Compare commits
7 commits
Author | SHA1 | Date | |
---|---|---|---|
d41973ca52 | |||
dd551f8344 | |||
531190b4a1 | |||
0f55663304 | |||
4a62e9ecba | |||
a5783618c5 | |||
587441baac |
554 changed files with 31908 additions and 40800 deletions
Binary file not shown.
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,2 +1 @@
|
||||||
p.py
|
p.py
|
||||||
__pycache__
|
|
1205
.vscode/PythonImportHelper-v2-Completion.json
vendored
1205
.vscode/PythonImportHelper-v2-Completion.json
vendored
File diff suppressed because it is too large
Load diff
74
.vscode/launch.json
vendored
74
.vscode/launch.json
vendored
|
@ -1,36 +1,40 @@
|
||||||
{
|
{
|
||||||
"version": "0.2.0",
|
// Use IntelliSense to learn about possible attributes.
|
||||||
"configurations": [
|
// Hover to view descriptions of existing attributes.
|
||||||
{
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
"type": "node",
|
"version": "0.2.0",
|
||||||
"request": "launch",
|
|
||||||
"name": "server-dev",
|
"configurations": [
|
||||||
"runtimeExecutable": "npm",
|
|
||||||
"runtimeArgs": ["run-script", "dev"],
|
{
|
||||||
"cwd": "${workspaceRoot}/server/"
|
"type": "node",
|
||||||
},
|
"request": "launch",
|
||||||
{
|
"name": "server-dev",
|
||||||
"type": "node",
|
"runtimeExecutable": "npm",
|
||||||
"request": "launch",
|
"runtimeArgs": [
|
||||||
"name": "server-test-watch",
|
"run-script", "dev"
|
||||||
"runtimeExecutable": "npm",
|
],
|
||||||
"runtimeArgs": ["run-script", "test:watch"],
|
"cwd": "${workspaceRoot}/server/",
|
||||||
"cwd": "${workspaceRoot}/server/"
|
},
|
||||||
},
|
{
|
||||||
{
|
"type": "node",
|
||||||
"type": "node",
|
"request": "launch",
|
||||||
"request": "launch",
|
"name": "server-test-watch",
|
||||||
"name": "ui-dev",
|
"runtimeExecutable": "npm",
|
||||||
"runtimeExecutable": "npm",
|
"runtimeArgs": [
|
||||||
"runtimeArgs": ["run-script", "dev"],
|
"run-script", "test:watch"
|
||||||
"cwd": "${workspaceRoot}/ui/"
|
],
|
||||||
},
|
"cwd": "${workspaceRoot}/server/",
|
||||||
{
|
},
|
||||||
"type": "chrome",
|
{
|
||||||
"request": "launch",
|
"type": "node",
|
||||||
"name": "Launch debug chrome",
|
"request": "launch",
|
||||||
"url": "http://localhost:3000",
|
"name": "ui-dev",
|
||||||
"webRoot": "${workspaceFolder}"
|
"runtimeExecutable": "npm",
|
||||||
}
|
"runtimeArgs": [
|
||||||
]
|
"run-script", "dev"
|
||||||
}
|
],
|
||||||
|
"cwd": "${workspaceRoot}/ui/",
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
33
.vscode/settings.json
vendored
33
.vscode/settings.json
vendored
|
@ -1,35 +1,6 @@
|
||||||
{
|
{
|
||||||
"cSpell.words": [
|
"cSpell.words": [
|
||||||
"введите",
|
|
||||||
"Ведите",
|
"Ведите",
|
||||||
"дерево",
|
"typedataset"
|
||||||
"Количество",
|
]
|
||||||
"модели",
|
|
||||||
"может",
|
|
||||||
"навык",
|
|
||||||
"Новое",
|
|
||||||
"отрицательное",
|
|
||||||
"принимать",
|
|
||||||
"скила",
|
|
||||||
"создано",
|
|
||||||
"число",
|
|
||||||
"эпох",
|
|
||||||
"эпоха",
|
|
||||||
"Collada",
|
|
||||||
"Contolls",
|
|
||||||
"GLTF",
|
|
||||||
"grau",
|
|
||||||
"idontsudo",
|
|
||||||
"raycaster",
|
|
||||||
"skils",
|
|
||||||
"typedataset",
|
|
||||||
"URDF",
|
|
||||||
"usecases"
|
|
||||||
],
|
|
||||||
"files.exclude": {
|
|
||||||
"**/.git": false,
|
|
||||||
"**/.svn": false,
|
|
||||||
"**/.hg": false,
|
|
||||||
"**/CVS": false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
674
LICENSE
674
LICENSE
|
@ -1,674 +0,0 @@
|
||||||
GNU GENERAL PUBLIC LICENSE
|
|
||||||
Version 3, 29 June 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 General Public License is a free, copyleft license for
|
|
||||||
software and other kinds of works.
|
|
||||||
|
|
||||||
The licenses for most software and other practical works are designed
|
|
||||||
to take away your freedom to share and change the works. By contrast,
|
|
||||||
the GNU General Public License is 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. We, the Free Software Foundation, use the
|
|
||||||
GNU General Public License for most of our software; it applies also to
|
|
||||||
any other work released this way by its authors. You can apply it to
|
|
||||||
your programs, too.
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
To protect your rights, we need to prevent others from denying you
|
|
||||||
these rights or asking you to surrender the rights. Therefore, you have
|
|
||||||
certain responsibilities if you distribute copies of the software, or if
|
|
||||||
you modify it: responsibilities to respect the freedom of others.
|
|
||||||
|
|
||||||
For example, if you distribute copies of such a program, whether
|
|
||||||
gratis or for a fee, you must pass on to the recipients the same
|
|
||||||
freedoms that you received. You must make sure that they, too, receive
|
|
||||||
or can get the source code. And you must show them these terms so they
|
|
||||||
know their rights.
|
|
||||||
|
|
||||||
Developers that use the GNU GPL protect your rights with two steps:
|
|
||||||
(1) assert copyright on the software, and (2) offer you this License
|
|
||||||
giving you legal permission to copy, distribute and/or modify it.
|
|
||||||
|
|
||||||
For the developers' and authors' protection, the GPL clearly explains
|
|
||||||
that there is no warranty for this free software. For both users' and
|
|
||||||
authors' sake, the GPL requires that modified versions be marked as
|
|
||||||
changed, so that their problems will not be attributed erroneously to
|
|
||||||
authors of previous versions.
|
|
||||||
|
|
||||||
Some devices are designed to deny users access to install or run
|
|
||||||
modified versions of the software inside them, although the manufacturer
|
|
||||||
can do so. This is fundamentally incompatible with the aim of
|
|
||||||
protecting users' freedom to change the software. The systematic
|
|
||||||
pattern of such abuse occurs in the area of products for individuals to
|
|
||||||
use, which is precisely where it is most unacceptable. Therefore, we
|
|
||||||
have designed this version of the GPL to prohibit the practice for those
|
|
||||||
products. If such problems arise substantially in other domains, we
|
|
||||||
stand ready to extend this provision to those domains in future versions
|
|
||||||
of the GPL, as needed to protect the freedom of users.
|
|
||||||
|
|
||||||
Finally, every program is threatened constantly by software patents.
|
|
||||||
States should not allow patents to restrict development and use of
|
|
||||||
software on general-purpose computers, but in those that do, we wish to
|
|
||||||
avoid the special danger that patents applied to a free program could
|
|
||||||
make it effectively proprietary. To prevent this, the GPL assures that
|
|
||||||
patents cannot be used to render the program non-free.
|
|
||||||
|
|
||||||
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 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. Use with the GNU Affero General Public License.
|
|
||||||
|
|
||||||
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 Affero 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 special requirements of the GNU Affero General Public License,
|
|
||||||
section 13, concerning interaction through a network will apply to the
|
|
||||||
combination as such.
|
|
||||||
|
|
||||||
14. Revised Versions of this License.
|
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions of
|
|
||||||
the GNU 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 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 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 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) 2024 Igor Brylev
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU 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 General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU 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 the program does terminal interaction, make it output a short
|
|
||||||
notice like this when it starts in an interactive mode:
|
|
||||||
|
|
||||||
<program> Copyright (C) 2024 Igor Brylev
|
|
||||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
|
||||||
This is free software, and you are welcome to redistribute it
|
|
||||||
under certain conditions; type `show c' for details.
|
|
||||||
|
|
||||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
|
||||||
parts of the General Public License. Of course, your program's commands
|
|
||||||
might be different; for a GUI interface, you would use an "about box".
|
|
||||||
|
|
||||||
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 GPL, see
|
|
||||||
<https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
The GNU General Public License does not permit incorporating your program
|
|
||||||
into proprietary programs. If your program is a subroutine library, you
|
|
||||||
may consider it more useful to permit linking proprietary applications with
|
|
||||||
the library. If this is what you want to do, use the GNU Lesser General
|
|
||||||
Public License instead of this License. But first, please read
|
|
||||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
|
81
README.md
81
README.md
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
Каждая фаза жизненного цикла имеет своё представление в виде страницы в веб-сервисе:
|
Каждая фаза жизненного цикла имеет своё представление в виде страницы в веб-сервисе:
|
||||||
|
|
||||||
1. Создание проекта сборки, загрузка CAD-проекта изделия - "Проекты"
|
1. Создание проекта сборки, загрузка CAD-проекта изделия - "Проекты", вкладки "Детали", "Сборки"
|
||||||
2. Подготовка и генерация датасета для навыков машинного зрения - Вкладка "Датасеты"
|
2. Подготовка и генерация датасета для навыков машинного зрения - Вкладка "Датасеты"
|
||||||
3. Конфигурация сцены - Scene Builder - Вкладка "Сцена"
|
3. Конфигурация сцены - Scene Builder - Вкладка "Сцена"
|
||||||
4. Создание дерева поведения из навыков - Вкладка "Поведение"
|
4. Создание дерева поведения из навыков - Вкладка "Поведение"
|
||||||
|
@ -23,74 +23,37 @@
|
||||||
|
|
||||||
## Требования
|
## Требования
|
||||||
|
|
||||||
- Node.js (версия >= 20.11.1)
|
- Node.js
|
||||||
- MongoDB (версия >= 7.0.15)
|
- MongoDB
|
||||||
- BlenderProc (для генерации датасетов)
|
- BlenderProc (для генерации датасетов)
|
||||||
|
|
||||||
## Последовательность команд для установки зависимостей
|
## Клонирование проекта
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# установка nvm
|
|
||||||
curl --silent -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.2/install.sh | bash
|
|
||||||
source ~/.bashrc
|
|
||||||
# установка Node.js
|
|
||||||
nvm install 20.11.1
|
|
||||||
nvm alias default 20.11.1
|
|
||||||
nvm use default
|
|
||||||
|
|
||||||
# MongoDB
|
|
||||||
# импортировать открытый ключ для MongoDB
|
|
||||||
curl -fsSL https://pgp.mongodb.com/server-7.0.asc | sudo gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg --dearmor
|
|
||||||
# добавить репозиторий MongoDB 7.0 в директорию /etc/apt/sources.list.d
|
|
||||||
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list
|
|
||||||
# установка MongoDB
|
|
||||||
apt-get update && apt-get install -y mongodb-org
|
|
||||||
# запуск
|
|
||||||
sudo systemctl start mongod
|
|
||||||
```
|
|
||||||
Убедиться в том, что сервер MongoDB работает, можно посмотрев его состояние:
|
|
||||||
```bash
|
|
||||||
sudo systemctl status mongod
|
|
||||||
```
|
|
||||||
Статус должен быть 'active'
|
|
||||||
```
|
|
||||||
● mongod.service - MongoDB Database Server
|
|
||||||
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
|
|
||||||
Active: active (running) since Wed 2024-12-11 10:34:58 MSK; 1h 24min ago
|
|
||||||
Docs: https://docs.mongodb.org/manual
|
|
||||||
Main PID: 2439 (mongod)
|
|
||||||
Memory: 256.7M
|
|
||||||
CPU: 24.168s
|
|
||||||
CGroup: /system.slice/mongod.service
|
|
||||||
└─2439 /usr/bin/mongod --config /etc/mongod.conf
|
|
||||||
```
|
|
||||||
|
|
||||||
## Установка веб-сервиса
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# клонирование исходников
|
|
||||||
cd ~/
|
|
||||||
git clone https://gitlab.com/robossembler/webservice
|
git clone https://gitlab.com/robossembler/webservice
|
||||||
# сборка сервера
|
|
||||||
cd webservice/server
|
|
||||||
npm i tsc-watch -g
|
|
||||||
npm i
|
|
||||||
# сборка фронтэнда
|
|
||||||
cd ..
|
|
||||||
cd ui
|
|
||||||
npm i
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Запуск веб-сервиса
|
## Настройка переменных окружения
|
||||||
|
|
||||||
|
Для работы Генератора Датасетов нужно задать следующие переменные в окружении `bash`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export PYTHON_BLENDER="путь_к_директории_с_файлами_из_rcg_pipeline"
|
||||||
|
export PYTHON_BLENDER_PROC="путь_к_генератору_датасетов_renderBOPdataset.py"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Запуск сервера
|
||||||
|
|
||||||
|
Из директории `server` в корне репозитория
|
||||||
|
|
||||||
Необходимо открыть два терминала. В первом нужно запустить сервер:
|
|
||||||
```bash
|
```bash
|
||||||
cd ~/webservice/server
|
|
||||||
npm run dev
|
npm run dev
|
||||||
```
|
```
|
||||||
Во втором запустить UI:
|
|
||||||
|
## Сборка и запуск UI
|
||||||
|
|
||||||
|
Из директории `ui` в корне репозитория
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd ~/webservice/ui
|
npm i && npm run build && npm run deploy
|
||||||
npm run dev
|
|
||||||
```
|
```
|
||||||
Если установка была успешной, откроется браузер, на странице http://localhost:3000/ "Проекты".
|
|
||||||
|
|
150
docs/entities.md
Normal file
150
docs/entities.md
Normal file
|
@ -0,0 +1,150 @@
|
||||||
|
# Сущности фреймворка применительно к веб-сервису
|
||||||
|
|
||||||
|
Веб-сервис позволяет добавить типы Моделей для запуска цифрового двойника (DT), навыка, процесса или дерева поведения. Модели оформляются в виде пакетов. Пакет - это условный "контейнер" для запуска этой сущности в командной строке. Схема пакета общая для всех сущностей. Различны только данные/аргументы. Все вводимые поля, кроме первого (command), могут быть пустыми.
|
||||||
|
|
||||||
|
Типы пакетов:
|
||||||
|
|
||||||
|
- Процессы - "computing_process" - вычислительные процессы, не требующие взаимодействия в ходе исполнения (нет интерфейсов)
|
||||||
|
- Навыки (Серверы навыков) - "skill_server" - произвольные ROS 2 пакеты
|
||||||
|
- Деревья поведения - "behavior_tree" - то, что исполняется нашим ROS 2 bt_executor
|
||||||
|
- Цифровые двойники - "digital_twin" - драйверы устройств, имеющие интерфейс ROS 2
|
||||||
|
|
||||||
|
Нужно создать в веб-сервисе сущность/класс "Пакет", от которой будут наследоваться "Процесс", "Навык", "Цифровой двойник" (устройство/твёрдое тело/точка/воркспейс - всё, что добавляется в Scene Builder), "Дерево поведения". Пакеты будут создаваться в веб-интерфейсе в самом начальном разделе (где проекты, процессы, навыки).
|
||||||
|
|
||||||
|
## Примеры
|
||||||
|
|
||||||
|
Пример для процесса (Генератор датасетов)
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"sid": 1,
|
||||||
|
"type": "computing_process",
|
||||||
|
"description": "Robossembler Dataset Generator",
|
||||||
|
"command": "blenderproc",
|
||||||
|
"package": "dataset_generator.py",
|
||||||
|
"executable": "",
|
||||||
|
"args": {
|
||||||
|
"folder": \${NAME:string:""},
|
||||||
|
},
|
||||||
|
"interfaces": "" // у процессов нет интерфейсов
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Пример для цифрового двойника (ROS драйвер для камеры)
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"sid": 2,
|
||||||
|
"type": "digital_twin",
|
||||||
|
"description": "ROS Wrapper for Intel RealSense Cameras",
|
||||||
|
"command": "ros2 launch",
|
||||||
|
"package": "realsense2_camera",
|
||||||
|
"executable": "rs_launch.py",
|
||||||
|
"args": {
|
||||||
|
"camera_namespace": \${NAME:string:""},
|
||||||
|
"camera_name": \${NAME:string:""},
|
||||||
|
},
|
||||||
|
"interfaces": {
|
||||||
|
"cmd": "python ros2_topic_to_json.py"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Пример для навыка (pose estimation skill server)
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"sid": 3,
|
||||||
|
"type": "skill_server",
|
||||||
|
"description": "Pose Estimation Skill Dope 6D",
|
||||||
|
"command": "ros2 launch",
|
||||||
|
"package": "dope6d",
|
||||||
|
"executable": "dope.py",
|
||||||
|
"args": {
|
||||||
|
"param1": \${NAME:string:""},
|
||||||
|
"param2": \${STRUCTURE:json:""},
|
||||||
|
"param3": \${INT:string:""},
|
||||||
|
"image_raw": \${TOPIC:CameraInfo:""},
|
||||||
|
},
|
||||||
|
"interfaces": {
|
||||||
|
"cmd": "python ros2_topic_to_json.py"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Пример для дерева (behaviour tree)
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"sid": 4,
|
||||||
|
"type": "behaviour_tree",
|
||||||
|
"description": "Behaviour tree executor",
|
||||||
|
"command": "ros2 launch",
|
||||||
|
"package": "rbs-bt",
|
||||||
|
"executable": "bt_executor",
|
||||||
|
"args": {
|
||||||
|
"xml": \${NAME:string:""},
|
||||||
|
"json": \${NAME:string:""}
|
||||||
|
},
|
||||||
|
"interfaces": {
|
||||||
|
"cmd": "python skills_interfaces_to_json.py [args]",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Пример цифрового двойника камеры
|
||||||
|
|
||||||
|
1. В главном меню создаётся новый тип для сущности "Цифровой двойник" (см. схему выше)
|
||||||
|
2. После создания проекта на экране "Scene Builder" эти цифровые двойники добавляются и конфигурируются. Веб-сервис формирует таблицу цифровых двойников.
|
||||||
|
|
||||||
|
Экземпляр Камеры №1
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"sid": 0,
|
||||||
|
"package_model": 2, // ссылка на модель данного пакета
|
||||||
|
"args": {
|
||||||
|
"camera_namespace": "cv",
|
||||||
|
"camera_name": "camera1",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
Экземпляр Камеры №2
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"sid": 1,
|
||||||
|
"package_model": 2, // ссылка на модель данного пакета
|
||||||
|
"args": {
|
||||||
|
"camera_namespace": "cv",
|
||||||
|
"camera_name": "camera2",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
3. После завершения конфигурации цифрового двойника Backend фоново запускает команду `get_interfaces.py --json={}`, где json - это набор параметров двойника для данного экземпляра. Программа `get_interfaces.py --json={}` внутри будет запускать субпроцесс вида `<command> <package> <executable> <key1>:=<value1> <key2>:=<value2>` и после запуска получать перечень интерфейсов, после чего возвращает веб-сервису все топики и их типы в системе. Веб-сервис записывает их в таблицу. Структура таблицы БД: `parent` (ссылка на экземпляр цифрового двойника из п.2), `topic_name` (строка или path), `msg_type` (строка), `hash` (хеш, пока не будет использоваться, оставлять пустым по дефолту). Все изменения в Scene Builder должны быть синхронизированы с БД. Если устройство удаляется из сцены, то её интерфейсы также удаляются из таблицы по parent'у.
|
||||||
|
|
||||||
|
## Пример навыка
|
||||||
|
|
||||||
|
1-3. см. предыдущий пример (вместо "Цифровой двойник" - "Навык", вместо Scene Builder - BT Builder, вместо Сцены - Холст). При конфигурации навыка пользователь видит только те топики, которые поддерживают данный тип интерфейса (то есть из цифровых двойников или других источников данных). При удалении данного навыка с холста, его интерфейсы удаляются из таблицы.
|
||||||
|
|
||||||
|
## Виды цифровых двойников (в разработке)
|
||||||
|
|
||||||
|
Parts:
|
||||||
|
`/parts/bolt_x/mesh_path [std_msgs/FilePath]`
|
||||||
|
`/parts/bolt_x/pose_6d [geometry_msgs/Pose]`
|
||||||
|
`/parts/bolt_x/bound_box [geometry_msgs/BoundBox]`
|
||||||
|
`/parts/bolt_x/grasp_pose [geometry_msgs/PoseArray]`
|
||||||
|
|
||||||
|
Wrist Cameras
|
||||||
|
`/robot_1/camera_rgb/camera_info [sensor_msgs/CameraInfo]`
|
||||||
|
`/robot_1/camera_rgbd/camera_info [sensor_msgs/CameraInfo]`
|
||||||
|
|
||||||
|
Robots + Controllers
|
||||||
|
`/robot_1/joint_trajectory_controller [sensor_msgs/CameraInfo]` // moveit
|
||||||
|
`/robot_2/move_cartesian [rbs_skill_interfaces/MoveItSendPose]` // cartesian
|
||||||
|
|
||||||
|
Assemblies:
|
||||||
|
`/assemblies/...`
|
||||||
|
|
||||||
|
Environment
|
||||||
|
`/environment/...`
|
||||||
|
|
||||||
|
Static:
|
||||||
|
`/camera/camera_info []`
|
293
docs/example.md
Normal file
293
docs/example.md
Normal file
|
@ -0,0 +1,293 @@
|
||||||
|
# Пример: проект "Шахматы"
|
||||||
|
|
||||||
|
Имеем доску, две модели фигур - коня и пешку, робота, камеру. Задачей будет из фигур в наличии расставить шахматы на доску в начальную позицию.
|
||||||
|
|
||||||
|
## Создаём проект
|
||||||
|
* Projects
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"sid": 1,
|
||||||
|
"name": "chess",
|
||||||
|
"description": "Robossembler Example"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Добавляем модели твёрдых тел (фигур и доски) в библиотеку проекта
|
||||||
|
Сначала добавляются пакеты:
|
||||||
|
|
||||||
|
* Packages
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"sid": 1,
|
||||||
|
"project": 1,
|
||||||
|
"type": "part_model",
|
||||||
|
"description": "Robossembler: chessboard",
|
||||||
|
"command": "python",
|
||||||
|
"package": "",
|
||||||
|
"executable": "chessboard.py",
|
||||||
|
"args": {
|
||||||
|
"blend": \${FILE:string:""},
|
||||||
|
"dae": \${FILE:string:""},rbs_arm/robot1/controller
|
||||||
|
"fbx": \${FILE:string:""},
|
||||||
|
"...": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"sid": 2,
|
||||||
|
"project": 1,
|
||||||
|
"type": "part_model",
|
||||||
|
"description": "Robossembler: chess pieces",
|
||||||
|
"command": "python",
|
||||||
|
"package": "",
|
||||||
|
"executable": "chess_pieces.py",
|
||||||
|
"args": [ // ARRAY of pieces
|
||||||
|
{
|
||||||
|
"name": \${NAME:string:""},
|
||||||
|
"blend": \${FILE:string:""},
|
||||||
|
"dae": \${FILE:string:""},
|
||||||
|
"fbx": \${FILE:string:""},
|
||||||
|
"...": ""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
Затем при запуске "get_interface.py" для каждого пакета, получаем json со структурой:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"cameras": [{"properties1": "value1", "propertiesN": "valueN"}],
|
||||||
|
"robots": [{"properties1": "value1", "propertiesN": "valueN"}],
|
||||||
|
"topics": [{"properties1": "value1", "propertiesN": "valueN"}],
|
||||||
|
"...": ""
|
||||||
|
}
|
||||||
|
```
|
||||||
|
в которой ключи - это наши сущности из БД.
|
||||||
|
В данном случае будет присутствовать только массив "parts". Web-сервис записывает парсинг результата в соответствующую таблицу.
|
||||||
|
|
||||||
|
* Parts_lib
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"sid": 1,
|
||||||
|
"package": 1,
|
||||||
|
"name": "chessboard",
|
||||||
|
"description": "Robossembler: chessboard",
|
||||||
|
"meshs": {
|
||||||
|
"blend": "chessboard.blend",
|
||||||
|
"dae": "chessboard.dae",
|
||||||
|
"fbx": "chessboard.fbx",
|
||||||
|
"...": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"sid": 2,
|
||||||
|
"package": 2,
|
||||||
|
"name": "pawn",
|
||||||
|
"description": "Robossembler: pawn",
|
||||||
|
"meshs": {
|
||||||
|
"blend": "pawn.blend",
|
||||||
|
"dae": "pawn.dae",
|
||||||
|
"fbx": "pawn.fbx",
|
||||||
|
"...": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"sid": 3,
|
||||||
|
"package": 2,
|
||||||
|
"name": "knight",
|
||||||
|
"description": "Robossembler: knight",
|
||||||
|
"meshs": {
|
||||||
|
"blend": "knight.blend",
|
||||||
|
"dae": "knight.dae",
|
||||||
|
"fbx": "knight.fbx",
|
||||||
|
"...": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
Note. Кроме "sid" и "packages" все остальные поля заполняются из массива [{"properties1": "value1", "propertiesN": "valueN"}].
|
||||||
|
|
||||||
|
# Пример: цифровой двойник "Камера"
|
||||||
|
|
||||||
|
## Добавляем пакет с моделью камеры в библиотеку проекта
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"sid": 3,
|
||||||
|
"type": "digital_twin",
|
||||||
|
"entity": "CAMERA",
|
||||||
|
"description": "ROS Wrapper for Intel RealSense Cameras",
|
||||||
|
"command": "ros2 launch",
|
||||||
|
"package": "realsense2_camera",
|
||||||
|
"executable": "rs_launch.py",
|
||||||
|
"args": {
|
||||||
|
"camera_namespace": \${NAME:string:""},
|
||||||
|
"camera_name": \${NAME:string:""},
|
||||||
|
... // + всё, что сейчас в модели данных в коде
|
||||||
|
},
|
||||||
|
"interfaces": {
|
||||||
|
"cmd": "python ros2_topic_to_json.py"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Добавляем экземпляр камеры в сцену (Scene Builder)
|
||||||
|
|
||||||
|
При этом запускаем "get_interface.py" и получаем json со структурой, описанной выше, но в данном случае в результате будет
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"cameras": [
|
||||||
|
{
|
||||||
|
"model_name": "Intel RealSense",
|
||||||
|
"model_type": "RGBD",
|
||||||
|
"...": "..."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"topics": [
|
||||||
|
{
|
||||||
|
"topic_name": "camera/camera1/image_raw",
|
||||||
|
"msg_type":"sensor_msgs/msg/Image"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"topic_name": "camera/camera1/camera_info",
|
||||||
|
"msg_type":"sensor_msgs/msg/CameraInfo"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
}
|
||||||
|
```
|
||||||
|
В БД создаются:
|
||||||
|
|
||||||
|
* Cameras
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"sid": 1,
|
||||||
|
"package": 3,
|
||||||
|
"model_name": "Intel RealSense",
|
||||||
|
"model_type": "RGBD",
|
||||||
|
"pose": {}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
* Topics
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"sid": 1,
|
||||||
|
"package": 3,
|
||||||
|
"topic_name": "camera/camera1/image_raw",
|
||||||
|
"msg_type":"sensor_msgs/msg/Image"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"sid": 2,
|
||||||
|
"package": 3,
|
||||||
|
"topic_name": "camera/camera1/camera_info",
|
||||||
|
"msg_type":"sensor_msgs/msg/CameraInfo"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Робот добавляется аналогично камере
|
||||||
|
|
||||||
|
Модель робота
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"sid": 3,
|
||||||
|
"type": "digital_twin",
|
||||||
|
"entity": "ROBOT",
|
||||||
|
"description": "Robossembler Arm",
|
||||||
|
"command": "ros2 launch",
|
||||||
|
"package": "rbs_bringup",
|
||||||
|
"executable": "single_robot.launch.py",
|
||||||
|
"args": {
|
||||||
|
"robot_name": \${NAME:string:""},
|
||||||
|
"dof": \${NAME:number:""},
|
||||||
|
... // + всё, что сейчас в модели данных в коде
|
||||||
|
},
|
||||||
|
"interfaces": {
|
||||||
|
"cmd": "python ros2_topic_to_json.py"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
* Topics
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"sid": 3,
|
||||||
|
"package": 4,
|
||||||
|
"topic_name": "rbs_arm/robot1/controller",
|
||||||
|
"msg_type":"sensor_msgs/msg/JointState"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"sid": 4,
|
||||||
|
"package": 4,
|
||||||
|
"topic_name": "rbs_arm/robot1/controller1",
|
||||||
|
"msg_type":"sensor_msgs/msg/JointState"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Добавляем пакет навыка Pose Estimation DOPE в библиотеку проекта
|
||||||
|
|
||||||
|
* Packages
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"sid": 5,
|
||||||
|
"project": 1,
|
||||||
|
"type": "skill_server",
|
||||||
|
"description": "Pose Estimation Skill Dope 6D",
|
||||||
|
"command": "ros2 launch",
|
||||||
|
"package": "dope6d",
|
||||||
|
"executable": "dope.py",
|
||||||
|
"args": {
|
||||||
|
"mode": "image/bbox",
|
||||||
|
"output_topic": \${NAME:string:"bound_box"}
|
||||||
|
"output_topic_image": \${NAME:string:"imagebb"}
|
||||||
|
},
|
||||||
|
"interfaces": {
|
||||||
|
"cmd": "python ros2_topic_to_json.py"
|
||||||
|
},
|
||||||
|
"bt_param":[
|
||||||
|
{
|
||||||
|
"name": "peConfigure",
|
||||||
|
"description": "configuring lifecycle node ROS 2",
|
||||||
|
"type_action": "action/condition",
|
||||||
|
"type": "run",
|
||||||
|
"param": [
|
||||||
|
{
|
||||||
|
"type": "weights",
|
||||||
|
"dependency": { "object_name": "knight", "weights_file": "/home/shalenikol/0_rbs/w_knight.pth", "dimensions": [0.03, 0.026, 0.065] },
|
||||||
|
"sid": "123"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"result": ["POSE"]
|
||||||
|
},
|
||||||
|
{ "name": "peStop", "type": "stop", "param": [], "result": [] }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Запускаем "get_interfaces.py"
|
||||||
|
* Topics
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"sid": 5,
|
||||||
|
"package": 5,
|
||||||
|
"topic_name": "bound_box",
|
||||||
|
"msg_type":"geometry_msgs/msg/BoundBox"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
* BTrees
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"sid": 1,
|
||||||
|
"package": 5,
|
||||||
|
"command_name": "peConfigure",
|
||||||
|
"dependency": {"$FormBuilderTemplate$"}
|
||||||
|
}
|
||||||
|
```
|
61
flake.lock
generated
61
flake.lock
generated
|
@ -1,61 +0,0 @@
|
||||||
{
|
|
||||||
"nodes": {
|
|
||||||
"flake-utils": {
|
|
||||||
"inputs": {
|
|
||||||
"systems": "systems"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1731533236,
|
|
||||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1733935512,
|
|
||||||
"narHash": "sha256-beDnPaHubnwcsbVPC3rIVtQM3QVFDMmc0dtfHCW5UrA=",
|
|
||||||
"owner": "NixOS",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "d55cc4608dae1b42a0ef5c0cf701b501fc7bae58",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "NixOS",
|
|
||||||
"ref": "master",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": {
|
|
||||||
"inputs": {
|
|
||||||
"flake-utils": "flake-utils",
|
|
||||||
"nixpkgs": "nixpkgs"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"systems": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1681028828,
|
|
||||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default",
|
|
||||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": "root",
|
|
||||||
"version": 7
|
|
||||||
}
|
|
37
flake.nix
37
flake.nix
|
@ -1,37 +0,0 @@
|
||||||
{
|
|
||||||
description = "Robossembler Development Environments on Nix";
|
|
||||||
inputs = {
|
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs?ref=master";
|
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
|
||||||
};
|
|
||||||
|
|
||||||
outputs = { self, nixpkgs, flake-utils }:
|
|
||||||
flake-utils.lib.eachDefaultSystem
|
|
||||||
(system:
|
|
||||||
let
|
|
||||||
pkgs = import nixpkgs { inherit system; overlays = []; };
|
|
||||||
in
|
|
||||||
{
|
|
||||||
packages = {
|
|
||||||
frontend = pkgs.writeShellApplication {
|
|
||||||
name = "frontend";
|
|
||||||
runtimeInputs = [ pkgs.nodejs ];
|
|
||||||
text = ''
|
|
||||||
cd ui && npm i && npm run dev
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
backend = pkgs.writeShellApplication {
|
|
||||||
name = "frontend";
|
|
||||||
runtimeInputs = [ pkgs.nodejs ];
|
|
||||||
text = ''
|
|
||||||
cd server && npm i && npm run dev
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
devShells = {
|
|
||||||
default = pkgs.mkShell { packages = with pkgs; [ nodejs ]; };
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
|
@ -19,7 +19,7 @@ module.exports = {
|
||||||
"@typescript-eslint/no-var-requires": "off",
|
"@typescript-eslint/no-var-requires": "off",
|
||||||
"@typescript-eslint/explicit-module-boundary-types": "off",
|
"@typescript-eslint/explicit-module-boundary-types": "off",
|
||||||
"@typescript-eslint/no-unused-vars": [
|
"@typescript-eslint/no-unused-vars": [
|
||||||
"warn",
|
"warn", // or "error"
|
||||||
{
|
{
|
||||||
"argsIgnorePattern": "^_",
|
"argsIgnorePattern": "^_",
|
||||||
"varsIgnorePattern": "^_",
|
"varsIgnorePattern": "^_",
|
||||||
|
|
3
server/.gitignore
vendored
3
server/.gitignore
vendored
|
@ -8,5 +8,4 @@ coverage
|
||||||
build/
|
build/
|
||||||
model_create.ts
|
model_create.ts
|
||||||
public
|
public
|
||||||
p.ts
|
p.ts
|
||||||
package-lock.json
|
|
|
@ -1,26 +0,0 @@
|
||||||
{
|
|
||||||
"tensorBoard": {
|
|
||||||
"execCommand": "nix run github:nixos/nixpkgs#python312Packages.tensorboard -- --logdir ${dir_path}",
|
|
||||||
"date": null,
|
|
||||||
"status": "Fail,Ok",
|
|
||||||
"delay": 200,
|
|
||||||
"checkCommand": null,
|
|
||||||
"filter": null
|
|
||||||
},
|
|
||||||
"simulationProcess": {
|
|
||||||
"execCommand": "nix run github:nixos/nixpkgs#python312Packages.tensorboard -- --logdir ${dir_path}",
|
|
||||||
"date": null,
|
|
||||||
"status": null,
|
|
||||||
"delay": 0,
|
|
||||||
"checkCommand": null,
|
|
||||||
"filter": null
|
|
||||||
},
|
|
||||||
"btBuilderProcess": {
|
|
||||||
"execCommand": "nix run github:nixos/nixpkgs#python312Packages.tensorboard -- --logdir ${dir_path}",
|
|
||||||
"date": null,
|
|
||||||
"status": null,
|
|
||||||
"delay": 0,
|
|
||||||
"checkCommand": null,
|
|
||||||
"filter": null
|
|
||||||
}
|
|
||||||
}
|
|
8576
server/package-lock.json
generated
Normal file
8576
server/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
|
@ -7,7 +7,8 @@
|
||||||
"test:dev": "NODE_ENV=test_dev tsc-watch --onSuccess 'ts-node ./build/test/test.js'",
|
"test:dev": "NODE_ENV=test_dev tsc-watch --onSuccess 'ts-node ./build/test/test.js'",
|
||||||
"test:unit": "NODE_ENV=unit tsc-watch --onSuccess 'ts-node ./build/test/test.js'",
|
"test:unit": "NODE_ENV=unit tsc-watch --onSuccess 'ts-node ./build/test/test.js'",
|
||||||
"test:e2e": "NODE_ENV=e2e tsc-watch --onSuccess 'ts-node ./build/test/test.js'",
|
"test:e2e": "NODE_ENV=e2e tsc-watch --onSuccess 'ts-node ./build/test/test.js'",
|
||||||
"dev": "NODE_ENV=dev tsc-watch --onSuccess 'ts-node ./build/src/main.js'"
|
"dev": "NODE_ENV=dev tsc-watch --onSuccess 'ts-node ./build/src/main.js'",
|
||||||
|
"build:stand": " "
|
||||||
},
|
},
|
||||||
"author": "IDONTSUDO",
|
"author": "IDONTSUDO",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -23,28 +24,34 @@
|
||||||
"chai": "latest",
|
"chai": "latest",
|
||||||
"eslint": "^8.47.0",
|
"eslint": "^8.47.0",
|
||||||
"mocha": "latest",
|
"mocha": "latest",
|
||||||
"node-watch": "^0.7.4",
|
"nyc": "latest",
|
||||||
"source-map-support": "latest",
|
"source-map-support": "latest",
|
||||||
"ts-node": "^10.9.1",
|
"ts-node": "^10.9.1",
|
||||||
"tslint": "latest",
|
"tslint": "latest",
|
||||||
"typescript": "^5.1.6"
|
"typescript": "^5.1.6",
|
||||||
|
"node-watch": "^0.7.4",
|
||||||
|
"nodemon": "^3.0.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@grpc/grpc-js": "^1.9.0",
|
||||||
"axios": "^1.6.2",
|
"axios": "^1.6.2",
|
||||||
|
"babel-register": "^6.26.0",
|
||||||
"class-transformer": "^0.5.1",
|
"class-transformer": "^0.5.1",
|
||||||
"class-validator": "^0.14.0",
|
"class-validator": "^0.14.0",
|
||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
"express": "^4.18.2",
|
"express": "^4.18.2",
|
||||||
"express-fileupload": "^1.4.2",
|
"express-fileupload": "^1.4.2",
|
||||||
|
"first-di": "^1.0.11",
|
||||||
|
"md5": "^2.3.0",
|
||||||
"mongoose": "^7.6.2",
|
"mongoose": "^7.6.2",
|
||||||
"mongoose-autopopulate": "^1.1.0",
|
"mongoose-autopopulate": "^1.1.0",
|
||||||
"pattern-matching-ts": "^2.0.0",
|
|
||||||
"pm2": "^5.3.1",
|
"pm2": "^5.3.1",
|
||||||
"reflect-metadata": "^0.1.13",
|
"reflect-metadata": "^0.1.13",
|
||||||
"rimraf": "^5.0.5",
|
"rimraf": "^5.0.5",
|
||||||
"socket.io": "^4.7.2",
|
"socket.io": "^4.7.2",
|
||||||
"socket.io-client": "^4.7.2",
|
"socket.io-client": "^4.7.2",
|
||||||
"ts-pattern": "^5.1.1",
|
"spark-md5": "^3.0.2",
|
||||||
|
"ts-md5": "^1.3.1",
|
||||||
"tsc-watch": "^6.0.4",
|
"tsc-watch": "^6.0.4",
|
||||||
"uuid": "^9.0.1"
|
"uuid": "^9.0.1"
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import { Server } from "socket.io";
|
||||||
import { createServer } from "http";
|
import { createServer } from "http";
|
||||||
import { SocketSubscriber } from "./socket_controller";
|
import { SocketSubscriber } from "./socket_controller";
|
||||||
import { dirname } from "path";
|
import { dirname } from "path";
|
||||||
|
import { SetLastActivePipelineToRealTimeServiceScenario } from "../scenarios/set_active_pipeline_to_realtime_service_scenario";
|
||||||
import { CheckAndCreateStaticFilesFolderUseCase } from "../usecases/check_and_create_static_files_folder_usecase";
|
import { CheckAndCreateStaticFilesFolderUseCase } from "../usecases/check_and_create_static_files_folder_usecase";
|
||||||
import { DataBaseConnectUseCase } from "../usecases/database_connect_usecase";
|
import { DataBaseConnectUseCase } from "../usecases/database_connect_usecase";
|
||||||
import { TypedEvent } from "../helpers/typed_event";
|
import { TypedEvent } from "../helpers/typed_event";
|
||||||
|
@ -57,6 +58,8 @@ export class App extends TypedEvent<ServerStatus> {
|
||||||
io.on("connection", (socket) => {
|
io.on("connection", (socket) => {
|
||||||
this.socketSubscribers.map((el) => {
|
this.socketSubscribers.map((el) => {
|
||||||
el.emitter.on((e) => {
|
el.emitter.on((e) => {
|
||||||
|
console.log(el.event)
|
||||||
|
console.log(e)
|
||||||
socket.emit(el.event, e);
|
socket.emit(el.event, e);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -106,7 +109,6 @@ export class App extends TypedEvent<ServerStatus> {
|
||||||
await result.fold(
|
await result.fold(
|
||||||
async (_s) => {
|
async (_s) => {
|
||||||
await new CheckAndCreateStaticFilesFolderUseCase().call();
|
await new CheckAndCreateStaticFilesFolderUseCase().call();
|
||||||
|
|
||||||
// await new SetLastActivePipelineToRealTimeServiceScenario().call();
|
// await new SetLastActivePipelineToRealTimeServiceScenario().call();
|
||||||
},
|
},
|
||||||
async (_e) => {
|
async (_e) => {
|
||||||
|
@ -122,5 +124,3 @@ export class App extends TypedEvent<ServerStatus> {
|
||||||
return rootDir + "public/";
|
return rootDir + "public/";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ import { Result } from "../helpers/result";
|
||||||
import { Router, Request, Response } from "express";
|
import { Router, Request, Response } from "express";
|
||||||
import { IRouteModel, Routes } from "../interfaces/router";
|
import { IRouteModel, Routes } from "../interfaces/router";
|
||||||
import { CoreValidation } from "../validations/core_validation";
|
import { CoreValidation } from "../validations/core_validation";
|
||||||
import { plainToInstance } from "class-transformer";
|
|
||||||
|
|
||||||
export type HttpMethodType = "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "PATCH" | "HEAD";
|
export type HttpMethodType = "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "PATCH" | "HEAD";
|
||||||
|
|
||||||
|
@ -29,48 +28,16 @@ export abstract class CallbackStrategyWithFileUpload {
|
||||||
abstract idValidationExpression: CoreValidation;
|
abstract idValidationExpression: CoreValidation;
|
||||||
abstract call(file: File, id: string): ResponseBase;
|
abstract call(file: File, id: string): ResponseBase;
|
||||||
}
|
}
|
||||||
export abstract class CallbackStrategyWithFilesUploads {
|
|
||||||
abstract chuckingFileExpressions: RegExp[];
|
|
||||||
abstract call(files: File[]): ResponseBase;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class SubRouter<A> implements ISubSetFeatureRouter<A> {
|
interface ISubSetFeatureRouter<T> {
|
||||||
method: HttpMethodType;
|
method: HttpMethodType;
|
||||||
subUrl: string;
|
subUrl: string;
|
||||||
fn:
|
fn:
|
||||||
| CallbackStrategyWithValidationModel<A>
|
| CallbackStrategyWithValidationModel<T>
|
||||||
| CallbackStrategyWithEmpty
|
| CallbackStrategyWithEmpty
|
||||||
| CallbackStrategyWithIdQuery
|
| CallbackStrategyWithIdQuery
|
||||||
| CallBackStrategyWithQueryPage
|
| CallBackStrategyWithQueryPage
|
||||||
| CallbackStrategyWithFileUpload
|
| CallbackStrategyWithFileUpload;
|
||||||
| CallbackStrategyWithFilesUploads;
|
|
||||||
constructor(
|
|
||||||
method: HttpMethodType,
|
|
||||||
subUrl: string,
|
|
||||||
fn:
|
|
||||||
| CallbackStrategyWithValidationModel<A>
|
|
||||||
| CallbackStrategyWithEmpty
|
|
||||||
| CallbackStrategyWithIdQuery
|
|
||||||
| CallBackStrategyWithQueryPage
|
|
||||||
| CallbackStrategyWithFileUpload
|
|
||||||
| CallbackStrategyWithFilesUploads
|
|
||||||
) {
|
|
||||||
this.fn = fn;
|
|
||||||
this.subUrl = subUrl;
|
|
||||||
this.method = method;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ISubSetFeatureRouter<A> {
|
|
||||||
method: HttpMethodType;
|
|
||||||
subUrl: string;
|
|
||||||
fn:
|
|
||||||
| CallbackStrategyWithValidationModel<A>
|
|
||||||
| CallbackStrategyWithEmpty
|
|
||||||
| CallbackStrategyWithIdQuery
|
|
||||||
| CallBackStrategyWithQueryPage
|
|
||||||
| CallbackStrategyWithFileUpload
|
|
||||||
| CallbackStrategyWithFilesUploads;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class ICoreHttpController {
|
abstract class ICoreHttpController {
|
||||||
|
@ -111,11 +78,11 @@ export class CoreHttpController<V> implements ICoreHttpController {
|
||||||
}
|
}
|
||||||
call(): Routes {
|
call(): Routes {
|
||||||
if (this.subRoutes.isNotEmpty()) {
|
if (this.subRoutes.isNotEmpty()) {
|
||||||
this.subRoutes.map(async (el) => {
|
this.subRoutes.map((el) => {
|
||||||
this.router[el.method.toLowerCase()](this.mainURL + "/" + el.subUrl, async (req, res) => {
|
this.router[el.method.toLowerCase()](this.mainURL + "/" + el.subUrl, async (req, res) => {
|
||||||
if (el.fn instanceof CallbackStrategyWithValidationModel) {
|
if (el.fn instanceof CallbackStrategyWithValidationModel) {
|
||||||
this.responseHelper(res, el.fn.call(req.body));
|
// TODO(IDONTSUDO):
|
||||||
return;
|
throw Error("needs to be implimed");
|
||||||
}
|
}
|
||||||
if (el.fn instanceof CallbackStrategyWithIdQuery) {
|
if (el.fn instanceof CallbackStrategyWithIdQuery) {
|
||||||
if (req.query.id === undefined) {
|
if (req.query.id === undefined) {
|
||||||
|
@ -137,7 +104,6 @@ export class CoreHttpController<V> implements ICoreHttpController {
|
||||||
await this.responseHelper(res, el.fn.call(req["files"]["file"]));
|
await this.responseHelper(res, el.fn.call(req["files"]["file"]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (el.fn instanceof CallBackStrategyWithQueryPage) {
|
if (el.fn instanceof CallBackStrategyWithQueryPage) {
|
||||||
throw Error("needs to be implimed");
|
throw Error("needs to be implimed");
|
||||||
}
|
}
|
||||||
|
@ -176,7 +142,6 @@ export class CoreHttpController<V> implements ICoreHttpController {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.responseHelper(res, el.fn.call(req["files"]["file"], req.query.id));
|
await this.responseHelper(res, el.fn.call(req["files"]["file"], req.query.id));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -206,10 +171,10 @@ export class CoreHttpController<V> implements ICoreHttpController {
|
||||||
router: this.router,
|
router: this.router,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
public put(usecase: any) {
|
public put(usecase: CallbackStrategyWithValidationModel<V>) {
|
||||||
this.routes["PUT"] = usecase;
|
this.routes["PUT"] = usecase;
|
||||||
}
|
}
|
||||||
public delete(usecase: any) {
|
public delete(usecase: CallbackStrategyWithValidationModel<V>) {
|
||||||
this.routes["DELETE"] = usecase;
|
this.routes["DELETE"] = usecase;
|
||||||
}
|
}
|
||||||
public async requestResponseController<T>(
|
public async requestResponseController<T>(
|
||||||
|
@ -226,6 +191,7 @@ export class CoreHttpController<V> implements ICoreHttpController {
|
||||||
if (req.query.page !== undefined) {
|
if (req.query.page !== undefined) {
|
||||||
payload = String(req.query.page);
|
payload = String(req.query.page);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (req.query.id !== undefined) {
|
if (req.query.id !== undefined) {
|
||||||
payload = String(req.query.id);
|
payload = String(req.query.id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,29 +1,9 @@
|
||||||
import { BehaviorTreesPresentation } from "../../features/behavior_trees/behavior_trees_presentation";
|
|
||||||
import { DatasetsPresentation } from "../../features/datasets/datasets_presentation";
|
import { DatasetsPresentation } from "../../features/datasets/datasets_presentation";
|
||||||
import { CalculationsTemplatePresentation } from "../../features/calculations_templates/calculations_template_presentation";
|
|
||||||
import { ProjectsPresentation } from "../../features/projects/projects_presentation";
|
import { ProjectsPresentation } from "../../features/projects/projects_presentation";
|
||||||
|
// import { ProjectsPresentation } from "../../features/_projects/projects_presentation";
|
||||||
import { extensions } from "../extensions/extensions";
|
import { extensions } from "../extensions/extensions";
|
||||||
import { Routes } from "../interfaces/router";
|
import { Routes } from "../interfaces/router";
|
||||||
import { ScenesPresentation } from "../../features/scenes/scenes_presentation";
|
|
||||||
import { CalculationsInstancesPresentation } from "../../features/calculations_instance/calculations_instance_presentation";
|
|
||||||
import { DigitalTwinsInstancePresentation } from "../../features/digital_twins_instance/digital_twins_instance_presentation";
|
|
||||||
import { DigitalTwinsTemplatePresentation } from "../../features/digital_twins_template/digital_twins_template_presentation";
|
|
||||||
import { TopicsPresentation } from "../../features/topics/topics_presentation";
|
|
||||||
import { SkillsPresentation } from "../../features/skills/skill_presentation";
|
|
||||||
import { RunTimePresentation } from "../../features/runtime/runtime_presentation";
|
|
||||||
|
|
||||||
extensions();
|
extensions();
|
||||||
|
|
||||||
export const httpRoutes: Routes[] = [
|
export const httpRoutes: Routes[] = [new ProjectsPresentation(), new DatasetsPresentation()].map((el) => el.call());
|
||||||
new ProjectsPresentation(),
|
|
||||||
new DatasetsPresentation(),
|
|
||||||
new ScenesPresentation(),
|
|
||||||
new BehaviorTreesPresentation(),
|
|
||||||
new CalculationsTemplatePresentation(),
|
|
||||||
new CalculationsInstancesPresentation(),
|
|
||||||
new DigitalTwinsTemplatePresentation(),
|
|
||||||
new DigitalTwinsInstancePresentation(),
|
|
||||||
new TopicsPresentation(),
|
|
||||||
new SkillsPresentation(),
|
|
||||||
new RunTimePresentation(),
|
|
||||||
].map((el) => el.call());
|
|
||||||
|
|
44
server/src/core/di/env.ts
Normal file
44
server/src/core/di/env.ts
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
// import { Service } from "typedi";
|
||||||
|
|
||||||
|
// @Service()
|
||||||
|
// export class IEnv{
|
||||||
|
// rootFolder!: string;
|
||||||
|
// constructor(){
|
||||||
|
|
||||||
|
// }
|
||||||
|
// toStringEnv(){
|
||||||
|
// return ''
|
||||||
|
// }
|
||||||
|
// static env(){
|
||||||
|
// return ''
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// @Service()
|
||||||
|
// export class DevEnv implements IEnv {
|
||||||
|
// rootFolder:string;
|
||||||
|
// constructor(rootFolder:string){
|
||||||
|
// this.rootFolder = rootFolder
|
||||||
|
// }
|
||||||
|
// toStringEnv(): string {
|
||||||
|
// return DevEnv.env()
|
||||||
|
// }
|
||||||
|
// static env(){
|
||||||
|
// return 'DevEnv'
|
||||||
|
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// @Service()
|
||||||
|
// export class UnitTestEnv implements IEnv{
|
||||||
|
// rootFolder:string;
|
||||||
|
// constructor(rootFolder:string){
|
||||||
|
// this.rootFolder = rootFolder
|
||||||
|
// }
|
||||||
|
// toStringEnv(): string {
|
||||||
|
// return UnitTestEnv.env()
|
||||||
|
// }
|
||||||
|
// static env(){
|
||||||
|
// return 'UnitTestEnv'
|
||||||
|
|
||||||
|
// }
|
||||||
|
// }
|
53
server/src/core/di/register_di.ts
Normal file
53
server/src/core/di/register_di.ts
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
// import { DevEnv, IEnv, UnitTestEnv } from "./env";
|
||||||
|
// import { extensions } from "../extensions/extensions";
|
||||||
|
// // import { Container, Service } from 'typedi';
|
||||||
|
|
||||||
|
// export default function locator(env: IEnv) {
|
||||||
|
// extensions();
|
||||||
|
// envRegister(env);
|
||||||
|
// registerRepository(env);
|
||||||
|
// registerController(env);
|
||||||
|
// registerService(env);
|
||||||
|
// // override(MetaDataFileManagerModel, MetaDataFileManagerModel);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// const envRegister = (env: IEnv) => {
|
||||||
|
// switch (env.toStringEnv()) {
|
||||||
|
// case UnitTestEnv.env():
|
||||||
|
// // override(IEnv, UnitTestEnv);
|
||||||
|
// return;
|
||||||
|
// case "DevEnv":
|
||||||
|
// // override(IEnv, DevEnv);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
|
||||||
|
// const registerRepository = (env: IEnv) => {
|
||||||
|
// switch (env.toStringEnv()) {
|
||||||
|
// case UnitTestEnv.env():
|
||||||
|
// // override(IEnv, UnitTestEnv);
|
||||||
|
|
||||||
|
// return;
|
||||||
|
// case DevEnv.env():
|
||||||
|
// // override(IEnv, DevEnv);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
|
||||||
|
// const registerController = (env: IEnv) => {
|
||||||
|
// switch (env.toStringEnv()) {
|
||||||
|
// case UnitTestEnv.env():
|
||||||
|
// return;
|
||||||
|
// case DevEnv.env():
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
|
||||||
|
// const registerService = (env: IEnv) => {
|
||||||
|
// switch (env.toStringEnv()) {
|
||||||
|
// case UnitTestEnv.env():
|
||||||
|
// return;
|
||||||
|
// case DevEnv.env():
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// };
|
|
@ -6,6 +6,7 @@ export const ArrayExtensions = () => {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if ([].equals === undefined) {
|
if ([].equals === undefined) {
|
||||||
|
// eslint-disable-next-line no-extend-native
|
||||||
Array.prototype.equals = function (array, strict = true) {
|
Array.prototype.equals = function (array, strict = true) {
|
||||||
if (!array) return false;
|
if (!array) return false;
|
||||||
|
|
||||||
|
@ -26,6 +27,7 @@ export const ArrayExtensions = () => {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if ([].lastElement === undefined) {
|
if ([].lastElement === undefined) {
|
||||||
|
// eslint-disable-next-line no-extend-native
|
||||||
Array.prototype.lastElement = function () {
|
Array.prototype.lastElement = function () {
|
||||||
const instanceCheck = this;
|
const instanceCheck = this;
|
||||||
if (instanceCheck === undefined) {
|
if (instanceCheck === undefined) {
|
||||||
|
@ -37,6 +39,7 @@ export const ArrayExtensions = () => {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if ([].isEmpty === undefined) {
|
if ([].isEmpty === undefined) {
|
||||||
|
// eslint-disable-next-line no-extend-native
|
||||||
Array.prototype.isEmpty = function () {
|
Array.prototype.isEmpty = function () {
|
||||||
return this.length === 0;
|
return this.length === 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -21,8 +21,6 @@ declare global {
|
||||||
hasPattern(pattern: string): boolean;
|
hasPattern(pattern: string): boolean;
|
||||||
hasNoPattern(pattern: string): boolean;
|
hasNoPattern(pattern: string): boolean;
|
||||||
pathNormalize(): string;
|
pathNormalize(): string;
|
||||||
isEqual(str: string): boolean;
|
|
||||||
isEqualMany(str: string[]): boolean;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export const extensions = () => {
|
export const extensions = () => {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
export const StringExtensions = () => {
|
export const StringExtensions = () => {
|
||||||
if ("".isEmpty === undefined) {
|
if ("".isEmpty === undefined) {
|
||||||
|
// eslint-disable-next-line no-extend-native
|
||||||
String.prototype.isEmpty = function () {
|
String.prototype.isEmpty = function () {
|
||||||
return this.length === 0;
|
return this.length === 0;
|
||||||
};
|
};
|
||||||
|
@ -10,6 +11,7 @@ export const StringExtensions = () => {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if ("".isNotEmpty === undefined) {
|
if ("".isNotEmpty === undefined) {
|
||||||
|
// eslint-disable-next-line no-extend-native
|
||||||
String.prototype.isNotEmpty = function () {
|
String.prototype.isNotEmpty = function () {
|
||||||
return this.length !== 0;
|
return this.length !== 0;
|
||||||
};
|
};
|
||||||
|
@ -29,19 +31,4 @@ export const StringExtensions = () => {
|
||||||
return !this.hasPattern(pattern);
|
return !this.hasPattern(pattern);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if ("".isEqual === undefined) {
|
|
||||||
String.prototype.isEqual = function (str: string) {
|
|
||||||
return this === str;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
if ("".isEqualMany === undefined) {
|
|
||||||
String.prototype.isEqualMany = function (str: string[]) {
|
|
||||||
for (const el of str) {
|
|
||||||
if (el === this) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -10,13 +10,11 @@ export const validationModelMiddleware = (
|
||||||
forbidNonWhitelisted = true
|
forbidNonWhitelisted = true
|
||||||
): RequestHandler => {
|
): RequestHandler => {
|
||||||
return (req, res, next) => {
|
return (req, res, next) => {
|
||||||
|
|
||||||
if (type === null && type == undefined) {
|
if (type === null && type == undefined) {
|
||||||
next();
|
next();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const model = plainToInstance(type, req[value]);
|
const model = plainToInstance(type, req[value]);
|
||||||
|
|
||||||
validate(model, { skipMissingProperties, whitelist, forbidNonWhitelisted }).then((errors: ValidationError[]) => {
|
validate(model, { skipMissingProperties, whitelist, forbidNonWhitelisted }).then((errors: ValidationError[]) => {
|
||||||
if (errors.length > 0) {
|
if (errors.length > 0) {
|
||||||
const message = errors.map((error: ValidationError) => Object.values(error.constraints)).join(", ");
|
const message = errors.map((error: ValidationError) => Object.values(error.constraints)).join(", ");
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
export interface Instance {
|
|
||||||
instanceName: string;
|
|
||||||
path: string;
|
|
||||||
instancePath: string;
|
|
||||||
}
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
import { Trigger } from "../../features/_triggers/models/trigger_database_model";
|
||||||
import { EXEC_TYPE } from "./exec_error_model";
|
import { EXEC_TYPE } from "./exec_error_model";
|
||||||
|
|
||||||
export interface Trigger {}
|
|
||||||
export interface IPipeline {
|
export interface IPipeline {
|
||||||
process: IProcess;
|
process: IProcess;
|
||||||
trigger?: Trigger;
|
trigger?: Trigger;
|
||||||
|
|
|
@ -21,4 +21,3 @@ export class RobossemblerAssets {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,189 +0,0 @@
|
||||||
import { IsArray, IsEnum, IsNotEmpty, IsString, ValidateNested } from "class-validator";
|
|
||||||
import { Type } from "class-transformer";
|
|
||||||
export class TopicViewModel {
|
|
||||||
@IsNotEmpty()
|
|
||||||
@IsString()
|
|
||||||
name: string;
|
|
||||||
@IsNotEmpty()
|
|
||||||
@IsString()
|
|
||||||
type: string;
|
|
||||||
constructor(name: string, type: string) {
|
|
||||||
this.name = name;
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
static empty() {
|
|
||||||
return new TopicViewModel("", "");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IParam {
|
|
||||||
type: string;
|
|
||||||
dependency: Object;
|
|
||||||
}
|
|
||||||
export interface Skill {
|
|
||||||
SkillPackage: ISkillPackage;
|
|
||||||
Module: IModule;
|
|
||||||
Launch: ILaunch;
|
|
||||||
ROS2: IRos2;
|
|
||||||
BTAction: IBTAction[];
|
|
||||||
Interface: IInterface;
|
|
||||||
Settings: ISetting[];
|
|
||||||
xxx: IXxx;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IBTAction {
|
|
||||||
name: string;
|
|
||||||
format: string;
|
|
||||||
type: string;
|
|
||||||
param: IParam[];
|
|
||||||
result: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IInterface {
|
|
||||||
Input: IPut[];
|
|
||||||
Output: IPut[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IPut {
|
|
||||||
name: string;
|
|
||||||
type: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ILaunch {
|
|
||||||
executable: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IModule {
|
|
||||||
name: string;
|
|
||||||
description: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IRos2 {
|
|
||||||
node_name: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ISetting {
|
|
||||||
name: string;
|
|
||||||
value: number | string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ISkillPackage {
|
|
||||||
name: string;
|
|
||||||
version: string;
|
|
||||||
format: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IXxx {
|
|
||||||
cameraLink: string;
|
|
||||||
topicImage: string;
|
|
||||||
topicCameraInfo: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class SkillPackage implements ISkillPackage {
|
|
||||||
@IsString()
|
|
||||||
name: string;
|
|
||||||
@IsString()
|
|
||||||
version: string;
|
|
||||||
@IsString()
|
|
||||||
format: string;
|
|
||||||
}
|
|
||||||
export class Module implements IModule {
|
|
||||||
@IsString()
|
|
||||||
name: string;
|
|
||||||
@IsString()
|
|
||||||
description: string;
|
|
||||||
}
|
|
||||||
export class BTAction implements IBTAction {
|
|
||||||
@IsString()
|
|
||||||
name: string;
|
|
||||||
@IsString()
|
|
||||||
format: string;
|
|
||||||
@IsString()
|
|
||||||
type: string;
|
|
||||||
@IsArray()
|
|
||||||
param: IParam[];
|
|
||||||
@IsArray()
|
|
||||||
result: string[];
|
|
||||||
}
|
|
||||||
export class Launch implements ILaunch {
|
|
||||||
@IsString()
|
|
||||||
executable: string;
|
|
||||||
}
|
|
||||||
export class Ros2 implements IRos2 {
|
|
||||||
@IsString()
|
|
||||||
node_name: string;
|
|
||||||
}
|
|
||||||
export class Put implements IPut {
|
|
||||||
@IsString()
|
|
||||||
name: string;
|
|
||||||
@IsString()
|
|
||||||
type: string;
|
|
||||||
}
|
|
||||||
export class Interface implements IInterface {
|
|
||||||
@ValidateNested()
|
|
||||||
@Type(() => Put)
|
|
||||||
Input: IPut[];
|
|
||||||
@ValidateNested()
|
|
||||||
@Type(() => Put)
|
|
||||||
Output: IPut[];
|
|
||||||
}
|
|
||||||
export class Setting implements ISetting {
|
|
||||||
name: string;
|
|
||||||
value: string | number;
|
|
||||||
}
|
|
||||||
export class Xxx implements IXxx {
|
|
||||||
cameraLink: string;
|
|
||||||
topicImage: string;
|
|
||||||
topicCameraInfo: string;
|
|
||||||
}
|
|
||||||
export class SkillModel implements Skill {
|
|
||||||
@ValidateNested()
|
|
||||||
@Type(() => SkillPackage)
|
|
||||||
SkillPackage: ISkillPackage;
|
|
||||||
@ValidateNested()
|
|
||||||
@Type(() => Module)
|
|
||||||
Module: IModule;
|
|
||||||
@ValidateNested()
|
|
||||||
@Type(() => Launch)
|
|
||||||
Launch: ILaunch;
|
|
||||||
@ValidateNested()
|
|
||||||
@Type(() => Ros2)
|
|
||||||
ROS2: IRos2;
|
|
||||||
@ValidateNested()
|
|
||||||
@IsArray()
|
|
||||||
@Type(() => BTAction)
|
|
||||||
BTAction: IBTAction[];
|
|
||||||
@ValidateNested()
|
|
||||||
@Type(() => Interface)
|
|
||||||
Interface: IInterface;
|
|
||||||
@ValidateNested()
|
|
||||||
@IsArray()
|
|
||||||
@Type(() => Setting)
|
|
||||||
Settings: ISetting[];
|
|
||||||
@ValidateNested()
|
|
||||||
@Type(() => Xxx)
|
|
||||||
xxx: IXxx;
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum BtAction {
|
|
||||||
ACTION = "ACTION",
|
|
||||||
CONDITION = "CONDITION",
|
|
||||||
}
|
|
||||||
export class BtActionViewModel implements IBTAction {
|
|
||||||
@IsNotEmpty()
|
|
||||||
@IsString()
|
|
||||||
name: string;
|
|
||||||
@IsNotEmpty()
|
|
||||||
@IsString()
|
|
||||||
format: string;
|
|
||||||
@IsNotEmpty()
|
|
||||||
@IsString()
|
|
||||||
type: string;
|
|
||||||
param: IParam[];
|
|
||||||
@IsNotEmpty()
|
|
||||||
@IsString()
|
|
||||||
result: string[];
|
|
||||||
@IsNotEmpty()
|
|
||||||
@IsEnum(BtAction)
|
|
||||||
typeAction: BtAction;
|
|
||||||
}
|
|
|
@ -1,13 +1,4 @@
|
||||||
export enum StaticFilesProject {
|
export enum StaticFiles {
|
||||||
robossembler_assets = "robossembler_assets.json",
|
robossembler_assets = "robossembler_assets.json",
|
||||||
assets = "/assets/assets.json",
|
assets = "/assets/assets.json",
|
||||||
parts = "/assets/parts.json",
|
|
||||||
scenes = "/scenes/",
|
|
||||||
behaviorTrees = "behavior_trees",
|
|
||||||
robots = 'robots'
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum StaticFilesServer {
|
|
||||||
process = "/process/",
|
|
||||||
digitalTwins = "/digital_twins/",
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { promisify } from "node:util";
|
import { promisify } from "node:util";
|
||||||
import { rimraf } from "rimraf";
|
import { rimraf } from 'rimraf'
|
||||||
|
|
||||||
export class FileSystemRepository {
|
export class FileSystemRepository {
|
||||||
public createDir = promisify(fs.mkdir);
|
public createDir = promisify(fs.mkdir);
|
||||||
|
@ -8,7 +8,6 @@ export class FileSystemRepository {
|
||||||
public writeFileAsync = promisify(fs.writeFile);
|
public writeFileAsync = promisify(fs.writeFile);
|
||||||
public dirIsExists = promisify(fs.exists);
|
public dirIsExists = promisify(fs.exists);
|
||||||
public stat = promisify(fs.stat);
|
public stat = promisify(fs.stat);
|
||||||
public deleteDir = promisify(fs.unlink);
|
|
||||||
public readFileAsync = promisify(fs.readFile);
|
public readFileAsync = promisify(fs.readFile);
|
||||||
public readdir = promisify(fs.readdir);
|
public readdir = promisify(fs.readdir);
|
||||||
public deleteDirRecursive = rimraf;
|
public deleteDirRecursive = rimraf;
|
||||||
|
@ -22,9 +21,7 @@ export class FileSystemRepository {
|
||||||
}
|
}
|
||||||
return await this.readFileAsync(path);
|
return await this.readFileAsync(path);
|
||||||
}
|
}
|
||||||
delete = async (path: string) => {
|
|
||||||
return await this.deleteDir(path);
|
|
||||||
};
|
|
||||||
readDirRecursive(path: string, filesToDir: string[] = []): string[] {
|
readDirRecursive(path: string, filesToDir: string[] = []): string[] {
|
||||||
const files = fs.readdirSync(path);
|
const files = fs.readdirSync(path);
|
||||||
files.forEach((file) => {
|
files.forEach((file) => {
|
||||||
|
@ -44,4 +41,5 @@ export class FileSystemRepository {
|
||||||
});
|
});
|
||||||
return filesToDir;
|
return filesToDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
import { CallbackStrategyWithValidationModel, ResponseBase } from "../controllers/http_controller";
|
|
||||||
import { Instance } from "../models/instance";
|
|
||||||
import { CreateDataBaseModelUseCase } from "../usecases/create_database_model_usecase";
|
|
||||||
import { CreateFolderUseCase } from "../usecases/create_folder_usecase";
|
|
||||||
|
|
||||||
export abstract class CreateInstanceScenario<V extends Instance> extends CallbackStrategyWithValidationModel<V> {
|
|
||||||
abstract validationModel: V;
|
|
||||||
abstract databaseModel: any;
|
|
||||||
call = async (model: V): ResponseBase => {
|
|
||||||
model.instancePath = `${model.path}/${model.instanceName}`;
|
|
||||||
console.log("INSTANCE PATh");
|
|
||||||
console.log(model.instancePath)
|
|
||||||
return (await new CreateFolderUseCase().call(model.instancePath)).map(
|
|
||||||
async () => await new CreateDataBaseModelUseCase(this.databaseModel).call(model)
|
|
||||||
);
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,16 +0,0 @@
|
||||||
import { Result } from "../helpers/result";
|
|
||||||
import { CreateFolderUseCase } from "../usecases/create_folder_usecase";
|
|
||||||
|
|
||||||
export class CreateManyFolderScenario {
|
|
||||||
call = async (path: string, foldersNames: string[]): Promise<Result<Error, string>> => {
|
|
||||||
try {
|
|
||||||
foldersNames.forEach(async (folder) => {
|
|
||||||
await new CreateFolderUseCase().call(`${path}${folder}`.normalize());
|
|
||||||
});
|
|
||||||
return Result.ok("many folder created");
|
|
||||||
} catch (error) {
|
|
||||||
return Result.error(new Error(error));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
import { App } from "../controllers/app";
|
|
||||||
import { CallbackStrategyWithValidationModel, ResponseBase } from "../controllers/http_controller";
|
|
||||||
import { StaticFilesServer } from "../models/static_files";
|
|
||||||
import { CreateDataBaseModelUseCase } from "../usecases/create_database_model_usecase";
|
|
||||||
import { CreateFolderUseCase } from "../usecases/create_folder_usecase";
|
|
||||||
|
|
||||||
interface IModel {
|
|
||||||
path: string;
|
|
||||||
name: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export abstract class CreateTemplateScenario<V extends IModel> extends CallbackStrategyWithValidationModel<V> {
|
|
||||||
validationModel: V;
|
|
||||||
abstract databaseModel: any;
|
|
||||||
abstract path: string;
|
|
||||||
call = async (model: V): ResponseBase => {
|
|
||||||
model.path = App.staticFilesStoreDir() + StaticFilesServer.process + model.name;
|
|
||||||
return (await new CreateFolderUseCase().call(model.path)).map(() => {
|
|
||||||
return new CreateDataBaseModelUseCase(this.databaseModel).call(model);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,20 +0,0 @@
|
||||||
import { CallbackStrategyWithIdQuery, ResponseBase } from "../controllers/http_controller";
|
|
||||||
import { Instance } from "../models/instance";
|
|
||||||
import { DeleteDataBaseModelUseCase } from "../usecases/delete_database_model_usecase";
|
|
||||||
import { DeleteRecursiveFolderUseCase } from "../usecases/delete_recursive_folder_usecase";
|
|
||||||
import { ReadByIdDataBaseModelUseCase } from "../usecases/read_by_id_database_model_usecase";
|
|
||||||
import { CoreValidation } from "../validations/core_validation";
|
|
||||||
import { MongoIdValidation } from "../validations/mongo_id_validation";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export abstract class DeleteInstanceScenario<D extends Instance> extends CallbackStrategyWithIdQuery {
|
|
||||||
abstract databaseModel: any;
|
|
||||||
idValidationExpression: CoreValidation = new MongoIdValidation();
|
|
||||||
call = async (id: string): ResponseBase =>
|
|
||||||
(await new ReadByIdDataBaseModelUseCase<D>(this.databaseModel).call(id)).map(async (model) => {
|
|
||||||
return (await new DeleteRecursiveFolderUseCase().call(model.instancePath)).map(
|
|
||||||
async () => await new DeleteDataBaseModelUseCase(this.databaseModel).call(id)
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
|
@ -1,20 +0,0 @@
|
||||||
import { CalculationsTemplateValidationModel } from "../../features/calculations_templates/models/calculations_template_validation_model";
|
|
||||||
import { CallbackStrategyWithIdQuery, ResponseBase } from "../controllers/http_controller";
|
|
||||||
import { DeleteDataBaseModelUseCase } from "../usecases/delete_database_model_usecase";
|
|
||||||
import { DeleteRecursiveFolderUseCase } from "../usecases/delete_recursive_folder_usecase";
|
|
||||||
import { ReadByIdDataBaseModelUseCase } from "../usecases/read_by_id_database_model_usecase";
|
|
||||||
import { CoreValidation } from "../validations/core_validation";
|
|
||||||
import { MongoIdValidation } from "../validations/mongo_id_validation";
|
|
||||||
|
|
||||||
export abstract class DeleteTemplateScenario extends CallbackStrategyWithIdQuery {
|
|
||||||
abstract databaseModel: any;
|
|
||||||
idValidationExpression: CoreValidation = new MongoIdValidation();
|
|
||||||
call = async (id: string): ResponseBase =>
|
|
||||||
(await new ReadByIdDataBaseModelUseCase<CalculationsTemplateValidationModel>(this.databaseModel).call(id)).map(
|
|
||||||
async (model) => {
|
|
||||||
return (await new DeleteRecursiveFolderUseCase().call(model.path)).map(
|
|
||||||
async () => await new DeleteDataBaseModelUseCase(this.databaseModel).call(id)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
|
@ -1,22 +0,0 @@
|
||||||
import { CallbackStrategyWithIdQuery } from "../controllers/http_controller";
|
|
||||||
import { Result } from "../helpers/result";
|
|
||||||
import { ReadByIdDataBaseModelUseCase } from "../usecases/read_by_id_database_model_usecase";
|
|
||||||
import { CoreValidation } from "../validations/core_validation";
|
|
||||||
import { MongoIdValidation } from "../validations/mongo_id_validation";
|
|
||||||
|
|
||||||
export class ReadByIdDataBaseModelScenario<D> extends CallbackStrategyWithIdQuery {
|
|
||||||
idValidationExpression: CoreValidation = new MongoIdValidation();
|
|
||||||
databaseModel: D;
|
|
||||||
|
|
||||||
constructor(model) {
|
|
||||||
super();
|
|
||||||
this.databaseModel = model;
|
|
||||||
}
|
|
||||||
call = async (id: string): Promise<Result<Error, D>> => {
|
|
||||||
try {
|
|
||||||
return new ReadByIdDataBaseModelUseCase<D>(this.databaseModel).call(id);
|
|
||||||
} catch (error) {
|
|
||||||
return Result.error(error);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,26 +1,28 @@
|
||||||
|
import {
|
||||||
|
IProjectInstanceModel,
|
||||||
import { IProjectModel, ProjectDBModel } from "../../features/projects/models/project_model_database_model";
|
ProjectInstanceDbModel,
|
||||||
|
} from "../../features/projects/models/project_instance_database_model";
|
||||||
|
import { pipelineRealTimeService } from "../../features/_realtime/realtime_presentation";
|
||||||
import { App } from "../controllers/app";
|
import { App } from "../controllers/app";
|
||||||
import { PipelineRealTimeService } from "../services/pipeline_real_time_service";
|
|
||||||
import { CreateFolderUseCase } from "../usecases/create_folder_usecase";
|
import { CreateFolderUseCase } from "../usecases/create_folder_usecase";
|
||||||
import { SearchOneDataBaseModelUseCase } from "../usecases/search_database_model_usecase";
|
import { SearchDataBaseModelUseCase } from "../usecases/search_database_model_usecase";
|
||||||
|
|
||||||
export const pipelineRealTimeService = new PipelineRealTimeService();
|
|
||||||
|
|
||||||
|
|
||||||
export class SetLastActivePipelineToRealTimeServiceScenario {
|
export class SetLastActivePipelineToRealTimeServiceScenario {
|
||||||
call = async (): Promise<void> => {
|
call = async (): Promise<void> => {
|
||||||
return (
|
return (
|
||||||
await new SearchOneDataBaseModelUseCase<IProjectModel>(ProjectDBModel).call({
|
await new SearchDataBaseModelUseCase<IProjectInstanceModel>(ProjectInstanceDbModel).call({
|
||||||
isActive: true,
|
isActive: true,
|
||||||
})
|
})
|
||||||
).fold(
|
).fold(
|
||||||
async (projectModel) => {
|
async (projectModel) => {
|
||||||
|
if (projectModel.project === null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const projectPath = App.staticFilesStoreDir() + projectModel.rootDir + "/";
|
const projectPath = App.staticFilesStoreDir() + projectModel.rootDir + "/";
|
||||||
await new CreateFolderUseCase().call(projectPath);
|
await new CreateFolderUseCase().call(projectPath);
|
||||||
pipelineRealTimeService.setPipelineDependency(
|
pipelineRealTimeService.setPipelineDependency(
|
||||||
|
projectModel.project.pipelines,
|
||||||
projectPath,
|
projectPath,
|
||||||
projectModel._id,
|
projectModel._id,
|
||||||
projectModel.rootDir
|
projectModel.rootDir
|
||||||
|
|
|
@ -41,7 +41,7 @@ export class ExecutorProgramService
|
||||||
await delay(300);
|
await delay(300);
|
||||||
|
|
||||||
this.worker = worker;
|
this.worker = worker;
|
||||||
|
|
||||||
const workerDataExec: WorkerDataExec = {
|
const workerDataExec: WorkerDataExec = {
|
||||||
command: command,
|
command: command,
|
||||||
execPath: this.execPath,
|
execPath: this.execPath,
|
||||||
|
@ -50,7 +50,6 @@ export class ExecutorProgramService
|
||||||
};
|
};
|
||||||
worker.send(workerDataExec);
|
worker.send(workerDataExec);
|
||||||
worker.on("message", (e) => {
|
worker.on("message", (e) => {
|
||||||
console.log(JSON.stringify(e));
|
|
||||||
const spawnError = SpawnError.isError(e);
|
const spawnError = SpawnError.isError(e);
|
||||||
|
|
||||||
if (spawnError instanceof SpawnError) {
|
if (spawnError instanceof SpawnError) {
|
||||||
|
@ -61,7 +60,7 @@ export class ExecutorProgramService
|
||||||
const execError = ExecError.isExecError(e);
|
const execError = ExecError.isExecError(e);
|
||||||
|
|
||||||
if (execError instanceof ExecError) {
|
if (execError instanceof ExecError) {
|
||||||
execError.id = id;
|
execError.id = id
|
||||||
this.emit(Result.error(execError));
|
this.emit(Result.error(execError));
|
||||||
this.worker = undefined;
|
this.worker = undefined;
|
||||||
return;
|
return;
|
||||||
|
@ -69,7 +68,7 @@ export class ExecutorProgramService
|
||||||
|
|
||||||
const executorResult = ExecutorResult.isExecutorResult(e);
|
const executorResult = ExecutorResult.isExecutorResult(e);
|
||||||
if (executorResult instanceof ExecutorResult) {
|
if (executorResult instanceof ExecutorResult) {
|
||||||
executorResult.id = id;
|
executorResult.id = id
|
||||||
this.emit(Result.ok(executorResult));
|
this.emit(Result.ok(executorResult));
|
||||||
this.worker = undefined;
|
this.worker = undefined;
|
||||||
return;
|
return;
|
||||||
|
@ -104,8 +103,7 @@ export class ExecutorProgramService
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const commands = command.split(" ");
|
this.workerExecuted(command, WorkerType.SPAWN, args, id);
|
||||||
this.workerExecuted(commands.at(0), WorkerType.SPAWN, commands.slice(1, commands.length), id);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,8 +58,9 @@ export class PipelineRealTimeService extends TypedEvent<ActivePipeline> {
|
||||||
this.status.pipelineIsRunning = false;
|
this.status.pipelineIsRunning = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setPipelineDependency(path: string, projectId: string, rootDir: string) {
|
setPipelineDependency(pipelineModels: IPipeline[], path: string, projectId: string, rootDir: string) {
|
||||||
this.status["projectId"] = projectId;
|
this.pipelineModels = pipelineModels;
|
||||||
|
this.status["projectId"] = projectId;
|
||||||
this.status["path"] = path;
|
this.status["path"] = path;
|
||||||
this.status["rootDir"] = rootDir;
|
this.status["rootDir"] = rootDir;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { FilesChangeNotifierService, IHashesCache } from "./files_change_notifier_service";
|
import { FilesChangeNotifierService, IHashesCache } from "./files_change_notifier_service";
|
||||||
import { IPipeline, Trigger } from "../models/process_model";
|
import { IPipeline } from "../models/process_model";
|
||||||
import { ExecutorProgramService } from "./executor_program_service";
|
import { ExecutorProgramService } from "./executor_program_service";
|
||||||
import { EXEC_EVENT, ExecError, SpawnError } from "../models/exec_error_model";
|
import { EXEC_EVENT, ExecError, SpawnError } from "../models/exec_error_model";
|
||||||
import { TypedEvent } from "../helpers/typed_event";
|
import { TypedEvent } from "../helpers/typed_event";
|
||||||
|
@ -7,7 +7,8 @@ import { Result } from "../helpers/result";
|
||||||
import { ExecutorResult } from "../models/executor_result";
|
import { ExecutorResult } from "../models/executor_result";
|
||||||
import { delay } from "../helpers/delay";
|
import { delay } from "../helpers/delay";
|
||||||
import { TriggerService } from "./trigger_service";
|
import { TriggerService } from "./trigger_service";
|
||||||
|
import { Trigger } from "../../features/_triggers/models/trigger_database_model";
|
||||||
|
|
||||||
export interface Iteration {
|
export interface Iteration {
|
||||||
hashes: IHashesCache | null;
|
hashes: IHashesCache | null;
|
||||||
pipeline: IPipeline;
|
pipeline: IPipeline;
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
// @ts-nocheck
|
|
||||||
import * as vm from "node:vm";
|
import * as vm from "node:vm";
|
||||||
import { IHashesCache } from "./files_change_notifier_service";
|
import { IHashesCache } from "./files_change_notifier_service";
|
||||||
import { EventsFileChanger } from "../models/meta_data_file_manager_model";
|
import { EventsFileChanger } from "../models/meta_data_file_manager_model";
|
||||||
import { Result } from "../helpers/result";
|
import { Result } from "../helpers/result";
|
||||||
import { TypedEvent } from "../helpers/typed_event";
|
import { TypedEvent } from "../helpers/typed_event";
|
||||||
import { Trigger } from "../models/process_model";
|
import { Trigger, TriggerType } from "../../features/_triggers/models/trigger_database_model";
|
||||||
|
|
||||||
export class TriggerCallResult {
|
export class TriggerCallResult {
|
||||||
results: Array<TriggerSuccessResult | TriggerErrorReport>;
|
results: Array<TriggerSuccessResult | TriggerErrorReport>;
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,24 @@
|
||||||
import { App } from "../controllers/app";
|
import { App } from "../controllers/app";
|
||||||
import { StaticFilesServer } from "../models/static_files";
|
|
||||||
import { FileSystemRepository } from "../repository/file_system_repository";
|
import { FileSystemRepository } from "../repository/file_system_repository";
|
||||||
import { CreateFolderUseCase } from "./create_folder_usecase";
|
import { CreateFolderUseCase } from "./create_folder_usecase";
|
||||||
|
|
||||||
export class CheckAndCreateStaticFilesFolderUseCase {
|
export class CheckAndCreateStaticFilesFolderUseCase {
|
||||||
fileSystemRepository: FileSystemRepository = new FileSystemRepository();
|
fileSystemRepository: FileSystemRepository;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.fileSystemRepository = new FileSystemRepository();
|
||||||
|
}
|
||||||
call = async (): Promise<void> => {
|
call = async (): Promise<void> => {
|
||||||
Object.keys(StaticFilesServer).forEach(async (key) => {
|
|
||||||
if (!(await this.fileSystemRepository.dirIsExists(App.staticFilesStoreDir() + key))) {
|
|
||||||
await new CreateFolderUseCase().call(App.staticFilesStoreDir() + key);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (await this.fileSystemRepository.dirIsExists(App.staticFilesStoreDir())) {
|
if (await this.fileSystemRepository.dirIsExists(App.staticFilesStoreDir())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await new CreateFolderUseCase().call(App.staticFilesStoreDir());
|
const createFolderUseCase = await new CreateFolderUseCase().call(App.staticFilesStoreDir());
|
||||||
|
|
||||||
|
createFolderUseCase.fold(
|
||||||
|
(_s) => {},
|
||||||
|
(e) => {
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
import { Result } from "../helpers/result";
|
|
||||||
import { FileSystemRepository } from "../repository/file_system_repository";
|
|
||||||
|
|
||||||
export class DeleteFileUseCase {
|
|
||||||
fileSystemRepository = new FileSystemRepository();
|
|
||||||
call = (path: string) => {
|
|
||||||
try {
|
|
||||||
this.fileSystemRepository.delete(path);
|
|
||||||
return Result.ok("file delete");
|
|
||||||
} catch {
|
|
||||||
return Result.error("Unknown error");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -4,6 +4,7 @@ import { FileSystemRepository } from "../repository/file_system_repository";
|
||||||
export class DeleteRecursiveFolderUseCase{
|
export class DeleteRecursiveFolderUseCase{
|
||||||
repository:FileSystemRepository = new FileSystemRepository()
|
repository:FileSystemRepository = new FileSystemRepository()
|
||||||
call = async (path:string):Promise<Result<void,void>> =>{
|
call = async (path:string):Promise<Result<void,void>> =>{
|
||||||
|
console.log(path)
|
||||||
await this.repository.deleteDirRecursive(path)
|
await this.repository.deleteDirRecursive(path)
|
||||||
return Result.ok()
|
return Result.ok()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
import * as cp from "child_process";
|
|
||||||
import { CallbackStrategyWithEmpty } from "../controllers/http_controller";
|
import { CallbackStrategyWithEmpty } from "../controllers/http_controller";
|
||||||
import { Result } from "../helpers/result";
|
import { Result } from "../helpers/result";
|
||||||
import { TypedEvent } from "../helpers/typed_event";
|
import { TypedEvent } from "../helpers/typed_event";
|
||||||
import { EXEC_EVENT, EXEC_TYPE, ExecError, SpawnError } from "../models/exec_error_model";
|
import { EXEC_TYPE, ExecError, SpawnError } from "../models/exec_error_model";
|
||||||
import { ExecutorResult } from "../models/executor_result";
|
import { ExecutorResult } from "../models/executor_result";
|
||||||
import { ExecutorProgramService } from "../services/executor_program_service";
|
import { ExecutorProgramService } from "../services/executor_program_service";
|
||||||
|
|
||||||
|
@ -27,7 +26,7 @@ export class ExecProcessUseCase {
|
||||||
call = async (
|
call = async (
|
||||||
path: string,
|
path: string,
|
||||||
command: string,
|
command: string,
|
||||||
id: string,
|
id:string,
|
||||||
watcher?: TypedEvent<Result<ExecError | SpawnError, ExecutorResult>>
|
watcher?: TypedEvent<Result<ExecError | SpawnError, ExecutorResult>>
|
||||||
): Promise<Result<Error, string>> => {
|
): Promise<Result<Error, string>> => {
|
||||||
try {
|
try {
|
||||||
|
@ -35,7 +34,7 @@ export class ExecProcessUseCase {
|
||||||
executorProgramService.on((event) => {
|
executorProgramService.on((event) => {
|
||||||
if (watcher) watcher.emit(event);
|
if (watcher) watcher.emit(event);
|
||||||
});
|
});
|
||||||
executorProgramService.call(EXEC_TYPE.EXEC, command, undefined, id);
|
executorProgramService.call(EXEC_TYPE.EXEC, command, undefined ,id);
|
||||||
|
|
||||||
return Result.ok("ok");
|
return Result.ok("ok");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -43,39 +42,3 @@ export class ExecProcessUseCase {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SpawnProcessUseCase {
|
|
||||||
call = async (
|
|
||||||
path: string,
|
|
||||||
command: string,
|
|
||||||
id: string,
|
|
||||||
watcher?: TypedEvent<Result<ExecError | SpawnError, ExecutorResult>>
|
|
||||||
): Promise<Result<Error, string>> => {
|
|
||||||
try {
|
|
||||||
const commands = command.split(" ");
|
|
||||||
|
|
||||||
const subprocess = cp.spawn(commands.at(0), commands.slice(1, commands.length), {
|
|
||||||
cwd: path,
|
|
||||||
});
|
|
||||||
const sendWatcher = (event: Buffer) => {
|
|
||||||
if (watcher) {
|
|
||||||
watcher.emit(Result.ok(new ExecutorResult(EXEC_TYPE.SPAWN, EXEC_EVENT.PROGRESS, event.toString())));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
subprocess.stdout.on("data", (data) => sendWatcher(data));
|
|
||||||
|
|
||||||
subprocess.stderr.on("data", (data) => sendWatcher(data));
|
|
||||||
|
|
||||||
subprocess.on("error", (error) => {
|
|
||||||
console.error(`Ошибка: ${error.message}`);
|
|
||||||
});
|
|
||||||
|
|
||||||
subprocess.on("close", (code) => {
|
|
||||||
console.log(`Процесс завершился с кодом: ${code}`);
|
|
||||||
});
|
|
||||||
return Result.ok('ok');
|
|
||||||
} catch (error) {
|
|
||||||
return Result.error(error);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
|
@ -2,9 +2,11 @@ import { Result } from "../helpers/result";
|
||||||
import { FileSystemRepository } from "../repository/file_system_repository";
|
import { FileSystemRepository } from "../repository/file_system_repository";
|
||||||
|
|
||||||
export class ReadFileAndParseJsonUseCase {
|
export class ReadFileAndParseJsonUseCase {
|
||||||
fileSystemRepository: FileSystemRepository = new FileSystemRepository();
|
fileSystemRepository: FileSystemRepository;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.fileSystemRepository = new FileSystemRepository();
|
||||||
|
}
|
||||||
async call<T>(path: string): Promise<Result<string, T>> {
|
async call<T>(path: string): Promise<Result<string, T>> {
|
||||||
try {
|
try {
|
||||||
if (RegExp(path).test("^(.+)/([^/]+)$")) {
|
if (RegExp(path).test("^(.+)/([^/]+)$")) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Result } from "../helpers/result";
|
import { Result } from "../helpers/result";
|
||||||
|
|
||||||
export class SearchOneDataBaseModelUseCase<T> {
|
export class SearchDataBaseModelUseCase<T> {
|
||||||
model: any;
|
model: any;
|
||||||
|
|
||||||
constructor(model: any) {
|
constructor(model: any) {
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
import { Result } from "../helpers/result";
|
|
||||||
|
|
||||||
export class SearchManyDataBaseModelUseCase<T> {
|
|
||||||
model: any;
|
|
||||||
|
|
||||||
constructor(model: any) {
|
|
||||||
this.model = model;
|
|
||||||
}
|
|
||||||
|
|
||||||
call = async (findFilter: Partial<T>, error: string = "not found database"): Promise<Result<string, T>> => {
|
|
||||||
const result = await this.model.find(findFilter);
|
|
||||||
if (result === null) {
|
|
||||||
return Result.error(error);
|
|
||||||
} else {
|
|
||||||
return Result.ok(result);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
58
server/src/features/_nix_store_manager/nix_store_manager.ts
Normal file
58
server/src/features/_nix_store_manager/nix_store_manager.ts
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
import { CallbackStrategyWithEmpty, CoreHttpController } from "../../core/controllers/http_controller";
|
||||||
|
import { Result } from "../../core/helpers/result";
|
||||||
|
import { EXEC_TYPE } from "../../core/models/exec_error_model";
|
||||||
|
import { ExecutorResult } from "../../core/models/executor_result";
|
||||||
|
import { IPipeline, IssueType, StackGenerateType } from "../../core/models/process_model";
|
||||||
|
import { StackService } from "../../core/services/stack_service";
|
||||||
|
import { TriggerType } from "../_triggers/models/trigger_database_model";
|
||||||
|
|
||||||
|
class NixStoreModel {}
|
||||||
|
|
||||||
|
const getNixStoreFolderCommand: IPipeline[] = [
|
||||||
|
{
|
||||||
|
process: {
|
||||||
|
type: EXEC_TYPE.EXEC,
|
||||||
|
command: `ls /nix/store`,
|
||||||
|
isGenerating: true,
|
||||||
|
isLocaleCode: false,
|
||||||
|
issueType: IssueType.WARNING,
|
||||||
|
},
|
||||||
|
trigger: {
|
||||||
|
type: TriggerType.FILE,
|
||||||
|
value: ["context"],
|
||||||
|
},
|
||||||
|
env: null,
|
||||||
|
stackGenerateType: StackGenerateType.SINGLETON,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
class GetNixStorePackagesUseCase extends CallbackStrategyWithEmpty {
|
||||||
|
call = async () => {
|
||||||
|
const stackService = new StackService(
|
||||||
|
getNixStoreFolderCommand,
|
||||||
|
"/Users/idontsudo/Desktop/testdeck-mocha-seed/server/build/test/"
|
||||||
|
);
|
||||||
|
stackService.call();
|
||||||
|
|
||||||
|
const promise = new Promise((resolve, _reject) => {
|
||||||
|
stackService.on((e) => {
|
||||||
|
const iteration = e.firstElement();
|
||||||
|
if (iteration.result instanceof ExecutorResult) {
|
||||||
|
const nixPackage = iteration.result.data;
|
||||||
|
resolve(nixPackage.split("\n").filter((e) => e.hasNoPattern(".drv")));
|
||||||
|
} else {
|
||||||
|
return "GetNixStorePackagesUseCase unknown Error";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return Result.ok(await promise);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export class NixStoreManagerPresentation extends CoreHttpController<NixStoreModel> {
|
||||||
|
constructor() {
|
||||||
|
super({
|
||||||
|
url: "nix_store_api",
|
||||||
|
});
|
||||||
|
super.get(new GetNixStorePackagesUseCase().call);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
import { Schema, model } from "mongoose";
|
||||||
|
import { IPipeline } from "../../../core/models/process_model";
|
||||||
|
import { schemaProcess } from "../../_process/models/process_database_model";
|
||||||
|
import { triggerSchema } from "../../_triggers/models/trigger_database_model";
|
||||||
|
|
||||||
|
export const PipelineSchema = new Schema({
|
||||||
|
process: {
|
||||||
|
type: Schema.Types.ObjectId,
|
||||||
|
ref: schemaProcess,
|
||||||
|
autopopulate: true,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
trigger: {
|
||||||
|
type: Schema.Types.ObjectId,
|
||||||
|
ref: triggerSchema,
|
||||||
|
autopopulate: true,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
stackGenerateType: {
|
||||||
|
type: String,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
}).plugin(require("mongoose-autopopulate"));
|
||||||
|
|
||||||
|
export const schemaPipeline = "Pipeline";
|
||||||
|
|
||||||
|
export const PipelineDBModel = model<IPipeline>(schemaPipeline, PipelineSchema);
|
21
server/src/features/_pipelines/models/pipeline_model.ts
Normal file
21
server/src/features/_pipelines/models/pipeline_model.ts
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
import { IsOptional, ValidateNested } from "class-validator";
|
||||||
|
import { IPipeline, IProcess, StackGenerateType } from "../../../core/models/process_model";
|
||||||
|
import { Type } from "class-transformer";
|
||||||
|
import { ProcessModel } from "../../_process/models/process_validation_model";
|
||||||
|
import { TriggerModelValidationModel } from "../../_triggers/models/trigger_validation_model";
|
||||||
|
|
||||||
|
export class PipelineModel implements IPipeline {
|
||||||
|
@ValidateNested()
|
||||||
|
@Type(() => ProcessModel)
|
||||||
|
public process: IProcess;
|
||||||
|
|
||||||
|
@ValidateNested()
|
||||||
|
@Type(() => TriggerModelValidationModel)
|
||||||
|
public trigger: TriggerModelValidationModel;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
public env = null;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
public stackGenerateType: StackGenerateType;
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
import { IsMongoId, IsOptional } from "class-validator";
|
||||||
|
import { IProcess, StackGenerateType } from "../../../core/models/process_model";
|
||||||
|
import { TriggerModelValidationModel } from "../../_triggers/models/trigger_validation_model";
|
||||||
|
|
||||||
|
export class PipelineValidationModel {
|
||||||
|
@IsMongoId()
|
||||||
|
public process: IProcess;
|
||||||
|
|
||||||
|
@IsMongoId()
|
||||||
|
public trigger: TriggerModelValidationModel;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
public env = null;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
public stackGenerateType: StackGenerateType;
|
||||||
|
}
|
13
server/src/features/_pipelines/pipeline_presentation.ts
Normal file
13
server/src/features/_pipelines/pipeline_presentation.ts
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
import { CrudController } from "../../core/controllers/crud_controller";
|
||||||
|
import { PipelineDBModel } from "./models/pipeline_database_model";
|
||||||
|
import { PipelineValidationModel } from "./models/pipeline_validation_model";
|
||||||
|
|
||||||
|
export class PipelinePresentation extends CrudController<PipelineValidationModel, typeof PipelineDBModel> {
|
||||||
|
constructor() {
|
||||||
|
super({
|
||||||
|
url: "pipeline",
|
||||||
|
validationModel: PipelineValidationModel,
|
||||||
|
databaseModel: PipelineDBModel,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
import { Schema, model } from "mongoose";
|
||||||
|
import { IProcess } from "../../../core/models/process_model";
|
||||||
|
|
||||||
|
export const ProcessSchema = new Schema({
|
||||||
|
type: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
description: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
command: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
isGenerating: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
isLocaleCode: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
issueType: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
timeout: {
|
||||||
|
type: Number,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
commit: {
|
||||||
|
type: String,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export const schemaProcess = "Process";
|
||||||
|
|
||||||
|
export const ProcessDBModel = model<IProcess>(schemaProcess, ProcessSchema);
|
|
@ -0,0 +1,31 @@
|
||||||
|
import { IsBoolean, IsEnum, IsNumber, IsOptional, IsString } from "class-validator";
|
||||||
|
import { EXEC_TYPE } from "../../../core/models/exec_error_model";
|
||||||
|
import { IProcess, IssueType } from "../../../core/models/process_model";
|
||||||
|
|
||||||
|
export class ProcessModel implements IProcess {
|
||||||
|
@IsEnum(EXEC_TYPE)
|
||||||
|
public type: EXEC_TYPE;
|
||||||
|
|
||||||
|
@IsString()
|
||||||
|
public description: string;
|
||||||
|
|
||||||
|
@IsString()
|
||||||
|
public command: string;
|
||||||
|
|
||||||
|
@IsBoolean()
|
||||||
|
public isGenerating: boolean;
|
||||||
|
|
||||||
|
@IsBoolean()
|
||||||
|
public isLocaleCode: boolean;
|
||||||
|
|
||||||
|
@IsEnum(IssueType)
|
||||||
|
public issueType: IssueType;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@IsNumber()
|
||||||
|
public timeout?: number;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@IsString()
|
||||||
|
public commit?: string;
|
||||||
|
}
|
13
server/src/features/_process/process_presentation.ts
Normal file
13
server/src/features/_process/process_presentation.ts
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
import { CrudController } from "../../core/controllers/crud_controller";
|
||||||
|
import { ProcessDBModel } from "./models/process_database_model";
|
||||||
|
import { ProcessModel } from "./models/process_validation_model";
|
||||||
|
|
||||||
|
export class ProcessPresentation extends CrudController<ProcessModel, typeof ProcessDBModel> {
|
||||||
|
constructor() {
|
||||||
|
super({
|
||||||
|
url: "process",
|
||||||
|
validationModel: ProcessModel,
|
||||||
|
databaseModel: ProcessDBModel,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,7 +1,9 @@
|
||||||
import { Schema, model } from "mongoose";
|
import { Schema, model } from "mongoose";
|
||||||
|
import { PipelineValidationModel } from "../../_pipelines/models/pipeline_validation_model";
|
||||||
|
|
||||||
export interface IProjectModel {
|
export interface IProjectModel {
|
||||||
_id?: string;
|
_id?: string;
|
||||||
|
pipelines: [PipelineValidationModel];
|
||||||
rootDir: string;
|
rootDir: string;
|
||||||
description: string;
|
description: string;
|
||||||
isActive: boolean;
|
isActive: boolean;
|
|
@ -0,0 +1,9 @@
|
||||||
|
import { IsArray, IsString } from "class-validator";
|
||||||
|
|
||||||
|
export class ProjectValidationModel {
|
||||||
|
@IsArray()
|
||||||
|
public pipelines: [string];
|
||||||
|
|
||||||
|
@IsString()
|
||||||
|
public description: string;
|
||||||
|
}
|
13
server/src/features/_projects/projects_presentation.ts
Normal file
13
server/src/features/_projects/projects_presentation.ts
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
import { CrudController } from "../../core/controllers/crud_controller";
|
||||||
|
import { ProjectDBModel } from "./models/project_database_model";
|
||||||
|
import { ProjectValidationModel } from "./models/project_validation_model";
|
||||||
|
|
||||||
|
export class ProjectsPresentation extends CrudController<ProjectValidationModel, typeof ProjectDBModel> {
|
||||||
|
constructor() {
|
||||||
|
super({
|
||||||
|
url: "project",
|
||||||
|
validationModel: ProjectValidationModel,
|
||||||
|
databaseModel: ProjectDBModel,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
import { Result } from "../../../core/helpers/result";
|
import { Result } from "../../../core/helpers/result";
|
||||||
import { ActivePipeline } from "../../../core/models/active_pipeline_model";
|
import { ActivePipeline } from "../../../core/models/active_pipeline_model";
|
||||||
import { pipelineRealTimeService } from "../../../core/scenarios/set_active_pipeline_to_realtime_service_scenario";
|
import { pipelineRealTimeService } from "../realtime_presentation";
|
||||||
|
|
||||||
export class PipelineStatusUseCase {
|
export class PipelineStatusUseCase {
|
||||||
async call(): Promise<Result<Error, ActivePipeline>> {
|
async call(): Promise<Result<Error, ActivePipeline>> {
|
||||||
try {
|
try {
|
||||||
|
@ -18,4 +18,3 @@ export class PipelineStatusUseCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
import { App } from "../../../core/controllers/app";
|
||||||
|
import { CallbackStrategyWithEmpty } from "../../../core/controllers/http_controller";
|
||||||
|
import { Result } from "../../../core/helpers/result";
|
||||||
|
import { IPipeline } from "../../../core/models/process_model";
|
||||||
|
import { ReadByIdDataBaseModelUseCase } from "../../../core/usecases/read_by_id_database_model_usecase";
|
||||||
|
import { PipelineValidationModel } from "../../_pipelines/models/pipeline_validation_model";
|
||||||
|
import { IProjectInstanceModel, ProjectInstanceDbModel } from "../../projects/models/project_instance_database_model";
|
||||||
|
import { pipelineRealTimeService } from "../realtime_presentation";
|
||||||
|
import { PipelineStatusUseCase } from "./pipeline_status_usecase";
|
||||||
|
|
||||||
|
const mongoPipelineModelMapper = (el: PipelineValidationModel): IPipeline => {
|
||||||
|
const mapObj: IPipeline = {
|
||||||
|
process: {
|
||||||
|
type: el.process.type,
|
||||||
|
command: el.process.command,
|
||||||
|
isGenerating: Boolean(el.process.isGenerating),
|
||||||
|
isLocaleCode: Boolean(el.process.isLocaleCode),
|
||||||
|
issueType: el.process.issueType,
|
||||||
|
},
|
||||||
|
trigger: {
|
||||||
|
type: el.trigger.type,
|
||||||
|
value: el.trigger.value.map((el) => String(el)),
|
||||||
|
},
|
||||||
|
env: null,
|
||||||
|
stackGenerateType: el.stackGenerateType,
|
||||||
|
};
|
||||||
|
return mapObj;
|
||||||
|
};
|
||||||
|
|
||||||
|
export class RunInstancePipelineUseCase extends CallbackStrategyWithEmpty {
|
||||||
|
async call(): Promise<Result<any, string>> {
|
||||||
|
return (await new PipelineStatusUseCase().call()).map(async (activePipelineModel) => {
|
||||||
|
if (activePipelineModel.pipelineIsRunning) {
|
||||||
|
return Result.error("pipeline is running");
|
||||||
|
}
|
||||||
|
const readByIdDataBaseModelUseCase = await new ReadByIdDataBaseModelUseCase<IProjectInstanceModel>(
|
||||||
|
ProjectInstanceDbModel
|
||||||
|
).call(activePipelineModel.projectId);
|
||||||
|
|
||||||
|
if (readByIdDataBaseModelUseCase.isFailure()) {
|
||||||
|
return readByIdDataBaseModelUseCase.forward();
|
||||||
|
}
|
||||||
|
const projectModel = readByIdDataBaseModelUseCase.value;
|
||||||
|
const resultMapper = projectModel.project.pipelines.map((el) => mongoPipelineModelMapper(el));
|
||||||
|
|
||||||
|
pipelineRealTimeService.setPipelineDependency(
|
||||||
|
resultMapper,
|
||||||
|
App.staticFilesStoreDir() + projectModel.rootDir + "/",
|
||||||
|
projectModel._id,
|
||||||
|
projectModel.rootDir
|
||||||
|
);
|
||||||
|
|
||||||
|
pipelineRealTimeService.runPipeline();
|
||||||
|
return Result.ok("ok");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
28
server/src/features/_realtime/realtime_presentation.ts
Normal file
28
server/src/features/_realtime/realtime_presentation.ts
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
import { IsString } from "class-validator";
|
||||||
|
import { CoreHttpController } from "../../core/controllers/http_controller";
|
||||||
|
import { PipelineRealTimeService } from "../../core/services/pipeline_real_time_service";
|
||||||
|
import { RunInstancePipelineUseCase } from "./domain/run_instance_pipeline_usecase";
|
||||||
|
import { PipelineStatusUseCase } from "./domain/pipeline_status_usecase";
|
||||||
|
|
||||||
|
export const pipelineRealTimeService = new PipelineRealTimeService();
|
||||||
|
|
||||||
|
export class RealTimeValidationModel {
|
||||||
|
@IsString()
|
||||||
|
public id: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class RealTimePresentation extends CoreHttpController<RealTimeValidationModel> {
|
||||||
|
constructor() {
|
||||||
|
super({
|
||||||
|
validationModel: RealTimeValidationModel,
|
||||||
|
url: "realtime",
|
||||||
|
databaseModel: null,
|
||||||
|
});
|
||||||
|
super.get(new PipelineStatusUseCase().call);
|
||||||
|
this.subRoutes.push({
|
||||||
|
method: "POST",
|
||||||
|
subUrl: "run",
|
||||||
|
fn: new RunInstancePipelineUseCase(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
import { Schema, model } from "mongoose";
|
||||||
|
|
||||||
|
export interface ITriggerModel {
|
||||||
|
_id?: string;
|
||||||
|
type: string;
|
||||||
|
description: string;
|
||||||
|
value: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export const TriggerSchema = new Schema({
|
||||||
|
type: {
|
||||||
|
type: String,
|
||||||
|
require: true,
|
||||||
|
},
|
||||||
|
description: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
value: {
|
||||||
|
type: Array,
|
||||||
|
require: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export const triggerSchema = "Trigger";
|
||||||
|
|
||||||
|
export const TriggerDBModel = model<ITriggerModel>(triggerSchema, TriggerSchema);
|
||||||
|
|
||||||
|
export enum TriggerType {
|
||||||
|
PROCESS = "PROCESS",
|
||||||
|
FILE = "FILE",
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Trigger {
|
||||||
|
type: TriggerType;
|
||||||
|
value: string[];
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
import { IsArray, IsOptional, IsEnum, IsString } from "class-validator";
|
||||||
|
import { ITriggerModel, TriggerType } from "./trigger_database_model";
|
||||||
|
|
||||||
|
export class TriggerModelValidationModel implements ITriggerModel {
|
||||||
|
@IsOptional()
|
||||||
|
public _id: string;
|
||||||
|
|
||||||
|
@IsString()
|
||||||
|
public description;
|
||||||
|
|
||||||
|
@IsEnum(TriggerType)
|
||||||
|
public type: TriggerType;
|
||||||
|
|
||||||
|
@IsArray()
|
||||||
|
public value: string[];
|
||||||
|
}
|
13
server/src/features/_triggers/triggers_presentation.ts
Normal file
13
server/src/features/_triggers/triggers_presentation.ts
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
import { CrudController } from "../../core/controllers/crud_controller";
|
||||||
|
import { TriggerDBModel } from "./models/trigger_database_model";
|
||||||
|
import { TriggerModelValidationModel } from "./models/trigger_validation_model";
|
||||||
|
|
||||||
|
export class TriggerPresentation extends CrudController<TriggerModelValidationModel, typeof TriggerDBModel> {
|
||||||
|
constructor() {
|
||||||
|
super({
|
||||||
|
url: "trigger",
|
||||||
|
validationModel: TriggerModelValidationModel,
|
||||||
|
databaseModel: TriggerDBModel,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,48 +0,0 @@
|
||||||
import { CrudController } from "../../core/controllers/crud_controller";
|
|
||||||
import { GetBehaviorTreeSkillsTemplatesUseCase } from "./domain/get_bt_skills_templates_usecase";
|
|
||||||
import { BehaviorTreeValidationModel } from "./models/behavior_tree_validation_model";
|
|
||||||
import { BehaviorTreeDBModel } from "./models/behavior_tree_database_model";
|
|
||||||
import { ReadByIdDataBaseModelScenario } from "../../core/scenarios/read_by_id_database_model_scenario";
|
|
||||||
import { GetBehaviorTreeActiveProjectScenario } from "./domain/get_behavior_tree_active_project_scenario";
|
|
||||||
import { SaveBtScenario as FillBtScenario } from "./domain/save_bt_scenario";
|
|
||||||
import { GetCameraUseCase } from "./domain/get_cameras_usecase";
|
|
||||||
import { GetRobotsUseCase } from "./domain/get_robots_usecase";
|
|
||||||
import { GetTopicsUseCase } from "./domain/get_topics_usecase";
|
|
||||||
|
|
||||||
export class BehaviorTreesPresentation extends CrudController<BehaviorTreeValidationModel, typeof BehaviorTreeDBModel> {
|
|
||||||
constructor() {
|
|
||||||
super({
|
|
||||||
url: "behavior/trees",
|
|
||||||
validationModel: BehaviorTreeValidationModel,
|
|
||||||
databaseModel: BehaviorTreeDBModel,
|
|
||||||
});
|
|
||||||
super.get(new GetBehaviorTreeActiveProjectScenario().call);
|
|
||||||
this.subRoutes.push({
|
|
||||||
method: "POST",
|
|
||||||
subUrl: "fill/tree",
|
|
||||||
fn: new FillBtScenario(),
|
|
||||||
});
|
|
||||||
this.subRoutes.push({ method: "GET", subUrl: "templates", fn: new GetBehaviorTreeSkillsTemplatesUseCase() });
|
|
||||||
this.subRoutes.push({
|
|
||||||
method: "GET",
|
|
||||||
subUrl: "by_id",
|
|
||||||
fn: new ReadByIdDataBaseModelScenario<BehaviorTreeValidationModel>(BehaviorTreeDBModel),
|
|
||||||
});
|
|
||||||
this.subRoutes.push({
|
|
||||||
method: "GET",
|
|
||||||
subUrl: "cameras",
|
|
||||||
fn: new GetCameraUseCase()
|
|
||||||
})
|
|
||||||
this.subRoutes.push({
|
|
||||||
method: "GET",
|
|
||||||
subUrl: "robots",
|
|
||||||
fn: new GetRobotsUseCase()
|
|
||||||
})
|
|
||||||
this.subRoutes.push({
|
|
||||||
method: "GET",
|
|
||||||
subUrl: "topics",
|
|
||||||
fn: new GetTopicsUseCase()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
import { CallbackStrategyWithEmpty, ResponseBase } from "../../../core/controllers/http_controller";
|
|
||||||
import { Result } from "../../../core/helpers/result";
|
|
||||||
import { SearchOneDataBaseModelUseCase } from "../../../core/usecases/search_database_model_usecase";
|
|
||||||
import { IProjectModel, ProjectDBModel } from "../../projects/models/project_model_database_model";
|
|
||||||
import { BehaviorTreeDBModel } from "../models/behavior_tree_database_model";
|
|
||||||
|
|
||||||
export class GetBehaviorTreeActiveProjectScenario extends CallbackStrategyWithEmpty {
|
|
||||||
call = async (): ResponseBase =>
|
|
||||||
(
|
|
||||||
await new SearchOneDataBaseModelUseCase<IProjectModel>(ProjectDBModel).call(
|
|
||||||
{ isActive: true },
|
|
||||||
"no active projects"
|
|
||||||
)
|
|
||||||
).map(async (project) => Result.ok(await BehaviorTreeDBModel.find({ project: project._id })));
|
|
||||||
}
|
|
|
@ -1,102 +0,0 @@
|
||||||
import { CallbackStrategyWithEmpty, ResponseBase } from "../../../core/controllers/http_controller";
|
|
||||||
import { Result } from "../../../core/helpers/result";
|
|
||||||
|
|
||||||
export class GetBehaviorTreeSkillsTemplatesUseCase extends CallbackStrategyWithEmpty {
|
|
||||||
call = async (): ResponseBase => {
|
|
||||||
return Result.ok({
|
|
||||||
skills: [
|
|
||||||
{
|
|
||||||
SkillPackage: { name: "Robossembler", version: "1.0", format: "1" },
|
|
||||||
Module: { name: "MoveToPose", description: "Move to Pose skill with cartesian controllers" },
|
|
||||||
Launch: { package: "rbss_movetopose", executable: "mtp_cartesian.py", name: "mtp_cartesian" },
|
|
||||||
BTAction: [
|
|
||||||
{
|
|
||||||
name: "move",
|
|
||||||
type: "action",
|
|
||||||
param: [
|
|
||||||
{
|
|
||||||
type: "move_to_pose",
|
|
||||||
dependency: {},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
Interface: {
|
|
||||||
Input: [
|
|
||||||
{ name: "robotName", type: "ROBOT" },
|
|
||||||
{ name: "pose", type: "POSE" },
|
|
||||||
],
|
|
||||||
Output: [],
|
|
||||||
},
|
|
||||||
Settings: [
|
|
||||||
{ name: "topicServer", value: "cartesian_move_to_pose" },
|
|
||||||
{ name: "end_effector_velocity", value: 1.0 },
|
|
||||||
{ name: "end_effector_acceleration", value: 1.0 },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Module: { name: "MMM", description: "Move to Pose skill with cartesian controllers" },
|
|
||||||
topicOut: [
|
|
||||||
{
|
|
||||||
topicName: "",
|
|
||||||
topicType: "",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
BTAction: [
|
|
||||||
{
|
|
||||||
name: "move",
|
|
||||||
type: "action",
|
|
||||||
param: [
|
|
||||||
{
|
|
||||||
type: "move_to_pose",
|
|
||||||
dependency: {},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
SkillPackage: { name: "Robossembler", version: "1.0", format: "1", type: "Action" },
|
|
||||||
Module: { name: "PoseEstimation", description: "Pose Estimation skill with DOPE" },
|
|
||||||
Launch: { package: "rbs_perception", executable: "pe_dope_lc.py", name: "lc_dope" },
|
|
||||||
BTAction: [
|
|
||||||
{
|
|
||||||
name: "peConfigure",
|
|
||||||
type: "run",
|
|
||||||
param: [
|
|
||||||
{
|
|
||||||
type: "weights",
|
|
||||||
dependency: {},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: "camera",
|
|
||||||
dependency: {},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: "topic",
|
|
||||||
dependency: {},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
result: ["POSE"],
|
|
||||||
},
|
|
||||||
{ name: "peStop", type: "stop", param: [], result: [] },
|
|
||||||
],
|
|
||||||
Interface: {
|
|
||||||
Input: [
|
|
||||||
{ name: "cameraLink", type: "CAMERA" },
|
|
||||||
{ name: "object_name", type: "MODEL" },
|
|
||||||
],
|
|
||||||
Output: [{ name: "pose_estimation_topic", type: "POSE" }],
|
|
||||||
},
|
|
||||||
Settings: [
|
|
||||||
{ name: "cameraLink", value: "inner_rgbd_camera" },
|
|
||||||
{ name: "pose", value: "" },
|
|
||||||
{ name: "publishDelay", value: 0.5 },
|
|
||||||
{ name: "tf2_send_pose", value: 1 },
|
|
||||||
{ name: "mesh_scale", value: 0.001 },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,120 +0,0 @@
|
||||||
import { CallbackStrategyWithEmpty, ResponseBase } from "../../../core/controllers/http_controller"
|
|
||||||
import { Result } from "../../../core/helpers/result"
|
|
||||||
|
|
||||||
export class GetCameraUseCase extends CallbackStrategyWithEmpty {
|
|
||||||
call = async (): ResponseBase => {
|
|
||||||
return Result.ok({
|
|
||||||
"camera": [
|
|
||||||
{
|
|
||||||
"sid": "1",
|
|
||||||
"DevicePackage": {
|
|
||||||
"name": "Robossembler",
|
|
||||||
"version": "1.0",
|
|
||||||
"format": "1"
|
|
||||||
},
|
|
||||||
"Module": {
|
|
||||||
"name": "RealSense Dxx",
|
|
||||||
"description": "ROS Wrapper for Intel(R) RealSense(TM) Cameras"
|
|
||||||
},
|
|
||||||
"Launch": {
|
|
||||||
"package": "realsense2_camera",
|
|
||||||
"executable": "rs_launch.py"
|
|
||||||
},
|
|
||||||
"DTwin": [
|
|
||||||
{
|
|
||||||
"interface": {
|
|
||||||
"input": [
|
|
||||||
{
|
|
||||||
"camera_namespace": "robot1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"camera_name": "455_1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"serial_port": "USB_1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"pose": "[0.0,0.0,0.0,0.0,0.0,0.0]"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"Interface": {
|
|
||||||
"param": [
|
|
||||||
{
|
|
||||||
"type": "camera",
|
|
||||||
"dependency": {}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"Settings": [
|
|
||||||
{
|
|
||||||
"name": "camera_config",
|
|
||||||
"description": "Camera Config",
|
|
||||||
"type": "file",
|
|
||||||
"defaultValue": "{ rgb_camera.profile: 1280x720x15 }"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"sid": "2",
|
|
||||||
"DevicePackage": {
|
|
||||||
"name": "Robossembler",
|
|
||||||
"version": "1.0",
|
|
||||||
"format": "1"
|
|
||||||
},
|
|
||||||
"Module": {
|
|
||||||
"name": "RealSense Dxx",
|
|
||||||
"description": "ROS Wrapper for Intel(R) RealSense(TM) Cameras"
|
|
||||||
},
|
|
||||||
"Launch": {
|
|
||||||
"package": "realsense2_camera",
|
|
||||||
"executable": "rs_launch.py"
|
|
||||||
},
|
|
||||||
|
|
||||||
"DTwin": [
|
|
||||||
{
|
|
||||||
"interface": {
|
|
||||||
"input": [
|
|
||||||
{
|
|
||||||
"camera_namespace": "robot1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"camera_name": "455_1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"serial_port": "USB_1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"pose": "[0.0,0.0,0.0,0.0,0.0,0.0]"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"Interface": {
|
|
||||||
"param": [
|
|
||||||
{
|
|
||||||
"type": "camera",
|
|
||||||
"dependency": {}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"Settings": [
|
|
||||||
{
|
|
||||||
"name": "camera_config",
|
|
||||||
"description": "Camera Config",
|
|
||||||
"type": "file",
|
|
||||||
"defaultValue": "{ rgb_camera.profile: 1280x720x15 }"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,50 +0,0 @@
|
||||||
import { CallbackStrategyWithEmpty, ResponseBase } from "../../../core/controllers/http_controller";
|
|
||||||
import { Result } from "../../../core/helpers/result";
|
|
||||||
|
|
||||||
export class GetRobotsUseCase extends CallbackStrategyWithEmpty {
|
|
||||||
call = async (): ResponseBase => {
|
|
||||||
return Result.ok({
|
|
||||||
"robots": [
|
|
||||||
{
|
|
||||||
"sid": "1",
|
|
||||||
"DevicePackage": {
|
|
||||||
"name": "Robossembler",
|
|
||||||
"version": "1.0",
|
|
||||||
"format": "1"
|
|
||||||
},
|
|
||||||
"Module": {
|
|
||||||
"name": "RBS",
|
|
||||||
"description": "Main Robot"
|
|
||||||
},
|
|
||||||
"Launch": {
|
|
||||||
"package": "rbs_bringup",
|
|
||||||
"executable": "single_robot.launch.py"
|
|
||||||
},
|
|
||||||
"DTwin": [
|
|
||||||
{
|
|
||||||
"interface": {
|
|
||||||
"input": [
|
|
||||||
{
|
|
||||||
"robot_namespace": "robot1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"dof": 6
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"Settings": [
|
|
||||||
{
|
|
||||||
"name": "robot_type",
|
|
||||||
"description": "Type of robot by name",
|
|
||||||
"defaultValue": "rbs_arm"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
import { CallbackStrategyWithEmpty, ResponseBase } from "../../../core/controllers/http_controller";
|
|
||||||
import { Result } from "../../../core/helpers/result";
|
|
||||||
|
|
||||||
export class GetTopicsUseCase extends CallbackStrategyWithEmpty {
|
|
||||||
call = async (): ResponseBase => {
|
|
||||||
return Result.ok({
|
|
||||||
"topics": [
|
|
||||||
{
|
|
||||||
"sid": "1",
|
|
||||||
"name": "topic camera 1",
|
|
||||||
"type": "sensor_msgs/Image"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"sid": "2",
|
|
||||||
"name": "topic camera 2",
|
|
||||||
"type": "sensor_msgs/Image"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,32 +0,0 @@
|
||||||
import { CallbackStrategyWithValidationModel, ResponseBase } from "../../../core/controllers/http_controller";
|
|
||||||
import { CreateFileUseCase } from "../../../core/usecases/create_file_usecase";
|
|
||||||
import { CreateFolderUseCase } from "../../../core/usecases/create_folder_usecase";
|
|
||||||
import { SearchOneDataBaseModelUseCase } from "../../../core/usecases/search_database_model_usecase";
|
|
||||||
import { FolderStructure } from "../../projects/domain/upload_file_to_to_project_scenario";
|
|
||||||
import { IProjectModel, ProjectDBModel } from "../../projects/models/project_model_database_model";
|
|
||||||
import { BehaviorTreeValidationModel } from "../models/behavior_tree_validation_model";
|
|
||||||
|
|
||||||
export class SaveBtScenario extends CallbackStrategyWithValidationModel<BehaviorTreeValidationModel> {
|
|
||||||
validationModel: BehaviorTreeValidationModel = new BehaviorTreeValidationModel();
|
|
||||||
call = async (model: BehaviorTreeValidationModel): ResponseBase =>
|
|
||||||
(
|
|
||||||
await new SearchOneDataBaseModelUseCase<IProjectModel>(ProjectDBModel).call(
|
|
||||||
{ isActive: true },
|
|
||||||
"no active projects"
|
|
||||||
)
|
|
||||||
).map(async (project) => {
|
|
||||||
const folder = `${project.rootDir}/${FolderStructure.behaviorTrees}/`;
|
|
||||||
|
|
||||||
(await new CreateFolderUseCase().call(folder)).map(async () =>
|
|
||||||
(await new CreateFolderUseCase().call(`${folder}${model.name}/`)).map(async () =>
|
|
||||||
(await new CreateFileUseCase().call(`${folder}${model.name}/bt.xml`, Buffer.from(model.xml))).map(
|
|
||||||
async () =>
|
|
||||||
await new CreateFileUseCase().call(
|
|
||||||
`${folder}${model.name}/skills.json`,
|
|
||||||
Buffer.from(JSON.stringify(model.skills))
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
|
@ -1,49 +0,0 @@
|
||||||
import { Schema, model } from "mongoose";
|
|
||||||
import { IProjectModel, projectSchema } from "../../projects/models/project_model_database_model";
|
|
||||||
|
|
||||||
export interface IBehaviorTreeModel {
|
|
||||||
name: string;
|
|
||||||
project?: IProjectModel | string;
|
|
||||||
unixTime?: number;
|
|
||||||
local_path?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const BehaviorTreeSchema = new Schema({
|
|
||||||
name: {
|
|
||||||
type: String,
|
|
||||||
},
|
|
||||||
description: { type: String },
|
|
||||||
scene: {
|
|
||||||
type: Schema.Types.Mixed,
|
|
||||||
default: [],
|
|
||||||
},
|
|
||||||
local_path: {
|
|
||||||
type: String,
|
|
||||||
},
|
|
||||||
unixTime: {
|
|
||||||
type: Number,
|
|
||||||
},
|
|
||||||
isFinished: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
dependency: {
|
|
||||||
type: Schema.Types.Mixed,
|
|
||||||
},
|
|
||||||
skills: {
|
|
||||||
type: Schema.Types.Mixed,
|
|
||||||
},
|
|
||||||
sceneId: {
|
|
||||||
type: String,
|
|
||||||
},
|
|
||||||
project: {
|
|
||||||
type: Schema.Types.ObjectId,
|
|
||||||
ref: projectSchema,
|
|
||||||
autopopulate: true,
|
|
||||||
require: true,
|
|
||||||
},
|
|
||||||
}).plugin(require("mongoose-autopopulate"));
|
|
||||||
|
|
||||||
export const behaviorTreeSchema = "Behavior";
|
|
||||||
|
|
||||||
export const BehaviorTreeDBModel = model<IBehaviorTreeModel>(behaviorTreeSchema, BehaviorTreeSchema);
|
|
|
@ -1,13 +0,0 @@
|
||||||
import { IsMongoId, IsNumber, IsString } from "class-validator";
|
|
||||||
import { IBehaviorTreeModel } from "./behavior_tree_database_model";
|
|
||||||
|
|
||||||
export class BehaviorTreeValidationModel implements IBehaviorTreeModel {
|
|
||||||
@IsString()
|
|
||||||
public name: string;
|
|
||||||
@IsMongoId()
|
|
||||||
public project:string;
|
|
||||||
public skills:any;
|
|
||||||
public xml:string;
|
|
||||||
@IsNumber()
|
|
||||||
public unixTime: number
|
|
||||||
}
|
|
|
@ -1,28 +0,0 @@
|
||||||
import { CrudController } from "../../core/controllers/crud_controller";
|
|
||||||
import { ExecCalculationInstanceProcessScenario } from "./domain/exec_calculations_instance_process_scenario";
|
|
||||||
import { CalculationInstanceValidationModel } from "./models/calculations_instance_validation_model";
|
|
||||||
import { CalculationInstanceDBModel } from "./models/calculations_instance_database_model";
|
|
||||||
import { CreateCalculationInstanceScenario } from "./domain/create_calculation_instance_scenario";
|
|
||||||
import { DeleteCalculationsInstanceScenario } from "./domain/delete_calculations_instance_scenario";
|
|
||||||
|
|
||||||
export class CalculationsInstancesPresentation extends CrudController<
|
|
||||||
CalculationInstanceValidationModel,
|
|
||||||
typeof CalculationInstanceDBModel
|
|
||||||
> {
|
|
||||||
constructor() {
|
|
||||||
super({
|
|
||||||
url: "calculations/instances",
|
|
||||||
validationModel: CalculationInstanceValidationModel,
|
|
||||||
databaseModel: CalculationInstanceDBModel,
|
|
||||||
});
|
|
||||||
|
|
||||||
super.delete(new DeleteCalculationsInstanceScenario().call);
|
|
||||||
super.post(new CreateCalculationInstanceScenario().call);
|
|
||||||
|
|
||||||
this.subRoutes.push({
|
|
||||||
method: "GET",
|
|
||||||
subUrl: "exec",
|
|
||||||
fn: new ExecCalculationInstanceProcessScenario(),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
import { CreateInstanceScenario } from "../../../core/scenarios/create_intance_scenario";
|
|
||||||
import { CalculationInstanceDBModel } from "../models/calculations_instance_database_model";
|
|
||||||
import { CalculationInstanceValidationModel } from "../models/calculations_instance_validation_model";
|
|
||||||
|
|
||||||
export class CreateCalculationInstanceScenario extends CreateInstanceScenario<CalculationInstanceValidationModel> {
|
|
||||||
databaseModel = CalculationInstanceDBModel;
|
|
||||||
validationModel: CalculationInstanceValidationModel = new CalculationInstanceValidationModel();
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
import { DeleteInstanceScenario } from "../../../core/scenarios/delete_instance_scenario";
|
|
||||||
import { CalculationInstanceDBModel } from "../models/calculations_instance_database_model";
|
|
||||||
import { CalculationInstanceValidationModel } from "../models/calculations_instance_validation_model";
|
|
||||||
|
|
||||||
export class DeleteCalculationsInstanceScenario extends DeleteInstanceScenario<CalculationInstanceValidationModel> {
|
|
||||||
databaseModel = CalculationInstanceDBModel;
|
|
||||||
}
|
|
|
@ -1,37 +0,0 @@
|
||||||
import { ObjectId } from "mongoose";
|
|
||||||
import { CallbackStrategyWithIdQuery, ResponseBase } from "../../../core/controllers/http_controller";
|
|
||||||
import { ExecProcessUseCase, IsHaveActiveProcessUseCase } from "../../../core/usecases/exec_process_usecase";
|
|
||||||
import { ReadByIdDataBaseModelUseCase } from "../../../core/usecases/read_by_id_database_model_usecase";
|
|
||||||
import { MongoIdValidation } from "../../../core/validations/mongo_id_validation";
|
|
||||||
import { ProcessWatcherAndDatabaseUpdateService } from "../../datasets/domain/create_dataset_scenario";
|
|
||||||
import { CalculationInstanceDBModel, ICalculationInstance } from "../models/calculations_instance_database_model";
|
|
||||||
import { Result } from "../../../core/helpers/result";
|
|
||||||
import { CreateFileUseCase } from "../../../core/usecases/create_file_usecase";
|
|
||||||
|
|
||||||
export class ExecCalculationInstanceProcessScenario extends CallbackStrategyWithIdQuery {
|
|
||||||
idValidationExpression = new MongoIdValidation();
|
|
||||||
call = async (id: string): ResponseBase =>
|
|
||||||
(await new ReadByIdDataBaseModelUseCase<ICalculationInstance>(CalculationInstanceDBModel).call(id)).map(
|
|
||||||
async (model) => {
|
|
||||||
const fileOutPath = model.instancePath.pathNormalize() + "/form.json";
|
|
||||||
return (await new IsHaveActiveProcessUseCase().call()).map(async () => {
|
|
||||||
const execCommand = `${model.script
|
|
||||||
} --path ${model.instancePath.pathNormalize()} --form ${fileOutPath}`.replace("\n", "");
|
|
||||||
|
|
||||||
await new CreateFileUseCase().call(fileOutPath, Buffer.from(JSON.stringify(model.formBuilder)));
|
|
||||||
await CalculationInstanceDBModel.findById(id).updateOne({
|
|
||||||
processStatus: "RUN",
|
|
||||||
lastProcessExecCommand: execCommand,
|
|
||||||
});
|
|
||||||
new ExecProcessUseCase().call(
|
|
||||||
// @ts-expect-error
|
|
||||||
`${model.project.rootDir}/`,
|
|
||||||
execCommand,
|
|
||||||
id,
|
|
||||||
new ProcessWatcherAndDatabaseUpdateService(id as unknown as ObjectId, CalculationInstanceDBModel)
|
|
||||||
);
|
|
||||||
return Result.ok("OK");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
import { ResponseBase } from "../../../core/controllers/http_controller";
|
|
||||||
import { SearchManyDataBaseModelUseCase } from "../../../core/usecases/search_many_database_model_usecase";
|
|
||||||
import { GetActiveProjectIdScenario } from "../../projects/domain/get_active_project_id_scenario";
|
|
||||||
import { ICalculationInstance, CalculationInstanceDBModel } from "../models/calculations_instance_database_model";
|
|
||||||
|
|
||||||
export class GetAllWeightsActiveProjectScenarios {
|
|
||||||
call = async (): ResponseBase =>
|
|
||||||
(await new GetActiveProjectIdScenario().call()).map(
|
|
||||||
async (model) => await new SearchManyDataBaseModelUseCase<ICalculationInstance>(CalculationInstanceDBModel).call({ project: model.id })
|
|
||||||
);
|
|
||||||
}
|
|
|
@ -1,77 +0,0 @@
|
||||||
import { Schema, model } from "mongoose";
|
|
||||||
import { FormBuilderValidationModel } from "../../datasets/models/dataset_validation_model";
|
|
||||||
import { IProjectModel, projectSchema } from "../../projects/models/project_model_database_model";
|
|
||||||
|
|
||||||
export interface ICalculationInstance {
|
|
||||||
script: string;
|
|
||||||
instancePath: string;
|
|
||||||
formBuilder: FormBuilderValidationModel;
|
|
||||||
type: string;
|
|
||||||
name: string;
|
|
||||||
isEnd: boolean;
|
|
||||||
createDate: Date;
|
|
||||||
card?: string;
|
|
||||||
lastProcessLogs?: string;
|
|
||||||
lastProcessExecCommand?: string;
|
|
||||||
lastExecDate?: Date;
|
|
||||||
processStatus: string;
|
|
||||||
project?: IProjectModel | string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const CalculationInstanceSchema = new Schema({
|
|
||||||
script: {
|
|
||||||
type: String,
|
|
||||||
},
|
|
||||||
formBuilder: {
|
|
||||||
type: Schema.Types.Mixed,
|
|
||||||
},
|
|
||||||
type: {
|
|
||||||
type: String,
|
|
||||||
},
|
|
||||||
instanceName: {
|
|
||||||
type: String,
|
|
||||||
},
|
|
||||||
name: {
|
|
||||||
type: String,
|
|
||||||
},
|
|
||||||
isEnd: {
|
|
||||||
type: Boolean,
|
|
||||||
},
|
|
||||||
createDate: {
|
|
||||||
type: String,
|
|
||||||
},
|
|
||||||
card: {
|
|
||||||
type: String,
|
|
||||||
},
|
|
||||||
lastProcessLogs: {
|
|
||||||
type: String,
|
|
||||||
},
|
|
||||||
lastProcessExecCommand: {
|
|
||||||
type: String,
|
|
||||||
},
|
|
||||||
lastExecDate: {
|
|
||||||
type: String,
|
|
||||||
},
|
|
||||||
processStatus: {
|
|
||||||
type: String,
|
|
||||||
},
|
|
||||||
path: {
|
|
||||||
type: String,
|
|
||||||
},
|
|
||||||
instancePath: {
|
|
||||||
type: String,
|
|
||||||
},
|
|
||||||
project: {
|
|
||||||
type: Schema.Types.ObjectId,
|
|
||||||
ref: projectSchema,
|
|
||||||
autopopulate: true,
|
|
||||||
require: true,
|
|
||||||
},
|
|
||||||
}).plugin(require("mongoose-autopopulate"));
|
|
||||||
|
|
||||||
export const calculationInstanceSchema = "calculations_instances";
|
|
||||||
|
|
||||||
export const CalculationInstanceDBModel = model<ICalculationInstance>(
|
|
||||||
calculationInstanceSchema,
|
|
||||||
CalculationInstanceSchema
|
|
||||||
);
|
|
|
@ -1,31 +0,0 @@
|
||||||
import { IsNotEmpty, IsString, IsMongoId } from "class-validator";
|
|
||||||
import { ICalculationInstance } from "./calculations_instance_database_model";
|
|
||||||
import { FormBuilderValidationModel } from "../../datasets/models/dataset_validation_model";
|
|
||||||
import { IProjectModel } from "../../projects/models/project_model_database_model";
|
|
||||||
|
|
||||||
export class CalculationInstanceValidationModel implements ICalculationInstance {
|
|
||||||
@IsNotEmpty()
|
|
||||||
@IsString()
|
|
||||||
instanceName: string;
|
|
||||||
instancePath: string;
|
|
||||||
processStatus: string;
|
|
||||||
@IsString()
|
|
||||||
path: string;
|
|
||||||
project?: string | IProjectModel;
|
|
||||||
@IsString()
|
|
||||||
@IsNotEmpty()
|
|
||||||
script: string;
|
|
||||||
formBuilder: FormBuilderValidationModel;
|
|
||||||
@IsString()
|
|
||||||
@IsNotEmpty()
|
|
||||||
type: string;
|
|
||||||
@IsString()
|
|
||||||
@IsNotEmpty()
|
|
||||||
name: string;
|
|
||||||
isEnd: boolean = false;
|
|
||||||
createDate: Date = new Date();
|
|
||||||
card?: string;
|
|
||||||
lastProcessLogs?: string;
|
|
||||||
lastProcessExecCommand?: string;
|
|
||||||
lastExecDate?: Date;
|
|
||||||
}
|
|
|
@ -1,20 +0,0 @@
|
||||||
import { CrudController } from "../../core/controllers/crud_controller";
|
|
||||||
import { DeleteCalculationsTemplateScenario } from "./domain/delete_calculations_template_scenario";
|
|
||||||
import { CalculationsTemplateValidationModel as CalculationsTemplateValidationModel } from "./models/calculations_template_validation_model";
|
|
||||||
import { CalculationsTemplateDBModel } from "./models/calculations_template_database_model";
|
|
||||||
import { CreateCalculationsTemplateScenario } from "./domain/create_calculations_template_scenario";
|
|
||||||
|
|
||||||
export class CalculationsTemplatePresentation extends CrudController<
|
|
||||||
CalculationsTemplateValidationModel,
|
|
||||||
typeof CalculationsTemplateDBModel
|
|
||||||
> {
|
|
||||||
constructor() {
|
|
||||||
super({
|
|
||||||
url: "calculations/template",
|
|
||||||
validationModel: CalculationsTemplateValidationModel,
|
|
||||||
databaseModel: CalculationsTemplateDBModel,
|
|
||||||
});
|
|
||||||
super.post(new CreateCalculationsTemplateScenario().call);
|
|
||||||
super.delete(new DeleteCalculationsTemplateScenario().call);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,10 +0,0 @@
|
||||||
import { StaticFilesServer } from "../../../core/models/static_files";
|
|
||||||
import { CreateTemplateScenario } from "../../../core/scenarios/create_template_scenario";
|
|
||||||
import { CalculationsTemplateDBModel } from "../models/calculations_template_database_model";
|
|
||||||
import { CalculationsTemplateValidationModel } from "../models/calculations_template_validation_model";
|
|
||||||
|
|
||||||
export class CreateCalculationsTemplateScenario extends CreateTemplateScenario<CalculationsTemplateValidationModel> {
|
|
||||||
validationModel: CalculationsTemplateValidationModel = new CalculationsTemplateValidationModel();
|
|
||||||
databaseModel = CalculationsTemplateDBModel;
|
|
||||||
path: string = StaticFilesServer.process;
|
|
||||||
}
|
|
|
@ -1,6 +0,0 @@
|
||||||
import { DeleteTemplateScenario } from "../../../core/scenarios/delete_template_scenario";
|
|
||||||
import { CalculationsTemplateDBModel } from "../models/calculations_template_database_model";
|
|
||||||
|
|
||||||
export class DeleteCalculationsTemplateScenario extends DeleteTemplateScenario {
|
|
||||||
databaseModel = CalculationsTemplateDBModel;
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
import { ResponseBase } from "../../../core/controllers/http_controller";
|
|
||||||
import { SearchManyDataBaseModelUseCase } from "../../../core/usecases/search_many_database_model_usecase";
|
|
||||||
import { GetActiveProjectIdScenario } from "../../projects/domain/get_active_project_id_scenario";
|
|
||||||
import { ICalculationsTemplateModel, CalculationsTemplateDBModel } from "../models/calculations_template_database_model";
|
|
||||||
|
|
||||||
export class GetAllCalculationsTemplateScenarios {
|
|
||||||
call = async (): ResponseBase =>
|
|
||||||
(await new GetActiveProjectIdScenario().call()).map(
|
|
||||||
async (model) => await new SearchManyDataBaseModelUseCase<ICalculationsTemplateModel>(CalculationsTemplateDBModel).call({ project: model.id })
|
|
||||||
);
|
|
||||||
}
|
|
|
@ -1,54 +0,0 @@
|
||||||
import { Schema, model } from "mongoose";
|
|
||||||
import { FormBuilderValidationModel, IDatasetModel } from "../../datasets/models/dataset_validation_model";
|
|
||||||
import { IProjectModel, projectSchema } from "../../projects/models/project_model_database_model";
|
|
||||||
|
|
||||||
export interface ICalculationsTemplateModel {
|
|
||||||
path?: string;
|
|
||||||
script: string;
|
|
||||||
formBuilder: FormBuilderValidationModel;
|
|
||||||
type: string;
|
|
||||||
name: string;
|
|
||||||
isEnd: boolean;
|
|
||||||
createDate: Date;
|
|
||||||
card?: string;
|
|
||||||
lastProcessLogs?: string;
|
|
||||||
lastProcessExecCommand?: string;
|
|
||||||
lastExecDate?: Date;
|
|
||||||
processStatus: string;
|
|
||||||
project?: IProjectModel | string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const CalculationsTemplateSchema = new Schema({
|
|
||||||
script: {
|
|
||||||
type: String,
|
|
||||||
},
|
|
||||||
formBuilder: {
|
|
||||||
type: Schema.Types.Mixed,
|
|
||||||
},
|
|
||||||
type: {
|
|
||||||
type: String,
|
|
||||||
},
|
|
||||||
name: {
|
|
||||||
type: String,
|
|
||||||
},
|
|
||||||
|
|
||||||
createDate: {
|
|
||||||
type: Number,
|
|
||||||
},
|
|
||||||
card: {
|
|
||||||
type: String,
|
|
||||||
},
|
|
||||||
project: {
|
|
||||||
type: Schema.Types.ObjectId,
|
|
||||||
ref: projectSchema,
|
|
||||||
autopopulate: true,
|
|
||||||
require: true,
|
|
||||||
},
|
|
||||||
path: {
|
|
||||||
type: String,
|
|
||||||
},
|
|
||||||
}).plugin(require("mongoose-autopopulate"));
|
|
||||||
|
|
||||||
export const calculationsTemplateSchema = "calculations_templates";
|
|
||||||
|
|
||||||
export const CalculationsTemplateDBModel = model<ICalculationsTemplateModel>(calculationsTemplateSchema, CalculationsTemplateSchema);
|
|
|
@ -1,27 +0,0 @@
|
||||||
import { IsNotEmpty, IsString, IsMongoId } from "class-validator";
|
|
||||||
import { ICalculationsTemplateModel } from "./calculations_template_database_model";
|
|
||||||
import { FormBuilderValidationModel } from "../../datasets/models/dataset_validation_model";
|
|
||||||
import { IProjectModel } from "../../projects/models/project_model_database_model";
|
|
||||||
|
|
||||||
export class CalculationsTemplateValidationModel implements ICalculationsTemplateModel {
|
|
||||||
processStatus: string;
|
|
||||||
@IsMongoId()
|
|
||||||
project?: string | IProjectModel;
|
|
||||||
@IsString()
|
|
||||||
@IsNotEmpty()
|
|
||||||
script: string;
|
|
||||||
formBuilder: FormBuilderValidationModel;
|
|
||||||
@IsString()
|
|
||||||
@IsNotEmpty()
|
|
||||||
type: string;
|
|
||||||
@IsString()
|
|
||||||
@IsNotEmpty()
|
|
||||||
name: string;
|
|
||||||
isEnd: boolean = true;
|
|
||||||
createDate: Date = new Date();
|
|
||||||
card?: string;
|
|
||||||
lastProcessLogs?: string;
|
|
||||||
lastProcessExecCommand?: string;
|
|
||||||
lastExecDate?: Date;
|
|
||||||
path: string;
|
|
||||||
}
|
|
|
@ -4,20 +4,16 @@ import { Result } from "../../../core/helpers/result";
|
||||||
import { TypedEvent } from "../../../core/helpers/typed_event";
|
import { TypedEvent } from "../../../core/helpers/typed_event";
|
||||||
import { EXEC_EVENT, ExecError, SpawnError } from "../../../core/models/exec_error_model";
|
import { EXEC_EVENT, ExecError, SpawnError } from "../../../core/models/exec_error_model";
|
||||||
import { ExecutorResult } from "../../../core/models/executor_result";
|
import { ExecutorResult } from "../../../core/models/executor_result";
|
||||||
import { SearchOneDataBaseModelUseCase } from "../../../core/usecases/search_database_model_usecase";
|
import { SearchDataBaseModelUseCase } from "../../../core/usecases/search_database_model_usecase";
|
||||||
|
import { IProjectModel, ProjectDBModel } from "../../_projects/models/project_database_model";
|
||||||
import { DatasetDBModel } from "../models/dataset_database_model";
|
import { DatasetDBModel } from "../models/dataset_database_model";
|
||||||
import { DatasetValidationModel, ProcessStatus } from "../models/dataset_validation_model";
|
import { DatasetValidationModel, ProcessStatus } from "../models/dataset_validation_model";
|
||||||
import { IProjectModel, ProjectDBModel } from "../../projects/models/project_model_database_model";
|
|
||||||
|
|
||||||
export class ProcessWatcherAndDatabaseUpdateService<A> extends TypedEvent<
|
export class ProcessWatcherAndDatabaseUpdateService extends TypedEvent<Result<ExecError | SpawnError, ExecutorResult>> {
|
||||||
Result<ExecError | SpawnError, ExecutorResult>
|
|
||||||
> {
|
|
||||||
databaseId: ObjectId;
|
databaseId: ObjectId;
|
||||||
model: A;
|
constructor(databaseId: ObjectId) {
|
||||||
constructor(databaseId: ObjectId, model: A) {
|
|
||||||
super();
|
super();
|
||||||
this.databaseId = databaseId;
|
this.databaseId = databaseId;
|
||||||
this.model = model;
|
|
||||||
this.on((event) => this.lister(event));
|
this.on((event) => this.lister(event));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,22 +21,20 @@ export class ProcessWatcherAndDatabaseUpdateService<A> extends TypedEvent<
|
||||||
event.fold(
|
event.fold(
|
||||||
async (success) => {
|
async (success) => {
|
||||||
if (success.event == EXEC_EVENT.END) {
|
if (success.event == EXEC_EVENT.END) {
|
||||||
// @ts-expect-error
|
const dbModel = await DatasetDBModel.findById(this.databaseId);
|
||||||
const dbModel = await this.model.findById(this.databaseId);
|
|
||||||
if (dbModel !== null) {
|
if (dbModel !== null) {
|
||||||
dbModel.local_path;
|
dbModel.local_path;
|
||||||
dbModel.processStatus = ProcessStatus.END;
|
dbModel.processStatus = ProcessStatus.END;
|
||||||
dbModel.lastProcessLogs = success.data;
|
dbModel.processLogs = success.data;
|
||||||
await dbModel.save();
|
await dbModel.save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async (error) => {
|
async (error) => {
|
||||||
// @ts-expect-error
|
const dbModel = await DatasetDBModel.findById(this.databaseId);
|
||||||
const dbModel = await this.model.findById(this.databaseId);
|
|
||||||
if (dbModel !== null) {
|
if (dbModel !== null) {
|
||||||
dbModel.processStatus = ProcessStatus.ERROR;
|
dbModel.processStatus = ProcessStatus.ERROR;
|
||||||
dbModel.lastProcessLogs = error.message;
|
dbModel.processLogs = error.message;
|
||||||
await dbModel.save();
|
await dbModel.save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,7 +45,7 @@ export class CreateDataSetScenario extends CallbackStrategyWithValidationModel<D
|
||||||
validationModel: DatasetValidationModel;
|
validationModel: DatasetValidationModel;
|
||||||
call = async (model: DatasetValidationModel): ResponseBase => {
|
call = async (model: DatasetValidationModel): ResponseBase => {
|
||||||
return (
|
return (
|
||||||
await new SearchOneDataBaseModelUseCase<IProjectModel>(ProjectDBModel).call({ isActive: true }, "no active projects")
|
await new SearchDataBaseModelUseCase<IProjectModel>(ProjectDBModel).call({ isActive: true }, "no active projects")
|
||||||
).map(async (project) => {
|
).map(async (project) => {
|
||||||
model.processStatus = ProcessStatus.NEW;
|
model.processStatus = ProcessStatus.NEW;
|
||||||
model.local_path = project.rootDir;
|
model.local_path = project.rootDir;
|
||||||
|
|
|
@ -6,7 +6,6 @@ import { MongoIdValidation } from "../../../core/validations/mongo_id_validation
|
||||||
import { DatasetDBModel } from "../models/dataset_database_model";
|
import { DatasetDBModel } from "../models/dataset_database_model";
|
||||||
import { IDatasetModel } from "../models/dataset_validation_model";
|
import { IDatasetModel } from "../models/dataset_validation_model";
|
||||||
import { ProcessWatcherAndDatabaseUpdateService } from "./create_dataset_scenario";
|
import { ProcessWatcherAndDatabaseUpdateService } from "./create_dataset_scenario";
|
||||||
import { FolderStructure } from "../../projects/domain/upload_file_to_to_project_scenario";
|
|
||||||
|
|
||||||
export class ExecDatasetProcessScenario extends CallbackStrategyWithIdQuery {
|
export class ExecDatasetProcessScenario extends CallbackStrategyWithIdQuery {
|
||||||
idValidationExpression = new MongoIdValidation();
|
idValidationExpression = new MongoIdValidation();
|
||||||
|
@ -15,13 +14,12 @@ export class ExecDatasetProcessScenario extends CallbackStrategyWithIdQuery {
|
||||||
return (await new ReadByIdDataBaseModelUseCase<IDatasetModel>(DatasetDBModel).call(id)).map(async (model) => {
|
return (await new ReadByIdDataBaseModelUseCase<IDatasetModel>(DatasetDBModel).call(id)).map(async (model) => {
|
||||||
return (await new IsHaveActiveProcessUseCase().call()).map(async () => {
|
return (await new IsHaveActiveProcessUseCase().call()).map(async () => {
|
||||||
await DatasetDBModel.findById(id).updateOne({ processStatus: "RUN" });
|
await DatasetDBModel.findById(id).updateOne({ processStatus: "RUN" });
|
||||||
model.local_path = `${model.local_path}/${FolderStructure.datasets}/`;
|
console.log(`blenderproc run $PYTHON_BLENDER_PROC --cfg '${JSON.stringify(model)}'`);
|
||||||
|
|
||||||
return new ExecProcessUseCase().call(
|
return new ExecProcessUseCase().call(
|
||||||
`${model.project.rootDir}/`,
|
`${model.project.rootDir}/`,
|
||||||
`blenderproc run $PYTHON_BLENDER_PROC --cfg '${JSON.stringify(model)}'`,
|
`blenderproc run $PYTHON_BLENDER_PROC --cfg '${JSON.stringify(model)}'`,
|
||||||
id,
|
id,
|
||||||
new ProcessWatcherAndDatabaseUpdateService(id as unknown as ObjectId, DatasetDBModel)
|
new ProcessWatcherAndDatabaseUpdateService(id as unknown as ObjectId)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import { CallbackStrategyWithEmpty, ResponseBase } from "../../../core/controllers/http_controller";
|
import { CallbackStrategyWithEmpty, ResponseBase } from "../../../core/controllers/http_controller";
|
||||||
import { Result } from "../../../core/helpers/result";
|
import { Result } from "../../../core/helpers/result";
|
||||||
import { SearchOneDataBaseModelUseCase } from "../../../core/usecases/search_database_model_usecase";
|
import { SearchDataBaseModelUseCase } from "../../../core/usecases/search_database_model_usecase";
|
||||||
import { IProjectModel, ProjectDBModel } from "../../projects/models/project_model_database_model";
|
import { IProjectModel, ProjectDBModel } from "../../_projects/models/project_database_model";
|
||||||
import { DatasetDBModel } from "../models/dataset_database_model";
|
import { DatasetDBModel } from "../models/dataset_database_model";
|
||||||
|
|
||||||
export class GetDatasetActiveProjectScenario extends CallbackStrategyWithEmpty {
|
export class GetDatasetActiveProjectScenario extends CallbackStrategyWithEmpty {
|
||||||
call = async (): ResponseBase => {
|
call = async (): ResponseBase => {
|
||||||
return (
|
return (
|
||||||
await new SearchOneDataBaseModelUseCase<IProjectModel>(ProjectDBModel).call({ isActive: true }, "no active projects")
|
await new SearchDataBaseModelUseCase<IProjectModel>(ProjectDBModel).call({ isActive: true }, "no active projects")
|
||||||
).map(async (project) => {
|
).map(async (project) => {
|
||||||
return Result.ok(await DatasetDBModel.find({ project: project._id }));
|
return Result.ok(await DatasetDBModel.find({ project: project._id }));
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Schema, model } from "mongoose";
|
import { Mongoose, Schema, model } from "mongoose";
|
||||||
import { IDatasetModel } from "./dataset_validation_model";
|
import { IDatasetModel } from "./dataset_validation_model";
|
||||||
import { projectSchema } from "../../projects/models/project_model_database_model";
|
import { projectSchema } from "../../_projects/models/project_database_model";
|
||||||
|
|
||||||
export const DatasetSchema = new Schema({
|
export const DatasetSchema = new Schema({
|
||||||
name: {
|
name: {
|
||||||
type: String,
|
type: String,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Type } from "class-transformer";
|
import { Type } from "class-transformer";
|
||||||
import { IsArray, IsOptional, IsString, ValidateNested } from "class-validator";
|
import { IsArray, IsOptional, IsString, ValidateNested } from "class-validator";
|
||||||
import { IProjectModel } from "../../projects/models/project_model_database_model";
|
import { IProjectModel } from "../../_projects/models/project_database_model";
|
||||||
|
|
||||||
export class FormBuilderValidationModel {
|
export class FormBuilderValidationModel {
|
||||||
@IsString()
|
@IsString()
|
||||||
|
@ -9,7 +9,6 @@ export class FormBuilderValidationModel {
|
||||||
public context: string;
|
public context: string;
|
||||||
@IsArray()
|
@IsArray()
|
||||||
public form: [];
|
public form: [];
|
||||||
output: any;
|
|
||||||
}
|
}
|
||||||
export enum ProcessStatus {
|
export enum ProcessStatus {
|
||||||
END = "END",
|
END = "END",
|
||||||
|
@ -17,7 +16,7 @@ export enum ProcessStatus {
|
||||||
NEW = "NEW",
|
NEW = "NEW",
|
||||||
}
|
}
|
||||||
export interface IDatasetModel {
|
export interface IDatasetModel {
|
||||||
_id?: string;
|
_id?:string;
|
||||||
name: string;
|
name: string;
|
||||||
local_path: string;
|
local_path: string;
|
||||||
dataSetObjects: string[];
|
dataSetObjects: string[];
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
import { CrudController } from "../../core/controllers/crud_controller";
|
|
||||||
import { CreateDigitalTwinsInstanceScenario } from "./domain/create_digital_twins_instance";
|
|
||||||
import { DeleteDigitalTwinsInstanceScenario } from "./domain/delete_digital_twins_instance";
|
|
||||||
import { ExecInstanceScenario } from "./domain/exec_instance_scenario";
|
|
||||||
import { DigitalTwinsInstanceDatabaseModel } from "./model/digital_twins_instance_database_model";
|
|
||||||
import { DigitalTwinsInstanceValidationModel } from "./model/digital_twins_instance_validation_model";
|
|
||||||
|
|
||||||
export class DigitalTwinsInstancePresentation extends CrudController<
|
|
||||||
DigitalTwinsInstanceValidationModel,
|
|
||||||
typeof DigitalTwinsInstanceDatabaseModel
|
|
||||||
> {
|
|
||||||
constructor() {
|
|
||||||
super({
|
|
||||||
url: "digital/twins/instance",
|
|
||||||
validationModel: DigitalTwinsInstanceValidationModel,
|
|
||||||
databaseModel: DigitalTwinsInstanceDatabaseModel,
|
|
||||||
});
|
|
||||||
super.post(new CreateDigitalTwinsInstanceScenario().call);
|
|
||||||
super.delete(new DeleteDigitalTwinsInstanceScenario().call);
|
|
||||||
this.subRoutes.push({
|
|
||||||
method: "POST",
|
|
||||||
fn: new ExecInstanceScenario(),
|
|
||||||
subUrl: "exec/instance",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,10 +0,0 @@
|
||||||
import { CreateInstanceScenario } from "../../../core/scenarios/create_intance_scenario";
|
|
||||||
import { DigitalTwinsInstanceDatabaseModel } from "../model/digital_twins_instance_database_model";
|
|
||||||
import { DigitalTwinsInstanceValidationModel } from "../model/digital_twins_instance_validation_model";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export class CreateDigitalTwinsInstanceScenario extends CreateInstanceScenario<DigitalTwinsInstanceValidationModel> {
|
|
||||||
databaseModel = DigitalTwinsInstanceDatabaseModel;
|
|
||||||
validationModel: DigitalTwinsInstanceValidationModel = new DigitalTwinsInstanceValidationModel();
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
import { DeleteInstanceScenario } from "../../../core/scenarios/delete_instance_scenario";
|
|
||||||
import { DigitalTwinsInstanceDatabaseModel } from "../model/digital_twins_instance_database_model";
|
|
||||||
import { DigitalTwinsInstanceValidationModel } from "../model/digital_twins_instance_validation_model";
|
|
||||||
|
|
||||||
export class DeleteDigitalTwinsInstanceScenario extends DeleteInstanceScenario<DigitalTwinsInstanceValidationModel> {
|
|
||||||
databaseModel = DigitalTwinsInstanceDatabaseModel;
|
|
||||||
}
|
|
|
@ -1,36 +0,0 @@
|
||||||
import { CallbackStrategyWithIdQuery, ResponseBase } from "../../../core/controllers/http_controller";
|
|
||||||
import { ExecProcessUseCase } from "../../../core/usecases/exec_process_usecase";
|
|
||||||
import { ReadByIdDataBaseModelUseCase } from "../../../core/usecases/read_by_id_database_model_usecase";
|
|
||||||
import { CoreValidation } from "../../../core/validations/core_validation";
|
|
||||||
import { MongoIdValidation } from "../../../core/validations/mongo_id_validation";
|
|
||||||
import {
|
|
||||||
DigitalTwinsInstanceDatabaseModel,
|
|
||||||
IDigitalTwinsInstanceModel,
|
|
||||||
} from "../model/digital_twins_instance_database_model";
|
|
||||||
import { ITopicModel } from "../../topics/topic_database_model";
|
|
||||||
import { ExecInstanceTwinsProcessService } from "../services/exec_instance_twins_process_service";
|
|
||||||
|
|
||||||
export interface Topics {
|
|
||||||
topics: ITopicModel[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export class ExecInstanceScenario extends CallbackStrategyWithIdQuery {
|
|
||||||
idValidationExpression: CoreValidation = new MongoIdValidation();
|
|
||||||
call = async (id: string): ResponseBase =>
|
|
||||||
(
|
|
||||||
await new ReadByIdDataBaseModelUseCase<IDigitalTwinsInstanceModel>(DigitalTwinsInstanceDatabaseModel).call(id)
|
|
||||||
).map(
|
|
||||||
(document) => (
|
|
||||||
console.log('DOCUMeNT PATH'),
|
|
||||||
console.log(document.instancePath.pathNormalize()),
|
|
||||||
new ExecProcessUseCase().call(
|
|
||||||
document.instancePath,
|
|
||||||
`python3 $GET_INTERFACES --path ${document.instancePath.pathNormalize()} --package '${JSON.stringify(
|
|
||||||
document
|
|
||||||
)}'`,
|
|
||||||
"",
|
|
||||||
new ExecInstanceTwinsProcessService(document.instancePath, document)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
|
@ -1,39 +0,0 @@
|
||||||
import { Schema, model } from "mongoose";
|
|
||||||
|
|
||||||
export interface IDigitalTwinsInstanceModel {
|
|
||||||
instancePath: string;
|
|
||||||
status?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const DigitalTwinsInstanceSchema = new Schema({
|
|
||||||
path: String,
|
|
||||||
name: String,
|
|
||||||
entity: String,
|
|
||||||
description: String,
|
|
||||||
command: String,
|
|
||||||
status: {
|
|
||||||
type: String,
|
|
||||||
},
|
|
||||||
interfaces: {
|
|
||||||
cmd: String,
|
|
||||||
},
|
|
||||||
instancePath: {
|
|
||||||
type: String,
|
|
||||||
},
|
|
||||||
package: {
|
|
||||||
type: String,
|
|
||||||
},
|
|
||||||
executable: {
|
|
||||||
type: String,
|
|
||||||
},
|
|
||||||
formBuilder: {
|
|
||||||
type: Schema.Types.Mixed,
|
|
||||||
},
|
|
||||||
}).plugin(require("mongoose-autopopulate"));
|
|
||||||
|
|
||||||
export const digitalTwinsInstanceSchema = "digital_twins_instance";
|
|
||||||
|
|
||||||
export const DigitalTwinsInstanceDatabaseModel = model<IDigitalTwinsInstanceModel>(
|
|
||||||
digitalTwinsInstanceSchema,
|
|
||||||
DigitalTwinsInstanceSchema
|
|
||||||
);
|
|
|
@ -1,26 +0,0 @@
|
||||||
import { Type } from "class-transformer";
|
|
||||||
import { IsEnum, IsString } from "class-validator";
|
|
||||||
import { Instance } from "../../../core/models/instance";
|
|
||||||
|
|
||||||
enum DigitalTwinsTypes {
|
|
||||||
CAMERA = "CAMERA",
|
|
||||||
ROBOT = "ROBOT",
|
|
||||||
}
|
|
||||||
export class Interfaces {
|
|
||||||
@IsString()
|
|
||||||
cmd: string;
|
|
||||||
}
|
|
||||||
export class DigitalTwinsInstanceValidationModel implements Instance {
|
|
||||||
instanceName: string;
|
|
||||||
instancePath: string;
|
|
||||||
path: string;
|
|
||||||
name: string;
|
|
||||||
@IsEnum(DigitalTwinsTypes)
|
|
||||||
entity: DigitalTwinsTypes;
|
|
||||||
@IsString()
|
|
||||||
description: string;
|
|
||||||
@IsString()
|
|
||||||
command: string;
|
|
||||||
@Type(() => Interfaces)
|
|
||||||
interfaces: Interfaces;
|
|
||||||
}
|
|
|
@ -1,49 +0,0 @@
|
||||||
import { Result } from "../../../core/helpers/result";
|
|
||||||
import { TypedEvent } from "../../../core/helpers/typed_event";
|
|
||||||
import { ExecError, SpawnError, EXEC_EVENT } from "../../../core/models/exec_error_model";
|
|
||||||
import { ExecutorResult } from "../../../core/models/executor_result";
|
|
||||||
import { CreateDataBaseModelUseCase } from "../../../core/usecases/create_database_model_usecase";
|
|
||||||
import { ReadFileAndParseJsonUseCase } from "../../../core/usecases/read_file_and_parse_json";
|
|
||||||
import { ITopicModel, TopicDatabaseModel } from "../../topics/topic_database_model";
|
|
||||||
import { Topics } from "../domain/exec_instance_scenario";
|
|
||||||
|
|
||||||
export class ExecInstanceTwinsProcessService extends TypedEvent<
|
|
||||||
Result<ExecError | SpawnError, ExecutorResult>
|
|
||||||
> {
|
|
||||||
path: string;
|
|
||||||
databaseModel: any;
|
|
||||||
constructor(path: string, databaseModel: any) {
|
|
||||||
super();
|
|
||||||
this.path = path;
|
|
||||||
this.databaseModel = databaseModel;
|
|
||||||
this.on((event) => this.lister(event));
|
|
||||||
}
|
|
||||||
|
|
||||||
lister = (event: Result<ExecError | SpawnError, ExecutorResult>) =>
|
|
||||||
event.fold(
|
|
||||||
async (success) => {
|
|
||||||
if (success.event == EXEC_EVENT.END) {
|
|
||||||
(await new ReadFileAndParseJsonUseCase().call<Topics>(this.path + "/topics.json")).fold(
|
|
||||||
async (model) => {
|
|
||||||
await model.topics.forEach(async (el) => {
|
|
||||||
el.digitalTwinId = this.databaseModel._id;
|
|
||||||
await new CreateDataBaseModelUseCase<ITopicModel>(TopicDatabaseModel).call(el);
|
|
||||||
});
|
|
||||||
|
|
||||||
this.databaseModel.status = "END";
|
|
||||||
await this.databaseModel.save();
|
|
||||||
},
|
|
||||||
|
|
||||||
async (_) => {
|
|
||||||
this.databaseModel.status = "ERROR";
|
|
||||||
await this.databaseModel.save();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async (_) => {
|
|
||||||
this.databaseModel.status = "ERROR";
|
|
||||||
await this.databaseModel.save();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue