Merge branch 'main' into feat/gantt-block

This commit is contained in:
katherinehhh 2023-01-23 10:38:59 +08:00
commit 4d9f79a874
264 changed files with 33902 additions and 2517 deletions

3
.gitmodules vendored
View File

@ -1,3 +0,0 @@
[submodule "packages/pro-plugins"]
path = packages/pro-plugins
url = git@github.com:nocobase/pro-plugins.git

View File

@ -30,6 +30,12 @@ RUN cd /app \
RUN cd /app \ RUN cd /app \
&& rm -rf my-nocobase-app/packages/app/client/src/.umi \ && rm -rf my-nocobase-app/packages/app/client/src/.umi \
&& rm -rf nocobase.tar.gz \ && rm -rf nocobase.tar.gz \
&& rm -rf ./my-nocobase-app/node_modules/@antv \
&& rm -rf ./my-nocobase-app/node_modules/antd/dist \
&& rm -rf ./my-nocobase-app/node_modules/antd/es \
&& rm -rf ./my-nocobase-app/node_modules/antd/node_modules \
&& rm -rf ./my-nocobase-app/node_modules/@ant-design \
&& rm -rf ./my-nocobase-app/node_modules/china-division/dist/villages.json \
&& find ./my-nocobase-app/node_modules/china-division/dist -name '*.csv' -delete \ && find ./my-nocobase-app/node_modules/china-division/dist -name '*.csv' -delete \
&& find ./my-nocobase-app/node_modules/china-division/dist -name '*.sqlite' -delete \ && find ./my-nocobase-app/node_modules/china-division/dist -name '*.sqlite' -delete \
&& tar -zcf ./nocobase.tar.gz -C /app/my-nocobase-app . && tar -zcf ./nocobase.tar.gz -C /app/my-nocobase-app .

View File

@ -7,41 +7,35 @@ WORKDIR /tmp
COPY . /tmp COPY . /tmp
RUN npx npm-cli-adduser --username test --password test -e test@nocobase.com -r $VERDACCIO_URL RUN npx npm-cli-adduser --username test --password test -e test@nocobase.com -r $VERDACCIO_URL
RUN cd /tmp && \ RUN cd /tmp && \
NEWVERSION="$(cat lerna.json | jq '.version' | tr -d '"').$(date +'%Y%m%d%H%M%S')" \ NEWVERSION="$(cat lerna.json | jq '.version' | tr -d '"').$(date +'%Y%m%d%H%M%S')" \
&& tmp=$(mktemp) \ && tmp=$(mktemp) \
&& jq ".version = \"${NEWVERSION}\"" lerna.json > "$tmp" && mv "$tmp" lerna.json && jq ".version = \"${NEWVERSION}\"" lerna.json > "$tmp" && mv "$tmp" lerna.json
RUN yarn install && yarn nocobase install && yarn pm add graph-collection-manager && yarn build RUN yarn install && yarn build
RUN git checkout -b release \ RUN git checkout -b release \
&& yarn version:alpha -y && yarn version:alpha -y \
&& git config user.email "test@mail.com" \
RUN cd packages/pro-plugins && git checkout -b release \ && git config user.name "test" && git add . \
&& git config user.email "test@mail.com" \ && git commit -m "chore(versions): test publish packages xxx" \
&& git config user.name "test" && git add . \ && yarn release:force --registry $VERDACCIO_URL
&& git commit -m "chore(versions): test publish packages xxx"
RUN git config user.email "test@mail.com" \
&& git config user.name "test" && git add . \
&& git commit -m "chore(versions): test publish packages xxx" \
&& git submodule update --init --recursive -- packages/pro-plugins
RUN yarn release:force --no-verify-access --no-git-reset --registry $VERDACCIO_URL
RUN yarn config set registry $VERDACCIO_URL RUN yarn config set registry $VERDACCIO_URL
WORKDIR /app WORKDIR /app
RUN cd /app \ RUN cd /app \
&& yarn config set network-timeout 600000 -g \ && yarn config set network-timeout 600000 -g \
&& yarn create nocobase-app my-nocobase-app -a \ && yarn create nocobase-app my-nocobase-app -a -e APP_ENV=production \
-e APP_ENV=production \
-e PLUGIN_PACKAGE_PREFIX=@nocobase/plugin-,@nocobase/preset-,@nocobase/plugin-pro- \
-e PRESET_NOCOBASE_PLUGINS=graph-collection-manager \
&& cd /app/my-nocobase-app \ && cd /app/my-nocobase-app \
&& yarn install --production \ && yarn install --production
&& yarn add @nocobase/plugin-pro-graph-collection-manager -W
RUN cd /app \ RUN cd /app \
&& rm -rf my-nocobase-app/packages/app/client/src/.umi \ && rm -rf my-nocobase-app/packages/app/client/src/.umi \
&& rm -rf nocobase.tar.gz \ && rm -rf nocobase.tar.gz \
&& rm -rf ./my-nocobase-app/node_modules/@antv \
&& rm -rf ./my-nocobase-app/node_modules/antd/dist \
&& rm -rf ./my-nocobase-app/node_modules/antd/es \
&& rm -rf ./my-nocobase-app/node_modules/antd/node_modules \
&& rm -rf ./my-nocobase-app/node_modules/@ant-design \
&& rm -rf ./my-nocobase-app/node_modules/china-division/dist/villages.json \
&& find ./my-nocobase-app/node_modules/china-division/dist -name '*.csv' -delete \ && find ./my-nocobase-app/node_modules/china-division/dist -name '*.csv' -delete \
&& find ./my-nocobase-app/node_modules/china-division/dist -name '*.sqlite' -delete \ && find ./my-nocobase-app/node_modules/china-division/dist -name '*.sqlite' -delete \
&& tar -zcf ./nocobase.tar.gz -C /app/my-nocobase-app . && tar -zcf ./nocobase.tar.gz -C /app/my-nocobase-app .

661
LICENSE-AGPL Normal file
View File

@ -0,0 +1,661 @@
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
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.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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 <https://www.gnu.org/licenses/>.
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
<https://www.gnu.org/licenses/>.

View File

