diff --git a/packages/plugins/@nocobase/plugin-workflow-aggregate/LICENSE b/packages/plugins/@nocobase/plugin-workflow-aggregate/LICENSE
new file mode 100644
index 0000000000..0ad25db4bd
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-aggregate/LICENSE
@@ -0,0 +1,661 @@
+ GNU AFFERO GENERAL PUBLIC LICENSE
+ Version 3, 19 November 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ 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,
+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
+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
+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
+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
+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
+ensure that, in such cases, the modified source code becomes available
+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
+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
+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
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "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
+works, such as semiconductor masks.
+
+ "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
+in a fashion requiring copyright permission, other than the making of an
+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
+on the Program.
+
+ 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,
+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
+a computer network, with no transfer of a copy, is not conveying.
+
+ 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
+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.
+
+ 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
+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
+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
+"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 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
+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
+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
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ 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
+covered work is covered by this License only if the output, given its
+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
+convey, without conditions so long as your license otherwise remains
+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
+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
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ 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
+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
+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.
+
+ 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
+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,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ 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:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ 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
+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
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ 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:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ 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
+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
+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
+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
+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,
+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
+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
+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
+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
+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
+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,
+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.
+
+ "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
+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
+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
+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
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ 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
+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
+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
+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
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ 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
+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
+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
+licenses of parties who have received copies or rights from you under
+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.
+
+ 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,
+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
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ 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
+for enforcing compliance by third parties with this License.
+
+ 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
+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
+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
+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.
+
+ 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
+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
+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
+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
+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
+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,
+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,
+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
+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
+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
+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
+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
+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
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+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
+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.
+
+ 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
+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
+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.
+
+ 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
+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
+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
+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.
+
+ 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
+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
+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
+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
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 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
+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
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ 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
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+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.
+
+ 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
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ 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 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.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ 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
+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
+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,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU AGPL, see
+.
diff --git a/packages/plugins/@nocobase/plugin-workflow-aggregate/README.md b/packages/plugins/@nocobase/plugin-workflow-aggregate/README.md
new file mode 100644
index 0000000000..e83d0373a4
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-aggregate/README.md
@@ -0,0 +1,9 @@
+# workflow
+
+English | [中文](./README.zh-CN.md)
+
+## 安装激活
+
+内置插件无需手动安装激活。
+
+## 使用方法
diff --git a/packages/plugins/@nocobase/plugin-workflow-aggregate/README.zh-CN.md b/packages/plugins/@nocobase/plugin-workflow-aggregate/README.zh-CN.md
new file mode 100644
index 0000000000..e690848dd1
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-aggregate/README.zh-CN.md
@@ -0,0 +1,9 @@
+# workflow
+
+[English](./README.md) | 中文
+
+## 安装激活
+
+内置插件无需手动安装激活。
+
+## 使用方法
diff --git a/packages/plugins/@nocobase/plugin-workflow-aggregate/client.d.ts b/packages/plugins/@nocobase/plugin-workflow-aggregate/client.d.ts
new file mode 100644
index 0000000000..6c459cbac4
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-aggregate/client.d.ts
@@ -0,0 +1,2 @@
+export * from './dist/client';
+export { default } from './dist/client';
diff --git a/packages/plugins/@nocobase/plugin-workflow-aggregate/client.js b/packages/plugins/@nocobase/plugin-workflow-aggregate/client.js
new file mode 100644
index 0000000000..b6e3be70e6
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-aggregate/client.js
@@ -0,0 +1 @@
+module.exports = require('./dist/client/index.js');
diff --git a/packages/plugins/@nocobase/plugin-workflow-aggregate/package.json b/packages/plugins/@nocobase/plugin-workflow-aggregate/package.json
new file mode 100644
index 0000000000..1cc040d3e8
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-aggregate/package.json
@@ -0,0 +1,24 @@
+{
+ "name": "@nocobase/plugin-workflow-aggregate",
+ "displayName": "Workflow: Aggregate node",
+ "displayName.zh-CN": "工作流:聚合查询节点",
+ "description": "Used to aggregate data against the database in workflow, such as: statistics, sum, average, etc.",
+ "description.zh-CN": "可用于在工作流中对数据库进行聚合查询,如:统计数量、求和、平均值等。",
+ "version": "0.17.0-alpha.3",
+ "license": "AGPL-3.0",
+ "main": "./dist/server/index.js",
+ "devDependencies": {
+ "antd": "5.x",
+ "react": "18.x",
+ "react-i18next": "^11.15.1"
+ },
+ "peerDependencies": {
+ "@nocobase/client": "0.x",
+ "@nocobase/database": "0.x",
+ "@nocobase/plugin-workflow": ">=0.17.0-alpha.3",
+ "@nocobase/plugin-workflow-test": ">=0.17.0-alpha.3",
+ "@nocobase/server": "0.x",
+ "@nocobase/test": "0.x"
+ },
+ "gitHead": "ce588eefb0bfc50f7d5bbee575e0b5e843bf6644"
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-aggregate/server.d.ts b/packages/plugins/@nocobase/plugin-workflow-aggregate/server.d.ts
new file mode 100644
index 0000000000..c41081ddc6
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-aggregate/server.d.ts
@@ -0,0 +1,2 @@
+export * from './dist/server';
+export { default } from './dist/server';
diff --git a/packages/plugins/@nocobase/plugin-workflow-aggregate/server.js b/packages/plugins/@nocobase/plugin-workflow-aggregate/server.js
new file mode 100644
index 0000000000..972842039a
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-aggregate/server.js
@@ -0,0 +1 @@
+module.exports = require('./dist/server/index.js');
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/aggregate.tsx b/packages/plugins/@nocobase/plugin-workflow-aggregate/src/client/AggregateInstruction.tsx
similarity index 86%
rename from packages/plugins/@nocobase/plugin-workflow/src/client/nodes/aggregate.tsx
rename to packages/plugins/@nocobase/plugin-workflow-aggregate/src/client/AggregateInstruction.tsx
index 0b4f725e5b..11bf256a3c 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/aggregate.tsx
+++ b/packages/plugins/@nocobase/plugin-workflow-aggregate/src/client/AggregateInstruction.tsx
@@ -5,17 +5,25 @@ import React, { useCallback, useEffect, useState } from 'react';
import {
SchemaComponentContext,
SchemaInitializerItemType,
+ css,
useCollectionDataSource,
+ useCollectionFilterOptions,
useCollectionManager,
useCompile,
} from '@nocobase/client';
-import { FieldsSelect } from '../components/FieldsSelect';
-import { FilterDynamicComponent } from '../components/FilterDynamicComponent';
-import { ValueBlock } from '../components/ValueBlock';
-import { NAMESPACE, lang } from '../locale';
-import { collection, filter } from '../schemas/collection';
-import { BaseTypeSets, defaultFieldNames, nodesOptions, triggerOptions } from '../variable';
+import {
+ FieldsSelect,
+ FilterDynamicComponent,
+ ValueBlock,
+ BaseTypeSets,
+ defaultFieldNames,
+ nodesOptions,
+ triggerOptions,
+ Instruction,
+} from '@nocobase/plugin-workflow/client';
+
+import { NAMESPACE, useLang } from '../locale';
function matchToManyField(field): boolean {
// const fieldPrefix = `${field.name}.`;
@@ -136,12 +144,12 @@ function AssociatedConfig({ value, onChange, ...props }): JSX.Element {
// { key: '{{$context.data.id}}', collection: "collection.association", field }
// select data based
-export default {
- title: `{{t("Aggregate", { ns: "${NAMESPACE}" })}}`,
- type: 'aggregate',
- group: 'collection',
- description: `{{t("Counting, summing, finding maximum, minimum, and average values for multiple records of a collection or associated data of a record.", { ns: "${NAMESPACE}" })}}`,
- fieldset: {
+export default class extends Instruction {
+ title = `{{t("Aggregate", { ns: "${NAMESPACE}" })}}`;
+ type = 'aggregate';
+ group = 'collection';
+ description = `{{t("Counting, summing, finding maximum, minimum, and average values for multiple records of a collection or associated data of a record.", { ns: "${NAMESPACE}" })}}`;
+ fieldset = {
aggregator: {
type: 'string',
title: `{{t("Aggregator function", { ns: "${NAMESPACE}" })}}`,
@@ -206,14 +214,12 @@ export default {
'x-component': 'Grid.Col',
properties: {
collection: {
- ...collection,
+ type: 'string',
+ required: true,
+ 'x-decorator': 'FormItem',
+ 'x-component': 'CollectionSelect',
title: `{{t("Data of collection", { ns: "${NAMESPACE}" })}}`,
- 'x-component-props': {
- ...collection['x-component-props'],
- className: null,
- },
'x-reactions': [
- ...collection['x-reactions'],
{
dependencies: ['associated'],
fulfill: {
@@ -320,7 +326,24 @@ export default {
],
},
filter: {
- ...filter,
+ type: 'object',
+ title: '{{t("Filter")}}',
+ 'x-decorator': 'FormItem',
+ 'x-component': 'Filter',
+ 'x-component-props': {
+ useProps() {
+ const { values } = useForm();
+ const options = useCollectionFilterOptions(values?.collection);
+ return {
+ options,
+ className: css`
+ position: relative;
+ width: 100%;
+ `,
+ };
+ },
+ dynamicComponent: 'FilterDynamicComponent',
+ },
'x-reactions': [
{
dependencies: ['collection'],
@@ -334,18 +357,17 @@ export default {
},
},
},
- },
- view: {},
- scope: {
+ };
+ scope = {
useCollectionDataSource,
- },
- components: {
+ };
+ components = {
SchemaComponentContext,
FilterDynamicComponent,
FieldsSelect,
ValueBlock,
AssociatedConfig,
- },
+ };
useVariables({ key, title }, { types, fieldNames = defaultFieldNames }) {
if (
types &&
@@ -357,19 +379,21 @@ export default {
[fieldNames.value]: key,
[fieldNames.label]: title,
};
- },
+ }
useInitializers(node): SchemaInitializerItemType | null {
+ // eslint-disable-next-line react-hooks/rules-of-hooks
+ const resultTitle = useLang('Query result');
if (!node.config.collection) {
return null;
}
return {
- name: node.title ?? `#${node.id}`,
+ name: `#${node.id}`,
type: 'item',
title: node.title ?? `#${node.id}`,
Component: ValueBlock.Initializer,
node,
- resultTitle: lang('Query result'),
+ resultTitle,
};
- },
-};
+ }
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-aggregate/src/client/index.ts b/packages/plugins/@nocobase/plugin-workflow-aggregate/src/client/index.ts
new file mode 100644
index 0000000000..b39b536de7
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-aggregate/src/client/index.ts
@@ -0,0 +1,19 @@
+import { Plugin } from '@nocobase/client';
+import WorkflowPlugin from '@nocobase/plugin-workflow/client';
+
+import AggregateInstruction from './AggregateInstruction';
+
+export default class extends Plugin {
+ async afterAdd() {
+ // await this.app.pm.add()
+ }
+
+ async beforeLoad() {}
+
+ // You can get and modify the app instance here
+ async load() {
+ const workflow = this.app.pm.get('workflow') as WorkflowPlugin;
+ const aggregateInstruction = new AggregateInstruction();
+ workflow.instructions.register(aggregateInstruction.type, aggregateInstruction);
+ }
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-aggregate/src/index.ts b/packages/plugins/@nocobase/plugin-workflow-aggregate/src/index.ts
new file mode 100644
index 0000000000..7e74612df8
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-aggregate/src/index.ts
@@ -0,0 +1,2 @@
+export * from './server';
+export { default } from './server';
diff --git a/packages/plugins/@nocobase/plugin-workflow-aggregate/src/locale/en-US.json b/packages/plugins/@nocobase/plugin-workflow-aggregate/src/locale/en-US.json
new file mode 100644
index 0000000000..ea7c9f8555
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-aggregate/src/locale/en-US.json
@@ -0,0 +1,12 @@
+{
+ "Aggregate": "Aggregate",
+ "Counting, summing, finding maximum, minimum, and average values for multiple records of a collection or associated data of a record.":
+ "Counting, summing, finding maximum, minimum, and average values for multiple records of a collection or associated data of a record.",
+ "Aggregator function": "Aggregator function",
+ "Target type": "Target type",
+ "Data of collection": "Data of collection",
+ "Data of associated collection": "Data of associated collection",
+ "Field to aggregate": "Field to aggregate",
+ "Distinct": "Distinct",
+ "Query result": "Query result"
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-aggregate/src/locale/index.ts b/packages/plugins/@nocobase/plugin-workflow-aggregate/src/locale/index.ts
new file mode 100644
index 0000000000..4c2c1a3e9d
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-aggregate/src/locale/index.ts
@@ -0,0 +1,12 @@
+import { useTranslation } from 'react-i18next';
+
+export const NAMESPACE = 'workflow-aggregate';
+
+export function useLang(key: string, options = {}) {
+ const { t } = usePluginTranslation(options);
+ return t(key);
+}
+
+export function usePluginTranslation(options) {
+ return useTranslation(NAMESPACE, options);
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-aggregate/src/locale/zh-CN.json b/packages/plugins/@nocobase/plugin-workflow-aggregate/src/locale/zh-CN.json
new file mode 100644
index 0000000000..f3b9df4362
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-aggregate/src/locale/zh-CN.json
@@ -0,0 +1,12 @@
+{
+ "Aggregate": "聚合查询",
+ "Counting, summing, finding maximum, minimum, and average values for multiple records of a collection or associated data of a record.":
+ "对一个数据表里的多条数据或者一条数据里的关系数据进行统计、求和、求最大值、最小值、平均值。",
+ "Aggregator function": "聚合函数",
+ "Target type": "目标类型",
+ "Data of collection": "数据表数据",
+ "Data of associated collection": "关联数据表数据",
+ "Field to aggregate": "聚合字段",
+ "Distinct": "去重",
+ "Query result": "查询结果"
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/server/instructions/aggregate.ts b/packages/plugins/@nocobase/plugin-workflow-aggregate/src/server/AggregateInstruction.ts
similarity index 88%
rename from packages/plugins/@nocobase/plugin-workflow/src/server/instructions/aggregate.ts
rename to packages/plugins/@nocobase/plugin-workflow-aggregate/src/server/AggregateInstruction.ts
index 42c8d61783..4f3e7f4863 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/server/instructions/aggregate.ts
+++ b/packages/plugins/@nocobase/plugin-workflow-aggregate/src/server/AggregateInstruction.ts
@@ -1,8 +1,5 @@
import { BelongsToManyRepository, DataTypes, HasManyRepository } from '@nocobase/database';
-
-import Processor from '../Processor';
-import { JOB_STATUS } from '../constants';
-import type { FlowNodeModel } from '../types';
+import { Processor, Instruction, JOB_STATUS, FlowNodeModel } from '@nocobase/plugin-workflow';
const aggregators = {
count: 'count',
@@ -12,7 +9,7 @@ const aggregators = {
max: 'max',
};
-export default {
+export default class extends Instruction {
async run(node: FlowNodeModel, input, processor: Processor) {
const { aggregator, associated, collection, association = {}, params = {} } = node.config;
const options = processor.getParsedValue(params, node.id);
@@ -38,5 +35,5 @@ export default {
result: options.dataType === DataTypes.DOUBLE ? Number(result) : result,
status: JOB_STATUS.RESOLVED,
};
- },
-};
+ }
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-aggregate/src/server/Plugin.ts b/packages/plugins/@nocobase/plugin-workflow-aggregate/src/server/Plugin.ts
new file mode 100644
index 0000000000..2cde92f57b
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-aggregate/src/server/Plugin.ts
@@ -0,0 +1,14 @@
+import { Plugin } from '@nocobase/server';
+import WorkflowPlugin from '@nocobase/plugin-workflow';
+
+import AggregateInstruction from './AggregateInstruction';
+
+export default class extends Plugin {
+ workflow: WorkflowPlugin;
+
+ async load() {
+ const workflowPlugin = this.app.getPlugin('workflow') as WorkflowPlugin;
+ this.workflow = workflowPlugin;
+ workflowPlugin.instructions.register('aggregate', new AggregateInstruction(workflowPlugin));
+ }
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/server/__tests__/instructions/aggregate.test.ts b/packages/plugins/@nocobase/plugin-workflow-aggregate/src/server/__tests__/instruction.test.ts
similarity index 97%
rename from packages/plugins/@nocobase/plugin-workflow/src/server/__tests__/instructions/aggregate.test.ts
rename to packages/plugins/@nocobase/plugin-workflow-aggregate/src/server/__tests__/instruction.test.ts
index 5b67c9523b..3bb1efe94b 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/server/__tests__/instructions/aggregate.test.ts
+++ b/packages/plugins/@nocobase/plugin-workflow-aggregate/src/server/__tests__/instruction.test.ts
@@ -1,6 +1,8 @@
-import { Application } from '@nocobase/server';
import Database from '@nocobase/database';
-import { getApp, sleep } from '..';
+import { Application } from '@nocobase/server';
+import { getApp, sleep } from '@nocobase/plugin-workflow-test';
+
+import Plugin from '..';
describe('workflow > instructions > aggregate', () => {
let app: Application;
@@ -12,16 +14,18 @@ describe('workflow > instructions > aggregate', () => {
let workflow;
beforeEach(async () => {
- app = await getApp();
+ app = await getApp({
+ plugins: [Plugin],
+ });
db = app.db;
WorkflowModel = db.getCollection('workflows').model;
+ WorkflowModel = db.getCollection('workflows').model;
PostRepo = db.getCollection('posts').repository;
CommentRepo = db.getCollection('comments').repository;
TagRepo = db.getCollection('tags').repository;
workflow = await WorkflowModel.create({
- title: 'test workflow',
enabled: true,
type: 'collection',
config: {
diff --git a/packages/plugins/@nocobase/plugin-workflow-aggregate/src/server/index.ts b/packages/plugins/@nocobase/plugin-workflow-aggregate/src/server/index.ts
new file mode 100644
index 0000000000..3b60b3bee9
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-aggregate/src/server/index.ts
@@ -0,0 +1 @@
+export { default } from './Plugin';
diff --git a/packages/plugins/@nocobase/plugin-workflow-delay/LICENSE b/packages/plugins/@nocobase/plugin-workflow-delay/LICENSE
new file mode 100644
index 0000000000..0ad25db4bd
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-delay/LICENSE
@@ -0,0 +1,661 @@
+ GNU AFFERO GENERAL PUBLIC LICENSE
+ Version 3, 19 November 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ 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,
+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
+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
+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
+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
+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
+ensure that, in such cases, the modified source code becomes available
+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
+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
+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
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "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
+works, such as semiconductor masks.
+
+ "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
+in a fashion requiring copyright permission, other than the making of an
+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
+on the Program.
+
+ 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,
+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
+a computer network, with no transfer of a copy, is not conveying.
+
+ 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
+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.
+
+ 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
+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
+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
+"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 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
+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
+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
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ 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
+covered work is covered by this License only if the output, given its
+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
+convey, without conditions so long as your license otherwise remains
+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
+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
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ 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
+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
+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.
+
+ 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
+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,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ 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:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ 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
+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
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ 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:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ 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
+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
+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
+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
+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,
+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
+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
+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
+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
+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
+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,
+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.
+
+ "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
+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
+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
+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
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ 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
+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
+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
+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
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ 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
+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
+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
+licenses of parties who have received copies or rights from you under
+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.
+
+ 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,
+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
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ 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
+for enforcing compliance by third parties with this License.
+
+ 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
+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
+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
+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.
+
+ 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
+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
+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
+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
+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
+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,
+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,
+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
+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
+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
+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
+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
+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
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+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
+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.
+
+ 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
+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
+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.
+
+ 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
+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
+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
+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.
+
+ 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
+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
+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
+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
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 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
+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
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ 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
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+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.
+
+ 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
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ 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 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.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ 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
+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
+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,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU AGPL, see
+.
diff --git a/packages/plugins/@nocobase/plugin-workflow-delay/README.md b/packages/plugins/@nocobase/plugin-workflow-delay/README.md
new file mode 100644
index 0000000000..e83d0373a4
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-delay/README.md
@@ -0,0 +1,9 @@
+# workflow
+
+English | [中文](./README.zh-CN.md)
+
+## 安装激活
+
+内置插件无需手动安装激活。
+
+## 使用方法
diff --git a/packages/plugins/@nocobase/plugin-workflow-delay/README.zh-CN.md b/packages/plugins/@nocobase/plugin-workflow-delay/README.zh-CN.md
new file mode 100644
index 0000000000..e690848dd1
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-delay/README.zh-CN.md
@@ -0,0 +1,9 @@
+# workflow
+
+[English](./README.md) | 中文
+
+## 安装激活
+
+内置插件无需手动安装激活。
+
+## 使用方法
diff --git a/packages/plugins/@nocobase/plugin-workflow-delay/client.d.ts b/packages/plugins/@nocobase/plugin-workflow-delay/client.d.ts
new file mode 100644
index 0000000000..6c459cbac4
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-delay/client.d.ts
@@ -0,0 +1,2 @@
+export * from './dist/client';
+export { default } from './dist/client';
diff --git a/packages/plugins/@nocobase/plugin-workflow-delay/client.js b/packages/plugins/@nocobase/plugin-workflow-delay/client.js
new file mode 100644
index 0000000000..b6e3be70e6
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-delay/client.js
@@ -0,0 +1 @@
+module.exports = require('./dist/client/index.js');
diff --git a/packages/plugins/@nocobase/plugin-workflow-delay/package.json b/packages/plugins/@nocobase/plugin-workflow-delay/package.json
new file mode 100644
index 0000000000..51a1bdd3cf
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-delay/package.json
@@ -0,0 +1,24 @@
+{
+ "name": "@nocobase/plugin-workflow-delay",
+ "displayName": "Workflow: Delay node",
+ "displayName.zh-CN": "工作流:延时节点",
+ "description": "Could be used in workflow parallel branch for waiting other branches.",
+ "description.zh-CN": "可用于工作流并行分支中等待其他分支执行完成。",
+ "version": "0.17.0-alpha.3",
+ "license": "AGPL-3.0",
+ "main": "./dist/server/index.js",
+ "devDependencies": {
+ "antd": "5.x",
+ "react": "18.x",
+ "react-i18next": "^11.15.1"
+ },
+ "peerDependencies": {
+ "@nocobase/client": "0.x",
+ "@nocobase/database": "0.x",
+ "@nocobase/plugin-workflow": ">=0.17.0-alpha.3",
+ "@nocobase/plugin-workflow-test": ">=0.17.0-alpha.3",
+ "@nocobase/server": "0.x",
+ "@nocobase/test": "0.x"
+ },
+ "gitHead": "ce588eefb0bfc50f7d5bbee575e0b5e843bf6644"
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-delay/server.d.ts b/packages/plugins/@nocobase/plugin-workflow-delay/server.d.ts
new file mode 100644
index 0000000000..c41081ddc6
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-delay/server.d.ts
@@ -0,0 +1,2 @@
+export * from './dist/server';
+export { default } from './dist/server';
diff --git a/packages/plugins/@nocobase/plugin-workflow-delay/server.js b/packages/plugins/@nocobase/plugin-workflow-delay/server.js
new file mode 100644
index 0000000000..972842039a
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-delay/server.js
@@ -0,0 +1 @@
+module.exports = require('./dist/server/index.js');
diff --git a/packages/plugins/@nocobase/plugin-workflow-delay/src/client/DelayInstruction.tsx b/packages/plugins/@nocobase/plugin-workflow-delay/src/client/DelayInstruction.tsx
new file mode 100644
index 0000000000..a6eb137e58
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-delay/src/client/DelayInstruction.tsx
@@ -0,0 +1,87 @@
+import React from 'react';
+import { InputNumber, Select } from 'antd';
+import { css, useCompile } from '@nocobase/client';
+import { Instruction, JOB_STATUS } from '@nocobase/plugin-workflow/client';
+
+import { NAMESPACE } from '../locale';
+
+const UnitOptions = [
+ { value: 1_000, label: `{{t('Seconds', { ns: "workflow" })}}` },
+ { value: 60_000, label: `{{t('Minutes', { ns: "workflow" })}}` },
+ { value: 3600_000, label: `{{t('Hours', { ns: "workflow" })}}` },
+ { value: 86400_000, label: `{{t('Days', { ns: "workflow" })}}` },
+ { value: 604800_000, label: `{{t('Weeks', { ns: "workflow" })}}` },
+];
+
+function getNumberOption(v) {
+ return UnitOptions.slice()
+ .reverse()
+ .find((item) => !(v % item.value));
+}
+
+function Duration({ value = 60000, onChange }) {
+ const compile = useCompile();
+ const option = getNumberOption(value);
+ const quantity = Math.round(value / option.value);
+
+ return (
+
+ );
+}
+
+export default class extends Instruction {
+ title = `{{t("Delay", { ns: "${NAMESPACE}" })}}`;
+ type = 'delay';
+ group = 'control';
+ description = `{{t("Delay a period of time and then continue or exit the process. Can be used to set wait or timeout times in parallel branches.", { ns: "${NAMESPACE}" })}}`;
+ fieldset = {
+ duration: {
+ type: 'number',
+ title: `{{t("Duration", { ns: "${NAMESPACE}" })}}`,
+ 'x-decorator': 'FormItem',
+ 'x-component': 'Duration',
+ default: 60000,
+ required: true,
+ },
+ endStatus: {
+ type: 'number',
+ title: `{{t("End Status", { ns: "${NAMESPACE}" })}}`,
+ 'x-decorator': 'FormItem',
+ 'x-component': 'Radio.Group',
+ enum: [
+ { label: `{{t("Succeed and continue", { ns: "${NAMESPACE}" })}}`, value: JOB_STATUS.RESOLVED },
+ { label: `{{t("Fail and exit", { ns: "${NAMESPACE}" })}}`, value: JOB_STATUS.FAILED },
+ ],
+ required: true,
+ default: JOB_STATUS.RESOLVED,
+ },
+ };
+ components = {
+ Duration,
+ };
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-delay/src/client/index.ts b/packages/plugins/@nocobase/plugin-workflow-delay/src/client/index.ts
new file mode 100644
index 0000000000..98afe99e23
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-delay/src/client/index.ts
@@ -0,0 +1,19 @@
+import { Plugin } from '@nocobase/client';
+import WorkflowPlugin from '@nocobase/plugin-workflow/client';
+
+import DelayInstruction from './DelayInstruction';
+
+export default class extends Plugin {
+ async afterAdd() {
+ // await this.app.pm.add()
+ }
+
+ async beforeLoad() {}
+
+ // You can get and modify the app instance here
+ async load() {
+ const workflow = this.app.pm.get('workflow') as WorkflowPlugin;
+ const delayInstruction = new DelayInstruction();
+ workflow.instructions.register(delayInstruction.type, delayInstruction);
+ }
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-delay/src/index.ts b/packages/plugins/@nocobase/plugin-workflow-delay/src/index.ts
new file mode 100644
index 0000000000..7e74612df8
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-delay/src/index.ts
@@ -0,0 +1,2 @@
+export * from './server';
+export { default } from './server';
diff --git a/packages/plugins/@nocobase/plugin-workflow-delay/src/locale/en-US.json b/packages/plugins/@nocobase/plugin-workflow-delay/src/locale/en-US.json
new file mode 100644
index 0000000000..f664b9afa2
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-delay/src/locale/en-US.json
@@ -0,0 +1,9 @@
+{
+ "Delay": "Delay",
+ "Delay a period of time and then continue or exit the process. Can be used to set wait or timeout times in parallel branches.": "Delay a period of time and then continue or exit the process. Can be used to set wait or timeout times in parallel branches.",
+ "Duration": "Duration",
+ "End Status": "End Status",
+ "Select status": "Select status",
+ "Succeed and continue": "Succeed and continue",
+ "Fail and exit": "Fail and exit"
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-delay/src/locale/es-ES.json b/packages/plugins/@nocobase/plugin-workflow-delay/src/locale/es-ES.json
new file mode 100644
index 0000000000..eec82769a0
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-delay/src/locale/es-ES.json
@@ -0,0 +1,8 @@
+{
+ "Delay": "Retraso",
+ "Duration": "Duración",
+ "End Status": "Estado Final",
+ "Select status": "Seleccionar estado",
+ "Succeed and continue": "Éxito y continuar",
+ "Fail and exit": "Falla y sale"
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-delay/src/locale/fr-FR.json b/packages/plugins/@nocobase/plugin-workflow-delay/src/locale/fr-FR.json
new file mode 100644
index 0000000000..c084f5852c
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-delay/src/locale/fr-FR.json
@@ -0,0 +1,8 @@
+{
+ "Delay": "Délai",
+ "Duration": "Durée",
+ "End Status": "Statut de fin",
+ "Select status": "Sélectionner un statut",
+ "Succeed and continue": "Réussir et continuer",
+ "Fail and exit": "Échouer et quitter"
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-delay/src/locale/index.ts b/packages/plugins/@nocobase/plugin-workflow-delay/src/locale/index.ts
new file mode 100644
index 0000000000..c8f617e676
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-delay/src/locale/index.ts
@@ -0,0 +1,12 @@
+import { useTranslation } from 'react-i18next';
+
+export const NAMESPACE = 'workflow-delay';
+
+export function useLang(key: string, options = {}) {
+ const { t } = usePluginTranslation(options);
+ return t(key);
+}
+
+export function usePluginTranslation(options) {
+ return useTranslation(NAMESPACE, options);
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-delay/src/locale/pt-BR.json b/packages/plugins/@nocobase/plugin-workflow-delay/src/locale/pt-BR.json
new file mode 100644
index 0000000000..cd73e9f56b
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-delay/src/locale/pt-BR.json
@@ -0,0 +1,8 @@
+{
+ "Delay": "Atraso",
+ "Duration": "Duração",
+ "End Status": "Status final",
+ "Select status": "Selecionar status",
+ "Succeed and continue": "Ter sucesso e continuar",
+ "Fail and exit": "Falhar e sair"
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-delay/src/locale/zh-CN.json b/packages/plugins/@nocobase/plugin-workflow-delay/src/locale/zh-CN.json
new file mode 100644
index 0000000000..04f0c3d887
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-delay/src/locale/zh-CN.json
@@ -0,0 +1,9 @@
+{
+ "Delay": "延时",
+ "Delay a period of time and then continue or exit the process. Can be used to set wait or timeout times in parallel branches.": "延时一段时间,然后继续或退出流程。可以用于并行分支中等待其他分支或设置超时时间。",
+ "Duration": "时长",
+ "End Status": "到时状态",
+ "Select status": "选择状态",
+ "Succeed and continue": "通过并继续",
+ "Fail and exit": "失败并退出"
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/server/instructions/delay.ts b/packages/plugins/@nocobase/plugin-workflow-delay/src/server/DelayInstruction.ts
similarity index 81%
rename from packages/plugins/@nocobase/plugin-workflow/src/server/instructions/delay.ts
rename to packages/plugins/@nocobase/plugin-workflow-delay/src/server/DelayInstruction.ts
index 57c667f2bd..66d5e68bb3 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/server/instructions/delay.ts
+++ b/packages/plugins/@nocobase/plugin-workflow-delay/src/server/DelayInstruction.ts
@@ -1,8 +1,10 @@
-import Plugin from '..';
-import { EXECUTION_STATUS, JOB_STATUS } from '../constants';
-import Processor from '../Processor';
-import { Instruction } from '.';
-import type { ExecutionModel, JobModel } from '../types';
+import WorkflowPlugin, {
+ Processor,
+ Instruction,
+ JOB_STATUS,
+ JobModel,
+ EXECUTION_STATUS,
+} from '@nocobase/plugin-workflow';
type ValueOf = T[keyof T];
@@ -11,11 +13,13 @@ interface DelayConfig {
duration: number;
}
-export default class implements Instruction {
+export default class extends Instruction {
timers: Map = new Map();
- constructor(protected plugin: Plugin) {
- plugin.app.on('beforeStart', this.load);
+ constructor(public plugin: WorkflowPlugin) {
+ super(plugin);
+
+ plugin.app.on('afterStart', this.load);
plugin.app.on('beforeStop', this.unload);
}
@@ -82,7 +86,7 @@ export default class implements Instruction {
}
}
- run = async (node, prevJob, processor: Processor) => {
+ async run(node, prevJob, processor: Processor) {
const job = await processor.saveJob({
status: JOB_STATUS.PENDING,
result: null,
@@ -95,11 +99,11 @@ export default class implements Instruction {
this.schedule(job);
return processor.exit();
- };
+ }
- resume = async (node, prevJob, processor: Processor) => {
+ async resume(node, prevJob, processor: Processor) {
const { endStatus } = node.config as DelayConfig;
prevJob.set('status', endStatus);
return prevJob;
- };
+ }
}
diff --git a/packages/plugins/@nocobase/plugin-workflow-delay/src/server/Plugin.ts b/packages/plugins/@nocobase/plugin-workflow-delay/src/server/Plugin.ts
new file mode 100644
index 0000000000..baab4fd11c
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-delay/src/server/Plugin.ts
@@ -0,0 +1,14 @@
+import { Plugin } from '@nocobase/server';
+import WorkflowPlugin from '@nocobase/plugin-workflow';
+
+import DelayInstruction from './DelayInstruction';
+
+export default class extends Plugin {
+ workflow: WorkflowPlugin;
+
+ async load() {
+ const workflowPlugin = this.app.getPlugin('workflow') as WorkflowPlugin;
+ this.workflow = workflowPlugin;
+ workflowPlugin.instructions.register('delay', new DelayInstruction(workflowPlugin));
+ }
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/server/__tests__/instructions/delay.test.ts b/packages/plugins/@nocobase/plugin-workflow-delay/src/server/__tests__/instruction.test.ts
similarity index 92%
rename from packages/plugins/@nocobase/plugin-workflow/src/server/__tests__/instructions/delay.test.ts
rename to packages/plugins/@nocobase/plugin-workflow-delay/src/server/__tests__/instruction.test.ts
index 5fb3e4cd1b..170a4f5d73 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/server/__tests__/instructions/delay.test.ts
+++ b/packages/plugins/@nocobase/plugin-workflow-delay/src/server/__tests__/instruction.test.ts
@@ -1,7 +1,11 @@
+import path from 'path';
+
import Database from '@nocobase/database';
import { Application } from '@nocobase/server';
-import { getApp, sleep } from '..';
-import { EXECUTION_STATUS, JOB_STATUS } from '../../constants';
+import { EXECUTION_STATUS, JOB_STATUS } from '@nocobase/plugin-workflow';
+import { getApp, sleep } from '@nocobase/plugin-workflow-test';
+
+import Plugin from '..';
describe('workflow > instructions > delay', () => {
let app: Application;
@@ -9,12 +13,16 @@ describe('workflow > instructions > delay', () => {
let PostRepo;
let WorkflowModel;
let workflow;
+ let plugin;
beforeEach(async () => {
- app = await getApp();
+ app = await getApp({
+ plugins: [Plugin],
+ collectionPath: path.join(__dirname, './collections'),
+ });
+ plugin = app.pm.get('workflow');
db = app.db;
-
WorkflowModel = db.getCollection('workflows').model;
PostRepo = db.getCollection('posts').repository;
@@ -171,7 +179,7 @@ describe('workflow > instructions > delay', () => {
await sleep(2000);
await app.start();
- await sleep(500);
+ await sleep(1000);
const [e2] = await workflow.getExecutions();
expect(e2.status).toEqual(EXECUTION_STATUS.RESOLVED);
diff --git a/packages/plugins/@nocobase/plugin-workflow-delay/src/server/index.ts b/packages/plugins/@nocobase/plugin-workflow-delay/src/server/index.ts
new file mode 100644
index 0000000000..3b60b3bee9
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-delay/src/server/index.ts
@@ -0,0 +1 @@
+export { default } from './Plugin';
diff --git a/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/LICENSE b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/LICENSE
new file mode 100644
index 0000000000..0ad25db4bd
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/LICENSE
@@ -0,0 +1,661 @@
+ GNU AFFERO GENERAL PUBLIC LICENSE
+ Version 3, 19 November 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ 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,
+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
+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
+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
+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
+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
+ensure that, in such cases, the modified source code becomes available
+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
+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
+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
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "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
+works, such as semiconductor masks.
+
+ "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
+in a fashion requiring copyright permission, other than the making of an
+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
+on the Program.
+
+ 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,
+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
+a computer network, with no transfer of a copy, is not conveying.
+
+ 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
+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.
+
+ 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
+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
+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
+"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 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
+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
+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
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ 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
+covered work is covered by this License only if the output, given its
+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
+convey, without conditions so long as your license otherwise remains
+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
+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
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ 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
+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
+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.
+
+ 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
+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,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ 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:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ 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
+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
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ 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:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ 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
+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
+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
+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
+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,
+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
+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
+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
+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
+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
+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,
+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.
+
+ "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
+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
+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
+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
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ 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
+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
+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
+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
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ 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
+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
+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
+licenses of parties who have received copies or rights from you under
+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.
+
+ 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,
+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
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ 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
+for enforcing compliance by third parties with this License.
+
+ 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
+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
+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
+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.
+
+ 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
+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
+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
+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
+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
+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,
+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,
+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
+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
+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
+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
+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
+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
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+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
+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.
+
+ 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
+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
+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.
+
+ 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
+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
+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
+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.
+
+ 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
+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
+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
+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
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 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
+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
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ 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
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+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.
+
+ 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
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ 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 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.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ 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
+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
+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,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU AGPL, see
+.
diff --git a/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/README.md b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/README.md
new file mode 100644
index 0000000000..e83d0373a4
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/README.md
@@ -0,0 +1,9 @@
+# workflow
+
+English | [中文](./README.zh-CN.md)
+
+## 安装激活
+
+内置插件无需手动安装激活。
+
+## 使用方法
diff --git a/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/README.zh-CN.md b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/README.zh-CN.md
new file mode 100644
index 0000000000..e690848dd1
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/README.zh-CN.md
@@ -0,0 +1,9 @@
+# workflow
+
+[English](./README.md) | 中文
+
+## 安装激活
+
+内置插件无需手动安装激活。
+
+## 使用方法
diff --git a/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/client.d.ts b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/client.d.ts
new file mode 100644
index 0000000000..6c459cbac4
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/client.d.ts
@@ -0,0 +1,2 @@
+export * from './dist/client';
+export { default } from './dist/client';
diff --git a/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/client.js b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/client.js
new file mode 100644
index 0000000000..b6e3be70e6
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/client.js
@@ -0,0 +1 @@
+module.exports = require('./dist/client/index.js');
diff --git a/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/package.json b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/package.json
new file mode 100644
index 0000000000..b153a3d9f3
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/package.json
@@ -0,0 +1,33 @@
+{
+ "name": "@nocobase/plugin-workflow-dynamic-calculation",
+ "displayName": "Workflow: Dynamic calculation node",
+ "displayName.zh-CN": "工作流:动态表达式计算节点",
+ "description": "Useful plugin for doing dynamic calculation based on expression collection records in workflow.",
+ "description.zh-CN": "用于在工作流中进行基于数据行的动态表达式计算。",
+ "version": "0.17.0-alpha.3",
+ "license": "AGPL-3.0",
+ "main": "./dist/server/index.js",
+ "devDependencies": {
+ "@ant-design/icons": "5.x",
+ "@formily/antd-v5": "1.x",
+ "@formily/core": "2.x",
+ "@formily/react": "2.x",
+ "antd": "5.x",
+ "lodash": "4.17.21",
+ "react": "18.x",
+ "react-i18next": "^11.15.1",
+ "react-router-dom": "^6.11.2"
+ },
+ "peerDependencies": {
+ "@nocobase/client": "0.x",
+ "@nocobase/database": "0.x",
+ "@nocobase/evaluators": "0.x",
+ "@nocobase/plugin-collection-manager": "0.x",
+ "@nocobase/plugin-workflow": ">=0.17.0-alpha.3",
+ "@nocobase/plugin-workflow-test": ">=0.17.0-alpha.3",
+ "@nocobase/server": "0.x",
+ "@nocobase/test": "0.x",
+ "@nocobase/utils": "0.x"
+ },
+ "gitHead": "ce588eefb0bfc50f7d5bbee575e0b5e843bf6644"
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/server.d.ts b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/server.d.ts
new file mode 100644
index 0000000000..c41081ddc6
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/server.d.ts
@@ -0,0 +1,2 @@
+export * from './dist/server';
+export { default } from './dist/server';
diff --git a/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/server.js b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/server.js
new file mode 100644
index 0000000000..972842039a
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/server.js
@@ -0,0 +1 @@
+module.exports = require('./dist/server/index.js');
diff --git a/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/client/DynamicCalculation.tsx b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/client/DynamicCalculation.tsx
new file mode 100644
index 0000000000..7ef3adcfbc
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/client/DynamicCalculation.tsx
@@ -0,0 +1,98 @@
+import React from 'react';
+
+import { SchemaInitializerItemType, Variable, useCollectionManager } from '@nocobase/client';
+import {
+ BaseTypeSets,
+ Instruction,
+ ValueBlock,
+ WorkflowVariableInput,
+ defaultFieldNames,
+ useWorkflowVariableOptions,
+} from '@nocobase/plugin-workflow/client';
+import { NAMESPACE, useLang } from '../locale';
+
+function useDynamicExpressionCollectionFieldMatcher(field): boolean {
+ if (!['belongsTo', 'hasOne'].includes(field.type)) {
+ return false;
+ }
+
+ if (this.getCollection(field.collectionName)?.template === 'expression') {
+ return true;
+ }
+
+ const fields = this.getCollectionFields(field.target);
+ return fields.some((f) => f.interface === 'expression');
+}
+
+function DynamicExpression({ value, onChange }) {
+ const { getCollectionFields, getCollection } = useCollectionManager();
+ const scope = useWorkflowVariableOptions({
+ types: [useDynamicExpressionCollectionFieldMatcher.bind({ getCollectionFields, getCollection })],
+ });
+
+ return ;
+}
+
+export default class extends Instruction {
+ title = `{{t("Dynamic Calculation", { ns: "${NAMESPACE}" })}}`;
+ type = 'dynamic-calculation';
+ group = 'control';
+ description = `{{t("Calculate an expression based on a calculation engine and obtain a value as the result. Variables in the upstream nodes can be used in the expression. The expression is dynamic one from an expression collections.", { ns: "${NAMESPACE}" })}}`;
+ fieldset = {
+ expression: {
+ type: 'string',
+ title: `{{t("Calculation expression", { ns: "${NAMESPACE}" })}}`,
+ 'x-decorator': 'FormItem',
+ 'x-component': 'DynamicExpression',
+ required: true,
+ },
+ scope: {
+ type: 'string',
+ title: `{{t("Variable datasource", { ns: "${NAMESPACE}" })}}`,
+ 'x-decorator': 'FormItem',
+ 'x-component': 'WorkflowVariableInput',
+ 'x-component-props': {
+ changeOnSelect: true,
+ variableOptions: {
+ types: [{ type: 'reference', options: { collection: '*', entity: true } }],
+ },
+ },
+ 'x-reactions': {
+ dependencies: ['expression'],
+ fulfill: {
+ state: {
+ visible: '{{$deps[0]}}',
+ },
+ },
+ },
+ },
+ };
+ components = {
+ DynamicExpression,
+ WorkflowVariableInput,
+ ValueBlock,
+ };
+ useVariables({ key, title }, { types, fieldNames = defaultFieldNames }) {
+ if (
+ types &&
+ !types.some((type) => type in BaseTypeSets || Object.values(BaseTypeSets).some((set) => set.has(type)))
+ ) {
+ return null;
+ }
+ return {
+ [fieldNames.value]: key,
+ [fieldNames.label]: title,
+ };
+ }
+ useInitializers(node): SchemaInitializerItemType {
+ return {
+ name: `#${node.id}`,
+ type: 'item',
+ title: node.title ?? `#${node.id}`,
+ Component: ValueBlock.Initializer,
+ node,
+ // eslint-disable-next-line react-hooks/rules-of-hooks
+ resultTitle: useLang('Calculation result'),
+ };
+ }
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/components/DynamicExpression.tsx b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/client/DynamicExpression.tsx
similarity index 96%
rename from packages/plugins/@nocobase/plugin-workflow/src/client/components/DynamicExpression.tsx
rename to packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/client/DynamicExpression.tsx
index 777173bd28..18fb22ecf5 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/client/components/DynamicExpression.tsx
+++ b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/client/DynamicExpression.tsx
@@ -5,9 +5,9 @@ import React, { useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useCollectionManager, useCompile, useRecord, Variable } from '@nocobase/client';
+import { getCollectionFieldOptions } from '@nocobase/plugin-workflow/client';
import { NAMESPACE } from '../locale';
-import { getCollectionFieldOptions } from '../variable';
const InternalExpression = observer(
(props: any) => {
diff --git a/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/client/Provider.tsx b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/client/Provider.tsx
new file mode 100644
index 0000000000..0777e42f6c
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/client/Provider.tsx
@@ -0,0 +1,22 @@
+import React from 'react';
+
+import { CollectionManagerContext, useCollectionManager } from '@nocobase/client';
+
+import expression from './expression';
+
+export function Provider(props) {
+ const cmCtx = useCollectionManager();
+ return (
+
+ {props.children}
+
+ );
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/interfaces/expression.tsx b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/client/expression.tsx
similarity index 100%
rename from packages/plugins/@nocobase/plugin-workflow/src/client/interfaces/expression.tsx
rename to packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/client/expression.tsx
diff --git a/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/client/index.ts b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/client/index.ts
new file mode 100644
index 0000000000..89809d6b83
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/client/index.ts
@@ -0,0 +1,28 @@
+import { Plugin } from '@nocobase/client';
+import WorkflowPlugin from '@nocobase/plugin-workflow/client';
+
+import { Provider } from './Provider';
+import DynamicCalculation from './DynamicCalculation';
+import { DynamicExpression } from './DynamicExpression';
+
+export default class extends Plugin {
+ async afterAdd() {
+ // await this.app.pm.add()
+ }
+
+ async beforeLoad() {}
+
+ // You can get and modify the app instance here
+ async load() {
+ this.app.addProvider(Provider);
+ const workflow = this.app.pm.get('workflow') as WorkflowPlugin;
+ const dynamicCalculation = new DynamicCalculation();
+ workflow.instructions.register(dynamicCalculation.type, dynamicCalculation);
+ }
+
+ addComponents() {
+ this.app.addComponents({
+ DynamicExpression,
+ });
+ }
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/index.ts b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/index.ts
new file mode 100644
index 0000000000..7e74612df8
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/index.ts
@@ -0,0 +1,2 @@
+export * from './server';
+export { default } from './server';
diff --git a/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/locale/en-US.json b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/locale/en-US.json
new file mode 100644
index 0000000000..5722e8719e
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/locale/en-US.json
@@ -0,0 +1,11 @@
+{
+ "Dynamic Calculation": "Dynamic Calculation",
+ "Calculate an expression based on a calculation engine and obtain a value as the result. Variables in the upstream nodes can be used in the expression. The expression is dynamic one from an expression collections.": "Calculate an expression based on a calculation engine and obtain a value as the result. Variables in the upstream nodes can be used in the expression. The expression is dynamic one from an expression collections.",
+ "Select dynamic expression": "Select dynamic expression",
+ "Select the dynamic expression queried from the upstream node. You need to query it from an expression collection.": "Select the dynamic expression queried from the upstream node. You need to query it from an expression collection.",
+ "Variable datasource": "Variable datasource",
+ "Dynamic expression": "Dynamic expression",
+ "An expression for calculation in each rows": "An expression for calculation in each rows",
+ "Unconfigured": "Unconfigured",
+ "Calculation result": "Calculation result"
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/locale/index.ts b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/locale/index.ts
new file mode 100644
index 0000000000..42335720f7
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/locale/index.ts
@@ -0,0 +1,12 @@
+import { useTranslation } from 'react-i18next';
+
+export const NAMESPACE = 'workflow-dynamic-calculation';
+
+export function useLang(key: string, options = {}) {
+ const { t } = usePluginTranslation(options);
+ return t(key);
+}
+
+export function usePluginTranslation(options) {
+ return useTranslation(NAMESPACE, options);
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/locale/zh-CN.json b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/locale/zh-CN.json
new file mode 100644
index 0000000000..3f7fc9a971
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/locale/zh-CN.json
@@ -0,0 +1,11 @@
+{
+ "Dynamic Calculation": "动态表达式计算",
+ "Calculate an expression based on a calculation engine and obtain a value as the result. Variables in the upstream nodes can be used in the expression. The expression is dynamic one from an expression collections.": "基于计算引擎计算表达式并获取值作为结果。可以在表达式中使用上游节点的变量。表达式是从表达式表中动态获取的。",
+ "Select dynamic expression": "选择动态表达式",
+ "Select the dynamic expression queried from the upstream node. You need to query it from an expression collection.": "从上游节点中选择查询出来的动态表达式。你需要从动态表达式类型的数据表中查询。",
+ "Variable datasource": "变量数据源",
+ "Dynamic expression": "动态表达式",
+ "An expression for calculation in each rows": "每行数据计算规则不同时使用",
+ "Unconfigured": "未配置",
+ "Calculation result": "运算结果"
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/server/DynamicCalculation.ts b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/server/DynamicCalculation.ts
new file mode 100644
index 0000000000..5b9d92ac78
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/server/DynamicCalculation.ts
@@ -0,0 +1,29 @@
+import { parse } from '@nocobase/utils';
+import { FlowNodeModel, Instruction, JOB_STATUS, Processor } from '@nocobase/plugin-workflow';
+import evaluators, { Evaluator } from '@nocobase/evaluators';
+
+export class DynamicCalculation extends Instruction {
+ async run(node: FlowNodeModel, prevJob, processor: Processor) {
+ let { engine = 'math.js', expression = '' } = node.config;
+ let scope = processor.getScope(node.id);
+ const parsed = parse(expression)(scope) ?? {};
+ engine = parsed.engine;
+ expression = parsed.expression;
+ scope = parse(node.config.scope ?? '')(scope) ?? {};
+
+ const evaluator = evaluators.get(engine);
+
+ try {
+ const result = evaluator && expression ? evaluator(expression, scope) : null;
+ return {
+ result,
+ status: JOB_STATUS.RESOLVED,
+ };
+ } catch (e) {
+ return {
+ result: e.toString(),
+ status: JOB_STATUS.ERROR,
+ };
+ }
+ }
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/server/Plugin.ts b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/server/Plugin.ts
new file mode 100644
index 0000000000..fe5e679236
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/server/Plugin.ts
@@ -0,0 +1,19 @@
+import { Plugin } from '@nocobase/server';
+import WorkflowPlugin from '@nocobase/plugin-workflow';
+
+import { ExpressionField } from './expression-field';
+import { DynamicCalculation } from './DynamicCalculation';
+
+export default class extends Plugin {
+ workflow: WorkflowPlugin;
+
+ async load() {
+ this.db.registerFieldTypes({
+ expression: ExpressionField,
+ });
+
+ const workflowPlugin = this.app.getPlugin('workflow') as WorkflowPlugin;
+ this.workflow = workflowPlugin;
+ workflowPlugin.instructions.register('dynamic-calculation', new DynamicCalculation(workflowPlugin));
+ }
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/server/__tests__/collections/categories.ts b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/server/__tests__/collections/categories.ts
new file mode 100644
index 0000000000..5368f7af27
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/server/__tests__/collections/categories.ts
@@ -0,0 +1,19 @@
+import { extendCollection } from '@nocobase/database';
+
+export default extendCollection({
+ name: 'categories',
+ fields: [
+ {
+ type: 'string',
+ name: 'engine',
+ },
+ {
+ type: 'string',
+ name: 'collection',
+ },
+ {
+ type: 'text',
+ name: 'expression',
+ },
+ ],
+});
diff --git a/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/server/__tests__/instruction.test.ts b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/server/__tests__/instruction.test.ts
new file mode 100644
index 0000000000..4959b587c5
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/server/__tests__/instruction.test.ts
@@ -0,0 +1,115 @@
+import path from 'path';
+
+import { MockServer } from '@nocobase/test';
+import { MockDatabase } from '@nocobase/database';
+import { getApp, sleep } from '@nocobase/plugin-workflow-test';
+
+import Plugin from '..';
+
+describe('workflow > instructions > calculation', () => {
+ let app: MockServer;
+ let db: MockDatabase;
+ let PostRepo;
+ let CategoryRepo;
+ let WorkflowModel;
+ let workflow;
+
+ beforeEach(async () => {
+ app = await getApp({
+ plugins: [Plugin],
+ collectionsPath: path.join(__dirname, 'collections'),
+ });
+
+ db = app.db;
+ WorkflowModel = db.getCollection('workflows').model;
+ PostRepo = db.getCollection('posts').repository;
+ CategoryRepo = db.getCollection('categories').repository;
+
+ workflow = await WorkflowModel.create({
+ title: 'test workflow',
+ enabled: true,
+ type: 'collection',
+ config: {
+ mode: 1,
+ collection: 'posts',
+ },
+ });
+ });
+
+ afterEach(() => app.destroy());
+
+ describe('dynamic expression', () => {
+ it('dynamic expression field in current table', async () => {
+ const n1 = await workflow.createNode({
+ type: 'dynamic-calculation',
+ config: {
+ expression: '{{$context.data.category}}',
+ scope: '{{$context.data}}',
+ },
+ });
+
+ const post = await PostRepo.create({
+ values: {
+ title: 't1',
+ category: {
+ engine: 'math.js',
+ expression: '1 + {{read}}',
+ },
+ },
+ });
+
+ await sleep(500);
+
+ const [execution] = await workflow.getExecutions();
+ const [job] = await execution.getJobs();
+ expect(job.result).toBe(1);
+ });
+
+ it('dynamic expression field in association table', async () => {
+ const n1 = await workflow.createNode({
+ type: 'query',
+ config: {
+ collection: 'categories',
+ params: {
+ filter: {
+ $and: [{ id: '{{$context.data.categoryId}}' }],
+ },
+ },
+ },
+ });
+
+ const n2 = await workflow.createNode({
+ type: 'dynamic-calculation',
+ config: {
+ expression: `{{$jobsMapByNodeKey.${n1.key}}}`,
+ scope: '{{$context.data}}',
+ },
+ upstreamId: n1.id,
+ });
+
+ await n1.setDownstream(n2);
+
+ const category = await CategoryRepo.create({
+ values: {
+ title: 'c1',
+ engine: 'math.js',
+ expression: '1 + {{read}}',
+ },
+ });
+
+ const post = await PostRepo.create({
+ values: {
+ title: 't1',
+ categoryId: category.id,
+ },
+ });
+
+ await sleep(500);
+
+ const [execution] = await workflow.getExecutions();
+ const jobs = await execution.getJobs({ order: [['id', 'ASC']] });
+ expect(jobs.length).toBe(2);
+ expect(jobs[1].result).toBe(1);
+ });
+ });
+});
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/server/fields/expression-field.ts b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/server/expression-field.ts
similarity index 100%
rename from packages/plugins/@nocobase/plugin-workflow/src/server/fields/expression-field.ts
rename to packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/server/expression-field.ts
diff --git a/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/server/index.ts b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/server/index.ts
new file mode 100644
index 0000000000..3b60b3bee9
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/server/index.ts
@@ -0,0 +1 @@
+export { default } from './Plugin';
diff --git a/packages/plugins/@nocobase/plugin-workflow-form-trigger/LICENSE b/packages/plugins/@nocobase/plugin-workflow-form-trigger/LICENSE
new file mode 100644
index 0000000000..0ad25db4bd
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-form-trigger/LICENSE
@@ -0,0 +1,661 @@
+ GNU AFFERO GENERAL PUBLIC LICENSE
+ Version 3, 19 November 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ 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,
+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
+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
+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
+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
+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
+ensure that, in such cases, the modified source code becomes available
+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
+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
+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
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "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
+works, such as semiconductor masks.
+
+ "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
+in a fashion requiring copyright permission, other than the making of an
+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
+on the Program.
+
+ 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,
+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
+a computer network, with no transfer of a copy, is not conveying.
+
+ 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
+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.
+
+ 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
+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
+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
+"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 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
+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
+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
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ 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
+covered work is covered by this License only if the output, given its
+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
+convey, without conditions so long as your license otherwise remains
+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
+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
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ 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
+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
+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.
+
+ 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
+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,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ 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:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ 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
+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
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ 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:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ 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
+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
+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
+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
+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,
+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
+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
+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
+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
+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
+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,
+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.
+
+ "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
+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
+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
+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
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ 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
+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
+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
+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
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ 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
+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
+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
+licenses of parties who have received copies or rights from you under
+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.
+
+ 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,
+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
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ 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
+for enforcing compliance by third parties with this License.
+
+ 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
+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
+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
+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.
+
+ 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
+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
+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
+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
+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
+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,
+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,
+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
+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
+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
+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
+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
+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
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+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
+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.
+
+ 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
+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
+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.
+
+ 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
+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
+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
+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.
+
+ 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
+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
+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
+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
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 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
+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
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ 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
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+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.
+
+ 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
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ 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 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.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ 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
+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
+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,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU AGPL, see
+.
diff --git a/packages/plugins/@nocobase/plugin-workflow-form-trigger/README.md b/packages/plugins/@nocobase/plugin-workflow-form-trigger/README.md
new file mode 100644
index 0000000000..e83d0373a4
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-form-trigger/README.md
@@ -0,0 +1,9 @@
+# workflow
+
+English | [中文](./README.zh-CN.md)
+
+## 安装激活
+
+内置插件无需手动安装激活。
+
+## 使用方法
diff --git a/packages/plugins/@nocobase/plugin-workflow-form-trigger/README.zh-CN.md b/packages/plugins/@nocobase/plugin-workflow-form-trigger/README.zh-CN.md
new file mode 100644
index 0000000000..e690848dd1
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-form-trigger/README.zh-CN.md
@@ -0,0 +1,9 @@
+# workflow
+
+[English](./README.md) | 中文
+
+## 安装激活
+
+内置插件无需手动安装激活。
+
+## 使用方法
diff --git a/packages/plugins/@nocobase/plugin-workflow-form-trigger/client.d.ts b/packages/plugins/@nocobase/plugin-workflow-form-trigger/client.d.ts
new file mode 100644
index 0000000000..6c459cbac4
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-form-trigger/client.d.ts
@@ -0,0 +1,2 @@
+export * from './dist/client';
+export { default } from './dist/client';
diff --git a/packages/plugins/@nocobase/plugin-workflow-form-trigger/client.js b/packages/plugins/@nocobase/plugin-workflow-form-trigger/client.js
new file mode 100644
index 0000000000..b6e3be70e6
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-form-trigger/client.js
@@ -0,0 +1 @@
+module.exports = require('./dist/client/index.js');
diff --git a/packages/plugins/@nocobase/plugin-workflow-form-trigger/package.json b/packages/plugins/@nocobase/plugin-workflow-form-trigger/package.json
new file mode 100644
index 0000000000..4127d22fc8
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-form-trigger/package.json
@@ -0,0 +1,24 @@
+{
+ "name": "@nocobase/plugin-workflow-form-trigger",
+ "displayName": "Workflow: Form trigger",
+ "displayName.zh-CN": "工作流:表单触发器",
+ "description": "Bind form buttons to trigger workflow events when submitting.",
+ "description.zh-CN": "可对表单按钮绑定,在提交时触发对应的工作流事件。",
+ "version": "0.17.0-alpha.3",
+ "license": "AGPL-3.0",
+ "main": "./dist/server/index.js",
+ "devDependencies": {
+ "antd": "5.x",
+ "react": "18.x",
+ "react-i18next": "^11.15.1"
+ },
+ "peerDependencies": {
+ "@nocobase/client": "0.x",
+ "@nocobase/database": "0.x",
+ "@nocobase/plugin-workflow": ">=0.17.0-alpha.3",
+ "@nocobase/plugin-workflow-test": ">=0.17.0-alpha.3",
+ "@nocobase/server": "0.x",
+ "@nocobase/test": "0.x"
+ },
+ "gitHead": "ce588eefb0bfc50f7d5bbee575e0b5e843bf6644"
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-form-trigger/server.d.ts b/packages/plugins/@nocobase/plugin-workflow-form-trigger/server.d.ts
new file mode 100644
index 0000000000..c41081ddc6
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-form-trigger/server.d.ts
@@ -0,0 +1,2 @@
+export * from './dist/server';
+export { default } from './dist/server';
diff --git a/packages/plugins/@nocobase/plugin-workflow-form-trigger/server.js b/packages/plugins/@nocobase/plugin-workflow-form-trigger/server.js
new file mode 100644
index 0000000000..972842039a
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-form-trigger/server.js
@@ -0,0 +1 @@
+module.exports = require('./dist/server/index.js');
diff --git a/packages/plugins/@nocobase/plugin-workflow-form-trigger/src/client/FormTrigger.tsx b/packages/plugins/@nocobase/plugin-workflow-form-trigger/src/client/FormTrigger.tsx
new file mode 100644
index 0000000000..a489d1ae7f
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-form-trigger/src/client/FormTrigger.tsx
@@ -0,0 +1,118 @@
+import { useForm } from '@formily/react';
+
+import { SchemaInitializerItemType, useCollectionDataSource, useCollectionManager, useCompile } from '@nocobase/client';
+import { Trigger, CollectionBlockInitializer, getCollectionFieldOptions } from '@nocobase/plugin-workflow/client';
+import { NAMESPACE, useLang } from '../locale';
+
+export default class extends Trigger {
+ title = `{{t("Form event", { ns: "${NAMESPACE}" })}}`;
+ type = 'form';
+ description = `{{t("Event triggers when submitted a workflow bound form action.", { ns: "${NAMESPACE}" })}}`;
+ fieldset = {
+ collection: {
+ type: 'string',
+ required: true,
+ 'x-decorator': 'FormItem',
+ 'x-component': 'CollectionSelect',
+ 'x-component-props': {
+ className: 'auto-width',
+ },
+ title: `{{t("Form data model", { ns: "${NAMESPACE}" })}}`,
+ description: `{{t("Use a collection to match form data.", { ns: "${NAMESPACE}" })}}`,
+ 'x-reactions': [
+ {
+ target: 'appends',
+ effects: ['onFieldValueChange'],
+ fulfill: {
+ state: {
+ value: [],
+ },
+ },
+ },
+ ],
+ },
+ appends: {
+ type: 'array',
+ title: `{{t("Associations to use", { ns: "${NAMESPACE}" })}}`,
+ description: `{{t("Please select the associated fields that need to be accessed in subsequent nodes. With more than two levels of to-many associations may cause performance issue, please use with caution.", { ns: "${NAMESPACE}" })}}`,
+ 'x-decorator': 'FormItem',
+ 'x-component': 'AppendsTreeSelect',
+ 'x-component-props': {
+ title: 'Preload associations',
+ multiple: true,
+ useCollection() {
+ const { values } = useForm();
+ return values?.collection;
+ },
+ },
+ 'x-reactions': [
+ {
+ dependencies: ['collection'],
+ fulfill: {
+ state: {
+ visible: '{{!!$deps[0]}}',
+ },
+ },
+ },
+ ],
+ },
+ };
+ scope = {
+ useCollectionDataSource,
+ };
+ useActionTriggerable = true;
+ useVariables(config, options) {
+ // eslint-disable-next-line react-hooks/rules-of-hooks
+ const compile = useCompile();
+ // eslint-disable-next-line react-hooks/rules-of-hooks
+ const { getCollectionFields } = useCollectionManager();
+ // eslint-disable-next-line react-hooks/rules-of-hooks
+ const langTriggerData = useLang('Trigger data');
+ // eslint-disable-next-line react-hooks/rules-of-hooks
+ const langUserSubmittedForm = useLang('User submitted form');
+ const rootFields = [
+ {
+ collectionName: config.collection,
+ name: 'data',
+ type: 'hasOne',
+ target: config.collection,
+ uiSchema: {
+ title: langTriggerData,
+ },
+ },
+ {
+ collectionName: 'users',
+ name: 'user',
+ type: 'hasOne',
+ target: 'users',
+ uiSchema: {
+ title: langUserSubmittedForm,
+ },
+ },
+ ];
+ const result = getCollectionFieldOptions({
+ // depth,
+ appends: ['data', 'user', ...(config.appends?.map((item) => `data.${item}`) || [])],
+ ...options,
+ fields: rootFields,
+ compile,
+ getCollectionFields,
+ });
+ return result;
+ }
+ useInitializers(config): SchemaInitializerItemType | null {
+ if (!config.collection) {
+ return null;
+ }
+
+ return {
+ name: 'triggerData',
+ type: 'item',
+ key: 'triggerData',
+ title: `{{t("Trigger data", { ns: "${NAMESPACE}" })}}`,
+ Component: CollectionBlockInitializer,
+ collection: config.collection,
+ dataSource: '{{$context.data}}',
+ };
+ }
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-form-trigger/src/client/index.ts b/packages/plugins/@nocobase/plugin-workflow-form-trigger/src/client/index.ts
new file mode 100644
index 0000000000..6bbfcaea0b
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-form-trigger/src/client/index.ts
@@ -0,0 +1,19 @@
+import { Plugin } from '@nocobase/client';
+import WorkflowPlugin from '@nocobase/plugin-workflow/client';
+
+import FormTrigger from './FormTrigger';
+
+export default class extends Plugin {
+ async afterAdd() {
+ // await this.app.pm.add()
+ }
+
+ async beforeLoad() {}
+
+ // You can get and modify the app instance here
+ async load() {
+ const workflow = this.app.pm.get('workflow') as WorkflowPlugin;
+ const formTrigger = new FormTrigger();
+ workflow.triggers.register(formTrigger.type, formTrigger);
+ }
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-form-trigger/src/index.ts b/packages/plugins/@nocobase/plugin-workflow-form-trigger/src/index.ts
new file mode 100644
index 0000000000..7e74612df8
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-form-trigger/src/index.ts
@@ -0,0 +1,2 @@
+export * from './server';
+export { default } from './server';
diff --git a/packages/plugins/@nocobase/plugin-workflow-form-trigger/src/locale/en-US.json b/packages/plugins/@nocobase/plugin-workflow-form-trigger/src/locale/en-US.json
new file mode 100644
index 0000000000..ef9819aac0
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-form-trigger/src/locale/en-US.json
@@ -0,0 +1,8 @@
+{
+ "Form event": "Form event",
+ "Event triggers when submitted a workflow bound form action.": "Event triggers when submitted a workflow bound form action.",
+ "Form data model": "Form data model",
+ "Use a collection to match form data.": "Use a collection to match form data.",
+ "Associations to use": "Associations to use",
+ "User submitted form": "User submitted form"
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-form-trigger/src/locale/index.ts b/packages/plugins/@nocobase/plugin-workflow-form-trigger/src/locale/index.ts
new file mode 100644
index 0000000000..01a1b04197
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-form-trigger/src/locale/index.ts
@@ -0,0 +1,12 @@
+import { useTranslation } from 'react-i18next';
+
+export const NAMESPACE = 'workflow-form-trigger';
+
+export function useLang(key: string, options = {}) {
+ const { t } = usePluginTranslation(options);
+ return t(key);
+}
+
+export function usePluginTranslation(options) {
+ return useTranslation(NAMESPACE, options);
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-form-trigger/src/locale/zh-CN.json b/packages/plugins/@nocobase/plugin-workflow-form-trigger/src/locale/zh-CN.json
new file mode 100644
index 0000000000..112e933be2
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-form-trigger/src/locale/zh-CN.json
@@ -0,0 +1,8 @@
+{
+ "Form event": "表单事件",
+ "Event triggers when submitted a workflow bound form action.": "在提交绑定工作流的表单操作按钮后触发。",
+ "Form data model": "表单数据模型",
+ "Use a collection to match form data.": "使用一个数据表来匹配表单数据。",
+ "Associations to use": "待使用的关系数据",
+ "User submitted form": "提交表单的用户"
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/server/triggers/form.ts b/packages/plugins/@nocobase/plugin-workflow-form-trigger/src/server/FormTrigger.ts
similarity index 93%
rename from packages/plugins/@nocobase/plugin-workflow/src/server/triggers/form.ts
rename to packages/plugins/@nocobase/plugin-workflow-form-trigger/src/server/FormTrigger.ts
index e2c2cfc401..c77a27875c 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/server/triggers/form.ts
+++ b/packages/plugins/@nocobase/plugin-workflow-form-trigger/src/server/FormTrigger.ts
@@ -1,14 +1,11 @@
import { get } from 'lodash';
-
-import { Trigger } from '.';
-import Plugin from '..';
-import { WorkflowModel } from '../types';
-import { Model, modelAssociationByKey } from '@nocobase/database';
import { BelongsTo, HasOne } from 'sequelize';
-import { toJSON } from '../utils';
+import { Model, modelAssociationByKey } from '@nocobase/database';
-export default class FormTrigger extends Trigger {
- constructor(plugin: Plugin) {
+import WorkflowPlugin, { Trigger, WorkflowModel, toJSON } from '@nocobase/plugin-workflow';
+
+export default class extends Trigger {
+ constructor(plugin: WorkflowPlugin) {
super(plugin);
plugin.app.resourcer.use(this.middleware);
diff --git a/packages/plugins/@nocobase/plugin-workflow-form-trigger/src/server/Plugin.ts b/packages/plugins/@nocobase/plugin-workflow-form-trigger/src/server/Plugin.ts
new file mode 100644
index 0000000000..9024c72b4e
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-form-trigger/src/server/Plugin.ts
@@ -0,0 +1,14 @@
+import { Plugin } from '@nocobase/server';
+import WorkflowPlugin from '@nocobase/plugin-workflow';
+
+import FormTrigger from './FormTrigger';
+
+export default class extends Plugin {
+ workflow: WorkflowPlugin;
+
+ async load() {
+ const workflowPlugin = this.app.getPlugin('workflow') as WorkflowPlugin;
+ this.workflow = workflowPlugin;
+ workflowPlugin.triggers.register('form', new FormTrigger(workflowPlugin));
+ }
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/server/__tests__/triggers/form.test.ts b/packages/plugins/@nocobase/plugin-workflow-form-trigger/src/server/__tests__/trigger.test.ts
similarity index 97%
rename from packages/plugins/@nocobase/plugin-workflow/src/server/__tests__/triggers/form.test.ts
rename to packages/plugins/@nocobase/plugin-workflow-form-trigger/src/server/__tests__/trigger.test.ts
index eeb32cb242..357bce3f13 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/server/__tests__/triggers/form.test.ts
+++ b/packages/plugins/@nocobase/plugin-workflow-form-trigger/src/server/__tests__/trigger.test.ts
@@ -1,9 +1,11 @@
import Database from '@nocobase/database';
import { MockServer } from '@nocobase/test';
-import { getApp, sleep } from '..';
-import { EXECUTION_STATUS } from '../../constants';
+import { EXECUTION_STATUS } from '@nocobase/plugin-workflow';
+import { getApp, sleep } from '@nocobase/plugin-workflow-test';
-describe('workflow > triggers > form', () => {
+import Plugin from '..';
+
+describe('workflow > instructions > sql', () => {
let app: MockServer;
let db: Database;
let agent;
@@ -16,7 +18,7 @@ describe('workflow > triggers > form', () => {
beforeEach(async () => {
app = await getApp({
- plugins: ['users', 'auth'],
+ plugins: ['users', 'auth', Plugin],
});
await app.getPlugin('auth').install();
agent = app.agent();
diff --git a/packages/plugins/@nocobase/plugin-workflow-form-trigger/src/server/index.ts b/packages/plugins/@nocobase/plugin-workflow-form-trigger/src/server/index.ts
new file mode 100644
index 0000000000..3b60b3bee9
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-form-trigger/src/server/index.ts
@@ -0,0 +1 @@
+export { default } from './Plugin';
diff --git a/packages/plugins/@nocobase/plugin-workflow-loop/LICENSE b/packages/plugins/@nocobase/plugin-workflow-loop/LICENSE
new file mode 100644
index 0000000000..0ad25db4bd
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-loop/LICENSE
@@ -0,0 +1,661 @@
+ GNU AFFERO GENERAL PUBLIC LICENSE
+ Version 3, 19 November 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ 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,
+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
+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
+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
+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
+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
+ensure that, in such cases, the modified source code becomes available
+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
+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
+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
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "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
+works, such as semiconductor masks.
+
+ "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
+in a fashion requiring copyright permission, other than the making of an
+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
+on the Program.
+
+ 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,
+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
+a computer network, with no transfer of a copy, is not conveying.
+
+ 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
+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.
+
+ 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
+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
+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
+"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 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
+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
+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
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ 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
+covered work is covered by this License only if the output, given its
+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
+convey, without conditions so long as your license otherwise remains
+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
+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
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ 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
+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
+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.
+
+ 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
+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,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ 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:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ 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
+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
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ 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:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ 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
+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
+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
+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
+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,
+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
+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
+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
+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
+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
+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,
+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.
+
+ "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
+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
+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
+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
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ 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
+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
+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
+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
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ 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
+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
+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
+licenses of parties who have received copies or rights from you under
+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.
+
+ 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,
+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
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ 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
+for enforcing compliance by third parties with this License.
+
+ 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
+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
+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
+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.
+
+ 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
+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
+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
+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
+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
+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,
+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,
+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
+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
+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
+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
+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
+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
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+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
+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.
+
+ 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
+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
+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.
+
+ 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
+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
+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
+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.
+
+ 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
+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
+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
+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
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 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
+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
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ 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
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+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.
+
+ 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
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ 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 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.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ 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
+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
+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,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU AGPL, see
+.
diff --git a/packages/plugins/@nocobase/plugin-workflow-loop/README.md b/packages/plugins/@nocobase/plugin-workflow-loop/README.md
new file mode 100644
index 0000000000..e83d0373a4
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-loop/README.md
@@ -0,0 +1,9 @@
+# workflow
+
+English | [中文](./README.zh-CN.md)
+
+## 安装激活
+
+内置插件无需手动安装激活。
+
+## 使用方法
diff --git a/packages/plugins/@nocobase/plugin-workflow-loop/README.zh-CN.md b/packages/plugins/@nocobase/plugin-workflow-loop/README.zh-CN.md
new file mode 100644
index 0000000000..e690848dd1
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-loop/README.zh-CN.md
@@ -0,0 +1,9 @@
+# workflow
+
+[English](./README.md) | 中文
+
+## 安装激活
+
+内置插件无需手动安装激活。
+
+## 使用方法
diff --git a/packages/plugins/@nocobase/plugin-workflow-loop/client.d.ts b/packages/plugins/@nocobase/plugin-workflow-loop/client.d.ts
new file mode 100644
index 0000000000..6c459cbac4
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-loop/client.d.ts
@@ -0,0 +1,2 @@
+export * from './dist/client';
+export { default } from './dist/client';
diff --git a/packages/plugins/@nocobase/plugin-workflow-loop/client.js b/packages/plugins/@nocobase/plugin-workflow-loop/client.js
new file mode 100644
index 0000000000..b6e3be70e6
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-loop/client.js
@@ -0,0 +1 @@
+module.exports = require('./dist/client/index.js');
diff --git a/packages/plugins/@nocobase/plugin-workflow-loop/package.json b/packages/plugins/@nocobase/plugin-workflow-loop/package.json
new file mode 100644
index 0000000000..a76024ec9c
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-loop/package.json
@@ -0,0 +1,24 @@
+{
+ "name": "@nocobase/plugin-workflow-loop",
+ "displayName": "Workflow: Loop node",
+ "displayName.zh-CN": "工作流:循环节点",
+ "description": "Useful plugin for doing dynamic calculation based on expression collection records in workflow.",
+ "description.zh-CN": "用于在工作流中进行基于数据行的动态表达式计算。",
+ "version": "0.17.0-alpha.3",
+ "license": "AGPL-3.0",
+ "main": "./dist/server/index.js",
+ "devDependencies": {
+ "@ant-design/icons": "5.x",
+ "react": "18.x",
+ "react-i18next": "^11.15.1"
+ },
+ "peerDependencies": {
+ "@nocobase/client": "0.x",
+ "@nocobase/database": "0.x",
+ "@nocobase/plugin-workflow": ">=0.17.0-alpha.3",
+ "@nocobase/plugin-workflow-test": ">=0.17.0-alpha.3",
+ "@nocobase/server": "0.x",
+ "@nocobase/test": "0.x"
+ },
+ "gitHead": "ce588eefb0bfc50f7d5bbee575e0b5e843bf6644"
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-loop/server.d.ts b/packages/plugins/@nocobase/plugin-workflow-loop/server.d.ts
new file mode 100644
index 0000000000..c41081ddc6
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-loop/server.d.ts
@@ -0,0 +1,2 @@
+export * from './dist/server';
+export { default } from './dist/server';
diff --git a/packages/plugins/@nocobase/plugin-workflow-loop/server.js b/packages/plugins/@nocobase/plugin-workflow-loop/server.js
new file mode 100644
index 0000000000..972842039a
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-loop/server.js
@@ -0,0 +1 @@
+module.exports = require('./dist/server/index.js');
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/loop.tsx b/packages/plugins/@nocobase/plugin-workflow-loop/src/client/LoopInstruction.tsx
similarity index 74%
rename from packages/plugins/@nocobase/plugin-workflow/src/client/nodes/loop.tsx
rename to packages/plugins/@nocobase/plugin-workflow-loop/src/client/LoopInstruction.tsx
index e05c1ad026..505fc30558 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/loop.tsx
+++ b/packages/plugins/@nocobase/plugin-workflow-loop/src/client/LoopInstruction.tsx
@@ -3,19 +3,20 @@ import { ArrowUpOutlined } from '@ant-design/icons';
import { css, cx, useCompile } from '@nocobase/client';
-import { NodeDefaultView } from '.';
-import { Branch } from '../Branch';
-import { useFlowContext } from '../FlowContext';
-import { NAMESPACE, lang } from '../locale';
-import useStyles from '../style';
import {
+ NodeDefaultView,
+ Branch,
+ useFlowContext,
+ useStyles,
VariableOption,
WorkflowVariableInput,
defaultFieldNames,
nodesOptions,
scopeOptions,
triggerOptions,
-} from '../variable';
+ Instruction,
+} from '@nocobase/plugin-workflow/client';
+import { NAMESPACE, useLang } from '../locale';
function findOption(options: VariableOption[], paths: string[]) {
let opts = options;
@@ -37,12 +38,12 @@ function findOption(options: VariableOption[], paths: string[]) {
return option;
}
-export default {
- title: `{{t("Loop", { ns: "${NAMESPACE}" })}}`,
- type: 'loop',
- group: 'control',
- description: `{{t("By using a loop node, you can perform the same operation on multiple sets of data. The source of these sets can be either multiple records from a query node or multiple associated records of a single record. Loop node can also be used for iterating a certain number of times or for looping through each character in a string. However, excessive looping may cause performance issues, so use with caution.", { ns: "${NAMESPACE}" })}}`,
- fieldset: {
+export default class extends Instruction {
+ title = `{{t("Loop", { ns: "${NAMESPACE}" })}}`;
+ type = 'loop';
+ group = 'control';
+ description = `{{t("By using a loop node, you can perform the same operation on multiple sets of data. The source of these sets can be either multiple records from a query node or multiple associated records of a single record. Loop node can also be used for iterating a certain number of times or for looping through each character in a string. However, excessive looping may cause performance issues, so use with caution.", { ns: "${NAMESPACE}" })}}`;
+ fieldset = {
target: {
type: 'string',
title: `{{t("Loop target", { ns: "${NAMESPACE}" })}}`,
@@ -66,10 +67,14 @@ export default {
},
required: true,
},
- },
- view: {},
- component: function Component({ data }) {
+ };
+ components = {
+ WorkflowVariableInput,
+ };
+ Component({ data }) {
+ // eslint-disable-next-line react-hooks/rules-of-hooks
const { nodes } = useFlowContext();
+ // eslint-disable-next-line react-hooks/rules-of-hooks
const { styles } = useStyles();
const entry = nodes.find((node) => node.upstreamId === data.id && node.branchIndex != null);
@@ -96,13 +101,16 @@ export default {
);
- },
- scope: {},
- components: {
- WorkflowVariableInput,
- },
+ }
useScopeVariables(node, options) {
+ // eslint-disable-next-line react-hooks/rules-of-hooks
const compile = useCompile();
+ // eslint-disable-next-line react-hooks/rules-of-hooks
+ const langLoopTarget = useLang('Loop target');
+ // eslint-disable-next-line react-hooks/rules-of-hooks
+ const langLoopIndex = useLang('Loop index');
+ // eslint-disable-next-line react-hooks/rules-of-hooks
+ const langLoopLength = useLang('Loop length');
const { target } = node.config;
if (!target) {
return null;
@@ -119,7 +127,7 @@ export default {
let targetOption: VariableOption = {
key: 'item',
[fieldNames.value]: 'item',
- [fieldNames.label]: lang('Loop target'),
+ [fieldNames.label]: langLoopTarget,
};
if (typeof target === 'string' && target.startsWith('{{') && target.endsWith('}}')) {
@@ -146,8 +154,8 @@ export default {
return [
targetOption,
- { key: 'index', [fieldNames.value]: 'index', [fieldNames.label]: lang('Loop index') },
- { key: 'length', [fieldNames.value]: 'length', [fieldNames.label]: lang('Loop length') },
+ { key: 'index', [fieldNames.value]: 'index', [fieldNames.label]: langLoopIndex },
+ { key: 'length', [fieldNames.value]: 'length', [fieldNames.label]: langLoopLength },
];
- },
-};
+ }
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-loop/src/client/index.ts b/packages/plugins/@nocobase/plugin-workflow-loop/src/client/index.ts
new file mode 100644
index 0000000000..a41d2e614a
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-loop/src/client/index.ts
@@ -0,0 +1,19 @@
+import { Plugin } from '@nocobase/client';
+import WorkflowPlugin from '@nocobase/plugin-workflow/client';
+
+import LoopInstruction from './LoopInstruction';
+
+export default class extends Plugin {
+ async afterAdd() {
+ // await this.app.pm.add()
+ }
+
+ async beforeLoad() {}
+
+ // You can get and modify the app instance here
+ async load() {
+ const workflow = this.app.pm.get('workflow') as WorkflowPlugin;
+ const loopInstruction = new LoopInstruction();
+ workflow.instructions.register(loopInstruction.type, loopInstruction);
+ }
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-loop/src/index.ts b/packages/plugins/@nocobase/plugin-workflow-loop/src/index.ts
new file mode 100644
index 0000000000..7e74612df8
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-loop/src/index.ts
@@ -0,0 +1,2 @@
+export * from './server';
+export { default } from './server';
diff --git a/packages/plugins/@nocobase/plugin-workflow-loop/src/locale/en-US.json b/packages/plugins/@nocobase/plugin-workflow-loop/src/locale/en-US.json
new file mode 100644
index 0000000000..dde8c8e80b
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-loop/src/locale/en-US.json
@@ -0,0 +1,9 @@
+{
+ "Loop": "Loop",
+ "Loop target": "Loop target",
+ "Loop index": "Loop index",
+ "Loop length": "Loop length",
+ "By using a loop node, you can perform the same operation on multiple sets of data. The source of these sets can be either multiple records from a query node or multiple associated records of a single record. Loop node can also be used for iterating a certain number of times or for looping through each character in a string. However, excessive looping may cause performance issues, so use with caution.": "By using a loop node, you can perform the same operation on multiple sets of data. The source of these sets can be either multiple records from a query node or multiple associated records of a single record. Loop node can also be used for iterating a certain number of times or for looping through each character in a string. However, excessive looping may cause performance issues, so use with caution.",
+ "Scope variables": "Scope variables",
+ "A single number will be treated as a loop count, a single string will be treated as an array of characters, and other non-array values will be converted to arrays. The loop node ends when the loop count is reached, or when the array loop is completed. You can also add condition nodes to the loop to terminate it.": "A single number will be treated as a loop count, a single string will be treated as an array of characters, and other non-array values will be converted to arrays. The loop node ends when the loop count is reached, or when the array loop is completed. You can also add condition nodes to the loop to terminate it."
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-loop/src/locale/index.ts b/packages/plugins/@nocobase/plugin-workflow-loop/src/locale/index.ts
new file mode 100644
index 0000000000..9cb8329df6
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-loop/src/locale/index.ts
@@ -0,0 +1,12 @@
+import { useTranslation } from 'react-i18next';
+
+export const NAMESPACE = 'workflow-loop';
+
+export function useLang(key: string, options = {}) {
+ const { t } = usePluginTranslation(options);
+ return t(key);
+}
+
+export function usePluginTranslation(options) {
+ return useTranslation(NAMESPACE, options);
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-loop/src/locale/zh-CN.json b/packages/plugins/@nocobase/plugin-workflow-loop/src/locale/zh-CN.json
new file mode 100644
index 0000000000..0c57ff062d
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-loop/src/locale/zh-CN.json
@@ -0,0 +1,9 @@
+{
+ "Loop": "循环",
+ "Loop target": "循环对象",
+ "Loop index": "当前索引",
+ "Loop length": "循环长度",
+ "By using a loop node, you can perform the same operation on multiple sets of data. The source of these sets can be either multiple records from a query node or multiple associated records of a single record. Loop node can also be used for iterating a certain number of times or for looping through each character in a string. However, excessive looping may cause performance issues, so use with caution.": "使用循环节点可以对多条数据进行同样的操作,多条数据的来源可以是查询节点的多条结果,或者一条数据的多条关系数据。也可以用于一定次数的循环,或者对字符串中每一个字符的循环处理。循环次数过高可能引起性能问题,请谨慎使用。",
+ "Scope variables": "局域变量",
+ "A single number will be treated as a loop count, a single string will be treated as an array of characters, and other non-array values will be converted to arrays. The loop node ends when the loop count is reached, or when the array loop is completed. You can also add condition nodes to the loop to terminate it.": "单一数字值将被视为循环次数,单一字符串值将被视为字符数组,其他非数组值将被转换为数组。达到循环次数,或者将数组循环完成后,循环节点结束。你也可以在循环中添加条件节点,以终止循环。"
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/server/instructions/loop.ts b/packages/plugins/@nocobase/plugin-workflow-loop/src/server/LoopInstruction.ts
similarity index 93%
rename from packages/plugins/@nocobase/plugin-workflow/src/server/instructions/loop.ts
rename to packages/plugins/@nocobase/plugin-workflow-loop/src/server/LoopInstruction.ts
index 7b259c319b..f090d3d821 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/server/instructions/loop.ts
+++ b/packages/plugins/@nocobase/plugin-workflow-loop/src/server/LoopInstruction.ts
@@ -1,6 +1,4 @@
-import Processor from '../Processor';
-import { JOB_STATUS } from '../constants';
-import type { FlowNodeModel, JobModel } from '../types';
+import { Processor, Instruction, JOB_STATUS, FlowNodeModel, JobModel } from '@nocobase/plugin-workflow';
function getTargetLength(target) {
let length = 0;
@@ -16,7 +14,7 @@ function getTargetLength(target) {
return length;
}
-export default {
+export default class extends Instruction {
async run(node: FlowNodeModel, prevJob: JobModel, processor: Processor) {
const [branch] = processor.getBranches(node);
const target = processor.getParsedValue(node.config.target, node.id);
@@ -46,7 +44,7 @@ export default {
await processor.run(branch, job);
return null;
- },
+ }
async resume(node: FlowNodeModel, branchJob, processor: Processor) {
const job = processor.findBranchParentJob(branchJob, node) as JobModel;
@@ -80,7 +78,7 @@ export default {
});
return job;
- },
+ }
getScope(node, index, processor) {
const target = processor.getParsedValue(node.config.target, node.id);
@@ -95,5 +93,5 @@ export default {
};
return result;
- },
-};
+ }
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-loop/src/server/Plugin.ts b/packages/plugins/@nocobase/plugin-workflow-loop/src/server/Plugin.ts
new file mode 100644
index 0000000000..d18d63223f
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-loop/src/server/Plugin.ts
@@ -0,0 +1,14 @@
+import { Plugin } from '@nocobase/server';
+import { default as WorkflowPlugin } from '@nocobase/plugin-workflow';
+
+import LoopInstruction from './LoopInstruction';
+
+export default class extends Plugin {
+ workflow: WorkflowPlugin;
+
+ async load() {
+ const workflowPlugin = this.app.getPlugin('workflow') as WorkflowPlugin;
+ this.workflow = workflowPlugin;
+ workflowPlugin.instructions.register('loop', new LoopInstruction(workflowPlugin));
+ }
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/server/__tests__/instructions/loop.test.ts b/packages/plugins/@nocobase/plugin-workflow-loop/src/server/__tests__/instruction.test.ts
similarity index 69%
rename from packages/plugins/@nocobase/plugin-workflow/src/server/__tests__/instructions/loop.test.ts
rename to packages/plugins/@nocobase/plugin-workflow-loop/src/server/__tests__/instruction.test.ts
index e89be20382..c1c8924611 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/server/__tests__/instructions/loop.test.ts
+++ b/packages/plugins/@nocobase/plugin-workflow-loop/src/server/__tests__/instruction.test.ts
@@ -1,7 +1,9 @@
import Database from '@nocobase/database';
import { Application } from '@nocobase/server';
-import { getApp, sleep } from '..';
-import { EXECUTION_STATUS, JOB_STATUS } from '../../constants';
+import { BRANCH_INDEX, EXECUTION_STATUS, JOB_STATUS } from '@nocobase/plugin-workflow';
+import { getApp, sleep } from '@nocobase/plugin-workflow-test';
+
+import Plugin from '..';
describe('workflow > instructions > loop', () => {
let app: Application;
@@ -12,7 +14,9 @@ describe('workflow > instructions > loop', () => {
let plugin;
beforeEach(async () => {
- app = await getApp();
+ app = await getApp({
+ plugins: [Plugin],
+ });
plugin = app.pm.get('workflow');
db = app.db;
@@ -328,4 +332,145 @@ describe('workflow > instructions > loop', () => {
expect(jobs[2].result).toBe('c2');
});
});
+
+ describe('mixed', () => {
+ it.skip('loop branch contains parallel branches', async () => {
+ const n1 = await workflow.createNode({
+ type: 'loop',
+ config: {
+ target: 2,
+ },
+ });
+
+ const n2 = await workflow.createNode({
+ type: 'parallel',
+ branchIndex: 0,
+ upstreamId: n1.id,
+ config: {
+ mode: 'any',
+ },
+ });
+
+ const n3 = await workflow.createNode({
+ type: 'condition',
+ config: {
+ rejectOnFalse: true,
+ calculation: {
+ calculator: '<',
+ operands: [`{{$scopes.${n1.id}.item}}`, 1],
+ },
+ },
+ branchIndex: 0,
+ upstreamId: n2.id,
+ });
+ const n4 = await workflow.createNode({
+ type: 'echo',
+ upstreamId: n3.id,
+ });
+ await n3.setDownstream(n4);
+
+ const n5 = await workflow.createNode({
+ type: 'condition',
+ config: {
+ rejectOnFalse: true,
+ calculation: {
+ calculator: '<',
+ operands: [`{{$scopes.${n1.id}.item}}`, 1],
+ },
+ },
+ branchIndex: 1,
+ upstreamId: n2.id,
+ });
+ const n6 = await workflow.createNode({
+ type: 'echo',
+ upstreamId: n5.id,
+ });
+ await n5.setDownstream(n6);
+
+ const post = await PostRepo.create({ values: { title: 't1' } });
+
+ await sleep(1000);
+
+ const [e1] = await workflow.getExecutions();
+ expect(e1.status).toEqual(EXECUTION_STATUS.FAILED);
+ const e1jobs = await e1.getJobs();
+ expect(e1jobs.length).toBe(7);
+ });
+
+ it('condition contains loop (target as 0)', async () => {
+ const n1 = await workflow.createNode({
+ type: 'condition',
+ });
+
+ const n2 = await workflow.createNode({
+ type: 'loop',
+ branchIndex: BRANCH_INDEX.ON_TRUE,
+ upstreamId: n1.id,
+ config: {
+ target: 0,
+ },
+ });
+
+ const n3 = await workflow.createNode({
+ type: 'echo',
+ branchIndex: 0,
+ upstreamId: n2.id,
+ });
+
+ const n4 = await workflow.createNode({
+ type: 'echo',
+ upstreamId: n1.id,
+ });
+
+ await n1.setDownstream(n4);
+
+ const post = await PostRepo.create({ values: { title: 't1' } });
+
+ await sleep(500);
+
+ const [e1] = await workflow.getExecutions();
+ expect(e1.status).toEqual(EXECUTION_STATUS.RESOLVED);
+ const jobs = await e1.getJobs({ order: [['id', 'ASC']] });
+ expect(jobs.length).toBe(3);
+ expect(jobs[0].status).toBe(JOB_STATUS.RESOLVED);
+ });
+
+ it('condition contains loop (target as 2)', async () => {
+ const n1 = await workflow.createNode({
+ type: 'condition',
+ });
+
+ const n2 = await workflow.createNode({
+ type: 'loop',
+ branchIndex: BRANCH_INDEX.ON_TRUE,
+ upstreamId: n1.id,
+ config: {
+ target: 2,
+ },
+ });
+
+ const n3 = await workflow.createNode({
+ type: 'echo',
+ branchIndex: 0,
+ upstreamId: n2.id,
+ });
+
+ const n4 = await workflow.createNode({
+ type: 'echo',
+ upstreamId: n1.id,
+ });
+
+ await n1.setDownstream(n4);
+
+ const post = await PostRepo.create({ values: { title: 't1' } });
+
+ await sleep(500);
+
+ const [e1] = await workflow.getExecutions();
+ expect(e1.status).toEqual(EXECUTION_STATUS.RESOLVED);
+ const jobs = await e1.getJobs({ order: [['id', 'ASC']] });
+ expect(jobs.length).toBe(5);
+ expect(jobs[0].status).toBe(JOB_STATUS.RESOLVED);
+ });
+ });
});
diff --git a/packages/plugins/@nocobase/plugin-workflow-loop/src/server/index.ts b/packages/plugins/@nocobase/plugin-workflow-loop/src/server/index.ts
new file mode 100644
index 0000000000..3b60b3bee9
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-loop/src/server/index.ts
@@ -0,0 +1 @@
+export { default } from './Plugin';
diff --git a/packages/plugins/@nocobase/plugin-workflow-manual/LICENSE b/packages/plugins/@nocobase/plugin-workflow-manual/LICENSE
new file mode 100644
index 0000000000..0ad25db4bd
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-manual/LICENSE
@@ -0,0 +1,661 @@
+ GNU AFFERO GENERAL PUBLIC LICENSE
+ Version 3, 19 November 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ 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,
+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
+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
+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
+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
+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
+ensure that, in such cases, the modified source code becomes available
+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
+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
+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
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "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
+works, such as semiconductor masks.
+
+ "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
+in a fashion requiring copyright permission, other than the making of an
+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
+on the Program.
+
+ 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,
+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
+a computer network, with no transfer of a copy, is not conveying.
+
+ 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
+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.
+
+ 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
+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
+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
+"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 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
+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
+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
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ 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
+covered work is covered by this License only if the output, given its
+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
+convey, without conditions so long as your license otherwise remains
+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
+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
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ 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
+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
+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.
+
+ 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
+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,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ 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:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ 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
+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
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ 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:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ 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
+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
+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
+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
+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,
+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
+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
+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
+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
+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
+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,
+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.
+
+ "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
+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
+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
+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
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ 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
+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
+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
+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
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ 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
+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
+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
+licenses of parties who have received copies or rights from you under
+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.
+
+ 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,
+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
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ 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
+for enforcing compliance by third parties with this License.
+
+ 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
+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
+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
+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.
+
+ 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
+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
+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
+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
+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
+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,
+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,
+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
+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
+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
+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
+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
+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
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+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
+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.
+
+ 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
+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
+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.
+
+ 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
+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
+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
+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.
+
+ 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
+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
+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
+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
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 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
+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
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ 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
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+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.
+
+ 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
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ 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 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.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ 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
+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
+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,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU AGPL, see
+.
diff --git a/packages/plugins/@nocobase/plugin-workflow-manual/README.md b/packages/plugins/@nocobase/plugin-workflow-manual/README.md
new file mode 100644
index 0000000000..e83d0373a4
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-manual/README.md
@@ -0,0 +1,9 @@
+# workflow
+
+English | [中文](./README.zh-CN.md)
+
+## 安装激活
+
+内置插件无需手动安装激活。
+
+## 使用方法
diff --git a/packages/plugins/@nocobase/plugin-workflow-manual/README.zh-CN.md b/packages/plugins/@nocobase/plugin-workflow-manual/README.zh-CN.md
new file mode 100644
index 0000000000..e690848dd1
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-manual/README.zh-CN.md
@@ -0,0 +1,9 @@
+# workflow
+
+[English](./README.md) | 中文
+
+## 安装激活
+
+内置插件无需手动安装激活。
+
+## 使用方法
diff --git a/packages/plugins/@nocobase/plugin-workflow-manual/client.d.ts b/packages/plugins/@nocobase/plugin-workflow-manual/client.d.ts
new file mode 100644
index 0000000000..6c459cbac4
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-manual/client.d.ts
@@ -0,0 +1,2 @@
+export * from './dist/client';
+export { default } from './dist/client';
diff --git a/packages/plugins/@nocobase/plugin-workflow-manual/client.js b/packages/plugins/@nocobase/plugin-workflow-manual/client.js
new file mode 100644
index 0000000000..b6e3be70e6
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-manual/client.js
@@ -0,0 +1 @@
+module.exports = require('./dist/client/index.js');
diff --git a/packages/plugins/@nocobase/plugin-workflow-manual/package.json b/packages/plugins/@nocobase/plugin-workflow-manual/package.json
new file mode 100644
index 0000000000..8be91d82e6
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-manual/package.json
@@ -0,0 +1,33 @@
+{
+ "name": "@nocobase/plugin-workflow-manual",
+ "displayName": "Workflow: Manual node",
+ "displayName.zh-CN": "工作流:人工处理节点",
+ "description": "Could be used for workflows which some of decisions are made by users.",
+ "description.zh-CN": "用于人工控制部分决策的流程。",
+ "version": "0.17.0-alpha.3",
+ "license": "AGPL-3.0",
+ "main": "./dist/server/index.js",
+ "devDependencies": {
+ "@ant-design/icons": "5.x",
+ "@formily/antd-v5": "1.x",
+ "@formily/core": "2.x",
+ "@formily/react": "2.x",
+ "antd": "5.x",
+ "lodash": "4.17.21",
+ "react": "18.x",
+ "react-i18next": "^11.15.1",
+ "react-router-dom": "^6.11.2"
+ },
+ "peerDependencies": {
+ "@nocobase/client": "0.x",
+ "@nocobase/database": "0.x",
+ "@nocobase/plugin-collection-manager": "0.x",
+ "@nocobase/plugin-users": "0.x",
+ "@nocobase/plugin-workflow": ">=0.17.0-alpha.3",
+ "@nocobase/plugin-workflow-test": ">=0.17.0-alpha.3",
+ "@nocobase/server": "0.x",
+ "@nocobase/test": "0.x",
+ "@nocobase/utils": "0.x"
+ },
+ "gitHead": "ce588eefb0bfc50f7d5bbee575e0b5e843bf6644"
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-manual/server.d.ts b/packages/plugins/@nocobase/plugin-workflow-manual/server.d.ts
new file mode 100644
index 0000000000..c41081ddc6
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-manual/server.d.ts
@@ -0,0 +1,2 @@
+export * from './dist/server';
+export { default } from './dist/server';
diff --git a/packages/plugins/@nocobase/plugin-workflow-manual/server.js b/packages/plugins/@nocobase/plugin-workflow-manual/server.js
new file mode 100644
index 0000000000..972842039a
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-manual/server.js
@@ -0,0 +1 @@
+module.exports = require('./dist/server/index.js');
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/WorkflowTodo.tsx b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/WorkflowTodo.tsx
similarity index 95%
rename from packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/WorkflowTodo.tsx
rename to packages/plugins/@nocobase/plugin-workflow-manual/src/client/WorkflowTodo.tsx
index 07b4c8a5ce..209a1573c2 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/WorkflowTodo.tsx
+++ b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/WorkflowTodo.tsx
@@ -3,7 +3,7 @@ import { observer, useField, useFieldSchema, useForm } from '@formily/react';
import { Space, Spin, Tag } from 'antd';
import dayjs from 'dayjs';
-import { css } from '@nocobase/client';
+import { css, usePlugin } from '@nocobase/client';
import {
CollectionManagerProvider,
@@ -19,14 +19,19 @@ import {
useRecord,
useTableBlockContext,
} from '@nocobase/client';
-import { instructions, useAvailableUpstreams } from '..';
-import { FlowContext, useFlowContext } from '../../FlowContext';
-import { JobStatusOptions, JobStatusOptionsMap } from '../../constants';
-import { NAMESPACE } from '../../locale';
-import { linkNodes } from '../../utils';
-import { DetailsBlockProvider } from './DetailsBlockProvider';
-import { FormBlockProvider } from './FormBlockProvider';
-import { ManualFormType, manualFormTypes } from './SchemaConfig';
+import WorkflowPlugin, {
+ useAvailableUpstreams,
+ FlowContext,
+ useFlowContext,
+ JobStatusOptions,
+ JobStatusOptionsMap,
+ linkNodes,
+} from '@nocobase/plugin-workflow/client';
+
+import { DetailsBlockProvider } from './instruction/DetailsBlockProvider';
+import { FormBlockProvider } from './instruction/FormBlockProvider';
+import { ManualFormType, manualFormTypes } from './instruction/SchemaConfig';
+import { NAMESPACE } from '../locale';
const nodeCollection = {
title: `{{t("Task", { ns: "${NAMESPACE}" })}}`,
@@ -385,7 +390,7 @@ function ManualActionStatusProvider({ value, children }) {
button.disabled = true;
button.visible = userJob.status === value && userJob.result._ === buttonSchema.name;
}
- }, [userJob, value, button]);
+ }, [userJob, value, button, buttonSchema.name]);
return {children};
}
@@ -418,6 +423,7 @@ function useSubmit() {
}
function FlowContextProvider(props) {
+ const workflowPlugin = usePlugin(WorkflowPlugin);
const api = useAPIClient();
const { id } = useRecord();
const [flowContext, setFlowContext] = useState(null);
@@ -445,11 +451,11 @@ function FlowContextProvider(props) {
});
return;
});
- }, [id]);
+ }, [api, id]);
const upstreams = useAvailableUpstreams(flowContext?.nodes.find((item) => item.id === node.id));
const nodeComponents = upstreams.reduce(
- (components, { type }) => Object.assign(components, instructions.get(type).components),
+ (components, { type }) => Object.assign(components, workflowPlugin.instructions.get(type).components),
{},
);
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/WorkflowTodoBlockInitializer.tsx b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/WorkflowTodoBlockInitializer.tsx
similarity index 100%
rename from packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/WorkflowTodoBlockInitializer.tsx
rename to packages/plugins/@nocobase/plugin-workflow-manual/src/client/WorkflowTodoBlockInitializer.tsx
diff --git a/packages/plugins/@nocobase/plugin-workflow-manual/src/client/index.ts b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/index.ts
new file mode 100644
index 0000000000..1a14d0a2e1
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/index.ts
@@ -0,0 +1,42 @@
+import { Plugin } from '@nocobase/client';
+import WorkflowPlugin from '@nocobase/plugin-workflow/client';
+
+import Manual from './instruction';
+
+import { WorkflowTodo } from './WorkflowTodo';
+import { WorkflowTodoBlockInitializer } from './WorkflowTodoBlockInitializer';
+import { NAMESPACE } from '../locale';
+import { addActionButton, addBlockButton } from './instruction/SchemaConfig';
+import { addCustomFormField } from './instruction/forms/custom';
+
+export default class extends Plugin {
+ async afterAdd() {
+ // await this.app.pm.add()
+ }
+
+ // You can get and modify the app instance here
+ async load() {
+ // this.app.addProvider(Provider);
+ const workflow = this.app.pm.get('workflow') as WorkflowPlugin;
+ const manualInstruction = new Manual();
+ workflow.instructions.register(manualInstruction.type, manualInstruction);
+
+ this.app.schemaInitializerManager.add(addBlockButton);
+ this.app.schemaInitializerManager.add(addActionButton);
+ this.app.schemaInitializerManager.add(addCustomFormField);
+
+ const blockInitializers = this.app.schemaInitializerManager.get('BlockInitializers');
+ blockInitializers.add('otherBlocks.workflowTodos', {
+ title: `{{t("Workflow todos", { ns: "${NAMESPACE}" })}}`,
+ Component: 'WorkflowTodoBlockInitializer',
+ icon: 'CheckSquareOutlined',
+ });
+ }
+
+ addComponents() {
+ this.app.addComponents({
+ WorkflowTodo,
+ WorkflowTodoBlockInitializer,
+ });
+ }
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/AssigneesSelect.tsx b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/AssigneesSelect.tsx
similarity index 91%
rename from packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/AssigneesSelect.tsx
rename to packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/AssigneesSelect.tsx
index e10b4f1703..8a42b4a4c7 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/AssigneesSelect.tsx
+++ b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/AssigneesSelect.tsx
@@ -1,6 +1,6 @@
-import { RemoteSelect, Variable } from '@nocobase/client';
import React from 'react';
-import { useWorkflowVariableOptions } from '../../variable';
+import { RemoteSelect, Variable } from '@nocobase/client';
+import { useWorkflowVariableOptions } from '@nocobase/plugin-workflow/client';
function isUserKeyField(field) {
if (field.isForeignKey) {
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/DetailsBlockProvider.tsx b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/DetailsBlockProvider.tsx
similarity index 91%
rename from packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/DetailsBlockProvider.tsx
rename to packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/DetailsBlockProvider.tsx
index ef39182784..6b0078a3db 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/DetailsBlockProvider.tsx
+++ b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/DetailsBlockProvider.tsx
@@ -9,8 +9,8 @@ import {
useAPIClient,
useAssociationNames,
} from '@nocobase/client';
-import { useFlowContext } from '../../FlowContext';
import { parse } from '@nocobase/utils/client';
+import { useFlowContext } from '@nocobase/plugin-workflow/client';
function useFlowContextData(dataSource) {
const { execution, nodes } = useFlowContext();
@@ -27,10 +27,10 @@ function useFlowContextData(dataSource) {
{},
),
}),
- [execution],
+ [execution?.context, execution?.jobs, nodesKeyMap],
);
- const result = useMemo(() => parse(dataSource)(data), [execution]);
+ const result = useMemo(() => parse(dataSource)(data), [data, dataSource]);
return result;
}
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/FormBlockInitializer.tsx b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/FormBlockInitializer.tsx
similarity index 96%
rename from packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/FormBlockInitializer.tsx
rename to packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/FormBlockInitializer.tsx
index 12627ef1ac..2d8b2546c0 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/FormBlockInitializer.tsx
+++ b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/FormBlockInitializer.tsx
@@ -11,9 +11,8 @@ import {
useSchemaTemplateManager,
} from '@nocobase/client';
-import { traverseSchema } from './utils';
+import { JOB_STATUS, traverseSchema } from '@nocobase/plugin-workflow/client';
-import { JOB_STATUS } from '../../constants';
import { NAMESPACE } from '../../locale';
function InternalFormBlockInitializer({ schema, ...others }) {
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/FormBlockProvider.tsx b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/FormBlockProvider.tsx
similarity index 100%
rename from packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/FormBlockProvider.tsx
rename to packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/FormBlockProvider.tsx
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/ModeConfig.tsx b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/ModeConfig.tsx
similarity index 51%
rename from packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/ModeConfig.tsx
rename to packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/ModeConfig.tsx
index 35117b0a75..682755cac1 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/ModeConfig.tsx
+++ b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/ModeConfig.tsx
@@ -4,7 +4,7 @@ import { Form, Radio, Tooltip } from 'antd';
import React from 'react';
import { css, FormItem } from '@nocobase/client';
-import { lang } from '../../locale';
+import { useLang } from '../../locale';
function parseMode(v) {
if (!v) {
@@ -25,6 +25,28 @@ function parseMode(v) {
export function ModeConfig({ value, onChange }) {
const mode = parseMode(value);
+ const negotiationFieldset = (
+
+ );
return (
);
}
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/SchemaConfig.tsx b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/SchemaConfig.tsx
similarity index 95%
rename from packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/SchemaConfig.tsx
rename to packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/SchemaConfig.tsx
index 03818c98e0..a453fd8838 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/SchemaConfig.tsx
+++ b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/SchemaConfig.tsx
@@ -28,17 +28,22 @@ import {
useCompile,
useFormActiveFields,
useFormBlockContext,
+ usePlugin,
useSchemaInitializer,
useSchemaInitializerItem,
useSchemaOptionsContext,
} from '@nocobase/client';
import { Registry, lodash } from '@nocobase/utils/client';
-import { instructions, useAvailableUpstreams, useNodeContext } from '..';
-import { useFlowContext } from '../../FlowContext';
-import { JOB_STATUS } from '../../constants';
-import { NAMESPACE, lang } from '../../locale';
-import { useTrigger } from '../../triggers';
-import { useWorkflowVariableOptions } from '../../variable';
+import WorkflowPlugin, {
+ useAvailableUpstreams,
+ useNodeContext,
+ useFlowContext,
+ JOB_STATUS,
+ useTrigger,
+ useWorkflowVariableOptions,
+} from '@nocobase/plugin-workflow/client';
+
+import { NAMESPACE, useLang } from '../../locale';
import { DetailsBlockProvider } from './DetailsBlockProvider';
import { FormBlockProvider } from './FormBlockProvider';
import createRecordForm from './forms/create';
@@ -128,12 +133,13 @@ export const addBlockButton = new SchemaInitializer({
title: '{{t("Data blocks")}}',
checkChildrenLength: true,
useChildren() {
+ const workflowPlugin = usePlugin(WorkflowPlugin);
const current = useNodeContext();
const nodes = useAvailableUpstreams(current);
const triggerInitializers = [useTriggerInitializers()].filter(Boolean);
const nodeBlockInitializers = nodes
.map((node) => {
- const instruction = instructions.get(node.type);
+ const instruction = workflowPlugin.instructions.get(node.type);
return instruction?.useInitializers?.(node);
})
.filter(Boolean);
@@ -211,7 +217,7 @@ function AssignedFieldValues() {
initialValues: lodash.cloneDeep(initialValues),
values: lodash.cloneDeep(initialValues),
});
- }, []);
+ }, [fieldSchema]);
const upLevelActiveFields = useFormActiveFields();
const title = t('Assign field values');
@@ -260,7 +266,7 @@ function AssignedFieldValues() {
@@ -399,6 +405,7 @@ function useSubmit() {
}
export function SchemaConfig({ value, onChange }) {
+ const workflowPlugin = usePlugin(WorkflowPlugin);
const ctx = useContext(SchemaComponentContext);
const node = useNodeContext();
const nodes = useAvailableUpstreams(node);
@@ -408,7 +415,7 @@ export function SchemaConfig({ value, onChange }) {
const nodeInitializers = {};
const nodeComponents = {};
nodes.forEach((item) => {
- const instruction = instructions.get(item.type);
+ const instruction = workflowPlugin.instructions.get(item.type);
Object.assign(nodeInitializers, instruction.initializers);
Object.assign(nodeComponents, instruction.components);
});
@@ -459,7 +466,7 @@ export function SchemaConfig({ value, onChange }) {
},
},
}),
- [],
+ [value],
);
const refresh = useCallback(
@@ -521,7 +528,7 @@ export function SchemaConfigButton(props) {
return (
<>
{props.children}
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/forms/create.tsx b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/forms/create.tsx
similarity index 100%
rename from packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/forms/create.tsx
rename to packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/forms/create.tsx
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/forms/custom.tsx b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/forms/custom.tsx
similarity index 98%
rename from packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/forms/custom.tsx
rename to packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/forms/custom.tsx
index ef3e52f75f..2f438ab65e 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/forms/custom.tsx
+++ b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/forms/custom.tsx
@@ -1,5 +1,6 @@
import React, { useContext, useMemo, useState } from 'react';
+import lodash from 'lodash';
import { ArrayTable } from '@formily/antd-v5';
import { Field, createForm } from '@formily/core';
import { useField, useFieldSchema, useForm } from '@formily/react';
@@ -22,11 +23,11 @@ import {
useSchemaInitializerItem,
} from '@nocobase/client';
import { merge, uid } from '@nocobase/utils/client';
-import lodash from 'lodash';
-import { JOB_STATUS } from '../../../constants';
-import { NAMESPACE, lang } from '../../../locale';
+import { JOB_STATUS } from '@nocobase/plugin-workflow/client';
+
import { ManualFormType } from '../SchemaConfig';
import { findSchema } from '../utils';
+import { NAMESPACE, useLang } from '../../../locale';
function CustomFormBlockProvider(props) {
const [fields, setCollectionFields] = useState(props.collection?.fields ?? []);
@@ -266,6 +267,7 @@ const CustomItemsComponent = (props) => {
type: 'primary',
useAction() {
const { values, query } = useForm();
+ const messages = [useLang('Field name existed in form')];
return {
async run() {
const { default: options } = interfaceOptions;
@@ -279,7 +281,7 @@ const CustomItemsComponent = (props) => {
field.setFeedback({
type: 'error',
// code: 'FormulaError',
- messages: [lang('Field name existed in form')],
+ messages,
});
return;
}
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/forms/update.tsx b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/forms/update.tsx
similarity index 98%
rename from packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/forms/update.tsx
rename to packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/forms/update.tsx
index a380d1f5a8..2a8e26eee4 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/forms/update.tsx
+++ b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/forms/update.tsx
@@ -1,6 +1,7 @@
import { useFieldSchema } from '@formily/react';
import React, { useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
+import _ from 'lodash';
import {
GeneralSchemaDesigner,
@@ -14,9 +15,8 @@ import {
useDesignable,
useMenuSearch,
} from '@nocobase/client';
+import { FilterDynamicComponent } from '@nocobase/plugin-workflow/client';
-import _ from 'lodash';
-import { FilterDynamicComponent } from '../../../components/FilterDynamicComponent';
import { NAMESPACE } from '../../../locale';
import { FormBlockInitializer } from '../FormBlockInitializer';
import { ManualFormType } from '../SchemaConfig';
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/index.tsx b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/index.tsx
similarity index 81%
rename from packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/index.tsx
rename to packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/index.tsx
index d06411ad8d..e826dc6c9e 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/index.tsx
+++ b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/index.tsx
@@ -1,11 +1,16 @@
import { SchemaInitializerItemType, useCollectionManager, useCompile } from '@nocobase/client';
-import { CollectionBlockInitializer } from '../../components/CollectionBlockInitializer';
-import { NAMESPACE } from '../../locale';
-import { defaultFieldNames, getCollectionFieldOptions } from '../../variable';
-import { AssigneesSelect } from './AssigneesSelect';
-import { ModeConfig } from './ModeConfig';
+import {
+ defaultFieldNames,
+ getCollectionFieldOptions,
+ CollectionBlockInitializer,
+ Instruction,
+} from '@nocobase/plugin-workflow/client';
+
import { SchemaConfig, SchemaConfigButton } from './SchemaConfig';
+import { ModeConfig } from './ModeConfig';
+import { AssigneesSelect } from './AssigneesSelect';
+import { NAMESPACE } from '../../locale';
const MULTIPLE_ASSIGNED_MODE = {
SINGLE: Symbol('single'),
@@ -15,12 +20,12 @@ const MULTIPLE_ASSIGNED_MODE = {
ANY_PERCENTAGE: Symbol('any percentage'),
};
-export default {
- title: `{{t("Manual", { ns: "${NAMESPACE}" })}}`,
- type: 'manual',
- group: 'manual',
- description: `{{t("Could be used for manually submitting data, and determine whether to continue or exit. Workflow will generate a todo item for assigned user when it reaches a manual node, and continue processing after user submits the form.", { ns: "${NAMESPACE}" })}}`,
- fieldset: {
+export default class extends Instruction {
+ title = `{{t("Manual", { ns: "${NAMESPACE}" })}}`;
+ type = 'manual';
+ group = 'manual';
+ description = `{{t("Could be used for manually submitting data, and determine whether to continue or exit. Workflow will generate a todo item for assigned user when it reaches a manual node, and continue processing after user submits the form.", { ns: "${NAMESPACE}" })}}`;
+ fieldset = {
assignees: {
type: 'array',
title: `{{t("Assignees", { ns: "${NAMESPACE}" })}}`,
@@ -64,17 +69,17 @@ export default {
type: 'object',
default: {},
},
- },
- view: {},
- scope: {},
- components: {
+ };
+ components = {
SchemaConfigButton,
SchemaConfig,
ModeConfig,
AssigneesSelect,
- },
+ };
useVariables({ key, title, config }, { types, fieldNames = defaultFieldNames }) {
+ // eslint-disable-next-line react-hooks/rules-of-hooks
const compile = useCompile();
+ // eslint-disable-next-line react-hooks/rules-of-hooks
const { getCollectionFields } = useCollectionManager();
const formKeys = Object.keys(config.forms ?? {});
if (!formKeys.length) {
@@ -112,8 +117,9 @@ export default {
[fieldNames.children]: options,
}
: null;
- },
+ }
useInitializers(node): SchemaInitializerItemType | null {
+ // eslint-disable-next-line react-hooks/rules-of-hooks
const { getCollection } = useCollectionManager();
const formKeys = Object.keys(node.config.forms ?? {});
if (!formKeys.length || node.config.mode) {
@@ -140,13 +146,12 @@ export default {
return forms.length
? {
- name: 'forms',
+ name: `#${node.id}`,
key: 'forms',
type: 'subMenu',
title: node.title,
children: forms,
}
: null;
- },
- initializers: {},
-};
+ }
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/utils.ts b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/utils.ts
similarity index 66%
rename from packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/utils.ts
rename to packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/utils.ts
index 10c7118cea..6ce1a9b524 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/utils.ts
+++ b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/utils.ts
@@ -1,12 +1,3 @@
-export function traverseSchema(schema, fn) {
- fn(schema);
- if (schema.properties) {
- Object.keys(schema.properties).forEach((key) => {
- traverseSchema(schema.properties[key], fn);
- });
- }
-}
-
export function findSchema(schema, filter, onlyLeaf = false) {
const result = [];
diff --git a/packages/plugins/@nocobase/plugin-workflow-manual/src/index.ts b/packages/plugins/@nocobase/plugin-workflow-manual/src/index.ts
new file mode 100644
index 0000000000..7e74612df8
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-manual/src/index.ts
@@ -0,0 +1,2 @@
+export * from './server';
+export { default } from './server';
diff --git a/packages/plugins/@nocobase/plugin-workflow-manual/src/locale/en-US.json b/packages/plugins/@nocobase/plugin-workflow-manual/src/locale/en-US.json
new file mode 100644
index 0000000000..f21e782a5f
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-manual/src/locale/en-US.json
@@ -0,0 +1,30 @@
+{
+ "Manual": "Manual",
+ "Could be used for manually submitting data, and determine whether to continue or exit. Workflow will generate a todo item for assigned user when it reaches a manual node, and continue processing after user submits the form.": "Could be used for manually submitting data, and determine whether to continue or exit. Workflow will generate a todo item for assigned user when it reaches a manual node, and continue processing after user submits the form.",
+ "Values preset in this form will override user submitted ones when continue or reject.": "Values preset in this form will override user submitted ones when continue or reject.",
+ "Assignee": "Assignee",
+ "Assignees": "Assignees",
+ "User interface": "User interface",
+ "Configure user interface": "Configure user interface",
+ "View user interface": "View user interface",
+ "Separately": "Separately",
+ "Each user has own task": "Each user has own task",
+ "Collaboratively": "Collaboratively",
+ "Everyone shares one task": "Everyone shares one task",
+ "Negotiation": "Negotiation",
+ "All pass": "All pass",
+ "Everyone should pass": "Everyone should pass",
+ "Any pass": "Any pass",
+ "Anyone pass": "Anyone pass",
+ "Field name existed in form": "Field name existed in form",
+ "Continue the process": "Continue the process",
+ "Terminate the process": "Terminate the process",
+ "Save temporarily": "Save temporarily",
+ "Custom form": "Custom form",
+ "Data record": "Data record",
+ "Create record form": "Create record form",
+ "Update record form": "Update record form",
+ "Filter settings": "Filter settings",
+ "Workflow todos": "Workflow todos",
+ "Task": "Task"
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-manual/src/locale/index.ts b/packages/plugins/@nocobase/plugin-workflow-manual/src/locale/index.ts
new file mode 100644
index 0000000000..6bec93a944
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-manual/src/locale/index.ts
@@ -0,0 +1,12 @@
+import { useTranslation } from 'react-i18next';
+
+export const NAMESPACE = 'workflow-manual';
+
+export function useLang(key: string, options = {}) {
+ const { t } = usePluginTranslation(options);
+ return t(key);
+}
+
+export function usePluginTranslation(options) {
+ return useTranslation(NAMESPACE, options);
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-manual/src/locale/zh-CN.json b/packages/plugins/@nocobase/plugin-workflow-manual/src/locale/zh-CN.json
new file mode 100644
index 0000000000..3d39a02cdc
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-manual/src/locale/zh-CN.json
@@ -0,0 +1,30 @@
+{
+ "Manual": "人工处理",
+ "Could be used for manually submitting data, and determine whether to continue or exit. Workflow will generate a todo item for assigned user when it reaches a manual node, and continue processing after user submits the form.": "可用于人工提交数据,并决定是否继续或退出流程。工作流在执行到人工节点时会为被指派的用户生成待办事项,直到用户提交对应表单后继续处理该流程。",
+ "Values preset in this form will override user submitted ones when continue or reject.": "表单中预设的字段值会在用户提交继续或拒绝时覆盖相应字段的值。",
+ "Assignee": "负责人",
+ "Assignees": "负责人",
+ "User interface": "操作界面",
+ "Configure user interface": "配置界面",
+ "View user interface": "查看界面",
+ "Separately": "分别处理",
+ "Each user has own task": "每个人处理各自的任务",
+ "Collaboratively": "协作处理",
+ "Everyone shares one task": "所有人共享同一个任务",
+ "Negotiation": "协商机制",
+ "All pass": "全部通过",
+ "Everyone should pass": "每个人通过才通过",
+ "Any pass": "任意通过",
+ "Anyone pass": "任何一人通过即通过",
+ "Field name existed in form": "表单中已有对应标识的字段",
+ "Continue the process": "继续流程",
+ "Terminate the process": "终止流程",
+ "Save temporarily": "暂存",
+ "Custom form": "自定义表单",
+ "Data record": "数据记录",
+ "Create record form": "新增数据表单",
+ "Update record form": "更新数据表单",
+ "Filter settings": "筛选设置",
+ "Workflow todos": "工作流待办",
+ "Task": "任务"
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/server/instructions/manual/index.ts b/packages/plugins/@nocobase/plugin-workflow-manual/src/server/ManualInstruction.ts
similarity index 78%
rename from packages/plugins/@nocobase/plugin-workflow/src/server/instructions/manual/index.ts
rename to packages/plugins/@nocobase/plugin-workflow-manual/src/server/ManualInstruction.ts
index 90741e48a6..0ab1d5f261 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/server/instructions/manual/index.ts
+++ b/packages/plugins/@nocobase/plugin-workflow-manual/src/server/ManualInstruction.ts
@@ -1,14 +1,6 @@
-import actions from '@nocobase/actions';
-import { HandlerType } from '@nocobase/resourcer';
import { Registry } from '@nocobase/utils';
+import WorkflowPlugin, { Processor, JOB_STATUS, Instruction } from '@nocobase/plugin-workflow';
-import Plugin, { Processor } from '../..';
-import { JOB_STATUS } from '../../constants';
-import { Instruction } from '..';
-import jobsCollection from './collecions/jobs';
-import usersCollection from './collecions/users';
-import usersJobsCollection from './collecions/users_jobs';
-import { submit } from './actions';
import initFormTypes, { FormHandler } from './forms';
type FormType = {
@@ -90,36 +82,11 @@ function getMode(mode) {
}
}
-export default class implements Instruction {
+export default class extends Instruction {
formTypes = new Registry();
- constructor(protected plugin: Plugin) {
- plugin.db.collection(usersJobsCollection);
- plugin.db.extendCollection(usersCollection);
- plugin.db.extendCollection(jobsCollection);
-
- plugin.app.resource({
- name: 'users_jobs',
- actions: {
- list: {
- filter: {
- $or: [
- {
- 'workflow.enabled': true,
- },
- {
- 'workflow.enabled': false,
- status: {
- $ne: JOB_STATUS.PENDING,
- },
- },
- ],
- },
- handler: actions.list as HandlerType,
- },
- submit,
- },
- });
+ constructor(public plugin: WorkflowPlugin) {
+ super(plugin);
initFormTypes(this);
}
diff --git a/packages/plugins/@nocobase/plugin-workflow-manual/src/server/Plugin.ts b/packages/plugins/@nocobase/plugin-workflow-manual/src/server/Plugin.ts
new file mode 100644
index 0000000000..0e52c392d8
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-manual/src/server/Plugin.ts
@@ -0,0 +1,48 @@
+import { Plugin } from '@nocobase/server';
+import actions from '@nocobase/actions';
+import { HandlerType } from '@nocobase/resourcer';
+import WorkflowPlugin, { JOB_STATUS } from '@nocobase/plugin-workflow';
+
+import jobsCollection from './collecions/jobs';
+import usersCollection from './collecions/users';
+import usersJobsCollection from './collecions/users_jobs';
+import { submit } from './actions';
+
+import ManualInstruction from './ManualInstruction';
+
+export default class extends Plugin {
+ workflow: WorkflowPlugin;
+
+ async load() {
+ this.app.db.collection(usersJobsCollection);
+ this.app.db.extendCollection(usersCollection);
+ this.app.db.extendCollection(jobsCollection);
+
+ this.app.resource({
+ name: 'users_jobs',
+ actions: {
+ list: {
+ filter: {
+ $or: [
+ {
+ 'workflow.enabled': true,
+ },
+ {
+ 'workflow.enabled': false,
+ status: {
+ $ne: JOB_STATUS.PENDING,
+ },
+ },
+ ],
+ },
+ handler: actions.list as HandlerType,
+ },
+ submit,
+ },
+ });
+
+ const workflowPlugin = this.app.getPlugin('workflow') as WorkflowPlugin;
+ this.workflow = workflowPlugin;
+ workflowPlugin.instructions.register('manual', new ManualInstruction(workflowPlugin));
+ }
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/server/__tests__/collections/categories.ts b/packages/plugins/@nocobase/plugin-workflow-manual/src/server/__tests__/collections/categories.ts
similarity index 58%
rename from packages/plugins/@nocobase/plugin-workflow/src/server/__tests__/collections/categories.ts
rename to packages/plugins/@nocobase/plugin-workflow-manual/src/server/__tests__/collections/categories.ts
index e25fd628f9..1c73e2e435 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/server/__tests__/collections/categories.ts
+++ b/packages/plugins/@nocobase/plugin-workflow-manual/src/server/__tests__/collections/categories.ts
@@ -7,18 +7,6 @@ export default {
type: 'string',
name: 'title',
},
- {
- type: 'string',
- name: 'engine',
- },
- {
- type: 'string',
- name: 'collection',
- },
- {
- type: 'text',
- name: 'expression',
- },
{
type: 'hasMany',
name: 'posts',
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/server/__tests__/collections/comments.ts b/packages/plugins/@nocobase/plugin-workflow-manual/src/server/__tests__/collections/comments.ts
similarity index 100%
rename from packages/plugins/@nocobase/plugin-workflow/src/server/__tests__/collections/comments.ts
rename to packages/plugins/@nocobase/plugin-workflow-manual/src/server/__tests__/collections/comments.ts
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/server/__tests__/collections/posts.ts b/packages/plugins/@nocobase/plugin-workflow-manual/src/server/__tests__/collections/posts.ts
similarity index 91%
rename from packages/plugins/@nocobase/plugin-workflow/src/server/__tests__/collections/posts.ts
rename to packages/plugins/@nocobase/plugin-workflow-manual/src/server/__tests__/collections/posts.ts
index 2d672ab43b..7e8e98db5d 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/server/__tests__/collections/posts.ts
+++ b/packages/plugins/@nocobase/plugin-workflow-manual/src/server/__tests__/collections/posts.ts
@@ -36,9 +36,5 @@ export default {
name: 'read',
defaultValue: 0,
},
- {
- type: 'expression',
- name: 'dexp',
- },
],
} as CollectionOptions;
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/server/__tests__/collections/replies.ts b/packages/plugins/@nocobase/plugin-workflow-manual/src/server/__tests__/collections/replies.ts
similarity index 100%
rename from packages/plugins/@nocobase/plugin-workflow/src/server/__tests__/collections/replies.ts
rename to packages/plugins/@nocobase/plugin-workflow-manual/src/server/__tests__/collections/replies.ts
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/server/__tests__/collections/tags.ts b/packages/plugins/@nocobase/plugin-workflow-manual/src/server/__tests__/collections/tags.ts
similarity index 100%
rename from packages/plugins/@nocobase/plugin-workflow/src/server/__tests__/collections/tags.ts
rename to packages/plugins/@nocobase/plugin-workflow-manual/src/server/__tests__/collections/tags.ts
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/server/__tests__/instructions/manual.test.ts b/packages/plugins/@nocobase/plugin-workflow-manual/src/server/__tests__/instruction.test.ts
similarity index 99%
rename from packages/plugins/@nocobase/plugin-workflow/src/server/__tests__/instructions/manual.test.ts
rename to packages/plugins/@nocobase/plugin-workflow-manual/src/server/__tests__/instruction.test.ts
index f2699c301f..724fd19819 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/server/__tests__/instructions/manual.test.ts
+++ b/packages/plugins/@nocobase/plugin-workflow-manual/src/server/__tests__/instruction.test.ts
@@ -1,8 +1,10 @@
import Database from '@nocobase/database';
import UserPlugin from '@nocobase/plugin-users';
import { MockServer } from '@nocobase/test';
-import { getApp, sleep } from '..';
-import { EXECUTION_STATUS, JOB_STATUS } from '../../constants';
+import { EXECUTION_STATUS, JOB_STATUS } from '@nocobase/plugin-workflow';
+import { getApp, sleep } from '@nocobase/plugin-workflow-test';
+
+import Plugin from '..';
// NOTE: skipped because time is not stable on github ci, but should work in local
describe('workflow > instructions > manual', () => {
@@ -20,7 +22,7 @@ describe('workflow > instructions > manual', () => {
beforeEach(async () => {
app = await getApp({
- plugins: ['users', 'auth'],
+ plugins: ['users', 'auth', Plugin],
});
await app.getPlugin('auth').install();
agent = app.agent();
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/server/instructions/manual/actions.ts b/packages/plugins/@nocobase/plugin-workflow-manual/src/server/actions.ts
similarity index 92%
rename from packages/plugins/@nocobase/plugin-workflow/src/server/instructions/manual/actions.ts
rename to packages/plugins/@nocobase/plugin-workflow-manual/src/server/actions.ts
index c3711bd6b2..a90ce0f7f4 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/server/instructions/manual/actions.ts
+++ b/packages/plugins/@nocobase/plugin-workflow-manual/src/server/actions.ts
@@ -1,8 +1,7 @@
import { Context, utils } from '@nocobase/actions';
+import WorkflowPlugin, { EXECUTION_STATUS, JOB_STATUS } from '@nocobase/plugin-workflow';
-import ManualInstruction from '.';
-import Plugin from '../..';
-import { EXECUTION_STATUS, JOB_STATUS } from '../../constants';
+import ManualInstruction from './ManualInstruction';
export async function submit(context: Context, next) {
const repository = utils.getRepositoryFromParams(context);
@@ -13,7 +12,7 @@ export async function submit(context: Context, next) {
return context.throw(401);
}
- const plugin: Plugin = context.app.pm.get('workflow') as Plugin;
+ const plugin: WorkflowPlugin = context.app.pm.get('workflow') as WorkflowPlugin;
const instruction = plugin.instructions.get('manual') as ManualInstruction;
const userJob = await repository.findOne({
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/server/instructions/manual/collecions/jobs.ts b/packages/plugins/@nocobase/plugin-workflow-manual/src/server/collecions/jobs.ts
similarity index 100%
rename from packages/plugins/@nocobase/plugin-workflow/src/server/instructions/manual/collecions/jobs.ts
rename to packages/plugins/@nocobase/plugin-workflow-manual/src/server/collecions/jobs.ts
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/server/instructions/manual/collecions/users.ts b/packages/plugins/@nocobase/plugin-workflow-manual/src/server/collecions/users.ts
similarity index 100%
rename from packages/plugins/@nocobase/plugin-workflow/src/server/instructions/manual/collecions/users.ts
rename to packages/plugins/@nocobase/plugin-workflow-manual/src/server/collecions/users.ts
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/server/instructions/manual/collecions/users_jobs.ts b/packages/plugins/@nocobase/plugin-workflow-manual/src/server/collecions/users_jobs.ts
similarity index 100%
rename from packages/plugins/@nocobase/plugin-workflow/src/server/instructions/manual/collecions/users_jobs.ts
rename to packages/plugins/@nocobase/plugin-workflow-manual/src/server/collecions/users_jobs.ts
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/server/instructions/manual/forms/create.ts b/packages/plugins/@nocobase/plugin-workflow-manual/src/server/forms/create.ts
similarity index 85%
rename from packages/plugins/@nocobase/plugin-workflow/src/server/instructions/manual/forms/create.ts
rename to packages/plugins/@nocobase/plugin-workflow-manual/src/server/forms/create.ts
index 87251837d2..f0f9d2cee9 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/server/instructions/manual/forms/create.ts
+++ b/packages/plugins/@nocobase/plugin-workflow-manual/src/server/forms/create.ts
@@ -1,5 +1,5 @@
-import { Processor } from '../../..';
-import ManualInstruction from '..';
+import { Processor } from '@nocobase/plugin-workflow';
+import ManualInstruction from '../ManualInstruction';
export default async function (this: ManualInstruction, instance, { collection }, processor: Processor) {
const repo = this.plugin.db.getRepository(collection);
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/server/instructions/manual/forms/index.ts b/packages/plugins/@nocobase/plugin-workflow-manual/src/server/forms/index.ts
similarity index 73%
rename from packages/plugins/@nocobase/plugin-workflow/src/server/instructions/manual/forms/index.ts
rename to packages/plugins/@nocobase/plugin-workflow-manual/src/server/forms/index.ts
index b1fe09f627..2648db4549 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/server/instructions/manual/forms/index.ts
+++ b/packages/plugins/@nocobase/plugin-workflow-manual/src/server/forms/index.ts
@@ -1,5 +1,6 @@
-import { Processor } from '../../..';
-import ManualInstruction from '..';
+import { Processor } from '@nocobase/plugin-workflow';
+
+import ManualInstruction from '../ManualInstruction';
import create from './create';
import update from './update';
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/server/instructions/manual/forms/update.ts b/packages/plugins/@nocobase/plugin-workflow-manual/src/server/forms/update.ts
similarity index 86%
rename from packages/plugins/@nocobase/plugin-workflow/src/server/instructions/manual/forms/update.ts
rename to packages/plugins/@nocobase/plugin-workflow-manual/src/server/forms/update.ts
index 7952eda2f3..a749c6b3a1 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/server/instructions/manual/forms/update.ts
+++ b/packages/plugins/@nocobase/plugin-workflow-manual/src/server/forms/update.ts
@@ -1,5 +1,5 @@
-import { Processor } from '../../..';
-import ManualInstruction from '..';
+import { Processor } from '@nocobase/plugin-workflow';
+import ManualInstruction from '../ManualInstruction';
export default async function (this: ManualInstruction, instance, { collection, filter = {} }, processor: Processor) {
const repo = this.plugin.db.getRepository(collection);
diff --git a/packages/plugins/@nocobase/plugin-workflow-manual/src/server/index.ts b/packages/plugins/@nocobase/plugin-workflow-manual/src/server/index.ts
new file mode 100644
index 0000000000..3b60b3bee9
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-manual/src/server/index.ts
@@ -0,0 +1 @@
+export { default } from './Plugin';
diff --git a/packages/plugins/@nocobase/plugin-workflow-parallel/LICENSE b/packages/plugins/@nocobase/plugin-workflow-parallel/LICENSE
new file mode 100644
index 0000000000..0ad25db4bd
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-parallel/LICENSE
@@ -0,0 +1,661 @@
+ GNU AFFERO GENERAL PUBLIC LICENSE
+ Version 3, 19 November 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ 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,
+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
+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
+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
+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
+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
+ensure that, in such cases, the modified source code becomes available
+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
+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
+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
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "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
+works, such as semiconductor masks.
+
+ "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
+in a fashion requiring copyright permission, other than the making of an
+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
+on the Program.
+
+ 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,
+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
+a computer network, with no transfer of a copy, is not conveying.
+
+ 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
+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.
+
+ 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
+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
+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
+"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 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
+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
+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
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ 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
+covered work is covered by this License only if the output, given its
+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
+convey, without conditions so long as your license otherwise remains
+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
+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
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ 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
+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
+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.
+
+ 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
+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,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ 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:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ 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
+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
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ 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:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ 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
+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
+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
+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
+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,
+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
+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
+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
+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
+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
+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,
+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.
+
+ "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
+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
+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
+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
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ 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
+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
+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
+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
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ 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
+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
+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
+licenses of parties who have received copies or rights from you under
+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.
+
+ 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,
+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
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ 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
+for enforcing compliance by third parties with this License.
+
+ 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
+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
+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
+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.
+
+ 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
+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
+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
+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
+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
+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,
+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,
+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
+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
+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
+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
+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
+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
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+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
+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.
+
+ 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
+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
+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.
+
+ 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
+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
+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
+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.
+
+ 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
+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
+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
+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
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 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
+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
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ 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
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+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.
+
+ 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
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ 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 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.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ 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
+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
+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,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU AGPL, see
+.
diff --git a/packages/plugins/@nocobase/plugin-workflow-parallel/README.md b/packages/plugins/@nocobase/plugin-workflow-parallel/README.md
new file mode 100644
index 0000000000..e83d0373a4
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-parallel/README.md
@@ -0,0 +1,9 @@
+# workflow
+
+English | [中文](./README.zh-CN.md)
+
+## 安装激活
+
+内置插件无需手动安装激活。
+
+## 使用方法
diff --git a/packages/plugins/@nocobase/plugin-workflow-parallel/README.zh-CN.md b/packages/plugins/@nocobase/plugin-workflow-parallel/README.zh-CN.md
new file mode 100644
index 0000000000..e690848dd1
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-parallel/README.zh-CN.md
@@ -0,0 +1,9 @@
+# workflow
+
+[English](./README.md) | 中文
+
+## 安装激活
+
+内置插件无需手动安装激活。
+
+## 使用方法
diff --git a/packages/plugins/@nocobase/plugin-workflow-parallel/client.d.ts b/packages/plugins/@nocobase/plugin-workflow-parallel/client.d.ts
new file mode 100644
index 0000000000..6c459cbac4
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-parallel/client.d.ts
@@ -0,0 +1,2 @@
+export * from './dist/client';
+export { default } from './dist/client';
diff --git a/packages/plugins/@nocobase/plugin-workflow-parallel/client.js b/packages/plugins/@nocobase/plugin-workflow-parallel/client.js
new file mode 100644
index 0000000000..b6e3be70e6
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-parallel/client.js
@@ -0,0 +1 @@
+module.exports = require('./dist/client/index.js');
diff --git a/packages/plugins/@nocobase/plugin-workflow-parallel/package.json b/packages/plugins/@nocobase/plugin-workflow-parallel/package.json
new file mode 100644
index 0000000000..33b023706a
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-parallel/package.json
@@ -0,0 +1,25 @@
+{
+ "name": "@nocobase/plugin-workflow-parallel",
+ "displayName": "Workflow: Parallel node",
+ "displayName.zh-CN": "工作流:并行分支节点",
+ "description": "Could be used for parallel execution of branch processes in the workflow.",
+ "description.zh-CN": "用于在工作流中需要并行执行的分支流程。",
+ "version": "0.17.0-alpha.3",
+ "license": "AGPL-3.0",
+ "main": "./dist/server/index.js",
+ "devDependencies": {
+ "@ant-design/icons": "5.x",
+ "antd": "5.x",
+ "react": "18.x",
+ "react-i18next": "^11.15.1"
+ },
+ "peerDependencies": {
+ "@nocobase/client": "0.x",
+ "@nocobase/database": "0.x",
+ "@nocobase/plugin-workflow": ">=0.17.0-alpha.3",
+ "@nocobase/plugin-workflow-test": ">=0.17.0-alpha.3",
+ "@nocobase/server": "0.x",
+ "@nocobase/test": "0.x"
+ },
+ "gitHead": "ce588eefb0bfc50f7d5bbee575e0b5e843bf6644"
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-parallel/server.d.ts b/packages/plugins/@nocobase/plugin-workflow-parallel/server.d.ts
new file mode 100644
index 0000000000..c41081ddc6
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-parallel/server.d.ts
@@ -0,0 +1,2 @@
+export * from './dist/server';
+export { default } from './dist/server';
diff --git a/packages/plugins/@nocobase/plugin-workflow-parallel/server.js b/packages/plugins/@nocobase/plugin-workflow-parallel/server.js
new file mode 100644
index 0000000000..972842039a
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-parallel/server.js
@@ -0,0 +1 @@
+module.exports = require('./dist/server/index.js');
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/parallel.tsx b/packages/plugins/@nocobase/plugin-workflow-parallel/src/client/ParallelInstruction.tsx
similarity index 81%
rename from packages/plugins/@nocobase/plugin-workflow/src/client/nodes/parallel.tsx
rename to packages/plugins/@nocobase/plugin-workflow-parallel/src/client/ParallelInstruction.tsx
index a9ee2a3e88..ff81623b48 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/parallel.tsx
+++ b/packages/plugins/@nocobase/plugin-workflow-parallel/src/client/ParallelInstruction.tsx
@@ -1,21 +1,27 @@
-import { PlusOutlined } from '@ant-design/icons';
-import { css } from '@nocobase/client';
-import { Button, Tooltip } from 'antd';
import React, { useState } from 'react';
-import { NodeDefaultView } from '.';
-import { Branch } from '../Branch';
-import { useFlowContext } from '../FlowContext';
-import { RadioWithTooltip } from '../components/RadioWithTooltip';
-import { useGetAriaLabelOfAddButton } from '../hooks/useGetAriaLabelOfAddButton';
-import { NAMESPACE, lang } from '../locale';
-import useStyles from '../style';
+import { Button, Tooltip } from 'antd';
+import { PlusOutlined } from '@ant-design/icons';
-export default {
- title: `{{t("Parallel branch", { ns: "${NAMESPACE}" })}}`,
- type: 'parallel',
- group: 'control',
- description: `{{t("Run multiple branch processes in parallel.", { ns: "${NAMESPACE}" })}}`,
- fieldset: {
+import { css } from '@nocobase/client';
+
+import {
+ NodeDefaultView,
+ Branch,
+ useFlowContext,
+ useStyles,
+ useGetAriaLabelOfAddButton,
+ RadioWithTooltip,
+ Instruction,
+} from '@nocobase/plugin-workflow/client';
+
+import { NAMESPACE, useLang } from '../locale';
+
+export default class extends Instruction {
+ title = `{{t("Parallel branch", { ns: "${NAMESPACE}" })}}`;
+ type = 'parallel';
+ group = 'control';
+ description = `{{t("Run multiple branch processes in parallel.", { ns: "${NAMESPACE}" })}}`;
+ fieldset = {
mode: {
type: 'string',
title: `{{t("Mode", { ns: "${NAMESPACE}" })}}`,
@@ -42,14 +48,18 @@ export default {
},
default: 'all',
},
- },
- view: {},
- component: function Component({ data }) {
+ };
+ components = {
+ RadioWithTooltip,
+ };
+ Component({ data }) {
+ // eslint-disable-next-line react-hooks/rules-of-hooks
const { styles } = useStyles();
const {
id,
config: { mode },
} = data;
+ // eslint-disable-next-line react-hooks/rules-of-hooks
const { workflow, nodes } = useFlowContext();
const branches = nodes
.reduce((result, node) => {
@@ -59,8 +69,12 @@ export default {
return result;
}, [])
.sort((a, b) => a.branchIndex - b.branchIndex);
+ // eslint-disable-next-line react-hooks/rules-of-hooks
const [branchCount, setBranchCount] = useState(Math.max(2, branches.length));
+ // eslint-disable-next-line react-hooks/rules-of-hooks
const { getAriaLabel } = useGetAriaLabelOfAddButton(data);
+ // eslint-disable-next-line react-hooks/rules-of-hooks
+ const langAddBranch = useLang('Add branch');
const tempBranches = Array(Math.max(0, branchCount - branches.length)).fill(null);
const lastBranchHead = branches[branches.length - 1];
@@ -103,7 +117,7 @@ export default {
))}
);
- },
- components: {
- RadioWithTooltip,
- },
-};
+ }
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-parallel/src/client/index.ts b/packages/plugins/@nocobase/plugin-workflow-parallel/src/client/index.ts
new file mode 100644
index 0000000000..e175164d06
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-parallel/src/client/index.ts
@@ -0,0 +1,19 @@
+import { Plugin } from '@nocobase/client';
+import WorkflowPlugin from '@nocobase/plugin-workflow/client';
+
+import ParallelInstruction from './ParallelInstruction';
+
+export default class extends Plugin {
+ async afterAdd() {
+ // await this.app.pm.add()
+ }
+
+ async beforeLoad() {}
+
+ // You can get and modify the app instance here
+ async load() {
+ const workflow = this.app.pm.get(WorkflowPlugin);
+ const parallelInstruction = new ParallelInstruction();
+ workflow.instructions.register(parallelInstruction.type, parallelInstruction);
+ }
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-parallel/src/index.ts b/packages/plugins/@nocobase/plugin-workflow-parallel/src/index.ts
new file mode 100644
index 0000000000..7e74612df8
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-parallel/src/index.ts
@@ -0,0 +1,2 @@
+export * from './server';
+export { default } from './server';
diff --git a/packages/plugins/@nocobase/plugin-workflow-parallel/src/locale/en-US.json b/packages/plugins/@nocobase/plugin-workflow-parallel/src/locale/en-US.json
new file mode 100644
index 0000000000..b6ab2d0099
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-parallel/src/locale/en-US.json
@@ -0,0 +1,11 @@
+{
+ "Parallel branch": "Parallel branch",
+ "Run multiple branch processes in parallel.": "Run multiple branch processes in parallel.",
+ "Add branch": "Add branch",
+ "All succeeded": "All succeeded",
+ "Any succeeded": "Any succeeded",
+ "Any succeeded or failed": "Any succeeded or failed",
+ "Continue after all branches succeeded": "Continue after all branches succeeded",
+ "Continue after any branch succeeded": "Continue after any branch succeeded",
+ "Continue after any branch succeeded, or exit after any branch failed.": "Continue after any branch succeeded, or exit after any branch failed."
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-parallel/src/locale/es-ES.json b/packages/plugins/@nocobase/plugin-workflow-parallel/src/locale/es-ES.json
new file mode 100644
index 0000000000..b0733c6d23
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-parallel/src/locale/es-ES.json
@@ -0,0 +1,10 @@
+{
+ "Parallel branch": "Rama paralela",
+ "Add branch": "Añadir rama",
+ "All succeeded": "Todo correcto",
+ "Any succeeded": "Cualquiera con éxito",
+ "Any succeeded or failed": "Cualquiera tuvo éxito o falló",
+ "Continue after all branches succeeded": "Continuar después que todas las ramas han tenido éxito",
+ "Continue after any branch succeeded": "Continuar después que cualquier rama tenga éxito",
+ "Continue after any branch succeeded, or exit after any branch failed": "Continuar después de que cualquier rama tenga éxito, o salir después de que cualquier rama falle"
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-parallel/src/locale/fr-FR.json b/packages/plugins/@nocobase/plugin-workflow-parallel/src/locale/fr-FR.json
new file mode 100644
index 0000000000..33f4dc87ac
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-parallel/src/locale/fr-FR.json
@@ -0,0 +1,10 @@
+{
+ "Parallel branch": "Branche parallèle",
+ "Add branch": "Ajouter une branche",
+ "All succeeded": "Tous réussis",
+ "Any succeeded": "Un réussi",
+ "Any succeeded or failed": "Un réussi ou un échoué",
+ "Continue after all branches succeeded": "Continuer après la réussite de toutes les branches",
+ "Continue after any branch succeeded": "Continuer après la réussite d'une branche",
+ "Continue after any branch succeeded, or exit after any branch failed": "Continuer après la réussite d'une branche, ou quitter après l'échec d'une branche"
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-parallel/src/locale/index.ts b/packages/plugins/@nocobase/plugin-workflow-parallel/src/locale/index.ts
new file mode 100644
index 0000000000..5bc45d6429
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-parallel/src/locale/index.ts
@@ -0,0 +1,12 @@
+import { useTranslation } from 'react-i18next';
+
+export const NAMESPACE = 'workflow-parallel';
+
+export function useLang(key: string, options = {}) {
+ const { t } = usePluginTranslation(options);
+ return t(key);
+}
+
+export function usePluginTranslation(options) {
+ return useTranslation(NAMESPACE, options);
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-parallel/src/locale/ja-JP.json b/packages/plugins/@nocobase/plugin-workflow-parallel/src/locale/ja-JP.json
new file mode 100644
index 0000000000..300bcebc78
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-parallel/src/locale/ja-JP.json
@@ -0,0 +1,7 @@
+{
+ "Parallel branch": "分岐",
+ "All succeeded": "すべて成功",
+ "Any succeeded": "いずれかが成功",
+ "Continue after all branches succeeded": "すべての分岐が成功した後に続行",
+ "Continue after any branch succeeded": "いずれかの分岐が成功した後に続行"
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-parallel/src/locale/pt-BR.json b/packages/plugins/@nocobase/plugin-workflow-parallel/src/locale/pt-BR.json
new file mode 100644
index 0000000000..a68ad96081
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-parallel/src/locale/pt-BR.json
@@ -0,0 +1,10 @@
+{
+ "Parallel branch": "Ramo paralelo",
+ "Add branch": "Adicionar ramo",
+ "All succeeded": "Todos com sucesso",
+ "Any succeeded": "Qualquer um com sucesso",
+ "Any succeeded or failed": "Qualquer um com sucesso ou falha",
+ "Continue after all branches succeeded": "Continuar após todos os ramos com sucesso",
+ "Continue after any branch succeeded": "Continuar após qualquer ramo com sucesso",
+ "Continue after any branch succeeded, or exit after any branch failed": "Continuar após qualquer ramo com sucesso ou sair após qualquer ramo falhar"
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-parallel/src/locale/ru-RU.json b/packages/plugins/@nocobase/plugin-workflow-parallel/src/locale/ru-RU.json
new file mode 100644
index 0000000000..61faedcaa4
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-parallel/src/locale/ru-RU.json
@@ -0,0 +1,7 @@
+{
+ "Parallel branch": "Параллельная ветвь",
+ "All succeeded": "Всё успешно",
+ "Any succeeded": "Что-то успешно",
+ "Continue after all branches succeeded": "Продолжать после успеха на всех ветвях",
+ "Continue after any branch succeeded": "Продолжать после успеха на любой из ветвей"
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-parallel/src/locale/tr-TR.json b/packages/plugins/@nocobase/plugin-workflow-parallel/src/locale/tr-TR.json
new file mode 100644
index 0000000000..a0fad8c6ae
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-parallel/src/locale/tr-TR.json
@@ -0,0 +1,7 @@
+{
+ "Parallel branch": "Paralel dal",
+ "All succeeded": "Hepsi başarılı",
+ "Any succeeded": "Herhangi biri başarılı",
+ "Continue after all branches succeeded": "Tüm dallar başarılı olduktan sonra devam et",
+ "Continue after any branch succeeded": "Herhangi bir dal başarılı olduktan sonra devam et"
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-parallel/src/locale/zh-CN.json b/packages/plugins/@nocobase/plugin-workflow-parallel/src/locale/zh-CN.json
new file mode 100644
index 0000000000..57ebdfc9a1
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-parallel/src/locale/zh-CN.json
@@ -0,0 +1,11 @@
+{
+ "Parallel branch": "分支",
+ "Run multiple branch processes in parallel.": "并行运行多个分支流程。",
+ "Add branch": "增加分支",
+ "All succeeded": "全部成功",
+ "Any succeeded": "任意成功",
+ "Any succeeded or failed": "任意成功或失败",
+ "Continue after all branches succeeded": "全部分支都成功后才能继续",
+ "Continue after any branch succeeded": "任意分支成功后就继续",
+ "Continue after any branch succeeded, or exit after any branch failed.": "任意分支成功就继续流程,或者任意分支失败就退出流程。"
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/server/instructions/parallel.ts b/packages/plugins/@nocobase/plugin-workflow-parallel/src/server/ParallelInstruction.ts
similarity index 95%
rename from packages/plugins/@nocobase/plugin-workflow/src/server/instructions/parallel.ts
rename to packages/plugins/@nocobase/plugin-workflow-parallel/src/server/ParallelInstruction.ts
index 166d8fae57..e60001d000 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/server/instructions/parallel.ts
+++ b/packages/plugins/@nocobase/plugin-workflow-parallel/src/server/ParallelInstruction.ts
@@ -1,6 +1,4 @@
-import Processor from '../Processor';
-import { JOB_STATUS } from '../constants';
-import type { FlowNodeModel, JobModel } from '../types';
+import { Processor, Instruction, JOB_STATUS, FlowNodeModel, JobModel } from '@nocobase/plugin-workflow';
export const PARALLEL_MODE = {
ALL: 'all',
@@ -55,7 +53,7 @@ const Modes = {
},
};
-export default {
+export default class extends Instruction {
async run(node: FlowNodeModel, prevJob: JobModel, processor: Processor) {
const branches = processor.getBranches(node);
@@ -87,7 +85,7 @@ export default {
);
return null;
- },
+ }
async resume(node: FlowNodeModel, branchJob, processor: Processor) {
const job = processor.findBranchParentJob(branchJob, node) as JobModel;
@@ -117,5 +115,5 @@ export default {
}
return job;
- },
-};
+ }
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-parallel/src/server/Plugin.ts b/packages/plugins/@nocobase/plugin-workflow-parallel/src/server/Plugin.ts
new file mode 100644
index 0000000000..9caf5eee2f
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-parallel/src/server/Plugin.ts
@@ -0,0 +1,14 @@
+import { Plugin } from '@nocobase/server';
+import WorkflowPlugin from '@nocobase/plugin-workflow';
+
+import ParallelInstruction from './ParallelInstruction';
+
+export default class extends Plugin {
+ workflow: WorkflowPlugin;
+
+ async load() {
+ const workflowPlugin = this.app.getPlugin('workflow') as WorkflowPlugin;
+ this.workflow = workflowPlugin;
+ workflowPlugin.instructions.register('parallel', new ParallelInstruction(workflowPlugin));
+ }
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/server/__tests__/instructions/parallel.test.ts b/packages/plugins/@nocobase/plugin-workflow-parallel/src/server/__tests__/instruction.test.ts
similarity index 77%
rename from packages/plugins/@nocobase/plugin-workflow/src/server/__tests__/instructions/parallel.test.ts
rename to packages/plugins/@nocobase/plugin-workflow-parallel/src/server/__tests__/instruction.test.ts
index a9fa10d4e3..980d30cf23 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/server/__tests__/instructions/parallel.test.ts
+++ b/packages/plugins/@nocobase/plugin-workflow-parallel/src/server/__tests__/instruction.test.ts
@@ -1,7 +1,9 @@
import Database from '@nocobase/database';
import { Application } from '@nocobase/server';
-import { getApp, sleep } from '..';
-import { EXECUTION_STATUS, JOB_STATUS } from '../../constants';
+import { BRANCH_INDEX, EXECUTION_STATUS, JOB_STATUS } from '@nocobase/plugin-workflow';
+import { getApp, sleep } from '@nocobase/plugin-workflow-test';
+
+import Plugin from '..';
describe('workflow > instructions > parallel', () => {
let app: Application;
@@ -12,7 +14,9 @@ describe('workflow > instructions > parallel', () => {
let plugin;
beforeEach(async () => {
- app = await getApp();
+ app = await getApp({
+ plugins: [Plugin],
+ });
plugin = app.pm.get('workflow');
db = app.db;
@@ -357,21 +361,18 @@ describe('workflow > instructions > parallel', () => {
});
const n2 = await workflow.createNode({
- title: 'manual',
- type: 'manual',
+ type: 'prompt',
upstreamId: n1.id,
branchIndex: 0,
});
const n3 = await workflow.createNode({
- title: 'echo',
type: 'echo',
upstreamId: n1.id,
branchIndex: 1,
});
const n4 = await workflow.createNode({
- title: 'echo on end',
type: 'echo',
upstreamId: n1.id,
});
@@ -398,6 +399,7 @@ describe('workflow > instructions > parallel', () => {
const [e2] = await workflow.getExecutions();
expect(e2.status).toBe(EXECUTION_STATUS.RESOLVED);
const jobs = await e2.getJobs({ order: [['id', 'ASC']] });
+ console.log(jobs);
expect(jobs.length).toBe(4);
});
});
@@ -442,4 +444,117 @@ describe('workflow > instructions > parallel', () => {
expect(jobs.length).toBe(5);
});
});
+
+ describe('mixed', () => {
+ it('condition branches contains parallel', async () => {
+ const n1 = await workflow.createNode({
+ type: 'condition',
+ });
+
+ const n2 = await workflow.createNode({
+ type: 'parallel',
+ branchIndex: BRANCH_INDEX.ON_TRUE,
+ upstreamId: n1.id,
+ });
+
+ const n3 = await workflow.createNode({
+ type: 'prompt',
+ upstreamId: n2.id,
+ branchIndex: 0,
+ });
+
+ const n4 = await workflow.createNode({
+ type: 'echo',
+ upstreamId: n2.id,
+ branchIndex: 1,
+ });
+
+ const n5 = await workflow.createNode({
+ type: 'echo',
+ upstreamId: n1.id,
+ });
+
+ await n1.setDownstream(n5);
+
+ const post = await PostRepo.create({ values: { title: 't1' } });
+
+ await sleep(500);
+
+ const [execution] = await workflow.getExecutions();
+ expect(execution.status).toEqual(EXECUTION_STATUS.STARTED);
+
+ const pendingJobs = await execution.getJobs();
+ expect(pendingJobs.length).toBe(4);
+
+ const pending = pendingJobs.find((item) => item.nodeId === n3.id);
+ pending.set({
+ status: JOB_STATUS.RESOLVED,
+ result: 123,
+ });
+ pending.execution = execution;
+ await plugin.resume(pending);
+
+ await sleep(500);
+
+ expect(execution.status).toEqual(EXECUTION_STATUS.RESOLVED);
+ const jobs = await execution.getJobs({ order: [['id', 'ASC']] });
+ expect(jobs.length).toEqual(5);
+ });
+
+ it('parallel branches contains condition', async () => {
+ const n1 = await workflow.createNode({
+ type: 'parallel',
+ });
+
+ const n2 = await workflow.createNode({
+ type: 'prompt',
+ upstreamId: n1.id,
+ branchIndex: 0,
+ });
+
+ const n3 = await workflow.createNode({
+ type: 'condition',
+ upstreamId: n1.id,
+ branchIndex: 1,
+ });
+
+ const n4 = await workflow.createNode({
+ type: 'echo',
+ upstreamId: n3.id,
+ branchIndex: BRANCH_INDEX.ON_TRUE,
+ });
+
+ const n5 = await workflow.createNode({
+ type: 'echo',
+ upstreamId: n1.id,
+ });
+
+ await n1.setDownstream(n5);
+
+ const post = await PostRepo.create({ values: { title: 't1' } });
+
+ await sleep(500);
+
+ const [e1] = await workflow.getExecutions();
+ expect(e1.status).toEqual(EXECUTION_STATUS.STARTED);
+
+ const pendingJobs = await e1.getJobs();
+ expect(pendingJobs.length).toBe(4);
+
+ const pending = pendingJobs.find((item) => item.nodeId === n2.id);
+ pending.set({
+ status: JOB_STATUS.RESOLVED,
+ result: 123,
+ });
+ pending.execution = e1;
+ await plugin.resume(pending);
+
+ await sleep(500);
+
+ const [e2] = await workflow.getExecutions();
+ expect(e2.status).toEqual(EXECUTION_STATUS.RESOLVED);
+ const jobs = await e2.getJobs({ order: [['id', 'ASC']] });
+ expect(jobs.length).toEqual(5);
+ });
+ });
});
diff --git a/packages/plugins/@nocobase/plugin-workflow-parallel/src/server/index.ts b/packages/plugins/@nocobase/plugin-workflow-parallel/src/server/index.ts
new file mode 100644
index 0000000000..3b60b3bee9
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-parallel/src/server/index.ts
@@ -0,0 +1 @@
+export { default } from './Plugin';
diff --git a/packages/plugins/@nocobase/plugin-workflow-request/LICENSE b/packages/plugins/@nocobase/plugin-workflow-request/LICENSE
new file mode 100644
index 0000000000..0ad25db4bd
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-request/LICENSE
@@ -0,0 +1,661 @@
+ GNU AFFERO GENERAL PUBLIC LICENSE
+ Version 3, 19 November 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ 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,
+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
+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
+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
+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
+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
+ensure that, in such cases, the modified source code becomes available
+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
+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
+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
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "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
+works, such as semiconductor masks.
+
+ "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
+in a fashion requiring copyright permission, other than the making of an
+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
+on the Program.
+
+ 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,
+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
+a computer network, with no transfer of a copy, is not conveying.
+
+ 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
+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.
+
+ 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
+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
+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
+"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 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
+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
+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
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ 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
+covered work is covered by this License only if the output, given its
+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
+convey, without conditions so long as your license otherwise remains
+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
+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
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ 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
+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
+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.
+
+ 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
+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,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ 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:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ 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
+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
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ 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:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ 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
+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
+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
+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
+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,
+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
+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
+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
+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
+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
+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,
+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.
+
+ "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
+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
+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
+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
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ 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
+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
+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
+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
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ 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
+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
+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
+licenses of parties who have received copies or rights from you under
+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.
+
+ 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,
+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
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ 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
+for enforcing compliance by third parties with this License.
+
+ 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
+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
+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
+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.
+
+ 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
+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
+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
+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
+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
+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,
+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,
+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
+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
+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
+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
+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
+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
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+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
+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.
+
+ 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
+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
+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.
+
+ 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
+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
+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
+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.
+
+ 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
+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
+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
+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
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 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
+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
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ 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
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+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.
+
+ 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
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ 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 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.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ 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
+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
+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,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU AGPL, see
+.
diff --git a/packages/plugins/@nocobase/plugin-workflow-request/README.md b/packages/plugins/@nocobase/plugin-workflow-request/README.md
new file mode 100644
index 0000000000..e83d0373a4
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-request/README.md
@@ -0,0 +1,9 @@
+# workflow
+
+English | [中文](./README.zh-CN.md)
+
+## 安装激活
+
+内置插件无需手动安装激活。
+
+## 使用方法
diff --git a/packages/plugins/@nocobase/plugin-workflow-request/README.zh-CN.md b/packages/plugins/@nocobase/plugin-workflow-request/README.zh-CN.md
new file mode 100644
index 0000000000..e690848dd1
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-request/README.zh-CN.md
@@ -0,0 +1,9 @@
+# workflow
+
+[English](./README.md) | 中文
+
+## 安装激活
+
+内置插件无需手动安装激活。
+
+## 使用方法
diff --git a/packages/plugins/@nocobase/plugin-workflow-request/client.d.ts b/packages/plugins/@nocobase/plugin-workflow-request/client.d.ts
new file mode 100644
index 0000000000..6c459cbac4
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-request/client.d.ts
@@ -0,0 +1,2 @@
+export * from './dist/client';
+export { default } from './dist/client';
diff --git a/packages/plugins/@nocobase/plugin-workflow-request/client.js b/packages/plugins/@nocobase/plugin-workflow-request/client.js
new file mode 100644
index 0000000000..b6e3be70e6
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-request/client.js
@@ -0,0 +1 @@
+module.exports = require('./dist/client/index.js');
diff --git a/packages/plugins/@nocobase/plugin-workflow-request/package.json b/packages/plugins/@nocobase/plugin-workflow-request/package.json
new file mode 100644
index 0000000000..dfba4fa7cd
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-request/package.json
@@ -0,0 +1,24 @@
+{
+ "name": "@nocobase/plugin-workflow-request",
+ "displayName": "Workflow: HTTP request node",
+ "displayName.zh-CN": "工作流:HTTP 请求节点",
+ "description": "Send HTTP requests to any HTTP service for data interaction in workflow.",
+ "description.zh-CN": "可用于在工作流中向任意 HTTP 服务发送请求,进行数据交互。",
+ "version": "0.17.0-alpha.3",
+ "license": "AGPL-3.0",
+ "main": "./dist/server/index.js",
+ "devDependencies": {
+ "antd": "5.x",
+ "react": "18.x",
+ "react-i18next": "^11.15.1"
+ },
+ "peerDependencies": {
+ "@nocobase/client": "0.x",
+ "@nocobase/database": "0.x",
+ "@nocobase/plugin-workflow": ">=0.17.0-alpha.3",
+ "@nocobase/plugin-workflow-test": ">=0.17.0-alpha.3",
+ "@nocobase/server": "0.x",
+ "@nocobase/test": "0.x"
+ },
+ "gitHead": "ce588eefb0bfc50f7d5bbee575e0b5e843bf6644"
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-request/server.d.ts b/packages/plugins/@nocobase/plugin-workflow-request/server.d.ts
new file mode 100644
index 0000000000..c41081ddc6
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-request/server.d.ts
@@ -0,0 +1,2 @@
+export * from './dist/server';
+export { default } from './dist/server';
diff --git a/packages/plugins/@nocobase/plugin-workflow-request/server.js b/packages/plugins/@nocobase/plugin-workflow-request/server.js
new file mode 100644
index 0000000000..972842039a
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-request/server.js
@@ -0,0 +1 @@
+module.exports = require('./dist/server/index.js');
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/request.tsx b/packages/plugins/@nocobase/plugin-workflow-request/src/client/RequestInstruction.tsx
similarity index 91%
rename from packages/plugins/@nocobase/plugin-workflow/src/client/nodes/request.tsx
rename to packages/plugins/@nocobase/plugin-workflow-request/src/client/RequestInstruction.tsx
index ae71840d3d..bf8c4147c9 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/request.tsx
+++ b/packages/plugins/@nocobase/plugin-workflow-request/src/client/RequestInstruction.tsx
@@ -1,15 +1,17 @@
import { ArrayItems } from '@formily/antd-v5';
import { defaultFieldNames } from '@nocobase/client';
-import { NAMESPACE } from '../locale';
-import { WorkflowVariableInput, WorkflowVariableJSON } from '../variable';
-export default {
- title: `{{t("HTTP request", { ns: "${NAMESPACE}" })}}`,
- type: 'request',
- group: 'extended',
- description: `{{t("Send HTTP request to a URL. You can use the variables in the upstream nodes as request headers, parameters and request body.", { ns: "${NAMESPACE}" })}}`,
- fieldset: {
+import { Instruction, WorkflowVariableInput, WorkflowVariableJSON } from '@nocobase/plugin-workflow/client';
+
+import { NAMESPACE } from '../locale';
+
+export default class extends Instruction {
+ title = `{{t("HTTP request", { ns: "${NAMESPACE}" })}}`;
+ type = 'request';
+ group = 'extended';
+ description = `{{t("Send HTTP request to a URL. You can use the variables in the upstream nodes as request headers, parameters and request body.", { ns: "${NAMESPACE}" })}}`;
+ fieldset = {
method: {
type: 'string',
required: true,
@@ -166,18 +168,16 @@ export default {
'x-decorator': 'FormItem',
'x-component': 'Checkbox',
},
- },
- view: {},
- scope: {},
- components: {
+ };
+ components = {
ArrayItems,
WorkflowVariableInput,
WorkflowVariableJSON,
- },
+ };
useVariables({ key, title }, { types, fieldNames = defaultFieldNames }) {
return {
[fieldNames.value]: key,
[fieldNames.label]: title,
};
- },
-};
+ }
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-request/src/client/index.ts b/packages/plugins/@nocobase/plugin-workflow-request/src/client/index.ts
new file mode 100644
index 0000000000..7d210a23dd
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-request/src/client/index.ts
@@ -0,0 +1,19 @@
+import { Plugin } from '@nocobase/client';
+import WorkflowPlugin from '@nocobase/plugin-workflow/client';
+
+import RequestInstruction from './RequestInstruction';
+
+export default class extends Plugin {
+ async afterAdd() {
+ // await this.app.pm.add()
+ }
+
+ async beforeLoad() {}
+
+ // You can get and modify the app instance here
+ async load() {
+ const workflow = this.app.pm.get('workflow') as WorkflowPlugin;
+ const requestInstruction = new RequestInstruction();
+ workflow.instructions.register(requestInstruction.type, requestInstruction);
+ }
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-request/src/index.ts b/packages/plugins/@nocobase/plugin-workflow-request/src/index.ts
new file mode 100644
index 0000000000..7e74612df8
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-request/src/index.ts
@@ -0,0 +1,2 @@
+export * from './server';
+export { default } from './server';
diff --git a/packages/plugins/@nocobase/plugin-workflow-request/src/locale/en-US.json b/packages/plugins/@nocobase/plugin-workflow-request/src/locale/en-US.json
new file mode 100644
index 0000000000..7c7d640ec9
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-request/src/locale/en-US.json
@@ -0,0 +1,20 @@
+{
+ "HTTP request": "HTTP request",
+ "Send HTTP request to a URL. You can use the variables in the upstream nodes as request headers, parameters and request body.": "Send HTTP request to a URL. You can use the variables in the upstream nodes as request headers, parameters and request body.",
+ "HTTP method": "HTTP method",
+ "URL": "URL",
+ "Headers": "Headers",
+ "Add request header": "Add request header",
+ "Parameters": "Parameters",
+ "Add parameter": "Add parameter",
+ "Body": "Body",
+ "Use variable": "Use variable",
+ "Format": "Format",
+ "Insert": "Insert",
+ "Timeout config": "Timeout config",
+ "ms": "ms",
+ "Input request data": "Input request data",
+ "Only support standard JSON data": "Only support standard JSON data",
+ "\"Content-Type\" only support \"application/json\", and no need to specify": "\"Content-Type\" only support \"application/json\", and no need to specify",
+ "Ignore failed request and continue workflow": "Ignore failed request and continue workflow"
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-request/src/locale/es-ES.json b/packages/plugins/@nocobase/plugin-workflow-request/src/locale/es-ES.json
new file mode 100644
index 0000000000..04134c1118
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-request/src/locale/es-ES.json
@@ -0,0 +1,19 @@
+{
+ "HTTP request": "Petición HTTP",
+ "HTTP method": "Método HTTP",
+ "URL": "URL",
+ "Headers": "Encabezados",
+ "Add request header": "Añadir encabezado de petición",
+ "Parameters": "Parámetros",
+ "Add parameter": "Añadir parámetro",
+ "Body": "Cuerpo",
+ "Use variable": "Utilizar variable",
+ "Format": "Formato",
+ "Insert": "Insertar",
+ "Timeout config": "Tiempo de espera config",
+ "ms": "ms",
+ "Input request data": "Datos de solicitud de entrada",
+ "Only support standard JSON data": "Sólo admite datos JSON estándar",
+ "\"Content-Type\" only support \"application/json\", and no need to specify": "\"Content-Type\" sólo admite \"application/json\", y no es necesario especificar",
+ "Ignore fail request and continue workflow": "Ignorar solicitud fallida y continuar flujo de trabajo"
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-request/src/locale/fr-FR.json b/packages/plugins/@nocobase/plugin-workflow-request/src/locale/fr-FR.json
new file mode 100644
index 0000000000..631052e907
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-request/src/locale/fr-FR.json
@@ -0,0 +1,19 @@
+{
+ "HTTP request": "Requête HTTP",
+ "HTTP method": "Méthode HTTP",
+ "URL": "URL",
+ "Headers": "En-têtes",
+ "Add request header": "Ajouter un en-tête de requête",
+ "Parameters": "Paramètres",
+ "Add parameter": "Ajouter un paramètre",
+ "Body": "Corps",
+ "Use variable": "Utiliser une variable",
+ "Format": "Format",
+ "Insert": "Insérer",
+ "Timeout config": "Configuration du délai d'expiration",
+ "ms": "ms",
+ "Input request data": "Entrée des données de requête",
+ "Only support standard JSON data": "Prend uniquement en charge les données JSON standard",
+ "\"Content-Type\" only support \"application/json\", and no need to specify": "\"Content-Type\" prend uniquement en charge \"application/json\" et n'a pas besoin d'être spécifié",
+ "Ignore fail request and continue workflow": "Ignorer l'échec de la requête et continuer le workflow"
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-request/src/locale/index.ts b/packages/plugins/@nocobase/plugin-workflow-request/src/locale/index.ts
new file mode 100644
index 0000000000..2726967b40
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-request/src/locale/index.ts
@@ -0,0 +1,12 @@
+import { useTranslation } from 'react-i18next';
+
+export const NAMESPACE = 'workflow-request';
+
+export function useLang(key: string, options = {}) {
+ const { t } = usePluginTranslation(options);
+ return t(key);
+}
+
+export function usePluginTranslation(options) {
+ return useTranslation(NAMESPACE, options);
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-request/src/locale/pt-BR.json b/packages/plugins/@nocobase/plugin-workflow-request/src/locale/pt-BR.json
new file mode 100644
index 0000000000..2f7a0dceb0
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-request/src/locale/pt-BR.json
@@ -0,0 +1,19 @@
+{
+ "HTTP request": "Requisição HTTP",
+ "HTTP method": "Método HTTP",
+ "URL": "URL",
+ "Headers": "Cabeçalhos",
+ "Add request header": "Adicionar cabeçalho de requisição",
+ "Parameters": "Parâmetros",
+ "Add parameter": "Adicionar parâmetro",
+ "Body": "Corpo",
+ "Use variable": "Usar variável",
+ "Format": "Formato",
+ "Insert": "Inserir",
+ "Timeout config": "Configuração de tempo limite",
+ "ms": "ms",
+ "Input request data": "Dados de entrada da requisição",
+ "Only support standard JSON data": "Suporta somente dados JSON padrão",
+ "\"Content-Type\" only support \"application/json\", and no need to specify": "\"Content-Type\" somente suporta \"application/json\" e não precisa ser especificado",
+ "Ignore fail request and continue workflow": "Ignorar falhas na requisição e continuar o fluxo de trabalho"
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-request/src/locale/zh-CN.json b/packages/plugins/@nocobase/plugin-workflow-request/src/locale/zh-CN.json
new file mode 100644
index 0000000000..480125f88b
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-request/src/locale/zh-CN.json
@@ -0,0 +1,20 @@
+{
+ "HTTP request": "HTTP 请求",
+ "Send HTTP request to a URL. You can use the variables in the upstream nodes as request headers, parameters and request body.": "向指定 URL 发送 HTTP 请求。可以使用上游节点里的变量作为请求头、参数和请求体。",
+ "HTTP method": "HTTP 方法",
+ "URL": "地址",
+ "Headers": "请求头",
+ "Add request header": "添加请求头",
+ "Parameters": "参数",
+ "Add parameter": "添加参数",
+ "Body": "请求体",
+ "Use variable": "使用变量",
+ "Format": "格式化",
+ "Insert": "插入",
+ "Timeout config": "超时设置",
+ "ms": "毫秒",
+ "Input request data": "输入请求数据",
+ "Only support standard JSON data": "仅支持标准 JSON 数据",
+ "\"Content-Type\" only support \"application/json\", and no need to specify": "\"Content-Type\" 请求头仅支持 \"application/json\",无需填写",
+ "Ignore failed request and continue workflow": "忽略失败的请求并继续工作流"
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-request/src/server/Plugin.ts b/packages/plugins/@nocobase/plugin-workflow-request/src/server/Plugin.ts
new file mode 100644
index 0000000000..0b07b555ed
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-request/src/server/Plugin.ts
@@ -0,0 +1,14 @@
+import { Plugin } from '@nocobase/server';
+import WorkflowPlugin from '@nocobase/plugin-workflow';
+
+import RequestInstruction from './RequestInstruction';
+
+export default class extends Plugin {
+ workflow: WorkflowPlugin;
+
+ async load() {
+ const workflowPlugin = this.app.getPlugin('workflow') as WorkflowPlugin;
+ this.workflow = workflowPlugin;
+ workflowPlugin.instructions.register('request', new RequestInstruction(workflowPlugin));
+ }
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/server/instructions/request.ts b/packages/plugins/@nocobase/plugin-workflow-request/src/server/RequestInstruction.ts
similarity index 89%
rename from packages/plugins/@nocobase/plugin-workflow/src/server/instructions/request.ts
rename to packages/plugins/@nocobase/plugin-workflow-request/src/server/RequestInstruction.ts
index 92e9a95c65..ce034da76a 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/server/instructions/request.ts
+++ b/packages/plugins/@nocobase/plugin-workflow-request/src/server/RequestInstruction.ts
@@ -1,9 +1,6 @@
import axios, { AxiosRequestConfig } from 'axios';
-import { Instruction } from './index';
-import { JOB_STATUS } from '../constants';
-import Processor from '../Processor';
-import type { FlowNodeModel } from '../types';
+import { Processor, Instruction, JOB_STATUS, FlowNodeModel } from '@nocobase/plugin-workflow';
export interface Header {
name: string;
@@ -42,9 +39,7 @@ async function request(config) {
});
}
-export default class implements Instruction {
- constructor(public plugin) {}
-
+export default class extends Instruction {
async run(node: FlowNodeModel, prevJob, processor: Processor) {
const job = await processor.saveJob({
status: JOB_STATUS.PENDING,
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/server/__tests__/instructions/request.test.ts b/packages/plugins/@nocobase/plugin-workflow-request/src/server/__tests__/instruction.test.ts
similarity index 88%
rename from packages/plugins/@nocobase/plugin-workflow/src/server/__tests__/instructions/request.test.ts
rename to packages/plugins/@nocobase/plugin-workflow-request/src/server/__tests__/instruction.test.ts
index 14c830bed7..a333b7fa41 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/server/__tests__/instructions/request.test.ts
+++ b/packages/plugins/@nocobase/plugin-workflow-request/src/server/__tests__/instruction.test.ts
@@ -4,30 +4,35 @@ import { Gateway } from '@nocobase/server';
import Database from '@nocobase/database';
import { MockServer } from '@nocobase/test';
-import { getApp, sleep } from '..';
-import { RequestConfig } from '../../instructions/request';
-import { EXECUTION_STATUS, JOB_STATUS } from '../../constants';
+import { EXECUTION_STATUS, JOB_STATUS } from '@nocobase/plugin-workflow';
+import { getApp, sleep } from '@nocobase/plugin-workflow-test';
+import Plugin from '..';
+import { RequestConfig } from '../RequestInstruction';
+
+const HOST = 'localhost';
const PORT = 12345;
-const URL_DATA = `http://localhost:${PORT}/api/data`;
-const URL_400 = `http://localhost:${PORT}/api/400`;
-const URL_TIMEOUT = `http://localhost:${PORT}/api/timeout`;
+const URL_DATA = `http://${HOST}:${PORT}/api/data`;
+const URL_400 = `http://${HOST}:${PORT}/api/400`;
+const URL_TIMEOUT = `http://${HOST}:${PORT}/api/timeout`;
describe('workflow > instructions > request', () => {
let app: MockServer;
let db: Database;
let PostRepo;
+ let PostCollection;
+ let ReplyRepo;
let WorkflowModel;
let workflow;
beforeEach(async () => {
app = await getApp({
+ plugins: ['users', 'auth', Plugin],
resourcer: {
prefix: '/api',
},
- plugins: ['users', 'auth'],
- manual: true,
+ autoStart: false,
});
app.use(async (ctx, next) => {
@@ -36,7 +41,8 @@ describe('workflow > instructions > request', () => {
}
if (ctx.path === '/api/timeout') {
await sleep(2000);
- return ctx.throw(new Error('timeout'));
+ ctx.status = 204;
+ return;
}
if (ctx.path === '/api/data') {
await sleep(100);
@@ -51,17 +57,18 @@ describe('workflow > instructions > request', () => {
Gateway.getInstance().start({
port: PORT,
- host: 'localhost',
+ host: HOST,
});
await app.start();
db = app.db;
WorkflowModel = db.getCollection('workflows').model;
- PostRepo = db.getCollection('posts').repository;
+ PostCollection = db.getCollection('posts');
+ PostRepo = PostCollection.repository;
+ ReplyRepo = db.getCollection('replies').repository;
workflow = await WorkflowModel.create({
- title: 'test workflow',
enabled: true,
type: 'collection',
config: {
@@ -94,7 +101,7 @@ describe('workflow > instructions > request', () => {
expect(job.result).toEqual({ meta: {}, data: {} });
});
- it('request - timeout', async () => {
+ it('timeout', async () => {
await workflow.createNode({
type: 'request',
config: {
@@ -118,9 +125,12 @@ describe('workflow > instructions > request', () => {
status: null,
message: 'timeout of 250ms exceeded',
});
+
+ // NOTE: to wait for the response to finish and avoid non finished promise.
+ await sleep(1500);
});
- it('request - ignoreFail', async () => {
+ it('ignoreFail', async () => {
await workflow.createNode({
type: 'request',
config: {
@@ -231,7 +241,7 @@ describe('workflow > instructions > request', () => {
expect(job.result.data).toEqual({ title });
});
- it('request inside loop', async () => {
+ it.skip('request inside loop', async () => {
const n1 = await workflow.createNode({
type: 'loop',
config: {
diff --git a/packages/plugins/@nocobase/plugin-workflow-request/src/server/index.ts b/packages/plugins/@nocobase/plugin-workflow-request/src/server/index.ts
new file mode 100644
index 0000000000..3b60b3bee9
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-request/src/server/index.ts
@@ -0,0 +1 @@
+export { default } from './Plugin';
diff --git a/packages/plugins/@nocobase/plugin-workflow-sql/LICENSE b/packages/plugins/@nocobase/plugin-workflow-sql/LICENSE
new file mode 100644
index 0000000000..0ad25db4bd
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-sql/LICENSE
@@ -0,0 +1,661 @@
+ GNU AFFERO GENERAL PUBLIC LICENSE
+ Version 3, 19 November 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ 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,
+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
+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
+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
+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
+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
+ensure that, in such cases, the modified source code becomes available
+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
+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
+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
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "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
+works, such as semiconductor masks.
+
+ "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
+in a fashion requiring copyright permission, other than the making of an
+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
+on the Program.
+
+ 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,
+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
+a computer network, with no transfer of a copy, is not conveying.
+
+ 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
+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.
+
+ 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
+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
+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
+"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 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
+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
+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
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ 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
+covered work is covered by this License only if the output, given its
+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
+convey, without conditions so long as your license otherwise remains
+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
+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
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ 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
+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
+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.
+
+ 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
+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,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ 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:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ 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
+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
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ 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:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ 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
+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
+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
+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
+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,
+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
+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
+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
+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
+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
+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,
+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.
+
+ "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
+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
+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
+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
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ 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
+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
+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
+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
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ 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
+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
+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
+licenses of parties who have received copies or rights from you under
+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.
+
+ 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,
+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
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ 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
+for enforcing compliance by third parties with this License.
+
+ 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
+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
+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
+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.
+
+ 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
+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
+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
+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
+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
+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,
+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,
+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
+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
+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
+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
+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
+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
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+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
+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.
+
+ 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
+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
+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.
+
+ 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
+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
+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
+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.
+
+ 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
+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
+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
+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
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 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
+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
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ 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
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+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.
+
+ 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
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ 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 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.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ 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
+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
+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,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU AGPL, see
+.
diff --git a/packages/plugins/@nocobase/plugin-workflow-sql/README.md b/packages/plugins/@nocobase/plugin-workflow-sql/README.md
new file mode 100644
index 0000000000..e83d0373a4
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-sql/README.md
@@ -0,0 +1,9 @@
+# workflow
+
+English | [中文](./README.zh-CN.md)
+
+## 安装激活
+
+内置插件无需手动安装激活。
+
+## 使用方法
diff --git a/packages/plugins/@nocobase/plugin-workflow-sql/README.zh-CN.md b/packages/plugins/@nocobase/plugin-workflow-sql/README.zh-CN.md
new file mode 100644
index 0000000000..e690848dd1
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-sql/README.zh-CN.md
@@ -0,0 +1,9 @@
+# workflow
+
+[English](./README.md) | 中文
+
+## 安装激活
+
+内置插件无需手动安装激活。
+
+## 使用方法
diff --git a/packages/plugins/@nocobase/plugin-workflow-sql/client.d.ts b/packages/plugins/@nocobase/plugin-workflow-sql/client.d.ts
new file mode 100644
index 0000000000..6c459cbac4
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-sql/client.d.ts
@@ -0,0 +1,2 @@
+export * from './dist/client';
+export { default } from './dist/client';
diff --git a/packages/plugins/@nocobase/plugin-workflow-sql/client.js b/packages/plugins/@nocobase/plugin-workflow-sql/client.js
new file mode 100644
index 0000000000..b6e3be70e6
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-sql/client.js
@@ -0,0 +1 @@
+module.exports = require('./dist/client/index.js');
diff --git a/packages/plugins/@nocobase/plugin-workflow-sql/package.json b/packages/plugins/@nocobase/plugin-workflow-sql/package.json
new file mode 100644
index 0000000000..3e41620540
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-sql/package.json
@@ -0,0 +1,24 @@
+{
+ "name": "@nocobase/plugin-workflow-sql",
+ "displayName": "Workflow: SQL node",
+ "displayName.zh-CN": "工作流:SQL 节点",
+ "description": "Execute SQL statements in workflow.",
+ "description.zh-CN": "可用于在工作流中对数据库执行任意 SQL 语句。",
+ "version": "0.17.0-alpha.3",
+ "license": "AGPL-3.0",
+ "main": "./dist/server/index.js",
+ "devDependencies": {
+ "antd": "5.x",
+ "react": "18.x",
+ "react-i18next": "^11.15.1"
+ },
+ "peerDependencies": {
+ "@nocobase/client": "0.x",
+ "@nocobase/database": "0.x",
+ "@nocobase/plugin-workflow": ">=0.17.0-alpha.3",
+ "@nocobase/plugin-workflow-test": ">=0.17.0-alpha.3",
+ "@nocobase/server": "0.x",
+ "@nocobase/test": "0.x"
+ },
+ "gitHead": "ce588eefb0bfc50f7d5bbee575e0b5e843bf6644"
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-sql/server.d.ts b/packages/plugins/@nocobase/plugin-workflow-sql/server.d.ts
new file mode 100644
index 0000000000..c41081ddc6
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-sql/server.d.ts
@@ -0,0 +1,2 @@
+export * from './dist/server';
+export { default } from './dist/server';
diff --git a/packages/plugins/@nocobase/plugin-workflow-sql/server.js b/packages/plugins/@nocobase/plugin-workflow-sql/server.js
new file mode 100644
index 0000000000..972842039a
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-sql/server.js
@@ -0,0 +1 @@
+module.exports = require('./dist/server/index.js');
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/sql.tsx b/packages/plugins/@nocobase/plugin-workflow-sql/src/client/SQLInstruction.tsx
similarity index 67%
rename from packages/plugins/@nocobase/plugin-workflow/src/client/nodes/sql.tsx
rename to packages/plugins/@nocobase/plugin-workflow-sql/src/client/SQLInstruction.tsx
index 1470215287..a023ba90f7 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/sql.tsx
+++ b/packages/plugins/@nocobase/plugin-workflow-sql/src/client/SQLInstruction.tsx
@@ -1,14 +1,15 @@
import { css, defaultFieldNames } from '@nocobase/client';
-import { NAMESPACE } from '../locale';
-import { WorkflowVariableRawTextArea } from '../variable';
+import { Instruction, WorkflowVariableRawTextArea } from '@nocobase/plugin-workflow/client';
-export default {
- title: `{{t("SQL action", { ns: "${NAMESPACE}" })}}`,
- type: 'sql',
- group: 'collection',
- description: `{{t("Execute a SQL statement in database.", { ns: "${NAMESPACE}" })}}`,
- fieldset: {
+import { NAMESPACE } from '../locale';
+
+export default class extends Instruction {
+ title = `{{t("SQL action", { ns: "${NAMESPACE}" })}}`;
+ type = 'sql';
+ group = 'collection';
+ description = `{{t("Execute a SQL statement in database.", { ns: "${NAMESPACE}" })}}`;
+ fieldset = {
sql: {
type: 'string',
required: true,
@@ -24,15 +25,14 @@ export default {
`,
},
},
- },
- scope: {},
- components: {
+ };
+ components = {
WorkflowVariableRawTextArea,
- },
+ };
useVariables({ key, title }, { types, fieldNames = defaultFieldNames }) {
return {
[fieldNames.value]: key,
[fieldNames.label]: title,
};
- },
-};
+ }
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-sql/src/client/index.ts b/packages/plugins/@nocobase/plugin-workflow-sql/src/client/index.ts
new file mode 100644
index 0000000000..65833be0f2
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-sql/src/client/index.ts
@@ -0,0 +1,19 @@
+import { Plugin } from '@nocobase/client';
+import WorkflowPlugin from '@nocobase/plugin-workflow/client';
+
+import SQLInstruction from './SQLInstruction';
+
+export default class extends Plugin {
+ async afterAdd() {
+ // await this.app.pm.add()
+ }
+
+ async beforeLoad() {}
+
+ // You can get and modify the app instance here
+ async load() {
+ const workflow = this.app.pm.get('workflow') as WorkflowPlugin;
+ const sqlInstruction = new SQLInstruction();
+ workflow.instructions.register(sqlInstruction.type, sqlInstruction);
+ }
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-sql/src/index.ts b/packages/plugins/@nocobase/plugin-workflow-sql/src/index.ts
new file mode 100644
index 0000000000..7e74612df8
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-sql/src/index.ts
@@ -0,0 +1,2 @@
+export * from './server';
+export { default } from './server';
diff --git a/packages/plugins/@nocobase/plugin-workflow-sql/src/locale/en-US.json b/packages/plugins/@nocobase/plugin-workflow-sql/src/locale/en-US.json
new file mode 100644
index 0000000000..e34793751d
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-sql/src/locale/en-US.json
@@ -0,0 +1,5 @@
+{
+ "SQL action": "SQL action",
+ "Execute a SQL statement in database": "Execute a SQL statement in database",
+ "Usage of SQL query result is not supported yet.": "Usage of SQL query result is not supported yet."
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-sql/src/locale/index.ts b/packages/plugins/@nocobase/plugin-workflow-sql/src/locale/index.ts
new file mode 100644
index 0000000000..f85747f647
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-sql/src/locale/index.ts
@@ -0,0 +1,12 @@
+import { useTranslation } from 'react-i18next';
+
+export const NAMESPACE = 'workflow-sql';
+
+export function useLang(key: string, options = {}) {
+ const { t } = usePluginTranslation(options);
+ return t(key);
+}
+
+export function usePluginTranslation(options) {
+ return useTranslation(NAMESPACE, options);
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-sql/src/locale/zh-CN.json b/packages/plugins/@nocobase/plugin-workflow-sql/src/locale/zh-CN.json
new file mode 100644
index 0000000000..603d19d846
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-sql/src/locale/zh-CN.json
@@ -0,0 +1,5 @@
+{
+ "SQL action": "SQL 操作",
+ "Execute a SQL statement in database": "在数据库中执行一个 SQL 语句",
+ "Usage of SQL query result is not supported yet.": "SQL 执行的结果暂不支持使用。"
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-sql/src/server/Plugin.ts b/packages/plugins/@nocobase/plugin-workflow-sql/src/server/Plugin.ts
new file mode 100644
index 0000000000..c2781901d8
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-sql/src/server/Plugin.ts
@@ -0,0 +1,14 @@
+import { Plugin } from '@nocobase/server';
+import WorkflowPlugin from '@nocobase/plugin-workflow';
+
+import SQLInstruction from './SQLInstruction';
+
+export default class extends Plugin {
+ workflow: WorkflowPlugin;
+
+ async load() {
+ const workflowPlugin = this.app.getPlugin('workflow') as WorkflowPlugin;
+ this.workflow = workflowPlugin;
+ workflowPlugin.instructions.register('sql', new SQLInstruction(workflowPlugin));
+ }
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/server/instructions/sql.ts b/packages/plugins/@nocobase/plugin-workflow-sql/src/server/SQLInstruction.ts
similarity index 79%
rename from packages/plugins/@nocobase/plugin-workflow/src/server/instructions/sql.ts
rename to packages/plugins/@nocobase/plugin-workflow-sql/src/server/SQLInstruction.ts
index 1da900353e..f75a1beaa2 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/server/instructions/sql.ts
+++ b/packages/plugins/@nocobase/plugin-workflow-sql/src/server/SQLInstruction.ts
@@ -1,7 +1,6 @@
-import { Processor, JOB_STATUS } from '..';
-import type { FlowNodeModel } from '../types';
+import { Processor, Instruction, JOB_STATUS, FlowNodeModel } from '@nocobase/plugin-workflow';
-export default {
+export default class extends Instruction {
async run(node: FlowNodeModel, input, processor: Processor) {
const { sequelize } = (node.constructor).database;
const sql = processor.getParsedValue(node.config.sql ?? '', node.id).trim();
@@ -21,5 +20,5 @@ export default {
result,
status: JOB_STATUS.RESOLVED,
};
- },
-};
+ }
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/server/__tests__/instructions/sql.test.ts b/packages/plugins/@nocobase/plugin-workflow-sql/src/server/__tests__/instruction.test.ts
similarity index 88%
rename from packages/plugins/@nocobase/plugin-workflow/src/server/__tests__/instructions/sql.test.ts
rename to packages/plugins/@nocobase/plugin-workflow-sql/src/server/__tests__/instruction.test.ts
index fa7cbd0bc8..448158a1a5 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/server/__tests__/instructions/sql.test.ts
+++ b/packages/plugins/@nocobase/plugin-workflow-sql/src/server/__tests__/instruction.test.ts
@@ -1,7 +1,9 @@
-import { Application } from '@nocobase/server';
import Database from '@nocobase/database';
-import { getApp, sleep } from '..';
-import { EXECUTION_STATUS, JOB_STATUS } from '../../constants';
+import { Application } from '@nocobase/server';
+import { EXECUTION_STATUS, JOB_STATUS } from '@nocobase/plugin-workflow';
+import { getApp, sleep } from '@nocobase/plugin-workflow-test';
+
+import Plugin from '..';
describe('workflow > instructions > sql', () => {
let app: Application;
@@ -13,7 +15,9 @@ describe('workflow > instructions > sql', () => {
let workflow;
beforeEach(async () => {
- app = await getApp();
+ app = await getApp({
+ plugins: [Plugin],
+ });
db = app.db;
WorkflowModel = db.getCollection('workflows').model;
@@ -22,7 +26,6 @@ describe('workflow > instructions > sql', () => {
ReplyRepo = db.getCollection('replies').repository;
workflow = await WorkflowModel.create({
- title: 'test workflow',
enabled: true,
type: 'collection',
config: {
@@ -32,7 +35,7 @@ describe('workflow > instructions > sql', () => {
});
});
- afterEach(async () => await app.destroy());
+ afterEach(() => app.destroy());
describe('invalid', () => {
it('no sql', async () => {
@@ -94,7 +97,9 @@ describe('workflow > instructions > sql', () => {
const n1 = await workflow.createNode({
type: 'sql',
config: {
- sql: `update ${PostCollection.quotedTableName()} set ${queryInterface.quoteIdentifier('read')}={{$context.data.id}} where ${queryInterface.quoteIdentifier('id')}={{$context.data.id}}`,
+ sql: `update ${PostCollection.quotedTableName()} set ${queryInterface.quoteIdentifier(
+ 'read',
+ )}={{$context.data.id}} where ${queryInterface.quoteIdentifier('id')}={{$context.data.id}}`,
},
});
@@ -105,8 +110,8 @@ describe('workflow > instructions > sql', () => {
params: {
filter: {
id: '{{ $context.data.id }}',
- }
- }
+ },
+ },
},
upstreamId: n1.id,
});
@@ -129,7 +134,9 @@ describe('workflow > instructions > sql', () => {
const n1 = await workflow.createNode({
type: 'sql',
config: {
- sql: `delete from ${PostCollection.quotedTableName()} where ${queryInterface.quoteIdentifier('id')}={{$context.data.id}};`,
+ sql: `delete from ${PostCollection.quotedTableName()} where ${queryInterface.quoteIdentifier(
+ 'id',
+ )}={{$context.data.id}};`,
},
});
@@ -140,8 +147,8 @@ describe('workflow > instructions > sql', () => {
params: {
filter: {
id: '{{ $context.data.id }}',
- }
- }
+ },
+ },
},
upstreamId: n1.id,
});
diff --git a/packages/plugins/@nocobase/plugin-workflow-sql/src/server/index.ts b/packages/plugins/@nocobase/plugin-workflow-sql/src/server/index.ts
new file mode 100644
index 0000000000..3b60b3bee9
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-sql/src/server/index.ts
@@ -0,0 +1 @@
+export { default } from './Plugin';
diff --git a/packages/plugins/@nocobase/plugin-workflow-test/LICENSE b/packages/plugins/@nocobase/plugin-workflow-test/LICENSE
new file mode 100644
index 0000000000..0ad25db4bd
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-test/LICENSE
@@ -0,0 +1,661 @@
+ GNU AFFERO GENERAL PUBLIC LICENSE
+ Version 3, 19 November 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ 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,
+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
+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
+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
+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
+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
+ensure that, in such cases, the modified source code becomes available
+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
+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
+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
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "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
+works, such as semiconductor masks.
+
+ "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
+in a fashion requiring copyright permission, other than the making of an
+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
+on the Program.
+
+ 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,
+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
+a computer network, with no transfer of a copy, is not conveying.
+
+ 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
+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.
+
+ 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
+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
+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
+"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 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
+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
+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
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ 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
+covered work is covered by this License only if the output, given its
+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
+convey, without conditions so long as your license otherwise remains
+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
+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
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ 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
+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
+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.
+
+ 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
+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,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ 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:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ 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
+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
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ 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:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ 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
+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
+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
+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
+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,
+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
+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
+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
+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
+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
+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,
+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.
+
+ "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
+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
+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
+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
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ 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
+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
+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
+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
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ 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
+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
+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
+licenses of parties who have received copies or rights from you under
+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.
+
+ 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,
+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
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ 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
+for enforcing compliance by third parties with this License.
+
+ 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
+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
+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
+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.
+
+ 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
+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
+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
+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
+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
+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,
+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,
+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
+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
+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
+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
+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
+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
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+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
+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.
+
+ 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
+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
+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.
+
+ 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
+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
+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
+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.
+
+ 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
+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
+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
+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
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 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
+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
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ 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
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+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.
+
+ 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
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ 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 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.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ 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
+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
+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,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU AGPL, see
+.
diff --git a/packages/plugins/@nocobase/plugin-workflow-test/README.md b/packages/plugins/@nocobase/plugin-workflow-test/README.md
new file mode 100644
index 0000000000..e83d0373a4
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-test/README.md
@@ -0,0 +1,9 @@
+# workflow
+
+English | [中文](./README.zh-CN.md)
+
+## 安装激活
+
+内置插件无需手动安装激活。
+
+## 使用方法
diff --git a/packages/plugins/@nocobase/plugin-workflow-test/package.json b/packages/plugins/@nocobase/plugin-workflow-test/package.json
new file mode 100644
index 0000000000..948053b221
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-test/package.json
@@ -0,0 +1,17 @@
+{
+ "name": "@nocobase/plugin-workflow-test",
+ "displayName": "Workflow: test kit",
+ "displayName.zh-CN": "工作流:测试工具包",
+ "version": "0.17.0-alpha.3",
+ "license": "AGPL-3.0",
+ "main": "dist/server/index.js",
+ "types": "./dist/server/index.d.ts",
+ "devDependencies": {
+ },
+ "peerDependencies": {
+ "@nocobase/database": "0.x",
+ "@nocobase/server": "0.x",
+ "@nocobase/test": "0.x"
+ },
+ "gitHead": "ce588eefb0bfc50f7d5bbee575e0b5e843bf6644"
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-test/server.d.ts b/packages/plugins/@nocobase/plugin-workflow-test/server.d.ts
new file mode 100644
index 0000000000..c41081ddc6
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-test/server.d.ts
@@ -0,0 +1,2 @@
+export * from './dist/server';
+export { default } from './dist/server';
diff --git a/packages/plugins/@nocobase/plugin-workflow-test/server.js b/packages/plugins/@nocobase/plugin-workflow-test/server.js
new file mode 100644
index 0000000000..972842039a
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-test/server.js
@@ -0,0 +1 @@
+module.exports = require('./dist/server/index.js');
diff --git a/packages/plugins/@nocobase/plugin-workflow-test/src/client/index.ts b/packages/plugins/@nocobase/plugin-workflow-test/src/client/index.ts
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/packages/plugins/@nocobase/plugin-workflow-test/src/index.ts b/packages/plugins/@nocobase/plugin-workflow-test/src/index.ts
new file mode 100644
index 0000000000..7e74612df8
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-test/src/index.ts
@@ -0,0 +1,2 @@
+export * from './server';
+export { default } from './server';
diff --git a/packages/plugins/@nocobase/plugin-workflow-test/src/server/collections/categories.ts b/packages/plugins/@nocobase/plugin-workflow-test/src/server/collections/categories.ts
new file mode 100644
index 0000000000..1c73e2e435
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-test/src/server/collections/categories.ts
@@ -0,0 +1,15 @@
+import { CollectionOptions } from '@nocobase/database';
+
+export default {
+ name: 'categories',
+ fields: [
+ {
+ type: 'string',
+ name: 'title',
+ },
+ {
+ type: 'hasMany',
+ name: 'posts',
+ },
+ ],
+} as CollectionOptions;
diff --git a/packages/plugins/@nocobase/plugin-workflow-test/src/server/collections/comments.ts b/packages/plugins/@nocobase/plugin-workflow-test/src/server/collections/comments.ts
new file mode 100644
index 0000000000..30494fae05
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-test/src/server/collections/comments.ts
@@ -0,0 +1,24 @@
+import { CollectionOptions } from '@nocobase/database';
+
+export default {
+ name: 'comments',
+ fields: [
+ {
+ type: 'belongsTo',
+ name: 'post',
+ },
+ {
+ type: 'text',
+ name: 'content',
+ },
+ {
+ type: 'integer',
+ name: 'status',
+ defaultValue: 0,
+ },
+ {
+ type: 'hasMany',
+ name: 'replies',
+ },
+ ],
+} as CollectionOptions;
diff --git a/packages/plugins/@nocobase/plugin-workflow-test/src/server/collections/posts.ts b/packages/plugins/@nocobase/plugin-workflow-test/src/server/collections/posts.ts
new file mode 100644
index 0000000000..7e8e98db5d
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-test/src/server/collections/posts.ts
@@ -0,0 +1,40 @@
+import { CollectionOptions } from '@nocobase/database';
+
+export default {
+ name: 'posts',
+ createdBy: true,
+ updatedBy: true,
+ fields: [
+ {
+ type: 'string',
+ name: 'title',
+ },
+ {
+ type: 'boolean',
+ name: 'published',
+ defaultValue: false,
+ },
+ {
+ type: 'integer',
+ name: 'read',
+ defaultValue: 0,
+ },
+ {
+ type: 'belongsTo',
+ name: 'category',
+ },
+ {
+ type: 'hasMany',
+ name: 'comments',
+ },
+ {
+ type: 'belongsToMany',
+ name: 'tags',
+ },
+ {
+ type: 'integer',
+ name: 'read',
+ defaultValue: 0,
+ },
+ ],
+} as CollectionOptions;
diff --git a/packages/plugins/@nocobase/plugin-workflow-test/src/server/collections/replies.ts b/packages/plugins/@nocobase/plugin-workflow-test/src/server/collections/replies.ts
new file mode 100644
index 0000000000..46c877e443
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-test/src/server/collections/replies.ts
@@ -0,0 +1,9 @@
+export default {
+ name: 'replies',
+ fields: [
+ {
+ type: 'string',
+ name: 'content',
+ },
+ ],
+};
diff --git a/packages/plugins/@nocobase/plugin-workflow-test/src/server/collections/tags.ts b/packages/plugins/@nocobase/plugin-workflow-test/src/server/collections/tags.ts
new file mode 100644
index 0000000000..433688e1b6
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-test/src/server/collections/tags.ts
@@ -0,0 +1,15 @@
+import { CollectionOptions } from '@nocobase/database';
+
+export default {
+ name: 'tags',
+ fields: [
+ {
+ type: 'belongsToMany',
+ name: 'posts',
+ },
+ {
+ type: 'string',
+ name: 'name',
+ },
+ ],
+} as CollectionOptions;
diff --git a/packages/plugins/@nocobase/plugin-workflow-test/src/server/functions.ts b/packages/plugins/@nocobase/plugin-workflow-test/src/server/functions.ts
new file mode 100644
index 0000000000..f5765c7e56
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-test/src/server/functions.ts
@@ -0,0 +1,3 @@
+export default {
+ no1: () => 1,
+};
diff --git a/packages/plugins/@nocobase/plugin-workflow-test/src/server/index.ts b/packages/plugins/@nocobase/plugin-workflow-test/src/server/index.ts
new file mode 100644
index 0000000000..59ea309fa1
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-test/src/server/index.ts
@@ -0,0 +1,78 @@
+import path from 'path';
+
+import { Plugin, ApplicationOptions } from '@nocobase/server';
+import { MockServer, mockServer } from '@nocobase/test';
+
+import instructions from './instructions';
+import functions from './functions';
+
+interface MockServerOptions extends ApplicationOptions {
+ autoStart?: boolean;
+ collectionsPath?: string;
+ cleanDb?: boolean;
+}
+
+async function createMockServer({ autoStart, collectionsPath, cleanDb, ...options }: MockServerOptions) {
+ const app = mockServer(options);
+
+ if (cleanDb) {
+ await app.cleanDb();
+ }
+
+ await app.load();
+
+ if (collectionsPath) {
+ await app.db.import({ directory: collectionsPath });
+ }
+
+ try {
+ await app.db.sync();
+ } catch (error) {
+ console.error(error);
+ }
+
+ if (autoStart) {
+ await app.start();
+ // await app.runCommand('start', '--quickstart');
+ }
+
+ return app;
+}
+
+export function sleep(ms: number) {
+ return new Promise((resolve) => {
+ setTimeout(resolve, ms);
+ });
+}
+
+export async function getApp({
+ autoStart = true,
+ cleanDb = true,
+ plugins = [],
+ ...options
+}: MockServerOptions = {}): Promise {
+ return createMockServer({
+ ...options,
+ autoStart,
+ cleanDb,
+ plugins: ['workflow', 'workflow-test', ...plugins],
+ });
+}
+
+export default class extends Plugin {
+ async load() {
+ await this.db.import({
+ directory: path.resolve(__dirname, 'collections'),
+ });
+
+ const workflow = this.app.getPlugin('workflow');
+
+ for (const [key, instruction] of Object.entries(instructions)) {
+ workflow.instructions.register(key, instruction);
+ }
+
+ for (const [key, func] of Object.entries(functions)) {
+ workflow.functions.register(key, func);
+ }
+ }
+}
diff --git a/packages/plugins/@nocobase/plugin-workflow-test/src/server/instructions.ts b/packages/plugins/@nocobase/plugin-workflow-test/src/server/instructions.ts
new file mode 100644
index 0000000000..b3466026c6
--- /dev/null
+++ b/packages/plugins/@nocobase/plugin-workflow-test/src/server/instructions.ts
@@ -0,0 +1,66 @@
+import { lodash } from '@nocobase/utils';
+
+export default {
+ echo: {
+ run({ config = {} }: any, { result }, processor) {
+ return {
+ status: 1,
+ result: config.path == null ? result : lodash.get(result, config.path),
+ };
+ },
+ },
+
+ error: {
+ run(node, input, processor) {
+ throw new Error('definite error');
+ },
+ },
+
+ pending: {
+ run(node, input, processor) {
+ return {
+ status: 0,
+ };
+ },
+ },
+
+ prompt: {
+ run(node, input, processor) {
+ return {
+ status: 0,
+ };
+ },
+ resume(node, job, processor) {
+ return job.set({
+ status: 1,
+ });
+ },
+ },
+
+ 'prompt->error': {
+ run(node, input, processor) {
+ return {
+ status: 0,
+ };
+ },
+ resume(node, input, processor) {
+ throw new Error('input failed');
+ },
+ },
+
+ customizedSuccess: {
+ run(node, input, processor) {
+ return {
+ status: 100,
+ };
+ },
+ },
+
+ customizedError: {
+ run(node, input, processor) {
+ return {
+ status: -100,
+ };
+ },
+ },
+};
diff --git a/packages/plugins/@nocobase/plugin-workflow/package.json b/packages/plugins/@nocobase/plugin-workflow/package.json
index 5df5b9a087..ed7246c4a1 100644
--- a/packages/plugins/@nocobase/plugin-workflow/package.json
+++ b/packages/plugins/@nocobase/plugin-workflow/package.json
@@ -36,10 +36,11 @@
"@nocobase/plugin-collection-manager": "0.x",
"@nocobase/plugin-error-handler": "0.x",
"@nocobase/plugin-users": "0.x",
+ "@nocobase/plugin-workflow-test": ">=0.17.0-alpha.3",
"@nocobase/resourcer": "0.x",
"@nocobase/server": "0.x",
- "@nocobase/test": "0.x",
- "@nocobase/utils": "0.x"
+ "@nocobase/utils": "0.x",
+ "@nocobase/test": "0.x"
},
"gitHead": "ce588eefb0bfc50f7d5bbee575e0b5e843bf6644"
}
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/AddButton.tsx b/packages/plugins/@nocobase/plugin-workflow/src/client/AddButton.tsx
index 369380d905..6443b88a05 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/client/AddButton.tsx
+++ b/packages/plugins/@nocobase/plugin-workflow/src/client/AddButton.tsx
@@ -1,10 +1,13 @@
-import { PlusOutlined } from '@ant-design/icons';
-import { css, useAPIClient, useCompile } from '@nocobase/client';
-import { Button, Dropdown, MenuProps } from 'antd';
import React, { useCallback, useMemo } from 'react';
+import { Button, Dropdown, MenuProps } from 'antd';
+import { PlusOutlined } from '@ant-design/icons';
+
+import { css, useAPIClient, useCompile, usePlugin } from '@nocobase/client';
+
+import WorkflowPlugin from '.';
import { useFlowContext } from './FlowContext';
import { NAMESPACE } from './locale';
-import { Instruction, instructions } from './nodes';
+import { Instruction } from './nodes';
import useStyles from './style';
interface AddButtonProps {
@@ -15,6 +18,7 @@ interface AddButtonProps {
export function AddButton(props: AddButtonProps) {
const { upstream, branchIndex = null } = props;
+ const { instructions } = usePlugin(WorkflowPlugin);
const compile = useCompile();
const api = useAPIClient();
const { workflow, refresh } = useFlowContext() ?? {};
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/ExecutionCanvas.tsx b/packages/plugins/@nocobase/plugin-workflow/src/client/ExecutionCanvas.tsx
index 3148b4eb7f..b934eba23d 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/client/ExecutionCanvas.tsx
+++ b/packages/plugins/@nocobase/plugin-workflow/src/client/ExecutionCanvas.tsx
@@ -1,3 +1,7 @@
+import React, { useCallback, useEffect, useState } from 'react';
+import { Link, useNavigate } from 'react-router-dom';
+import { Breadcrumb, Dropdown, Result, Space, Spin, Tag } from 'antd';
+
import {
ActionContextProvider,
cx,
@@ -6,17 +10,16 @@ import {
useApp,
useCompile,
useDocumentTitle,
+ usePlugin,
useResourceActionContext,
} from '@nocobase/client';
import { str2moment } from '@nocobase/utils/client';
-import { Breadcrumb, Dropdown, Result, Space, Spin, Tag } from 'antd';
-import React, { useCallback, useEffect, useState } from 'react';
-import { Link, useNavigate } from 'react-router-dom';
+
+import WorkflowPlugin from '.';
import { CanvasContent } from './CanvasContent';
import { ExecutionStatusOptionsMap, JobStatusOptions } from './constants';
import { FlowContext, useFlowContext } from './FlowContext';
import { lang, NAMESPACE } from './locale';
-import { instructions } from './nodes';
import useStyles from './style';
import { linkNodes } from './utils';
import { DownOutlined } from '@ant-design/icons';
@@ -45,6 +48,7 @@ function attachJobs(nodes, jobs: any[] = []): void {
}
function JobModal() {
+ const { instructions } = usePlugin(WorkflowPlugin);
const compile = useCompile();
const { viewJob: job, setViewJob } = useFlowContext();
const { styles } = useStyles();
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/WorkflowProvider.tsx b/packages/plugins/@nocobase/plugin-workflow/src/client/WorkflowPane.tsx
similarity index 51%
rename from packages/plugins/@nocobase/plugin-workflow/src/client/WorkflowProvider.tsx
rename to packages/plugins/@nocobase/plugin-workflow/src/client/WorkflowPane.tsx
index 356bcc3fd0..f2a1278c92 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/client/WorkflowProvider.tsx
+++ b/packages/plugins/@nocobase/plugin-workflow/src/client/WorkflowPane.tsx
@@ -1,26 +1,17 @@
-import { CollectionManagerContext, SchemaComponent, SchemaComponentContext } from '@nocobase/client';
+import { SchemaComponent, SchemaComponentContext, usePlugin } from '@nocobase/client';
import { Card } from 'antd';
import React, { useContext } from 'react';
import { ExecutionLink } from './ExecutionLink';
import { ExecutionResourceProvider } from './ExecutionResourceProvider';
import { WorkflowLink } from './WorkflowLink';
import OpenDrawer from './components/OpenDrawer';
-import expressionField from './interfaces/expression';
-import { instructions } from './nodes';
import { workflowSchema } from './schemas/workflows';
-import { getTriggersOptions, triggers } from './triggers';
import { ExecutionStatusSelect } from './components/ExecutionStatusSelect';
-
-// registerField(expressionField.group, 'expression', expressionField);
-
-export const WorkflowContext = React.createContext({});
-
-export function useWorkflowContext() {
- return useContext(WorkflowContext);
-}
+import WorkflowPlugin from '.';
export function WorkflowPane() {
const ctx = useContext(SchemaComponentContext);
+ const { getTriggersOptions } = usePlugin(WorkflowPlugin);
return (
@@ -41,20 +32,3 @@ export function WorkflowPane() {
);
}
-
-export const WorkflowProvider = (props) => {
- const cmCtx = useContext(CollectionManagerContext);
- return (
-
- {props.children}
-
- );
-};
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/components/CollectionBlockInitializer.tsx b/packages/plugins/@nocobase/plugin-workflow/src/client/components/CollectionBlockInitializer.tsx
index f205762c69..3cc8d7ec1a 100644
--- a/packages/plugins/@nocobase/plugin-workflow/src/client/components/CollectionBlockInitializer.tsx
+++ b/packages/plugins/@nocobase/plugin-workflow/src/client/components/CollectionBlockInitializer.tsx
@@ -10,7 +10,8 @@ import {
useSchemaInitializerItem,
useSchemaTemplateManager,
} from '@nocobase/client';
-import { traverseSchema } from '../nodes/manual/utils';
+
+import { traverseSchema } from '../utils';
function InnerCollectionBlockInitializer({ collection, dataSource, ...props }) {
const { insert } = useSchemaInitializer();
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/components/Duration.tsx b/packages/plugins/@nocobase/plugin-workflow/src/client/components/Duration.tsx
deleted file mode 100644
index 42b327c067..0000000000
--- a/packages/plugins/@nocobase/plugin-workflow/src/client/components/Duration.tsx
+++ /dev/null
@@ -1,54 +0,0 @@
-import { css } from '@nocobase/client';
-import { InputNumber, Select } from 'antd';
-import React from 'react';
-import { lang } from '../locale';
-
-const UnitOptions = [
- { value: 1_000, label: 'Seconds' },
- { value: 60_000, label: 'Minutes' },
- { value: 3600_000, label: 'Hours' },
- { value: 86400_000, label: 'Days' },
- { value: 604800_000, label: 'Weeks' },
-];
-
-function getNumberOption(v) {
- return UnitOptions.slice()
- .reverse()
- .find((item) => !(v % item.value));
-}
-
-export default function ({ value = 60000, onChange }) {
- const option = getNumberOption(value);
- const quantity = Math.round(value / option.value);
-
- return (
-