@ -63,6 +63,10 @@ NocoBase adopts plugin architecture, all new features can be implemented by deve
[Click to view the full image](https://www.nocobase.com/images/NocoBaseMindMap.png) [Click to view the full image](https://www.nocobase.com/images/NocoBaseMindMap.png)
## Business Services
If you need commercial version and commercial services, please feel free to contact us by email: hello@nocobase.com
## Installation ## Installation
NocoBase supports three installation methods: NocoBase supports three installation methods:
@ -78,3 +82,8 @@ NocoBase supports three installation methods:
- <a target="_blank" href="https://docs.nocobase.com/welcome/getting-started/installation/git-clone">Installing from Git source code</a> - <a target="_blank" href="https://docs.nocobase.com/welcome/getting-started/installation/git-clone">Installing from Git source code</a>
If you want to experience the latest unreleased version, or want to participate in the contribution, you need to make changes and debug on the source code, it is recommended to choose this installation method, which requires a high level of development skills, and if the code has been updated, you can git pull the latest code. If you want to experience the latest unreleased version, or want to participate in the contribution, you need to make changes and debug on the source code, it is recommended to choose this installation method, which requires a high level of development skills, and if the code has been updated, you can git pull the latest code.
## License
- [Core packages](https://github.com/nocobase/nocobase/tree/main/packages/core) are [Apache 2.0 licensed](./LICENSE-APACHE-2.0).
- [Plugins packages](https://github.com/nocobase/nocobase/tree/main/packages/plugins) are [AGPL 3.0 licensed](./LICENSE-AGPL).

View File

@ -78,3 +78,8 @@ NocoBase üç kurulum modelini destekler:
- <a target="_blank" href="https://docs.nocobase.com/welcome/getting-started/installation/git-clone">Git kaynak kodlarından derleme</a> - <a target="_blank" href="https://docs.nocobase.com/welcome/getting-started/installation/git-clone">Git kaynak kodlarından derleme</a>
Yayınlanmamış en son sürümü deneyimlemek veya katkıda bulunmak istiyorsanız, kaynak kodunda değişiklik yapmanız ve hata ayıklamanız gerekiyorsa, yüksek düzeyde geliştirme becerisi gerektiren bu kurulum yöntemini seçmeniz önerilir. Eğer kodlar güncellendiyse git pull ile son sürümü çekebilirsiniz. Yayınlanmamış en son sürümü deneyimlemek veya katkıda bulunmak istiyorsanız, kaynak kodunda değişiklik yapmanız ve hata ayıklamanız gerekiyorsa, yüksek düzeyde geliştirme becerisi gerektiren bu kurulum yöntemini seçmeniz önerilir. Eğer kodlar güncellendiyse git pull ile son sürümü çekebilirsiniz.
## License
- [Core packages](https://github.com/nocobase/nocobase/tree/main/packages/core) are [Apache 2.0 licensed](./LICENSE-APACHE-2.0).
- [Plugins packages](https://github.com/nocobase/nocobase/tree/main/packages/plugins) are [AGPL 3.0 licensed](./LICENSE-AGPL).

View File

@ -58,9 +58,9 @@ NocoBase 采用插件化架构,所有新功能都可以通过开发和安装
[点此查看完整图片](https://www.nocobase.com/images/NocoBaseMindMap.png) [点此查看完整图片](https://www.nocobase.com/images/NocoBaseMindMap.png)
## 联系 ## 商业服务
如果你希望加入我们一起开发 NocoBase或者需要提供商业服务欢迎通过邮件联系我们hello@nocobase.com 如果你需要商业版本和商业服务欢迎通过邮件联系我们hello@nocobase.com
或者添加我们的微信: 或者添加我们的微信:
@ -81,3 +81,8 @@ NocoBase 支持三种安装方式:
- <a target="_blank" href="https://docs-cn.nocobase.com/welcome/getting-started/installation/git-clone">Git 源码安装</a> - <a target="_blank" href="https://docs-cn.nocobase.com/welcome/getting-started/installation/git-clone">Git 源码安装</a>
如果你想体验最新未发布版本,或者想参与贡献,需要在源码上进行修改、调试,建议选择这种安装方式,对开发技术水平要求较高,如果代码有更新,可以走 git 流程拉取最新代码。 如果你想体验最新未发布版本,或者想参与贡献,需要在源码上进行修改、调试,建议选择这种安装方式,对开发技术水平要求较高,如果代码有更新,可以走 git 流程拉取最新代码。
## 协议
- [内核](https://github.com/nocobase/nocobase/tree/main/packages/core) 采用 [Apache 2.0 协议](./LICENSE-APACHE-2.0)
- [插件](https://github.com/nocobase/nocobase/tree/main/packages/plugins) 采用 [AGPL 3.0 协议](./LICENSE-AGPL)。

View File

@ -1,28 +1,27 @@
# Collection # Collection
## 概览 ## Overview
`Collection` 用于定义系统中的数据模型,如模型名称、字段、索引、关联等信息。 `Collection` is used to define the data model in the system, such as model name, fields, indexes, associations, and other information. It is usually called through the `collection` method of the `Database` instance as a proxy entry.
一般通过 `Database` 实例的 `collection` 方法作为代理入口调用。
```javascript ```javascript
const { Database } = require('@nocobase/database') const { Database } = require('@nocobase/database')
// 创建数据库实例 // Create database instance
const db = new Database({...}); const db = new Database({...});
// 定义数据模型 // Define data model
db.collection({ db.collection({
name: 'users', name: 'users',
// 定义模型字段 // Define model fields
fields: [ fields: [
// 标量字段 // Scalar field
{ {
name: 'name', name: 'name',
type: 'string', type: 'string',
}, },
// 关联字段 // Association field
{ {
name: 'profile', name: 'profile',
type: 'hasOne' // 'hasMany', 'belongsTo', 'belongsToMany' type: 'hasOne' // 'hasMany', 'belongsTo', 'belongsToMany'
@ -31,30 +30,30 @@ db.collection({
}); });
``` ```
更多字段类型请参考 [Fields](/api/database/field.md)。 Refer to [Fields](/api/database/field.md) for more field types.
## 构造函数 ## Constructor
**签名** **Signature**
* `constructor(options: CollectionOptions, context: CollectionContext)` * `constructor(options: CollectionOptions, context: CollectionContext)`
**参数** **Parameter**
| 参数名 | 类型 | 默认值 | 描述 | | Name | Type | Default | Description |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| `options.name` | `string` | - | collection 标识 | | `options.name` | `string` | - | Identifier of the collection |
| `options.tableName?` | `string` | - | 数据库表名,如不传则使用 `options.name` 的值 | | `options.tableName?` | `string` | - | Database table name, the value of `options.name` is used if not set |
| `options.fields?` | `FieldOptions[]` | - | 字段定义,详见 [Field](./field) | | `options.fields?` | `FieldOptions[]` | - | Definition of fields, refer to [Field](./field) for details |
| `options.model?` | `string \| ModelStatic<Model>` | - | Sequelize 的 Model 类型,如果使用的是 `string`,则需要调用之前在 db 上注册过该模型名称 | | `options.model?` | `string \| ModelStatic<Model>` | - | Model type of Sequelize; in case `string` is used, this model name needs to be registered in the db before being called |
| `options.repository?` | `string \| RepositoryType` | - | 数据仓库类型,如果使用 `string`,则需要调用之前在 db 上注册过该仓库类型 | | `options.repository?` | `string \| RepositoryType` | - | Data repository type; in case `string` is used, this repository type needs to be registered in the db before being called |
| `options.sortable?` | `string \| boolean \| { name?: string; scopeKey?: string }` | - | 数据可排序字段配置,默认不排序 | | `options.sortable?` | `string \| boolean \| { name?: string; scopeKey?: string }` | - | Configure which fields are sortable; not sortable by default |
| `options.autoGenId?` | `boolean` | `true` | 是否自动生成唯一主键,默认为 `true` | | `options.autoGenId?` | `boolean` | `true` | Whether to automatically generate unique primary key; `true` by default |
| `context.database` | `Database` | - | 所在的上下文环境数据库 | | `context.database` | `Database` | - | The context database in which it resides |
**示例** **Example**
创建一张文章表: Create a table <i>posts</i>:
```ts ```ts
const posts = new Collection({ const posts = new Collection({
@ -70,62 +69,62 @@ const posts = new Collection({
} }
] ]
}, { }, {
// 已存在的数据库实例 // An existing database instance
database: db database: db
}); });
``` ```
## 实例成员 ## Instance Member
### `options` ### `options`
数据表配置初始参数。与构造函数的 `options` 参数一致。 Initial parameters for data table configuration, which are consistent with the `options` parameter of the constructor.
### `context` ### `context`
当前数据表所属的上下文环境,目前主要是数据库实例。 The contextual environment to which the current data table belongs, currently mainly the database instance.
### `name` ### `name`
数据表名称。 Name of the data table.
### `db` ### `db`
所属数据库实例。 The database instance to which it belongs.
### `filterTargetKey` ### `filterTargetKey`
作为主键的字段名。 Name of the field that is used as the primary key.
### `isThrough` ### `isThrough`
是否为中间表。 Whether it is an intermediate table.
### `model` ### `model`
匹配 Sequelize 的 Model 类型。 Match the Model type of Sequelize.
### `repository` ### `repository`
数据仓库实例。 Data repository instance.
## 字段配置方法 ## Field Configuration Method
### `getField()` ### `getField()`
获取数据表已定义对应名称的字段对象。 Get a field object whose corresponding name has been defined in the data table.
**签名** **Signature**
* `getField(name: string): Field` * `getField(name: string): Field`
**参数** **Parameter**
| 参数名 | 类型 | 默认值 | 描述 | | Name | Type | Default | Description |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| `name` | `string` | - | 字段名称 | | `name` | `string` | - | Name of the field |
**示例** **Example**
```ts ```ts
const posts = db.collection({ const posts = db.collection({
@ -143,20 +142,20 @@ const field = posts.getField('title');
### `setField()` ### `setField()`
对数据表设置字段。 Set a field to the data table.
**签名** **Signature**
* `setField(name: string, options: FieldOptions): Field` * `setField(name: string, options: FieldOptions): Field`
**参数** **Parameter**
| 参数名 | 类型 | 默认值 | 描述 | | Name | Type | Default | Description |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| `name` | `string` | - | 字段名称 | | `name` | `string` | - | Name of the field |
| `options` | `FieldOptions` | - | 字段配置,详见 [Field](./field) | | `options` | `FieldOptions` | - | Configuration of the field, refer to [Field](./field) for details |
**示例** **Example**
```ts ```ts
const posts = db.collection({ name: 'posts' }); const posts = db.collection({ name: 'posts' });
@ -166,20 +165,20 @@ posts.setField('title', { type: 'string' });
### `setFields()` ### `setFields()`
对数据表批量设置多个字段。 Set multiple fields to the data table.
**签名** **Signature**
* `setFields(fields: FieldOptions[], resetFields = true): Field[]` * `setFields(fields: FieldOptions[], resetFields = true): Field[]`
**参数** **Parameter**
| 参数名 | 类型 | 默认值 | 描述 | | Name | Type | Default | Description |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| `fields` | `FieldOptions[]` | - | 字段配置,详见 [Field](./field) | | `fields` | `FieldOptions[]` | - | Configuration of the fields, refer to [Field](./field) for details |
| `resetFields` | `boolean` | `true` | 是否重置已存在的字段 | | `resetFields` | `boolean` | `true` | Whether to reset existing fields |
**示例** **Example**
```ts ```ts
const posts = db.collection({ name: 'posts' }); const posts = db.collection({ name: 'posts' });
@ -192,19 +191,19 @@ posts.setFields([
### `removeField()` ### `removeField()`
移除数据表已定义对应名称的字段对象。 Remove a field object whose corresponding name has been defined in the data table.
**签名** **Signature**
* `removeField(name: string): void | Field` * `removeField(name: string): void | Field`
**参数** **Parameter**
| 参数名 | 类型 | 默认值 | 描述 | | Name | Type | Default | Description |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| `name` | `string` | - | 字段名称 | | `name` | `string` | - | Name of the field |
**示例** **Example**
```ts ```ts
const posts = db.collection({ const posts = db.collection({
@ -222,13 +221,13 @@ posts.removeField('title');
### `resetFields()` ### `resetFields()`
重置(清空)数据表的字段。 Reset (Empty) fields of the data table.
**签名** **Signature**
* `resetFields(): void` * `resetFields(): void`
**示例** **Example**
```ts ```ts
const posts = db.collection({ const posts = db.collection({
@ -246,19 +245,19 @@ posts.resetFields();
### `hasField()` ### `hasField()`
判断数据表是否已定义对应名称的字段对象。 Check if the data table has defined a field object with the corresponding name.
**签名** **Signature**
* `hasField(name: string): boolean` * `hasField(name: string): boolean`
**参数** **Parameter**
| 参数名 | 类型 | 默认值 | 描述 | | Name | Type | Default | Description |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| `name` | `string` | - | 字段名称 | | `name` | `string` | - | Name of the field |
**示例** **Example**
```ts ```ts
const posts = db.collection({ const posts = db.collection({
@ -276,19 +275,19 @@ posts.hasField('title'); // true
### `findField()` ### `findField()`
查找数据表中符合条件的字段对象。 Find field objects in the data table that match the conditions.
**签名** **Signature**
* `findField(predicate: (field: Field) => boolean): Field | undefined` * `findField(predicate: (field: Field) => boolean): Field | undefined`
**参数** **Parameter**
| 参数名 | 类型 | 默认值 | 描述 | | Name | Type | Default | Description |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| `predicate` | `(field: Field) => boolean` | - | 查找条件 | | `predicate` | `(field: Field) => boolean` | - | The condition |
**示例** **Example**
```ts ```ts
const posts = db.collection({ const posts = db.collection({
@ -306,19 +305,19 @@ posts.findField(field => field.name === 'title');
### `forEachField()` ### `forEachField()`
遍历数据表中的字段对象。 Iterate over field objects in the data table.
**签名** **Signature**
* `forEachField(callback: (field: Field) => void): void` * `forEachField(callback: (field: Field) => void): void`
**参数** **Parameter**
| 参数名 | 类型 | 默认值 | 描述 | | Name | Type | Default | Description |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| `callback` | `(field: Field) => void` | - | 回调函数 | | `callback` | `(field: Field) => void` | - | Callback function |
**示例** **Example**
```ts ```ts
const posts = db.collection({ const posts = db.collection({
@ -334,24 +333,24 @@ const posts = db.collection({
posts.forEachField(field => console.log(field.name)); posts.forEachField(field => console.log(field.name));
``` ```
## 索引配置方法 ## Index Configuration Method
### `addIndex()` ### `addIndex()`
添加数据表索引。 Add data table index.
**签名** **Signature**
* `addIndex(index: string | string[] | { fields: string[], unique?: boolean,[key: string]: any })` * `addIndex(index: string | string[] | { fields: string[], unique?: boolean,[key: string]: any })`
**参数** **Parameter**
| 参数名 | 类型 | 默认值 | 描述 | | Name | Type | Default | Description |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| `index` | `string \| string[]` | - | 需要配置索引的字段名 | | `index` | `string \| string[]` | - | Names of fields to be indexed |
| `index` | `{ fields: string[], unique?: boolean, [key: string]: any }` | - | 完整配置 | | `index` | `{ fields: string[], unique?: boolean, [key: string]: any }` | - | Full configuration |
**示例** **Example**
```ts ```ts
const posts = db.collection({ const posts = db.collection({
@ -372,19 +371,19 @@ posts.addIndex({
### `removeIndex()` ### `removeIndex()`
移除数据表索引。 Remove data table index.
**签名** **Signature**
* `removeIndex(fields: string[])` * `removeIndex(fields: string[])`
**参数** **Parameter**
| 参数名 | 类型 | 默认值 | 描述 | | Name | Type | Default | Description |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| `fields` | `string[]` | - | 需要移除索引的字段名组合 | | `fields` | `string[]` | - | Names of fields to remove indexes |
**示例** **Example**
```ts ```ts
const posts = db.collection({ const posts = db.collection({
@ -406,17 +405,17 @@ const posts = db.collection({
posts.removeIndex(['title']); posts.removeIndex(['title']);
``` ```
## 表配置方法 ## Table Configuration Method
### `remove()` ### `remove()`
删除数据表。 Remove data table.
**签名** **Signature**
* `remove(): void` * `remove(): void`
**示例** **Example**
```ts ```ts
const posts = db.collection({ const posts = db.collection({
@ -432,17 +431,17 @@ const posts = db.collection({
posts.remove(); posts.remove();
``` ```
## 数据库操作方法 ## Database Operation Method
### `sync()` ### `sync()`
同步数据表定义到数据库。除了 Sequelize 中默认的 `Model.sync` 的逻辑,还会一并处理关系字段对应的数据表。 Synchronize the definitions in data table to the database. In addition to the default `Model.sync` logic in Sequelize, the data tables corresponding to the relational fields will also be handled together.
**签名** **Signature**
* `sync(): Promise<void>` * `sync(): Promise<void>`
**示例** **Example**
```ts ```ts
const posts = db.collection({ const posts = db.collection({
@ -460,19 +459,19 @@ await posts.sync();
### `existsInDb()` ### `existsInDb()`
判断数据表是否存在于数据库中。 Check whether the data table exists in the database.
**签名** **Signature**
* `existsInDb(options?: Transactionable): Promise<boolean>` * `existsInDb(options?: Transactionable): Promise<boolean>`
**参数** **Parameter**
| 参数名 | 类型 | 默认值 | 描述 | | Name | Type | Default | Description |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| `options?.transaction` | `Transaction` | - | 事务实例 | | `options?.transaction` | `Transaction` | - | Transaction instance |
**示例** **Example**
```ts ```ts
const posts = db.collection({ const posts = db.collection({
@ -492,20 +491,20 @@ console.log(existed); // false
### `removeFromDb()` ### `removeFromDb()`
**签名** **Signature**
* `removeFromDb(): Promise<void>` * `removeFromDb(): Promise<void>`
**示例** **Example**
```ts ```ts
const books = db.collection({ const books = db.collection({
name: 'books' name: 'books'
}); });
// 同步书籍表到数据库 // Synchronize the table books to the database
await db.sync(); await db.sync();
// 删除数据库中的书籍表 // Remove the table books from the database
await books.removeFromDb(); await books.removeFromDb();
``` ```

View File

@ -1,163 +1,163 @@
# Field # Field
## 概览 ## Overview
数据表字段管理类(抽象类)。同时是所有字段类型的基类,其他任意字段类型均通过继承该类来实现。 Data table field management class (abstract class). It is also the base class for all field types, and any other field types are implemented by inheriting from this class.
如何自定义字段可参考[扩展字段类型](/development/guide/collections-fields#扩展字段类型) Refer to [Extended Field Types](/development/guide/collections-fields#extended-field-types) to see how to customize fields.
## 构造函数 ## Constructor
通常不会直接由开发者调用,主要通过 `db.collection({ fields: [] })` 方法作为代理入口调用。 It is usually not called directly by the developer, but mainly through the `db.collection({ fields: [] })` method as a proxy entry.
在扩展字段时主要通过继承 `Field` 抽象类,再注册到 Database 实例中来实现。 Extended field is implemented mainly by inheriting the `Field` abstract class and registering it to a Database instance.
**签名** **Signature**
* `constructor(options: FieldOptions, context: FieldContext)` * `constructor(options: FieldOptions, context: FieldContext)`
**参数** **Parameter**
| 参数名 | 类型 | 默认值 | 描述 | | Name | Type | Default | Description |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| `options` | `FieldOptions` | - | 字段配置对象 | | `options` | `FieldOptions` | - | Field configuration object |
| `options.name` | `string` | - | 字段名称 | | `options.name` | `string` | - | Field name |
| `options.type` | `string` | - | 字段类型,对应在 db 中注册的字段类型名称 | | `options.type` | `string` | - | Field type, corresponding to the name of the field type registered in the db |
| `context` | `FieldContext` | - | 字段上下文对象 | | `context` | `FieldContext` | - | Field context object |
| `context.database` | `Database` | - | 数据库实例 | | `context.database` | `Database` | - | Database instance |
| `context.collection` | `Collection` | - | 数据表实例 | | `context.collection` | `Collection` | - | Data table instance |
## 实例成员 ## Instance Member
### `name` ### `name`
字段名称。 Field name.
### `type` ### `type`
字段类型。 Field type.
### `dataType` ### `dataType`
字段数据库存储类型。 Data type of the field.
### `options` ### `options`
字段初始化配置参数。 Configuration parameters to initialize the field.
### `context` ### `context`
字段上下文对象。 Field context object.
## 配置方法 ## Configuration Method
### `on()` ### `on()`
基于数据表事件的快捷定义方式。相当于 `db.on(this.collection.name + '.' + eventName, listener)` Quick definition method based on data table events. It is equivalent to `db.on(this.collection.name + '.' + eventName, listener)`.
继承时通常无需覆盖此方法。 It is usually not necessary to override this method when inheriting.
**签名** **Signature**
* `on(eventName: string, listener: (...args: any[]) => void)` * `on(eventName: string, listener: (...args: any[]) => void)`
**参数** **Parameter**
| 参数名 | 类型 | 默认值 | 描述 | | Name | Type | Default | Description |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| `eventName` | `string` | - | 事件名称 | | `eventName` | `string` | - | Event name |
| `listener` | `(...args: any[]) => void` | - | 事件监听器 | | `listener` | `(...args: any[]) => void` | - | Event listener |
### `off()` ### `off()`
基于数据表事件的快捷移除方式。相当于 `db.off(this.collection.name + '.' + eventName, listener)` Quick removal method based on data table events. It is equivalent to `db.off(this.collection.name + '.' + eventName, listener)`.
继承时通常无需覆盖此方法。 It is usually not necessary to override this method when inheriting.
**签名** **Signature**
* `off(eventName: string, listener: (...args: any[]) => void)` * `off(eventName: string, listener: (...args: any[]) => void)`
**参数** **Parameter**
| 参数名 | 类型 | 默认值 | 描述 | | Name | Type | Default | Description |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| `eventName` | `string` | - | 事件名称 | | `eventName` | `string` | - | Event name |
| `listener` | `(...args: any[]) => void` | - | 事件监听器 | | `listener` | `(...args: any[]) => void` | - | Event listener |
### `bind()` ### `bind()`
当字段被添加到数据表时触发的执行内容。通常用于添加数据表事件监听器和其他处理。 The execution content that is triggered when a field is added to data table. Typically used to add data table event listeners and other processing.
继承时需要先调用对应的 `super.bind()` 方法。 The corresponding `super.bind()` method needs to be called first when inheriting.
**签名** **Signature**
* `bind()` * `bind()`
### `unbind()` ### `unbind()`
当字段从数据表中移除时触发的执行内容。通常用于移除数据表事件监听器和其他处理。 The execution content that is triggered when a field is removed from data table. Typically used to remove data table event listeners and other processing.
继承时需要先调用对应的 `super.unbind()` 方法。 The corresponding `super.unbind()` method needs to be called first when inheriting.
**签名** **Signature**
* `unbind()` * `unbind()`
### `get()` ### `get()`
获取字段的配置项的值。 Get the values of a configuration item of the field.
**签名** **Signature**
* `get(key: string): any` * `get(key: string): any`
**参数** **Parameter**
| 参数名 | 类型 | 默认值 | 描述 | | Name | Type | Default | Description |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| `key` | `string` | - | 配置项名称 | | `key` | `string` | - | Name of the configuration item |
**示例** **Example**
```ts ```ts
const field = db.collection('users').getField('name'); const field = db.collection('users').getField('name');
// 获取字段名称配置项的值,返回 'name' // Get and return the values of the configuration item 'name'
console.log(field.get('name')); console.log(field.get('name'));
``` ```
### `merge()` ### `merge()`
合并字段的配置项的值。 Merge the values of a configuration item of the field.
**签名** **Signature**
* `merge(options: { [key: string]: any }): void` * `merge(options: { [key: string]: any }): void`
**参数** **Parameter**
| 参数名 | 类型 | 默认值 | 描述 | | Name | Type | Default | Description |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| `options` | `{ [key: string]: any }` | - | 要合并的配置项对象 | | `options` | `{ [key: string]: any }` | - | The configuration item to merge |
**示例** **Example**
```ts ```ts
const field = db.collection('users').getField('name'); const field = db.collection('users').getField('name');
field.merge({ field.merge({
// 添加一个索引配置 // Add an index configuration
index: true index: true
}); });
``` ```
### `remove()` ### `remove()`
从数据表中移除字段(仅从内存中移除)。 Remove a field from data table (from memory only).
**示例** **Example**
```ts ```ts
const books = db.getCollections('books'); const books = db.getCollections('books');
@ -168,49 +168,49 @@ books.getField('isbn').remove();
await books.sync(); await books.sync();
``` ```
## 数据库方法 ## Database Method
### `removeFromDb()` ### `removeFromDb()`
从数据库中移除字段。 Remove a field from the database.
**签名** **Signature**
* `removeFromDb(options?: Transactionable): Promise<void>` * `removeFromDb(options?: Transactionable): Promise<void>`
**参数** **Parameter**
| 参数名 | 类型 | 默认值 | 描述 | | Name | Type | Default | Description |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| `options.transaction?` | `Transaction` | - | 事务实例 | | `options.transaction?` | `Transaction` | - | Transaction instance |
### `existsInDb()` ### `existsInDb()`
判断字段是否存在于数据库中。 Check if a field exists in the database.
**签名** **Signature**
* `existsInDb(options?: Transactionable): Promise<boolean>` * `existsInDb(options?: Transactionable): Promise<boolean>`
**参数** **Parameter**
| 参数名 | 类型 | 默认值 | 描述 | | Name | Type | Default | Description |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| `options.transaction?` | `Transaction` | - | 事务实例 | | `options.transaction?` | `Transaction` | - | Transaction instance |
## 内置字段类型列表 ## Built-in Field Types
NocoBase 内置了一些常用的字段类型,可以直接在定义数据表的字段是使用对应的 type 名称来指定类型。不同类型的字段参数配置不同,具体可参考下面的列表。 NocoBase has some built-in common field types, the corresponding type name can be used directly to specify the type of field upon definition. Fields of different types are configured differently, please refer to the list below.
所有字段类型的配置项除了以下额外介绍的以外,都会透传至 Sequelize所以所有 Sequelize 支持的字段配置项都可以在这里使用(如 `allowNull``defaultValue` 等)。 The configuration items of all field types are passed through to Sequelize in addition to those described below. Therefore, all field configuration items supported by Sequelize can be used here (e.g. `allowNull`, `defaultValue`, etc.).
另外 server 端的字段类型主要解决数据库存储和部分算法的问题,与前端的字段展示类型和使用组件基本无关。前端字段类型可以参考教程对应说明。 Moreover, server-side field types are mainly used for solving the problems of database storage and some algorithms, they are barely relevant to the field display types and the use of components in front-end. The front-end field types can be found in the corresponding tutorials.
### `'boolean'` ### `'boolean'`
逻辑值类型。 Boolean type.
**示例** **Example**
```js ```js
db.collection({ db.collection({
@ -226,9 +226,9 @@ db.collection({
### `'integer'` ### `'integer'`
整型32 位)。 Integer type (32 bits).
**示例** **Example**
```ts ```ts
db.collection({ db.collection({
@ -244,9 +244,9 @@ db.collection({
### `'bigInt'` ### `'bigInt'`
长整型64 位)。 Long integer type (64 bits).
**示例** **Example**
```ts ```ts
db.collection({ db.collection({
@ -262,9 +262,9 @@ db.collection({
### `'double'` ### `'double'`
双精度浮点型64 位)。 Double-precision floating-point format (64 bits).
**示例** **Example**
```ts ```ts
db.collection({ db.collection({
@ -280,17 +280,17 @@ db.collection({
### `'real'` ### `'real'`
实数类型(仅 PG 适用)。 Real type (PG only).
### `'decimal'` ### `'decimal'`
十进制小数类型。 Decimal type.
### `'string'` ### `'string'`
字符串类型。相当于大部分数据库的 `VARCHAR` 类型。 String type. Equivalent to the `VARCHAR` type for most databases.
**示例** **Example**
```ts ```ts
db.collection({ db.collection({
@ -306,9 +306,9 @@ db.collection({
### `'text'` ### `'text'`
文本类型。相当于大部分数据库的 `TEXT` 类型。 Text type. Equivalent to the `TEXT` type for most databases.
**示例** **Example**
```ts ```ts
db.collection({ db.collection({
@ -324,9 +324,9 @@ db.collection({
### `'password'` ### `'password'`
密码类型NocoBase 扩展)。基于 Node.js 原生的 crypto 包的 `scrypt` 方法进行密码加密。 Password type (NocoBase extension). Password encryption based on the `scrypt` method of Node.js native crypto packages.
**示例** **Example**
```ts ```ts
db.collection({ db.collection({
@ -335,53 +335,53 @@ db.collection({
{ {
type: 'password', type: 'password',
name: 'password', name: 'password',
length: 64, // 长度,默认 64 length: 64, // Length, default is 64
randomBytesSize: 8 // 随机字节长度,默认 8 randomBytesSize: 8 // Length of random bytes, default is 8
} }
] ]
}); });
``` ```
**参数** **Parameter**
| 参数名 | 类型 | 默认值 | 描述 | | Name | Type | Default | Description |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| `length` | `number` | 64 | 字符长度 | | `length` | `number` | 64 | Length of characters |
| `randomBytesSize` | `number` | 8 | 随机字节大小 | | `randomBytesSize` | `number` | 8 | Length of random bytes |
### `'date'` ### `'date'`
日期类型。 Date type.
### `'time'` ### `'time'`
时间类型。 Time type.
### `'array'` ### `'array'`
数组类型(仅 PG 适用)。 Array type (PG only).
### `'json'` ### `'json'`
JSON 类型。 JSON type.
### `'jsonb'` ### `'jsonb'`
JSONB 类型(仅 PG 适用,其他会被兼容为 `'json'` 类型)。 JSONB type (PG only, others will be compatible with the `'json'` type).
### `'uuid'` ### `'uuid'`
UUID 类型。 UUID type.
### `'uid'` ### `'uid'`
UID 类型NocoBase 扩展)。短随机字符串标识符类型。 UID type (NocoBase extension). Short random string identifier type.
### `'formula'` ### `'formula'`
公式类型NocoBase 扩展)。可配置基于 [mathjs](https://www.npmjs.com/package/mathjs) 的数学公式计算,公式中可以引用同一条记录中其他列的数值参与计算。 Formula type (NocoBase extension). Mathematical formula calculation can be configured based on [mathjs](https://www.npmjs.com/package/mathjs), and the formula can refer to the values of other columns in the same record to participate in the calculation.
**示例** **Example**
```ts ```ts
db.collection({ db.collection({
@ -406,11 +406,11 @@ db.collection({
### `'radio'` ### `'radio'`
单选类型NocoBase 扩展)。全表最多有一行数据的该字段值为 `true`,其他都为 `false``null` Radio type (NocoBase extension). The field value is 'true' for at most one row of data for the full table, all others are 'false' or 'null'.
**示例** **Example**
整个系统只有一个被标记为 root 的用户,任意另一个用户的 root 值被改为 `true` 之后,其他所有 root 为 `true` 的记录均会被修改为 `false` There is only one user marked as <i>root</i> in the entire system, once the <i>root</i> value of any other user is changed to `true`, all other records with <i>root</i> of `true` will be changed to `false`:
```ts ```ts
db.collection({ db.collection({
@ -426,13 +426,13 @@ db.collection({
### `'sort'` ### `'sort'`
排序类型NocoBase 扩展)。基于整型数字进行排序,为新记录自动生成新序号,当移动数据时进行序号重排。 Sorting type (NocoBase extension). Sorting based on integer numbers, automatically generating new serial numbers for new records, and rearranging serial numbers when moving data.
数据表如果定义了 `sortable` 选项,也会自动生成对应字段。 If data table has the `sortable` option defined, the corresponding fields will be generated automatically.
**示例** **Example**
文章基于所属用户可排序: Posts are sortable based on the users they belong to.
```ts ```ts
db.collection({ db.collection({
@ -445,7 +445,7 @@ db.collection({
{ {
type: 'sort', type: 'sort',
name: 'priority', name: 'priority',
scopeKey: 'userId' // 以 userId 相同值分组的数据进行排序 scopeKey: 'userId' // Sort data grouped by the values of userId
} }
] ]
}); });
@ -453,15 +453,15 @@ db.collection({
### `'virtual'` ### `'virtual'`
虚拟类型。不实际储存数据,仅用于特殊 getter/setter 定义时使用。 Virtual type. No Data is actually stored, it is used only when special getter/setter is defined.
### `'belongsTo'` ### `'belongsTo'`
多对一关联类型。外键储存在自身表,与 hasOne/hasMany 相对。 Many-to-one association type. Foreign key is stored in its own table, as opposed to `'hasOne'`/`'hasMany'`.
**示例** **Example**
任意文章属于某个作者: Any post belongs to an author:
```ts ```ts
db.collection({ db.collection({
@ -470,9 +470,9 @@ db.collection({
{ {
type: 'belongsTo', type: 'belongsTo',
name: 'author', name: 'author',
target: 'users', // 不配置默认为 name 复数名称的表名 target: 'users', // Default table name is the plural form of <name>
foreignKey: 'authorId', // 不配置默认为 <name> + Id 的格式 foreignKey: 'authorId', // Default is '<name> + Id'
sourceKey: 'id' // 不配置默认为 target 表的 id sourceKey: 'id' // Default is id of the <target> table
} }
] ]
}); });
@ -480,11 +480,11 @@ db.collection({
### `'hasOne'` ### `'hasOne'`
一对一关联类型。外键储存在关联表,与 belongsTo 相对。 One-to-one association type. Foreign key is stored in the association table, as opposed to `'belongsTo'`.
**示例** **Example**
任意用户都有一份个人资料: Any user has a profile:
```ts ```ts
db.collection({ db.collection({
@ -493,7 +493,7 @@ db.collection({
{ {
type: 'hasOne', type: 'hasOne',
name: 'profile', name: 'profile',
target: 'profiles', // 可省略 target: 'profiles', // Can be omitted
} }
] ]
}) })
@ -501,11 +501,11 @@ db.collection({
### `'hasMany'` ### `'hasMany'`
一对多关联类型。外键储存在关联表,与 belongsTo 相对。 One-to-many association type. The foreign key is stored in the association table, as opposed to `'belongsTo'`.
**示例** **Example**
任意用户可以拥有多篇文章: Any user can have multiple posts:
```ts ```ts
db.collection({ db.collection({
@ -523,11 +523,11 @@ db.collection({
### `'belongsToMany'` ### `'belongsToMany'`
多对多关联类型。使用中间表储存双方外键,如不指定已存在的表为中间表的话,将会自动创建中间表。 Many-to-many association type. Intermediate table is used to store both foreign keys. If no existing table is specified as intermediate table, it will be created automatically.
**示例** **Example**
任意文章可以加任意多个标签,任意标签也可以被任意多篇文章添加: Any post can have multiple tags added to it, and any tag can be added to multiple posts:
```ts ```ts
db.collection({ db.collection({
@ -536,11 +536,11 @@ db.collection({
{ {
type: 'belongsToMany', type: 'belongsToMany',
name: 'tags', name: 'tags',
target: 'tags', // 同名可省略 target: 'tags', // Can be omitted if name is the same
through: 'postsTags', // 中间表不配置将自动生成 through: 'postsTags', // Intermediate table will be generated automatically if not specified
foreignKey: 'postId', // 自身表在中间表的外键 foreignKey: 'postId', // Foreign key in the intermediate table referring to the table itself
sourceKey: 'id', // 自身表的主键 sourceKey: 'id', // Primary key of the table itself
otherKey: 'tagId' // 关联表在中间表的外键 otherKey: 'tagId' // Foreign key in the intermediate table referring to the association table
} }
] ]
}); });
@ -551,7 +551,7 @@ db.collection({
{ {
type: 'belongsToMany', type: 'belongsToMany',
name: 'posts', name: 'posts',
through: 'postsTags', // 同一组关系指向同一张中间表 through: 'postsTags', // Refer to the same intermediate table in the same set of relation
} }
] ]
}); });

View File

@ -112,7 +112,7 @@ Create a database instance.
| Name | Type | Default | Description | | Name | Type | Default | Description |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| `options.host` | `string` | `'localhost'` | Database host | | `options.host` | `string` | `'localhost'` | Database host |
| `options.port` | `number` | - | Database service port, there is a default port depending on the database used | | `options.port` | `number` | - | Database service port, default port depends on the type of database used |
| `options.username` | `string` | - | Database username | | `options.username` | `string` | - | Database username |
| `options.password` | `string` | - | Database password| | `options.password` | `string` | - | Database password|
| `options.database` | `string` | - | Database name | | `options.database` | `string` | - | Database name |
@ -209,7 +209,7 @@ Get the table name prefix in the configuration.
### `collection()` ### `collection()`
Define a data table. This is similar to the `define` method of Sequelize, which only creates table structure in memory. Call the `sync` method if it is needed to be persisted to the database. Define a data table. This is like the `define` method of Sequelize, which only creates table structure in memory. Call the `sync` method if needs to be persisted to the database.
**Signature** **Signature**
@ -247,7 +247,7 @@ await db.sync();
### `getCollection()` ### `getCollection()`
Gets a defined data table. Get a defined data table.
**Signature** **Signature**
@ -267,7 +267,7 @@ const collection = db.getCollection('books');
### `hasCollection()` ### `hasCollection()`
Check whether if a specified data table has been defined. Check whether a specified data table is defined.
**Signature** **Signature**
@ -291,7 +291,7 @@ db.hasCollection('authors'); // false
### `removeCollection()` ### `removeCollection()`
Remove a defined data table; remove from memory only. Call the `sync` method if it is needed to be persisted to the database. Remove a defined data table. It is to remove from memory only, call the `sync` method if needs to be persisted to the database.
**Signature** **Signature**
@ -318,7 +318,7 @@ db.removeCollection('books');
### `import()` ### `import()`
Load all files in the import file directory into memory as the configuration of collection. Load all files in the import file directory into memory as the configuration of collection.
**Signature** **Signature**
@ -359,7 +359,7 @@ class Plugin {
} }
``` ```
## Extended Registration and Acquisition ## Extension Registration and Acquisition
### `registerFieldTypes()` ### `registerFieldTypes()`
@ -371,7 +371,7 @@ Register custom field type.
**Parameter** **Parameter**
`fieldTypes` is a key-value pair, where key is the field type name and value is the field type class. `fieldTypes` is a key-value pair, where key is the field type name, and value is the field type class.
**Example** **Example**
@ -397,7 +397,7 @@ Register custom data model class.
**Parameter** **Parameter**
`models` is a key-value pair, where key is the data model name and value is the data model class. `models` is a key-value pair, where key is the data model name, and value is the data model class.
**Example** **Example**
@ -428,7 +428,7 @@ Register custom data repository class.
**Parameter** **Parameter**
`repositories` is a key-value pair, where key is the data repository name and value is the data repository class. `repositories` is a key-value pair, where key is the data repository name, and value is the data repository class.
**Example** **Example**
@ -459,7 +459,7 @@ Register custom data query operator.
**Parameter** **Parameter**
`operators` is a key-value pair, where key is the operator name and value is the generating function of the comparison operator statement. `operators` is a key-value pair, where key is the operator name, and value is the generating function of the comparison operator statement.
**Example** **Example**
@ -508,7 +508,7 @@ const ModelClass = db.getModel('books');
console.log(ModelClass.prototype instanceof MyModel) // true console.log(ModelClass.prototype instanceof MyModel) // true
``` ```
Note: The model class retrieved from collection is not strictly equivalent to the model class at registration, but is inherited from the model class at registration. Since the properties of Sequelize's model class are modified during initialization, NocoBase automatically handles this inheritance relationship. All thr definitions work fine except that the classes are not equal. Note: The model class retrieved from collection is not strictly equivalent to the model class at registration, but is inherited from the model class at registration. Since the properties of Sequelize's model class are modified during initialization, NocoBase automatically handles this inheritance relationship. All the definitions work fine except that the classes are not equal.
### `getRepository()` ### `getRepository()`
@ -660,7 +660,7 @@ Empty the database, it will delete all data tables.
**Example** **Example**
Removes all tables except for the `users` table. Remove all tables except for the `users` table.
```ts ```ts
await db.clean({ await db.clean({
@ -705,22 +705,22 @@ export default defineCollection({
### `extendCollection()` ### `extendCollection()`
扩展已在内存中的表结构配置内容,主要用于 `import()` 方法导入的文件内容。该方法是 `@nocobase/database` 包导出的顶级方法,不通过 db 实例调用。也可以使用 `extend` 别名。 Extent the configuration content of a data table that is already in memory, mainly for the content of files imported by the `import()` method. This is the top-level package export method of `@nocobase/database`, and is not called through db instance. The `extend` alias can also be used.
**签名** **Signature**
* `extendCollection(collectionOptions: CollectionOptions, mergeOptions?: MergeOptions): ExtendedCollectionOptions` * `extendCollection(collectionOptions: CollectionOptions, mergeOptions?: MergeOptions): ExtendedCollectionOptions`
**参数** **Parameter**
| 参数名 | 类型 | 默认值 | 描述 | | Name | Type | Default | Description |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| `collectionOptions` | `CollectionOptions` | - | 与所有 `db.collection()` 的参数相同 | | `collectionOptions` | `CollectionOptions` | - | All the same with `db.collection()` |
| `mergeOptions?` | `MergeOptions` | - | npm 包 [deepmerge](https://npmjs.com/package/deepmerge) 的参数 | | `mergeOptions?` | `MergeOptions` | - | [deepmerge](https://npmjs.com/package/deepmerge) options of npm package |
**示例** **Example**
原始 books 表定义books.ts Original definition of the table <i>books</i> (books.ts):
```ts ```ts
export default { export default {
@ -731,12 +731,12 @@ export default {
} }
``` ```
扩展 books 表定义books.extend.ts Extend the definition of the table <i>books</i> (books.extend.ts):
```ts ```ts
import { extend } from '@nocobase/database'; import { extend } from '@nocobase/database';
// 再次扩展 // Extend again
export default extend({ export default extend({
name: 'books', name: 'books',
fields: [ fields: [
@ -745,25 +745,25 @@ export default extend({
}); });
``` ```
以上两个文件如在调用 `import()` 时导入,通过 `extend()` 再次扩展以后books 表将拥有 `title``price` 两个字段。 If the above two files are imported when calling `import()`, after being extended again by `extend()`, the table <i>books</i> will have `title` and `price` two fields.
此方法在扩展已有插件已定义的表结构时非常有用。 This method is especially useful when extending the table structure that is already defined by existing plugin.
## 内置事件 ## Built-in Events
数据库会在相应的生命周期触发以下对应的事件,通过 `on()` 方法订阅后进行特定的处理可满足一些业务需要。 The following events will be triggered in the corresponding lifecycle of database, subscribe by the `on()` method and perform specific processing to meet some business needs.
### `'beforeSync'` / `'afterSync'` ### `'beforeSync'` / `'afterSync'`
当新的表结构配置(字段、索引等)被同步到数据库前后触发,通常在执行 `collection.sync()`(内部调用)时会触发,一般用于一些特殊的字段扩展的逻辑处理。 Events triggered before or after a new table structure configuration (fields, indexes, etc.) is synchronized to the database. This is usually triggered when executing `collection.sync()` (internal call) for the logical processing of the extension of some special fields.
**签名** **Signature**
```ts ```ts
on(eventName: `${string}.beforeSync` | 'beforeSync' | `${string}.afterSync` | 'afterSync', listener: SyncListener): this on(eventName: `${string}.beforeSync` | 'beforeSync' | `${string}.afterSync` | 'afterSync', listener: SyncListener): this
``` ```
**类型** **Type**
```ts ```ts
import type { SyncOptions, HookReturn } from 'sequelize/types'; import type { SyncOptions, HookReturn } from 'sequelize/types';
@ -771,7 +771,7 @@ import type { SyncOptions, HookReturn } from 'sequelize/types';
type SyncListener = (options?: SyncOptions) => HookReturn; type SyncListener = (options?: SyncOptions) => HookReturn;
``` ```
**示例** **Example**
```ts ```ts
const users = db.collection({ const users = db.collection({
@ -794,15 +794,15 @@ await users.sync();
### `'beforeValidate'` / `'afterValidate'` ### `'beforeValidate'` / `'afterValidate'`
创建或更新数据前会有基于 collection 定义的规则对数据的验证过程,在验证前后会触发对应事件。当调用 `repository.create()``repository.update()` 时会触发。 Before creating or updating data, there is a validation against the data based on the rules defined by the collection, and the corresponding events are triggered before and after the validation. This is triggered when `repository.create()` or `repository.update()` is called.
**签名** **Signature**
```ts ```ts
on(eventName: `${string}.beforeValidate` | 'beforeValidate' | `${string}.afterValidate` | 'afterValidate', listener: ValidateListener): this on(eventName: `${string}.beforeValidate` | 'beforeValidate' | `${string}.afterValidate` | 'afterValidate', listener: ValidateListener): this
``` ```
**类型** **Type**
```ts ```ts
import type { ValidationOptions } from 'sequelize/types/lib/instance-validator'; import type { ValidationOptions } from 'sequelize/types/lib/instance-validator';
@ -812,7 +812,7 @@ import type { Model } from '@nocobase/database';
type ValidateListener = (model: Model, options?: ValidationOptions) => HookReturn; type ValidateListener = (model: Model, options?: ValidationOptions) => HookReturn;
``` ```
**示例** **Example**
```ts ```ts
db.collection({ db.collection({
@ -863,15 +863,15 @@ await repository.update({
### `'beforeCreate'` / `'afterCreate'` ### `'beforeCreate'` / `'afterCreate'`
创建一条数据前后会触发对应事件,当调用 `repository.create()` 时会触发。 Events triggered before or after creating one piece of data. This is triggered when `repository.create()` is called.
**签名** **Signature**
```ts ```ts
on(eventName: `${string}.beforeCreate` | 'beforeCreate' | `${string}.afterCreate` | 'afterCreate', listener: CreateListener): this on(eventName: `${string}.beforeCreate` | 'beforeCreate' | `${string}.afterCreate` | 'afterCreate', listener: CreateListener): this
``` ```
**类型** **Type**
```ts ```ts
import type { CreateOptions, HookReturn } from 'sequelize/types'; import type { CreateOptions, HookReturn } from 'sequelize/types';
@ -880,7 +880,7 @@ import type { Model } from '@nocobase/database';
export type CreateListener = (model: Model, options?: CreateOptions) => HookReturn; export type CreateListener = (model: Model, options?: CreateOptions) => HookReturn;
``` ```
**示例** **Example**
```ts ```ts
db.on('beforeCreate', async (model, options) => { db.on('beforeCreate', async (model, options) => {
@ -898,15 +898,15 @@ db.on('books.afterCreate', async (model, options) => {
### `'beforeUpdate'` / `'afterUpdate'` ### `'beforeUpdate'` / `'afterUpdate'`
更新一条数据前后会触发对应事件,当调用 `repository.update()` 时会触发。 Events triggered before or after updating one piece of data. This is triggered when `repository.update()` is called.
**签名** **Signature**
```ts ```ts
on(eventName: `${string}.beforeUpdate` | 'beforeUpdate' | `${string}.afterUpdate` | 'afterUpdate', listener: UpdateListener): this on(eventName: `${string}.beforeUpdate` | 'beforeUpdate' | `${string}.afterUpdate` | 'afterUpdate', listener: UpdateListener): this
``` ```
**类型** **Type**
```ts ```ts
import type { UpdateOptions, HookReturn } from 'sequelize/types'; import type { UpdateOptions, HookReturn } from 'sequelize/types';
@ -915,7 +915,7 @@ import type { Model } from '@nocobase/database';
export type UpdateListener = (model: Model, options?: UpdateOptions) => HookReturn; export type UpdateListener = (model: Model, options?: UpdateOptions) => HookReturn;
``` ```
**示例** **Example**
```ts ```ts
db.on('beforeUpdate', async (model, options) => { db.on('beforeUpdate', async (model, options) => {
@ -929,15 +929,15 @@ db.on('books.afterUpdate', async (model, options) => {
### `'beforeSave'` / `'afterSave'` ### `'beforeSave'` / `'afterSave'`
创建或更新一条数据前后会触发对应事件,当调用 `repository.create()``repository.update()` 时会触发。 Events triggered before or after creating or updating one piece of data. This is triggered when `repository.create()` or `repository.update()` is called.
**签名** **Signature**
```ts ```ts
on(eventName: `${string}.beforeSave` | 'beforeSave' | `${string}.afterSave` | 'afterSave', listener: SaveListener): this on(eventName: `${string}.beforeSave` | 'beforeSave' | `${string}.afterSave` | 'afterSave', listener: SaveListener): this
``` ```
**类型** **Type**
```ts ```ts
import type { SaveOptions, HookReturn } from 'sequelize/types'; import type { SaveOptions, HookReturn } from 'sequelize/types';
@ -946,7 +946,7 @@ import type { Model } from '@nocobase/database';
export type SaveListener = (model: Model, options?: SaveOptions) => HookReturn; export type SaveListener = (model: Model, options?: SaveOptions) => HookReturn;
``` ```
**示例** **Example**
```ts ```ts
db.on('beforeSave', async (model, options) => { db.on('beforeSave', async (model, options) => {
@ -960,15 +960,15 @@ db.on('books.afterSave', async (model, options) => {
### `'beforeDestroy'` / `'afterDestroy'` ### `'beforeDestroy'` / `'afterDestroy'`
删除一条数据前后会触发对应事件,当调用 `repository.destroy()` 时会触发。 Events triggered before or after deleting one piece of data. This is triggered when `repository.destroy()` is called.
**签名** **Signature**
```ts ```ts
on(eventName: `${string}.beforeDestroy` | 'beforeDestroy' | `${string}.afterDestroy` | 'afterDestroy', listener: DestroyListener): this on(eventName: `${string}.beforeDestroy` | 'beforeDestroy' | `${string}.afterDestroy` | 'afterDestroy', listener: DestroyListener): this
``` ```
**类型** **Type**
```ts ```ts
import type { DestroyOptions, HookReturn } from 'sequelize/types'; import type { DestroyOptions, HookReturn } from 'sequelize/types';
@ -977,7 +977,7 @@ import type { Model } from '@nocobase/database';
export type DestroyListener = (model: Model, options?: DestroyOptions) => HookReturn; export type DestroyListener = (model: Model, options?: DestroyOptions) => HookReturn;
``` ```
**示例** **Example**
```ts ```ts
db.on('beforeDestroy', async (model, options) => { db.on('beforeDestroy', async (model, options) => {
@ -991,15 +991,15 @@ db.on('books.afterDestroy', async (model, options) => {
### `'afterCreateWithAssociations'` ### `'afterCreateWithAssociations'`
创建一条携带层级关系数据的数据之后会触发对应事件,当调用 `repository.create()` 时会触发。 Events triggered after creating one piece of data that carries hierarchical data. This is triggered when `repository.create()` is called.
**签名** **Signature**
```ts ```ts
on(eventName: `${string}.afterCreateWithAssociations` | 'afterCreateWithAssociations', listener: CreateWithAssociationsListener): this on(eventName: `${string}.afterCreateWithAssociations` | 'afterCreateWithAssociations', listener: CreateWithAssociationsListener): this
``` ```
**类型** **Type**
```ts ```ts
import type { CreateOptions, HookReturn } from 'sequelize/types'; import type { CreateOptions, HookReturn } from 'sequelize/types';
@ -1008,7 +1008,7 @@ import type { Model } from '@nocobase/database';
export type CreateWithAssociationsListener = (model: Model, options?: CreateOptions) => HookReturn; export type CreateWithAssociationsListener = (model: Model, options?: CreateOptions) => HookReturn;
``` ```
**示例** **Example**
```ts ```ts
db.on('afterCreateWithAssociations', async (model, options) => { db.on('afterCreateWithAssociations', async (model, options) => {
@ -1022,15 +1022,15 @@ db.on('books.afterCreateWithAssociations', async (model, options) => {
### `'afterUpdateWithAssociations'` ### `'afterUpdateWithAssociations'`
更新一条携带层级关系数据的数据之后会触发对应事件,当调用 `repository.update()` 时会触发。 Events triggered after updating one piece of data that carries hierarchical data. This is triggered when `repository.update()` is called.
**签名** **Signature**
```ts ```ts
on(eventName: `${string}.afterUpdateWithAssociations` | 'afterUpdateWithAssociations', listener: CreateWithAssociationsListener): this on(eventName: `${string}.afterUpdateWithAssociations` | 'afterUpdateWithAssociations', listener: CreateWithAssociationsListener): this
``` ```
**类型** **Type**
```ts ```ts
import type { UpdateOptions, HookReturn } from 'sequelize/types'; import type { UpdateOptions, HookReturn } from 'sequelize/types';
@ -1039,7 +1039,7 @@ import type { Model } from '@nocobase/database';
export type UpdateWithAssociationsListener = (model: Model, options?: UpdateOptions) => HookReturn; export type UpdateWithAssociationsListener = (model: Model, options?: UpdateOptions) => HookReturn;
``` ```
**示例** **Example**
```ts ```ts
db.on('afterUpdateWithAssociations', async (model, options) => { db.on('afterUpdateWithAssociations', async (model, options) => {
@ -1053,15 +1053,15 @@ db.on('books.afterUpdateWithAssociations', async (model, options) => {
### `'afterSaveWithAssociations'` ### `'afterSaveWithAssociations'`
创建或更新一条携带层级关系数据的数据之后会触发对应事件,当调用 `repository.create()``repository.update()` 时会触发。 Events triggered after creating or updating one piece of data that carries hierarchical data. This is triggered when `repository.create()` or `repository.update()` is called.
**签名** **Signature**
```ts ```ts
on(eventName: `${string}.afterSaveWithAssociations` | 'afterSaveWithAssociations', listener: SaveWithAssociationsListener): this on(eventName: `${string}.afterSaveWithAssociations` | 'afterSaveWithAssociations', listener: SaveWithAssociationsListener): this
``` ```
**类型** **Type**
```ts ```ts
import type { SaveOptions, HookReturn } from 'sequelize/types'; import type { SaveOptions, HookReturn } from 'sequelize/types';
@ -1070,7 +1070,7 @@ import type { Model } from '@nocobase/database';
export type SaveWithAssociationsListener = (model: Model, options?: SaveOptions) => HookReturn; export type SaveWithAssociationsListener = (model: Model, options?: SaveOptions) => HookReturn;
``` ```
**示例** **Example**
```ts ```ts
db.on('afterSaveWithAssociations', async (model, options) => { db.on('afterSaveWithAssociations', async (model, options) => {
@ -1084,17 +1084,17 @@ db.on('books.afterSaveWithAssociations', async (model, options) => {
### `'beforeDefineCollection'` ### `'beforeDefineCollection'`
当定义一个数据表之前触发,如调用 `db.collection()` 时。 Events triggered before defining a data table, such as when `db.collection()` is called.
注:该事件是同步事件。 Note: This is a synchronous event.
**签名** **Signature**
```ts ```ts
on(eventName: 'beforeDefineCollection', listener: BeforeDefineCollectionListener): this on(eventName: 'beforeDefineCollection', listener: BeforeDefineCollectionListener): this
``` ```
**类型** **Type**
```ts ```ts
import type { CollectionOptions } from '@nocobase/database'; import type { CollectionOptions } from '@nocobase/database';
@ -1102,7 +1102,7 @@ import type { CollectionOptions } from '@nocobase/database';
export type BeforeDefineCollectionListener = (options: CollectionOptions) => void; export type BeforeDefineCollectionListener = (options: CollectionOptions) => void;
``` ```
**示例** **Example**
```ts ```ts
db.on('beforeDefineCollection', (options) => { db.on('beforeDefineCollection', (options) => {
@ -1112,17 +1112,17 @@ db.on('beforeDefineCollection', (options) => {
### `'afterDefineCollection'` ### `'afterDefineCollection'`
当定义一个数据表之后触发,如调用 `db.collection()` 时。 Events triggered after defining a data table, such as when `db.collection()` is called.
注:该事件是同步事件。 Note: This is a synchronous event.
**签名** **Signature**
```ts ```ts
on(eventName: 'afterDefineCollection', listener: AfterDefineCollectionListener): this on(eventName: 'afterDefineCollection', listener: AfterDefineCollectionListener): this
``` ```
**类型** **Type**
```ts ```ts
import type { Collection } from '@nocobase/database'; import type { Collection } from '@nocobase/database';
@ -1130,7 +1130,7 @@ import type { Collection } from '@nocobase/database';
export type AfterDefineCollectionListener = (options: Collection) => void; export type AfterDefineCollectionListener = (options: Collection) => void;
``` ```
**示例** **Example**
```ts ```ts
db.on('afterDefineCollection', (collection) => { db.on('afterDefineCollection', (collection) => {
@ -1140,17 +1140,17 @@ db.on('afterDefineCollection', (collection) => {
### `'beforeRemoveCollection'` / `'afterRemoveCollection'` ### `'beforeRemoveCollection'` / `'afterRemoveCollection'`
当从内存中移除一个数据表前后触发,如调用 `db.removeCollection()` 时。 Events triggered before or after removing a data table from memory, such as when `db.removeCollection()` is called.
注:该事件是同步事件。 Note: This is a synchronous event.
**签名** **Signature**
```ts ```ts
on(eventName: 'beforeRemoveCollection' | 'afterRemoveCollection', listener: RemoveCollectionListener): this on(eventName: 'beforeRemoveCollection' | 'afterRemoveCollection', listener: RemoveCollectionListener): this
``` ```
**类型** **Type**
```ts ```ts
import type { Collection } from '@nocobase/database'; import type { Collection } from '@nocobase/database';
@ -1158,7 +1158,7 @@ import type { Collection } from '@nocobase/database';
export type RemoveCollectionListener = (options: Collection) => void; export type RemoveCollectionListener = (options: Collection) => void;
``` ```
**示例** **Example**
```ts ```ts
db.on('beforeRemoveCollection', (collection) => { db.on('beforeRemoveCollection', (collection) => {

View File

@ -1,8 +1,8 @@
# Repository # Repository
## 概览 ## Overview
在一个给定的 `Collection` 对象上,可以获取到它的 `Repository` 对象来对数据表进行读写操作。 On a given `Collection` object, you can get its `Repository` object to perform read and write operations on the data table.
```javascript ```javascript
const { UserCollection } = require("./collections"); const { UserCollection } = require("./collections");
@ -19,11 +19,11 @@ user.name = "new name";
await user.save(); await user.save();
``` ```
### 查询 ### Query
#### 基础查询 #### Basic Query
`Repository` 对象上,调用 `find*` 相关方法,可执行查询操作,查询方法都支持传入 `filter` 参数,用于过滤数据。 On the `Repository` object, call the `find*` methods to perform query. The `filter` parameter is supported by all query methods to filter the data.
```javascript ```javascript
// SELECT * FROM users WHERE id = 1 // SELECT * FROM users WHERE id = 1
@ -34,9 +34,9 @@ userRepository.find({
}); });
``` ```
#### 操作符 #### Operator
`Repository` 中的 `filter` 参数,还提供了多种操作符,执行更加多样的查询操作。 The `filter` parameter in the `Repository` also provides a variety of operators to perform more diverse queries.
```javascript ```javascript
// SELECT * FROM users WHERE age > 18 // SELECT * FROM users WHERE age > 18
@ -60,39 +60,39 @@ userRepository.find({
``` ```
操作符的更多详细信息请参考 [Filter Operators](/api/database/operators)。 Refer to [Filter Operators](/api/database/operators) for more details on operators.
#### 字段控制 #### Field Control
在查询操作时,通过 `fields`, `except`, `appends` 参数可以控制输出字段。 Control the output fields by the `fields`, `except`, and `appends` parameters when performing query.
* `fields`: 指定输出字段 * `fields`: Specify output fields
* `except`: 排除输出字段 * `except`: Exclude output fields
* `appends`: 追加输出关联字段 * `appends`: Append output associated fields
```javascript ```javascript
// 获取的结果只包含 id 和 name 字段 // The result contains only the <i>id</i> and <i>name</i> fields
userRepository.find({ userRepository.find({
fields: ["id", "name"], fields: ["id", "name"],
}); });
// 获取的结果不包含 password 字段 // The result does not contain only the <i>password</i> field
userRepository.find({ userRepository.find({
except: ["password"], except: ["password"],
}); });
// 获取的结果会包含关联对象 posts 的数据 // The result contains data associated with the <i>posts</i> object
userRepository.find({ userRepository.find({
appends: ["posts"], appends: ["posts"],
}); });
``` ```
#### 关联字段查询 #### Associated Field Query
`filter` 参数支持按关联字段进行过滤,例如: The `filter` parameter supports filtering by associated fields, for example:
```javascript ```javascript
// 查询 user 对象,其所关联的 posts 存在 title 为 'title1' 的对象 // Find the <i>user</i> objects whose associated posts have title of "post title"
userRepository.find({ userRepository.find({
filter: { filter: {
"posts.title": "post title" "posts.title": "post title"
@ -100,10 +100,10 @@ userRepository.find({
}); });
``` ```
关联字段也可进行嵌套 Associated fields can also be nested:
```javascript ```javascript
// 查询 user 对象,查询结果满足其 posts 的 comments 包含 keywords // Find the <i>user</i> objects whose associated posts have comments containing "keywords"
await userRepository.find({ await userRepository.find({
filter: { filter: {
"posts.comments.content": { "posts.comments.content": {
@ -113,9 +113,9 @@ await userRepository.find({
}); });
``` ```
#### 排序 #### Sort
通过 `sort` 参数,可以对查询结果进行排序。 Sort query results by the `sort` parameter.
```javascript ```javascript
@ -136,7 +136,7 @@ await userRepository.find({
}); });
``` ```
也可按照关联对象的字段进行排序 Sort by the field of the associated object is also supported:
```javascript ```javascript
await userRepository.find({ await userRepository.find({
@ -144,38 +144,38 @@ await userRepository.find({
}); });
``` ```
### 创建 ### Create
#### 基础创建 #### Basic Create
通过 `Repository` 创建新的数据对象。 Create new data objects via `Repository`.
```javascript ```javascript
await userRepository.create({ await userRepository.create({
name: "张三", name: "Mark",
age: 18, age: 18,
}); });
// INSERT INTO users (name, age) VALUES ('张三', 18) // INSERT INTO users (name, age) VALUES ('Mark', 18)
// 支持批量创建 // Bulk creation
await userRepository.create([ await userRepository.create([
{ {
name: "张三", name: "Mark",
age: 18, age: 18,
}, },
{ {
name: "李四", name: "Alex",
age: 20, age: 20,
}, },
]) ])
``` ```
#### 创建关联 #### Create Association
创建时可以同时创建关联对象,和查询类似,也支持关联对象的嵌套使用,例如: Create associated objects at the same time of creating data. Similar to query, nested use of associated objects is also supported. For example:
```javascript ```javascript
await userRepository.create({ await userRepository.create({
@ -196,9 +196,10 @@ await userRepository.create({
}, },
], ],
}); });
// 创建用户的同时,创建 post 与用户关联,创建 tags 与 post 相关联。 // When crearing a user, creat a post to associate with the user, and create tags to associate with the post
``` ```
若关联对象已在数据库中可传入其ID创建时会建立与关联对象的关联关系。
If the associated object is already in the database, you can pass its ID to create an association with it.
```javascript ```javascript
const tag1 = await tagRepository.findOne({ const tag1 = await tagRepository.findOne({
@ -208,7 +209,7 @@ const tag1 = await tagRepository.findOne({
}); });
await userRepository.create({ await userRepository.create({
name: "张三", name: "Mark",
age: 18, age: 18,
posts: [ posts: [
{ {
@ -216,7 +217,7 @@ await userRepository.create({
content: "post content", content: "post content",
tags: [ tags: [
{ {
id: tag1.id, // 建立与已存在关联对象的关联关系 id: tag1.id, // Create an association with an existing associated object
}, },
{ {
name: "tag2", name: "tag2",
@ -227,16 +228,16 @@ await userRepository.create({
}); });
``` ```
### 更新 ### Update
#### 基础更新 #### Basic Update
获取到数据对象后,可直接在数据对象(`Model`)上修改属性,然后调用 `save` 方法保存修改。 After getting the data object, you can modify the properties directly on the data object (`Model`), and then call the `save` method to save the changes.
```javascript ```javascript
const user = await userRepository.findOne({ const user = await userRepository.findOne({
filter: { filter: {
name: "张三", name: "Mark",
}, },
}); });
@ -245,15 +246,15 @@ user.age = 20;
await user.save(); await user.save();
``` ```
数据对象 `Model` 继承自 Sequelize Model`Model` 的操作可参考 [Sequelize Model](https://sequelize.org/master/manual/model-basics.html)。 The data object `Model` is inherited from Sequelize Model, refer to [Sequelize Model](https://sequelize.org/master/manual/model-basics.html) for the operations on `Model`.
也可通过 `Repository` 更新数据: Or update data via `Repository`:
```javascript ```javascript
// 修改满足筛选条件的数据记录 // Update the records that meet the filtering condition
await userRepository.update({ await userRepository.update({
filter: { filter: {
name: "张三", name: "Mark",
}, },
values: { values: {
age: 20, age: 20,
@ -261,24 +262,24 @@ await userRepository.update({
}); });
``` ```
更新时,可以通过 `whitelist``blacklist` 参数控制更新字段,例如: Control which fields to update by the `whitelist` and `blacklist` parameters, for example:
```javascript ```javascript
await userRepository.update({ await userRepository.update({
filter: { filter: {
name: "张三", name: "Mark",
}, },
values: { values: {
age: 20, age: 20,
name: "李四", name: "Alex",
}, },
whitelist: ["age"], // 仅更新 age 字段 whitelist: ["age"], // Only update the <i>age</i> field
}); });
```` ````
#### 更新关联字段 #### Update Associated Field
在更新时,可以设置关联对象,例如: Associated objects can be set while updating, for example:
```javascript ```javascript
const tag1 = tagRepository.findOne({ const tag1 = tagRepository.findOne({
@ -295,10 +296,10 @@ await postRepository.update({
title: "new post title", title: "new post title",
tags: [ tags: [
{ {
id: tag1.id // 与 tag1 建立关联 id: tag1.id // Associate with tag1
}, },
{ {
name: "tag2", // 创建新的 tag 并建立关联 name: "tag2", // Create new tag and associate with it
}, },
], ],
}, },
@ -310,14 +311,14 @@ await postRepository.update({
id: 1 id: 1
}, },
values: { values: {
tags: null // 解除 post 与 tags 的关联 tags: null // Disassociate post from tags
}, },
}) })
``` ```
### 删除 ### Delete
可调用 `Repository` 中的 `destroy()`方法进行删除操作。删除时需指定筛选条件: Call the `destroy()` method in `Repository` to perform the deletion operation. Filtering condition has to be specified to delete.
```javascript ```javascript
await userRepository.destroy({ await userRepository.destroy({
@ -327,15 +328,15 @@ await userRepository.destroy({
}); });
``` ```
## 构造函数 ## Constructor
通常不会直接由开发者调用,主要通过 `db.registerRepositories()` 注册类型以后,在 `db.colletion()` 的参数中指定对应已注册的仓库类型,并完成实例化。 It is usually not called directly by the developer, the instantiation is done mainly by specifying a coressponding repository type that is already registered in the parameter of `db.colletion()`. Repository type is registered through `db.registerRepositories()`.
**签名** **Signature**
* `constructor(collection: Collection)` * `constructor(collection: Collection)`
**示例** **Example**
```ts ```ts
import { Repository } from '@nocobase/database'; import { Repository } from '@nocobase/database';
@ -362,7 +363,7 @@ const books = db.getRepository('books') as MyRepository;
await books.myQuery('SELECT * FROM books;'); await books.myQuery('SELECT * FROM books;');
``` ```
## 实例成员 ## Instance Member
### `database` ### `database`
@ -383,7 +384,7 @@ await books.myQuery('SELECT * FROM books;');
从数据库查询数据集,可指定筛选条件、排序等。 从数据库查询数据集,可指定筛选条件、排序等。
**签名** **Signature**
* `async find(options?: FindOptions): Promise<Model[]>` * `async find(options?: FindOptions): Promise<Model[]>`
@ -466,7 +467,7 @@ repository.find({
#### `offset: number` #### `offset: number`
查询偏移量,同 `SQL` 中的 `offset` 查询偏移量,同 `SQL` 中的 `offset`
**示例** **Example**
```ts ```ts
const posts = db.getRepository('posts'); const posts = db.getRepository('posts');
@ -486,13 +487,13 @@ const results = await posts.find({
从数据库查询特定条件的单条数据。相当于 Sequelize 中的 `Model.findOne()` 从数据库查询特定条件的单条数据。相当于 Sequelize 中的 `Model.findOne()`
**签名** **Signature**
* `async findOne(options?: FindOneOptions): Promise<Model | null>` * `async findOne(options?: FindOneOptions): Promise<Model | null>`
<embed src="./shared/find-one.md"></embed> <embed src="./shared/find-one.md"></embed>
**示例** **Example**
```ts ```ts
const posts = db.getRepository('posts'); const posts = db.getRepository('posts');
@ -506,7 +507,7 @@ const result = await posts.findOne({
从数据库查询特定条件的数据总数。相当于 Sequelize 中的 `Model.count()` 从数据库查询特定条件的数据总数。相当于 Sequelize 中的 `Model.count()`
**签名** **Signature**
* `count(options?: CountOptions): Promise<number>` * `count(options?: CountOptions): Promise<number>`
@ -517,7 +518,7 @@ interface CountOptions extends Omit<SequelizeCountOptions, 'distinct' | 'where'
} }
``` ```
**示例** **Example**
```ts ```ts
const books = db.getRepository('books'); const books = db.getRepository('books');
@ -534,7 +535,7 @@ const count = await books.count({
从数据库查询特定条件的数据集和结果数。相当于 Sequelize 中的 `Model.findAndCountAll()` 从数据库查询特定条件的数据集和结果数。相当于 Sequelize 中的 `Model.findAndCountAll()`
**签名** **Signature**
* `async findAndCount(options?: FindAndCountOptions): Promise<[Model[], number]>` * `async findAndCount(options?: FindAndCountOptions): Promise<[Model[], number]>`
@ -551,13 +552,13 @@ type FindAndCountOptions = Omit<SequelizeAndCountOptions, 'where' | 'include' |
向数据表插入一条新创建的数据。相当于 Sequelize 中的 `Model.create()`。当要创建的数据对象携带关系字段的信息时,会一并创建或更新相应的关系数据记录。 向数据表插入一条新创建的数据。相当于 Sequelize 中的 `Model.create()`。当要创建的数据对象携带关系字段的信息时,会一并创建或更新相应的关系数据记录。
**签名** **Signature**
* `async create<M extends Model>(options: CreateOptions): Promise<M>` * `async create<M extends Model>(options: CreateOptions): Promise<M>`
<embed src="./shared/create-options.md"></embed> <embed src="./shared/create-options.md"></embed>
**示例** **Example**
```ts ```ts
const posts = db.getRepository('posts'); const posts = db.getRepository('posts');
@ -579,7 +580,7 @@ const result = await posts.create({
向数据表插入多条新创建的数据。相当于多次调用 `create()` 方法。 向数据表插入多条新创建的数据。相当于多次调用 `create()` 方法。
**签名** **Signature**
* `createMany(options: CreateManyOptions): Promise<Model[]>` * `createMany(options: CreateManyOptions): Promise<Model[]>`
@ -595,7 +596,7 @@ interface CreateManyOptions extends BulkCreateOptions {
* `records`:要创建的记录的数据对象数组。 * `records`:要创建的记录的数据对象数组。
* `transaction`: 事务对象。如果没有传入事务参数,该方法会自动创建一个内部事务。 * `transaction`: 事务对象。如果没有传入事务参数,该方法会自动创建一个内部事务。
**示例** **Example**
```ts ```ts
const posts = db.getRepository('posts'); const posts = db.getRepository('posts');
@ -625,13 +626,13 @@ const results = await posts.createMany({
更新数据表中的数据。相当于 Sequelize 中的 `Model.update()`。当要更新的数据对象携带关系字段的信息时,会一并创建或更新相应的关系数据记录。 更新数据表中的数据。相当于 Sequelize 中的 `Model.update()`。当要更新的数据对象携带关系字段的信息时,会一并创建或更新相应的关系数据记录。
**签名** **Signature**
* `async update<M extends Model>(options: UpdateOptions): Promise<M>` * `async update<M extends Model>(options: UpdateOptions): Promise<M>`
<embed src="./shared/update-options.md"></embed> <embed src="./shared/update-options.md"></embed>
**示例** **Example**
```ts ```ts
const posts = db.getRepository('posts'); const posts = db.getRepository('posts');
@ -654,7 +655,7 @@ const result = await posts.update({
删除数据表中的数据。相当于 Sequelize 中的 `Model.destroy()` 删除数据表中的数据。相当于 Sequelize 中的 `Model.destroy()`
**签名** **Signature**
* `async destory(options?: TargetKey | TargetKey[] | DestoryOptions): Promise<number>` * `async destory(options?: TargetKey | TargetKey[] | DestoryOptions): Promise<number>`
@ -675,3 +676,4 @@ interface DestroyOptions extends SequelizeDestroyOptions {
* `filterByTk`:按 TargetKey 指定要删除的记录的过滤条件。 * `filterByTk`:按 TargetKey 指定要删除的记录的过滤条件。
* `truncate`: 是否清空表数据,在没有传入 `filter``filterByTk` 参数时有效。 * `truncate`: 是否清空表数据,在没有传入 `filter``filterByTk` 参数时有效。
* `transaction`: 事务对象。如果没有传入事务参数,该方法会自动创建一个内部事务。 * `transaction`: 事务对象。如果没有传入事务参数,该方法会自动创建一个内部事务。
![image](https://user-images.githubusercontent.com/63629092/213859493-1eb7eb5b-0368-41e8-8fb5-d0d735afd429.png)

View File

@ -22,7 +22,7 @@ hello@nocobase.com
## Features ## Features
- **Open source and free** - **Open source and free**
- Unrestricted commercial use under the Apache-2.0 license - Apache-2.0 & AGPL-3.0 licensed
- Full code ownership, private deployment, private and secure data - Full code ownership, private deployment, private and secure data
- Free to expand and develop for actual needs - Free to expand and develop for actual needs
- Good ecological support - Good ecological support
@ -48,3 +48,7 @@ hello@nocobase.com
![](https://www.nocobase.com/images/NocoBaseMindMapLite.png) ![](https://www.nocobase.com/images/NocoBaseMindMapLite.png)
[Click here to view the full image](https://www.nocobase.com/images/NocoBaseMindMap.png) [Click here to view the full image](https://www.nocobase.com/images/NocoBaseMindMap.png)
## Business Services
If you need commercial version and commercial services, please feel free to contact us by email: hello@nocobase.com

View File

@ -1,4 +1,4 @@
# v0.8.1: Collection 模板 # v0.9.0: Collection 模板
<img src="./v08-1-collection-templates/v08-1-collection-templates.jpg"> <img src="./v08-1-collection-templates/v08-1-collection-templates.jpg">

View File

@ -0,0 +1,33 @@
# v0.9.0:字段的计算公式插件
NocoBase 目前提供了两种计算公式插件:
- `@nocobase/plugin-math-formula-field` Math 公式
- `@nocobase/plugin-excel-formula-field` Excel 公式(感谢 [azriel46d](https://github.com/nocobase/nocobase/pull/906) 贡献)
## Math Formula
基于 [Math.js](https://mathjs.org/) 实现,它具有支持符号计算的灵活表达式解析器,大量内置函数和常量,并提供了集成的解决方案来处理不同的数据类型,例如数字,大数,复数,分数,单位和矩阵。
```ts
import { evaluate } from 'mathjs';
// expressions
evaluate('1.2 * (2 + 4.5)') // 7.8
evaluate('12.7 cm to inch') // 5 inch
evaluate('sin(45 deg) ^ 2') // 0.5
evaluate('9 / 3 + 2i') // 3 + 2i
evaluate('det([-1, 2; 3, 1])') // -7
```
<img src="./formulas/math-form.jpg" />
## Excel Formula
基于 [Formula.js](https://formulajs.info/) 实现,详细用法参考 [Formula.js functions](https://formulajs.info/functions/)。
```ts
SUM(-5, 15, 32) // 42
IF(true, 'Hello!', 'Goodbye!') // Hello!
```
<img src="./formulas/excel-form.jpg" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 307 KiB

View File

@ -1,5 +1,65 @@
# Release Notes # Release Notes
## 2023/01/11 ~v0.9.0-alpha.1
### License changes
- [Core](https://github.com/nocobase/nocobase/tree/main/packages/core) continue with [Apache 2.0](https://github.com/nocobase/nocobase/blob/main/LICENSE-APACHE-2.0)
- [Plugins](https://github.com/nocobase/nocobase/tree/main/packages/plugins) changed to [AGPL 3.0](https://github.com/nocobase/nocobase/blob/main/LICENSE-AGPL)
### Core improvements
- [Logging system for NocoBase](/welcome/release/logger)
- [Collection inheritance](/welcome/release/inherits)
- [Collection templates](/welcome/release/collection-templates)
- Primary key of collection is BigInt type by default
- Provide more robust ACL modules
- Association field component supports switching to a simple Select component
- Support page tabs
- Table & Kanban blocks support fixed model
- Provide more friendly association filtering
- Calendar block supports displaying lunar
- Calendar block supports configuration and deletion of duplicate schedules
- Table block horizontal scroll bar optimization, support adjust column width
- Configurable size of pop-up windows
### New plugins
- Data import
- Graphical interface for collections
- SSO: OIDC, SAML
- Map
- Iframe block
- Data snapshot
- Duplicator: application duplication, backup, migration
- [Formula for fields: Math Formula and Excel Formula](/welcome/release/formulas)
### Other plugin optimizations
- Collection configuration
- Support for filtering
- Support for define the title field
- Support for classification
- Workflow
- Fix trigger fetching function
- Front-end refactoring and plugin independence
- Fix the execution history loading problem
- Optimize the execution process by no longer using the same transaction after the execution of the data table trigger
- New scheduler and trigger cache are added to solve the concurrency problem by queue execution
- Fix the problem of timed task end time component
- Fix the problem of timed task skipping seconds
- Support workflow-level duplication
- Refactor the data structure of context and node variables
- Captcha
- New captcha configuration panel
- Files Manager
- Fix local storage static file service middleware
- Local storage empty baseUrl configuration fault tolerance handling
- Auto Numbering
- Refactor to record sequence by data table
- Add configurations that can be entered and matched with rules
- Fix generating numbers not less than the configured starting value
## 2022/10/31 ~ v0.8.0-alpha.1 ## 2022/10/31 ~ v0.8.0-alpha.1
- Starting with v0.8, NocoBase begins to provide an available plugin manager and development documentation. - Starting with v0.8, NocoBase begins to provide an available plugin manager and development documentation.

View File

@ -0,0 +1,74 @@
# v0.9.0: 数据表继承
数据表继承基于 [PostgreSQL 的 INHERITS 语法](https://www.postgresql.org/docs/current/tutorial-inheritance.html) 实现,仅限于 PostgreSQL 数据库安装的 NocoBase 时才会提供。
## 示例
我们从一个例子开始,假设要做一个教学系统,有三类用户:学生、家长和老师。
如果没有继承,要分别为三类用户建表:
- 学生:姓名、年龄、性别、身份证
- 家长:姓名、年龄、性别、职业、学历
- 老师:姓名、年龄、性别、教龄、已婚
有了数据表继承之后,共同的信息就可以提炼出来:
- 用户:姓名、年龄、性别
- 学生:身份证
- 家长:职业、学历
- 老师:教龄、已婚
ER 图如下:
<img src="./inherits/er.svg" style="max-width: 700px;" />
注:子表 ID 和父表 ID 共享序列
## 配置数据表继承
Inherits 字段选择需要继承的数据表
<img src="./inherits/inherit.jpg" />
通过代码配置如下:
```ts
db.collection({
name: 'users',
});
db.collection({
name: 'students',
inherits: 'users',
});
```
注意:
- 继承的表并不能随意选择,主键必须是唯一序列,比如 uuid 或者所有继承线路上的表的 id 自增序列都用同一个
- Inherits 参数不能被编辑
- 如果有继承关系,被继承的父表不能被删除
## 数据表字段列表
字段列表里同步显示继承的父表字段父表字段不可以修改但可以重写Override
<img src="./inherits/inherit-fields.jpg" />
重写父表字段的注意事项:
- 子表字段标识与父表字段一样时为重写
- 重写字段的类型必须保持一致
- 关系字段除了 target collection 以外的其他参数需要保持一致
## 父表的子表区块
在父表区块里可以配置子表的区块
<img src="./inherits/inherited-blocks.jpg" />
## 新增继承的父表字段的配置
当有继承的父表时,配置字段时,会提供从父表继承的字段的配置
<img src="./inherits/configure-fields.jpg" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

View File

@ -1,4 +1,4 @@
# v0.8.1NocoBase 的 Logging 系统 # v0.9.0NocoBase 的 Logging 系统
## `@nocobase/logger` ## `@nocobase/logger`

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

View File

@ -200,7 +200,7 @@ await books.sync();
## 内置字段类型列表 ## 内置字段类型列表
NocoBase 内置了一些常用的字段类型,可以直接在定义数据表的字段使用对应的 type 名称来指定类型。不同类型的字段参数配置不同,具体可参考下面的列表。 NocoBase 内置了一些常用的字段类型,可以直接在定义数据表的字段使用对应的 type 名称来指定类型。不同类型的字段参数配置不同,具体可参考下面的列表。
所有字段类型的配置项除了以下额外介绍的以外,都会透传至 Sequelize所以所有 Sequelize 支持的字段配置项都可以在这里使用(如 `allowNull``defaultValue` 等)。 所有字段类型的配置项除了以下额外介绍的以外,都会透传至 Sequelize所以所有 Sequelize 支持的字段配置项都可以在这里使用(如 `allowNull``defaultValue` 等)。

View File

@ -141,7 +141,7 @@ await UserRepository.destroy(user.id);
| 参数名 | 类型 | 默认值 | 描述 | | 参数名 | 类型 | 默认值 | 描述 |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| `options.name` | `string` | - | 迁移文件名称 | | `options.name` | `string` | - | 迁移文件名称 |
| `options.context?` | `string` | - | 迁移文件的 `up` 方法 | | `options.context?` | `string` | - | 迁移文件的上下文 |
| `options.migration?` | `typeof Migration` | - | 迁移文件的自定义类 | | `options.migration?` | `typeof Migration` | - | 迁移文件的自定义类 |
| `options.up` | `Function` | - | 迁移文件的 `up` 方法 | | `options.up` | `Function` | - | 迁移文件的 `up` 方法 |
| `options.down` | `Function` | - | 迁移文件的 `down` 方法 | | `options.down` | `Function` | - | 迁移文件的 `down` 方法 |
@ -575,6 +575,8 @@ asset(post1.authorId === author1.id); // true
* `off(name: string, listener: Function)` * `off(name: string, listener: Function)`
**参数**
| 参数名 | 类型 | 默认值 | 描述 | | 参数名 | 类型 | 默认值 | 描述 |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| name | string | - | 事件名称 | | name | string | - | 事件名称 |

View File

@ -92,7 +92,7 @@ userRepository.find({
`filter` 参数支持按关联字段进行过滤,例如: `filter` 参数支持按关联字段进行过滤,例如:
```javascript ```javascript
// 查询 user 对象,其所关联的 posts 存在 title 为 'title1' 的对象 // 查询 user 对象,其所关联的 posts 存在 title 为 'post title' 的对象
userRepository.find({ userRepository.find({
filter: { filter: {
"posts.title": "post title" "posts.title": "post title"

View File

@ -18,7 +18,7 @@ NocoBase 是一个极易扩展的开源无代码开发平台。
## 为什么选择 NocoBase ## 为什么选择 NocoBase
- **开源,自主可控** - **开源,自主可控**
- 采用 Apache-2.0 许可协议,不限制商业使用 - 采用 Apache-2.0 & AGPL-3.0 许可协议
- 拥有全部代码,私有化部署,保障数据私有和安全 - 拥有全部代码,私有化部署,保障数据私有和安全
- 针对实际需求自由扩展开发 - 针对实际需求自由扩展开发
- 具备良好的生态支持 - 具备良好的生态支持
@ -46,9 +46,9 @@ NocoBase 是一个极易扩展的开源无代码开发平台。
[点此查看完整图片](https://www.nocobase.com/images/NocoBaseMindMap.png) [点此查看完整图片](https://www.nocobase.com/images/NocoBaseMindMap.png)
## 联系 ## 商业服务
如果你希望加入我们一起开发 NocoBase或者需要提供商业服务欢迎通过邮件联系我们hello@nocobase.com 如果你需要商业版本和商业服务欢迎通过邮件联系我们hello@nocobase.com
或者添加我们的微信: 或者添加我们的微信:

View File

@ -0,0 +1,79 @@
# v0.9.0: Collection 模板
<img src="./v08-1-collection-templates/v08-1-collection-templates.jpg">
## 为什么需要 Collection 模板?
待补充
## 配置参数说明
```ts
interface ICollectionTemplate {
name: string;
title?: string;
/** 排序 */
order?: number;
/** 默认配置 */
default?: CollectionOptions;
/** UI 可配置的 CollectionOptions 参数(添加或编辑的 Collection 表单的字段) */
configurableProperties?: Record<string, ISchema>;
/** 当前模板可用的字段类型 */
availableFieldInterfaces?: AvailableFieldInterfacesInclude | AvailableFieldInterfacesExclude;
}
interface AvailableFieldInterfacesInclude {
include?: any[];
}
interface AvailableFieldInterfacesExclude {
exclude?: any[];
}
interface CollectionOptions {
/**
* 自动生成 id
* @default true
* */
autoGenId?: boolean;
/** 创建人 */
createdBy?: boolean;
/** 最后更新人 */
updatedBy?: boolean;
/** 创建日期 */
createdAt?: boolean;
/** 更新日期 */
updatedAt?: boolean;
/** 可排序 */
sortable?: boolean;
/* 树结构 */
tree?: string;
/* 日志 */
logging?: boolean;
/** 继承 */
inherits: string | string[];
/* 字段列表 */
fields?: FieldOptions[];
}
```
## 示例
创建时都不需要 autoGenId并且只提供 title 和 name 配置项
```ts
import { collectionConfigurableProperties } from '@nocobase/client';
{
default: {
autoGenId: false,
fields: [],
},
configurableProperties: {
...collectionConfigurableProperties('name', 'title'),
},
}
```
完整插件示例参考:[samples/custom-collection-template](https://github.com/nocobase/nocobase/tree/feat/collection-templates/packages/samples/custom-collection-template)

View File

@ -1,4 +1,4 @@
# v0.8.1:字段的计算公式插件 # v0.9.0:字段的计算公式插件
NocoBase 目前提供了两种计算公式插件: NocoBase 目前提供了两种计算公式插件:

View File

@ -1,5 +1,65 @@
# 更新日志 # 更新日志
## 2023/01/11 ~v0.9.0-alpha.1
### 协议变更
- [内核](https://github.com/nocobase/nocobase/tree/main/packages/core) 继续采用 [Apache 2.0 协议](https://github.com/nocobase/nocobase/blob/main/LICENSE-APACHE-2.0)
- [插件](https://github.com/nocobase/nocobase/tree/main/packages/plugins) 变更为 [AGPL 3.0 协议](https://github.com/nocobase/nocobase/blob/main/LICENSE-AGPL)
### 内核改进
- [NocoBase 的 Logging 系统](/welcome/release/logger)
- [数据表继承](/welcome/release/inherits)
- [数据表模板](/welcome/release/collection-templates)
- 数据表主键默认为 BigInt 类型
- 提供更健全的 ACL 模块
- 关系字段组件支持切换为简单的 Select 组件
- 支持页面标签页
- 表格、看板支持固定区块
- 提供更为友好的关系筛选
- 日历区块支持显示农历
- 日历区块支持配置、删除重复日程
- 表格区块横向滚动条优化,支持调整列宽
- 弹窗可配置尺寸大小
### 新增插件
- Excel 数据导入插件
- 图形化数据表配置插件
- SSO 插件OIDC、SAML
- 地图插件
- iframe 区块插件
- 数据快照插件
- 应用复制、备份、迁移插件
- [字段的计算公式插件Math Formula 和 Excel Formula](/welcome/release/formulas)
### 其他插件优化
- 数据表配置:
- 数据表支持筛选
- 数据表支持设置标题字段
- 数据表支持分类
- 工作流:
- 修复触发器取值功能
- 前端代码重构,插件独立化
- 修复执行历史加载问题
- 数据表触发后执行不再使用相同事务,优化执行流程
- 新增调度器和触发缓存,以队列执行方式解决并发问题
- 修复定时任务结束时间组件问题
- 修复定时任务跳秒问题
- 支持工作流级别复制
- 重构上下文及节点变量数据结构
- 验证码:
- 新增验证码配置面板
- 文件管理器:
- 修复本地存储静态文件服务中间件
- 本地存储空 baseUrl 配置容错处理
- 自动编号:
- 重构为由数据表记录序列
- 增加可输入和匹配规则的配置
- 修复生成数字不小于配置的起始值
## 2022/10/31 ~ v0.8.0-alpha.1 ## 2022/10/31 ~ v0.8.0-alpha.1
- 从 v0.8 开始NocoBase 开始提供可用的插件管理器和开发文档。[查看 v0.8 的主要变化](/welcome/release/v08-changelog) - 从 v0.8 开始NocoBase 开始提供可用的插件管理器和开发文档。[查看 v0.8 的主要变化](/welcome/release/v08-changelog)

View File

@ -1,4 +1,4 @@
# v0.8.1: 数据表继承 # v0.9.0: 数据表继承
数据表继承基于 [PostgreSQL 的 INHERITS 语法](https://www.postgresql.org/docs/current/tutorial-inheritance.html) 实现,仅限于 PostgreSQL 数据库安装的 NocoBase 时才会提供。 数据表继承基于 [PostgreSQL 的 INHERITS 语法](https://www.postgresql.org/docs/current/tutorial-inheritance.html) 实现,仅限于 PostgreSQL 数据库安装的 NocoBase 时才会提供。

View File

@ -1,4 +1,4 @@
# v0.8.1NocoBase 的 Logging 系统 # v0.9.0NocoBase 的 Logging 系统
## `@nocobase/logger` ## `@nocobase/logger`

View File

@ -1,5 +1,5 @@
{ {
"version": "0.8.1-alpha.4", "version": "0.9.0-alpha.2",
"npmClient": "yarn", "npmClient": "yarn",
"useWorkspaces": true, "useWorkspaces": true,
"npmClientArgs": [ "npmClientArgs": [

View File

@ -18,4 +18,3 @@
/src/.umi-production /src/.umi-production
/src/.umi-test /src/.umi-test
/.env.local /.env.local
src/plugins/graph-collection-manager.ts

661
packages/app/client/LICENSE Normal file
View File

@ -0,0 +1,661 @@
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
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.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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 <https://www.gnu.org/licenses/>.
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
<https://www.gnu.org/licenses/>.

View File

@ -1,9 +1,9 @@
{ {
"name": "@nocobase/app-client", "name": "@nocobase/app-client",
"version": "0.8.1-alpha.4", "version": "0.9.0-alpha.2",
"license": "MIT", "license": "AGPL-3.0",
"devDependencies": { "devDependencies": {
"@nocobase/client": "0.8.1-alpha.4" "@nocobase/client": "0.9.0-alpha.2"
}, },
"repository": { "repository": {
"type": "git", "type": "git",

View File

@ -0,0 +1 @@
export { default } from '@nocobase/plugin-graph-collection-manager/client';

661
packages/app/server/LICENSE Normal file
View File

@ -0,0 +1,661 @@
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
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.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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 <https://www.gnu.org/licenses/>.
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
<https://www.gnu.org/licenses/>.

View File

@ -1,12 +1,12 @@
{ {
"name": "@nocobase/app-server", "name": "@nocobase/app-server",
"version": "0.8.1-alpha.4", "version": "0.9.0-alpha.2",
"description": "", "description": "",
"license": "MIT", "license": "AGPL-3.0",
"main": "./lib/index.js", "main": "./lib/index.js",
"types": "./lib/index.d.ts", "types": "./lib/index.d.ts",
"dependencies": { "dependencies": {
"@nocobase/preset-nocobase": "0.8.1-alpha.4" "@nocobase/preset-nocobase": "0.9.0-alpha.2"
}, },
"repository": { "repository": {
"type": "git", "type": "git",

201
packages/core/acl/LICENSE Normal file
View File

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -1,19 +1,13 @@
{ {
"name": "@nocobase/acl", "name": "@nocobase/acl",
"version": "0.8.1-alpha.4", "version": "0.9.0-alpha.2",
"description": "", "description": "",
"license": "Apache-2.0", "license": "Apache-2.0",
"licenses": [
{
"type": "Apache-2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0"
}
],
"main": "./lib/index.js", "main": "./lib/index.js",
"types": "./lib/index.d.ts", "types": "./lib/index.d.ts",
"dependencies": { "dependencies": {
"@nocobase/resourcer": "0.8.1-alpha.4", "@nocobase/resourcer": "0.9.0-alpha.2",
"@nocobase/utils": "0.8.1-alpha.4", "@nocobase/utils": "0.9.0-alpha.2",
"json-templates": "^4.2.0", "json-templates": "^4.2.0",
"minimatch": "^5.1.1" "minimatch": "^5.1.1"
}, },

View File

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -1,20 +1,14 @@
{ {
"name": "@nocobase/actions", "name": "@nocobase/actions",
"version": "0.8.1-alpha.4", "version": "0.9.0-alpha.2",
"description": "", "description": "",
"license": "Apache-2.0", "license": "Apache-2.0",
"licenses": [
{
"type": "Apache-2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0"
}
],
"main": "./lib/index.js", "main": "./lib/index.js",
"types": "./lib/index.d.ts", "types": "./lib/index.d.ts",
"dependencies": { "dependencies": {
"@nocobase/cache": "0.8.1-alpha.4", "@nocobase/cache": "0.9.0-alpha.2",
"@nocobase/database": "0.8.1-alpha.4", "@nocobase/database": "0.9.0-alpha.2",
"@nocobase/resourcer": "0.8.1-alpha.4" "@nocobase/resourcer": "0.9.0-alpha.2"
}, },
"repository": { "repository": {
"type": "git", "type": "git",

201
packages/core/build/LICENSE Normal file
View File

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -1,6 +1,6 @@
{ {
"name": "@nocobase/build", "name": "@nocobase/build",
"version": "0.8.1-alpha.4", "version": "0.9.0-alpha.2",
"description": "Library build tool based on rollup.", "description": "Library build tool based on rollup.",
"main": "lib/index.js", "main": "lib/index.js",
"bin": { "bin": {
@ -66,7 +66,7 @@
"vinyl-fs": "3.0.3", "vinyl-fs": "3.0.3",
"yargs-parser": "13.1.2" "yargs-parser": "13.1.2"
}, },
"license": "MIT", "license": "Apache-2.0",
"scripts": { "scripts": {
"build": "umi-tools build" "build": "umi-tools build"
}, },

201
packages/core/cache/LICENSE vendored Normal file
View File

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -1,14 +1,8 @@
{ {
"name": "@nocobase/cache", "name": "@nocobase/cache",
"version": "0.8.1-alpha.4", "version": "0.9.0-alpha.2",
"description": "", "description": "",
"license": "Apache-2.0", "license": "Apache-2.0",
"licenses": [
{
"type": "Apache-2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0"
}
],
"main": "./lib/index.js", "main": "./lib/index.js",
"types": "./lib/index.d.ts", "types": "./lib/index.d.ts",
"dependencies": { "dependencies": {

201
packages/core/cli/LICENSE Normal file
View File

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -1,14 +1,8 @@
{ {
"name": "@nocobase/cli", "name": "@nocobase/cli",
"version": "0.8.1-alpha.4", "version": "0.9.0-alpha.2",
"description": "", "description": "",
"license": "Apache-2.0", "license": "Apache-2.0",
"licenses": [
{
"type": "Apache-2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0"
}
],
"main": "./src/index.js", "main": "./src/index.js",
"bin": { "bin": {
"nocobase": "./bin/index.js" "nocobase": "./bin/index.js"
@ -23,7 +17,7 @@
"serve": "^13.0.2" "serve": "^13.0.2"
}, },
"devDependencies": { "devDependencies": {
"@nocobase/devtools": "0.8.1-alpha.4" "@nocobase/devtools": "0.9.0-alpha.2"
}, },
"repository": { "repository": {
"type": "git", "type": "git",

View File

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -1,13 +1,7 @@
{ {
"name": "@nocobase/client", "name": "@nocobase/client",
"version": "0.8.1-alpha.4", "version": "0.9.0-alpha.2",
"license": "Apache-2.0", "license": "Apache-2.0",
"licenses": [
{
"type": "Apache-2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0"
}
],
"main": "lib", "main": "lib",
"module": "es/index.js", "module": "es/index.js",
"typings": "es/index.d.ts", "typings": "es/index.d.ts",
@ -19,8 +13,8 @@
"@formily/antd": "2.0.20", "@formily/antd": "2.0.20",
"@formily/core": "2.0.20", "@formily/core": "2.0.20",
"@formily/react": "2.0.20", "@formily/react": "2.0.20",
"@nocobase/sdk": "0.8.1-alpha.4", "@nocobase/sdk": "0.9.0-alpha.2",
"@nocobase/utils": "0.8.1-alpha.4", "@nocobase/utils": "0.9.0-alpha.2",
"ahooks": "^3.7.2", "ahooks": "^3.7.2",
"antd": "4.22.8", "antd": "4.22.8",
"axios": "^0.26.1", "axios": "^0.26.1",
@ -28,7 +22,8 @@
"cron-parser": "^4.6.0", "cron-parser": "^4.6.0",
"cronstrue": "^2.11.0", "cronstrue": "^2.11.0",
"file-saver": "^2.0.5", "file-saver": "^2.0.5",
"i18next": "^21.6.0", "i18next": "^22.4.9",
"i18next-http-backend": "^2.1.1",
"json-templates": "^4.2.0", "json-templates": "^4.2.0",
"marked": "^4.0.12", "marked": "^4.0.12",
"mathjs": "^10.6.0", "mathjs": "^10.6.0",

View File

@ -1,6 +1,7 @@
import { Schema, useFieldSchema } from '@formily/react'; import { Field } from '@formily/core';
import { Schema, useField, useFieldSchema } from '@formily/react';
import { Spin } from 'antd'; import { Spin } from 'antd';
import React, { createContext, useContext } from 'react'; import React, { createContext, useContext, useEffect } from 'react';
import { Redirect } from 'react-router-dom'; import { Redirect } from 'react-router-dom';
import { useAPIClient, useRequest } from '../api-client'; import { useAPIClient, useRequest } from '../api-client';
import { useBlockRequestContext } from '../block-provider/BlockProvider'; import { useBlockRequestContext } from '../block-provider/BlockProvider';
@ -251,6 +252,7 @@ export const useACLFieldWhitelist = () => {
export const ACLCollectionFieldProvider = (props) => { export const ACLCollectionFieldProvider = (props) => {
const fieldSchema = useFieldSchema(); const fieldSchema = useFieldSchema();
const field = useField<Field>();
const { allowAll } = useACLRoleContext(); const { allowAll } = useACLRoleContext();
if (allowAll) { if (allowAll) {
return <>{props.children}</>; return <>{props.children}</>;
@ -260,6 +262,12 @@ export const ACLCollectionFieldProvider = (props) => {
} }
const { whitelist } = useACLFieldWhitelist(); const { whitelist } = useACLFieldWhitelist();
const allowed = whitelist.length > 0 ? whitelist.includes(fieldSchema.name) : true; const allowed = whitelist.length > 0 ? whitelist.includes(fieldSchema.name) : true;
useEffect(() => {
if (!allowed) {
field.required = false;
field.display = 'hidden';
}
}, [allowed]);
if (!allowed) { if (!allowed) {
return null; return null;
} }

View File

@ -1,14 +1,21 @@
import { ConfigProvider, Spin } from 'antd'; import { ConfigProvider, Spin } from 'antd';
import React from 'react'; import moment from 'moment';
import React, { createContext, useContext } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { useAPIClient, useRequest } from '../api-client'; import { useAPIClient, useRequest } from '../api-client';
import locale from '../locale'; import { loadConstrueLocale } from './loadConstrueLocale';
export const AppLangContext = createContext<any>({});
export const useAppLangContext = () => {
return useContext(AppLangContext);
};
export function AntdConfigProvider(props) { export function AntdConfigProvider(props) {
const { remoteLocale, ...others } = props; const { remoteLocale, ...others } = props;
const api = useAPIClient(); const api = useAPIClient();
const { i18n } = useTranslation(); const { i18n } = useTranslation();
const { loading } = useRequest( const { data, loading } = useRequest(
{ {
url: 'app:getLang', url: 'app:getLang',
}, },
@ -19,6 +26,12 @@ export function AntdConfigProvider(props) {
api.auth.setLocale(data?.data?.lang); api.auth.setLocale(data?.data?.lang);
i18n.changeLanguage(data?.data?.lang); i18n.changeLanguage(data?.data?.lang);
} }
Object.keys(data?.data?.resources || {}).forEach((key) => {
i18n.addResources(data?.data?.lang, key, data?.data?.resources[key] || {});
});
loadConstrueLocale(data?.data);
moment.locale(data?.data?.moment);
window['cronLocale'] = data?.data?.cron;
}, },
manual: !remoteLocale, manual: !remoteLocale,
}, },
@ -27,12 +40,10 @@ export function AntdConfigProvider(props) {
return <Spin />; return <Spin />;
} }
return ( return (
<ConfigProvider <AppLangContext.Provider value={data?.data}>
dropdownMatchSelectWidth={false} <ConfigProvider dropdownMatchSelectWidth={false} {...others} locale={data?.data?.antd || {}}>
{...others} {props.children}
locale={locale[i18n.language].antd} </ConfigProvider>
> </AppLangContext.Provider>
{props.children}
</ConfigProvider>
); );
} }

View File

@ -0,0 +1,172 @@
import cronstrue from 'cronstrue';
class CronstrueLocale {
constructor(protected data: any) {}
atX0SecondsPastTheMinuteGt20(): string | null {
return this.data['atX0SecondsPastTheMinuteGt20'];
}
atX0MinutesPastTheHourGt20(): string | null {
return this.data['atX0MinutesPastTheHourGt20'];
}
commaMonthX0ThroughMonthX1(): string | null {
return this.data['commaMonthX0ThroughMonthX1'];
}
commaYearX0ThroughYearX1(): string | null {
return this.data['commaYearX0ThroughYearX1'];
}
use24HourTimeFormatByDefault() {
return this.data['use24HourTimeFormatByDefault'];
}
anErrorOccuredWhenGeneratingTheExpressionD() {
return this.data['anErrorOccuredWhenGeneratingTheExpressionD'];
}
everyMinute() {
return this.data['everyMinute'];
}
everyHour() {
return this.data['everyHour'];
}
atSpace() {
return this.data['atSpace'];
}
everyMinuteBetweenX0AndX1() {
return this.data['everyMinuteBetweenX0AndX1'];
}
at() {
return this.data['at'];
}
spaceAnd() {
return this.data['spaceAnd'];
}
everySecond() {
return this.data['everySecond'];
}
everyX0Seconds() {
return this.data['everyX0Seconds'];
}
secondsX0ThroughX1PastTheMinute() {
return this.data['secondsX0ThroughX1PastTheMinute'];
}
atX0SecondsPastTheMinute() {
return this.data['atX0SecondsPastTheMinute'];
}
everyX0Minutes() {
return this.data['everyX0Minutes'];
}
minutesX0ThroughX1PastTheHour() {
return this.data['minutesX0ThroughX1PastTheHour'];
}
atX0MinutesPastTheHour() {
return this.data['atX0MinutesPastTheHour'];
}
everyX0Hours() {
return this.data['everyX0Hours'];
}
betweenX0AndX1() {
return this.data['betweenX0AndX1'];
}
atX0() {
return this.data['atX0'];
}
commaEveryDay() {
return this.data['commaEveryDay'];
}
commaEveryX0DaysOfTheWeek() {
return this.data['commaEveryX0DaysOfTheWeek'];
}
commaX0ThroughX1() {
return this.data['commaX0ThroughX1'];
}
commaAndX0ThroughX1() {
return this.data['commaAndX0ThroughX1'];
}
first() {
return this.data['first'];
}
second() {
return this.data['second'];
}
third() {
return this.data['third'];
}
fourth() {
return this.data['fourth'];
}
fifth() {
return this.data['fifth'];
}
commaOnThe() {
return this.data['commaOnThe'];
}
spaceX0OfTheMonth() {
return this.data['spaceX0OfTheMonth'];
}
lastDay() {
return this.data['lastDay'];
}
commaOnTheLastX0OfTheMonth() {
return this.data['commaOnTheLastX0OfTheMonth'];
}
commaOnlyOnX0() {
return this.data['commaOnlyOnX0'];
}
commaAndOnX0() {
return this.data['commaAndOnX0'];
}
commaEveryX0Months() {
return this.data['commaEveryX0Months'];
}
commaOnlyInX0() {
return this.data['commaOnlyInX0'];
}
commaOnTheLastDayOfTheMonth() {
return this.data['commaOnTheLastDayOfTheMonth'];
}
commaOnTheLastWeekdayOfTheMonth() {
return this.data['commaOnTheLastWeekdayOfTheMonth'];
}
commaDaysBeforeTheLastDayOfTheMonth() {
return this.data['commaDaysBeforeTheLastDayOfTheMonth'];
}
firstWeekday() {
return this.data['firstWeekday'];
}
weekdayNearestDayX0() {
return this.data['weekdayNearestDayX0'];
}
commaOnTheX0OfTheMonth() {
return this.data['commaOnTheX0OfTheMonth'];
}
commaEveryX0Days() {
return this.data['commaEveryX0Days'];
}
commaBetweenDayX0AndX1OfTheMonth() {
return this.data['commaBetweenDayX0AndX1OfTheMonth'];
}
commaOnDayX0OfTheMonth() {
return this.data['commaOnDayX0OfTheMonth'];
}
commaEveryHour() {
return this.data['commaEveryHour'];
}
commaEveryX0Years() {
return this.data['commaEveryX0Years'];
}
commaStartingX0() {
return this.data['commaStartingX0'];
}
daysOfTheWeek() {
return this.data['daysOfTheWeek'];
}
monthsOfTheYear() {
return this.data['monthsOfTheYear'];
}
}
export const loadConstrueLocale = (data) => {
cronstrue.initialize({
load(availableLocales) {
availableLocales[data?.lang] = new CronstrueLocale(data?.cronstrue);
},
});
};

View File

@ -1,5 +1,4 @@
import i18next from 'i18next'; import i18next from 'i18next';
import moment from 'moment';
import { initReactI18next } from 'react-i18next'; import { initReactI18next } from 'react-i18next';
import locale from '../locale'; import locale from '../locale';
const log = require('debug')('i18next'); const log = require('debug')('i18next');
@ -12,27 +11,25 @@ Object.keys(locale).forEach((lang) => {
resources[lang] = locale[lang].resources; resources[lang] = locale[lang].resources;
}); });
i18n.use(initReactI18next).init({ i18n
lng: localStorage.getItem('NOCOBASE_LOCALE') || 'en-US', // .use(Backend)
// debug: true, .use(initReactI18next)
defaultNS: 'client', .init({
// parseMissingKeyHandler: (key) => { lng: localStorage.getItem('NOCOBASE_LOCALE') || 'en-US',
// console.log('parseMissingKeyHandler', `'${key}': '${key}',`); // debug: true,
// return key; defaultNS: 'client',
// }, // backend: {
// ns: ['client'], // // for all available options read the backend's repository readme file
resources, // loadPath: '/api/locales/{{lng}}/{{ns}}.json',
}); // },
// parseMissingKeyHandler: (key) => {
function setMomentLng(language) { // console.log('parseMissingKeyHandler', `'${key}': '${key}',`);
const lng = locale[language || 'en-US'].moment || 'en'; // return key;
log(lng); // },
moment.locale(lng); // ns: ['client'],
} resources: {},
});
setMomentLng(localStorage.getItem('NOCOBASE_LOCALE'));
i18n.on('languageChanged', (lng) => { i18n.on('languageChanged', (lng) => {
localStorage.setItem('NOCOBASE_LOCALE', lng); localStorage.setItem('NOCOBASE_LOCALE', lng);
setMomentLng(lng);
}); });

View File

@ -4,6 +4,7 @@ import './global.less';
export * from './acl'; export * from './acl';
export * from './antd-config-provider'; export * from './antd-config-provider';
export * from './api-client'; export * from './api-client';
export * from './appInfo';
export * from './application'; export * from './application';
export * from './async-data-provider'; export * from './async-data-provider';
export * from './block-provider'; export * from './block-provider';
@ -26,5 +27,4 @@ export * from './schema-templates';
export * from './settings-form'; export * from './settings-form';
export * from './system-settings'; export * from './system-settings';
export * from './user'; export * from './user';
export * from './appInfo'

View File

@ -43,6 +43,7 @@ export default {
"Super admin": "Super admin", "Super admin": "Super admin",
"Language": "Language", "Language": "Language",
"Allow sign up": "Allow sign up", "Allow sign up": "Allow sign up",
"Enable SMS authentication": "Enable SMS authentication",
"Sign out": "Sign out", "Sign out": "Sign out",
"Cancel": "Cancel", "Cancel": "Cancel",
"Submit": "Submit", "Submit": "Submit",
@ -53,12 +54,12 @@ export default {
"Form": "Form", "Form": "Form",
"Select data source": "Select data source", "Select data source": "Select data source",
"Calendar": "Calendar", "Calendar": "Calendar",
'Delete events': 'Delete events', "Delete events": "Delete events",
'This event': 'This event', "This event": "This event",
'This and following events': 'This and following events', "This and following events": "This and following events",
'All events': 'All events', "All events": "All events",
'Delete this event?': 'Delete this event?', "Delete this event?": "Delete this event?",
'Delete Event': 'Delete Event', "Delete Event": "Delete Event",
"Kanban": "Kanban", "Kanban": "Kanban",
"Select grouping field": "Select grouping field", "Select grouping field": "Select grouping field",
"Media": "Media", "Media": "Media",
@ -114,11 +115,12 @@ export default {
"Collection display name": "Collection display name", "Collection display name": "Collection display name",
"Collection name": "Collection name", "Collection name": "Collection name",
"Inherits": "Inherits", "Inherits": "Inherits",
"AutoGenId": "Auto-generated ID field", "Generate ID field automatically": "Generate ID field automatically",
"CreatedBy": "Recording a row's created user", "Store the creation user of each record": "Store the creation user of each record",
"UpdatedBy": "Recording a row's last updated user", "Store the last update user of each record": "Store the last update user of each record",
"CreatedAt": "Recording a row's created time ", "Store the creation time of each record": "Store the creation time of each record",
"UpdatedAt": "Recording a row's last updated user", "Store the last update time of each record": "Store the last update time of each record",
"More options": "More options",
"Records can be sorted": "Records can be sorted", "Records can be sorted": "Records can be sorted",
"Collection template": "Collection template", "Collection template": "Collection template",
"Calendar collection": "Calendar collection", "Calendar collection": "Calendar collection",
@ -136,9 +138,9 @@ export default {
"Association fields filter": "Association fields filter", "Association fields filter": "Association fields filter",
"PK & FK fields": "PK & FK fields", "PK & FK fields": "PK & FK fields",
"Association fields": "Association fields", "Association fields": "Association fields",
"Parent collection fields": "Parent collection fields",
"System fields": "System fields", "System fields": "System fields",
"General fields": "General fields", "General fields": "General fields",
"Parent collection fields": "Parent collection fields",
"Basic": "Basic", "Basic": "Basic",
"Single line text": "Single line text", "Single line text": "Single line text",
"Long text": "Long text", "Long text": "Long text",
@ -183,6 +185,7 @@ export default {
"12 hour": "12 hour", "12 hour": "12 hour",
"24 hour": "24 hour", "24 hour": "24 hour",
"Relationship type": "Relationship type", "Relationship type": "Relationship type",
"Inverse relationship type": "Inverse relationship type",
"Source collection": "Source collection", "Source collection": "Source collection",
"Source key": "Source key", "Source key": "Source key",
"Target collection": "Target collection", "Target collection": "Target collection",
@ -193,12 +196,28 @@ export default {
"One to many": "One to many", "One to many": "One to many",
"Many to one": "Many to one", "Many to one": "Many to one",
"Many to many": "Many to many", "Many to many": "Many to many",
"Foreign key 1": "Foreign key 1",
"Foreign key 2": "Foreign key 2",
"One to one description": "Used to create one-to-one relationships. For example, a user has a profile.", "One to one description": "Used to create one-to-one relationships. For example, a user has a profile.",
"One to many description": "Used to create a one-to-many relationship. For example, a country will have many cities and a city can only be in one country. When present as a field, it is a sub-table that displays the records of the associated collection. When created, a Many-to-one field is automatically generated in the associated collection.", "One to many description": "Used to create a one-to-many relationship. For example, a country will have many cities and a city can only be in one country. When present as a field, it is a sub-table that displays the records of the associated collection. When created, a Many-to-one field is automatically generated in the associated collection.",
"Many to one description": "Used to create many-to-one relationships. For example, a city can belong to only one country and a country can have many cities. When present as a field, it is a drop-down selection used to select record from the associated collection. Once created, a One-to-many field is automatically generated in the associated collection.", "Many to one description": "Used to create many-to-one relationships. For example, a city can belong to only one country and a country can have many cities. When present as a field, it is a drop-down selection used to select record from the associated collection. Once created, a One-to-many field is automatically generated in the associated collection.",
"Many to many description": "Used to create many-to-many relationships. For example, a student will have many teachers and a teacher will have many students. When present as a field, it is a drop-down selection used to select records from the associated collection.", "Many to many description": "Used to create many-to-many relationships. For example, a student will have many teachers and a teacher will have many students. When present as a field, it is a drop-down selection used to select records from the associated collection.",
"Foreign key 1": "Foreign key 1", "Generated automatically if left blank": "Generated automatically if left blank",
"Foreign key 2": "Foreign key 2", "Display association fields": "Display association fields",
"Field component": "Field component",
"Subtable": "Subtable",
"Subform": "Subform",
"Record picker": "Record picker",
"Toggles the subfield mode": "Toggles the subfield mode",
"Selector mode": "Selector mode",
"Subtable mode": "Subtable mode",
"Subform mode": "Subform mode",
"Edit block title": "Edit block title",
"Block title": "Block title",
"Pattern": "Pattern",
"Editable": "Editable",
"Readonly": "Readonly",
"Easy-reading": "Easy-reading",
"Add filter": "Add filter", "Add filter": "Add filter",
"Add filter group": "Add filter group", "Add filter group": "Add filter group",
"Comparision": "Comparision", "Comparision": "Comparision",
@ -219,6 +238,7 @@ export default {
"Edit button": "Edit button", "Edit button": "Edit button",
"Hide": "Hide", "Hide": "Hide",
"Enable actions": "Enable actions", "Enable actions": "Enable actions",
"Import": "Import",
"Export": "Export", "Export": "Export",
"Customize": "Customize", "Customize": "Customize",
"Function": "Function", "Function": "Function",
@ -239,9 +259,30 @@ export default {
"Custom column name": "Custom column name", "Custom column name": "Custom column name",
"Edit description": "Edit description", "Edit description": "Edit description",
"Required": "Required", "Required": "Required",
"Unique": "Unique",
"Label field": "Label field", "Label field": "Label field",
"Default is the ID field": "Default is the ID field", "Default is the ID field": "Default is the ID field",
"Set default sorting rules": "Set default sorting rules", "Set default sorting rules": "Set default sorting rules",
"Set validation rules": "Set validation rules",
"Max length": "Max length",
"Min length": "Min length",
"Maximum": "Maximum",
"Minimum": "Minimum",
"Max length must greater than min length": "Max length must greater than min length",
"Min length must less than max length": "Min length must less than max length",
"Maximum must greater than minimum": "Maximum must greater than minimum",
"Minimum must less than maximum": "Minimum must less than maximum",
"Validation rule": "Validation rule",
"Add validation rule": "Add validation rule",
"Format": "Format",
"Regular expression": "Pattern",
"Error message": "Error message",
"Length": "Length",
"The field value cannot be greater than ": "The field value cannot be greater than ",
"The field value cannot be less than ": "The field value cannot be less than ",
"The field value is not an integer number": "The field value is not an integer number",
"Set default value": "Set default value",
"Default value": "Default value",
"is before": "is before", "is before": "is before",
"is after": "is after", "is after": "is after",
"is on or after": "is on or after", "is on or after": "is on or after",
@ -275,6 +316,7 @@ export default {
"Configure calendar": "Configure calendar", "Configure calendar": "Configure calendar",
"Title field": "Title field", "Title field": "Title field",
"Custom title": "Custom title", "Custom title": "Custom title",
"Show lunar": "Show lunar",
"Start date field": "Start date field", "Start date field": "Start date field",
"End date field": "End date field", "End date field": "End date field",
"Navigate": "Navigate", "Navigate": "Navigate",
@ -282,10 +324,13 @@ export default {
"Description": "Description", "Description": "Description",
"Select view": "Select view", "Select view": "Select view",
"Reset": "Reset", "Reset": "Reset",
"Importable fields": "Importable fields",
"Exportable fields": "Exportable fields", "Exportable fields": "Exportable fields",
"Saved successfully": "Saved successfully", "Saved successfully": "Saved successfully",
"Nickname": "Nickname", "Nickname": "Nickname",
"Sign in": "Sign in", "Sign in": "Sign in",
"Sign in via account": "Sign in via account",
"Sign in via phone": "Sign in via phone",
"Create an account": "Create an account", "Create an account": "Create an account",
"Sign up": "Sign up", "Sign up": "Sign up",
"Confirm password": "Confirm password", "Confirm password": "Confirm password",
@ -293,6 +338,9 @@ export default {
"Signed up successfully. It will jump to the login page.": "Signed up successfully. It will jump to the login page.", "Signed up successfully. It will jump to the login page.": "Signed up successfully. It will jump to the login page.",
"Password mismatch": "Password mismatch", "Password mismatch": "Password mismatch",
"Users": "Users", "Users": "Users",
"Verification code": "Verification code",
"Send code": "Send code",
"Retry after {{count}} seconds": "Retry after {{count}} seconds",
"Roles": "Roles", "Roles": "Roles",
"Add role": "Add role", "Add role": "Add role",
"Role name": "Role name", "Role name": "Role name",
@ -355,6 +403,7 @@ export default {
"DESC": "DESC", "DESC": "DESC",
"Add sort field": "Add sort field", "Add sort field": "Add sort field",
"ID": "ID", "ID": "ID",
"Identifier for program usage. Support letters, numbers and underscores, must start with an letter.": "Identifier for program usage. Support letters, numbers and underscores, must start with an letter.",
"Drawer": "Drawer", "Drawer": "Drawer",
"Dialog": "Dialog", "Dialog": "Dialog",
"Delete action": "Delete action", "Delete action": "Delete action",
@ -377,6 +426,7 @@ export default {
"exists": "exists", "exists": "exists",
"not exists": "not exists", "not exists": "not exists",
"is current logged-in user": "is current logged-in user", "is current logged-in user": "is current logged-in user",
"is not current logged-in user": "is not current logged-in user",
"=": "=", "=": "=",
"≠": "≠", "≠": "≠",
">": ">", ">": ">",
@ -406,6 +456,7 @@ export default {
"Create calendar block": "Create calendar block", "Create calendar block": "Create calendar block",
"Create kanban block": "Create kanban block", "Create kanban block": "Create kanban block",
"Grouping field": "Grouping field", "Grouping field": "Grouping field",
"Single select and radio fields can be used as the grouping field": "Single select and radio fields can be used as the grouping field",
"Tab name": "Tab name", "Tab name": "Tab name",
"Current record blocks": "Current record blocks", "Current record blocks": "Current record blocks",
"Popup message": "Popup message", "Popup message": "Popup message",
@ -419,10 +470,13 @@ export default {
"General permissions": "General permissions", "General permissions": "General permissions",
"Global action permissions": "Global action permissions", "Global action permissions": "Global action permissions",
"General action permissions": "General action permissions", "General action permissions": "General action permissions",
"Plugin settings permissions":"Plugin settings permissions", "Plugin settings permissions": "Plugin settings permissions",
"Allow to desgin pages":"Allow to desgin pages", "Allow to desgin pages": "Allow to desgin pages",
"Allow to manage plugins":"Allow to manage plugins", "Allow to manage plugins": "Allow to manage plugins",
"Allow to configure plugins":"Allow to configure plugins", "Allow to configure plugins": "Allow to configure plugins",
"Allows to configure interface": "Allows to configure interface",
"Allows to install, activate, disable plugins": "Allows to install, activate, disable plugins",
"Allows to configure plugins": "Allows to configure plugins",
"Action display name": "Action display name", "Action display name": "Action display name",
"Allow": "Allow", "Allow": "Allow",
"Data scope": "Data scope", "Data scope": "Data scope",
@ -449,8 +503,11 @@ export default {
"Use the built-in static file server": "Use the built-in static file server", "Use the built-in static file server": "Use the built-in static file server",
"Local storage": "Local storage", "Local storage": "Local storage",
"Aliyun OSS": "Aliyun OSS", "Aliyun OSS": "Aliyun OSS",
"Tencent COS": "Tencent COS",
"Amazon S3": "Amazon S3", "Amazon S3": "Amazon S3",
"Tencent COS": "Tencent COS",
"Region": "Region",
"Bucket": "Bucket",
"Path": "Path",
"Unsaved changes": "Unsaved changes", "Unsaved changes": "Unsaved changes",
"Are you sure you don't want to save?": "Are you sure you don't want to save?", "Are you sure you don't want to save?": "Are you sure you don't want to save?",
"Dragging": "Dragging", "Dragging": "Dragging",
@ -462,6 +519,7 @@ export default {
"Dynamic value": "Dynamic value", "Dynamic value": "Dynamic value",
"Current user": "Current user", "Current user": "Current user",
"Current record": "Current record", "Current record": "Current record",
"Current time": "Current time",
"Popup close method": "Popup close method", "Popup close method": "Popup close method",
"Automatic close": "Automatic close", "Automatic close": "Automatic close",
"Manually close": "Manually close", "Manually close": "Manually close",
@ -489,29 +547,40 @@ export default {
"Record ID": "Record ID", "Record ID": "Record ID",
"User": "User", "User": "User",
"Field": "Field", "Field": "Field",
"Select": "Select",
"Select Field": "Select Field",
"Field value changes": "Field value changes", "Field value changes": "Field value changes",
"One to one (has one)": "One to one (has one)", "One to one (has one)": "One to one (has one)",
"One to one (belongs to)": "One to one (belongs to)", "One to one (belongs to)": "One to one (belongs to)",
"Use the same time zone (GMT) for all users": "Use the same time zone (GMT) for all users", "Use the same time zone (GMT) for all users": "Use the same time zone (GMT) for all users",
"Block title": "Block title",
"Edit block title": "Edit block title",
"Province/city/area name": "Province/city/area name", "Province/city/area name": "Province/city/area name",
"Field component": "Field component",
"Subtable": "Subtable",
"Subform": "Subform",
"Regular expression": "Pattern",
"Enabled languages": "Enabled languages", "Enabled languages": "Enabled languages",
"View all plugins": "View all plugins", "View all plugins": "View all plugins",
"Print": "Print", "Print": "Print",
'Single select and radio fields can be used as the grouping field': 'Single select and radio fields can be used as the grouping field', "Done": "Done",
'Sign up successfully, and automatically jump to the sign in page': 'Sign up successfully, and automatically jump to the sign in page', "Sign up successfully, and automatically jump to the sign in page": "Sign up successfully, and automatically jump to the sign in page",
"File manager": "File manager",
"ACL": "ACL",
"Collection manager": "Collection manager",
"Plugin manager": "Plugin manager",
"Local": "Local",
"Built-in": "Built-in",
"Marketplace": "Marketplace",
"Coming soon...": "Coming soon...",
"All plugin settings": "All plugin settings",
"Bookmark": "Bookmark",
"Manage all settings": "Manage all settings",
"Create inverse field in the target collection": "Create inverse field in the target collection",
"Inverse field name": "Inverse field name",
"Inverse field display name": "Inverse field display name",
"Bulk update": "Bulk update",
"After successful bulk update": "After successful bulk update", "After successful bulk update": "After successful bulk update",
"All": "All",
"Update selected data?": "Update selected data?",
"Update all data?": "Update all data?",
"Bulk edit": "Bulk edit", "Bulk edit": "Bulk edit",
"Data will be updated": "Data will be updated", "Data will be updated": "Data will be updated",
"Selected": "Selected", "Selected": "Selected",
"All": "All",
"Update selected data?": "Update selected data?",
"Update all data?": "Update all data?",
"Remains the same": "Remains the same", "Remains the same": "Remains the same",
"Changed to": "Changed to", "Changed to": "Changed to",
"Clear": "Clear", "Clear": "Clear",
@ -520,6 +589,13 @@ export default {
"Selector": "Selector", "Selector": "Selector",
"Inner": "Inner", "Inner": "Inner",
"Search and select collection": "Search and select collection", "Search and select collection": "Search and select collection",
'Please fill in the iframe URL': 'Please fill in the iframe URL', "Please fill in the iframe URL": "Please fill in the iframe URL",
'Fix block': 'Fix block' "Fix block": "Fix block",
} "Plugin name": "Plugin name",
"Plugin tab name": "Plugin tab name",
"AutoGenId": "Auto-generated ID field",
"CreatedBy": "Recording a row's created user",
"UpdatedBy": "Recording a row's last updated user",
"CreatedAt": "Recording a row's created time ",
"UpdatedAt": "Recording a row's last updated user"
};

View File

@ -1,81 +1,75 @@
import antdEnUS from 'antd/lib/locale/en_US';
import antdJaJP from 'antd/lib/locale/ja_JP';
import antdRuRU from 'antd/lib/locale/ru_RU';
import antdTrTR from 'antd/lib/locale/tr_TR';
import antdZhCN from 'antd/lib/locale/zh_CN';
import enUS from './en_US';
import jaJP from './ja_JP';
import ruRU from './ru_RU';
import trTR from './tr_TR';
import zhCN from './zh_CN';
export type LocaleOptions = { export type LocaleOptions = {
label: string; label: string;
moment: string;
antd: any;
resources?: any;
}; };
export { default as cron } from '../schema-component/antd/cron/locale';
export default { export default {
'en-US': { 'ar-EG': { label: 'العربية' },
label: 'English', 'az-AZ': { label: 'Azərbaycan dili' },
// https://github.com/moment/moment/blob/develop/locale/en.js 'bg-BG': { label: 'Български' },
moment: 'en', 'bn-BD': { label: 'Bengali' },
// https://github.com/ant-design/ant-design/tree/master/components/locale/en_US 'by-BY': { label: 'Беларускі' },
antd: antdEnUS, 'ca-ES': { label: 'Сatalà/Espanya' },
resources: { 'cs-CZ': { label: 'Česky' },
client: { 'da-DK': { label: 'Dansk' },
...enUS, 'de-DE': { label: 'Deutsch' },
}, 'el-GR': { label: 'Ελληνικά' },
}, 'en-GB': { label: 'English(GB)' },
}, 'en-US': { label: 'English' },
'ja-JP': { 'es-ES': { label: 'Español' },
label: '日本語', 'et-EE': { label: 'Estonian (Eesti)' },
// https://github.com/moment/moment/blob/develop/locale/ja.js 'fa-IR': { label: 'فارسی' },
moment: 'ja', 'fi-FI': { label: 'Suomi' },
// https://github.com/ant-design/ant-design/tree/master/components/locale/ja_JP 'fr-BE': { label: 'Français(BE)' },
antd: antdJaJP, 'fr-CA': { label: 'Français(CA)' },
resources: { 'fr-FR': { label: 'Français' },
client: { 'ga-IE': { label: 'Gaeilge' },
...jaJP, 'gl-ES': { label: 'Galego' },
}, 'he-IL': { label: 'עברית' },
}, 'hi-IN': { label: 'हिन्दी' },
}, 'hr-HR': { label: 'Hrvatski jezik' },
'zh-CN': { 'hu-HU': { label: 'Magyar' },
label: '简体中文', 'hy-AM': { label: 'Հայերեն' },
// https://github.com/moment/moment/blob/develop/locale/zh-cn.js 'id-ID': { label: 'Bahasa Indonesia' },
moment: 'zh-cn', 'is-IS': { label: 'Íslenska' },
// https://github.com/ant-design/ant-design/tree/master/components/locale/zh_CN 'it-IT': { label: 'Italiano' },
antd: antdZhCN, 'ja-JP': { label: '日本語' },
// i18next 'ka-GE': { label: 'ქართული' },
resources: { 'kk-KZ': { label: 'Қазақ тілі' },
client: { 'km-KH': { label: 'ភាសាខ្មែរ' },
...zhCN, // 'kmr-IQ': { label: 'kmr_IQ' },
}, 'kn-IN': { label: 'ಕನ್ನಡ' },
}, 'ko-KR': { label: '한국어' },
}, 'ku-IQ': { label: 'کوردی' },
'ru-RU': { 'lt-LT': { label: 'lietuvių' },
label: 'Русский', 'lv-LV': { label: 'Latviešu valoda' },
// https://github.com/moment/moment/blob/develop/locale/ru.js 'mk-MK': { label: 'македонски јазик' },
moment: 'ru', 'ml-IN': { label: 'മലയാളം' },
// https://github.com/ant-design/ant-design/tree/master/components/locale/ru_RU 'mn-MN': { label: 'Монгол хэл' },
antd: antdRuRU, 'ms-MY': { label: 'بهاس ملايو' },
resources: { 'nb-NO': { label: 'Norsk bokmål' },
client: { 'ne-NP': { label: 'नेपाली' },
...ruRU, 'nl-BE': { label: 'Vlaams' },
}, 'nl-NL': { label: 'Nederlands' },
}, 'pl-PL': { label: 'Polski' },
}, 'pt-BR': { label: 'Português brasileiro' },
'tr-TR': { 'pt-PT': { label: 'Português' },
label: 'Türkçe', 'ro-RO': { label: 'România' },
// https://github.com/moment/moment/blob/develop/locale/tr.js 'ru-RU': { label: 'Русский' },
moment: 'tr', 'si-LK': { label: 'සිංහල' },
// https://github.com/ant-design/ant-design/tree/master/components/locale/tr_TR 'sk-SK': { label: 'Slovenčina' },
antd: antdTrTR, 'sl-SI': { label: 'Slovenščina' },
resources: { 'sr-RS': { label: 'српски језик' },
client: { 'sv-SE': { label: 'Svenska' },
...trTR, 'ta-IN': { label: 'Tamil' },
}, 'th-TH': { label: 'ภาษาไทย' },
}, 'tk-TK': { label: 'Turkmen' },
}, 'tr-TR': { label: 'Türkçe' },
} as Record<string, LocaleOptions>; 'uk-UA': { label: 'Українська' },
'ur-PK': { label: 'Oʻzbekcha' },
'vi-VN': { label: 'Tiếng Việt' },
'zh-CN': { label: '简体中文' },
'zh-HK': { label: '繁體中文(香港)' },
'zh-TW': { label: '繁體中文(台湾)' },
};

View File

@ -1,13 +1,11 @@
import { css } from '@emotion/css'; import { css } from '@emotion/css';
import { useMutationObserver } from 'ahooks';
import { Layout, Spin } from 'antd'; import { Layout, Spin } from 'antd';
import React, { createContext, useContext, useMemo, useRef, useState } from 'react'; import React, { createContext, useContext, useMemo, useRef, useState } from 'react';
import { useHistory, useRouteMatch } from 'react-router-dom'; import { useHistory, useRouteMatch } from 'react-router-dom';
import { import {
ACLRolesCheckProvider, ACLRolesCheckProvider, CurrentAppInfoProvider, CurrentUser,
CurrentUser, CurrentUserProvider, findByUid,
CurrentUserProvider,
CurrentAppInfoProvider,
findByUid,
findMenuItem, findMenuItem,
RemoteCollectionManagerProvider, RemoteCollectionManagerProvider,
RemotePluginManagerToolbar, RemotePluginManagerToolbar,
@ -17,11 +15,9 @@ import {
useDocumentTitle, useDocumentTitle,
useRequest, useRequest,
useRoute, useRoute,
useSystemSettings, useSystemSettings
} from '../../../'; } from '../../../';
import { useCollectionManager } from '../../../collection-manager'; import { useCollectionManager } from '../../../collection-manager';
import { PoweredBy } from '../../../powered-by';
import { useMutationObserver } from 'ahooks';
const filterByACL = (schema, options) => { const filterByACL = (schema, options) => {
const { allowAll, allowMenuItemIds = [] } = options; const { allowAll, allowMenuItemIds = [] } = options;
@ -209,8 +205,8 @@ export const InternalAdminLayout = (props: any) => {
max-width: var(--side-menu-width); max-width: var(--side-menu-width);
min-width: var(--side-menu-width); min-width: var(--side-menu-width);
pointer-events: none; pointer-events: none;
transition: background-color 0.3s ease 0s, min-width 0.3s ease 0s, /* transition: background-color 0.3s ease 0s, min-width 0.3s ease 0s,
max-width 0.3s cubic-bezier(0.645, 0.045, 0.355, 1) 0s; max-width 0.3s cubic-bezier(0.645, 0.045, 0.355, 1) 0s; */
`} `}
></div> ></div>
<Layout.Sider <Layout.Sider

View File

@ -23,7 +23,8 @@ export const AssociationFilterItem = (props) => {
const fieldSchema = useFieldSchema(); const fieldSchema = useFieldSchema();
const Designer = useDesigner(); const Designer = useDesigner();
const compile = useCompile(); const compile = useCompile();
const { service } = useBlockRequestContext(); const { service, props: blockProps } = useBlockRequestContext();
const [searchVisible, setSearchVisible] = useState(false); const [searchVisible, setSearchVisible] = useState(false);
const collectionFieldName = collectionField.name; const collectionFieldName = collectionField.name;
@ -76,7 +77,15 @@ export const AssociationFilterItem = (props) => {
delete filters[`af.${collectionFieldName}`]; delete filters[`af.${collectionFieldName}`];
} }
service.run({ ...service.params?.[0], pageSize: 200, page: 1, filter: mergeFilter(Object.values(filters)) }, { filters }); service.run(
{
...service.params?.[0],
pageSize: 200,
page: 1,
filter: mergeFilter([...Object.values(filters), blockProps?.params?.filter]),
},
{ filters },
);
}; };
const handleSearchToggle = (e: MouseEvent) => { const handleSearchToggle = (e: MouseEvent) => {

View File

@ -1,68 +1,54 @@
import React from 'react';
import { connect, mapProps, mapReadPretty } from '@formily/react';
import { Cron as ReactCron, CronProps } from 'react-js-cron';
import cronstrue from 'cronstrue';
import 'cronstrue/locales/zh_CN';
import { css } from '@emotion/css'; import { css } from '@emotion/css';
import { connect, mapReadPretty } from '@formily/react';
import cronstrue from 'cronstrue';
import React from 'react';
import { Cron as ReactCron, CronProps } from 'react-js-cron';
import { useAPIClient } from '../../../api-client';
import localeZhCN from './locale/zh-CN'; type ComposedCron = React.FC<CronProps> & {};
const ComponentLocales = { const Input = (props: Exclude<CronProps, 'setValue'> & { onChange: (value: string) => void }) => {
'zh-CN': localeZhCN, const { onChange, ...rest } = props;
}; return (
<fieldset
const ReadPrettyLocales = { className={css`
'en-US': 'en', .react-js-cron {
'zh-CN': 'zh_CN' padding: 0.5em 0.5em 0 0.5em;
};
type ComposedCron = React.FC<CronProps> & {}
export const Cron: ComposedCron = connect(
(props: Exclude<CronProps, 'setValue'> & { onChange: (value: string) => void }) => {
const { onChange, ...rest } = props;
const locale = ComponentLocales[localStorage.getItem('NOCOBASE_LOCALE') || 'en-US'];
return (
<fieldset className={css`
.react-js-cron{
padding: .5em .5em 0 .5em;
border: 1px dashed #ccc; border: 1px dashed #ccc;
.react-js-cron-field {
.react-js-cron-field{
flex-shrink: 0; flex-shrink: 0;
margin-bottom: .5em; margin-bottom: 0.5em;
> span{ > span {
flex-shrink: 0; flex-shrink: 0;
margin: 0 .5em 0 0; margin: 0 0.5em 0 0;
} }
> .react-js-cron-select{ > .react-js-cron-select {
margin: 0 .5em 0 0; margin: 0 0.5em 0 0;
} }
} }
`}> }
<ReactCron `}
setValue={onChange} >
locale={locale} <ReactCron setValue={onChange} locale={window['cronLocale']} {...rest} />
{...rest} </fieldset>
/> );
</fieldset> };
);
}, const ReadPretty = (props) => {
mapReadPretty((props) => { const api = useAPIClient();
const locale = ReadPrettyLocales[localStorage.getItem('NOCOBASE_LOCALE') || 'en-US']; const locale = api.auth.getLocale();
return props.value return props.value ? (
? ( <span>
<span> {cronstrue.toString(props.value, {
{cronstrue.toString(props.value, { locale,
locale, use24HourTimeFormat: true,
use24HourTimeFormat: true })}
})} </span>
</span> ) : null;
) };
: null;
}) export const Cron: ComposedCron = connect(Input, mapReadPretty(ReadPretty));
);
export default Cron; export default Cron;

View File

@ -0,0 +1,7 @@
import { DEFAULT_LOCALE_EN } from 'react-js-cron/dist/cjs/locale';
import zhCN from './zh-CN';
export default {
'zh-CN': zhCN,
'en-US': DEFAULT_LOCALE_EN,
};

View File

@ -1,7 +1,7 @@
import { CloseCircleOutlined } from '@ant-design/icons'; import { CloseCircleOutlined } from '@ant-design/icons';
import { ObjectField as ObjectFieldModel } from '@formily/core'; import { ObjectField as ObjectFieldModel } from '@formily/core';
import { ArrayField, connect, useField } from '@formily/react'; import { ArrayField, connect, useField } from '@formily/react';
import { Select, Space } from 'antd'; import { ConfigProvider, Select, Space } from 'antd';
import React, { useContext } from 'react'; import React, { useContext } from 'react';
import { Trans, useTranslation } from 'react-i18next'; import { Trans, useTranslation } from 'react-i18next';
import { FilterLogicContext, RemoveConditionContext } from './context'; import { FilterLogicContext, RemoveConditionContext } from './context';
@ -20,84 +20,89 @@ export const FilterGroup = connect((props) => {
[value]: [...(obj[logic] || [])], [value]: [...(obj[logic] || [])],
}; };
}; };
const mergedDisabled = field.disabled;
return ( return (
<FilterLogicContext.Provider value={logic}> <ConfigProvider componentDisabled={mergedDisabled}>
<div <FilterLogicContext.Provider value={logic}>
style={ <div
bordered style={
? { bordered
position: 'relative', ? {
border: '1px dashed #dedede', position: 'relative',
padding: 14, border: '1px dashed #dedede',
marginBottom: 8, padding: 14,
} marginBottom: 8,
: { }
position: 'relative', : {
marginBottom: 8, position: 'relative',
} marginBottom: 8,
} }
> }
{remove && ( >
<a> {remove && !mergedDisabled && (
<CloseCircleOutlined <a>
style={{ <CloseCircleOutlined
position: 'absolute', style={{
right: 10, position: 'absolute',
top: 10, right: 10,
color: '#bfbfbf', top: 10,
}} color: '#bfbfbf',
onClick={() => remove()} }}
/> onClick={() => remove()}
</a> />
)} </a>
<div style={{ marginBottom: 8 }}> )}
<Trans> <div style={{ marginBottom: 8 }}>
{'Meet '} <Trans>
<Select {'Meet '}
style={{ width: 'auto' }} <Select
value={logic} style={{ width: 'auto' }}
onChange={(value) => { value={logic}
setLogic(value); onChange={(value) => {
}} setLogic(value);
> }}
<Select.Option value={'$and'}>All</Select.Option> >
<Select.Option value={'$or'}>Any</Select.Option> <Select.Option value={'$and'}>All</Select.Option>
</Select> <Select.Option value={'$or'}>Any</Select.Option>
{' conditions in the group'} </Select>
</Trans> {' conditions in the group'}
</Trans>
</div>
<div>
<ArrayField name={logic} component={[FilterItems]} disabled={mergedDisabled} />
</div>
{!mergedDisabled && (
<Space size={16} style={{ marginTop: 8, marginBottom: 8 }}>
<a
onClick={() => {
const value = field.value || {};
const items = value[logic] || [];
items.push({});
field.value = {
[logic]: items,
};
}}
>
{t('Add condition')}
</a>
<a
onClick={() => {
const value = field.value || {};
const items = value[logic] || [];
items.push({
$and: [{}],
});
field.value = {
[logic]: items,
};
}}
>
{t('Add condition group')}
</a>
</Space>
)}
</div> </div>
<div> </FilterLogicContext.Provider>
<ArrayField name={logic} component={[FilterItems]} /> </ConfigProvider>
</div>
<Space size={16} style={{ marginTop: 8, marginBottom: 8 }}>
<a
onClick={() => {
const value = field.value || {};
const items = value[logic] || [];
items.push({});
field.value = {
[logic]: items,
};
}}
>
{t('Add condition')}
</a>
<a
onClick={() => {
const value = field.value || {};
const items = value[logic] || [];
items.push({
$and: [{}],
});
field.value = {
[logic]: items,
};
}}
>
{t('Add condition group')}
</a>
</Space>
</div>
</FilterLogicContext.Provider>
); );
}); });

View File

@ -50,9 +50,11 @@ export const FilterItem = observer((props: any) => {
setValue(value); setValue(value);
}, },
})} })}
<a> {!props.disabled && (
<CloseCircleOutlined onClick={() => remove()} style={{ color: '#bfbfbf' }} /> <a>
</a> <CloseCircleOutlined onClick={() => remove()} style={{ color: '#bfbfbf' }} />
</a>
)}
</Space> </Space>
</div> </div>
); );

View File

@ -107,9 +107,11 @@ export const useFilterFieldProps = ({ options, service, params }) => {
const filter = removeNullCondition(values?.filter); const filter = removeNullCondition(values?.filter);
const filters = service.params?.[1]?.filters || {}; const filters = service.params?.[1]?.filters || {};
filters[`default`] = mergeFilter([defaultFilter, filter]); filters[`filterAction`] = filter;
service.run(
service.run({ ...service.params?.[0], page: 1, filter: mergeFilter(Object.values(filters)) }, { filters }); { ...service.params?.[0], page: 1, filter: mergeFilter([...Object.values(filters), defaultFilter]) },
{ filters },
);
const items = filter?.$and || filter?.$or; const items = filter?.$and || filter?.$or;
if (items?.length) { if (items?.length) {
field.title = t('{{count}} filter items', { count: items?.length || 0 }); field.title = t('{{count}} filter items', { count: items?.length || 0 });
@ -119,7 +121,16 @@ export const useFilterFieldProps = ({ options, service, params }) => {
}, },
onReset() { onReset() {
const filter = params.filter; const filter = params.filter;
service.run({ ...service.params?.[0], filter, page: 1 }); const filters = service.params?.[1]?.filters || {};
delete filters[`filterAction`];
service.run(
{
...service.params?.[0],
filter: mergeFilter([...Object.values(filters), filter]),
page: 1,
},
{ filters },
);
field.title = t('Filter'); field.title = t('Filter');
}, },
}; };

View File

@ -2,7 +2,7 @@ import { FormLayout } from '@formily/antd';
import { createForm, Field, onFormInputChange } from '@formily/core'; import { createForm, Field, onFormInputChange } from '@formily/core';
import { FieldContext, FormContext, observer, RecursionField, useField, useFieldSchema } from '@formily/react'; import { FieldContext, FormContext, observer, RecursionField, useField, useFieldSchema } from '@formily/react';
import { uid } from '@formily/shared'; import { uid } from '@formily/shared';
import { Spin } from 'antd'; import { ConfigProvider, Spin } from 'antd';
import React, { useEffect, useMemo } from 'react'; import React, { useEffect, useMemo } from 'react';
import { useActionContext } from '..'; import { useActionContext } from '..';
import { useAttach, useComponent } from '../..'; import { useAttach, useComponent } from '../..';
@ -32,7 +32,7 @@ const FormComponent: React.FC<FormProps> = (props) => {
const Def = (props: any) => props.children; const Def = (props: any) => props.children;
const FormDecorator: React.FC<FormProps> = (props) => { const FormDecorator: React.FC<FormProps> = (props) => {
const { form, children, ...others } = props; const { form, children, disabled, ...others } = props;
const field = useField(); const field = useField();
const fieldSchema = useFieldSchema(); const fieldSchema = useFieldSchema();
// TODO: component 里 useField 会与当前 field 存在偏差 // TODO: component 里 useField 会与当前 field 存在偏差
@ -65,6 +65,7 @@ const WithForm = (props) => {
setFormValueChanged?.(true); setFormValueChanged?.(true);
}); });
}); });
form.disabled = props.disabled;
return () => { return () => {
form.removeEffects(id); form.removeEffects(id);
}; };
@ -78,6 +79,7 @@ const WithoutForm = (props) => {
const form = useMemo( const form = useMemo(
() => () =>
createForm({ createForm({
disabled: props.disabled,
effects() { effects() {
onFormInputChange((form) => { onFormInputChange((form) => {
setFormValueChanged?.(true); setFormValueChanged?.(true);
@ -95,12 +97,19 @@ const WithoutForm = (props) => {
export const Form: React.FC<FormProps> & { Designer?: any; ReadPrettyDesigner?: any } = observer((props) => { export const Form: React.FC<FormProps> & { Designer?: any; ReadPrettyDesigner?: any } = observer((props) => {
const field = useField<Field>(); const field = useField<Field>();
const { form, ...others } = useProps(props); const { form, disabled, ...others } = useProps(props);
const formDisabled = disabled || field.disabled;
return ( return (
<form> <ConfigProvider componentDisabled={formDisabled}>
<Spin spinning={field.loading || false}> <form>
{form ? <WithForm form={form} {...others} /> : <WithoutForm {...others} />} <Spin spinning={field.loading || false}>
</Spin> {form ? (
</form> <WithForm form={form} {...others} disabled={formDisabled} />
) : (
<WithoutForm {...others} disabled={formDisabled} />
)}
</Spin>
</form>
</ConfigProvider>
); );
}); });

View File

@ -2,8 +2,8 @@ import { FormLayout } from '@formily/antd';
import { createForm } from '@formily/core'; import { createForm } from '@formily/core';
import { FieldContext, FormContext, observer, RecursionField, useField, useFieldSchema } from '@formily/react'; import { FieldContext, FormContext, observer, RecursionField, useField, useFieldSchema } from '@formily/react';
import { Options, Result } from 'ahooks/lib/useRequest/src/types'; import { Options, Result } from 'ahooks/lib/useRequest/src/types';
import { Spin } from 'antd'; import { ConfigProvider, Spin } from 'antd';
import React, { createContext, useContext, useMemo } from 'react'; import React, { createContext, useContext, useEffect, useMemo } from 'react';
import { useAttach, useComponent } from '../..'; import { useAttach, useComponent } from '../..';
import { useRequest } from '../../../api-client'; import { useRequest } from '../../../api-client';
import { useCollection } from '../../../collection-manager'; import { useCollection } from '../../../collection-manager';
@ -38,25 +38,30 @@ const FormComponent: React.FC<FormProps> = (props) => {
const Def = (props: any) => props.children; const Def = (props: any) => props.children;
const FormDecorator: React.FC<FormProps> = (props) => { const FormDecorator: React.FC<FormProps> = (props) => {
const { form, children, ...others } = props; const { form, children, disabled, ...others } = props;
const field = useField(); const field = useField();
const fieldSchema = useFieldSchema(); const fieldSchema = useFieldSchema();
// TODO: component 里 useField 会与当前 field 存在偏差 // TODO: component 里 useField 会与当前 field 存在偏差
const f = useAttach(form.createVoidField({ ...field.props, basePath: '' })); const f = useAttach(form.createVoidField({ ...field.props, basePath: '' }));
const Component = useComponent(fieldSchema['x-component'], Def); const Component = useComponent(fieldSchema['x-component'], Def);
useEffect(() => {
form.disabled = disabled || field.disabled;
}, [disabled, field.disabled]);
return ( return (
<FieldContext.Provider value={undefined}> <ConfigProvider componentDisabled={disabled}>
<FormContext.Provider value={form}> <FieldContext.Provider value={undefined}>
<FormLayout layout={'vertical'} {...others}> <FormContext.Provider value={form}>
<FieldContext.Provider value={f}> <FormLayout layout={'vertical'} {...others}>
<Component {...field.componentProps}> <FieldContext.Provider value={f}>
<RecursionField basePath={f.address} schema={fieldSchema} onlyRenderProperties /> <Component {...field.componentProps}>
</Component> <RecursionField basePath={f.address} schema={fieldSchema} onlyRenderProperties />
</FieldContext.Provider> </Component>
{/* <FieldContext.Provider value={f}>{children}</FieldContext.Provider> */} </FieldContext.Provider>
</FormLayout> {/* <FieldContext.Provider value={f}>{children}</FieldContext.Provider> */}
</FormContext.Provider> </FormLayout>
</FieldContext.Provider> </FormContext.Provider>
</FieldContext.Provider>
</ConfigProvider>
); );
}; };

View File

@ -4,12 +4,12 @@ import { Input as AntdInput } from 'antd';
import { InputProps, TextAreaProps } from 'antd/lib/input'; import { InputProps, TextAreaProps } from 'antd/lib/input';
import React from 'react'; import React from 'react';
import { ReadPretty } from './ReadPretty'; import { ReadPretty } from './ReadPretty';
import { Json } from './Json'; import { Json, JSONTextAreaProps } from './Json';
type ComposedInput = React.FC<InputProps> & { type ComposedInput = React.FC<InputProps> & {
TextArea?: React.FC<TextAreaProps>; TextArea?: React.FC<TextAreaProps>;
URL?: React.FC<InputProps>; URL?: React.FC<InputProps>;
JSON?: React.FC<TextAreaProps>; JSON?: React.FC<JSONTextAreaProps>;
}; };
export const Input: ComposedInput = connect( export const Input: ComposedInput = connect(

View File

@ -1,14 +1,17 @@
import React, { useState } from 'react'; import React, { Ref } from 'react';
import { Field } from '@formily/core'; import { Field } from '@formily/core';
import { useField } from '@formily/react'; import { useField } from '@formily/react';
import { Input } from 'antd'; import { Input } from 'antd';
import { TextAreaProps } from 'antd/lib/input'; import { TextAreaProps } from 'antd/lib/input';
export function Json({ value, onChange, space = 2, ...props }: TextAreaProps & { value: any, space: number }) { export type JSONTextAreaProps = TextAreaProps & { ref: Ref<any>, value: any, space: number };
export const Json = React.forwardRef<Ref<any>>(({ value, onChange, space = 2, ...props }: JSONTextAreaProps, ref: Ref<any>) => {
const field = useField<Field>(); const field = useField<Field>();
return ( return (
<Input.TextArea <Input.TextArea
{...props} {...props}
ref={ref}
defaultValue={value != null ? JSON.stringify(value, null, space) : ''} defaultValue={value != null ? JSON.stringify(value, null, space) : ''}
onChange={(ev) => { onChange={(ev) => {
try { try {
@ -25,4 +28,4 @@ export function Json({ value, onChange, space = 2, ...props }: TextAreaProps & {
}} }}
/> />
); );
} });

View File

@ -1,6 +1,7 @@
import { PlusOutlined } from '@ant-design/icons';
import { css } from '@emotion/css'; import { css } from '@emotion/css';
import { FormDialog, FormLayout } from '@formily/antd'; import { FormDialog, FormLayout } from '@formily/antd';
import { RecursionField, Schema, SchemaOptionsContext, useField, useFieldSchema } from '@formily/react'; import { Schema, SchemaOptionsContext, useField, useFieldSchema } from '@formily/react';
import { Button, PageHeader as AntdPageHeader, Spin, Tabs } from 'antd'; import { Button, PageHeader as AntdPageHeader, Spin, Tabs } from 'antd';
import classNames from 'classnames'; import classNames from 'classnames';
import React, { useContext, useEffect, useState } from 'react'; import React, { useContext, useEffect, useState } from 'react';
@ -8,6 +9,8 @@ import { useTranslation } from 'react-i18next';
import { useHistory, useLocation } from 'react-router-dom'; import { useHistory, useLocation } from 'react-router-dom';
import { useDocumentTitle } from '../../../document-title'; import { useDocumentTitle } from '../../../document-title';
import { Icon } from '../../../icon'; import { Icon } from '../../../icon';
import { DndContext } from '../../common';
import { SortableItem } from '../../common/sortable-item';
import { SchemaComponent, SchemaComponentOptions } from '../../core'; import { SchemaComponent, SchemaComponentOptions } from '../../core';
import { useCompile, useDesignable } from '../../hooks'; import { useCompile, useDesignable } from '../../hooks';
import FixedBlock from './FixedBlock'; import FixedBlock from './FixedBlock';
@ -160,84 +163,91 @@ export const Page = (props) => {
{...others} {...others}
footer={ footer={
enablePageTabs && ( enablePageTabs && (
<Tabs <DndContext>
size={'small'} <Tabs
activeKey={activeKey} size={'small'}
onTabClick={(activeKey) => { activeKey={activeKey}
setLoading(true); onTabClick={(activeKey) => {
setActiveKey(activeKey); setLoading(true);
window.history.pushState({}, '', location.pathname + `?tab=` + activeKey); setActiveKey(activeKey);
setTimeout(() => { window.history.pushState({}, '', location.pathname + `?tab=` + activeKey);
setLoading(false); setTimeout(() => {
}, 50); setLoading(false);
}} }, 50);
tabBarExtraContent={ }}
dn.designable && ( tabBarExtraContent={
<Button dn.designable && (
className={css` <Button
border-color: rgb(241, 139, 98) !important; icon={<PlusOutlined />}
color: rgb(241, 139, 98) !important; className={css`
`} border-color: rgb(241, 139, 98) !important;
type={'dashed'} color: rgb(241, 139, 98) !important;
onClick={async () => { `}
const values = await FormDialog(t('Add tab'), () => { type={'dashed'}
return ( onClick={async () => {
<SchemaComponentOptions scope={options.scope} components={{ ...options.components }}> const values = await FormDialog(t('Add tab'), () => {
<FormLayout layout={'vertical'}> return (
<SchemaComponent <SchemaComponentOptions scope={options.scope} components={{ ...options.components }}>
schema={{ <FormLayout layout={'vertical'}>
properties: { <SchemaComponent
title: { schema={{
title: t('Tab name'), properties: {
'x-component': 'Input', title: {
'x-decorator': 'FormItem', title: t('Tab name'),
required: true, 'x-component': 'Input',
'x-decorator': 'FormItem',
required: true,
},
icon: {
title: t('Icon'),
'x-component': 'IconPicker',
'x-decorator': 'FormItem',
},
}, },
icon: { }}
title: t('Icon'), />
'x-component': 'IconPicker', </FormLayout>
'x-decorator': 'FormItem', </SchemaComponentOptions>
}, );
}, }).open({
}} initialValues: {},
/> });
</FormLayout> const { title, icon } = values;
</SchemaComponentOptions> dn.insertBeforeEnd({
); type: 'void',
}).open({ title,
initialValues: {}, 'x-icon': icon,
}); 'x-component': 'Grid',
const { title, icon } = values; 'x-initializer': 'BlockInitializers',
dn.insertBeforeEnd({ properties: {},
type: 'void', });
title, }}
'x-icon': icon, >
'x-component': 'Grid', Add tab
'x-initializer': 'BlockInitializers', </Button>
properties: {}, )
}); }
}} >
> {fieldSchema.mapProperties((schema) => {
Add tab return (
</Button> <Tabs.TabPane
) tab={
} <SortableItem
> id={schema.name}
{fieldSchema.mapProperties((schema) => { schema={schema}
return ( className={classNames('nb-action-link', designerCss, props.className)}
<Tabs.TabPane >
tab={ {schema['x-icon'] && <Icon style={{ marginRight: 8 }} type={schema['x-icon']} />}
<span className={classNames('nb-action-link', designerCss, props.className)}> <span>{schema.title || t('Unnamed')}</span>
{schema['x-icon'] && <Icon style={{ marginRight: 8 }} type={schema['x-icon']} />} <PageTabDesigner schema={schema} />
<span>{schema.title || t('Unnamed')}</span> </SortableItem>
<PageTabDesigner schema={schema} /> }
</span> key={schema.name}
} />
key={schema.name} );
/> })}
); </Tabs>
})} </DndContext>
</Tabs>
) )
} }
/> />

View File

@ -1,9 +1,9 @@
import { MenuOutlined } from '@ant-design/icons'; import { DragOutlined, MenuOutlined } from '@ant-design/icons';
import { ISchema, useField, useFieldSchema } from '@formily/react'; import { ISchema, useField, useFieldSchema } from '@formily/react';
import { Modal, Space } from 'antd'; import { Modal, Space } from 'antd';
import React from 'react'; import React from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { useDesignable } from '../..'; import { DragHandler, useDesignable } from '../..';
import { SchemaSettings } from '../../../schema-settings'; import { SchemaSettings } from '../../../schema-settings';
export const PageDesigner = ({ title }) => { export const PageDesigner = ({ title }) => {
@ -120,6 +120,9 @@ export const PageTabDesigner = ({ schema }) => {
<div className={'general-schema-designer'}> <div className={'general-schema-designer'}>
<div className={'general-schema-designer-icons'}> <div className={'general-schema-designer-icons'}>
<Space size={2} align={'center'}> <Space size={2} align={'center'}>
<DragHandler>
<DragOutlined />
</DragHandler>
<SchemaSettings title={<MenuOutlined style={{ cursor: 'pointer', fontSize: 12 }} />}> <SchemaSettings title={<MenuOutlined style={{ cursor: 'pointer', fontSize: 12 }} />}>
<SchemaSettings.ModalItem <SchemaSettings.ModalItem
title={t('Edit')} title={t('Edit')}

View File

@ -1,11 +1,11 @@
import { ArrayItems } from '@formily/antd'; import { ArrayItems } from '@formily/antd';
import { ISchema, observer, useField, useFieldSchema } from '@formily/react'; import { ISchema, useField, useFieldSchema } from '@formily/react';
import React, { useEffect } from 'react'; import React from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { useTableBlockContext } from '../../../block-provider'; import { useTableBlockContext } from '../../../block-provider';
import { mergeFilter } from '../../../block-provider/SharedFilterProvider';
import { useCollection } from '../../../collection-manager'; import { useCollection } from '../../../collection-manager';
import { useCollectionFilterOptions, useSortFields } from '../../../collection-manager/action-hooks'; import { useCollectionFilterOptions, useSortFields } from '../../../collection-manager/action-hooks';
import { useRecord } from '../../../record-provider';
import { GeneralSchemaDesigner, SchemaSettings } from '../../../schema-settings'; import { GeneralSchemaDesigner, SchemaSettings } from '../../../schema-settings';
import { useSchemaTemplate } from '../../../schema-templates'; import { useSchemaTemplate } from '../../../schema-templates';
import { useDesignable } from '../../hooks'; import { useDesignable } from '../../hooks';
@ -81,7 +81,11 @@ export const TableBlockDesigner = () => {
params.filter = filter; params.filter = filter;
field.decoratorProps.params = params; field.decoratorProps.params = params;
fieldSchema['x-decorator-props']['params'] = params; fieldSchema['x-decorator-props']['params'] = params;
service.run({ ...service.params?.[0], filter, page: 1 }); const filters = service.params?.[1]?.filters || {};
service.run(
{ ...service.params?.[0], filter: mergeFilter([...Object.values(filters), filter]), page: 1 },
{ filters },
);
dn.emit('patch', { dn.emit('patch', {
schema: { schema: {
['x-uid']: fieldSchema['x-uid'], ['x-uid']: fieldSchema['x-uid'],

View File

@ -38,12 +38,28 @@ export const Sortable = (props: any) => {
); );
}; };
export const SortableItem: React.FC<any> = observer((props) => { const useSortableItemProps = (props) => {
const id = useSortableItemId(props);
if (props.schema) {
return { ...props, id };
}
const schema = useFieldSchema();
return { ...props, id, schema };
};
const useSortableItemId = (props) => {
if (props.id) {
return props.id;
}
const field = useField(); const field = useField();
const fieldSchema = useFieldSchema(); return field.address.toString();
};
export const SortableItem: React.FC<any> = observer((props) => {
const { schema, id, ...others } = useSortableItemProps(props);
return ( return (
<SortableProvider id={field.address.toString()} data={{ insertAdjacent: 'afterEnd', schema: fieldSchema }}> <SortableProvider id={id} data={{ insertAdjacent: 'afterEnd', schema: schema }}>
<Sortable {...props}>{props.children}</Sortable> <Sortable {...others}>{props.children}</Sortable>
</SortableProvider> </SortableProvider>
); );
}); });

View File

@ -13,7 +13,7 @@ import { ActionContext, SchemaComponent, useActionContext } from '../schema-comp
const langs = Object.keys(locale).map((lang) => { const langs = Object.keys(locale).map((lang) => {
return { return {
label: locale[lang].label, label: `${locale[lang].label} (${lang})`,
value: lang, value: lang,
}; };
}); });

View File

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -1,14 +1,8 @@
{ {
"name": "create-nocobase-app", "name": "create-nocobase-app",
"version": "0.8.1-alpha.4", "version": "0.9.0-alpha.2",
"main": "src/index.js", "main": "src/index.js",
"license": "Apache-2.0", "license": "Apache-2.0",
"licenses": [
{
"type": "Apache-2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0"
}
],
"dependencies": { "dependencies": {
"@umijs/utils": "^3.5.20", "@umijs/utils": "^3.5.20",
"axios": "^0.26.1", "axios": "^0.26.1",

View File

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -1,18 +1,12 @@
{ {
"name": "@nocobase/database", "name": "@nocobase/database",
"version": "0.8.1-alpha.4", "version": "0.9.0-alpha.2",
"description": "", "description": "",
"main": "./lib/index.js", "main": "./lib/index.js",
"types": "./lib/index.d.ts", "types": "./lib/index.d.ts",
"license": "Apache-2.0", "license": "Apache-2.0",
"licenses": [
{
"type": "Apache-2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0"
}
],
"dependencies": { "dependencies": {
"@nocobase/utils": "0.8.1-alpha.4", "@nocobase/utils": "0.9.0-alpha.2",
"async-mutex": "^0.3.2", "async-mutex": "^0.3.2",
"cron-parser": "4.4.0", "cron-parser": "4.4.0",
"deepmerge": "^4.2.2", "deepmerge": "^4.2.2",

View File

@ -0,0 +1,73 @@
import { Database } from '../database';
import { mockDatabase } from './';
describe('update through', () => {
let db: Database;
beforeEach(async () => {
db = mockDatabase();
await db.clean({ drop: true });
});
afterEach(async () => {
await db.close();
});
it('should not be reset', async () => {
db.collection({
name: 'c',
autoGenId: true,
fields: [
{
name: 'id',
type: 'integer',
primaryKey: true,
autoIncrement: true,
},
],
});
db.collection({
name: 'a',
fields: [
{
type: 'string',
name: 'name',
},
{
type: 'belongsToMany',
name: 'b',
target: 'b',
through: 'c',
},
],
});
db.collection({
name: 'b',
fields: [],
});
await db.sync();
const callback1 = jest.fn();
const callback2 = jest.fn();
db.on('c.afterCreate', callback1);
db.on('c.afterBulkCreate', callback2);
const b = await db.getRepository('b').create({
values: {},
});
const a = await db.getRepository('a').create({
values: {
b: [b.toJSON()],
},
});
const c1 = await db.getRepository('c').findOne();
await db.getRepository('a').update({
filterByTk: a.id,
values: {
b: [b.toJSON()],
},
});
const c2 = await db.getRepository('c').findOne();
expect(c1.get('id')).toBe(c2.get('id'));
expect(callback1).toHaveBeenCalledTimes(1);
expect(callback2).toHaveBeenCalledTimes(1);
});
});

View File

@ -3,11 +3,11 @@ import { EventEmitter } from 'events';
import { default as lodash, default as _ } from 'lodash'; import { default as lodash, default as _ } from 'lodash';
import { import {
ModelOptions, ModelOptions,
ModelStatic,
QueryInterfaceDropTableOptions, QueryInterfaceDropTableOptions,
SyncOptions, SyncOptions,
Transactionable, Transactionable,
ModelStatic, Utils
Utils,
} from 'sequelize'; } from 'sequelize';
import { Database } from './database'; import { Database } from './database';
import { Field, FieldOptions } from './fields'; import { Field, FieldOptions } from './fields';
@ -62,6 +62,10 @@ export class Collection<
return this.options.name; return this.options.name;
} }
get titleField() {
return (this.options.titleField as string) || this.model.primaryKeyAttribute;
}
get db() { get db() {
return this.context.database; return this.context.database;
} }

View File

@ -16,6 +16,10 @@ export type ModelCreateWithAssociationsEventType = 'afterCreateWithAssociations'
export type ModelUpdateWithAssociationsEventType = 'afterUpdateWithAssociations'; export type ModelUpdateWithAssociationsEventType = 'afterUpdateWithAssociations';
export type ModelSaveWithAssociationsEventType = 'afterSaveWithAssociations'; export type ModelSaveWithAssociationsEventType = 'afterSaveWithAssociations';
export type ModelBulkCreateEvnetType = 'beforeBulkCreate' | 'afterBulkCreate';
export type ModelBulkUpdateEvnetType = 'beforeBulkUpdate' | 'afterBulkUpdate';
export type ModelBulkDestroyEvnetType = 'beforeBulkDestroy' | 'afterBulkDestroy';
export type ModelValidateEventTypes = ModelValidateEventType | `${CollectionNameType}.${ModelValidateEventType}`; export type ModelValidateEventTypes = ModelValidateEventType | `${CollectionNameType}.${ModelValidateEventType}`;
export type ModelCreateEventTypes = ModelCreateEventType | `${CollectionNameType}.${ModelCreateEventType}`; export type ModelCreateEventTypes = ModelCreateEventType | `${CollectionNameType}.${ModelCreateEventType}`;
export type ModelUpdateEventTypes = ModelUpdateEventType | `${CollectionNameType}.${ModelUpdateEventType}`; export type ModelUpdateEventTypes = ModelUpdateEventType | `${CollectionNameType}.${ModelUpdateEventType}`;
@ -25,6 +29,10 @@ export type ModelCreateWithAssociationsEventTypes = ModelCreateWithAssociationsE
export type ModelUpdateWithAssociationsEventTypes = ModelUpdateWithAssociationsEventType | `${CollectionNameType}.${ModelUpdateWithAssociationsEventType}`; export type ModelUpdateWithAssociationsEventTypes = ModelUpdateWithAssociationsEventType | `${CollectionNameType}.${ModelUpdateWithAssociationsEventType}`;
export type ModelSaveWithAssociationsEventTypes = ModelSaveWithAssociationsEventType | `${CollectionNameType}.${ModelSaveWithAssociationsEventType}`; export type ModelSaveWithAssociationsEventTypes = ModelSaveWithAssociationsEventType | `${CollectionNameType}.${ModelSaveWithAssociationsEventType}`;
export type ModelBulkCreateEvnetTypes = ModelBulkCreateEvnetType | `${CollectionNameType}.${ModelBulkCreateEvnetType}`;
export type ModelBulkUpdateEvnetTypes = ModelBulkUpdateEvnetType | `${CollectionNameType}.${ModelBulkUpdateEvnetType}`;
export type ModelBulkDestroyEvnetTypes = ModelBulkDestroyEvnetType | `${CollectionNameType}.${ModelBulkDestroyEvnetType}`;
export type ModelEventTypes = ModelSyncEventType export type ModelEventTypes = ModelSyncEventType
| ModelValidateEventTypes | ModelValidateEventTypes
| ModelCreateEventTypes | ModelCreateEventTypes
@ -33,7 +41,10 @@ export type ModelEventTypes = ModelSyncEventType
| ModelDestroyEventTypes | ModelDestroyEventTypes
| ModelCreateWithAssociationsEventTypes | ModelCreateWithAssociationsEventTypes
| ModelUpdateWithAssociationsEventTypes | ModelUpdateWithAssociationsEventTypes
| ModelSaveWithAssociationsEventTypes; | ModelSaveWithAssociationsEventTypes
| ModelBulkCreateEvnetTypes
| ModelBulkUpdateEvnetTypes
| ModelBulkDestroyEvnetTypes;
export type DatabaseBeforeDefineCollectionEventType = 'beforeDefineCollection'; export type DatabaseBeforeDefineCollectionEventType = 'beforeDefineCollection';
export type DatabaseAfterDefineCollectionEventType = 'afterDefineCollection'; export type DatabaseAfterDefineCollectionEventType = 'afterDefineCollection';

View File

@ -6,7 +6,7 @@ import {
HasOne, HasOne,
Hookable, Hookable,
ModelStatic, ModelStatic,
Transactionable, Transactionable
} from 'sequelize'; } from 'sequelize';
import { Model } from './model'; import { Model } from './model';
import { UpdateGuard } from './update-guard'; import { UpdateGuard } from './update-guard';
@ -392,7 +392,7 @@ export async function updateMultipleAssociation(
} }
if (isStringOrNumber(value)) { if (isStringOrNumber(value)) {
await model[setAccessor](value, { transaction, context }); await model[setAccessor](value, { transaction, context, individualHooks: true });
return; return;
} }
@ -402,6 +402,7 @@ export async function updateMultipleAssociation(
const list1 = []; // to be setted const list1 = []; // to be setted
const list2 = []; // to be added const list2 = []; // to be added
const created = [];
for (const item of value) { for (const item of value) {
if (isUndefinedOrNull(item)) { if (isUndefinedOrNull(item)) {
continue; continue;
@ -413,12 +414,17 @@ export async function updateMultipleAssociation(
} else if (item.sequelize) { } else if (item.sequelize) {
list1.push(item); list1.push(item);
} else if (typeof item === 'object') { } else if (typeof item === 'object') {
const targetKey = (association as any).targetKey || 'id';
if (item[targetKey]) {
created.push(item[targetKey]);
list1.push(item[targetKey]);
}
list2.push(item); list2.push(item);
} }
} }
// associate targets in lists1 // associate targets in lists1
await model[setAccessor](list1, { transaction, context }); await model[setAccessor](list1, { transaction, context, individualHooks: true });
const list3 = []; const list3 = [];
for (const item of list2) { for (const item of list2) {
@ -456,8 +462,9 @@ export async function updateMultipleAssociation(
continue; continue;
} }
const addAccessor = association.accessors.add; const addAccessor = association.accessors.add;
if (!created.includes(item[pk])) {
await model[addAccessor](item[pk], accessorOptions); await model[addAccessor](item[pk], accessorOptions);
}
if (!recursive) { if (!recursive) {
continue; continue;
} }

View File

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -1,17 +1,11 @@
{ {
"name": "@nocobase/devtools", "name": "@nocobase/devtools",
"version": "0.8.1-alpha.4", "version": "0.9.0-alpha.2",
"description": "", "description": "",
"license": "Apache-2.0", "license": "Apache-2.0",
"licenses": [
{
"type": "Apache-2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0"
}
],
"main": "./src/index.js", "main": "./src/index.js",
"dependencies": { "dependencies": {
"@nocobase/build": "0.8.1-alpha.4", "@nocobase/build": "0.9.0-alpha.2",
"@testing-library/react": "^12.1.2", "@testing-library/react": "^12.1.2",
"@types/jest": "^26.0.0", "@types/jest": "^26.0.0",
"@types/koa": "^2.13.4", "@types/koa": "^2.13.4",

View File

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -1,6 +1,6 @@
{ {
"name": "dumi-theme-nocobase", "name": "dumi-theme-nocobase",
"version": "0.8.1-alpha.4", "version": "0.9.0-alpha.2",
"private": true, "private": true,
"files": [ "files": [
"es", "es",

View File

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -1,14 +1,8 @@
{ {
"name": "@nocobase/logger", "name": "@nocobase/logger",
"version": "0.8.1-alpha.4", "version": "0.9.0-alpha.2",
"description": "nocobase logging library", "description": "nocobase logging library",
"license": "Apache-2.0", "license": "Apache-2.0",
"licenses": [
{
"type": "Apache-2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0"
}
],
"main": "./lib/index.js", "main": "./lib/index.js",
"types": "./lib/index.d.ts", "types": "./lib/index.d.ts",
"repository": { "repository": {

View File

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -1,18 +1,12 @@
{ {
"name": "@nocobase/resourcer", "name": "@nocobase/resourcer",
"version": "0.8.1-alpha.4", "version": "0.9.0-alpha.2",
"description": "", "description": "",
"main": "./lib/index.js", "main": "./lib/index.js",
"types": "./lib/index.d.ts", "types": "./lib/index.d.ts",
"license": "Apache-2.0", "license": "Apache-2.0",
"licenses": [
{
"type": "Apache-2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0"
}
],
"dependencies": { "dependencies": {
"@nocobase/utils": "0.8.1-alpha.4", "@nocobase/utils": "0.9.0-alpha.2",
"deepmerge": "^4.2.2", "deepmerge": "^4.2.2",
"koa-compose": "^4.1.0", "koa-compose": "^4.1.0",
"lodash": "^4.17.21", "lodash": "^4.17.21",

201
packages/core/sdk/LICENSE Normal file
View File

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -1,13 +1,7 @@
{ {
"name": "@nocobase/sdk", "name": "@nocobase/sdk",
"version": "0.8.1-alpha.4", "version": "0.9.0-alpha.2",
"license": "Apache-2.0", "license": "Apache-2.0",
"licenses": [
{
"type": "Apache-2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0"
}
],
"main": "lib", "main": "lib",
"module": "es/index.js", "module": "es/index.js",
"typings": "es/index.d.ts", "typings": "es/index.d.ts",

View File

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -1,28 +1,22 @@
{ {
"name": "@nocobase/server", "name": "@nocobase/server",
"version": "0.8.1-alpha.4", "version": "0.9.0-alpha.2",
"main": "lib/index.js", "main": "lib/index.js",
"types": "./lib/index.d.ts", "types": "./lib/index.d.ts",
"license": "Apache-2.0", "license": "Apache-2.0",
"licenses": [
{
"type": "Apache-2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0"
}
],
"dependencies": { "dependencies": {
"@hapi/topo": "^6.0.0", "@hapi/topo": "^6.0.0",
"@koa/cors": "^3.1.0", "@koa/cors": "^3.1.0",
"@koa/router": "^9.4.0", "@koa/router": "^9.4.0",
"@nocobase/acl": "0.8.1-alpha.4", "@nocobase/acl": "0.9.0-alpha.2",
"@nocobase/actions": "0.8.1-alpha.4", "@nocobase/actions": "0.9.0-alpha.2",
"@nocobase/database": "0.8.1-alpha.4", "@nocobase/database": "0.9.0-alpha.2",
"@nocobase/logger": "0.8.1-alpha.4", "@nocobase/logger": "0.9.0-alpha.2",
"@nocobase/resourcer": "0.8.1-alpha.4", "@nocobase/resourcer": "0.9.0-alpha.2",
"chalk": "^4.1.1", "chalk": "^4.1.1",
"commander": "^9.2.0", "commander": "^9.2.0",
"find-package-json": "^1.2.0", "find-package-json": "^1.2.0",
"i18next": "^21.6.0", "i18next": "^22.4.9",
"koa": "^2.13.4", "koa": "^2.13.4",
"koa-bodyparser": "^4.3.0", "koa-bodyparser": "^4.3.0",
"koa-static": "^5.0.0", "koa-static": "^5.0.0",

View File

@ -2,12 +2,16 @@ export async function i18n(ctx, next) {
const i18n = ctx.app.i18n.cloneInstance({ initImmediate: false }); const i18n = ctx.app.i18n.cloneInstance({ initImmediate: false });
ctx.i18n = i18n; ctx.i18n = i18n;
ctx.t = i18n.t.bind(i18n); ctx.t = i18n.t.bind(i18n);
const lng = ctx.getCurrentLocale = () => {
ctx.get('X-Locale') || const lng =
(ctx.request.query.locale as string) || ctx.get('X-Locale') ||
ctx.app.i18n.language || (ctx.request.query.locale as string) ||
ctx.acceptsLanguages().shift() || ctx.app.i18n.language ||
'en-US'; ctx.acceptsLanguages().shift() ||
'en-US';
return lng;
};
const lng = ctx.getCurrentLocale();
if (lng !== '*' && lng) { if (lng !== '*' && lng) {
i18n.changeLanguage(lng); i18n.changeLanguage(lng);
} }

201
packages/core/test/LICENSE Normal file
View File

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Some files were not shown because too many files have changed in this diff Show More