Upload 45 files
Browse files- .gitattributes +2 -0
- Dockerfile +21 -0
- LICENSE +674 -0
- configs/dev/service.yml +6 -0
- configs/dev/system.yml +14 -0
- doc/example-0.png +3 -0
- doc/example-1.jpeg +3 -0
- libs.d.ts +0 -0
- package-lock.json +0 -0
- package.json +52 -0
- public/welcome.html +10 -0
- src/api/consts/exceptions.ts +13 -0
- src/api/controllers/chat.ts +499 -0
- src/api/controllers/core.ts +434 -0
- src/api/controllers/images.ts +1234 -0
- src/api/controllers/videos.ts +733 -0
- src/api/routes/chat.ts +36 -0
- src/api/routes/images.ts +135 -0
- src/api/routes/index.ts +31 -0
- src/api/routes/models.ts +45 -0
- src/api/routes/ping.ts +6 -0
- src/api/routes/token.ts +39 -0
- src/api/routes/videos.ts +84 -0
- src/daemon.ts +82 -0
- src/index.ts +32 -0
- src/lib/config.ts +14 -0
- src/lib/configs/service-config.ts +68 -0
- src/lib/configs/system-config.ts +84 -0
- src/lib/consts/exceptions.ts +5 -0
- src/lib/environment.ts +44 -0
- src/lib/exceptions/APIException.ts +14 -0
- src/lib/exceptions/Exception.ts +47 -0
- src/lib/http-status-codes.ts +61 -0
- src/lib/initialize.ts +28 -0
- src/lib/interfaces/ICompletionMessage.ts +4 -0
- src/lib/logger.ts +184 -0
- src/lib/request/Request.ts +72 -0
- src/lib/response/Body.ts +41 -0
- src/lib/response/FailureBody.ts +31 -0
- src/lib/response/Response.ts +63 -0
- src/lib/response/SuccessfulBody.ts +19 -0
- src/lib/server.ts +223 -0
- src/lib/util.ts +307 -0
- tsconfig.json +16 -0
- vercel.json +27 -0
- yarn.lock +1831 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
doc/example-0.png filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
doc/example-1.jpeg filter=lfs diff=lfs merge=lfs -text
|
Dockerfile
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM node:lts AS BUILD_IMAGE
|
| 2 |
+
|
| 3 |
+
WORKDIR /app
|
| 4 |
+
|
| 5 |
+
COPY . /app
|
| 6 |
+
|
| 7 |
+
RUN yarn install --registry https://registry.npmmirror.com/ --ignore-engines && yarn run build
|
| 8 |
+
|
| 9 |
+
FROM node:lts-alpine
|
| 10 |
+
|
| 11 |
+
COPY --from=BUILD_IMAGE /app/configs /app/configs
|
| 12 |
+
COPY --from=BUILD_IMAGE /app/package.json /app/package.json
|
| 13 |
+
COPY --from=BUILD_IMAGE /app/dist /app/dist
|
| 14 |
+
COPY --from=BUILD_IMAGE /app/public /app/public
|
| 15 |
+
COPY --from=BUILD_IMAGE /app/node_modules /app/node_modules
|
| 16 |
+
|
| 17 |
+
WORKDIR /app
|
| 18 |
+
|
| 19 |
+
EXPOSE 8000
|
| 20 |
+
|
| 21 |
+
CMD ["npm", "start"]
|
LICENSE
ADDED
|
@@ -0,0 +1,674 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
GNU GENERAL PUBLIC LICENSE
|
| 2 |
+
Version 3, 29 June 2007
|
| 3 |
+
|
| 4 |
+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
| 5 |
+
Everyone is permitted to copy and distribute verbatim copies
|
| 6 |
+
of this license document, but changing it is not allowed.
|
| 7 |
+
|
| 8 |
+
Preamble
|
| 9 |
+
|
| 10 |
+
The GNU General Public License is a free, copyleft license for
|
| 11 |
+
software and other kinds of works.
|
| 12 |
+
|
| 13 |
+
The licenses for most software and other practical works are designed
|
| 14 |
+
to take away your freedom to share and change the works. By contrast,
|
| 15 |
+
the GNU General Public License is intended to guarantee your freedom to
|
| 16 |
+
share and change all versions of a program--to make sure it remains free
|
| 17 |
+
software for all its users. We, the Free Software Foundation, use the
|
| 18 |
+
GNU General Public License for most of our software; it applies also to
|
| 19 |
+
any other work released this way by its authors. You can apply it to
|
| 20 |
+
your programs, too.
|
| 21 |
+
|
| 22 |
+
When we speak of free software, we are referring to freedom, not
|
| 23 |
+
price. Our General Public Licenses are designed to make sure that you
|
| 24 |
+
have the freedom to distribute copies of free software (and charge for
|
| 25 |
+
them if you wish), that you receive source code or can get it if you
|
| 26 |
+
want it, that you can change the software or use pieces of it in new
|
| 27 |
+
free programs, and that you know you can do these things.
|
| 28 |
+
|
| 29 |
+
To protect your rights, we need to prevent others from denying you
|
| 30 |
+
these rights or asking you to surrender the rights. Therefore, you have
|
| 31 |
+
certain responsibilities if you distribute copies of the software, or if
|
| 32 |
+
you modify it: responsibilities to respect the freedom of others.
|
| 33 |
+
|
| 34 |
+
For example, if you distribute copies of such a program, whether
|
| 35 |
+
gratis or for a fee, you must pass on to the recipients the same
|
| 36 |
+
freedoms that you received. You must make sure that they, too, receive
|
| 37 |
+
or can get the source code. And you must show them these terms so they
|
| 38 |
+
know their rights.
|
| 39 |
+
|
| 40 |
+
Developers that use the GNU GPL protect your rights with two steps:
|
| 41 |
+
(1) assert copyright on the software, and (2) offer you this License
|
| 42 |
+
giving you legal permission to copy, distribute and/or modify it.
|
| 43 |
+
|
| 44 |
+
For the developers' and authors' protection, the GPL clearly explains
|
| 45 |
+
that there is no warranty for this free software. For both users' and
|
| 46 |
+
authors' sake, the GPL requires that modified versions be marked as
|
| 47 |
+
changed, so that their problems will not be attributed erroneously to
|
| 48 |
+
authors of previous versions.
|
| 49 |
+
|
| 50 |
+
Some devices are designed to deny users access to install or run
|
| 51 |
+
modified versions of the software inside them, although the manufacturer
|
| 52 |
+
can do so. This is fundamentally incompatible with the aim of
|
| 53 |
+
protecting users' freedom to change the software. The systematic
|
| 54 |
+
pattern of such abuse occurs in the area of products for individuals to
|
| 55 |
+
use, which is precisely where it is most unacceptable. Therefore, we
|
| 56 |
+
have designed this version of the GPL to prohibit the practice for those
|
| 57 |
+
products. If such problems arise substantially in other domains, we
|
| 58 |
+
stand ready to extend this provision to those domains in future versions
|
| 59 |
+
of the GPL, as needed to protect the freedom of users.
|
| 60 |
+
|
| 61 |
+
Finally, every program is threatened constantly by software patents.
|
| 62 |
+
States should not allow patents to restrict development and use of
|
| 63 |
+
software on general-purpose computers, but in those that do, we wish to
|
| 64 |
+
avoid the special danger that patents applied to a free program could
|
| 65 |
+
make it effectively proprietary. To prevent this, the GPL assures that
|
| 66 |
+
patents cannot be used to render the program non-free.
|
| 67 |
+
|
| 68 |
+
The precise terms and conditions for copying, distribution and
|
| 69 |
+
modification follow.
|
| 70 |
+
|
| 71 |
+
TERMS AND CONDITIONS
|
| 72 |
+
|
| 73 |
+
0. Definitions.
|
| 74 |
+
|
| 75 |
+
"This License" refers to version 3 of the GNU General Public License.
|
| 76 |
+
|
| 77 |
+
"Copyright" also means copyright-like laws that apply to other kinds of
|
| 78 |
+
works, such as semiconductor masks.
|
| 79 |
+
|
| 80 |
+
"The Program" refers to any copyrightable work licensed under this
|
| 81 |
+
License. Each licensee is addressed as "you". "Licensees" and
|
| 82 |
+
"recipients" may be individuals or organizations.
|
| 83 |
+
|
| 84 |
+
To "modify" a work means to copy from or adapt all or part of the work
|
| 85 |
+
in a fashion requiring copyright permission, other than the making of an
|
| 86 |
+
exact copy. The resulting work is called a "modified version" of the
|
| 87 |
+
earlier work or a work "based on" the earlier work.
|
| 88 |
+
|
| 89 |
+
A "covered work" means either the unmodified Program or a work based
|
| 90 |
+
on the Program.
|
| 91 |
+
|
| 92 |
+
To "propagate" a work means to do anything with it that, without
|
| 93 |
+
permission, would make you directly or secondarily liable for
|
| 94 |
+
infringement under applicable copyright law, except executing it on a
|
| 95 |
+
computer or modifying a private copy. Propagation includes copying,
|
| 96 |
+
distribution (with or without modification), making available to the
|
| 97 |
+
public, and in some countries other activities as well.
|
| 98 |
+
|
| 99 |
+
To "convey" a work means any kind of propagation that enables other
|
| 100 |
+
parties to make or receive copies. Mere interaction with a user through
|
| 101 |
+
a computer network, with no transfer of a copy, is not conveying.
|
| 102 |
+
|
| 103 |
+
An interactive user interface displays "Appropriate Legal Notices"
|
| 104 |
+
to the extent that it includes a convenient and prominently visible
|
| 105 |
+
feature that (1) displays an appropriate copyright notice, and (2)
|
| 106 |
+
tells the user that there is no warranty for the work (except to the
|
| 107 |
+
extent that warranties are provided), that licensees may convey the
|
| 108 |
+
work under this License, and how to view a copy of this License. If
|
| 109 |
+
the interface presents a list of user commands or options, such as a
|
| 110 |
+
menu, a prominent item in the list meets this criterion.
|
| 111 |
+
|
| 112 |
+
1. Source Code.
|
| 113 |
+
|
| 114 |
+
The "source code" for a work means the preferred form of the work
|
| 115 |
+
for making modifications to it. "Object code" means any non-source
|
| 116 |
+
form of a work.
|
| 117 |
+
|
| 118 |
+
A "Standard Interface" means an interface that either is an official
|
| 119 |
+
standard defined by a recognized standards body, or, in the case of
|
| 120 |
+
interfaces specified for a particular programming language, one that
|
| 121 |
+
is widely used among developers working in that language.
|
| 122 |
+
|
| 123 |
+
The "System Libraries" of an executable work include anything, other
|
| 124 |
+
than the work as a whole, that (a) is included in the normal form of
|
| 125 |
+
packaging a Major Component, but which is not part of that Major
|
| 126 |
+
Component, and (b) serves only to enable use of the work with that
|
| 127 |
+
Major Component, or to implement a Standard Interface for which an
|
| 128 |
+
implementation is available to the public in source code form. A
|
| 129 |
+
"Major Component", in this context, means a major essential component
|
| 130 |
+
(kernel, window system, and so on) of the specific operating system
|
| 131 |
+
(if any) on which the executable work runs, or a compiler used to
|
| 132 |
+
produce the work, or an object code interpreter used to run it.
|
| 133 |
+
|
| 134 |
+
The "Corresponding Source" for a work in object code form means all
|
| 135 |
+
the source code needed to generate, install, and (for an executable
|
| 136 |
+
work) run the object code and to modify the work, including scripts to
|
| 137 |
+
control those activities. However, it does not include the work's
|
| 138 |
+
System Libraries, or general-purpose tools or generally available free
|
| 139 |
+
programs which are used unmodified in performing those activities but
|
| 140 |
+
which are not part of the work. For example, Corresponding Source
|
| 141 |
+
includes interface definition files associated with source files for
|
| 142 |
+
the work, and the source code for shared libraries and dynamically
|
| 143 |
+
linked subprograms that the work is specifically designed to require,
|
| 144 |
+
such as by intimate data communication or control flow between those
|
| 145 |
+
subprograms and other parts of the work.
|
| 146 |
+
|
| 147 |
+
The Corresponding Source need not include anything that users
|
| 148 |
+
can regenerate automatically from other parts of the Corresponding
|
| 149 |
+
Source.
|
| 150 |
+
|
| 151 |
+
The Corresponding Source for a work in source code form is that
|
| 152 |
+
same work.
|
| 153 |
+
|
| 154 |
+
2. Basic Permissions.
|
| 155 |
+
|
| 156 |
+
All rights granted under this License are granted for the term of
|
| 157 |
+
copyright on the Program, and are irrevocable provided the stated
|
| 158 |
+
conditions are met. This License explicitly affirms your unlimited
|
| 159 |
+
permission to run the unmodified Program. The output from running a
|
| 160 |
+
covered work is covered by this License only if the output, given its
|
| 161 |
+
content, constitutes a covered work. This License acknowledges your
|
| 162 |
+
rights of fair use or other equivalent, as provided by copyright law.
|
| 163 |
+
|
| 164 |
+
You may make, run and propagate covered works that you do not
|
| 165 |
+
convey, without conditions so long as your license otherwise remains
|
| 166 |
+
in force. You may convey covered works to others for the sole purpose
|
| 167 |
+
of having them make modifications exclusively for you, or provide you
|
| 168 |
+
with facilities for running those works, provided that you comply with
|
| 169 |
+
the terms of this License in conveying all material for which you do
|
| 170 |
+
not control copyright. Those thus making or running the covered works
|
| 171 |
+
for you must do so exclusively on your behalf, under your direction
|
| 172 |
+
and control, on terms that prohibit them from making any copies of
|
| 173 |
+
your copyrighted material outside their relationship with you.
|
| 174 |
+
|
| 175 |
+
Conveying under any other circumstances is permitted solely under
|
| 176 |
+
the conditions stated below. Sublicensing is not allowed; section 10
|
| 177 |
+
makes it unnecessary.
|
| 178 |
+
|
| 179 |
+
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
| 180 |
+
|
| 181 |
+
No covered work shall be deemed part of an effective technological
|
| 182 |
+
measure under any applicable law fulfilling obligations under article
|
| 183 |
+
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
| 184 |
+
similar laws prohibiting or restricting circumvention of such
|
| 185 |
+
measures.
|
| 186 |
+
|
| 187 |
+
When you convey a covered work, you waive any legal power to forbid
|
| 188 |
+
circumvention of technological measures to the extent such circumvention
|
| 189 |
+
is effected by exercising rights under this License with respect to
|
| 190 |
+
the covered work, and you disclaim any intention to limit operation or
|
| 191 |
+
modification of the work as a means of enforcing, against the work's
|
| 192 |
+
users, your or third parties' legal rights to forbid circumvention of
|
| 193 |
+
technological measures.
|
| 194 |
+
|
| 195 |
+
4. Conveying Verbatim Copies.
|
| 196 |
+
|
| 197 |
+
You may convey verbatim copies of the Program's source code as you
|
| 198 |
+
receive it, in any medium, provided that you conspicuously and
|
| 199 |
+
appropriately publish on each copy an appropriate copyright notice;
|
| 200 |
+
keep intact all notices stating that this License and any
|
| 201 |
+
non-permissive terms added in accord with section 7 apply to the code;
|
| 202 |
+
keep intact all notices of the absence of any warranty; and give all
|
| 203 |
+
recipients a copy of this License along with the Program.
|
| 204 |
+
|
| 205 |
+
You may charge any price or no price for each copy that you convey,
|
| 206 |
+
and you may offer support or warranty protection for a fee.
|
| 207 |
+
|
| 208 |
+
5. Conveying Modified Source Versions.
|
| 209 |
+
|
| 210 |
+
You may convey a work based on the Program, or the modifications to
|
| 211 |
+
produce it from the Program, in the form of source code under the
|
| 212 |
+
terms of section 4, provided that you also meet all of these conditions:
|
| 213 |
+
|
| 214 |
+
a) The work must carry prominent notices stating that you modified
|
| 215 |
+
it, and giving a relevant date.
|
| 216 |
+
|
| 217 |
+
b) The work must carry prominent notices stating that it is
|
| 218 |
+
released under this License and any conditions added under section
|
| 219 |
+
7. This requirement modifies the requirement in section 4 to
|
| 220 |
+
"keep intact all notices".
|
| 221 |
+
|
| 222 |
+
c) You must license the entire work, as a whole, under this
|
| 223 |
+
License to anyone who comes into possession of a copy. This
|
| 224 |
+
License will therefore apply, along with any applicable section 7
|
| 225 |
+
additional terms, to the whole of the work, and all its parts,
|
| 226 |
+
regardless of how they are packaged. This License gives no
|
| 227 |
+
permission to license the work in any other way, but it does not
|
| 228 |
+
invalidate such permission if you have separately received it.
|
| 229 |
+
|
| 230 |
+
d) If the work has interactive user interfaces, each must display
|
| 231 |
+
Appropriate Legal Notices; however, if the Program has interactive
|
| 232 |
+
interfaces that do not display Appropriate Legal Notices, your
|
| 233 |
+
work need not make them do so.
|
| 234 |
+
|
| 235 |
+
A compilation of a covered work with other separate and independent
|
| 236 |
+
works, which are not by their nature extensions of the covered work,
|
| 237 |
+
and which are not combined with it such as to form a larger program,
|
| 238 |
+
in or on a volume of a storage or distribution medium, is called an
|
| 239 |
+
"aggregate" if the compilation and its resulting copyright are not
|
| 240 |
+
used to limit the access or legal rights of the compilation's users
|
| 241 |
+
beyond what the individual works permit. Inclusion of a covered work
|
| 242 |
+
in an aggregate does not cause this License to apply to the other
|
| 243 |
+
parts of the aggregate.
|
| 244 |
+
|
| 245 |
+
6. Conveying Non-Source Forms.
|
| 246 |
+
|
| 247 |
+
You may convey a covered work in object code form under the terms
|
| 248 |
+
of sections 4 and 5, provided that you also convey the
|
| 249 |
+
machine-readable Corresponding Source under the terms of this License,
|
| 250 |
+
in one of these ways:
|
| 251 |
+
|
| 252 |
+
a) Convey the object code in, or embodied in, a physical product
|
| 253 |
+
(including a physical distribution medium), accompanied by the
|
| 254 |
+
Corresponding Source fixed on a durable physical medium
|
| 255 |
+
customarily used for software interchange.
|
| 256 |
+
|
| 257 |
+
b) Convey the object code in, or embodied in, a physical product
|
| 258 |
+
(including a physical distribution medium), accompanied by a
|
| 259 |
+
written offer, valid for at least three years and valid for as
|
| 260 |
+
long as you offer spare parts or customer support for that product
|
| 261 |
+
model, to give anyone who possesses the object code either (1) a
|
| 262 |
+
copy of the Corresponding Source for all the software in the
|
| 263 |
+
product that is covered by this License, on a durable physical
|
| 264 |
+
medium customarily used for software interchange, for a price no
|
| 265 |
+
more than your reasonable cost of physically performing this
|
| 266 |
+
conveying of source, or (2) access to copy the
|
| 267 |
+
Corresponding Source from a network server at no charge.
|
| 268 |
+
|
| 269 |
+
c) Convey individual copies of the object code with a copy of the
|
| 270 |
+
written offer to provide the Corresponding Source. This
|
| 271 |
+
alternative is allowed only occasionally and noncommercially, and
|
| 272 |
+
only if you received the object code with such an offer, in accord
|
| 273 |
+
with subsection 6b.
|
| 274 |
+
|
| 275 |
+
d) Convey the object code by offering access from a designated
|
| 276 |
+
place (gratis or for a charge), and offer equivalent access to the
|
| 277 |
+
Corresponding Source in the same way through the same place at no
|
| 278 |
+
further charge. You need not require recipients to copy the
|
| 279 |
+
Corresponding Source along with the object code. If the place to
|
| 280 |
+
copy the object code is a network server, the Corresponding Source
|
| 281 |
+
may be on a different server (operated by you or a third party)
|
| 282 |
+
that supports equivalent copying facilities, provided you maintain
|
| 283 |
+
clear directions next to the object code saying where to find the
|
| 284 |
+
Corresponding Source. Regardless of what server hosts the
|
| 285 |
+
Corresponding Source, you remain obligated to ensure that it is
|
| 286 |
+
available for as long as needed to satisfy these requirements.
|
| 287 |
+
|
| 288 |
+
e) Convey the object code using peer-to-peer transmission, provided
|
| 289 |
+
you inform other peers where the object code and Corresponding
|
| 290 |
+
Source of the work are being offered to the general public at no
|
| 291 |
+
charge under subsection 6d.
|
| 292 |
+
|
| 293 |
+
A separable portion of the object code, whose source code is excluded
|
| 294 |
+
from the Corresponding Source as a System Library, need not be
|
| 295 |
+
included in conveying the object code work.
|
| 296 |
+
|
| 297 |
+
A "User Product" is either (1) a "consumer product", which means any
|
| 298 |
+
tangible personal property which is normally used for personal, family,
|
| 299 |
+
or household purposes, or (2) anything designed or sold for incorporation
|
| 300 |
+
into a dwelling. In determining whether a product is a consumer product,
|
| 301 |
+
doubtful cases shall be resolved in favor of coverage. For a particular
|
| 302 |
+
product received by a particular user, "normally used" refers to a
|
| 303 |
+
typical or common use of that class of product, regardless of the status
|
| 304 |
+
of the particular user or of the way in which the particular user
|
| 305 |
+
actually uses, or expects or is expected to use, the product. A product
|
| 306 |
+
is a consumer product regardless of whether the product has substantial
|
| 307 |
+
commercial, industrial or non-consumer uses, unless such uses represent
|
| 308 |
+
the only significant mode of use of the product.
|
| 309 |
+
|
| 310 |
+
"Installation Information" for a User Product means any methods,
|
| 311 |
+
procedures, authorization keys, or other information required to install
|
| 312 |
+
and execute modified versions of a covered work in that User Product from
|
| 313 |
+
a modified version of its Corresponding Source. The information must
|
| 314 |
+
suffice to ensure that the continued functioning of the modified object
|
| 315 |
+
code is in no case prevented or interfered with solely because
|
| 316 |
+
modification has been made.
|
| 317 |
+
|
| 318 |
+
If you convey an object code work under this section in, or with, or
|
| 319 |
+
specifically for use in, a User Product, and the conveying occurs as
|
| 320 |
+
part of a transaction in which the right of possession and use of the
|
| 321 |
+
User Product is transferred to the recipient in perpetuity or for a
|
| 322 |
+
fixed term (regardless of how the transaction is characterized), the
|
| 323 |
+
Corresponding Source conveyed under this section must be accompanied
|
| 324 |
+
by the Installation Information. But this requirement does not apply
|
| 325 |
+
if neither you nor any third party retains the ability to install
|
| 326 |
+
modified object code on the User Product (for example, the work has
|
| 327 |
+
been installed in ROM).
|
| 328 |
+
|
| 329 |
+
The requirement to provide Installation Information does not include a
|
| 330 |
+
requirement to continue to provide support service, warranty, or updates
|
| 331 |
+
for a work that has been modified or installed by the recipient, or for
|
| 332 |
+
the User Product in which it has been modified or installed. Access to a
|
| 333 |
+
network may be denied when the modification itself materially and
|
| 334 |
+
adversely affects the operation of the network or violates the rules and
|
| 335 |
+
protocols for communication across the network.
|
| 336 |
+
|
| 337 |
+
Corresponding Source conveyed, and Installation Information provided,
|
| 338 |
+
in accord with this section must be in a format that is publicly
|
| 339 |
+
documented (and with an implementation available to the public in
|
| 340 |
+
source code form), and must require no special password or key for
|
| 341 |
+
unpacking, reading or copying.
|
| 342 |
+
|
| 343 |
+
7. Additional Terms.
|
| 344 |
+
|
| 345 |
+
"Additional permissions" are terms that supplement the terms of this
|
| 346 |
+
License by making exceptions from one or more of its conditions.
|
| 347 |
+
Additional permissions that are applicable to the entire Program shall
|
| 348 |
+
be treated as though they were included in this License, to the extent
|
| 349 |
+
that they are valid under applicable law. If additional permissions
|
| 350 |
+
apply only to part of the Program, that part may be used separately
|
| 351 |
+
under those permissions, but the entire Program remains governed by
|
| 352 |
+
this License without regard to the additional permissions.
|
| 353 |
+
|
| 354 |
+
When you convey a copy of a covered work, you may at your option
|
| 355 |
+
remove any additional permissions from that copy, or from any part of
|
| 356 |
+
it. (Additional permissions may be written to require their own
|
| 357 |
+
removal in certain cases when you modify the work.) You may place
|
| 358 |
+
additional permissions on material, added by you to a covered work,
|
| 359 |
+
for which you have or can give appropriate copyright permission.
|
| 360 |
+
|
| 361 |
+
Notwithstanding any other provision of this License, for material you
|
| 362 |
+
add to a covered work, you may (if authorized by the copyright holders of
|
| 363 |
+
that material) supplement the terms of this License with terms:
|
| 364 |
+
|
| 365 |
+
a) Disclaiming warranty or limiting liability differently from the
|
| 366 |
+
terms of sections 15 and 16 of this License; or
|
| 367 |
+
|
| 368 |
+
b) Requiring preservation of specified reasonable legal notices or
|
| 369 |
+
author attributions in that material or in the Appropriate Legal
|
| 370 |
+
Notices displayed by works containing it; or
|
| 371 |
+
|
| 372 |
+
c) Prohibiting misrepresentation of the origin of that material, or
|
| 373 |
+
requiring that modified versions of such material be marked in
|
| 374 |
+
reasonable ways as different from the original version; or
|
| 375 |
+
|
| 376 |
+
d) Limiting the use for publicity purposes of names of licensors or
|
| 377 |
+
authors of the material; or
|
| 378 |
+
|
| 379 |
+
e) Declining to grant rights under trademark law for use of some
|
| 380 |
+
trade names, trademarks, or service marks; or
|
| 381 |
+
|
| 382 |
+
f) Requiring indemnification of licensors and authors of that
|
| 383 |
+
material by anyone who conveys the material (or modified versions of
|
| 384 |
+
it) with contractual assumptions of liability to the recipient, for
|
| 385 |
+
any liability that these contractual assumptions directly impose on
|
| 386 |
+
those licensors and authors.
|
| 387 |
+
|
| 388 |
+
All other non-permissive additional terms are considered "further
|
| 389 |
+
restrictions" within the meaning of section 10. If the Program as you
|
| 390 |
+
received it, or any part of it, contains a notice stating that it is
|
| 391 |
+
governed by this License along with a term that is a further
|
| 392 |
+
restriction, you may remove that term. If a license document contains
|
| 393 |
+
a further restriction but permits relicensing or conveying under this
|
| 394 |
+
License, you may add to a covered work material governed by the terms
|
| 395 |
+
of that license document, provided that the further restriction does
|
| 396 |
+
not survive such relicensing or conveying.
|
| 397 |
+
|
| 398 |
+
If you add terms to a covered work in accord with this section, you
|
| 399 |
+
must place, in the relevant source files, a statement of the
|
| 400 |
+
additional terms that apply to those files, or a notice indicating
|
| 401 |
+
where to find the applicable terms.
|
| 402 |
+
|
| 403 |
+
Additional terms, permissive or non-permissive, may be stated in the
|
| 404 |
+
form of a separately written license, or stated as exceptions;
|
| 405 |
+
the above requirements apply either way.
|
| 406 |
+
|
| 407 |
+
8. Termination.
|
| 408 |
+
|
| 409 |
+
You may not propagate or modify a covered work except as expressly
|
| 410 |
+
provided under this License. Any attempt otherwise to propagate or
|
| 411 |
+
modify it is void, and will automatically terminate your rights under
|
| 412 |
+
this License (including any patent licenses granted under the third
|
| 413 |
+
paragraph of section 11).
|
| 414 |
+
|
| 415 |
+
However, if you cease all violation of this License, then your
|
| 416 |
+
license from a particular copyright holder is reinstated (a)
|
| 417 |
+
provisionally, unless and until the copyright holder explicitly and
|
| 418 |
+
finally terminates your license, and (b) permanently, if the copyright
|
| 419 |
+
holder fails to notify you of the violation by some reasonable means
|
| 420 |
+
prior to 60 days after the cessation.
|
| 421 |
+
|
| 422 |
+
Moreover, your license from a particular copyright holder is
|
| 423 |
+
reinstated permanently if the copyright holder notifies you of the
|
| 424 |
+
violation by some reasonable means, this is the first time you have
|
| 425 |
+
received notice of violation of this License (for any work) from that
|
| 426 |
+
copyright holder, and you cure the violation prior to 30 days after
|
| 427 |
+
your receipt of the notice.
|
| 428 |
+
|
| 429 |
+
Termination of your rights under this section does not terminate the
|
| 430 |
+
licenses of parties who have received copies or rights from you under
|
| 431 |
+
this License. If your rights have been terminated and not permanently
|
| 432 |
+
reinstated, you do not qualify to receive new licenses for the same
|
| 433 |
+
material under section 10.
|
| 434 |
+
|
| 435 |
+
9. Acceptance Not Required for Having Copies.
|
| 436 |
+
|
| 437 |
+
You are not required to accept this License in order to receive or
|
| 438 |
+
run a copy of the Program. Ancillary propagation of a covered work
|
| 439 |
+
occurring solely as a consequence of using peer-to-peer transmission
|
| 440 |
+
to receive a copy likewise does not require acceptance. However,
|
| 441 |
+
nothing other than this License grants you permission to propagate or
|
| 442 |
+
modify any covered work. These actions infringe copyright if you do
|
| 443 |
+
not accept this License. Therefore, by modifying or propagating a
|
| 444 |
+
covered work, you indicate your acceptance of this License to do so.
|
| 445 |
+
|
| 446 |
+
10. Automatic Licensing of Downstream Recipients.
|
| 447 |
+
|
| 448 |
+
Each time you convey a covered work, the recipient automatically
|
| 449 |
+
receives a license from the original licensors, to run, modify and
|
| 450 |
+
propagate that work, subject to this License. You are not responsible
|
| 451 |
+
for enforcing compliance by third parties with this License.
|
| 452 |
+
|
| 453 |
+
An "entity transaction" is a transaction transferring control of an
|
| 454 |
+
organization, or substantially all assets of one, or subdividing an
|
| 455 |
+
organization, or merging organizations. If propagation of a covered
|
| 456 |
+
work results from an entity transaction, each party to that
|
| 457 |
+
transaction who receives a copy of the work also receives whatever
|
| 458 |
+
licenses to the work the party's predecessor in interest had or could
|
| 459 |
+
give under the previous paragraph, plus a right to possession of the
|
| 460 |
+
Corresponding Source of the work from the predecessor in interest, if
|
| 461 |
+
the predecessor has it or can get it with reasonable efforts.
|
| 462 |
+
|
| 463 |
+
You may not impose any further restrictions on the exercise of the
|
| 464 |
+
rights granted or affirmed under this License. For example, you may
|
| 465 |
+
not impose a license fee, royalty, or other charge for exercise of
|
| 466 |
+
rights granted under this License, and you may not initiate litigation
|
| 467 |
+
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
| 468 |
+
any patent claim is infringed by making, using, selling, offering for
|
| 469 |
+
sale, or importing the Program or any portion of it.
|
| 470 |
+
|
| 471 |
+
11. Patents.
|
| 472 |
+
|
| 473 |
+
A "contributor" is a copyright holder who authorizes use under this
|
| 474 |
+
License of the Program or a work on which the Program is based. The
|
| 475 |
+
work thus licensed is called the contributor's "contributor version".
|
| 476 |
+
|
| 477 |
+
A contributor's "essential patent claims" are all patent claims
|
| 478 |
+
owned or controlled by the contributor, whether already acquired or
|
| 479 |
+
hereafter acquired, that would be infringed by some manner, permitted
|
| 480 |
+
by this License, of making, using, or selling its contributor version,
|
| 481 |
+
but do not include claims that would be infringed only as a
|
| 482 |
+
consequence of further modification of the contributor version. For
|
| 483 |
+
purposes of this definition, "control" includes the right to grant
|
| 484 |
+
patent sublicenses in a manner consistent with the requirements of
|
| 485 |
+
this License.
|
| 486 |
+
|
| 487 |
+
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
| 488 |
+
patent license under the contributor's essential patent claims, to
|
| 489 |
+
make, use, sell, offer for sale, import and otherwise run, modify and
|
| 490 |
+
propagate the contents of its contributor version.
|
| 491 |
+
|
| 492 |
+
In the following three paragraphs, a "patent license" is any express
|
| 493 |
+
agreement or commitment, however denominated, not to enforce a patent
|
| 494 |
+
(such as an express permission to practice a patent or covenant not to
|
| 495 |
+
sue for patent infringement). To "grant" such a patent license to a
|
| 496 |
+
party means to make such an agreement or commitment not to enforce a
|
| 497 |
+
patent against the party.
|
| 498 |
+
|
| 499 |
+
If you convey a covered work, knowingly relying on a patent license,
|
| 500 |
+
and the Corresponding Source of the work is not available for anyone
|
| 501 |
+
to copy, free of charge and under the terms of this License, through a
|
| 502 |
+
publicly available network server or other readily accessible means,
|
| 503 |
+
then you must either (1) cause the Corresponding Source to be so
|
| 504 |
+
available, or (2) arrange to deprive yourself of the benefit of the
|
| 505 |
+
patent license for this particular work, or (3) arrange, in a manner
|
| 506 |
+
consistent with the requirements of this License, to extend the patent
|
| 507 |
+
license to downstream recipients. "Knowingly relying" means you have
|
| 508 |
+
actual knowledge that, but for the patent license, your conveying the
|
| 509 |
+
covered work in a country, or your recipient's use of the covered work
|
| 510 |
+
in a country, would infringe one or more identifiable patents in that
|
| 511 |
+
country that you have reason to believe are valid.
|
| 512 |
+
|
| 513 |
+
If, pursuant to or in connection with a single transaction or
|
| 514 |
+
arrangement, you convey, or propagate by procuring conveyance of, a
|
| 515 |
+
covered work, and grant a patent license to some of the parties
|
| 516 |
+
receiving the covered work authorizing them to use, propagate, modify
|
| 517 |
+
or convey a specific copy of the covered work, then the patent license
|
| 518 |
+
you grant is automatically extended to all recipients of the covered
|
| 519 |
+
work and works based on it.
|
| 520 |
+
|
| 521 |
+
A patent license is "discriminatory" if it does not include within
|
| 522 |
+
the scope of its coverage, prohibits the exercise of, or is
|
| 523 |
+
conditioned on the non-exercise of one or more of the rights that are
|
| 524 |
+
specifically granted under this License. You may not convey a covered
|
| 525 |
+
work if you are a party to an arrangement with a third party that is
|
| 526 |
+
in the business of distributing software, under which you make payment
|
| 527 |
+
to the third party based on the extent of your activity of conveying
|
| 528 |
+
the work, and under which the third party grants, to any of the
|
| 529 |
+
parties who would receive the covered work from you, a discriminatory
|
| 530 |
+
patent license (a) in connection with copies of the covered work
|
| 531 |
+
conveyed by you (or copies made from those copies), or (b) primarily
|
| 532 |
+
for and in connection with specific products or compilations that
|
| 533 |
+
contain the covered work, unless you entered into that arrangement,
|
| 534 |
+
or that patent license was granted, prior to 28 March 2007.
|
| 535 |
+
|
| 536 |
+
Nothing in this License shall be construed as excluding or limiting
|
| 537 |
+
any implied license or other defenses to infringement that may
|
| 538 |
+
otherwise be available to you under applicable patent law.
|
| 539 |
+
|
| 540 |
+
12. No Surrender of Others' Freedom.
|
| 541 |
+
|
| 542 |
+
If conditions are imposed on you (whether by court order, agreement or
|
| 543 |
+
otherwise) that contradict the conditions of this License, they do not
|
| 544 |
+
excuse you from the conditions of this License. If you cannot convey a
|
| 545 |
+
covered work so as to satisfy simultaneously your obligations under this
|
| 546 |
+
License and any other pertinent obligations, then as a consequence you may
|
| 547 |
+
not convey it at all. For example, if you agree to terms that obligate you
|
| 548 |
+
to collect a royalty for further conveying from those to whom you convey
|
| 549 |
+
the Program, the only way you could satisfy both those terms and this
|
| 550 |
+
License would be to refrain entirely from conveying the Program.
|
| 551 |
+
|
| 552 |
+
13. Use with the GNU Affero General Public License.
|
| 553 |
+
|
| 554 |
+
Notwithstanding any other provision of this License, you have
|
| 555 |
+
permission to link or combine any covered work with a work licensed
|
| 556 |
+
under version 3 of the GNU Affero General Public License into a single
|
| 557 |
+
combined work, and to convey the resulting work. The terms of this
|
| 558 |
+
License will continue to apply to the part which is the covered work,
|
| 559 |
+
but the special requirements of the GNU Affero General Public License,
|
| 560 |
+
section 13, concerning interaction through a network will apply to the
|
| 561 |
+
combination as such.
|
| 562 |
+
|
| 563 |
+
14. Revised Versions of this License.
|
| 564 |
+
|
| 565 |
+
The Free Software Foundation may publish revised and/or new versions of
|
| 566 |
+
the GNU General Public License from time to time. Such new versions will
|
| 567 |
+
be similar in spirit to the present version, but may differ in detail to
|
| 568 |
+
address new problems or concerns.
|
| 569 |
+
|
| 570 |
+
Each version is given a distinguishing version number. If the
|
| 571 |
+
Program specifies that a certain numbered version of the GNU General
|
| 572 |
+
Public License "or any later version" applies to it, you have the
|
| 573 |
+
option of following the terms and conditions either of that numbered
|
| 574 |
+
version or of any later version published by the Free Software
|
| 575 |
+
Foundation. If the Program does not specify a version number of the
|
| 576 |
+
GNU General Public License, you may choose any version ever published
|
| 577 |
+
by the Free Software Foundation.
|
| 578 |
+
|
| 579 |
+
If the Program specifies that a proxy can decide which future
|
| 580 |
+
versions of the GNU General Public License can be used, that proxy's
|
| 581 |
+
public statement of acceptance of a version permanently authorizes you
|
| 582 |
+
to choose that version for the Program.
|
| 583 |
+
|
| 584 |
+
Later license versions may give you additional or different
|
| 585 |
+
permissions. However, no additional obligations are imposed on any
|
| 586 |
+
author or copyright holder as a result of your choosing to follow a
|
| 587 |
+
later version.
|
| 588 |
+
|
| 589 |
+
15. Disclaimer of Warranty.
|
| 590 |
+
|
| 591 |
+
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
| 592 |
+
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
| 593 |
+
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
| 594 |
+
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
| 595 |
+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
| 596 |
+
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
| 597 |
+
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
| 598 |
+
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
| 599 |
+
|
| 600 |
+
16. Limitation of Liability.
|
| 601 |
+
|
| 602 |
+
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
| 603 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
| 604 |
+
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
| 605 |
+
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
| 606 |
+
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
| 607 |
+
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
| 608 |
+
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
| 609 |
+
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
| 610 |
+
SUCH DAMAGES.
|
| 611 |
+
|
| 612 |
+
17. Interpretation of Sections 15 and 16.
|
| 613 |
+
|
| 614 |
+
If the disclaimer of warranty and limitation of liability provided
|
| 615 |
+
above cannot be given local legal effect according to their terms,
|
| 616 |
+
reviewing courts shall apply local law that most closely approximates
|
| 617 |
+
an absolute waiver of all civil liability in connection with the
|
| 618 |
+
Program, unless a warranty or assumption of liability accompanies a
|
| 619 |
+
copy of the Program in return for a fee.
|
| 620 |
+
|
| 621 |
+
END OF TERMS AND CONDITIONS
|
| 622 |
+
|
| 623 |
+
How to Apply These Terms to Your New Programs
|
| 624 |
+
|
| 625 |
+
If you develop a new program, and you want it to be of the greatest
|
| 626 |
+
possible use to the public, the best way to achieve this is to make it
|
| 627 |
+
free software which everyone can redistribute and change under these terms.
|
| 628 |
+
|
| 629 |
+
To do so, attach the following notices to the program. It is safest
|
| 630 |
+
to attach them to the start of each source file to most effectively
|
| 631 |
+
state the exclusion of warranty; and each file should have at least
|
| 632 |
+
the "copyright" line and a pointer to where the full notice is found.
|
| 633 |
+
|
| 634 |
+
<one line to give the program's name and a brief idea of what it does.>
|
| 635 |
+
Copyright (C) <year> <name of author>
|
| 636 |
+
|
| 637 |
+
This program is free software: you can redistribute it and/or modify
|
| 638 |
+
it under the terms of the GNU General Public License as published by
|
| 639 |
+
the Free Software Foundation, either version 3 of the License, or
|
| 640 |
+
(at your option) any later version.
|
| 641 |
+
|
| 642 |
+
This program is distributed in the hope that it will be useful,
|
| 643 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 644 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 645 |
+
GNU General Public License for more details.
|
| 646 |
+
|
| 647 |
+
You should have received a copy of the GNU General Public License
|
| 648 |
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
| 649 |
+
|
| 650 |
+
Also add information on how to contact you by electronic and paper mail.
|
| 651 |
+
|
| 652 |
+
If the program does terminal interaction, make it output a short
|
| 653 |
+
notice like this when it starts in an interactive mode:
|
| 654 |
+
|
| 655 |
+
<program> Copyright (C) <year> <name of author>
|
| 656 |
+
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
| 657 |
+
This is free software, and you are welcome to redistribute it
|
| 658 |
+
under certain conditions; type `show c' for details.
|
| 659 |
+
|
| 660 |
+
The hypothetical commands `show w' and `show c' should show the appropriate
|
| 661 |
+
parts of the General Public License. Of course, your program's commands
|
| 662 |
+
might be different; for a GUI interface, you would use an "about box".
|
| 663 |
+
|
| 664 |
+
You should also get your employer (if you work as a programmer) or school,
|
| 665 |
+
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
| 666 |
+
For more information on this, and how to apply and follow the GNU GPL, see
|
| 667 |
+
<https://www.gnu.org/licenses/>.
|
| 668 |
+
|
| 669 |
+
The GNU General Public License does not permit incorporating your program
|
| 670 |
+
into proprietary programs. If your program is a subroutine library, you
|
| 671 |
+
may consider it more useful to permit linking proprietary applications with
|
| 672 |
+
the library. If this is what you want to do, use the GNU Lesser General
|
| 673 |
+
Public License instead of this License. But first, please read
|
| 674 |
+
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
configs/dev/service.yml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 服务名称
|
| 2 |
+
name: jimeng-free-api
|
| 3 |
+
# 服务绑定主机地址
|
| 4 |
+
host: '0.0.0.0'
|
| 5 |
+
# 服务绑定端口
|
| 6 |
+
port: 8000
|
configs/dev/system.yml
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 是否开启请求日志
|
| 2 |
+
requestLog: true
|
| 3 |
+
# 临时目录路径
|
| 4 |
+
tmpDir: ./tmp
|
| 5 |
+
# 日志目录路径
|
| 6 |
+
logDir: ./logs
|
| 7 |
+
# 日志写入间隔(毫秒)
|
| 8 |
+
logWriteInterval: 200
|
| 9 |
+
# 日志文件有效期(毫秒)
|
| 10 |
+
logFileExpires: 2626560000
|
| 11 |
+
# 公共目录路径
|
| 12 |
+
publicDir: ./public
|
| 13 |
+
# 临时文件有效期(毫秒)
|
| 14 |
+
tmpFileExpires: 86400000
|
doc/example-0.png
ADDED
|
Git LFS Details
|
doc/example-1.jpeg
ADDED
|
Git LFS Details
|
libs.d.ts
ADDED
|
File without changes
|
package-lock.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "jimeng-free-api",
|
| 3 |
+
"version": "0.0.6",
|
| 4 |
+
"description": "jimeng Free API Server",
|
| 5 |
+
"type": "module",
|
| 6 |
+
"main": "dist/index.js",
|
| 7 |
+
"module": "dist/index.mjs",
|
| 8 |
+
"types": "dist/index.d.ts",
|
| 9 |
+
"directories": {
|
| 10 |
+
"dist": "dist"
|
| 11 |
+
},
|
| 12 |
+
"files": [
|
| 13 |
+
"dist/"
|
| 14 |
+
],
|
| 15 |
+
"scripts": {
|
| 16 |
+
"dev": "tsup src/index.ts --format cjs,esm --sourcemap --dts --publicDir public --watch --onSuccess \"node --enable-source-maps --no-node-snapshot dist/index.js\"",
|
| 17 |
+
"start": "node --enable-source-maps --no-node-snapshot dist/index.js",
|
| 18 |
+
"build": "tsup src/index.ts --format cjs,esm --sourcemap --dts --clean --publicDir public"
|
| 19 |
+
},
|
| 20 |
+
"author": "Vinlic",
|
| 21 |
+
"license": "ISC",
|
| 22 |
+
"dependencies": {
|
| 23 |
+
"axios": "^1.6.7",
|
| 24 |
+
"build": "^0.1.4",
|
| 25 |
+
"colors": "^1.4.0",
|
| 26 |
+
"crc-32": "^1.2.2",
|
| 27 |
+
"cron": "^3.1.6",
|
| 28 |
+
"date-fns": "^3.3.1",
|
| 29 |
+
"eventsource-parser": "^1.1.2",
|
| 30 |
+
"form-data": "^4.0.0",
|
| 31 |
+
"fs-extra": "^11.2.0",
|
| 32 |
+
"koa": "^2.15.0",
|
| 33 |
+
"koa-body": "^5.0.0",
|
| 34 |
+
"koa-bodyparser": "^4.4.1",
|
| 35 |
+
"koa-range": "^0.3.0",
|
| 36 |
+
"koa-router": "^12.0.1",
|
| 37 |
+
"koa2-cors": "^2.0.6",
|
| 38 |
+
"lodash": "^4.17.21",
|
| 39 |
+
"mime": "^4.0.1",
|
| 40 |
+
"minimist": "^1.2.8",
|
| 41 |
+
"randomstring": "^1.3.0",
|
| 42 |
+
"semver": "^7.7.2",
|
| 43 |
+
"uuid": "^9.0.1",
|
| 44 |
+
"yaml": "^2.3.4"
|
| 45 |
+
},
|
| 46 |
+
"devDependencies": {
|
| 47 |
+
"@types/lodash": "^4.14.202",
|
| 48 |
+
"@types/mime": "^3.0.4",
|
| 49 |
+
"tsup": "^8.0.2",
|
| 50 |
+
"typescript": "^5.3.3"
|
| 51 |
+
}
|
| 52 |
+
}
|
public/welcome.html
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html>
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="utf-8"/>
|
| 5 |
+
<title>🚀 服务已启动</title>
|
| 6 |
+
</head>
|
| 7 |
+
<body>
|
| 8 |
+
<p>jimeng-free-api已启动!<br>请通过LobeChat / NextChat / Dify等客户端或OpenAI SDK接入!</p>
|
| 9 |
+
</body>
|
| 10 |
+
</html>
|
src/api/consts/exceptions.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export default {
|
| 2 |
+
API_TEST: [-9999, 'API异常错误'],
|
| 3 |
+
API_REQUEST_PARAMS_INVALID: [-2000, '请求参数非法'],
|
| 4 |
+
API_REQUEST_FAILED: [-2001, '请求失败'],
|
| 5 |
+
API_TOKEN_EXPIRES: [-2002, 'Token已失效'],
|
| 6 |
+
API_FILE_URL_INVALID: [-2003, '远程文件URL非法'],
|
| 7 |
+
API_FILE_EXECEEDS_SIZE: [-2004, '远程文件超出大小'],
|
| 8 |
+
API_CHAT_STREAM_PUSHING: [-2005, '已有对话流正在输出'],
|
| 9 |
+
API_CONTENT_FILTERED: [-2006, '内容由于合规问题已被阻止生成'],
|
| 10 |
+
API_IMAGE_GENERATION_FAILED: [-2007, '图像生成失败'],
|
| 11 |
+
API_VIDEO_GENERATION_FAILED: [-2008, '视频生成失败'],
|
| 12 |
+
API_IMAGE_GENERATION_INSUFFICIENT_POINTS: [-2009, '即梦积分不足'],
|
| 13 |
+
}
|
src/api/controllers/chat.ts
ADDED
|
@@ -0,0 +1,499 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import _ from "lodash";
|
| 2 |
+
import { PassThrough } from "stream";
|
| 3 |
+
|
| 4 |
+
import APIException from "@/lib/exceptions/APIException.ts";
|
| 5 |
+
import EX from "@/api/consts/exceptions.ts";
|
| 6 |
+
import logger from "@/lib/logger.ts";
|
| 7 |
+
import util from "@/lib/util.ts";
|
| 8 |
+
import { generateImages, DEFAULT_MODEL } from "./images.ts";
|
| 9 |
+
import { generateVideo, DEFAULT_MODEL as DEFAULT_VIDEO_MODEL } from "./videos.ts";
|
| 10 |
+
|
| 11 |
+
// 最大重试次数
|
| 12 |
+
const MAX_RETRY_COUNT = 3;
|
| 13 |
+
// 重试延迟
|
| 14 |
+
const RETRY_DELAY = 5000;
|
| 15 |
+
|
| 16 |
+
/**
|
| 17 |
+
* 解析模型
|
| 18 |
+
*
|
| 19 |
+
* @param model 模型名称
|
| 20 |
+
* @returns 模型信息
|
| 21 |
+
*/
|
| 22 |
+
function parseModel(model: string) {
|
| 23 |
+
const [_model, size] = model.split(":");
|
| 24 |
+
const [_, width, height] = /(\d+)[\W\w](\d+)/.exec(size) ?? [];
|
| 25 |
+
return {
|
| 26 |
+
model: _model,
|
| 27 |
+
width: size ? Math.ceil(parseInt(width) / 2) * 2 : 1024,
|
| 28 |
+
height: size ? Math.ceil(parseInt(height) / 2) * 2 : 1024,
|
| 29 |
+
};
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
/**
|
| 33 |
+
* 检测是否为视频生成请求
|
| 34 |
+
*
|
| 35 |
+
* @param model 模型名称
|
| 36 |
+
* @returns 是否为视频生成请求
|
| 37 |
+
*/
|
| 38 |
+
function isVideoModel(model: string) {
|
| 39 |
+
return model.startsWith("jimeng-video");
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* 同步对话补全
|
| 44 |
+
*
|
| 45 |
+
* @param messages 参考gpt系列消息格式,多轮对话请完整提供上下文
|
| 46 |
+
* @param refreshToken 用于刷新access_token的refresh_token
|
| 47 |
+
* @param assistantId 智能体ID,默认使用jimeng原版
|
| 48 |
+
* @param retryCount 重试次数
|
| 49 |
+
*/
|
| 50 |
+
export async function createCompletion(
|
| 51 |
+
messages: any[],
|
| 52 |
+
refreshToken: string,
|
| 53 |
+
_model = DEFAULT_MODEL,
|
| 54 |
+
retryCount = 0
|
| 55 |
+
) {
|
| 56 |
+
return (async () => {
|
| 57 |
+
if (messages.length === 0)
|
| 58 |
+
throw new APIException(EX.API_REQUEST_PARAMS_INVALID, "消息不能为空");
|
| 59 |
+
|
| 60 |
+
const { model, width, height } = parseModel(_model);
|
| 61 |
+
logger.info(messages);
|
| 62 |
+
|
| 63 |
+
// 检查是否为视频生成请求
|
| 64 |
+
if (isVideoModel(_model)) {
|
| 65 |
+
try {
|
| 66 |
+
// 视频生成
|
| 67 |
+
logger.info(`开始生成视频,模型: ${_model}`);
|
| 68 |
+
const videoUrl = await generateVideo(
|
| 69 |
+
_model,
|
| 70 |
+
messages[messages.length - 1].content,
|
| 71 |
+
{
|
| 72 |
+
width,
|
| 73 |
+
height,
|
| 74 |
+
resolution: "720p", // 默认分辨率
|
| 75 |
+
},
|
| 76 |
+
refreshToken
|
| 77 |
+
);
|
| 78 |
+
|
| 79 |
+
logger.info(`视频生成成功,URL: ${videoUrl}`);
|
| 80 |
+
return {
|
| 81 |
+
id: util.uuid(),
|
| 82 |
+
model: _model,
|
| 83 |
+
object: "chat.completion",
|
| 84 |
+
choices: [
|
| 85 |
+
{
|
| 86 |
+
index: 0,
|
| 87 |
+
message: {
|
| 88 |
+
role: "assistant",
|
| 89 |
+
content: `\n`,
|
| 90 |
+
},
|
| 91 |
+
finish_reason: "stop",
|
| 92 |
+
},
|
| 93 |
+
],
|
| 94 |
+
usage: { prompt_tokens: 1, completion_tokens: 1, total_tokens: 2 },
|
| 95 |
+
created: util.unixTimestamp(),
|
| 96 |
+
};
|
| 97 |
+
} catch (error) {
|
| 98 |
+
logger.error(`视频生成失败: ${error.message}`);
|
| 99 |
+
// 如果是积分不足等特定错误,直接抛出
|
| 100 |
+
if (error instanceof APIException) {
|
| 101 |
+
throw error;
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
// 其他错误返回友好提示
|
| 105 |
+
return {
|
| 106 |
+
id: util.uuid(),
|
| 107 |
+
model: _model,
|
| 108 |
+
object: "chat.completion",
|
| 109 |
+
choices: [
|
| 110 |
+
{
|
| 111 |
+
index: 0,
|
| 112 |
+
message: {
|
| 113 |
+
role: "assistant",
|
| 114 |
+
content: `生成视频失败: ${error.message}\n\n如果您在即梦官网看到已生成的视频,可能是获取结果时出现了问题,请前往即梦官网查看。`,
|
| 115 |
+
},
|
| 116 |
+
finish_reason: "stop",
|
| 117 |
+
},
|
| 118 |
+
],
|
| 119 |
+
usage: { prompt_tokens: 1, completion_tokens: 1, total_tokens: 2 },
|
| 120 |
+
created: util.unixTimestamp(),
|
| 121 |
+
};
|
| 122 |
+
}
|
| 123 |
+
} else {
|
| 124 |
+
// 图像生成
|
| 125 |
+
const imageUrls = await generateImages(
|
| 126 |
+
model,
|
| 127 |
+
messages[messages.length - 1].content,
|
| 128 |
+
{
|
| 129 |
+
width,
|
| 130 |
+
height,
|
| 131 |
+
},
|
| 132 |
+
refreshToken
|
| 133 |
+
);
|
| 134 |
+
|
| 135 |
+
return {
|
| 136 |
+
id: util.uuid(),
|
| 137 |
+
model: _model || model,
|
| 138 |
+
object: "chat.completion",
|
| 139 |
+
choices: [
|
| 140 |
+
{
|
| 141 |
+
index: 0,
|
| 142 |
+
message: {
|
| 143 |
+
role: "assistant",
|
| 144 |
+
content: imageUrls.reduce(
|
| 145 |
+
(acc, url, i) => acc + `\n`,
|
| 146 |
+
""
|
| 147 |
+
),
|
| 148 |
+
},
|
| 149 |
+
finish_reason: "stop",
|
| 150 |
+
},
|
| 151 |
+
],
|
| 152 |
+
usage: { prompt_tokens: 1, completion_tokens: 1, total_tokens: 2 },
|
| 153 |
+
created: util.unixTimestamp(),
|
| 154 |
+
};
|
| 155 |
+
}
|
| 156 |
+
})().catch((err) => {
|
| 157 |
+
if (retryCount < MAX_RETRY_COUNT) {
|
| 158 |
+
logger.error(`Response error: ${err.stack}`);
|
| 159 |
+
logger.warn(`Try again after ${RETRY_DELAY / 1000}s...`);
|
| 160 |
+
return (async () => {
|
| 161 |
+
await new Promise((resolve) => setTimeout(resolve, RETRY_DELAY));
|
| 162 |
+
return createCompletion(messages, refreshToken, _model, retryCount + 1);
|
| 163 |
+
})();
|
| 164 |
+
}
|
| 165 |
+
throw err;
|
| 166 |
+
});
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
/**
|
| 170 |
+
* 流式对话补全
|
| 171 |
+
*
|
| 172 |
+
* @param messages 参考gpt系列消息格式,多轮对话请完整提供上下文
|
| 173 |
+
* @param refreshToken 用于刷新access_token的refresh_token
|
| 174 |
+
* @param assistantId 智能体ID,默认使用jimeng原版
|
| 175 |
+
* @param retryCount 重试次数
|
| 176 |
+
*/
|
| 177 |
+
export async function createCompletionStream(
|
| 178 |
+
messages: any[],
|
| 179 |
+
refreshToken: string,
|
| 180 |
+
_model = DEFAULT_MODEL,
|
| 181 |
+
retryCount = 0
|
| 182 |
+
) {
|
| 183 |
+
return (async () => {
|
| 184 |
+
const { model, width, height } = parseModel(_model);
|
| 185 |
+
logger.info(messages);
|
| 186 |
+
|
| 187 |
+
const stream = new PassThrough();
|
| 188 |
+
|
| 189 |
+
if (messages.length === 0) {
|
| 190 |
+
logger.warn("消息为空,返回空流");
|
| 191 |
+
stream.end("data: [DONE]\n\n");
|
| 192 |
+
return stream;
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
// 检查是否为视频生成请求
|
| 196 |
+
if (isVideoModel(_model)) {
|
| 197 |
+
// 视频生成
|
| 198 |
+
stream.write(
|
| 199 |
+
"data: " +
|
| 200 |
+
JSON.stringify({
|
| 201 |
+
id: util.uuid(),
|
| 202 |
+
model: _model,
|
| 203 |
+
object: "chat.completion.chunk",
|
| 204 |
+
choices: [
|
| 205 |
+
{
|
| 206 |
+
index: 0,
|
| 207 |
+
delta: { role: "assistant", content: "🎬 视频生成中,请稍候...\n这可能需要1-2分钟,请耐心等待" },
|
| 208 |
+
finish_reason: null,
|
| 209 |
+
},
|
| 210 |
+
],
|
| 211 |
+
}) +
|
| 212 |
+
"\n\n"
|
| 213 |
+
);
|
| 214 |
+
|
| 215 |
+
// 视频生成
|
| 216 |
+
logger.info(`开始生成视频,提示词: ${messages[messages.length - 1].content}`);
|
| 217 |
+
|
| 218 |
+
// 进度更新定时器
|
| 219 |
+
const progressInterval = setInterval(() => {
|
| 220 |
+
stream.write(
|
| 221 |
+
"data: " +
|
| 222 |
+
JSON.stringify({
|
| 223 |
+
id: util.uuid(),
|
| 224 |
+
model: _model,
|
| 225 |
+
object: "chat.completion.chunk",
|
| 226 |
+
choices: [
|
| 227 |
+
{
|
| 228 |
+
index: 0,
|
| 229 |
+
delta: { role: "assistant", content: "." },
|
| 230 |
+
finish_reason: null,
|
| 231 |
+
},
|
| 232 |
+
],
|
| 233 |
+
}) +
|
| 234 |
+
"\n\n"
|
| 235 |
+
);
|
| 236 |
+
}, 5000);
|
| 237 |
+
|
| 238 |
+
// 设置超时,防止无限等待
|
| 239 |
+
const timeoutId = setTimeout(() => {
|
| 240 |
+
clearInterval(progressInterval);
|
| 241 |
+
logger.warn(`视频生成超时(2分钟),提示用户前往即梦官网查看`);
|
| 242 |
+
stream.write(
|
| 243 |
+
"data: " +
|
| 244 |
+
JSON.stringify({
|
| 245 |
+
id: util.uuid(),
|
| 246 |
+
model: _model,
|
| 247 |
+
object: "chat.completion.chunk",
|
| 248 |
+
choices: [
|
| 249 |
+
{
|
| 250 |
+
index: 1,
|
| 251 |
+
delta: {
|
| 252 |
+
role: "assistant",
|
| 253 |
+
content: "\n\n视频生成时间较长(已等待2分钟),但视频可能仍在生成中。\n\n请前往即梦官网查看您的视频:\n1. 访问 https://jimeng.jianying.com/ai-tool/video/generate\n2. 登录后查看您的创作历史\n3. 如果视频已生成,您可以直接在官网下载或分享\n\n您也可以继续等待,系统将在后台继续尝试获取视频(最长约20分钟)。",
|
| 254 |
+
},
|
| 255 |
+
finish_reason: "stop",
|
| 256 |
+
},
|
| 257 |
+
],
|
| 258 |
+
}) +
|
| 259 |
+
"\n\n"
|
| 260 |
+
);
|
| 261 |
+
// 注意:这里不结束流,让后台继续尝试获取视频
|
| 262 |
+
// stream.end("data: [DONE]\n\n");
|
| 263 |
+
}, 2 * 60 * 1000);
|
| 264 |
+
|
| 265 |
+
logger.info(`开始生成视频,模型: ${_model}, 提示词: ${messages[messages.length - 1].content.substring(0, 50)}...`);
|
| 266 |
+
|
| 267 |
+
// 先给用户一个初始提示
|
| 268 |
+
stream.write(
|
| 269 |
+
"data: " +
|
| 270 |
+
JSON.stringify({
|
| 271 |
+
id: util.uuid(),
|
| 272 |
+
model: _model,
|
| 273 |
+
object: "chat.completion.chunk",
|
| 274 |
+
choices: [
|
| 275 |
+
{
|
| 276 |
+
index: 0,
|
| 277 |
+
delta: {
|
| 278 |
+
role: "assistant",
|
| 279 |
+
content: "\n\n🎬 视频生成已开始,这可能需要几分钟时间...",
|
| 280 |
+
},
|
| 281 |
+
finish_reason: null,
|
| 282 |
+
},
|
| 283 |
+
],
|
| 284 |
+
}) +
|
| 285 |
+
"\n\n"
|
| 286 |
+
);
|
| 287 |
+
|
| 288 |
+
generateVideo(
|
| 289 |
+
_model,
|
| 290 |
+
messages[messages.length - 1].content,
|
| 291 |
+
{ width, height, resolution: "720p" },
|
| 292 |
+
refreshToken
|
| 293 |
+
)
|
| 294 |
+
.then((videoUrl) => {
|
| 295 |
+
clearInterval(progressInterval);
|
| 296 |
+
clearTimeout(timeoutId);
|
| 297 |
+
|
| 298 |
+
logger.info(`视频生成成功,URL: ${videoUrl}`);
|
| 299 |
+
|
| 300 |
+
stream.write(
|
| 301 |
+
"data: " +
|
| 302 |
+
JSON.stringify({
|
| 303 |
+
id: util.uuid(),
|
| 304 |
+
model: _model,
|
| 305 |
+
object: "chat.completion.chunk",
|
| 306 |
+
choices: [
|
| 307 |
+
{
|
| 308 |
+
index: 1,
|
| 309 |
+
delta: {
|
| 310 |
+
role: "assistant",
|
| 311 |
+
content: `\n\n✅ 视频生成完成!\n\n\n\n您可以:\n1. 直接查看上方视频\n2. 使用以下链接下载或分享:${videoUrl}`,
|
| 312 |
+
},
|
| 313 |
+
finish_reason: null,
|
| 314 |
+
},
|
| 315 |
+
],
|
| 316 |
+
}) +
|
| 317 |
+
"\n\n"
|
| 318 |
+
);
|
| 319 |
+
|
| 320 |
+
stream.write(
|
| 321 |
+
"data: " +
|
| 322 |
+
JSON.stringify({
|
| 323 |
+
id: util.uuid(),
|
| 324 |
+
model: _model,
|
| 325 |
+
object: "chat.completion.chunk",
|
| 326 |
+
choices: [
|
| 327 |
+
{
|
| 328 |
+
index: 2,
|
| 329 |
+
delta: {
|
| 330 |
+
role: "assistant",
|
| 331 |
+
content: "",
|
| 332 |
+
},
|
| 333 |
+
finish_reason: "stop",
|
| 334 |
+
},
|
| 335 |
+
],
|
| 336 |
+
}) +
|
| 337 |
+
"\n\n"
|
| 338 |
+
);
|
| 339 |
+
stream.end("data: [DONE]\n\n");
|
| 340 |
+
})
|
| 341 |
+
.catch((err) => {
|
| 342 |
+
clearInterval(progressInterval);
|
| 343 |
+
clearTimeout(timeoutId);
|
| 344 |
+
|
| 345 |
+
logger.error(`视频生成失败: ${err.message}`);
|
| 346 |
+
logger.error(`错误详情: ${JSON.stringify(err)}`);
|
| 347 |
+
|
| 348 |
+
// 记录详细错误信息
|
| 349 |
+
logger.error(`视频生成失败: ${err.message}`);
|
| 350 |
+
logger.error(`错误详情: ${JSON.stringify(err)}`);
|
| 351 |
+
|
| 352 |
+
// 构建更详细的错误信息
|
| 353 |
+
let errorMessage = `⚠️ 视频生成过程中遇到问题: ${err.message}`;
|
| 354 |
+
|
| 355 |
+
// 如果是历史记录不存在的错误,提供更具体的建议
|
| 356 |
+
if (err.message.includes("历史记录不存在")) {
|
| 357 |
+
errorMessage += "\n\n可能原因:\n1. 视频生成请求已发送,但API无法获取历史记录\n2. 视频生成服务暂时不可用\n3. 历史记录ID无效或已过期\n\n建议操作:\n1. 请前往即梦官网查看您的视频是否已生成:https://jimeng.jianying.com/ai-tool/video/generate\n2. 如果官网已显示视频,但这里无法获取,可能是API连接问题\n3. 如果官网也没有显示,请稍后再试或重新生成视频";
|
| 358 |
+
} else if (err.message.includes("获取视频生成结果超时")) {
|
| 359 |
+
errorMessage += "\n\n视频生成可能仍在进行中,但等待时间已超过系统设定的限制。\n\n请前往即梦官网查看您的视频:https://jimeng.jianying.com/ai-tool/video/generate\n\n如果您在官网上看到视频已生成,但这里无法显示,可能是因为:\n1. 获取结果的过程超时\n2. 网络连接问题\n3. API访问限制";
|
| 360 |
+
} else {
|
| 361 |
+
errorMessage += "\n\n如果您在即梦官网看到已生成的视频,可能是获取结果时出现了问题。\n\n请访问即梦官网查看您的创作历史:https://jimeng.jianying.com/ai-tool/video/generate";
|
| 362 |
+
}
|
| 363 |
+
|
| 364 |
+
// 添加历史ID信息,方便用户在官网查找
|
| 365 |
+
if (err.historyId) {
|
| 366 |
+
errorMessage += `\n\n历史记录ID: ${err.historyId}(您可以使用此ID在官网搜索您的视频)`;
|
| 367 |
+
}
|
| 368 |
+
|
| 369 |
+
stream.write(
|
| 370 |
+
"data: " +
|
| 371 |
+
JSON.stringify({
|
| 372 |
+
id: util.uuid(),
|
| 373 |
+
model: _model,
|
| 374 |
+
object: "chat.completion.chunk",
|
| 375 |
+
choices: [
|
| 376 |
+
{
|
| 377 |
+
index: 1,
|
| 378 |
+
delta: {
|
| 379 |
+
role: "assistant",
|
| 380 |
+
content: `\n\n${errorMessage}`,
|
| 381 |
+
},
|
| 382 |
+
finish_reason: "stop",
|
| 383 |
+
},
|
| 384 |
+
],
|
| 385 |
+
}) +
|
| 386 |
+
"\n\n"
|
| 387 |
+
);
|
| 388 |
+
stream.end("data: [DONE]\n\n");
|
| 389 |
+
});
|
| 390 |
+
} else {
|
| 391 |
+
// 图像生成
|
| 392 |
+
stream.write(
|
| 393 |
+
"data: " +
|
| 394 |
+
JSON.stringify({
|
| 395 |
+
id: util.uuid(),
|
| 396 |
+
model: _model || model,
|
| 397 |
+
object: "chat.completion.chunk",
|
| 398 |
+
choices: [
|
| 399 |
+
{
|
| 400 |
+
index: 0,
|
| 401 |
+
delta: { role: "assistant", content: "🎨 图像生成中,请稍候..." },
|
| 402 |
+
finish_reason: null,
|
| 403 |
+
},
|
| 404 |
+
],
|
| 405 |
+
}) +
|
| 406 |
+
"\n\n"
|
| 407 |
+
);
|
| 408 |
+
|
| 409 |
+
generateImages(
|
| 410 |
+
model,
|
| 411 |
+
messages[messages.length - 1].content,
|
| 412 |
+
{ width, height },
|
| 413 |
+
refreshToken
|
| 414 |
+
)
|
| 415 |
+
.then((imageUrls) => {
|
| 416 |
+
for (let i = 0; i < imageUrls.length; i++) {
|
| 417 |
+
const url = imageUrls[i];
|
| 418 |
+
stream.write(
|
| 419 |
+
"data: " +
|
| 420 |
+
JSON.stringify({
|
| 421 |
+
id: util.uuid(),
|
| 422 |
+
model: _model || model,
|
| 423 |
+
object: "chat.completion.chunk",
|
| 424 |
+
choices: [
|
| 425 |
+
{
|
| 426 |
+
index: i + 1,
|
| 427 |
+
delta: {
|
| 428 |
+
role: "assistant",
|
| 429 |
+
content: `\n`,
|
| 430 |
+
},
|
| 431 |
+
finish_reason: i < imageUrls.length - 1 ? null : "stop",
|
| 432 |
+
},
|
| 433 |
+
],
|
| 434 |
+
}) +
|
| 435 |
+
"\n\n"
|
| 436 |
+
);
|
| 437 |
+
}
|
| 438 |
+
stream.write(
|
| 439 |
+
"data: " +
|
| 440 |
+
JSON.stringify({
|
| 441 |
+
id: util.uuid(),
|
| 442 |
+
model: _model || model,
|
| 443 |
+
object: "chat.completion.chunk",
|
| 444 |
+
choices: [
|
| 445 |
+
{
|
| 446 |
+
index: imageUrls.length + 1,
|
| 447 |
+
delta: {
|
| 448 |
+
role: "assistant",
|
| 449 |
+
content: "图像生成完成!",
|
| 450 |
+
},
|
| 451 |
+
finish_reason: "stop",
|
| 452 |
+
},
|
| 453 |
+
],
|
| 454 |
+
}) +
|
| 455 |
+
"\n\n"
|
| 456 |
+
);
|
| 457 |
+
stream.end("data: [DONE]\n\n");
|
| 458 |
+
})
|
| 459 |
+
.catch((err) => {
|
| 460 |
+
stream.write(
|
| 461 |
+
"data: " +
|
| 462 |
+
JSON.stringify({
|
| 463 |
+
id: util.uuid(),
|
| 464 |
+
model: _model || model,
|
| 465 |
+
object: "chat.completion.chunk",
|
| 466 |
+
choices: [
|
| 467 |
+
{
|
| 468 |
+
index: 1,
|
| 469 |
+
delta: {
|
| 470 |
+
role: "assistant",
|
| 471 |
+
content: `生成图片失败: ${err.message}`,
|
| 472 |
+
},
|
| 473 |
+
finish_reason: "stop",
|
| 474 |
+
},
|
| 475 |
+
],
|
| 476 |
+
}) +
|
| 477 |
+
"\n\n"
|
| 478 |
+
);
|
| 479 |
+
stream.end("data: [DONE]\n\n");
|
| 480 |
+
});
|
| 481 |
+
}
|
| 482 |
+
return stream;
|
| 483 |
+
})().catch((err) => {
|
| 484 |
+
if (retryCount < MAX_RETRY_COUNT) {
|
| 485 |
+
logger.error(`Response error: ${err.stack}`);
|
| 486 |
+
logger.warn(`Try again after ${RETRY_DELAY / 1000}s...`);
|
| 487 |
+
return (async () => {
|
| 488 |
+
await new Promise((resolve) => setTimeout(resolve, RETRY_DELAY));
|
| 489 |
+
return createCompletionStream(
|
| 490 |
+
messages,
|
| 491 |
+
refreshToken,
|
| 492 |
+
_model,
|
| 493 |
+
retryCount + 1
|
| 494 |
+
);
|
| 495 |
+
})();
|
| 496 |
+
}
|
| 497 |
+
throw err;
|
| 498 |
+
});
|
| 499 |
+
}
|
src/api/controllers/core.ts
ADDED
|
@@ -0,0 +1,434 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { PassThrough } from "stream";
|
| 2 |
+
import path from "path";
|
| 3 |
+
import _ from "lodash";
|
| 4 |
+
import mime from "mime";
|
| 5 |
+
import axios, { AxiosRequestConfig, AxiosResponse } from "axios";
|
| 6 |
+
|
| 7 |
+
import APIException from "@/lib/exceptions/APIException.ts";
|
| 8 |
+
import EX from "@/api/consts/exceptions.ts";
|
| 9 |
+
import { createParser } from "eventsource-parser";
|
| 10 |
+
import logger from "@/lib/logger.ts";
|
| 11 |
+
import util from "@/lib/util.ts";
|
| 12 |
+
|
| 13 |
+
// 模型名称
|
| 14 |
+
const MODEL_NAME = "jimeng";
|
| 15 |
+
// 默认的AgentID
|
| 16 |
+
const DEFAULT_ASSISTANT_ID = "513695";
|
| 17 |
+
// 版本号
|
| 18 |
+
const VERSION_CODE = "5.8.0";
|
| 19 |
+
// 平台代码
|
| 20 |
+
const PLATFORM_CODE = "7";
|
| 21 |
+
// 设备ID
|
| 22 |
+
const DEVICE_ID = Math.random() * 999999999999999999 + 7000000000000000000;
|
| 23 |
+
// WebID
|
| 24 |
+
const WEB_ID = Math.random() * 999999999999999999 + 7000000000000000000;
|
| 25 |
+
// 用户ID
|
| 26 |
+
const USER_ID = util.uuid(false);
|
| 27 |
+
// 最大重试次数
|
| 28 |
+
const MAX_RETRY_COUNT = 3;
|
| 29 |
+
// 重试延迟
|
| 30 |
+
const RETRY_DELAY = 5000;
|
| 31 |
+
// 伪装headers
|
| 32 |
+
const FAKE_HEADERS = {
|
| 33 |
+
Accept: "application/json, text/plain, */*",
|
| 34 |
+
"Accept-Encoding": "gzip, deflate, br, zstd",
|
| 35 |
+
"Accept-language": "zh-CN,zh;q=0.9",
|
| 36 |
+
"Cache-control": "no-cache",
|
| 37 |
+
"Last-event-id": "undefined",
|
| 38 |
+
Appid: DEFAULT_ASSISTANT_ID,
|
| 39 |
+
Appvr: VERSION_CODE,
|
| 40 |
+
Origin: "https://jimeng.jianying.com",
|
| 41 |
+
Pragma: "no-cache",
|
| 42 |
+
Priority: "u=1, i",
|
| 43 |
+
Referer: "https://jimeng.jianying.com",
|
| 44 |
+
Pf: PLATFORM_CODE,
|
| 45 |
+
"Sec-Ch-Ua":
|
| 46 |
+
'"Google Chrome";v="131", "Chromium";v="131", "Not_A Brand";v="24"',
|
| 47 |
+
"Sec-Ch-Ua-Mobile": "?0",
|
| 48 |
+
"Sec-Ch-Ua-Platform": '"Windows"',
|
| 49 |
+
"Sec-Fetch-Dest": "empty",
|
| 50 |
+
"Sec-Fetch-Mode": "cors",
|
| 51 |
+
"Sec-Fetch-Site": "same-origin",
|
| 52 |
+
"User-Agent":
|
| 53 |
+
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36",
|
| 54 |
+
};
|
| 55 |
+
// 文件最大大小
|
| 56 |
+
const FILE_MAX_SIZE = 100 * 1024 * 1024;
|
| 57 |
+
|
| 58 |
+
/**
|
| 59 |
+
* 获取缓存中的access_token
|
| 60 |
+
*
|
| 61 |
+
* 目前jimeng的access_token是固定的,暂无刷新功能
|
| 62 |
+
*
|
| 63 |
+
* @param refreshToken 用于刷新access_token的refresh_token
|
| 64 |
+
*/
|
| 65 |
+
export async function acquireToken(refreshToken: string): Promise<string> {
|
| 66 |
+
return refreshToken;
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
/**
|
| 70 |
+
* 生成cookie
|
| 71 |
+
*/
|
| 72 |
+
export function generateCookie(refreshToken: string) {
|
| 73 |
+
return [
|
| 74 |
+
`_tea_web_id=${WEB_ID}`,
|
| 75 |
+
`is_staff_user=false`,
|
| 76 |
+
`store-region=cn-gd`,
|
| 77 |
+
`store-region-src=uid`,
|
| 78 |
+
`sid_guard=${refreshToken}%7C${util.unixTimestamp()}%7C5184000%7CMon%2C+03-Feb-2025+08%3A17%3A09+GMT`,
|
| 79 |
+
`uid_tt=${USER_ID}`,
|
| 80 |
+
`uid_tt_ss=${USER_ID}`,
|
| 81 |
+
`sid_tt=${refreshToken}`,
|
| 82 |
+
`sessionid=${refreshToken}`,
|
| 83 |
+
`sessionid_ss=${refreshToken}`,
|
| 84 |
+
`sid_tt=${refreshToken}`
|
| 85 |
+
].join("; ");
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
/**
|
| 89 |
+
* 获取积分信息
|
| 90 |
+
*
|
| 91 |
+
* @param refreshToken 用于刷新access_token的refresh_token
|
| 92 |
+
*/
|
| 93 |
+
export async function getCredit(refreshToken: string) {
|
| 94 |
+
const {
|
| 95 |
+
credit: { gift_credit, purchase_credit, vip_credit }
|
| 96 |
+
} = await request("POST", "/commerce/v1/benefits/user_credit", refreshToken, {
|
| 97 |
+
data: {},
|
| 98 |
+
headers: {
|
| 99 |
+
// Cookie: 'x-web-secsdk-uid=ef44bd0d-0cf6-448c-b517-fd1b5a7267ba; s_v_web_id=verify_m4b1lhlu_DI8qKRlD_7mJJ_4eqx_9shQ_s8eS2QLAbc4n; passport_csrf_token=86f3619c0c4a9c13f24117f71dc18524; passport_csrf_token_default=86f3619c0c4a9c13f24117f71dc18524; n_mh=9-mIeuD4wZnlYrrOvfzG3MuT6aQmCUtmr8FxV8Kl8xY; sid_guard=a7eb745aec44bb3186dbc2083ea9e1a6%7C1733386629%7C5184000%7CMon%2C+03-Feb-2025+08%3A17%3A09+GMT; uid_tt=59a46c7d3f34bda9588b93590cca2e12; uid_tt_ss=59a46c7d3f34bda9588b93590cca2e12; sid_tt=a7eb745aec44bb3186dbc2083ea9e1a6; sessionid=a7eb745aec44bb3186dbc2083ea9e1a6; sessionid_ss=a7eb745aec44bb3186dbc2083ea9e1a6; is_staff_user=false; sid_ucp_v1=1.0.0-KGRiOGY2ODQyNWU1OTk3NzRhYTE2ZmZhYmFjNjdmYjY3NzRmZGRiZTgKHgjToPCw0cwbEIXDxboGGJ-tHyAMMITDxboGOAhAJhoCaGwiIGE3ZWI3NDVhZWM0NGJiMzE4NmRiYzIwODNlYTllMWE2; ssid_ucp_v1=1.0.0-KGRiOGY2ODQyNWU1OTk3NzRhYTE2ZmZhYmFjNjdmYjY3NzRmZGRiZTgKHgjToPCw0cwbEIXDxboGGJ-tHyAMMITDxboGOAhAJhoCaGwiIGE3ZWI3NDVhZWM0NGJiMzE4NmRiYzIwODNlYTllMWE2; store-region=cn-gd; store-region-src=uid; user_spaces_idc={"7444764277623653426":"lf"}; ttwid=1|cxHJViEev1mfkjntdMziir8SwbU8uPNVSaeh9QpEUs8|1733966961|d8d52f5f56607427691be4ac44253f7870a34d25dd05a01b4d89b8a7c5ea82ad; _tea_web_id=7444838473275573797; fpk1=fa6c6a4d9ba074b90003896f36b6960066521c1faec6a60bdcb69ec8ddf85e8360b4c0704412848ec582b2abca73d57a; odin_tt=efe9dc150207879b88509e651a1c4af4e7ffb4cfcb522425a75bd72fbf894eda570bbf7ffb551c8b1de0aa2bfa0bd1be6c4157411ecdcf4464fcaf8dd6657d66',
|
| 100 |
+
Referer: "https://jimeng.jianying.com/ai-tool/image/generate",
|
| 101 |
+
// "Device-Time": 1733966964,
|
| 102 |
+
// Sign: "f3dbb824b378abea7c03cbb152b3a365"
|
| 103 |
+
}
|
| 104 |
+
});
|
| 105 |
+
logger.info(`\n积分信息: \n赠送积分: ${gift_credit}, 购买积分: ${purchase_credit}, VIP积分: ${vip_credit}`);
|
| 106 |
+
return {
|
| 107 |
+
giftCredit: gift_credit,
|
| 108 |
+
purchaseCredit: purchase_credit,
|
| 109 |
+
vipCredit: vip_credit,
|
| 110 |
+
totalCredit: gift_credit + purchase_credit + vip_credit
|
| 111 |
+
}
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
/**
|
| 115 |
+
* 接收今日积分
|
| 116 |
+
*
|
| 117 |
+
* @param refreshToken 用于刷新access_token的refresh_token
|
| 118 |
+
*/
|
| 119 |
+
export async function receiveCredit(refreshToken: string) {
|
| 120 |
+
logger.info("正在收取今日积分...")
|
| 121 |
+
const { cur_total_credits, receive_quota } = await request("POST", "/commerce/v1/benefits/credit_receive", refreshToken, {
|
| 122 |
+
data: {
|
| 123 |
+
time_zone: "Asia/Shanghai"
|
| 124 |
+
},
|
| 125 |
+
headers: {
|
| 126 |
+
Referer: "https://jimeng.jianying.com/ai-tool/image/generate"
|
| 127 |
+
}
|
| 128 |
+
});
|
| 129 |
+
logger.info(`\n今日${receive_quota}积分收取成功\n剩余积分: ${cur_total_credits}`);
|
| 130 |
+
return cur_total_credits;
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
/**
|
| 134 |
+
* 请求jimeng
|
| 135 |
+
*
|
| 136 |
+
* @param method 请求方法
|
| 137 |
+
* @param uri 请求路径
|
| 138 |
+
* @param params 请求参数
|
| 139 |
+
* @param headers 请求头
|
| 140 |
+
*/
|
| 141 |
+
export async function request(
|
| 142 |
+
method: string,
|
| 143 |
+
uri: string,
|
| 144 |
+
refreshToken: string,
|
| 145 |
+
options: AxiosRequestConfig = {}
|
| 146 |
+
) {
|
| 147 |
+
const token = await acquireToken(refreshToken);
|
| 148 |
+
const deviceTime = util.unixTimestamp();
|
| 149 |
+
const sign = util.md5(
|
| 150 |
+
`9e2c|${uri.slice(-7)}|${PLATFORM_CODE}|${VERSION_CODE}|${deviceTime}||11ac`
|
| 151 |
+
);
|
| 152 |
+
|
| 153 |
+
const fullUrl = `https://jimeng.jianying.com${uri}`;
|
| 154 |
+
const requestParams = {
|
| 155 |
+
aid: DEFAULT_ASSISTANT_ID,
|
| 156 |
+
device_platform: "web",
|
| 157 |
+
region: "CN",
|
| 158 |
+
web_id: WEB_ID,
|
| 159 |
+
...(options.params || {}),
|
| 160 |
+
};
|
| 161 |
+
|
| 162 |
+
const headers = {
|
| 163 |
+
...FAKE_HEADERS,
|
| 164 |
+
Cookie: generateCookie(token),
|
| 165 |
+
"Device-Time": deviceTime,
|
| 166 |
+
Sign: sign,
|
| 167 |
+
"Sign-Ver": "1",
|
| 168 |
+
...(options.headers || {}),
|
| 169 |
+
};
|
| 170 |
+
|
| 171 |
+
logger.info(`发送请求: ${method.toUpperCase()} ${fullUrl}`);
|
| 172 |
+
logger.info(`请求参数: ${JSON.stringify(requestParams)}`);
|
| 173 |
+
logger.info(`请求数据: ${JSON.stringify(options.data || {})}`);
|
| 174 |
+
|
| 175 |
+
// 添加重试逻辑
|
| 176 |
+
let retries = 0;
|
| 177 |
+
const maxRetries = 3; // 最大重试次数
|
| 178 |
+
let lastError = null;
|
| 179 |
+
|
| 180 |
+
while (retries <= maxRetries) {
|
| 181 |
+
try {
|
| 182 |
+
if (retries > 0) {
|
| 183 |
+
logger.info(`第 ${retries} 次重试请求: ${method.toUpperCase()} ${fullUrl}`);
|
| 184 |
+
// 重试前等待一段时间
|
| 185 |
+
await new Promise(resolve => setTimeout(resolve, 1000 * retries));
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
const response = await axios.request({
|
| 189 |
+
method,
|
| 190 |
+
url: fullUrl,
|
| 191 |
+
params: requestParams,
|
| 192 |
+
headers: headers,
|
| 193 |
+
timeout: 45000, // 增加超时时间到45秒
|
| 194 |
+
validateStatus: () => true, // 允许任何状态码
|
| 195 |
+
..._.omit(options, "params", "headers"),
|
| 196 |
+
});
|
| 197 |
+
|
| 198 |
+
// 记录响应状态和头信息
|
| 199 |
+
logger.info(`响应状态: ${response.status} ${response.statusText}`);
|
| 200 |
+
|
| 201 |
+
// 流式响应直接返回response
|
| 202 |
+
if (options.responseType == "stream") return response;
|
| 203 |
+
|
| 204 |
+
// 记录响应数据摘要
|
| 205 |
+
const responseDataSummary = JSON.stringify(response.data).substring(0, 500) +
|
| 206 |
+
(JSON.stringify(response.data).length > 500 ? "..." : "");
|
| 207 |
+
logger.info(`响应数据摘要: ${responseDataSummary}`);
|
| 208 |
+
|
| 209 |
+
// 检查HTTP状态码
|
| 210 |
+
if (response.status >= 400) {
|
| 211 |
+
logger.warn(`HTTP错误: ${response.status} ${response.statusText}`);
|
| 212 |
+
if (retries < maxRetries) {
|
| 213 |
+
retries++;
|
| 214 |
+
continue;
|
| 215 |
+
}
|
| 216 |
+
}
|
| 217 |
+
|
| 218 |
+
return checkResult(response);
|
| 219 |
+
}
|
| 220 |
+
catch (error) {
|
| 221 |
+
lastError = error;
|
| 222 |
+
logger.error(`请求失败 (尝试 ${retries + 1}/${maxRetries + 1}): ${error.message}`);
|
| 223 |
+
|
| 224 |
+
// 如果是网络错误或超时,尝试重试
|
| 225 |
+
if ((error.code === 'ECONNABORTED' || error.code === 'ETIMEDOUT' ||
|
| 226 |
+
error.message.includes('timeout') || error.message.includes('network')) &&
|
| 227 |
+
retries < maxRetries) {
|
| 228 |
+
retries++;
|
| 229 |
+
continue;
|
| 230 |
+
}
|
| 231 |
+
|
| 232 |
+
// 其他错误直接抛出
|
| 233 |
+
break;
|
| 234 |
+
}
|
| 235 |
+
}
|
| 236 |
+
|
| 237 |
+
// 所有重试都失败了,抛出最后一个错误
|
| 238 |
+
logger.error(`请求失败,已重试 ${retries} 次: ${lastError.message}`);
|
| 239 |
+
if (lastError.response) {
|
| 240 |
+
logger.error(`响应状态: ${lastError.response.status}`);
|
| 241 |
+
logger.error(`响应数据: ${JSON.stringify(lastError.response.data)}`);
|
| 242 |
+
}
|
| 243 |
+
throw lastError;
|
| 244 |
+
}
|
| 245 |
+
|
| 246 |
+
/**
|
| 247 |
+
* 预检查文件URL有效性
|
| 248 |
+
*
|
| 249 |
+
* @param fileUrl 文件URL
|
| 250 |
+
*/
|
| 251 |
+
export async function checkFileUrl(fileUrl: string) {
|
| 252 |
+
if (util.isBASE64Data(fileUrl)) return;
|
| 253 |
+
const result = await axios.head(fileUrl, {
|
| 254 |
+
timeout: 15000,
|
| 255 |
+
validateStatus: () => true,
|
| 256 |
+
});
|
| 257 |
+
if (result.status >= 400)
|
| 258 |
+
throw new APIException(
|
| 259 |
+
EX.API_FILE_URL_INVALID,
|
| 260 |
+
`File ${fileUrl} is not valid: [${result.status}] ${result.statusText}`
|
| 261 |
+
);
|
| 262 |
+
// 检查文件大小
|
| 263 |
+
if (result.headers && result.headers["content-length"]) {
|
| 264 |
+
const fileSize = parseInt(result.headers["content-length"], 10);
|
| 265 |
+
if (fileSize > FILE_MAX_SIZE)
|
| 266 |
+
throw new APIException(
|
| 267 |
+
EX.API_FILE_EXECEEDS_SIZE,
|
| 268 |
+
`File ${fileUrl} is not valid`
|
| 269 |
+
);
|
| 270 |
+
}
|
| 271 |
+
}
|
| 272 |
+
|
| 273 |
+
/**
|
| 274 |
+
* 上传文件
|
| 275 |
+
*
|
| 276 |
+
* @param refreshToken 用于刷新access_token的refresh_token
|
| 277 |
+
* @param fileUrl 文件URL或BASE64数据
|
| 278 |
+
* @param isVideoImage 是否是用于视频图像
|
| 279 |
+
* @returns 上传结果,包含image_uri
|
| 280 |
+
*/
|
| 281 |
+
export async function uploadFile(
|
| 282 |
+
refreshToken: string,
|
| 283 |
+
fileUrl: string,
|
| 284 |
+
isVideoImage: boolean = false
|
| 285 |
+
) {
|
| 286 |
+
try {
|
| 287 |
+
logger.info(`开始上传文件: ${fileUrl}, 视频图像模式: ${isVideoImage}`);
|
| 288 |
+
|
| 289 |
+
// 预检查远程文件URL可用性
|
| 290 |
+
await checkFileUrl(fileUrl);
|
| 291 |
+
|
| 292 |
+
let filename, fileData, mimeType;
|
| 293 |
+
// 如果是BASE64数据则直接转换为Buffer
|
| 294 |
+
if (util.isBASE64Data(fileUrl)) {
|
| 295 |
+
mimeType = util.extractBASE64DataFormat(fileUrl);
|
| 296 |
+
const ext = mime.getExtension(mimeType);
|
| 297 |
+
filename = `${util.uuid()}.${ext}`;
|
| 298 |
+
fileData = Buffer.from(util.removeBASE64DataHeader(fileUrl), "base64");
|
| 299 |
+
logger.info(`处理BASE64数据,文件名: ${filename}, 类型: ${mimeType}, 大小: ${fileData.length}字节`);
|
| 300 |
+
}
|
| 301 |
+
// 下载文件到内存,如果您的服务器内存很小,建议考虑改造为流直传到下一个接口上,避免停留占用内存
|
| 302 |
+
else {
|
| 303 |
+
filename = path.basename(fileUrl);
|
| 304 |
+
logger.info(`开始下载远程文件: ${fileUrl}`);
|
| 305 |
+
({ data: fileData } = await axios.get(fileUrl, {
|
| 306 |
+
responseType: "arraybuffer",
|
| 307 |
+
// 100M限制
|
| 308 |
+
maxContentLength: FILE_MAX_SIZE,
|
| 309 |
+
// 60秒超时
|
| 310 |
+
timeout: 60000,
|
| 311 |
+
}));
|
| 312 |
+
logger.info(`文件下载完成,文件名: ${filename}, 大小: ${fileData.length}字节`);
|
| 313 |
+
}
|
| 314 |
+
|
| 315 |
+
// 获取文件的MIME类型
|
| 316 |
+
mimeType = mimeType || mime.getType(filename);
|
| 317 |
+
logger.info(`文件MIME类型: ${mimeType}`);
|
| 318 |
+
|
| 319 |
+
// 构建FormData
|
| 320 |
+
const formData = new FormData();
|
| 321 |
+
const blob = new Blob([fileData], { type: mimeType });
|
| 322 |
+
formData.append('file', blob, filename);
|
| 323 |
+
|
| 324 |
+
// 获取上传凭证
|
| 325 |
+
logger.info(`请求上传凭证,场景: ${isVideoImage ? 'video_cover' : 'aigc_image'}`);
|
| 326 |
+
const uploadProofUrl = 'https://imagex.bytedanceapi.com/';
|
| 327 |
+
const proofResult = await request(
|
| 328 |
+
'POST',
|
| 329 |
+
'/mweb/v1/get_upload_image_proof',
|
| 330 |
+
refreshToken,
|
| 331 |
+
{
|
| 332 |
+
data: {
|
| 333 |
+
scene: isVideoImage ? 'video_cover' : 'aigc_image',
|
| 334 |
+
file_name: filename,
|
| 335 |
+
file_size: fileData.length,
|
| 336 |
+
}
|
| 337 |
+
}
|
| 338 |
+
);
|
| 339 |
+
|
| 340 |
+
if (!proofResult || !proofResult.proof_info) {
|
| 341 |
+
logger.error(`获取上传凭证失败: ${JSON.stringify(proofResult)}`);
|
| 342 |
+
throw new APIException(EX.API_REQUEST_FAILED, '获取上传凭证失败');
|
| 343 |
+
}
|
| 344 |
+
|
| 345 |
+
logger.info(`获取上传凭证成功`);
|
| 346 |
+
|
| 347 |
+
// 上传文件
|
| 348 |
+
const { proof_info } = proofResult;
|
| 349 |
+
logger.info(`开始上传文件到: ${uploadProofUrl}`);
|
| 350 |
+
|
| 351 |
+
const uploadResult = await axios.post(
|
| 352 |
+
uploadProofUrl,
|
| 353 |
+
formData,
|
| 354 |
+
{
|
| 355 |
+
headers: {
|
| 356 |
+
...proof_info.headers,
|
| 357 |
+
'Content-Type': 'multipart/form-data',
|
| 358 |
+
},
|
| 359 |
+
params: proof_info.query_params,
|
| 360 |
+
timeout: 60000,
|
| 361 |
+
validateStatus: () => true, // 允许任何状态码以便详细处理
|
| 362 |
+
}
|
| 363 |
+
);
|
| 364 |
+
|
| 365 |
+
logger.info(`上传响应状态: ${uploadResult.status}`);
|
| 366 |
+
|
| 367 |
+
if (!uploadResult || uploadResult.status !== 200) {
|
| 368 |
+
logger.error(`上传文件失败: 状态码 ${uploadResult?.status}, 响应: ${JSON.stringify(uploadResult?.data)}`);
|
| 369 |
+
throw new APIException(EX.API_REQUEST_FAILED, `上传文件失败: 状态码 ${uploadResult?.status}`);
|
| 370 |
+
}
|
| 371 |
+
|
| 372 |
+
// 验证 proof_info.image_uri 是否存在
|
| 373 |
+
if (!proof_info.image_uri) {
|
| 374 |
+
logger.error(`上传凭证中缺少 image_uri: ${JSON.stringify(proof_info)}`);
|
| 375 |
+
throw new APIException(EX.API_REQUEST_FAILED, '上传凭证中缺少 image_uri');
|
| 376 |
+
}
|
| 377 |
+
|
| 378 |
+
logger.info(`文件上传成功: ${proof_info.image_uri}`);
|
| 379 |
+
|
| 380 |
+
// 返回上传结果
|
| 381 |
+
return {
|
| 382 |
+
image_uri: proof_info.image_uri,
|
| 383 |
+
uri: proof_info.image_uri,
|
| 384 |
+
}
|
| 385 |
+
} catch (error) {
|
| 386 |
+
logger.error(`文件上传过程中发生错误: ${error.message}`);
|
| 387 |
+
throw error;
|
| 388 |
+
}
|
| 389 |
+
}
|
| 390 |
+
|
| 391 |
+
/**
|
| 392 |
+
* 检查请求结果
|
| 393 |
+
*
|
| 394 |
+
* @param result 结果
|
| 395 |
+
*/
|
| 396 |
+
export function checkResult(result: AxiosResponse) {
|
| 397 |
+
const { ret, errmsg, data } = result.data;
|
| 398 |
+
if (!_.isFinite(Number(ret))) return result.data;
|
| 399 |
+
if (ret === '0') return data;
|
| 400 |
+
if (ret === '5000')
|
| 401 |
+
throw new APIException(EX.API_IMAGE_GENERATION_INSUFFICIENT_POINTS, `[无法生成图像]: 即梦积分可能不足,${errmsg}`);
|
| 402 |
+
throw new APIException(EX.API_REQUEST_FAILED, `[请求jimeng失败]: ${errmsg}`);
|
| 403 |
+
}
|
| 404 |
+
|
| 405 |
+
/**
|
| 406 |
+
* Token切分
|
| 407 |
+
*
|
| 408 |
+
* @param authorization 认证字符串
|
| 409 |
+
*/
|
| 410 |
+
export function tokenSplit(authorization: string) {
|
| 411 |
+
return authorization.replace("Bearer ", "").split(",");
|
| 412 |
+
}
|
| 413 |
+
|
| 414 |
+
/**
|
| 415 |
+
* 获取Token存活状态
|
| 416 |
+
*/
|
| 417 |
+
export async function getTokenLiveStatus(refreshToken: string) {
|
| 418 |
+
const result = await request(
|
| 419 |
+
"POST",
|
| 420 |
+
"/passport/account/info/v2",
|
| 421 |
+
refreshToken,
|
| 422 |
+
{
|
| 423 |
+
params: {
|
| 424 |
+
account_sdk_source: "web",
|
| 425 |
+
},
|
| 426 |
+
}
|
| 427 |
+
);
|
| 428 |
+
try {
|
| 429 |
+
const { user_id } = checkResult(result);
|
| 430 |
+
return !!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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import _ from "lodash";
|
| 2 |
+
import crypto from "crypto";
|
| 3 |
+
|
| 4 |
+
import APIException from "@/lib/exceptions/APIException.ts";
|
| 5 |
+
import EX from "@/api/consts/exceptions.ts";
|
| 6 |
+
import util from "@/lib/util.ts";
|
| 7 |
+
import { getCredit, receiveCredit, request } from "./core.ts";
|
| 8 |
+
import logger from "@/lib/logger.ts";
|
| 9 |
+
|
| 10 |
+
const DEFAULT_ASSISTANT_ID = "513695";
|
| 11 |
+
export const DEFAULT_MODEL = "jimeng-4.0";
|
| 12 |
+
const DRAFT_VERSION = "3.0.2";
|
| 13 |
+
const MODEL_MAP = {
|
| 14 |
+
"jimeng-4.0": "high_aes_general_v40",
|
| 15 |
+
"jimeng-3.1": "high_aes_general_v30l_art_fangzhou:general_v3.0_18b",
|
| 16 |
+
"jimeng-3.0": "high_aes_general_v30l:general_v3.0_18b",
|
| 17 |
+
"jimeng-2.1": "high_aes_general_v21_L:general_v2.1_L",
|
| 18 |
+
"jimeng-2.0-pro": "high_aes_general_v20_L:general_v2.0_L",
|
| 19 |
+
"jimeng-2.0": "high_aes_general_v20:general_v2.0",
|
| 20 |
+
"jimeng-1.4": "high_aes_general_v14:general_v1.4",
|
| 21 |
+
"jimeng-xl-pro": "text2img_xl_sft",
|
| 22 |
+
};
|
| 23 |
+
|
| 24 |
+
export function getModel(model: string) {
|
| 25 |
+
return MODEL_MAP[model] || MODEL_MAP[DEFAULT_MODEL];
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
// AWS4-HMAC-SHA256 签名生成函数
|
| 30 |
+
function createSignature(
|
| 31 |
+
method: string,
|
| 32 |
+
url: string,
|
| 33 |
+
headers: { [key: string]: string },
|
| 34 |
+
accessKeyId: string,
|
| 35 |
+
secretAccessKey: string,
|
| 36 |
+
sessionToken?: string,
|
| 37 |
+
payload: string = ''
|
| 38 |
+
) {
|
| 39 |
+
const urlObj = new URL(url);
|
| 40 |
+
const pathname = urlObj.pathname || '/';
|
| 41 |
+
const search = urlObj.search;
|
| 42 |
+
|
| 43 |
+
// 创建规范请求
|
| 44 |
+
const timestamp = headers['x-amz-date'];
|
| 45 |
+
const date = timestamp.substr(0, 8);
|
| 46 |
+
const region = 'cn-north-1';
|
| 47 |
+
const service = 'imagex';
|
| 48 |
+
|
| 49 |
+
// 规范化查询参数 - 手动处理以确保正确的顺序
|
| 50 |
+
const queryParams: Array<[string, string]> = [];
|
| 51 |
+
const searchParams = new URLSearchParams(search);
|
| 52 |
+
searchParams.forEach((value, key) => {
|
| 53 |
+
queryParams.push([key, value]);
|
| 54 |
+
});
|
| 55 |
+
|
| 56 |
+
// 按键名排序 - 大小写敏感,先大写字母,后小写字母
|
| 57 |
+
queryParams.sort(([a], [b]) => {
|
| 58 |
+
// AWS要求大小写敏感的ASCII排序
|
| 59 |
+
if (a < b) return -1;
|
| 60 |
+
if (a > b) return 1;
|
| 61 |
+
return 0;
|
| 62 |
+
});
|
| 63 |
+
|
| 64 |
+
// 构建规范查询字符串(不进行额外编码,因为URL中已经编码)
|
| 65 |
+
const canonicalQueryString = queryParams
|
| 66 |
+
.map(([key, value]) => `${key}=${value}`)
|
| 67 |
+
.join('&');
|
| 68 |
+
|
| 69 |
+
// 规范化头部 - 只包含必要的头部
|
| 70 |
+
const headersToSign: { [key: string]: string } = {
|
| 71 |
+
'x-amz-date': timestamp
|
| 72 |
+
};
|
| 73 |
+
|
| 74 |
+
// 添加 session token
|
| 75 |
+
if (sessionToken) {
|
| 76 |
+
headersToSign['x-amz-security-token'] = sessionToken;
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
// 如果是POST请求且包含payload,添加content-sha256头
|
| 80 |
+
let payloadHash = crypto.createHash('sha256').update('').digest('hex'); // 默认空payload
|
| 81 |
+
if (method.toUpperCase() === 'POST' && payload) {
|
| 82 |
+
payloadHash = crypto.createHash('sha256').update(payload, 'utf8').digest('hex');
|
| 83 |
+
headersToSign['x-amz-content-sha256'] = payloadHash;
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
const signedHeaders = Object.keys(headersToSign)
|
| 87 |
+
.map(key => key.toLowerCase())
|
| 88 |
+
.sort()
|
| 89 |
+
.join(';');
|
| 90 |
+
|
| 91 |
+
const canonicalHeaders = Object.keys(headersToSign)
|
| 92 |
+
.sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase()))
|
| 93 |
+
.map(key => `${key.toLowerCase()}:${headersToSign[key].trim()}\n`)
|
| 94 |
+
.join('');
|
| 95 |
+
|
| 96 |
+
// 创建规范请求
|
| 97 |
+
const canonicalRequest = [
|
| 98 |
+
method.toUpperCase(),
|
| 99 |
+
pathname,
|
| 100 |
+
canonicalQueryString,
|
| 101 |
+
canonicalHeaders,
|
| 102 |
+
signedHeaders,
|
| 103 |
+
payloadHash
|
| 104 |
+
].join('\n');
|
| 105 |
+
|
| 106 |
+
// 调试输出
|
| 107 |
+
logger.debug(`规范请求:
|
| 108 |
+
Method: ${method.toUpperCase()}
|
| 109 |
+
Path: ${pathname}
|
| 110 |
+
Query: ${canonicalQueryString}
|
| 111 |
+
Headers: ${canonicalHeaders}
|
| 112 |
+
SignedHeaders: ${signedHeaders}
|
| 113 |
+
PayloadHash: ${payloadHash}
|
| 114 |
+
---完整规范请求---
|
| 115 |
+
${canonicalRequest}
|
| 116 |
+
---结束---`);
|
| 117 |
+
|
| 118 |
+
// 创建待签名字符串
|
| 119 |
+
const credentialScope = `${date}/${region}/${service}/aws4_request`;
|
| 120 |
+
const stringToSign = [
|
| 121 |
+
'AWS4-HMAC-SHA256',
|
| 122 |
+
timestamp,
|
| 123 |
+
credentialScope,
|
| 124 |
+
crypto.createHash('sha256').update(canonicalRequest, 'utf8').digest('hex')
|
| 125 |
+
].join('\n');
|
| 126 |
+
|
| 127 |
+
logger.debug(`待签名字符串:
|
| 128 |
+
${stringToSign}`);
|
| 129 |
+
|
| 130 |
+
// 生成签名
|
| 131 |
+
const kDate = crypto.createHmac('sha256', `AWS4${secretAccessKey}`).update(date).digest();
|
| 132 |
+
const kRegion = crypto.createHmac('sha256', kDate).update(region).digest();
|
| 133 |
+
const kService = crypto.createHmac('sha256', kRegion).update(service).digest();
|
| 134 |
+
const kSigning = crypto.createHmac('sha256', kService).update('aws4_request').digest();
|
| 135 |
+
const signature = crypto.createHmac('sha256', kSigning).update(stringToSign, 'utf8').digest('hex');
|
| 136 |
+
|
| 137 |
+
return `AWS4-HMAC-SHA256 Credential=${accessKeyId}/${credentialScope}, SignedHeaders=${signedHeaders}, Signature=${signature}`;
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
// 计算文件的CRC32值
|
| 141 |
+
function calculateCRC32(buffer: ArrayBuffer): string {
|
| 142 |
+
const crcTable = [];
|
| 143 |
+
for (let i = 0; i < 256; i++) {
|
| 144 |
+
let crc = i;
|
| 145 |
+
for (let j = 0; j < 8; j++) {
|
| 146 |
+
crc = (crc & 1) ? (0xEDB88320 ^ (crc >>> 1)) : (crc >>> 1);
|
| 147 |
+
}
|
| 148 |
+
crcTable[i] = crc;
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
let crc = 0 ^ (-1);
|
| 152 |
+
const bytes = new Uint8Array(buffer);
|
| 153 |
+
for (let i = 0; i < bytes.length; i++) {
|
| 154 |
+
crc = (crc >>> 8) ^ crcTable[(crc ^ bytes[i]) & 0xFF];
|
| 155 |
+
}
|
| 156 |
+
return ((crc ^ (-1)) >>> 0).toString(16).padStart(8, '0');
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
// 图片上传功能:将外部图片URL上传到即梦系统
|
| 160 |
+
async function uploadImageFromUrl(imageUrl: string, refreshToken: string): Promise<string> {
|
| 161 |
+
try {
|
| 162 |
+
logger.info(`开始上传图片: ${imageUrl}`);
|
| 163 |
+
|
| 164 |
+
// 第一步:获取上传令牌
|
| 165 |
+
const tokenResult = await request("post", "/mweb/v1/get_upload_token", refreshToken, {
|
| 166 |
+
data: {
|
| 167 |
+
scene: 2, // AIGC 图片上传场景
|
| 168 |
+
},
|
| 169 |
+
});
|
| 170 |
+
|
| 171 |
+
const { access_key_id, secret_access_key, session_token, service_id } = tokenResult;
|
| 172 |
+
if (!access_key_id || !secret_access_key || !session_token) {
|
| 173 |
+
throw new Error("获取上传令牌失败");
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
// 使用固定的service_id
|
| 177 |
+
const actualServiceId = service_id || "tb4s082cfz";
|
| 178 |
+
|
| 179 |
+
logger.info(`获取上传令牌成功: service_id=${actualServiceId}`);
|
| 180 |
+
|
| 181 |
+
// 下载图片数据
|
| 182 |
+
const imageResponse = await fetch(imageUrl);
|
| 183 |
+
if (!imageResponse.ok) {
|
| 184 |
+
throw new Error(`下载图片失败: ${imageResponse.status}`);
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
const imageBuffer = await imageResponse.arrayBuffer();
|
| 188 |
+
const fileSize = imageBuffer.byteLength;
|
| 189 |
+
const crc32 = calculateCRC32(imageBuffer);
|
| 190 |
+
|
| 191 |
+
logger.info(`图片下载完成: 大小=${fileSize}字节, CRC32=${crc32}`);
|
| 192 |
+
|
| 193 |
+
// 第二步:申请图片上传权限
|
| 194 |
+
// 使用UTC时间格式 YYYYMMDD'T'HHMMSS'Z'
|
| 195 |
+
const now = new Date();
|
| 196 |
+
const timestamp = now.toISOString().replace(/[:\-]/g, '').replace(/\.\d{3}Z$/, 'Z');
|
| 197 |
+
|
| 198 |
+
// 生成随机字符串作为签名参数
|
| 199 |
+
const randomStr = Math.random().toString(36).substring(2, 12);
|
| 200 |
+
// 保持原始的参数顺序(这是API期望的顺序)
|
| 201 |
+
const applyUrl = `https://imagex.bytedanceapi.com/?Action=ApplyImageUpload&Version=2018-08-01&ServiceId=${actualServiceId}&FileSize=${fileSize}&s=${randomStr}`;
|
| 202 |
+
|
| 203 |
+
logger.debug(`原始URL: ${applyUrl}`);
|
| 204 |
+
|
| 205 |
+
// 构建AWS签名所需的头部
|
| 206 |
+
const requestHeaders = {
|
| 207 |
+
'x-amz-date': timestamp,
|
| 208 |
+
'x-amz-security-token': session_token
|
| 209 |
+
};
|
| 210 |
+
|
| 211 |
+
// 生成AWS签名
|
| 212 |
+
const authorization = createSignature('GET', applyUrl, requestHeaders, access_key_id, secret_access_key, session_token);
|
| 213 |
+
|
| 214 |
+
// 调试日志
|
| 215 |
+
logger.info(`AWS签名调试信息:
|
| 216 |
+
URL: ${applyUrl}
|
| 217 |
+
AccessKeyId: ${access_key_id}
|
| 218 |
+
SessionToken: ${session_token ? '存在' : '不存在'}
|
| 219 |
+
Timestamp: ${timestamp}
|
| 220 |
+
Authorization: ${authorization}
|
| 221 |
+
`);
|
| 222 |
+
|
| 223 |
+
const applyResponse = await fetch(applyUrl, {
|
| 224 |
+
method: 'GET',
|
| 225 |
+
headers: {
|
| 226 |
+
'accept': '*/*',
|
| 227 |
+
'accept-language': 'zh-CN,zh;q=0.9',
|
| 228 |
+
'authorization': authorization,
|
| 229 |
+
'origin': 'https://jimeng.jianying.com',
|
| 230 |
+
'referer': 'https://jimeng.jianying.com/ai-tool/generate',
|
| 231 |
+
'sec-ch-ua': '"Not A(Brand";v="8", "Chromium";v="132", "Google Chrome";v="132"',
|
| 232 |
+
'sec-ch-ua-mobile': '?0',
|
| 233 |
+
'sec-ch-ua-platform': '"Windows"',
|
| 234 |
+
'sec-fetch-dest': 'empty',
|
| 235 |
+
'sec-fetch-mode': 'cors',
|
| 236 |
+
'sec-fetch-site': 'cross-site',
|
| 237 |
+
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36',
|
| 238 |
+
'x-amz-date': timestamp,
|
| 239 |
+
'x-amz-security-token': session_token,
|
| 240 |
+
},
|
| 241 |
+
});
|
| 242 |
+
|
| 243 |
+
if (!applyResponse.ok) {
|
| 244 |
+
const errorText = await applyResponse.text();
|
| 245 |
+
throw new Error(`申请上传权限失败: ${applyResponse.status} - ${errorText}`);
|
| 246 |
+
}
|
| 247 |
+
|
| 248 |
+
const applyResult = await applyResponse.json();
|
| 249 |
+
|
| 250 |
+
// 检查是否有错误
|
| 251 |
+
if (applyResult?.ResponseMetadata?.Error) {
|
| 252 |
+
throw new Error(`申请上传权限失败: ${JSON.stringify(applyResult.ResponseMetadata.Error)}`);
|
| 253 |
+
}
|
| 254 |
+
|
| 255 |
+
logger.info(`申请上传权限成功`);
|
| 256 |
+
|
| 257 |
+
// 解析上传信息
|
| 258 |
+
const uploadAddress = applyResult?.Result?.UploadAddress;
|
| 259 |
+
if (!uploadAddress || !uploadAddress.StoreInfos || !uploadAddress.UploadHosts) {
|
| 260 |
+
throw new Error(`获取上传地址失败: ${JSON.stringify(applyResult)}`);
|
| 261 |
+
}
|
| 262 |
+
|
| 263 |
+
const storeInfo = uploadAddress.StoreInfos[0];
|
| 264 |
+
const uploadHost = uploadAddress.UploadHosts[0];
|
| 265 |
+
const auth = storeInfo.Auth;
|
| 266 |
+
|
| 267 |
+
// 构建上传URL
|
| 268 |
+
const uploadUrl = `https://${uploadHost}/upload/v1/${storeInfo.StoreUri}`;
|
| 269 |
+
|
| 270 |
+
// 提取图片ID (StoreUri最后一个斜杠后的部分)
|
| 271 |
+
const imageId = storeInfo.StoreUri.split('/').pop();
|
| 272 |
+
|
| 273 |
+
logger.info(`准备上传图片: imageId=${imageId}, uploadUrl=${uploadUrl}`);
|
| 274 |
+
|
| 275 |
+
// 第三步:上传图片文件
|
| 276 |
+
const uploadResponse = await fetch(uploadUrl, {
|
| 277 |
+
method: 'POST',
|
| 278 |
+
headers: {
|
| 279 |
+
'Accept': '*/*',
|
| 280 |
+
'Accept-Language': 'zh-CN,zh;q=0.9',
|
| 281 |
+
'Authorization': auth,
|
| 282 |
+
'Connection': 'keep-alive',
|
| 283 |
+
'Content-CRC32': crc32,
|
| 284 |
+
'Content-Disposition': 'attachment; filename="undefined"',
|
| 285 |
+
'Content-Type': 'application/octet-stream',
|
| 286 |
+
'Origin': 'https://jimeng.jianying.com',
|
| 287 |
+
'Referer': 'https://jimeng.jianying.com/ai-tool/generate',
|
| 288 |
+
'Sec-Fetch-Dest': 'empty',
|
| 289 |
+
'Sec-Fetch-Mode': 'cors',
|
| 290 |
+
'Sec-Fetch-Site': 'cross-site',
|
| 291 |
+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36',
|
| 292 |
+
'X-Storage-U': '704135154117550', // 用户ID,可以从token或其他地方获取
|
| 293 |
+
},
|
| 294 |
+
body: imageBuffer,
|
| 295 |
+
});
|
| 296 |
+
|
| 297 |
+
if (!uploadResponse.ok) {
|
| 298 |
+
const errorText = await uploadResponse.text();
|
| 299 |
+
throw new Error(`图片上传失败: ${uploadResponse.status} - ${errorText}`);
|
| 300 |
+
}
|
| 301 |
+
|
| 302 |
+
logger.info(`图片文件上传成功`);
|
| 303 |
+
|
| 304 |
+
// 第四步:提交上传
|
| 305 |
+
const commitUrl = `https://imagex.bytedanceapi.com/?Action=CommitImageUpload&Version=2018-08-01&ServiceId=${actualServiceId}`;
|
| 306 |
+
|
| 307 |
+
const commitTimestamp = new Date().toISOString().replace(/[:\-]/g, '').replace(/\.\d{3}Z$/, 'Z');
|
| 308 |
+
const commitPayload = JSON.stringify({
|
| 309 |
+
SessionKey: uploadAddress.SessionKey,
|
| 310 |
+
SuccessActionStatus: "200"
|
| 311 |
+
});
|
| 312 |
+
|
| 313 |
+
// 计算payload的SHA256哈希值
|
| 314 |
+
const payloadHash = crypto.createHash('sha256').update(commitPayload, 'utf8').digest('hex');
|
| 315 |
+
|
| 316 |
+
// 构建AWS签名所需的头部
|
| 317 |
+
const commitRequestHeaders = {
|
| 318 |
+
'x-amz-date': commitTimestamp,
|
| 319 |
+
'x-amz-security-token': session_token,
|
| 320 |
+
'x-amz-content-sha256': payloadHash
|
| 321 |
+
};
|
| 322 |
+
|
| 323 |
+
// 生成AWS签名
|
| 324 |
+
const commitAuthorization = createSignature('POST', commitUrl, commitRequestHeaders, access_key_id, secret_access_key, session_token, commitPayload);
|
| 325 |
+
|
| 326 |
+
const commitResponse = await fetch(commitUrl, {
|
| 327 |
+
method: 'POST',
|
| 328 |
+
headers: {
|
| 329 |
+
'accept': '*/*',
|
| 330 |
+
'accept-language': 'zh-CN,zh;q=0.9',
|
| 331 |
+
'authorization': commitAuthorization,
|
| 332 |
+
'content-type': 'application/json',
|
| 333 |
+
'origin': 'https://jimeng.jianying.com',
|
| 334 |
+
'referer': 'https://jimeng.jianying.com/ai-tool/generate',
|
| 335 |
+
'sec-ch-ua': '"Not A(Brand";v="8", "Chromium";v="132", "Google Chrome";v="132"',
|
| 336 |
+
'sec-ch-ua-mobile': '?0',
|
| 337 |
+
'sec-ch-ua-platform': '"Windows"',
|
| 338 |
+
'sec-fetch-dest': 'empty',
|
| 339 |
+
'sec-fetch-mode': 'cors',
|
| 340 |
+
'sec-fetch-site': 'cross-site',
|
| 341 |
+
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36',
|
| 342 |
+
'x-amz-date': commitTimestamp,
|
| 343 |
+
'x-amz-security-token': session_token,
|
| 344 |
+
'x-amz-content-sha256': payloadHash,
|
| 345 |
+
},
|
| 346 |
+
body: commitPayload,
|
| 347 |
+
});
|
| 348 |
+
|
| 349 |
+
if (!commitResponse.ok) {
|
| 350 |
+
const errorText = await commitResponse.text();
|
| 351 |
+
throw new Error(`提交上传失败: ${commitResponse.status} - ${errorText}`);
|
| 352 |
+
}
|
| 353 |
+
|
| 354 |
+
const commitResult = await commitResponse.json();
|
| 355 |
+
|
| 356 |
+
// 检查提交结果
|
| 357 |
+
if (commitResult?.ResponseMetadata?.Error) {
|
| 358 |
+
throw new Error(`提交上传失败: ${JSON.stringify(commitResult.ResponseMetadata.Error)}`);
|
| 359 |
+
}
|
| 360 |
+
|
| 361 |
+
if (!commitResult?.Result?.Results || commitResult.Result.Results.length === 0) {
|
| 362 |
+
throw new Error(`提交上传响应缺少结果: ${JSON.stringify(commitResult)}`);
|
| 363 |
+
}
|
| 364 |
+
|
| 365 |
+
const uploadResult = commitResult.Result.Results[0];
|
| 366 |
+
if (uploadResult.UriStatus !== 2000) {
|
| 367 |
+
throw new Error(`图片上传状态异常: UriStatus=${uploadResult.UriStatus}`);
|
| 368 |
+
}
|
| 369 |
+
|
| 370 |
+
// 获取完整的URI(包含前缀)
|
| 371 |
+
const fullImageUri = uploadResult.Uri; // 如: "tos-cn-i-tb4s082cfz/bab623359bd9410da0c1f07897b16fec"
|
| 372 |
+
|
| 373 |
+
// 验证图片信息
|
| 374 |
+
const pluginResult = commitResult.Result?.PluginResult?.[0];
|
| 375 |
+
if (pluginResult) {
|
| 376 |
+
logger.info(`图片上传成功详情:`, {
|
| 377 |
+
imageUri: pluginResult.ImageUri,
|
| 378 |
+
sourceUri: pluginResult.SourceUri,
|
| 379 |
+
size: `${pluginResult.ImageWidth}x${pluginResult.ImageHeight}`,
|
| 380 |
+
format: pluginResult.ImageFormat,
|
| 381 |
+
fileSize: pluginResult.ImageSize,
|
| 382 |
+
md5: pluginResult.ImageMd5
|
| 383 |
+
});
|
| 384 |
+
|
| 385 |
+
// 优先使用PluginResult中的ImageUri,因为它可能是最准确的
|
| 386 |
+
if (pluginResult.ImageUri) {
|
| 387 |
+
logger.info(`图片上传完成: ${pluginResult.ImageUri}`);
|
| 388 |
+
return pluginResult.ImageUri; // 返回完整的URI
|
| 389 |
+
}
|
| 390 |
+
}
|
| 391 |
+
|
| 392 |
+
logger.info(`图片上传完成: ${fullImageUri}`);
|
| 393 |
+
return fullImageUri; // 返回完整的URI
|
| 394 |
+
|
| 395 |
+
} catch (error) {
|
| 396 |
+
logger.error(`图片上传失败: ${error.message}`);
|
| 397 |
+
throw error;
|
| 398 |
+
}
|
| 399 |
+
}
|
| 400 |
+
|
| 401 |
+
// 图片合成功能:先上传图片,然后进行图生图
|
| 402 |
+
export async function generateImageComposition(
|
| 403 |
+
_model: string,
|
| 404 |
+
prompt: string,
|
| 405 |
+
imageUrls: string[],
|
| 406 |
+
{
|
| 407 |
+
width = 2560,
|
| 408 |
+
height = 1440,
|
| 409 |
+
sampleStrength = 0.5,
|
| 410 |
+
negativePrompt = "",
|
| 411 |
+
}: {
|
| 412 |
+
width?: number;
|
| 413 |
+
height?: number;
|
| 414 |
+
sampleStrength?: number;
|
| 415 |
+
negativePrompt?: string;
|
| 416 |
+
},
|
| 417 |
+
refreshToken: string
|
| 418 |
+
) {
|
| 419 |
+
const model = getModel(_model);
|
| 420 |
+
const imageCount = imageUrls.length;
|
| 421 |
+
logger.info(`使用模型: ${_model} 映射模型: ${model} 图生图功能 ${imageCount}张图片 ${width}x${height} 精细度: ${sampleStrength}`);
|
| 422 |
+
|
| 423 |
+
const { totalCredit } = await getCredit(refreshToken);
|
| 424 |
+
if (totalCredit <= 0)
|
| 425 |
+
await receiveCredit(refreshToken);
|
| 426 |
+
|
| 427 |
+
// 上传所有输入图片
|
| 428 |
+
const uploadedImageIds: string[] = [];
|
| 429 |
+
for (let i = 0; i < imageUrls.length; i++) {
|
| 430 |
+
try {
|
| 431 |
+
const imageId = await uploadImageFromUrl(imageUrls[i], refreshToken);
|
| 432 |
+
uploadedImageIds.push(imageId);
|
| 433 |
+
logger.info(`图片 ${i + 1}/${imageCount} 上传成功: ${imageId}`);
|
| 434 |
+
} catch (error) {
|
| 435 |
+
logger.error(`图片 ${i + 1}/${imageCount} 上传失败: ${error.message}`);
|
| 436 |
+
throw new APIException(EX.API_IMAGE_GENERATION_FAILED, `图片上传失败: ${error.message}`);
|
| 437 |
+
}
|
| 438 |
+
}
|
| 439 |
+
|
| 440 |
+
logger.info(`所有图片上传完成,开始图生图: ${uploadedImageIds.join(', ')}`);
|
| 441 |
+
|
| 442 |
+
const componentId = util.uuid();
|
| 443 |
+
const submitId = util.uuid();
|
| 444 |
+
const { aigc_data } = await request(
|
| 445 |
+
"post",
|
| 446 |
+
"/mweb/v1/aigc_draft/generate",
|
| 447 |
+
refreshToken,
|
| 448 |
+
{
|
| 449 |
+
params: {
|
| 450 |
+
babi_param: encodeURIComponent(
|
| 451 |
+
JSON.stringify({
|
| 452 |
+
scenario: "image_video_generation",
|
| 453 |
+
feature_key: "aigc_to_image",
|
| 454 |
+
feature_entrance: "to_image",
|
| 455 |
+
feature_entrance_detail: "to_image-" + model,
|
| 456 |
+
})
|
| 457 |
+
),
|
| 458 |
+
},
|
| 459 |
+
data: {
|
| 460 |
+
extend: {
|
| 461 |
+
root_model: model,
|
| 462 |
+
},
|
| 463 |
+
submit_id: submitId,
|
| 464 |
+
metrics_extra: JSON.stringify({
|
| 465 |
+
promptSource: "custom",
|
| 466 |
+
generateCount: 1,
|
| 467 |
+
enterFrom: "click",
|
| 468 |
+
generateId: submitId,
|
| 469 |
+
isRegenerate: false
|
| 470 |
+
}),
|
| 471 |
+
draft_content: JSON.stringify({
|
| 472 |
+
type: "draft",
|
| 473 |
+
id: util.uuid(),
|
| 474 |
+
min_version: "3.2.9",
|
| 475 |
+
min_features: [],
|
| 476 |
+
is_from_tsn: true,
|
| 477 |
+
version: "3.2.9",
|
| 478 |
+
main_component_id: componentId,
|
| 479 |
+
component_list: [
|
| 480 |
+
{
|
| 481 |
+
type: "image_base_component",
|
| 482 |
+
id: componentId,
|
| 483 |
+
min_version: "3.0.2",
|
| 484 |
+
aigc_mode: "workbench",
|
| 485 |
+
metadata: {
|
| 486 |
+
type: "",
|
| 487 |
+
id: util.uuid(),
|
| 488 |
+
created_platform: 3,
|
| 489 |
+
created_platform_version: "",
|
| 490 |
+
created_time_in_ms: Date.now().toString(),
|
| 491 |
+
created_did: "",
|
| 492 |
+
},
|
| 493 |
+
generate_type: "blend",
|
| 494 |
+
abilities: {
|
| 495 |
+
type: "",
|
| 496 |
+
id: util.uuid(),
|
| 497 |
+
blend: {
|
| 498 |
+
type: "",
|
| 499 |
+
id: util.uuid(),
|
| 500 |
+
min_version: "3.2.9",
|
| 501 |
+
min_features: [],
|
| 502 |
+
core_param: {
|
| 503 |
+
type: "",
|
| 504 |
+
id: util.uuid(),
|
| 505 |
+
model,
|
| 506 |
+
prompt: `####${prompt}`,
|
| 507 |
+
sample_strength: sampleStrength,
|
| 508 |
+
image_ratio: 1,
|
| 509 |
+
large_image_info: {
|
| 510 |
+
type: "",
|
| 511 |
+
id: util.uuid(),
|
| 512 |
+
height: 2048,
|
| 513 |
+
width: 2048,
|
| 514 |
+
resolution_type: "2k"
|
| 515 |
+
},
|
| 516 |
+
intelligent_ratio: false,
|
| 517 |
+
},
|
| 518 |
+
ability_list: uploadedImageIds.map((imageId) => ({
|
| 519 |
+
type: "",
|
| 520 |
+
id: util.uuid(),
|
| 521 |
+
name: "byte_edit",
|
| 522 |
+
image_uri_list: [imageId],
|
| 523 |
+
image_list: [{
|
| 524 |
+
type: "image",
|
| 525 |
+
id: util.uuid(),
|
| 526 |
+
source_from: "upload",
|
| 527 |
+
platform_type: 1,
|
| 528 |
+
name: "",
|
| 529 |
+
image_uri: imageId,
|
| 530 |
+
width: 0,
|
| 531 |
+
height: 0,
|
| 532 |
+
format: "",
|
| 533 |
+
uri: imageId
|
| 534 |
+
}],
|
| 535 |
+
strength: 0.5
|
| 536 |
+
})),
|
| 537 |
+
prompt_placeholder_info_list: uploadedImageIds.map((_, index) => ({
|
| 538 |
+
type: "",
|
| 539 |
+
id: util.uuid(),
|
| 540 |
+
ability_index: index
|
| 541 |
+
})),
|
| 542 |
+
postedit_param: {
|
| 543 |
+
type: "",
|
| 544 |
+
id: util.uuid(),
|
| 545 |
+
generate_type: 0
|
| 546 |
+
}
|
| 547 |
+
},
|
| 548 |
+
},
|
| 549 |
+
},
|
| 550 |
+
],
|
| 551 |
+
}),
|
| 552 |
+
http_common_info: {
|
| 553 |
+
aid: Number(DEFAULT_ASSISTANT_ID),
|
| 554 |
+
},
|
| 555 |
+
},
|
| 556 |
+
}
|
| 557 |
+
);
|
| 558 |
+
|
| 559 |
+
const historyId = aigc_data?.history_record_id;
|
| 560 |
+
if (!historyId)
|
| 561 |
+
throw new APIException(EX.API_IMAGE_GENERATION_FAILED, "记录ID不存在");
|
| 562 |
+
|
| 563 |
+
logger.info(`图生图任务已提交,history_id: ${historyId},等待生成完成...`);
|
| 564 |
+
|
| 565 |
+
let status = 20, failCode, item_list = [];
|
| 566 |
+
let pollCount = 0;
|
| 567 |
+
const maxPollCount = 600; // 最多轮询10分钟
|
| 568 |
+
|
| 569 |
+
while (pollCount < maxPollCount) {
|
| 570 |
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
| 571 |
+
pollCount++;
|
| 572 |
+
|
| 573 |
+
if (pollCount % 30 === 0) {
|
| 574 |
+
logger.info(`图生图进度: 第 ${pollCount} 次轮询 (history_id: ${historyId}),当前状态: ${status},已生成: ${item_list.length} 张图片...`);
|
| 575 |
+
}
|
| 576 |
+
|
| 577 |
+
const result = await request("post", "/mweb/v1/get_history_by_ids", refreshToken, {
|
| 578 |
+
data: {
|
| 579 |
+
history_ids: [historyId],
|
| 580 |
+
image_info: {
|
| 581 |
+
width: 2048,
|
| 582 |
+
height: 2048,
|
| 583 |
+
format: "webp",
|
| 584 |
+
image_scene_list: [
|
| 585 |
+
{
|
| 586 |
+
scene: "smart_crop",
|
| 587 |
+
width: 360,
|
| 588 |
+
height: 360,
|
| 589 |
+
uniq_key: "smart_crop-w:360-h:360",
|
| 590 |
+
format: "webp",
|
| 591 |
+
},
|
| 592 |
+
{
|
| 593 |
+
scene: "smart_crop",
|
| 594 |
+
width: 480,
|
| 595 |
+
height: 480,
|
| 596 |
+
uniq_key: "smart_crop-w:480-h:480",
|
| 597 |
+
format: "webp",
|
| 598 |
+
},
|
| 599 |
+
{
|
| 600 |
+
scene: "smart_crop",
|
| 601 |
+
width: 720,
|
| 602 |
+
height: 720,
|
| 603 |
+
uniq_key: "smart_crop-w:720-h:720",
|
| 604 |
+
format: "webp",
|
| 605 |
+
},
|
| 606 |
+
{
|
| 607 |
+
scene: "smart_crop",
|
| 608 |
+
width: 720,
|
| 609 |
+
height: 480,
|
| 610 |
+
uniq_key: "smart_crop-w:720-h:480",
|
| 611 |
+
format: "webp",
|
| 612 |
+
},
|
| 613 |
+
{
|
| 614 |
+
scene: "normal",
|
| 615 |
+
width: 2400,
|
| 616 |
+
height: 2400,
|
| 617 |
+
uniq_key: "2400",
|
| 618 |
+
format: "webp",
|
| 619 |
+
},
|
| 620 |
+
{
|
| 621 |
+
scene: "normal",
|
| 622 |
+
width: 1080,
|
| 623 |
+
height: 1080,
|
| 624 |
+
uniq_key: "1080",
|
| 625 |
+
format: "webp",
|
| 626 |
+
},
|
| 627 |
+
{
|
| 628 |
+
scene: "normal",
|
| 629 |
+
width: 720,
|
| 630 |
+
height: 720,
|
| 631 |
+
uniq_key: "720",
|
| 632 |
+
format: "webp",
|
| 633 |
+
},
|
| 634 |
+
{
|
| 635 |
+
scene: "normal",
|
| 636 |
+
width: 480,
|
| 637 |
+
height: 480,
|
| 638 |
+
uniq_key: "480",
|
| 639 |
+
format: "webp",
|
| 640 |
+
},
|
| 641 |
+
{
|
| 642 |
+
scene: "normal",
|
| 643 |
+
width: 360,
|
| 644 |
+
height: 360,
|
| 645 |
+
uniq_key: "360",
|
| 646 |
+
format: "webp",
|
| 647 |
+
},
|
| 648 |
+
],
|
| 649 |
+
},
|
| 650 |
+
http_common_info: {
|
| 651 |
+
aid: Number(DEFAULT_ASSISTANT_ID),
|
| 652 |
+
},
|
| 653 |
+
},
|
| 654 |
+
});
|
| 655 |
+
|
| 656 |
+
if (!result[historyId])
|
| 657 |
+
throw new APIException(EX.API_IMAGE_GENERATION_FAILED, "记录不存在");
|
| 658 |
+
|
| 659 |
+
status = result[historyId].status;
|
| 660 |
+
failCode = result[historyId].fail_code;
|
| 661 |
+
item_list = result[historyId].item_list || [];
|
| 662 |
+
|
| 663 |
+
// 检查是否已生成图片
|
| 664 |
+
if (item_list.length > 0) {
|
| 665 |
+
logger.info(`图生图完成: 状态=${status}, 已生成 ${item_list.length} 张图片`);
|
| 666 |
+
break;
|
| 667 |
+
}
|
| 668 |
+
|
| 669 |
+
// 记录详细状态
|
| 670 |
+
if (pollCount % 60 === 0) {
|
| 671 |
+
logger.info(`图生图详细状态: status=${status}, item_list.length=${item_list.length}, failCode=${failCode || 'none'}`);
|
| 672 |
+
}
|
| 673 |
+
|
| 674 |
+
// 如果状态是完成但图片数量为0,记录并继续等待
|
| 675 |
+
if (status === 10 && item_list.length === 0 && pollCount % 30 === 0) {
|
| 676 |
+
logger.info(`图生图状态已完成但无图片生成: 状态=${status}, 继续等待...`);
|
| 677 |
+
}
|
| 678 |
+
}
|
| 679 |
+
|
| 680 |
+
if (pollCount >= maxPollCount) {
|
| 681 |
+
logger.warn(`图生图超时: 轮询了 ${pollCount} 次,当前状态: ${status},已生成图片数: ${item_list.length}`);
|
| 682 |
+
}
|
| 683 |
+
|
| 684 |
+
if (status === 30) {
|
| 685 |
+
if (failCode === '2038')
|
| 686 |
+
throw new APIException(EX.API_CONTENT_FILTERED);
|
| 687 |
+
else
|
| 688 |
+
throw new APIException(EX.API_IMAGE_GENERATION_FAILED, `图生图失败,错误代码: ${failCode}`);
|
| 689 |
+
}
|
| 690 |
+
|
| 691 |
+
const resultImageUrls = item_list.map((item) => {
|
| 692 |
+
if(!item?.image?.large_images?.[0]?.image_url)
|
| 693 |
+
return item?.common_attr?.cover_url || null;
|
| 694 |
+
return item.image.large_images[0].image_url;
|
| 695 |
+
}).filter(url => url !== null);
|
| 696 |
+
|
| 697 |
+
logger.info(`图生图结果: 成功生成 ${resultImageUrls.length} 张图片`);
|
| 698 |
+
return resultImageUrls;
|
| 699 |
+
}
|
| 700 |
+
|
| 701 |
+
// jimeng-4.0 专用的多图生成函数
|
| 702 |
+
async function generateJimeng40MultiImages(
|
| 703 |
+
_model: string,
|
| 704 |
+
prompt: string,
|
| 705 |
+
{
|
| 706 |
+
width = 1024,
|
| 707 |
+
height = 1024,
|
| 708 |
+
sampleStrength = 0.5,
|
| 709 |
+
negativePrompt = "",
|
| 710 |
+
}: {
|
| 711 |
+
width?: number;
|
| 712 |
+
height?: number;
|
| 713 |
+
sampleStrength?: number;
|
| 714 |
+
negativePrompt?: string;
|
| 715 |
+
},
|
| 716 |
+
refreshToken: string
|
| 717 |
+
) {
|
| 718 |
+
const model = getModel(_model);
|
| 719 |
+
|
| 720 |
+
// 从prompt中提取图片数量,默认为4张
|
| 721 |
+
const targetImageCount = prompt.match(/(\d+)张/) ? parseInt(prompt.match(/(\d+)张/)[1]) : 4;
|
| 722 |
+
|
| 723 |
+
logger.info(`使用 jimeng-4.0 多图生成: ${targetImageCount}张图片 ${width}x${height} 精细度: ${sampleStrength}`);
|
| 724 |
+
|
| 725 |
+
const componentId = util.uuid();
|
| 726 |
+
const submitId = util.uuid(); // 生成 submit_id
|
| 727 |
+
|
| 728 |
+
const { aigc_data } = await request(
|
| 729 |
+
"post",
|
| 730 |
+
"/mweb/v1/aigc_draft/generate",
|
| 731 |
+
refreshToken,
|
| 732 |
+
{
|
| 733 |
+
params: {
|
| 734 |
+
babi_param: encodeURIComponent(
|
| 735 |
+
JSON.stringify({
|
| 736 |
+
scenario: "image_video_generation",
|
| 737 |
+
feature_key: "aigc_to_image",
|
| 738 |
+
feature_entrance: "to_image",
|
| 739 |
+
feature_entrance_detail: "to_image-" + model,
|
| 740 |
+
})
|
| 741 |
+
),
|
| 742 |
+
},
|
| 743 |
+
data: {
|
| 744 |
+
extend: {
|
| 745 |
+
root_model: model,
|
| 746 |
+
template_id: "",
|
| 747 |
+
},
|
| 748 |
+
submit_id: submitId, // 使用生成的 submit_id
|
| 749 |
+
metrics_extra: JSON.stringify({
|
| 750 |
+
templateId: "",
|
| 751 |
+
generateCount: 1,
|
| 752 |
+
promptSource: "custom",
|
| 753 |
+
templateSource: "",
|
| 754 |
+
lastRequestId: "",
|
| 755 |
+
originRequestId: "",
|
| 756 |
+
}),
|
| 757 |
+
draft_content: JSON.stringify({
|
| 758 |
+
type: "draft",
|
| 759 |
+
id: util.uuid(),
|
| 760 |
+
min_version: DRAFT_VERSION,
|
| 761 |
+
is_from_tsn: true,
|
| 762 |
+
version: DRAFT_VERSION,
|
| 763 |
+
main_component_id: componentId,
|
| 764 |
+
component_list: [
|
| 765 |
+
{
|
| 766 |
+
type: "image_base_component",
|
| 767 |
+
id: componentId,
|
| 768 |
+
min_version: DRAFT_VERSION,
|
| 769 |
+
generate_type: "generate",
|
| 770 |
+
aigc_mode: "workbench",
|
| 771 |
+
abilities: {
|
| 772 |
+
type: "",
|
| 773 |
+
id: util.uuid(),
|
| 774 |
+
generate: {
|
| 775 |
+
type: "",
|
| 776 |
+
id: util.uuid(),
|
| 777 |
+
core_param: {
|
| 778 |
+
type: "",
|
| 779 |
+
id: util.uuid(),
|
| 780 |
+
model,
|
| 781 |
+
prompt,
|
| 782 |
+
negative_prompt: negativePrompt,
|
| 783 |
+
seed: Math.floor(Math.random() * 100000000) + 2500000000,
|
| 784 |
+
sample_strength: sampleStrength,
|
| 785 |
+
image_ratio: 1,
|
| 786 |
+
large_image_info: {
|
| 787 |
+
type: "",
|
| 788 |
+
id: util.uuid(),
|
| 789 |
+
height,
|
| 790 |
+
width,
|
| 791 |
+
},
|
| 792 |
+
},
|
| 793 |
+
history_option: {
|
| 794 |
+
type: "",
|
| 795 |
+
id: util.uuid(),
|
| 796 |
+
},
|
| 797 |
+
},
|
| 798 |
+
},
|
| 799 |
+
},
|
| 800 |
+
],
|
| 801 |
+
}),
|
| 802 |
+
http_common_info: {
|
| 803 |
+
aid: Number(DEFAULT_ASSISTANT_ID),
|
| 804 |
+
},
|
| 805 |
+
},
|
| 806 |
+
}
|
| 807 |
+
);
|
| 808 |
+
|
| 809 |
+
const historyId = aigc_data?.history_record_id;
|
| 810 |
+
if (!historyId)
|
| 811 |
+
throw new APIException(EX.API_IMAGE_GENERATION_FAILED, "记录ID不存在");
|
| 812 |
+
|
| 813 |
+
logger.info(`jimeng-4.0 多图生成任务已提交,submit_id: ${submitId}, history_id: ${historyId},等待生成 ${targetImageCount} 张图片...`);
|
| 814 |
+
|
| 815 |
+
// 直接使用 history_id 轮询生成结果(增加轮询时间)
|
| 816 |
+
let status = 20, failCode, item_list = [];
|
| 817 |
+
let pollCount = 0;
|
| 818 |
+
const maxPollCount = 600; // 最多轮询10分钟(600次 * 1秒)
|
| 819 |
+
|
| 820 |
+
while (pollCount < maxPollCount) {
|
| 821 |
+
await new Promise((resolve) => setTimeout(resolve, 1000)); // 每1秒轮询一次
|
| 822 |
+
pollCount++;
|
| 823 |
+
|
| 824 |
+
if (pollCount % 30 === 0) {
|
| 825 |
+
logger.info(`jimeng-4.0 多图生成进度: 第 ${pollCount} 次轮询 (history_id: ${historyId}),当前状态: ${status},已生成: ${item_list.length}/${targetImageCount} 张图片...`);
|
| 826 |
+
}
|
| 827 |
+
|
| 828 |
+
const result = await request("post", "/mweb/v1/get_history_by_ids", refreshToken, {
|
| 829 |
+
data: {
|
| 830 |
+
history_ids: [historyId],
|
| 831 |
+
image_info: {
|
| 832 |
+
width: 2048,
|
| 833 |
+
height: 2048,
|
| 834 |
+
format: "webp",
|
| 835 |
+
image_scene_list: [
|
| 836 |
+
{
|
| 837 |
+
scene: "smart_crop",
|
| 838 |
+
width: 360,
|
| 839 |
+
height: 360,
|
| 840 |
+
uniq_key: "smart_crop-w:360-h:360",
|
| 841 |
+
format: "webp",
|
| 842 |
+
},
|
| 843 |
+
{
|
| 844 |
+
scene: "smart_crop",
|
| 845 |
+
width: 480,
|
| 846 |
+
height: 480,
|
| 847 |
+
uniq_key: "smart_crop-w:480-h:480",
|
| 848 |
+
format: "webp",
|
| 849 |
+
},
|
| 850 |
+
{
|
| 851 |
+
scene: "smart_crop",
|
| 852 |
+
width: 720,
|
| 853 |
+
height: 720,
|
| 854 |
+
uniq_key: "smart_crop-w:720-h:720",
|
| 855 |
+
format: "webp",
|
| 856 |
+
},
|
| 857 |
+
{
|
| 858 |
+
scene: "smart_crop",
|
| 859 |
+
width: 720,
|
| 860 |
+
height: 480,
|
| 861 |
+
uniq_key: "smart_crop-w:720-h:480",
|
| 862 |
+
format: "webp",
|
| 863 |
+
},
|
| 864 |
+
{
|
| 865 |
+
scene: "normal",
|
| 866 |
+
width: 2400,
|
| 867 |
+
height: 2400,
|
| 868 |
+
uniq_key: "2400",
|
| 869 |
+
format: "webp",
|
| 870 |
+
},
|
| 871 |
+
{
|
| 872 |
+
scene: "normal",
|
| 873 |
+
width: 1080,
|
| 874 |
+
height: 1080,
|
| 875 |
+
uniq_key: "1080",
|
| 876 |
+
format: "webp",
|
| 877 |
+
},
|
| 878 |
+
{
|
| 879 |
+
scene: "normal",
|
| 880 |
+
width: 720,
|
| 881 |
+
height: 720,
|
| 882 |
+
uniq_key: "720",
|
| 883 |
+
format: "webp",
|
| 884 |
+
},
|
| 885 |
+
{
|
| 886 |
+
scene: "normal",
|
| 887 |
+
width: 480,
|
| 888 |
+
height: 480,
|
| 889 |
+
uniq_key: "480",
|
| 890 |
+
format: "webp",
|
| 891 |
+
},
|
| 892 |
+
{
|
| 893 |
+
scene: "normal",
|
| 894 |
+
width: 360,
|
| 895 |
+
height: 360,
|
| 896 |
+
uniq_key: "360",
|
| 897 |
+
format: "webp",
|
| 898 |
+
},
|
| 899 |
+
],
|
| 900 |
+
},
|
| 901 |
+
http_common_info: {
|
| 902 |
+
aid: Number(DEFAULT_ASSISTANT_ID),
|
| 903 |
+
},
|
| 904 |
+
},
|
| 905 |
+
});
|
| 906 |
+
|
| 907 |
+
if (!result[historyId])
|
| 908 |
+
throw new APIException(EX.API_IMAGE_GENERATION_FAILED, "记录不存在");
|
| 909 |
+
|
| 910 |
+
status = result[historyId].status;
|
| 911 |
+
failCode = result[historyId].fail_code;
|
| 912 |
+
item_list = result[historyId].item_list || [];
|
| 913 |
+
|
| 914 |
+
// 检查是否已生成足够的图片
|
| 915 |
+
if (item_list.length >= targetImageCount) {
|
| 916 |
+
logger.info(`jimeng-4.0 多图生成完成: 状态=${status}, 已生成 ${item_list.length} 张图片`);
|
| 917 |
+
break;
|
| 918 |
+
}
|
| 919 |
+
|
| 920 |
+
// 记录详细状态
|
| 921 |
+
if (pollCount % 60 === 0) {
|
| 922 |
+
logger.info(`jimeng-4.0 详细状态: status=${status}, item_list.length=${item_list.length}, failCode=${failCode || 'none'}`);
|
| 923 |
+
}
|
| 924 |
+
|
| 925 |
+
// 如果状态是完成但图片数量不够,记录并继续等待
|
| 926 |
+
if (status === 10 && item_list.length < targetImageCount && pollCount % 30 === 0) {
|
| 927 |
+
logger.info(`jimeng-4.0 状态已完成但图片数量不足: 状态=${status}, 已生成 ${item_list.length}/${targetImageCount} 张图片,继续等待...`);
|
| 928 |
+
}
|
| 929 |
+
}
|
| 930 |
+
|
| 931 |
+
if (pollCount >= maxPollCount) {
|
| 932 |
+
logger.warn(`jimeng-4.0 多图生成超时: 轮询了 ${pollCount} 次,当前状态: ${status},已生成图片数: ${item_list.length}`);
|
| 933 |
+
}
|
| 934 |
+
|
| 935 |
+
if (status === 30) {
|
| 936 |
+
if (failCode === '2038')
|
| 937 |
+
throw new APIException(EX.API_CONTENT_FILTERED);
|
| 938 |
+
else
|
| 939 |
+
throw new APIException(EX.API_IMAGE_GENERATION_FAILED, `生成失败,错误代码: ${failCode}`);
|
| 940 |
+
}
|
| 941 |
+
|
| 942 |
+
const imageUrls = item_list.map((item) => {
|
| 943 |
+
if(!item?.image?.large_images?.[0]?.image_url)
|
| 944 |
+
return item?.common_attr?.cover_url || null;
|
| 945 |
+
return item.image.large_images[0].image_url;
|
| 946 |
+
}).filter(url => url !== null);
|
| 947 |
+
|
| 948 |
+
logger.info(`jimeng-4.0 多图生成结果: 成功生成 ${imageUrls.length} 张图片`);
|
| 949 |
+
return imageUrls;
|
| 950 |
+
}
|
| 951 |
+
|
| 952 |
+
export async function generateImages(
|
| 953 |
+
_model: string,
|
| 954 |
+
prompt: string,
|
| 955 |
+
{
|
| 956 |
+
width = 1024,
|
| 957 |
+
height = 1024,
|
| 958 |
+
sampleStrength = 0.5,
|
| 959 |
+
negativePrompt = "",
|
| 960 |
+
}: {
|
| 961 |
+
width?: number;
|
| 962 |
+
height?: number;
|
| 963 |
+
sampleStrength?: number;
|
| 964 |
+
negativePrompt?: string;
|
| 965 |
+
},
|
| 966 |
+
refreshToken: string
|
| 967 |
+
) {
|
| 968 |
+
const model = getModel(_model);
|
| 969 |
+
logger.info(`使用模型: ${_model} 映射模型: ${model} ${width}x${height} 精细度: ${sampleStrength}`);
|
| 970 |
+
|
| 971 |
+
const { totalCredit } = await getCredit(refreshToken);
|
| 972 |
+
if (totalCredit <= 0)
|
| 973 |
+
await receiveCredit(refreshToken);
|
| 974 |
+
|
| 975 |
+
// 检测是否为 jimeng-4.0 的多图生成请求
|
| 976 |
+
const isJimeng40MultiImage = _model === "jimeng-4.0" && (
|
| 977 |
+
prompt.includes("连续") ||
|
| 978 |
+
prompt.includes("绘本") ||
|
| 979 |
+
prompt.includes("故事") ||
|
| 980 |
+
/\d+张/.test(prompt)
|
| 981 |
+
);
|
| 982 |
+
|
| 983 |
+
// 如果是 jimeng-4.0 的多图请求,使用专门的处理逻辑
|
| 984 |
+
if (isJimeng40MultiImage) {
|
| 985 |
+
return await generateJimeng40MultiImages(_model, prompt, { width, height, sampleStrength, negativePrompt }, refreshToken);
|
| 986 |
+
}
|
| 987 |
+
|
| 988 |
+
const componentId = util.uuid();
|
| 989 |
+
const { aigc_data } = await request(
|
| 990 |
+
"post",
|
| 991 |
+
"/mweb/v1/aigc_draft/generate",
|
| 992 |
+
refreshToken,
|
| 993 |
+
{
|
| 994 |
+
params: {
|
| 995 |
+
babi_param: encodeURIComponent(
|
| 996 |
+
JSON.stringify({
|
| 997 |
+
scenario: "image_video_generation",
|
| 998 |
+
feature_key: "aigc_to_image",
|
| 999 |
+
feature_entrance: "to_image",
|
| 1000 |
+
feature_entrance_detail: "to_image-" + model,
|
| 1001 |
+
})
|
| 1002 |
+
),
|
| 1003 |
+
},
|
| 1004 |
+
data: {
|
| 1005 |
+
extend: {
|
| 1006 |
+
root_model: model,
|
| 1007 |
+
template_id: "",
|
| 1008 |
+
},
|
| 1009 |
+
submit_id: util.uuid(),
|
| 1010 |
+
metrics_extra: JSON.stringify({
|
| 1011 |
+
templateId: "",
|
| 1012 |
+
generateCount: 1,
|
| 1013 |
+
promptSource: "custom",
|
| 1014 |
+
templateSource: "",
|
| 1015 |
+
lastRequestId: "",
|
| 1016 |
+
originRequestId: "",
|
| 1017 |
+
}),
|
| 1018 |
+
draft_content: JSON.stringify({
|
| 1019 |
+
type: "draft",
|
| 1020 |
+
id: util.uuid(),
|
| 1021 |
+
min_version: DRAFT_VERSION,
|
| 1022 |
+
is_from_tsn: true,
|
| 1023 |
+
version: DRAFT_VERSION,
|
| 1024 |
+
main_component_id: componentId,
|
| 1025 |
+
component_list: [
|
| 1026 |
+
{
|
| 1027 |
+
type: "image_base_component",
|
| 1028 |
+
id: componentId,
|
| 1029 |
+
min_version: DRAFT_VERSION,
|
| 1030 |
+
generate_type: "generate",
|
| 1031 |
+
aigc_mode: "workbench",
|
| 1032 |
+
abilities: {
|
| 1033 |
+
type: "",
|
| 1034 |
+
id: util.uuid(),
|
| 1035 |
+
generate: {
|
| 1036 |
+
type: "",
|
| 1037 |
+
id: util.uuid(),
|
| 1038 |
+
core_param: {
|
| 1039 |
+
type: "",
|
| 1040 |
+
id: util.uuid(),
|
| 1041 |
+
model,
|
| 1042 |
+
prompt,
|
| 1043 |
+
negative_prompt: negativePrompt,
|
| 1044 |
+
seed: Math.floor(Math.random() * 100000000) + 2500000000,
|
| 1045 |
+
sample_strength: sampleStrength,
|
| 1046 |
+
image_ratio: 1,
|
| 1047 |
+
large_image_info: {
|
| 1048 |
+
type: "",
|
| 1049 |
+
id: util.uuid(),
|
| 1050 |
+
height,
|
| 1051 |
+
width,
|
| 1052 |
+
},
|
| 1053 |
+
},
|
| 1054 |
+
history_option: {
|
| 1055 |
+
type: "",
|
| 1056 |
+
id: util.uuid(),
|
| 1057 |
+
},
|
| 1058 |
+
},
|
| 1059 |
+
},
|
| 1060 |
+
},
|
| 1061 |
+
],
|
| 1062 |
+
}),
|
| 1063 |
+
http_common_info: {
|
| 1064 |
+
aid: Number(DEFAULT_ASSISTANT_ID),
|
| 1065 |
+
},
|
| 1066 |
+
},
|
| 1067 |
+
}
|
| 1068 |
+
);
|
| 1069 |
+
const historyId = aigc_data.history_record_id;
|
| 1070 |
+
if (!historyId)
|
| 1071 |
+
throw new APIException(EX.API_IMAGE_GENERATION_FAILED, "记录ID不存在");
|
| 1072 |
+
|
| 1073 |
+
logger.info(`文生图任务已提交,history_id: ${historyId},等待生成完成...`);
|
| 1074 |
+
|
| 1075 |
+
let status = 20, failCode, item_list = [];
|
| 1076 |
+
let pollCount = 0;
|
| 1077 |
+
const maxPollCount = 600; // 最多轮询10分钟
|
| 1078 |
+
|
| 1079 |
+
while (pollCount < maxPollCount) {
|
| 1080 |
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
| 1081 |
+
pollCount++;
|
| 1082 |
+
|
| 1083 |
+
if (pollCount % 30 === 0) {
|
| 1084 |
+
logger.info(`文生图进度: 第 ${pollCount} 次轮询 (history_id: ${historyId}),当前状态: ${status},已生成: ${item_list.length} 张图片...`);
|
| 1085 |
+
}
|
| 1086 |
+
|
| 1087 |
+
const result = await request("post", "/mweb/v1/get_history_by_ids", refreshToken, {
|
| 1088 |
+
data: {
|
| 1089 |
+
history_ids: [historyId],
|
| 1090 |
+
image_info: {
|
| 1091 |
+
width: 2048,
|
| 1092 |
+
height: 2048,
|
| 1093 |
+
format: "webp",
|
| 1094 |
+
image_scene_list: [
|
| 1095 |
+
{
|
| 1096 |
+
scene: "smart_crop",
|
| 1097 |
+
width: 360,
|
| 1098 |
+
height: 360,
|
| 1099 |
+
uniq_key: "smart_crop-w:360-h:360",
|
| 1100 |
+
format: "webp",
|
| 1101 |
+
},
|
| 1102 |
+
{
|
| 1103 |
+
scene: "smart_crop",
|
| 1104 |
+
width: 480,
|
| 1105 |
+
height: 480,
|
| 1106 |
+
uniq_key: "smart_crop-w:480-h:480",
|
| 1107 |
+
format: "webp",
|
| 1108 |
+
},
|
| 1109 |
+
{
|
| 1110 |
+
scene: "smart_crop",
|
| 1111 |
+
width: 720,
|
| 1112 |
+
height: 720,
|
| 1113 |
+
uniq_key: "smart_crop-w:720-h:720",
|
| 1114 |
+
format: "webp",
|
| 1115 |
+
},
|
| 1116 |
+
{
|
| 1117 |
+
scene: "smart_crop",
|
| 1118 |
+
width: 720,
|
| 1119 |
+
height: 480,
|
| 1120 |
+
uniq_key: "smart_crop-w:720-h:480",
|
| 1121 |
+
format: "webp",
|
| 1122 |
+
},
|
| 1123 |
+
{
|
| 1124 |
+
scene: "smart_crop",
|
| 1125 |
+
width: 360,
|
| 1126 |
+
height: 240,
|
| 1127 |
+
uniq_key: "smart_crop-w:360-h:240",
|
| 1128 |
+
format: "webp",
|
| 1129 |
+
},
|
| 1130 |
+
{
|
| 1131 |
+
scene: "smart_crop",
|
| 1132 |
+
width: 240,
|
| 1133 |
+
height: 320,
|
| 1134 |
+
uniq_key: "smart_crop-w:240-h:320",
|
| 1135 |
+
format: "webp",
|
| 1136 |
+
},
|
| 1137 |
+
{
|
| 1138 |
+
scene: "smart_crop",
|
| 1139 |
+
width: 480,
|
| 1140 |
+
height: 640,
|
| 1141 |
+
uniq_key: "smart_crop-w:480-h:640",
|
| 1142 |
+
format: "webp",
|
| 1143 |
+
},
|
| 1144 |
+
{
|
| 1145 |
+
scene: "normal",
|
| 1146 |
+
width: 2400,
|
| 1147 |
+
height: 2400,
|
| 1148 |
+
uniq_key: "2400",
|
| 1149 |
+
format: "webp",
|
| 1150 |
+
},
|
| 1151 |
+
{
|
| 1152 |
+
scene: "normal",
|
| 1153 |
+
width: 1080,
|
| 1154 |
+
height: 1080,
|
| 1155 |
+
uniq_key: "1080",
|
| 1156 |
+
format: "webp",
|
| 1157 |
+
},
|
| 1158 |
+
{
|
| 1159 |
+
scene: "normal",
|
| 1160 |
+
width: 720,
|
| 1161 |
+
height: 720,
|
| 1162 |
+
uniq_key: "720",
|
| 1163 |
+
format: "webp",
|
| 1164 |
+
},
|
| 1165 |
+
{
|
| 1166 |
+
scene: "normal",
|
| 1167 |
+
width: 480,
|
| 1168 |
+
height: 480,
|
| 1169 |
+
uniq_key: "480",
|
| 1170 |
+
format: "webp",
|
| 1171 |
+
},
|
| 1172 |
+
{
|
| 1173 |
+
scene: "normal",
|
| 1174 |
+
width: 360,
|
| 1175 |
+
height: 360,
|
| 1176 |
+
uniq_key: "360",
|
| 1177 |
+
format: "webp",
|
| 1178 |
+
},
|
| 1179 |
+
],
|
| 1180 |
+
},
|
| 1181 |
+
http_common_info: {
|
| 1182 |
+
aid: Number(DEFAULT_ASSISTANT_ID),
|
| 1183 |
+
},
|
| 1184 |
+
},
|
| 1185 |
+
});
|
| 1186 |
+
if (!result[historyId])
|
| 1187 |
+
throw new APIException(EX.API_IMAGE_GENERATION_FAILED, "记录不存在");
|
| 1188 |
+
|
| 1189 |
+
status = result[historyId].status;
|
| 1190 |
+
failCode = result[historyId].fail_code;
|
| 1191 |
+
item_list = result[historyId].item_list || [];
|
| 1192 |
+
|
| 1193 |
+
// 检查是否已生成图片
|
| 1194 |
+
if (item_list.length > 0) {
|
| 1195 |
+
logger.info(`文生图完成: 状态=${status}, 已生成 ${item_list.length} 张图片`);
|
| 1196 |
+
break;
|
| 1197 |
+
}
|
| 1198 |
+
|
| 1199 |
+
// 记录详细状态
|
| 1200 |
+
if (pollCount % 60 === 0) {
|
| 1201 |
+
logger.info(`文生图详细状态: status=${status}, item_list.length=${item_list.length}, failCode=${failCode || 'none'}`);
|
| 1202 |
+
}
|
| 1203 |
+
|
| 1204 |
+
// 如果状态是完成但图片数量为0,记录并继续等待
|
| 1205 |
+
if (status === 10 && item_list.length === 0 && pollCount % 30 === 0) {
|
| 1206 |
+
logger.info(`文生图状态已完成但无图片生成: 状态=${status}, 继续等待...`);
|
| 1207 |
+
}
|
| 1208 |
+
}
|
| 1209 |
+
|
| 1210 |
+
if (pollCount >= maxPollCount) {
|
| 1211 |
+
logger.warn(`文生图超时: 轮询了 ${pollCount} 次,当前状态: ${status},已生成图片数: ${item_list.length}`);
|
| 1212 |
+
}
|
| 1213 |
+
|
| 1214 |
+
if (status === 30) {
|
| 1215 |
+
if (failCode === '2038')
|
| 1216 |
+
throw new APIException(EX.API_CONTENT_FILTERED);
|
| 1217 |
+
else
|
| 1218 |
+
throw new APIException(EX.API_IMAGE_GENERATION_FAILED);
|
| 1219 |
+
}
|
| 1220 |
+
|
| 1221 |
+
const imageUrls = item_list.map((item) => {
|
| 1222 |
+
if(!item?.image?.large_images?.[0]?.image_url)
|
| 1223 |
+
return item?.common_attr?.cover_url || null;
|
| 1224 |
+
return item.image.large_images[0].image_url;
|
| 1225 |
+
}).filter(url => url !== null);
|
| 1226 |
+
|
| 1227 |
+
logger.info(`文生图结果: 成功生成 ${imageUrls.length} 张图片`);
|
| 1228 |
+
return imageUrls;
|
| 1229 |
+
}
|
| 1230 |
+
|
| 1231 |
+
export default {
|
| 1232 |
+
generateImages,
|
| 1233 |
+
generateImageComposition,
|
| 1234 |
+
};
|
src/api/controllers/videos.ts
ADDED
|
@@ -0,0 +1,733 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import _ from "lodash";
|
| 2 |
+
import crypto from "crypto";
|
| 3 |
+
|
| 4 |
+
import APIException from "@/lib/exceptions/APIException.ts";
|
| 5 |
+
import EX from "@/api/consts/exceptions.ts";
|
| 6 |
+
import util from "@/lib/util.ts";
|
| 7 |
+
import { getCredit, receiveCredit, request } from "./core.ts";
|
| 8 |
+
import logger from "@/lib/logger.ts";
|
| 9 |
+
|
| 10 |
+
const DEFAULT_ASSISTANT_ID = "513695";
|
| 11 |
+
export const DEFAULT_MODEL = "jimeng-video-3.0";
|
| 12 |
+
const DRAFT_VERSION = "3.2.8";
|
| 13 |
+
const MODEL_MAP = {
|
| 14 |
+
"jimeng-video-3.0-pro": "dreamina_ic_generate_video_model_vgfm_3.0_pro",
|
| 15 |
+
"jimeng-video-3.0": "dreamina_ic_generate_video_model_vgfm_3.0",
|
| 16 |
+
"jimeng-video-2.0": "dreamina_ic_generate_video_model_vgfm_lite",
|
| 17 |
+
"jimeng-video-2.0-pro": "dreamina_ic_generate_video_model_vgfm1.0"
|
| 18 |
+
};
|
| 19 |
+
|
| 20 |
+
export function getModel(model: string) {
|
| 21 |
+
return MODEL_MAP[model] || MODEL_MAP[DEFAULT_MODEL];
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
// AWS4-HMAC-SHA256 签名生成函数(从 images.ts 复制)
|
| 25 |
+
function createSignature(
|
| 26 |
+
method: string,
|
| 27 |
+
url: string,
|
| 28 |
+
headers: { [key: string]: string },
|
| 29 |
+
accessKeyId: string,
|
| 30 |
+
secretAccessKey: string,
|
| 31 |
+
sessionToken?: string,
|
| 32 |
+
payload: string = ''
|
| 33 |
+
) {
|
| 34 |
+
const urlObj = new URL(url);
|
| 35 |
+
const pathname = urlObj.pathname || '/';
|
| 36 |
+
const search = urlObj.search;
|
| 37 |
+
|
| 38 |
+
// 创建规范请求
|
| 39 |
+
const timestamp = headers['x-amz-date'];
|
| 40 |
+
const date = timestamp.substr(0, 8);
|
| 41 |
+
const region = 'cn-north-1';
|
| 42 |
+
const service = 'imagex';
|
| 43 |
+
|
| 44 |
+
// 规范化查询参数
|
| 45 |
+
const queryParams: Array<[string, string]> = [];
|
| 46 |
+
const searchParams = new URLSearchParams(search);
|
| 47 |
+
searchParams.forEach((value, key) => {
|
| 48 |
+
queryParams.push([key, value]);
|
| 49 |
+
});
|
| 50 |
+
|
| 51 |
+
// 按键名排序
|
| 52 |
+
queryParams.sort(([a], [b]) => {
|
| 53 |
+
if (a < b) return -1;
|
| 54 |
+
if (a > b) return 1;
|
| 55 |
+
return 0;
|
| 56 |
+
});
|
| 57 |
+
|
| 58 |
+
const canonicalQueryString = queryParams
|
| 59 |
+
.map(([key, value]) => `${key}=${value}`)
|
| 60 |
+
.join('&');
|
| 61 |
+
|
| 62 |
+
// 规范化头部
|
| 63 |
+
const headersToSign: { [key: string]: string } = {
|
| 64 |
+
'x-amz-date': timestamp
|
| 65 |
+
};
|
| 66 |
+
|
| 67 |
+
if (sessionToken) {
|
| 68 |
+
headersToSign['x-amz-security-token'] = sessionToken;
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
let payloadHash = crypto.createHash('sha256').update('').digest('hex');
|
| 72 |
+
if (method.toUpperCase() === 'POST' && payload) {
|
| 73 |
+
payloadHash = crypto.createHash('sha256').update(payload, 'utf8').digest('hex');
|
| 74 |
+
headersToSign['x-amz-content-sha256'] = payloadHash;
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
const signedHeaders = Object.keys(headersToSign)
|
| 78 |
+
.map(key => key.toLowerCase())
|
| 79 |
+
.sort()
|
| 80 |
+
.join(';');
|
| 81 |
+
|
| 82 |
+
const canonicalHeaders = Object.keys(headersToSign)
|
| 83 |
+
.sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase()))
|
| 84 |
+
.map(key => `${key.toLowerCase()}:${headersToSign[key].trim()}\n`)
|
| 85 |
+
.join('');
|
| 86 |
+
|
| 87 |
+
const canonicalRequest = [
|
| 88 |
+
method.toUpperCase(),
|
| 89 |
+
pathname,
|
| 90 |
+
canonicalQueryString,
|
| 91 |
+
canonicalHeaders,
|
| 92 |
+
signedHeaders,
|
| 93 |
+
payloadHash
|
| 94 |
+
].join('\n');
|
| 95 |
+
|
| 96 |
+
// 创建待签名字符串
|
| 97 |
+
const credentialScope = `${date}/${region}/${service}/aws4_request`;
|
| 98 |
+
const stringToSign = [
|
| 99 |
+
'AWS4-HMAC-SHA256',
|
| 100 |
+
timestamp,
|
| 101 |
+
credentialScope,
|
| 102 |
+
crypto.createHash('sha256').update(canonicalRequest, 'utf8').digest('hex')
|
| 103 |
+
].join('\n');
|
| 104 |
+
|
| 105 |
+
// 生成签名
|
| 106 |
+
const kDate = crypto.createHmac('sha256', `AWS4${secretAccessKey}`).update(date).digest();
|
| 107 |
+
const kRegion = crypto.createHmac('sha256', kDate).update(region).digest();
|
| 108 |
+
const kService = crypto.createHmac('sha256', kRegion).update(service).digest();
|
| 109 |
+
const kSigning = crypto.createHmac('sha256', kService).update('aws4_request').digest();
|
| 110 |
+
const signature = crypto.createHmac('sha256', kSigning).update(stringToSign, 'utf8').digest('hex');
|
| 111 |
+
|
| 112 |
+
return `AWS4-HMAC-SHA256 Credential=${accessKeyId}/${credentialScope}, SignedHeaders=${signedHeaders}, Signature=${signature}`;
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
// 计算文件的CRC32值(从 images.ts 复制)
|
| 116 |
+
function calculateCRC32(buffer: ArrayBuffer): string {
|
| 117 |
+
const crcTable = [];
|
| 118 |
+
for (let i = 0; i < 256; i++) {
|
| 119 |
+
let crc = i;
|
| 120 |
+
for (let j = 0; j < 8; j++) {
|
| 121 |
+
crc = (crc & 1) ? (0xEDB88320 ^ (crc >>> 1)) : (crc >>> 1);
|
| 122 |
+
}
|
| 123 |
+
crcTable[i] = crc;
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
let crc = 0 ^ (-1);
|
| 127 |
+
const bytes = new Uint8Array(buffer);
|
| 128 |
+
for (let i = 0; i < bytes.length; i++) {
|
| 129 |
+
crc = (crc >>> 8) ^ crcTable[(crc ^ bytes[i]) & 0xFF];
|
| 130 |
+
}
|
| 131 |
+
return ((crc ^ (-1)) >>> 0).toString(16).padStart(8, '0');
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
// 视频专用图片上传功能(基于 images.ts 的 uploadImageFromUrl)
|
| 135 |
+
async function uploadImageForVideo(imageUrl: string, refreshToken: string): Promise<string> {
|
| 136 |
+
try {
|
| 137 |
+
logger.info(`开始上传视频图片: ${imageUrl}`);
|
| 138 |
+
|
| 139 |
+
// 第一步:获取上传令牌
|
| 140 |
+
const tokenResult = await request("post", "/mweb/v1/get_upload_token", refreshToken, {
|
| 141 |
+
data: {
|
| 142 |
+
scene: 2, // AIGC 图片上传场景
|
| 143 |
+
},
|
| 144 |
+
});
|
| 145 |
+
|
| 146 |
+
const { access_key_id, secret_access_key, session_token, service_id } = tokenResult;
|
| 147 |
+
if (!access_key_id || !secret_access_key || !session_token) {
|
| 148 |
+
throw new Error("获取上传令牌失败");
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
const actualServiceId = service_id || "tb4s082cfz";
|
| 152 |
+
logger.info(`获取上传令牌成功: service_id=${actualServiceId}`);
|
| 153 |
+
|
| 154 |
+
// 下载图片数据
|
| 155 |
+
const imageResponse = await fetch(imageUrl);
|
| 156 |
+
if (!imageResponse.ok) {
|
| 157 |
+
throw new Error(`下载图片失败: ${imageResponse.status}`);
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
const imageBuffer = await imageResponse.arrayBuffer();
|
| 161 |
+
const fileSize = imageBuffer.byteLength;
|
| 162 |
+
const crc32 = calculateCRC32(imageBuffer);
|
| 163 |
+
|
| 164 |
+
logger.info(`图片下载完成: 大小=${fileSize}字节, CRC32=${crc32}`);
|
| 165 |
+
|
| 166 |
+
// 第二步:申请图片上传权限
|
| 167 |
+
const now = new Date();
|
| 168 |
+
const timestamp = now.toISOString().replace(/[:\-]/g, '').replace(/\.\d{3}Z$/, 'Z');
|
| 169 |
+
|
| 170 |
+
const randomStr = Math.random().toString(36).substring(2, 12);
|
| 171 |
+
const applyUrl = `https://imagex.bytedanceapi.com/?Action=ApplyImageUpload&Version=2018-08-01&ServiceId=${actualServiceId}&FileSize=${fileSize}&s=${randomStr}`;
|
| 172 |
+
|
| 173 |
+
const requestHeaders = {
|
| 174 |
+
'x-amz-date': timestamp,
|
| 175 |
+
'x-amz-security-token': session_token
|
| 176 |
+
};
|
| 177 |
+
|
| 178 |
+
const authorization = createSignature('GET', applyUrl, requestHeaders, access_key_id, secret_access_key, session_token);
|
| 179 |
+
|
| 180 |
+
logger.info(`申请上传权限: ${applyUrl}`);
|
| 181 |
+
|
| 182 |
+
const applyResponse = await fetch(applyUrl, {
|
| 183 |
+
method: 'GET',
|
| 184 |
+
headers: {
|
| 185 |
+
'accept': '*/*',
|
| 186 |
+
'accept-language': 'zh-CN,zh;q=0.9',
|
| 187 |
+
'authorization': authorization,
|
| 188 |
+
'origin': 'https://jimeng.jianying.com',
|
| 189 |
+
'referer': 'https://jimeng.jianying.com/ai-tool/video/generate',
|
| 190 |
+
'sec-ch-ua': '"Not A(Brand";v="8", "Chromium";v="132", "Google Chrome";v="132"',
|
| 191 |
+
'sec-ch-ua-mobile': '?0',
|
| 192 |
+
'sec-ch-ua-platform': '"Windows"',
|
| 193 |
+
'sec-fetch-dest': 'empty',
|
| 194 |
+
'sec-fetch-mode': 'cors',
|
| 195 |
+
'sec-fetch-site': 'cross-site',
|
| 196 |
+
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36',
|
| 197 |
+
'x-amz-date': timestamp,
|
| 198 |
+
'x-amz-security-token': session_token,
|
| 199 |
+
},
|
| 200 |
+
});
|
| 201 |
+
|
| 202 |
+
if (!applyResponse.ok) {
|
| 203 |
+
const errorText = await applyResponse.text();
|
| 204 |
+
throw new Error(`申请上传权限失败: ${applyResponse.status} - ${errorText}`);
|
| 205 |
+
}
|
| 206 |
+
|
| 207 |
+
const applyResult = await applyResponse.json();
|
| 208 |
+
|
| 209 |
+
if (applyResult?.ResponseMetadata?.Error) {
|
| 210 |
+
throw new Error(`申请上传权限失败: ${JSON.stringify(applyResult.ResponseMetadata.Error)}`);
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
+
logger.info(`申请上传权限成功`);
|
| 214 |
+
|
| 215 |
+
// 解析上传信息
|
| 216 |
+
const uploadAddress = applyResult?.Result?.UploadAddress;
|
| 217 |
+
if (!uploadAddress || !uploadAddress.StoreInfos || !uploadAddress.UploadHosts) {
|
| 218 |
+
throw new Error(`获取上传地址失败: ${JSON.stringify(applyResult)}`);
|
| 219 |
+
}
|
| 220 |
+
|
| 221 |
+
const storeInfo = uploadAddress.StoreInfos[0];
|
| 222 |
+
const uploadHost = uploadAddress.UploadHosts[0];
|
| 223 |
+
const auth = storeInfo.Auth;
|
| 224 |
+
|
| 225 |
+
const uploadUrl = `https://${uploadHost}/upload/v1/${storeInfo.StoreUri}`;
|
| 226 |
+
const imageId = storeInfo.StoreUri.split('/').pop();
|
| 227 |
+
|
| 228 |
+
logger.info(`准备上传图片: imageId=${imageId}, uploadUrl=${uploadUrl}`);
|
| 229 |
+
|
| 230 |
+
// 第三步:上传图片文件
|
| 231 |
+
const uploadResponse = await fetch(uploadUrl, {
|
| 232 |
+
method: 'POST',
|
| 233 |
+
headers: {
|
| 234 |
+
'Accept': '*/*',
|
| 235 |
+
'Accept-Language': 'zh-CN,zh;q=0.9',
|
| 236 |
+
'Authorization': auth,
|
| 237 |
+
'Connection': 'keep-alive',
|
| 238 |
+
'Content-CRC32': crc32,
|
| 239 |
+
'Content-Disposition': 'attachment; filename="undefined"',
|
| 240 |
+
'Content-Type': 'application/octet-stream',
|
| 241 |
+
'Origin': 'https://jimeng.jianying.com',
|
| 242 |
+
'Referer': 'https://jimeng.jianying.com/ai-tool/video/generate',
|
| 243 |
+
'Sec-Fetch-Dest': 'empty',
|
| 244 |
+
'Sec-Fetch-Mode': 'cors',
|
| 245 |
+
'Sec-Fetch-Site': 'cross-site',
|
| 246 |
+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36',
|
| 247 |
+
'X-Storage-U': '704135154117550',
|
| 248 |
+
},
|
| 249 |
+
body: imageBuffer,
|
| 250 |
+
});
|
| 251 |
+
|
| 252 |
+
if (!uploadResponse.ok) {
|
| 253 |
+
const errorText = await uploadResponse.text();
|
| 254 |
+
throw new Error(`图片上传失败: ${uploadResponse.status} - ${errorText}`);
|
| 255 |
+
}
|
| 256 |
+
|
| 257 |
+
logger.info(`图片文件上传成功`);
|
| 258 |
+
|
| 259 |
+
// 第四步:提交上传
|
| 260 |
+
const commitUrl = `https://imagex.bytedanceapi.com/?Action=CommitImageUpload&Version=2018-08-01&ServiceId=${actualServiceId}`;
|
| 261 |
+
|
| 262 |
+
const commitTimestamp = new Date().toISOString().replace(/[:\-]/g, '').replace(/\.\d{3}Z$/, 'Z');
|
| 263 |
+
const commitPayload = JSON.stringify({
|
| 264 |
+
SessionKey: uploadAddress.SessionKey,
|
| 265 |
+
SuccessActionStatus: "200"
|
| 266 |
+
});
|
| 267 |
+
|
| 268 |
+
const payloadHash = crypto.createHash('sha256').update(commitPayload, 'utf8').digest('hex');
|
| 269 |
+
|
| 270 |
+
const commitRequestHeaders = {
|
| 271 |
+
'x-amz-date': commitTimestamp,
|
| 272 |
+
'x-amz-security-token': session_token,
|
| 273 |
+
'x-amz-content-sha256': payloadHash
|
| 274 |
+
};
|
| 275 |
+
|
| 276 |
+
const commitAuthorization = createSignature('POST', commitUrl, commitRequestHeaders, access_key_id, secret_access_key, session_token, commitPayload);
|
| 277 |
+
|
| 278 |
+
const commitResponse = await fetch(commitUrl, {
|
| 279 |
+
method: 'POST',
|
| 280 |
+
headers: {
|
| 281 |
+
'accept': '*/*',
|
| 282 |
+
'accept-language': 'zh-CN,zh;q=0.9',
|
| 283 |
+
'authorization': commitAuthorization,
|
| 284 |
+
'content-type': 'application/json',
|
| 285 |
+
'origin': 'https://jimeng.jianying.com',
|
| 286 |
+
'referer': 'https://jimeng.jianying.com/ai-tool/video/generate',
|
| 287 |
+
'sec-ch-ua': '"Not A(Brand";v="8", "Chromium";v="132", "Google Chrome";v="132"',
|
| 288 |
+
'sec-ch-ua-mobile': '?0',
|
| 289 |
+
'sec-ch-ua-platform': '"Windows"',
|
| 290 |
+
'sec-fetch-dest': 'empty',
|
| 291 |
+
'sec-fetch-mode': 'cors',
|
| 292 |
+
'sec-fetch-site': 'cross-site',
|
| 293 |
+
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36',
|
| 294 |
+
'x-amz-date': commitTimestamp,
|
| 295 |
+
'x-amz-security-token': session_token,
|
| 296 |
+
'x-amz-content-sha256': payloadHash,
|
| 297 |
+
},
|
| 298 |
+
body: commitPayload,
|
| 299 |
+
});
|
| 300 |
+
|
| 301 |
+
if (!commitResponse.ok) {
|
| 302 |
+
const errorText = await commitResponse.text();
|
| 303 |
+
throw new Error(`提交上传失败: ${commitResponse.status} - ${errorText}`);
|
| 304 |
+
}
|
| 305 |
+
|
| 306 |
+
const commitResult = await commitResponse.json();
|
| 307 |
+
|
| 308 |
+
if (commitResult?.ResponseMetadata?.Error) {
|
| 309 |
+
throw new Error(`提交上传失败: ${JSON.stringify(commitResult.ResponseMetadata.Error)}`);
|
| 310 |
+
}
|
| 311 |
+
|
| 312 |
+
if (!commitResult?.Result?.Results || commitResult.Result.Results.length === 0) {
|
| 313 |
+
throw new Error(`提交上传响应缺少结果: ${JSON.stringify(commitResult)}`);
|
| 314 |
+
}
|
| 315 |
+
|
| 316 |
+
const uploadResult = commitResult.Result.Results[0];
|
| 317 |
+
if (uploadResult.UriStatus !== 2000) {
|
| 318 |
+
throw new Error(`图片上传状态异常: UriStatus=${uploadResult.UriStatus}`);
|
| 319 |
+
}
|
| 320 |
+
|
| 321 |
+
const fullImageUri = uploadResult.Uri;
|
| 322 |
+
|
| 323 |
+
// 验证图片信息
|
| 324 |
+
const pluginResult = commitResult.Result?.PluginResult?.[0];
|
| 325 |
+
if (pluginResult && pluginResult.ImageUri) {
|
| 326 |
+
logger.info(`视频图片上传完成: ${pluginResult.ImageUri}`);
|
| 327 |
+
return pluginResult.ImageUri;
|
| 328 |
+
}
|
| 329 |
+
|
| 330 |
+
logger.info(`视频图片上传完成: ${fullImageUri}`);
|
| 331 |
+
return fullImageUri;
|
| 332 |
+
|
| 333 |
+
} catch (error) {
|
| 334 |
+
logger.error(`视频图片上传失败: ${error.message}`);
|
| 335 |
+
throw error;
|
| 336 |
+
}
|
| 337 |
+
}
|
| 338 |
+
|
| 339 |
+
/**
|
| 340 |
+
* 生成视频
|
| 341 |
+
*
|
| 342 |
+
* @param _model 模型名称
|
| 343 |
+
* @param prompt 提示词
|
| 344 |
+
* @param options 选项
|
| 345 |
+
* @param refreshToken 刷新令牌
|
| 346 |
+
* @returns 视频URL
|
| 347 |
+
*/
|
| 348 |
+
export async function generateVideo(
|
| 349 |
+
_model: string,
|
| 350 |
+
prompt: string,
|
| 351 |
+
{
|
| 352 |
+
width = 1024,
|
| 353 |
+
height = 1024,
|
| 354 |
+
resolution = "720p",
|
| 355 |
+
filePaths = [],
|
| 356 |
+
}: {
|
| 357 |
+
width?: number;
|
| 358 |
+
height?: number;
|
| 359 |
+
resolution?: string;
|
| 360 |
+
filePaths?: string[];
|
| 361 |
+
},
|
| 362 |
+
refreshToken: string
|
| 363 |
+
) {
|
| 364 |
+
const model = getModel(_model);
|
| 365 |
+
logger.info(`使用模型: ${_model} 映射模型: ${model} ${width}x${height} 分辨率: ${resolution}`);
|
| 366 |
+
|
| 367 |
+
// 检查积分
|
| 368 |
+
const { totalCredit } = await getCredit(refreshToken);
|
| 369 |
+
if (totalCredit <= 0)
|
| 370 |
+
await receiveCredit(refreshToken);
|
| 371 |
+
|
| 372 |
+
// 处理首帧和尾帧图片
|
| 373 |
+
let first_frame_image = undefined;
|
| 374 |
+
let end_frame_image = undefined;
|
| 375 |
+
|
| 376 |
+
if (filePaths && filePaths.length > 0) {
|
| 377 |
+
let uploadIDs: string[] = [];
|
| 378 |
+
logger.info(`开始上传 ${filePaths.length} 张图片用于视频生成`);
|
| 379 |
+
|
| 380 |
+
for (let i = 0; i < filePaths.length; i++) {
|
| 381 |
+
const filePath = filePaths[i];
|
| 382 |
+
if (!filePath) {
|
| 383 |
+
logger.warn(`第 ${i + 1} 张图片路径为空,跳过`);
|
| 384 |
+
continue;
|
| 385 |
+
}
|
| 386 |
+
|
| 387 |
+
try {
|
| 388 |
+
logger.info(`开始上传第 ${i + 1} 张图片: ${filePath}`);
|
| 389 |
+
|
| 390 |
+
// 使用Amazon S3上传方式
|
| 391 |
+
const imageUri = await uploadImageForVideo(filePath, refreshToken);
|
| 392 |
+
|
| 393 |
+
if (imageUri) {
|
| 394 |
+
uploadIDs.push(imageUri);
|
| 395 |
+
logger.info(`第 ${i + 1} 张图片上传成功: ${imageUri}`);
|
| 396 |
+
} else {
|
| 397 |
+
logger.error(`第 ${i + 1} 张图片上传失败: 未获取到 image_uri`);
|
| 398 |
+
}
|
| 399 |
+
} catch (error) {
|
| 400 |
+
logger.error(`第 ${i + 1} 张图片上传失败: ${error.message}`);
|
| 401 |
+
|
| 402 |
+
// 图片上传失败时,停止视频生成避免浪费积分
|
| 403 |
+
if (i === 0) {
|
| 404 |
+
logger.error(`首帧图片上传失败,停止视频生成以避免浪费积分`);
|
| 405 |
+
throw new APIException(EX.API_REQUEST_FAILED, `首帧图片上传失败: ${error.message}`);
|
| 406 |
+
} else {
|
| 407 |
+
logger.warn(`第 ${i + 1} 张图片上传失败,将跳过此图片继续处理`);
|
| 408 |
+
}
|
| 409 |
+
}
|
| 410 |
+
}
|
| 411 |
+
|
| 412 |
+
logger.info(`图片上传完成,成功上传 ${uploadIDs.length} 张图片`);
|
| 413 |
+
|
| 414 |
+
// 如果没有成功上传任何图片,停止视频生成
|
| 415 |
+
if (uploadIDs.length === 0) {
|
| 416 |
+
logger.error(`所有图片上传失败,停止视频生成以避免浪费积分`);
|
| 417 |
+
throw new APIException(EX.API_REQUEST_FAILED, '所有图片上传失败,请检查图片URL是否有效');
|
| 418 |
+
}
|
| 419 |
+
|
| 420 |
+
// 构建首帧图片对象
|
| 421 |
+
if (uploadIDs[0]) {
|
| 422 |
+
first_frame_image = {
|
| 423 |
+
format: "",
|
| 424 |
+
height: height,
|
| 425 |
+
id: util.uuid(),
|
| 426 |
+
image_uri: uploadIDs[0],
|
| 427 |
+
name: "",
|
| 428 |
+
platform_type: 1,
|
| 429 |
+
source_from: "upload",
|
| 430 |
+
type: "image",
|
| 431 |
+
uri: uploadIDs[0],
|
| 432 |
+
width: width,
|
| 433 |
+
};
|
| 434 |
+
logger.info(`设置首帧图片: ${uploadIDs[0]}`);
|
| 435 |
+
}
|
| 436 |
+
|
| 437 |
+
// 构建尾帧图片对象
|
| 438 |
+
if (uploadIDs[1]) {
|
| 439 |
+
end_frame_image = {
|
| 440 |
+
format: "",
|
| 441 |
+
height: height,
|
| 442 |
+
id: util.uuid(),
|
| 443 |
+
image_uri: uploadIDs[1],
|
| 444 |
+
name: "",
|
| 445 |
+
platform_type: 1,
|
| 446 |
+
source_from: "upload",
|
| 447 |
+
type: "image",
|
| 448 |
+
uri: uploadIDs[1],
|
| 449 |
+
width: width,
|
| 450 |
+
};
|
| 451 |
+
logger.info(`设置尾帧图片: ${uploadIDs[1]}`);
|
| 452 |
+
} else if (filePaths.length > 1) {
|
| 453 |
+
logger.warn(`第二张图片上传失败或未提供,将仅使用首帧图片`);
|
| 454 |
+
}
|
| 455 |
+
} else {
|
| 456 |
+
logger.info(`未提供图片文件,将进行纯文本视频生成`);
|
| 457 |
+
}
|
| 458 |
+
|
| 459 |
+
const componentId = util.uuid();
|
| 460 |
+
const metricsExtra = JSON.stringify({
|
| 461 |
+
"enterFrom": "click",
|
| 462 |
+
"isDefaultSeed": 1,
|
| 463 |
+
"promptSource": "custom",
|
| 464 |
+
"isRegenerate": false,
|
| 465 |
+
"originSubmitId": util.uuid(),
|
| 466 |
+
});
|
| 467 |
+
|
| 468 |
+
// 计算视频宽高比
|
| 469 |
+
const gcd = (a: number, b: number): number => b === 0 ? a : gcd(b, a % b);
|
| 470 |
+
const divisor = gcd(width, height);
|
| 471 |
+
const aspectRatio = `${width / divisor}:${height / divisor}`;
|
| 472 |
+
|
| 473 |
+
// 构建请求参数
|
| 474 |
+
const { aigc_data } = await request(
|
| 475 |
+
"post",
|
| 476 |
+
"/mweb/v1/aigc_draft/generate",
|
| 477 |
+
refreshToken,
|
| 478 |
+
{
|
| 479 |
+
params: {
|
| 480 |
+
aigc_features: "app_lip_sync",
|
| 481 |
+
web_version: "6.6.0",
|
| 482 |
+
da_version: DRAFT_VERSION,
|
| 483 |
+
},
|
| 484 |
+
data: {
|
| 485 |
+
"extend": {
|
| 486 |
+
"root_model": end_frame_image ? MODEL_MAP['jimeng-video-3.0'] : model,
|
| 487 |
+
"m_video_commerce_info": {
|
| 488 |
+
benefit_type: "basic_video_operation_vgfm_v_three",
|
| 489 |
+
resource_id: "generate_video",
|
| 490 |
+
resource_id_type: "str",
|
| 491 |
+
resource_sub_type: "aigc"
|
| 492 |
+
},
|
| 493 |
+
"m_video_commerce_info_list": [{
|
| 494 |
+
benefit_type: "basic_video_operation_vgfm_v_three",
|
| 495 |
+
resource_id: "generate_video",
|
| 496 |
+
resource_id_type: "str",
|
| 497 |
+
resource_sub_type: "aigc"
|
| 498 |
+
}]
|
| 499 |
+
},
|
| 500 |
+
"submit_id": util.uuid(),
|
| 501 |
+
"metrics_extra": metricsExtra,
|
| 502 |
+
"draft_content": JSON.stringify({
|
| 503 |
+
"type": "draft",
|
| 504 |
+
"id": util.uuid(),
|
| 505 |
+
"min_version": "3.0.5",
|
| 506 |
+
"is_from_tsn": true,
|
| 507 |
+
"version": DRAFT_VERSION,
|
| 508 |
+
"main_component_id": componentId,
|
| 509 |
+
"component_list": [{
|
| 510 |
+
"type": "video_base_component",
|
| 511 |
+
"id": componentId,
|
| 512 |
+
"min_version": "1.0.0",
|
| 513 |
+
"metadata": {
|
| 514 |
+
"type": "",
|
| 515 |
+
"id": util.uuid(),
|
| 516 |
+
"created_platform": 3,
|
| 517 |
+
"created_platform_version": "",
|
| 518 |
+
"created_time_in_ms": Date.now(),
|
| 519 |
+
"created_did": ""
|
| 520 |
+
},
|
| 521 |
+
"generate_type": "gen_video",
|
| 522 |
+
"aigc_mode": "workbench",
|
| 523 |
+
"abilities": {
|
| 524 |
+
"type": "",
|
| 525 |
+
"id": util.uuid(),
|
| 526 |
+
"gen_video": {
|
| 527 |
+
"id": util.uuid(),
|
| 528 |
+
"type": "",
|
| 529 |
+
"text_to_video_params": {
|
| 530 |
+
"type": "",
|
| 531 |
+
"id": util.uuid(),
|
| 532 |
+
"model_req_key": model,
|
| 533 |
+
"priority": 0,
|
| 534 |
+
"seed": Math.floor(Math.random() * 100000000) + 2500000000,
|
| 535 |
+
"video_aspect_ratio": aspectRatio,
|
| 536 |
+
"video_gen_inputs": [{
|
| 537 |
+
duration_ms: 5000,
|
| 538 |
+
first_frame_image: first_frame_image,
|
| 539 |
+
end_frame_image: end_frame_image,
|
| 540 |
+
fps: 24,
|
| 541 |
+
id: util.uuid(),
|
| 542 |
+
min_version: "3.0.5",
|
| 543 |
+
prompt: prompt,
|
| 544 |
+
resolution: resolution,
|
| 545 |
+
type: "",
|
| 546 |
+
video_mode: 2
|
| 547 |
+
}]
|
| 548 |
+
},
|
| 549 |
+
"video_task_extra": metricsExtra,
|
| 550 |
+
}
|
| 551 |
+
}
|
| 552 |
+
}],
|
| 553 |
+
}),
|
| 554 |
+
http_common_info: {
|
| 555 |
+
aid: Number(DEFAULT_ASSISTANT_ID),
|
| 556 |
+
},
|
| 557 |
+
},
|
| 558 |
+
}
|
| 559 |
+
);
|
| 560 |
+
|
| 561 |
+
const historyId = aigc_data.history_record_id;
|
| 562 |
+
if (!historyId)
|
| 563 |
+
throw new APIException(EX.API_IMAGE_GENERATION_FAILED, "记录ID不存在");
|
| 564 |
+
|
| 565 |
+
// 轮询获取结果
|
| 566 |
+
let status = 20, failCode, item_list = [];
|
| 567 |
+
let retryCount = 0;
|
| 568 |
+
const maxRetries = 60; // 增加重试次数,支持约20分钟的总重试时间
|
| 569 |
+
|
| 570 |
+
// 首次查询前等待更长时间,让服务器有时间处理请求
|
| 571 |
+
await new Promise((resolve) => setTimeout(resolve, 5000));
|
| 572 |
+
|
| 573 |
+
logger.info(`开始轮询视频生成结果,历史ID: ${historyId},最大重试次数: ${maxRetries}`);
|
| 574 |
+
logger.info(`即梦官网API地址: https://jimeng.jianying.com/mweb/v1/get_history_by_ids`);
|
| 575 |
+
logger.info(`视频生成请求已发送,请同时在即梦官网查看: https://jimeng.jianying.com/ai-tool/video/generate`);
|
| 576 |
+
|
| 577 |
+
while (status === 20 && retryCount < maxRetries) {
|
| 578 |
+
try {
|
| 579 |
+
// 构建请求URL和参数
|
| 580 |
+
const requestUrl = "/mweb/v1/get_history_by_ids";
|
| 581 |
+
const requestData = {
|
| 582 |
+
history_ids: [historyId],
|
| 583 |
+
};
|
| 584 |
+
|
| 585 |
+
// 尝试两种不同的API请求方式
|
| 586 |
+
let result;
|
| 587 |
+
let useAlternativeApi = retryCount > 10 && retryCount % 2 === 0; // 在重试10次后,每隔一次尝试备用API
|
| 588 |
+
|
| 589 |
+
if (useAlternativeApi) {
|
| 590 |
+
// 备用API请求方式
|
| 591 |
+
logger.info(`尝试备用API请求方式,URL: ${requestUrl}, 历史ID: ${historyId}, 重试次数: ${retryCount + 1}/${maxRetries}`);
|
| 592 |
+
const alternativeRequestData = {
|
| 593 |
+
history_record_ids: [historyId],
|
| 594 |
+
};
|
| 595 |
+
result = await request("post", "/mweb/v1/get_history_records", refreshToken, {
|
| 596 |
+
data: alternativeRequestData,
|
| 597 |
+
});
|
| 598 |
+
logger.info(`备用API响应: ${JSON.stringify(result)}`);
|
| 599 |
+
|
| 600 |
+
// 尝试直接从响应中提取视频URL
|
| 601 |
+
const responseStr = JSON.stringify(result);
|
| 602 |
+
const videoUrlMatch = responseStr.match(/https:\/\/v[0-9]+-artist\.vlabvod\.com\/[^"\s]+/);
|
| 603 |
+
if (videoUrlMatch && videoUrlMatch[0]) {
|
| 604 |
+
logger.info(`从备用API响应中直接提取到视频URL: ${videoUrlMatch[0]}`);
|
| 605 |
+
// 提前返回找到的URL
|
| 606 |
+
return videoUrlMatch[0];
|
| 607 |
+
}
|
| 608 |
+
} else {
|
| 609 |
+
// 标准API请求方式
|
| 610 |
+
logger.info(`发送请求获取视频生成结果,URL: ${requestUrl}, 历史ID: ${historyId}, 重试次数: ${retryCount + 1}/${maxRetries}`);
|
| 611 |
+
result = await request("post", requestUrl, refreshToken, {
|
| 612 |
+
data: requestData,
|
| 613 |
+
});
|
| 614 |
+
const responseStr = JSON.stringify(result);
|
| 615 |
+
logger.info(`标准API响应摘要: ${responseStr.substring(0, 300)}...`);
|
| 616 |
+
|
| 617 |
+
// 尝试直接从响应中提取视频URL
|
| 618 |
+
const videoUrlMatch = responseStr.match(/https:\/\/v[0-9]+-artist\.vlabvod\.com\/[^"\s]+/);
|
| 619 |
+
if (videoUrlMatch && videoUrlMatch[0]) {
|
| 620 |
+
logger.info(`从标准API响应中直接提取到视频URL: ${videoUrlMatch[0]}`);
|
| 621 |
+
// 提前返回找到的URL
|
| 622 |
+
return videoUrlMatch[0];
|
| 623 |
+
}
|
| 624 |
+
}
|
| 625 |
+
|
| 626 |
+
|
| 627 |
+
// 检查结果是否有效
|
| 628 |
+
let historyData;
|
| 629 |
+
|
| 630 |
+
if (useAlternativeApi && result.history_records && result.history_records.length > 0) {
|
| 631 |
+
// 处理备用API返回的数据格式
|
| 632 |
+
historyData = result.history_records[0];
|
| 633 |
+
logger.info(`从备用API获取到历史记录`);
|
| 634 |
+
} else if (result.history_list && result.history_list.length > 0) {
|
| 635 |
+
// 处理标准API返回的数据格式
|
| 636 |
+
historyData = result.history_list[0];
|
| 637 |
+
logger.info(`从标准API获取到历史记录`);
|
| 638 |
+
} else {
|
| 639 |
+
// 两种API都没有返回有效数据
|
| 640 |
+
logger.warn(`历史记录不存在,重试中 (${retryCount + 1}/${maxRetries})... 历史ID: ${historyId}`);
|
| 641 |
+
logger.info(`请同时在即梦官网检查视频是否已生成: https://jimeng.jianying.com/ai-tool/video/generate`);
|
| 642 |
+
|
| 643 |
+
retryCount++;
|
| 644 |
+
// 增加重试间隔时间,但设置上限为30秒
|
| 645 |
+
const waitTime = Math.min(2000 * (retryCount + 1), 30000);
|
| 646 |
+
logger.info(`等待 ${waitTime}ms 后进行第 ${retryCount + 1} 次重试`);
|
| 647 |
+
await new Promise((resolve) => setTimeout(resolve, waitTime));
|
| 648 |
+
continue;
|
| 649 |
+
}
|
| 650 |
+
|
| 651 |
+
// 记录获取到的结果详情
|
| 652 |
+
logger.info(`获取到历史记录结果: ${JSON.stringify(historyData)}`);
|
| 653 |
+
|
| 654 |
+
|
| 655 |
+
// 从历史数据中提取状态和结果
|
| 656 |
+
status = historyData.status;
|
| 657 |
+
failCode = historyData.fail_code;
|
| 658 |
+
item_list = historyData.item_list || [];
|
| 659 |
+
|
| 660 |
+
logger.info(`视频生成状态: ${status}, 失败代码: ${failCode || '无'}, 项目列表长度: ${item_list.length}`);
|
| 661 |
+
|
| 662 |
+
// 如果有视频URL,提前记录
|
| 663 |
+
let tempVideoUrl = item_list?.[0]?.video?.transcoded_video?.origin?.video_url;
|
| 664 |
+
if (!tempVideoUrl) {
|
| 665 |
+
// 尝试从其他可能的路径获取
|
| 666 |
+
tempVideoUrl = item_list?.[0]?.video?.play_url ||
|
| 667 |
+
item_list?.[0]?.video?.download_url ||
|
| 668 |
+
item_list?.[0]?.video?.url;
|
| 669 |
+
}
|
| 670 |
+
|
| 671 |
+
if (tempVideoUrl) {
|
| 672 |
+
logger.info(`检测到视频URL: ${tempVideoUrl}`);
|
| 673 |
+
}
|
| 674 |
+
|
| 675 |
+
if (status === 30) {
|
| 676 |
+
const error = failCode === 2038
|
| 677 |
+
? new APIException(EX.API_CONTENT_FILTERED, "内容被过滤")
|
| 678 |
+
: new APIException(EX.API_IMAGE_GENERATION_FAILED, `生成失败,错误码: ${failCode}`);
|
| 679 |
+
// 添加历史ID到错误对象,以便在chat.ts中显示
|
| 680 |
+
error.historyId = historyId;
|
| 681 |
+
throw error;
|
| 682 |
+
}
|
| 683 |
+
|
| 684 |
+
// 如果状态仍在处理中,等待后继续
|
| 685 |
+
if (status === 20) {
|
| 686 |
+
const waitTime = 2000 * (Math.min(retryCount + 1, 5)); // 随着重试次数增加等待时间,但最多10秒
|
| 687 |
+
logger.info(`视频生成中,状态码: ${status},等待 ${waitTime}ms 后继续查询`);
|
| 688 |
+
await new Promise((resolve) => setTimeout(resolve, waitTime));
|
| 689 |
+
}
|
| 690 |
+
} catch (error) {
|
| 691 |
+
logger.error(`轮询视频生成结果出错: ${error.message}`);
|
| 692 |
+
retryCount++;
|
| 693 |
+
await new Promise((resolve) => setTimeout(resolve, 2000 * (retryCount + 1)));
|
| 694 |
+
}
|
| 695 |
+
}
|
| 696 |
+
|
| 697 |
+
// 如果达到最大重试次数仍未成功
|
| 698 |
+
if (retryCount >= maxRetries && status === 20) {
|
| 699 |
+
logger.error(`视频生成超时,已尝试 ${retryCount} 次,总耗时约 ${Math.floor(retryCount * 2000 / 1000 / 60)} 分钟`);
|
| 700 |
+
const error = new APIException(EX.API_IMAGE_GENERATION_FAILED, "获取视频生成结果超时,请稍后在即梦官网查看您的视频");
|
| 701 |
+
// 添加历史ID到错误对象,以便在chat.ts中显示
|
| 702 |
+
error.historyId = historyId;
|
| 703 |
+
throw error;
|
| 704 |
+
}
|
| 705 |
+
|
| 706 |
+
// 提取视频URL
|
| 707 |
+
let videoUrl = item_list?.[0]?.video?.transcoded_video?.origin?.video_url;
|
| 708 |
+
|
| 709 |
+
// 如果通过常规路径无法获取视频URL,尝试其他可能的路径
|
| 710 |
+
if (!videoUrl) {
|
| 711 |
+
// 尝试从item_list中的其他可能位置获取
|
| 712 |
+
if (item_list?.[0]?.video?.play_url) {
|
| 713 |
+
videoUrl = item_list[0].video.play_url;
|
| 714 |
+
logger.info(`从play_url获取到视频URL: ${videoUrl}`);
|
| 715 |
+
} else if (item_list?.[0]?.video?.download_url) {
|
| 716 |
+
videoUrl = item_list[0].video.download_url;
|
| 717 |
+
logger.info(`从download_url获取到视频URL: ${videoUrl}`);
|
| 718 |
+
} else if (item_list?.[0]?.video?.url) {
|
| 719 |
+
videoUrl = item_list[0].video.url;
|
| 720 |
+
logger.info(`从url获取到视频URL: ${videoUrl}`);
|
| 721 |
+
} else {
|
| 722 |
+
// 如果仍然找不到,记录错误并抛出异常
|
| 723 |
+
logger.error(`未能获取视频URL,item_list: ${JSON.stringify(item_list)}`);
|
| 724 |
+
const error = new APIException(EX.API_IMAGE_GENERATION_FAILED, "未能获取视频URL,请稍后在即梦官网查看");
|
| 725 |
+
// 添加历史ID到错误对象,以便在chat.ts中显示
|
| 726 |
+
error.historyId = historyId;
|
| 727 |
+
throw error;
|
| 728 |
+
}
|
| 729 |
+
}
|
| 730 |
+
|
| 731 |
+
logger.info(`视频生成成功,URL: ${videoUrl}`);
|
| 732 |
+
return videoUrl;
|
| 733 |
+
}
|
src/api/routes/chat.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import _ from 'lodash';
|
| 2 |
+
|
| 3 |
+
import Request from '@/lib/request/Request.ts';
|
| 4 |
+
import Response from '@/lib/response/Response.ts';
|
| 5 |
+
import { tokenSplit } from '@/api/controllers/core.ts';
|
| 6 |
+
import { createCompletion, createCompletionStream } from '@/api/controllers/chat.ts';
|
| 7 |
+
|
| 8 |
+
export default {
|
| 9 |
+
|
| 10 |
+
prefix: '/v1/chat',
|
| 11 |
+
|
| 12 |
+
post: {
|
| 13 |
+
|
| 14 |
+
'/completions': async (request: Request) => {
|
| 15 |
+
request
|
| 16 |
+
.validate('body.model', v => _.isUndefined(v) || _.isString(v))
|
| 17 |
+
.validate('body.messages', _.isArray)
|
| 18 |
+
.validate('headers.authorization', _.isString)
|
| 19 |
+
// refresh_token切分
|
| 20 |
+
const tokens = tokenSplit(request.headers.authorization);
|
| 21 |
+
// 随机挑选一个refresh_token
|
| 22 |
+
const token = _.sample(tokens);
|
| 23 |
+
const { model, messages, stream } = request.body;
|
| 24 |
+
if (stream) {
|
| 25 |
+
const stream = await createCompletionStream(messages, token, model);
|
| 26 |
+
return new Response(stream, {
|
| 27 |
+
type: "text/event-stream"
|
| 28 |
+
});
|
| 29 |
+
}
|
| 30 |
+
else
|
| 31 |
+
return await createCompletion(messages, token, model);
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
}
|
src/api/routes/images.ts
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import _ from "lodash";
|
| 2 |
+
|
| 3 |
+
import Request from "@/lib/request/Request.ts";
|
| 4 |
+
import { generateImages, generateImageComposition } from "@/api/controllers/images.ts";
|
| 5 |
+
import { tokenSplit } from "@/api/controllers/core.ts";
|
| 6 |
+
import util from "@/lib/util.ts";
|
| 7 |
+
|
| 8 |
+
export default {
|
| 9 |
+
prefix: "/v1/images",
|
| 10 |
+
|
| 11 |
+
post: {
|
| 12 |
+
"/generations": async (request: Request) => {
|
| 13 |
+
request
|
| 14 |
+
.validate("body.model", v => _.isUndefined(v) || _.isString(v))
|
| 15 |
+
.validate("body.prompt", _.isString)
|
| 16 |
+
.validate("body.negative_prompt", v => _.isUndefined(v) || _.isString(v))
|
| 17 |
+
.validate("body.width", v => _.isUndefined(v) || _.isFinite(v))
|
| 18 |
+
.validate("body.height", v => _.isUndefined(v) || _.isFinite(v))
|
| 19 |
+
.validate("body.sample_strength", v => _.isUndefined(v) || _.isFinite(v))
|
| 20 |
+
.validate("body.response_format", v => _.isUndefined(v) || _.isString(v))
|
| 21 |
+
.validate("headers.authorization", _.isString);
|
| 22 |
+
// refresh_token切分
|
| 23 |
+
const tokens = tokenSplit(request.headers.authorization);
|
| 24 |
+
// 随机挑选一个refresh_token
|
| 25 |
+
const token = _.sample(tokens);
|
| 26 |
+
const {
|
| 27 |
+
model,
|
| 28 |
+
prompt,
|
| 29 |
+
negative_prompt: negativePrompt,
|
| 30 |
+
width,
|
| 31 |
+
height,
|
| 32 |
+
sample_strength: sampleStrength,
|
| 33 |
+
response_format,
|
| 34 |
+
} = request.body;
|
| 35 |
+
const responseFormat = _.defaultTo(response_format, "url");
|
| 36 |
+
const imageUrls = await generateImages(model, prompt, {
|
| 37 |
+
width,
|
| 38 |
+
height,
|
| 39 |
+
sampleStrength,
|
| 40 |
+
negativePrompt,
|
| 41 |
+
}, token);
|
| 42 |
+
let data = [];
|
| 43 |
+
if (responseFormat == "b64_json") {
|
| 44 |
+
data = (
|
| 45 |
+
await Promise.all(imageUrls.map((url) => util.fetchFileBASE64(url)))
|
| 46 |
+
).map((b64) => ({ b64_json: b64 }));
|
| 47 |
+
} else {
|
| 48 |
+
data = imageUrls.map((url) => ({
|
| 49 |
+
url,
|
| 50 |
+
}));
|
| 51 |
+
}
|
| 52 |
+
return {
|
| 53 |
+
created: util.unixTimestamp(),
|
| 54 |
+
data,
|
| 55 |
+
};
|
| 56 |
+
},
|
| 57 |
+
|
| 58 |
+
// 新增图片合成路由
|
| 59 |
+
"/compositions": async (request: Request) => {
|
| 60 |
+
request
|
| 61 |
+
.validate("body.model", v => _.isUndefined(v) || _.isString(v))
|
| 62 |
+
.validate("body.prompt", _.isString)
|
| 63 |
+
.validate("body.images", _.isArray)
|
| 64 |
+
.validate("body.negative_prompt", v => _.isUndefined(v) || _.isString(v))
|
| 65 |
+
.validate("body.width", v => _.isUndefined(v) || _.isFinite(v))
|
| 66 |
+
.validate("body.height", v => _.isUndefined(v) || _.isFinite(v))
|
| 67 |
+
.validate("body.sample_strength", v => _.isUndefined(v) || _.isFinite(v))
|
| 68 |
+
.validate("body.response_format", v => _.isUndefined(v) || _.isString(v))
|
| 69 |
+
.validate("headers.authorization", _.isString);
|
| 70 |
+
|
| 71 |
+
// 验证图片数组
|
| 72 |
+
const { images } = request.body;
|
| 73 |
+
if (!images || images.length === 0) {
|
| 74 |
+
throw new Error("至少需要提供1张输入图片");
|
| 75 |
+
}
|
| 76 |
+
if (images.length > 10) {
|
| 77 |
+
throw new Error("最多支持10张输入图片");
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
// 验证每个图片元素
|
| 81 |
+
images.forEach((image, index) => {
|
| 82 |
+
if (!_.isString(image) && !_.isObject(image)) {
|
| 83 |
+
throw new Error(`图片 ${index + 1} 格式不正确:应为URL字符串或包含url字段的对象`);
|
| 84 |
+
}
|
| 85 |
+
if (_.isObject(image) && !image.url) {
|
| 86 |
+
throw new Error(`图片 ${index + 1} 缺少url字段`);
|
| 87 |
+
}
|
| 88 |
+
});
|
| 89 |
+
|
| 90 |
+
// refresh_token切分
|
| 91 |
+
const tokens = tokenSplit(request.headers.authorization);
|
| 92 |
+
// 随机挑选一个refresh_token
|
| 93 |
+
const token = _.sample(tokens);
|
| 94 |
+
|
| 95 |
+
const {
|
| 96 |
+
model,
|
| 97 |
+
prompt,
|
| 98 |
+
negative_prompt: negativePrompt,
|
| 99 |
+
width = 2560,
|
| 100 |
+
height = 1440,
|
| 101 |
+
sample_strength: sampleStrength,
|
| 102 |
+
response_format,
|
| 103 |
+
} = request.body;
|
| 104 |
+
|
| 105 |
+
// 提取图片URL
|
| 106 |
+
const imageUrls = images.map(img => _.isString(img) ? img : img.url);
|
| 107 |
+
|
| 108 |
+
const responseFormat = _.defaultTo(response_format, "url");
|
| 109 |
+
const resultUrls = await generateImageComposition(model, prompt, imageUrls, {
|
| 110 |
+
width,
|
| 111 |
+
height,
|
| 112 |
+
sampleStrength,
|
| 113 |
+
negativePrompt,
|
| 114 |
+
}, token);
|
| 115 |
+
|
| 116 |
+
let data = [];
|
| 117 |
+
if (responseFormat == "b64_json") {
|
| 118 |
+
data = (
|
| 119 |
+
await Promise.all(resultUrls.map((url) => util.fetchFileBASE64(url)))
|
| 120 |
+
).map((b64) => ({ b64_json: b64 }));
|
| 121 |
+
} else {
|
| 122 |
+
data = resultUrls.map((url) => ({
|
| 123 |
+
url,
|
| 124 |
+
}));
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
return {
|
| 128 |
+
created: util.unixTimestamp(),
|
| 129 |
+
data,
|
| 130 |
+
input_images: imageUrls.length,
|
| 131 |
+
composition_type: "multi_image_synthesis",
|
| 132 |
+
};
|
| 133 |
+
},
|
| 134 |
+
},
|
| 135 |
+
};
|
src/api/routes/index.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import fs from 'fs-extra';
|
| 2 |
+
|
| 3 |
+
import Response from '@/lib/response/Response.ts';
|
| 4 |
+
import images from "./images.ts";
|
| 5 |
+
import chat from "./chat.ts";
|
| 6 |
+
import ping from "./ping.ts";
|
| 7 |
+
import token from './token.js';
|
| 8 |
+
import models from './models.ts';
|
| 9 |
+
import videos from './videos.ts';
|
| 10 |
+
|
| 11 |
+
export default [
|
| 12 |
+
{
|
| 13 |
+
get: {
|
| 14 |
+
'/': async () => {
|
| 15 |
+
const content = await fs.readFile('public/welcome.html');
|
| 16 |
+
return new Response(content, {
|
| 17 |
+
type: 'html',
|
| 18 |
+
headers: {
|
| 19 |
+
Expires: '-1'
|
| 20 |
+
}
|
| 21 |
+
});
|
| 22 |
+
}
|
| 23 |
+
}
|
| 24 |
+
},
|
| 25 |
+
images,
|
| 26 |
+
chat,
|
| 27 |
+
ping,
|
| 28 |
+
token,
|
| 29 |
+
models,
|
| 30 |
+
videos
|
| 31 |
+
];
|
src/api/routes/models.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import _ from 'lodash';
|
| 2 |
+
|
| 3 |
+
export default {
|
| 4 |
+
|
| 5 |
+
prefix: '/v1',
|
| 6 |
+
|
| 7 |
+
get: {
|
| 8 |
+
'/models': async () => {
|
| 9 |
+
return {
|
| 10 |
+
"data": [
|
| 11 |
+
{
|
| 12 |
+
"id": "jimeng",
|
| 13 |
+
"object": "model",
|
| 14 |
+
"owned_by": "jimeng-free-api"
|
| 15 |
+
},
|
| 16 |
+
{
|
| 17 |
+
"id": "jimeng-video-3.0",
|
| 18 |
+
"object": "model",
|
| 19 |
+
"owned_by": "jimeng-free-api",
|
| 20 |
+
"description": "即梦AI视频生成模型 3.0 版本"
|
| 21 |
+
},
|
| 22 |
+
{
|
| 23 |
+
"id": "jimeng-video-3.0-pro",
|
| 24 |
+
"object": "model",
|
| 25 |
+
"owned_by": "jimeng-free-api",
|
| 26 |
+
"description": "即梦AI视频生成模型 3.0 专业版"
|
| 27 |
+
},
|
| 28 |
+
{
|
| 29 |
+
"id": "jimeng-video-2.0",
|
| 30 |
+
"object": "model",
|
| 31 |
+
"owned_by": "jimeng-free-api",
|
| 32 |
+
"description": "即梦AI视频生成模型 2.0 版本"
|
| 33 |
+
},
|
| 34 |
+
{
|
| 35 |
+
"id": "jimeng-video-2.0-pro",
|
| 36 |
+
"object": "model",
|
| 37 |
+
"owned_by": "jimeng-free-api",
|
| 38 |
+
"description": "即梦AI视频生成模型 2.0 专业版"
|
| 39 |
+
}
|
| 40 |
+
]
|
| 41 |
+
};
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
}
|
| 45 |
+
}
|
src/api/routes/ping.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export default {
|
| 2 |
+
prefix: '/ping',
|
| 3 |
+
get: {
|
| 4 |
+
'': async () => "pong"
|
| 5 |
+
}
|
| 6 |
+
}
|
src/api/routes/token.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import _ from 'lodash';
|
| 2 |
+
|
| 3 |
+
import Request from '@/lib/request/Request.ts';
|
| 4 |
+
import Response from '@/lib/response/Response.ts';
|
| 5 |
+
import { getTokenLiveStatus, getCredit, tokenSplit } from '@/api/controllers/core.ts';
|
| 6 |
+
import logger from '@/lib/logger.ts';
|
| 7 |
+
|
| 8 |
+
export default {
|
| 9 |
+
|
| 10 |
+
prefix: '/token',
|
| 11 |
+
|
| 12 |
+
post: {
|
| 13 |
+
|
| 14 |
+
'/check': async (request: Request) => {
|
| 15 |
+
request
|
| 16 |
+
.validate('body.token', _.isString)
|
| 17 |
+
const live = await getTokenLiveStatus(request.body.token);
|
| 18 |
+
return {
|
| 19 |
+
live
|
| 20 |
+
}
|
| 21 |
+
},
|
| 22 |
+
|
| 23 |
+
'/points': async (request: Request) => {
|
| 24 |
+
request
|
| 25 |
+
.validate('headers.authorization', _.isString)
|
| 26 |
+
// refresh_token切分
|
| 27 |
+
const tokens = tokenSplit(request.headers.authorization);
|
| 28 |
+
const points = await Promise.all(tokens.map(async (token) => {
|
| 29 |
+
return {
|
| 30 |
+
token,
|
| 31 |
+
points: await getCredit(token)
|
| 32 |
+
}
|
| 33 |
+
}))
|
| 34 |
+
return points;
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
}
|
src/api/routes/videos.ts
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import _ from 'lodash';
|
| 2 |
+
|
| 3 |
+
import Request from '@/lib/request/Request.ts';
|
| 4 |
+
import Response from '@/lib/response/Response.ts';
|
| 5 |
+
import { tokenSplit } from '@/api/controllers/core.ts';
|
| 6 |
+
import { generateVideo, DEFAULT_MODEL } from '@/api/controllers/videos.ts';
|
| 7 |
+
import util from '@/lib/util.ts';
|
| 8 |
+
|
| 9 |
+
export default {
|
| 10 |
+
|
| 11 |
+
prefix: '/v1/videos',
|
| 12 |
+
|
| 13 |
+
post: {
|
| 14 |
+
|
| 15 |
+
'/generations': async (request: Request) => {
|
| 16 |
+
request
|
| 17 |
+
.validate('body.model', v => _.isUndefined(v) || _.isString(v))
|
| 18 |
+
.validate('body.prompt', _.isString)
|
| 19 |
+
.validate('body.width', v => _.isUndefined(v) || _.isFinite(v))
|
| 20 |
+
.validate('body.height', v => _.isUndefined(v) || _.isFinite(v))
|
| 21 |
+
.validate('body.resolution', v => _.isUndefined(v) || _.isString(v))
|
| 22 |
+
.validate('body.file_paths', v => _.isUndefined(v) || _.isArray(v))
|
| 23 |
+
.validate('body.filePaths', v => _.isUndefined(v) || _.isArray(v))
|
| 24 |
+
.validate('body.response_format', v => _.isUndefined(v) || _.isString(v))
|
| 25 |
+
.validate('headers.authorization', _.isString);
|
| 26 |
+
|
| 27 |
+
// refresh_token切分
|
| 28 |
+
const tokens = tokenSplit(request.headers.authorization);
|
| 29 |
+
// 随机挑选一个refresh_token
|
| 30 |
+
const token = _.sample(tokens);
|
| 31 |
+
|
| 32 |
+
const {
|
| 33 |
+
model = DEFAULT_MODEL,
|
| 34 |
+
prompt,
|
| 35 |
+
width = 1024,
|
| 36 |
+
height = 1024,
|
| 37 |
+
resolution = "720p",
|
| 38 |
+
file_paths = [],
|
| 39 |
+
filePaths = [],
|
| 40 |
+
response_format = "url"
|
| 41 |
+
} = request.body;
|
| 42 |
+
|
| 43 |
+
// 兼容两种参数名格式:file_paths 和 filePaths
|
| 44 |
+
const finalFilePaths = filePaths.length > 0 ? filePaths : file_paths;
|
| 45 |
+
|
| 46 |
+
// 生成视频
|
| 47 |
+
const videoUrl = await generateVideo(
|
| 48 |
+
model,
|
| 49 |
+
prompt,
|
| 50 |
+
{
|
| 51 |
+
width,
|
| 52 |
+
height,
|
| 53 |
+
resolution,
|
| 54 |
+
filePaths: finalFilePaths
|
| 55 |
+
},
|
| 56 |
+
token
|
| 57 |
+
);
|
| 58 |
+
|
| 59 |
+
// 根据response_format返回不同格式的结果
|
| 60 |
+
if (response_format === "b64_json") {
|
| 61 |
+
// 获取视频内容并转换为BASE64
|
| 62 |
+
const videoBase64 = await util.fetchFileBASE64(videoUrl);
|
| 63 |
+
return {
|
| 64 |
+
created: util.unixTimestamp(),
|
| 65 |
+
data: [{
|
| 66 |
+
b64_json: videoBase64,
|
| 67 |
+
revised_prompt: prompt
|
| 68 |
+
}]
|
| 69 |
+
};
|
| 70 |
+
} else {
|
| 71 |
+
// 默认返回URL
|
| 72 |
+
return {
|
| 73 |
+
created: util.unixTimestamp(),
|
| 74 |
+
data: [{
|
| 75 |
+
url: videoUrl,
|
| 76 |
+
revised_prompt: prompt
|
| 77 |
+
}]
|
| 78 |
+
};
|
| 79 |
+
}
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
}
|
src/daemon.ts
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* 守护进程
|
| 3 |
+
*/
|
| 4 |
+
|
| 5 |
+
import process from 'process';
|
| 6 |
+
import path from 'path';
|
| 7 |
+
import { spawn } from 'child_process';
|
| 8 |
+
|
| 9 |
+
import fs from 'fs-extra';
|
| 10 |
+
import { format as dateFormat } from 'date-fns';
|
| 11 |
+
import 'colors';
|
| 12 |
+
|
| 13 |
+
const CRASH_RESTART_LIMIT = 600; //进程崩溃重启次数限制
|
| 14 |
+
const CRASH_RESTART_DELAY = 5000; //进程崩溃重启延迟
|
| 15 |
+
const LOG_PATH = path.resolve("./logs/daemon.log"); //守护进程日志路径
|
| 16 |
+
let crashCount = 0; //进程崩溃次数
|
| 17 |
+
let currentProcess; //当前运行进程
|
| 18 |
+
|
| 19 |
+
/**
|
| 20 |
+
* 写入守护进程日志
|
| 21 |
+
*/
|
| 22 |
+
function daemonLog(value, color?: string) {
|
| 23 |
+
try {
|
| 24 |
+
const head = `[daemon][${dateFormat(new Date(), "yyyy-MM-dd HH:mm:ss.SSS")}] `;
|
| 25 |
+
value = head + value;
|
| 26 |
+
console.log(color ? value[color] : value);
|
| 27 |
+
fs.ensureDirSync(path.dirname(LOG_PATH));
|
| 28 |
+
fs.appendFileSync(LOG_PATH, value + "\n");
|
| 29 |
+
}
|
| 30 |
+
catch(err) {
|
| 31 |
+
console.error("daemon log write error:", err);
|
| 32 |
+
}
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
daemonLog(`daemon pid: ${process.pid}`);
|
| 36 |
+
|
| 37 |
+
function createProcess() {
|
| 38 |
+
const childProcess = spawn("node", ["index.js", ...process.argv.slice(2)]); //启动子进程
|
| 39 |
+
childProcess.stdout.pipe(process.stdout, { end: false }); //将子进程输出管道到当前进程输出
|
| 40 |
+
childProcess.stderr.pipe(process.stderr, { end: false }); //将子进程错误输出管道到当前进程输出
|
| 41 |
+
currentProcess = childProcess; //更新当前进程
|
| 42 |
+
daemonLog(`process(${childProcess.pid}) has started`);
|
| 43 |
+
childProcess.on("error", err => daemonLog(`process(${childProcess.pid}) error: ${err.stack}`, "red"));
|
| 44 |
+
childProcess.on("close", code => {
|
| 45 |
+
if(code === 0) //进程正常退出
|
| 46 |
+
daemonLog(`process(${childProcess.pid}) has exited`);
|
| 47 |
+
else if(code === 2) //进程已被杀死
|
| 48 |
+
daemonLog(`process(${childProcess.pid}) has been killed!`, "bgYellow");
|
| 49 |
+
else if(code === 3) { //进程主动重启
|
| 50 |
+
daemonLog(`process(${childProcess.pid}) has restart`, "yellow");
|
| 51 |
+
createProcess(); //重新创建进程
|
| 52 |
+
}
|
| 53 |
+
else { //进程发生崩溃
|
| 54 |
+
if(crashCount++ < CRASH_RESTART_LIMIT) { //进程崩溃次数未达重启次数上限前尝试重启
|
| 55 |
+
daemonLog(`process(${childProcess.pid}) has crashed! delay ${CRASH_RESTART_DELAY}ms try restarting...(${crashCount})`, "bgRed");
|
| 56 |
+
setTimeout(() => createProcess(), CRASH_RESTART_DELAY); //延迟指定时长后再重启
|
| 57 |
+
}
|
| 58 |
+
else //进程已崩溃,且无法重启
|
| 59 |
+
daemonLog(`process(${childProcess.pid}) has crashed! unable to restart`, "bgRed");
|
| 60 |
+
}
|
| 61 |
+
}); //子进程关闭监听
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
process.on("exit", code => {
|
| 65 |
+
if(code === 0)
|
| 66 |
+
daemonLog("daemon process exited");
|
| 67 |
+
else if(code === 2)
|
| 68 |
+
daemonLog("daemon process has been killed!");
|
| 69 |
+
}); //守护进程退出事件
|
| 70 |
+
|
| 71 |
+
process.on("SIGTERM", () => {
|
| 72 |
+
daemonLog("received kill signal", "yellow");
|
| 73 |
+
currentProcess && currentProcess.kill("SIGINT");
|
| 74 |
+
process.exit(2);
|
| 75 |
+
}); //kill退出守护进程
|
| 76 |
+
|
| 77 |
+
process.on("SIGINT", () => {
|
| 78 |
+
currentProcess && currentProcess.kill("SIGINT");
|
| 79 |
+
process.exit(0);
|
| 80 |
+
}); //主动退出守护进程
|
| 81 |
+
|
| 82 |
+
createProcess(); //创建进程
|
src/index.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
import environment from "@/lib/environment.ts";
|
| 4 |
+
import config from "@/lib/config.ts";
|
| 5 |
+
import "@/lib/initialize.ts";
|
| 6 |
+
import server from "@/lib/server.ts";
|
| 7 |
+
import routes from "@/api/routes/index.ts";
|
| 8 |
+
import logger from "@/lib/logger.ts";
|
| 9 |
+
|
| 10 |
+
const startupTime = performance.now();
|
| 11 |
+
|
| 12 |
+
(async () => {
|
| 13 |
+
logger.header();
|
| 14 |
+
|
| 15 |
+
logger.info("<<<< jimeng free server >>>>");
|
| 16 |
+
logger.info("Version:", environment.package.version);
|
| 17 |
+
logger.info("Process id:", process.pid);
|
| 18 |
+
logger.info("Environment:", environment.env);
|
| 19 |
+
logger.info("Service name:", config.service.name);
|
| 20 |
+
|
| 21 |
+
server.attachRoutes(routes);
|
| 22 |
+
await server.listen();
|
| 23 |
+
|
| 24 |
+
config.service.bindAddress &&
|
| 25 |
+
logger.success("Service bind address:", config.service.bindAddress);
|
| 26 |
+
})()
|
| 27 |
+
.then(() =>
|
| 28 |
+
logger.success(
|
| 29 |
+
`Service startup completed (${Math.floor(performance.now() - startupTime)}ms)`
|
| 30 |
+
)
|
| 31 |
+
)
|
| 32 |
+
.catch((err) => console.error(err));
|
src/lib/config.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import serviceConfig from "./configs/service-config.ts";
|
| 2 |
+
import systemConfig from "./configs/system-config.ts";
|
| 3 |
+
|
| 4 |
+
class Config {
|
| 5 |
+
|
| 6 |
+
/** 服务配置 */
|
| 7 |
+
service = serviceConfig;
|
| 8 |
+
|
| 9 |
+
/** 系统配置 */
|
| 10 |
+
system = systemConfig;
|
| 11 |
+
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
export default new Config();
|
src/lib/configs/service-config.ts
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import path from 'path';
|
| 2 |
+
|
| 3 |
+
import fs from 'fs-extra';
|
| 4 |
+
import yaml from 'yaml';
|
| 5 |
+
import _ from 'lodash';
|
| 6 |
+
|
| 7 |
+
import environment from '../environment.ts';
|
| 8 |
+
import util from '../util.ts';
|
| 9 |
+
|
| 10 |
+
const CONFIG_PATH = path.join(path.resolve(), 'configs/', environment.env, "/service.yml");
|
| 11 |
+
|
| 12 |
+
/**
|
| 13 |
+
* 服务配置
|
| 14 |
+
*/
|
| 15 |
+
export class ServiceConfig {
|
| 16 |
+
|
| 17 |
+
/** 服务名称 */
|
| 18 |
+
name: string;
|
| 19 |
+
/** @type {string} 服务绑定主机地址 */
|
| 20 |
+
host;
|
| 21 |
+
/** @type {number} 服务绑定端口 */
|
| 22 |
+
port;
|
| 23 |
+
/** @type {string} 服务路由前缀 */
|
| 24 |
+
urlPrefix;
|
| 25 |
+
/** @type {string} 服务绑定地址(外部访问地址) */
|
| 26 |
+
bindAddress;
|
| 27 |
+
|
| 28 |
+
constructor(options?: any) {
|
| 29 |
+
const { name, host, port, urlPrefix, bindAddress } = options || {};
|
| 30 |
+
this.name = _.defaultTo(name, 'jimeng-free-api');
|
| 31 |
+
this.host = _.defaultTo(host, '0.0.0.0');
|
| 32 |
+
this.port = _.defaultTo(port, 5566);
|
| 33 |
+
this.urlPrefix = _.defaultTo(urlPrefix, '');
|
| 34 |
+
this.bindAddress = bindAddress;
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
get addressHost() {
|
| 38 |
+
if(this.bindAddress) return this.bindAddress;
|
| 39 |
+
const ipAddresses = util.getIPAddressesByIPv4();
|
| 40 |
+
for(let ipAddress of ipAddresses) {
|
| 41 |
+
if(ipAddress === this.host)
|
| 42 |
+
return ipAddress;
|
| 43 |
+
}
|
| 44 |
+
return ipAddresses[0] || "127.0.0.1";
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
get address() {
|
| 48 |
+
return `${this.addressHost}:${this.port}`;
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
get pageDirUrl() {
|
| 52 |
+
return `http://127.0.0.1:${this.port}/page`;
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
get publicDirUrl() {
|
| 56 |
+
return `http://127.0.0.1:${this.port}/public`;
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
static load() {
|
| 60 |
+
const external = _.pickBy(environment, (v, k) => ["name", "host", "port"].includes(k) && !_.isUndefined(v));
|
| 61 |
+
if(!fs.pathExistsSync(CONFIG_PATH)) return new ServiceConfig(external);
|
| 62 |
+
const data = yaml.parse(fs.readFileSync(CONFIG_PATH).toString());
|
| 63 |
+
return new ServiceConfig({ ...data, ...external });
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
export default ServiceConfig.load();
|
src/lib/configs/system-config.ts
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import path from 'path';
|
| 2 |
+
|
| 3 |
+
import fs from 'fs-extra';
|
| 4 |
+
import yaml from 'yaml';
|
| 5 |
+
import _ from 'lodash';
|
| 6 |
+
|
| 7 |
+
import environment from '../environment.ts';
|
| 8 |
+
|
| 9 |
+
const CONFIG_PATH = path.join(path.resolve(), 'configs/', environment.env, "/system.yml");
|
| 10 |
+
|
| 11 |
+
/**
|
| 12 |
+
* 系统配置
|
| 13 |
+
*/
|
| 14 |
+
export class SystemConfig {
|
| 15 |
+
|
| 16 |
+
/** 是否开启请求日志 */
|
| 17 |
+
requestLog: boolean;
|
| 18 |
+
/** 临时目录路径 */
|
| 19 |
+
tmpDir: string;
|
| 20 |
+
/** 日志目录路径 */
|
| 21 |
+
logDir: string;
|
| 22 |
+
/** 日志写入间隔(毫秒) */
|
| 23 |
+
logWriteInterval: number;
|
| 24 |
+
/** 日志文件有效期(毫秒) */
|
| 25 |
+
logFileExpires: number;
|
| 26 |
+
/** 公共目录路径 */
|
| 27 |
+
publicDir: string;
|
| 28 |
+
/** 临时文件有效期(毫秒) */
|
| 29 |
+
tmpFileExpires: number;
|
| 30 |
+
/** 请求体配置 */
|
| 31 |
+
requestBody: any;
|
| 32 |
+
/** 是否调试模式 */
|
| 33 |
+
debug: boolean;
|
| 34 |
+
|
| 35 |
+
constructor(options?: any) {
|
| 36 |
+
const { requestLog, tmpDir, logDir, logWriteInterval, logFileExpires, publicDir, tmpFileExpires, requestBody, debug } = options || {};
|
| 37 |
+
this.requestLog = _.defaultTo(requestLog, false);
|
| 38 |
+
this.tmpDir = _.defaultTo(tmpDir, './tmp');
|
| 39 |
+
this.logDir = _.defaultTo(logDir, './logs');
|
| 40 |
+
this.logWriteInterval = _.defaultTo(logWriteInterval, 200);
|
| 41 |
+
this.logFileExpires = _.defaultTo(logFileExpires, 2626560000);
|
| 42 |
+
this.publicDir = _.defaultTo(publicDir, './public');
|
| 43 |
+
this.tmpFileExpires = _.defaultTo(tmpFileExpires, 86400000);
|
| 44 |
+
this.requestBody = Object.assign(requestBody || {}, {
|
| 45 |
+
enableTypes: ['form', 'text', 'xml'], // 移除 json,由自定义中间件处理
|
| 46 |
+
encoding: 'utf-8',
|
| 47 |
+
formLimit: '100mb',
|
| 48 |
+
jsonLimit: '100mb',
|
| 49 |
+
textLimit: '100mb',
|
| 50 |
+
xmlLimit: '100mb',
|
| 51 |
+
formidable: {
|
| 52 |
+
maxFileSize: '100mb'
|
| 53 |
+
},
|
| 54 |
+
multipart: true,
|
| 55 |
+
parsedMethods: ['POST', 'PUT', 'PATCH']
|
| 56 |
+
});
|
| 57 |
+
this.debug = _.defaultTo(debug, true);
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
get rootDirPath() {
|
| 61 |
+
return path.resolve();
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
get tmpDirPath() {
|
| 65 |
+
return path.resolve(this.tmpDir);
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
get logDirPath() {
|
| 69 |
+
return path.resolve(this.logDir);
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
get publicDirPath() {
|
| 73 |
+
return path.resolve(this.publicDir);
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
static load() {
|
| 77 |
+
if (!fs.pathExistsSync(CONFIG_PATH)) return new SystemConfig();
|
| 78 |
+
const data = yaml.parse(fs.readFileSync(CONFIG_PATH).toString());
|
| 79 |
+
return new SystemConfig(data);
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
export default SystemConfig.load();
|
src/lib/consts/exceptions.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export default {
|
| 2 |
+
SYSTEM_ERROR: [-1000, '系统异常'],
|
| 3 |
+
SYSTEM_REQUEST_VALIDATION_ERROR: [-1001, '请求参数校验错误'],
|
| 4 |
+
SYSTEM_NOT_ROUTE_MATCHING: [-1002, '无匹配的路由']
|
| 5 |
+
} as Record<string, [number, string]>
|
src/lib/environment.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import path from 'path';
|
| 2 |
+
|
| 3 |
+
import fs from 'fs-extra';
|
| 4 |
+
import minimist from 'minimist';
|
| 5 |
+
import _ from 'lodash';
|
| 6 |
+
|
| 7 |
+
const cmdArgs = minimist(process.argv.slice(2)); //获取命令行参数
|
| 8 |
+
const envVars = process.env; //获取环境变量
|
| 9 |
+
|
| 10 |
+
class Environment {
|
| 11 |
+
|
| 12 |
+
/** 命令行参数 */
|
| 13 |
+
cmdArgs: any;
|
| 14 |
+
/** 环境变量 */
|
| 15 |
+
envVars: any;
|
| 16 |
+
/** 环境名称 */
|
| 17 |
+
env?: string;
|
| 18 |
+
/** 服务名称 */
|
| 19 |
+
name?: string;
|
| 20 |
+
/** 服务地址 */
|
| 21 |
+
host?: string;
|
| 22 |
+
/** 服务端口 */
|
| 23 |
+
port?: number;
|
| 24 |
+
/** 包参数 */
|
| 25 |
+
package: any;
|
| 26 |
+
|
| 27 |
+
constructor(options: any = {}) {
|
| 28 |
+
const { cmdArgs, envVars, package: _package } = options;
|
| 29 |
+
this.cmdArgs = cmdArgs;
|
| 30 |
+
this.envVars = envVars;
|
| 31 |
+
this.env = _.defaultTo(cmdArgs.env || envVars.SERVER_ENV, 'dev');
|
| 32 |
+
this.name = cmdArgs.name || envVars.SERVER_NAME || undefined;
|
| 33 |
+
this.host = cmdArgs.host || envVars.SERVER_HOST || undefined;
|
| 34 |
+
this.port = Number(cmdArgs.port || envVars.SERVER_PORT) ? Number(cmdArgs.port || envVars.SERVER_PORT) : undefined;
|
| 35 |
+
this.package = _package;
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
export default new Environment({
|
| 41 |
+
cmdArgs,
|
| 42 |
+
envVars,
|
| 43 |
+
package: JSON.parse(fs.readFileSync(path.join(path.resolve(), "package.json")).toString())
|
| 44 |
+
});
|
src/lib/exceptions/APIException.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Exception from './Exception.js';
|
| 2 |
+
|
| 3 |
+
export default class APIException extends Exception {
|
| 4 |
+
|
| 5 |
+
/**
|
| 6 |
+
* 构造异常
|
| 7 |
+
*
|
| 8 |
+
* @param {[number, string]} exception 异常
|
| 9 |
+
*/
|
| 10 |
+
constructor(exception: (string | number)[], errmsg?: string) {
|
| 11 |
+
super(exception, errmsg);
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
}
|
src/lib/exceptions/Exception.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import assert from 'assert';
|
| 2 |
+
|
| 3 |
+
import _ from 'lodash';
|
| 4 |
+
|
| 5 |
+
export default class Exception extends Error {
|
| 6 |
+
|
| 7 |
+
/** 错误码 */
|
| 8 |
+
errcode: number;
|
| 9 |
+
/** 错误消息 */
|
| 10 |
+
errmsg: string;
|
| 11 |
+
/** 数据 */
|
| 12 |
+
data: any;
|
| 13 |
+
/** HTTP状态码 */
|
| 14 |
+
httpStatusCode: number;
|
| 15 |
+
|
| 16 |
+
/**
|
| 17 |
+
* 构造异常
|
| 18 |
+
*
|
| 19 |
+
* @param exception 异常
|
| 20 |
+
* @param _errmsg 异常消息
|
| 21 |
+
*/
|
| 22 |
+
constructor(exception: (string | number)[], _errmsg?: string) {
|
| 23 |
+
assert(_.isArray(exception), 'Exception must be Array');
|
| 24 |
+
const [errcode, errmsg] = exception as [number, string];
|
| 25 |
+
assert(_.isFinite(errcode), 'Exception errcode invalid');
|
| 26 |
+
assert(_.isString(errmsg), 'Exception errmsg invalid');
|
| 27 |
+
super(_errmsg || errmsg);
|
| 28 |
+
this.errcode = errcode;
|
| 29 |
+
this.errmsg = _errmsg || errmsg;
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
compare(exception: (string | number)[]) {
|
| 33 |
+
const [errcode] = exception as [number, string];
|
| 34 |
+
return this.errcode == errcode;
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
setHTTPStatusCode(value: number) {
|
| 38 |
+
this.httpStatusCode = value;
|
| 39 |
+
return this;
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
setData(value: any) {
|
| 43 |
+
this.data = _.defaultTo(value, null);
|
| 44 |
+
return this;
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
}
|
src/lib/http-status-codes.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export default {
|
| 2 |
+
|
| 3 |
+
CONTINUE: 100, //客户端应当继续发送请求。这个临时响应是用来通知客户端它的部分请求已经被服务器接收,且仍未被拒绝。客户端应当继续发送请求的剩余部分,或者如果请求已经完成,忽略这个响应。服务器必须在请求完成后向客户端发送一个最终响应
|
| 4 |
+
SWITCHING_PROTOCOLS: 101, //服务器已经理解了客户端的请求,并将通过Upgrade 消息头通知客户端采用不同的协议来完成这个请求。在发送完这个响应最后的空行后,服务器将会切换到在Upgrade 消息头中定义的那些协议。只有在切换新的协议更有好处的时候才应该采取类似措施。例如,切换到新的HTTP 版本比旧版本更有优势,或者切换到一个实时且同步的协议以传送利用此类特性的资源
|
| 5 |
+
PROCESSING: 102, //处理将被继续执行
|
| 6 |
+
|
| 7 |
+
OK: 200, //请求已成功,请求所希望的响应头或数据体将随此响应返回
|
| 8 |
+
CREATED: 201, //请求已经被实现,而且有一个新的资源已经依据请求的需要而建立,且其 URI 已经随Location 头信息返回。假如需要的资源无法及时建立的话,应当返回 '202 Accepted'
|
| 9 |
+
ACCEPTED: 202, //服务器已接受请求,但尚未处理。正如它可能被拒绝一样,最终该请求可能会也可能不会被执行。在异步操作的场合下,没有比发送这个状态码更方便的做法了。返回202状态码的响应的目的是允许服务器接受其他过程的请求(例如某个每天只执行一次的基于批处理的操作),而不必让客户端一直保持与服务器的连接直到批处理操作全部完成。在接受请求处理并返回202状态码的响应应当在返回的实体中包含一些指示处理当前状态的信息,以及指向处理状态监视器或状态预测的指针,以便用户能够估计操作是否已经完成
|
| 10 |
+
NON_AUTHORITATIVE_INFO: 203, //服务器已成功处理了请求,但返回的实体头部元信息不是在原始服务器上有效的确定集合,而是来自本地或者第三方的拷贝。当前的信息可能是原始版本的子集或者超集。例如,包含资源的元数据可能导致原始服务器知道元信息的超级。使用此状态码不是必须的,而且只有在响应不使用此状态码便会返回200 OK的情况下才是合适的
|
| 11 |
+
NO_CONTENT: 204, //服务器成功处理了请求,但不需要返回任何实体内容,并且希望返回更新了的元信息。响应可能通过实体头部的形式,返回新的或更新后的元信息。如果存在这些头部信息,则应当与所请求的变量相呼应。如果客户端是浏览器的话,那么用户浏览器应保留发送了该请求的页面,而不产生任何文档视图上的变化,即使按照规范新的或更新后的元信息应当被应用到用户浏览器活动视图中的文档。由于204响应被禁止包含任何消息体,因此它始终以消息头后的第一个空行结尾
|
| 12 |
+
RESET_CONTENT: 205, //服务器成功处理了请求,且没有返回任何内容。但是与204响应不同,返回此状态码的响应要求请求者重置文档视图。该响应主要是被用于接受用户输入后,立即重置表单,以便用户能够轻松地开始另一次输入。与204响应一样,该响应也被禁止包含任何消息体,且以消息头后的第一个空行结束
|
| 13 |
+
PARTIAL_CONTENT: 206, //服务器已经成功处理了部分 GET 请求。类似于FlashGet或者迅雷这类的HTTP下载工具都是使用此类响应实现断点续传或者将一个大文档分解为多个下载段同时下载。该请求必须包含 Range 头信息来指示客户端希望得到的内容范围,并且可能包含 If-Range 来作为请求条件。响应必须包含如下的头部域:Content-Range 用以指示本次响应中返回的内容的范围;如果是Content-Type为multipart/byteranges的多段下载,则每一段multipart中都应包含Content-Range域用以指示本段的内容范围。假如响应中包含Content-Length,那么它的数值必须匹配它返回的内容范围的真实字节数。Date和ETag或Content-Location,假如同样的请求本应该返回200响应。Expires, Cache-Control,和/或 Vary,假如其值可能与之前相同变量的其他响应对应的值不同的话。假如本响应请求使用了 If-Range 强缓存验证,那么本次响应不应该包含其他实体头;假如本响应的请求使用了 If-Range 弱缓存验证,那么本次响应禁止包含其他实体头;这避免了缓存的实体内容和更新了的实体头信息之间的不一致。否则,本响应就应当包含所有本应该返回200响应中应当返回的所有实体头部域。假如 ETag 或 Latest-Modified 头部不能精确匹配的话,则客户端缓存应禁止将206响应返回的内容与之前任何缓存过的内容组合在一起。任何不支持 Range 以及 Content-Range 头的缓存都禁止缓存206响应返���的内容
|
| 14 |
+
MULTIPLE_STATUS: 207, //代表之后的消息体将是一个XML消息,并且可能依照之前子请求数量的不同,包含一系列独立的响应代码
|
| 15 |
+
|
| 16 |
+
MULTIPLE_CHOICES: 300, //被请求的资源有一系列可供选择的回馈信息,每个都有自己特定的地址和浏览器驱动的商议信息。用户或浏览器能够自行选择一个首选的地址进行重定向。除非这是一个HEAD请求,否则该响应应当包括一个资源特性及地址的列表的实体,以便用户或浏览器从中选择最合适的重定向地址。这个实体的格式由Content-Type定义的格式所决定。浏览器可能根据响应的格式以及浏览器自身能力,自动作出最合适的选择。当然,RFC 2616规范并没有规定这样的自动选择该如何进行。如果服务器本身已经有了首选的回馈选择,那么在Location中应当指明这个回馈的 URI;浏览器可能会将这个 Location 值作为自动重定向的地址。此外,除非额外指定,否则这个响应也是可缓存的
|
| 17 |
+
MOVED_PERMANENTLY: 301, //被请求的资源已永久移动到新位置,并且将来任何对此资源的引用都应该使用本响应返回的若干个URI之一。如果可能,拥有链接编辑功能的客户端应当自动把请求的地址修改为从服务器反馈回来的地址。除非额外指定,否则这个响应也是可缓存的。新的永久性的URI应当在响应的Location域中返回。除非这是一个HEAD请求,否则响应的实体中应当包含指向新的URI的超链接及简短说明。如果这不是一个GET或者HEAD请求,因此浏览器禁止自动进行重定向,除非得到用户的确认,因为请求的条件可能因此发生变化。注意:对于某些使用 HTTP/1.0 协议的浏览器,当它们发送的POST请求得到了一个301响应的话,接下来的重定向请求将会变成GET方式
|
| 18 |
+
FOUND: 302, //请求的资源现在临时从不同的URI响应请求。由于这样的重定向是临时的,客户端应当继续向原有地址发送以后的请求。只有在Cache-Control或Expires中进行了指定的情况下,这个响应才是可缓存的。新的临时性的URI应当在响应的 Location 域中返回。除非这是一个HEAD请求,否则响应的实体中应当包含指向新的URI的超链接及简短说明。如果这不是一个GET或者HEAD请求,那么浏览器禁止自动进行重定向,除非得到用户的确认,因为请求的条件可能因此发生变化。注意:虽然RFC 1945和RFC 2068规范不允许客户端在重定向时改变请求的方法,但是很多现存的浏览器将302响应视作为303响应,并且使用GET方式访问在Location中规定的URI,而无视原先请求的方法。状态码303和307被添加了进来,用以明确服务器期待客户端进行何种反应
|
| 19 |
+
SEE_OTHER: 303, //对应当前请求的响应可以在另一个URI上被找到,而且客户端应当采用 GET 的方式访问那个资源。这个方法的存在主要是为了允许由脚本激活的POST请求输出重定向到一个新的资源。这个新的 URI 不是原始资源的替代引用。同时,303响应禁止被缓存。当然,第二个请求(重定向)可能被缓存。新的 URI 应当在响应的Location域中返回。除非这是一个HEAD请求,否则响应的实体中应当包含指向新的URI的超链接及简短说明。注意:许多 HTTP/1.1 版以前的浏览器不能正确理解303状态。如果需要考虑与这些浏览器之间的互动,302状态码应该可以胜任,因为大多数的浏览器处理302响应时的方式恰恰就是上述规范要求客户端处理303响应时应当做的
|
| 20 |
+
NOT_MODIFIED: 304, //如果客户端发送了一个带条件的GET请求且该请求已被允许,而文档的内容(自上次访问以来或者根据请求的条件)并没有改变,则服务器应当返回这个状态码。304响应禁止包含消息体,因此始终以消息头后的第一个空行结尾。该响应必须包含以下的头信息:Date,除非这个服务器没有时钟。假如没有时钟的服务器也遵守这些规则,那么代理服务器以及客户端可以自行将Date字段添加到接收到的响应头中去(正如RFC 2068中规定的一样),缓存机制将会正常工作。ETag或 Content-Location,假如同样的请求本应返回200响应。Expires, Cache-Control,和/或Vary,假如其值可能与之前相同变量的其他响应对应的值不同的话。假如本响应请求使用了强缓存验证,那么本次响应不应该包含其他实体头;否则(例如,某个带条件的 GET 请求使用了弱缓存验证),本次响应禁止包含其他实体头;这避免了缓存了的实体内容和更新了的实体头信息之间的不一致。假如某个304响应指明了当前某个实体没有缓存,那么缓存系统必须忽视这个响应,并且重复发送不包含限制条件的请求。假如接收到一个要求更新某个缓存条目的304响应,那么缓存系统必须更新整个条目以反映所有在响应中被更新的字段的值
|
| 21 |
+
USE_PROXY: 305, //被请求的资源必须通过指定的代理才能被访问。Location域中将给出指定的代理所在的URI信息,接收者需要重复发送一个单独的请求,通过这个代理才能访问相应资源。只有原始服务器才能建立305响应。注意:RFC 2068中没有明确305响应是为了重定向一个单独的请求,而且只能被原始服务器建立。忽视这些限制可能导致严重的安全后果
|
| 22 |
+
UNUSED: 306, //在最新版的规范中,306状态码已经不再被使用
|
| 23 |
+
TEMPORARY_REDIRECT: 307, //请求的资源现在临时从不同的URI 响应请求。由于这样的重定向是临时的,客户端应当继续向原有地址发送以后的请求。只有在Cache-Control或Expires中进行了指定的情况下,这个响应才是可缓存的。新的临时性的URI 应当在响应的Location域中返回。除非这是一个HEAD请求,否则响应的实体中应当包含指向新的URI 的超链接及简短说明。因为部分浏览器不能识别307响应,因此需要添加上述必要信息以便用户能够理解并向新的 URI 发出访问请求。如果这不是一个GET或者HEAD请求,那么浏览器禁止自动进行重定向,除非得到用户的确认,因为请求的条件可能因此发生变化
|
| 24 |
+
|
| 25 |
+
BAD_REQUEST: 400, //1.语义有误,当前请求无法被服务器理解。除非进行修改,否则客户端不应该重复提交这个请求 2.请求参数有误
|
| 26 |
+
UNAUTHORIZED: 401, //当前请求需要用户验证。该响应必须包含一个适用于被请求资源的 WWW-Authenticate 信息头用以询问用户信息。客户端可以重复提交一个包含恰当的 Authorization 头信息的请求。如果当前请求已经包含了 Authorization 证书,那么401响应代表着服务器验证已经拒绝了那些证书。如果401响应包含了与前一个响应相同的身份验证询问,且浏览器已经至少尝试了一次验证,那么浏览器应当向用户展示响应中包含的实体信息,因为这个实体信息中可能包含了相关诊断信息。参见RFC 2617
|
| 27 |
+
PAYMENT_REQUIRED: 402, //该状态码是为了将来可能的需求而预留的
|
| 28 |
+
FORBIDDEN: 403, //服务器已经理解请求,但是拒绝执行它。与401响应不同的是,身份验证并不能提供任何帮助,而且这个请求也不应该被重复提交。如果这不是一个HEAD请求,而且服务器希望能够讲清楚为何请求不能被执行,那么就应该在实体内描述拒绝的原因。当然服务器也可以返回一个404响应,假如它不希望让客户端获得任何信息
|
| 29 |
+
NOT_FOUND: 404, //请求失败,请求所希望得到的资源未被在服务器上发现。没有信息能够告诉用户这个状况到底是暂时的还是永久的。假如服务器知道情况的话,应当使用410状态码来告知旧资源因为某些内部的配置机制问题,已经永久的不可用,而且没有任何可以跳转的地址。404这个状态码被广泛应用于当服务器不想揭示到底为何请求被拒绝或者没有其他适合的响应可用的情况下
|
| 30 |
+
METHOD_NOT_ALLOWED: 405, //请求行中指定的请求方法不能被用于请求相应的资源。该响应必须返回一个Allow 头信息用以表示出当前资源能够接受的请求方法的列表。鉴于PUT,DELETE方法会对服务器上的资源进行写操作,因而绝大部分的网页服务器都不支持或者在默认配置下不允许上述请求方法,对于此类请求均会返回405错误
|
| 31 |
+
NO_ACCEPTABLE: 406, //请求的资源的内容特性无法满足请求头中的条件,因而无法生成响应实体。除非这是一个 HEAD 请求,否则该响应就应当返回一个包含可以让用户或者浏览器从中选择最合适的实体特性以及地址列表的实体。实体的格式由Content-Type头中定义的媒体类型决定。浏览器可以根据格式及自身能力自行作出最佳选择。但是,规范中并没有定义任何作出此类自动选择的标准
|
| 32 |
+
PROXY_AUTHENTICATION_REQUIRED: 407, //与401响应类似,只不过客户端必须在代理服务器上进行身份验证。代理服务器必须返回一个Proxy-Authenticate用以进行身份询问。客户端可以返回一个Proxy-Authorization信息头用以验证。参见RFC 2617
|
| 33 |
+
REQUEST_TIMEOUT: 408, //请求超时。客户端没有在服务器预备等待的时间内完成一个请求的发送。客户端可以随时再次提交这一请求而无需进行任何更改
|
| 34 |
+
CONFLICT: 409, //由于和被请求的资源的当前状态之间存在冲突,请求无法完成。这个代码只允许用在这样的情况下才能被使用:用户被认为能够解决冲突,并且会重新提交新的请求。该响应应当包含足够的信息以便用户发现冲突的源头。冲突通常发生于对PUT请求的处理中。例如,在采用版本检查的环境下,某次PUT提交的对特定资源���修改请求所附带的版本信息与之前的某个(第三方)请求向冲突,那么此时服务器就应该返回一个409错误,告知用户请求无法完成。此时,响应实体中很可能会包含两个冲突版本之间的差异比较,以便用户重新提交归并以后的新版本
|
| 35 |
+
GONE: 410, //被请求的资源在服务器上已经不再可用,而且没有任何已知的转发地址。这样的状况应当被认为是永久性的。如果可能,拥有链接编辑功能的客户端应当在获得用户许可后删除所有指向这个地址的引用。如果服务器不知道或者无法确定这个状况是否是永久的,那么就应该使用404状态码。除非额外说明,否则这个响应是可缓存的。410响应的目的主要是帮助网站管理员维护网站,通知用户该资源已经不再可用,并且服务器拥有者希望所有指向这个资源的远端连接也被删除。这类事件在限时、增值服务中很普遍。同样,410响应也被用于通知客户端在当前服务器站点上,原本属于某个个人的资源已经不再可用。当然,是否需要把所有永久不可用的资源标记为'410 Gone',以及是否需要保持此标记多长时间,完全取决于服务器拥有者
|
| 36 |
+
LENGTH_REQUIRED: 411, //服务器拒绝在没有定义Content-Length头的情况下接受请求。在添加了表明请求消息体长度的有效Content-Length头之后,客户端可以再次提交该请求
|
| 37 |
+
PRECONDITION_FAILED: 412, //服务器在验证在请求的头字段中给出先决条件时,没能满足其中的一个或多个。这个状态码允许客户端在获取资源时在请求的元信息(请求头字段数据)中设置先决条件,以此避免该请求方法被应用到其希望的内容以外的资源上
|
| 38 |
+
REQUEST_ENTITY_TOO_LARGE: 413, //服务器拒绝处理当前请求,因为该请求提交的实体数据大小超过了服务器愿意或者能够处理的范围。此种情况下,服务器可以关闭连接以免客户端继续发送此请求。如果这个状况是临时的,服务器应当返回一个 Retry-After 的响应头,以告知客户端可以在多少时间以后重新尝试
|
| 39 |
+
REQUEST_URI_TOO_LONG: 414, //请求的URI长度超过了服务器能够解释的长度,因此服务器拒绝对该请求提供服务。这比较少见,通常的情况包括:本应使用POST方法的表单提交变成了GET方法,导致查询字符串(Query String)过长。重定向URI “黑洞”,例如每次重定向把旧的URI作为新的URI的一部分,导致在若干次重定向后URI超长。客户端正在尝试利用某些服务器中存在的安全漏洞攻击服务器。这类服务器使用固定长度的缓冲读取或操作请求的URI,当GET后的参数超过某个数值后,可能会产生缓冲区溢出,导致任意代码被执行[1]。没有此类漏洞的服务器,应当返回414状态码
|
| 40 |
+
UNSUPPORTED_MEDIA_TYPE: 415, //对于当前请求的方法和所请求的资源,请求中提交的实体并不是服务器中所支持的格式,因此请求被拒绝
|
| 41 |
+
REQUESTED_RANGE_NOT_SATISFIABLE: 416, //如果请求中包含了Range请求头,并且Range中指定的任何数据范围都与当前资源的可用范围不重合,同时请求中又没有定义If-Range请求头,那么服务器就应当返回416状态码。假如Range使用的是字节范围,那么这种情况就是指请求指定的所有数据范围的首字节位置都超过了当前资源的长度。服务器也应当在返回416状态码的同时,包含一个Content-Range实体头,用以指明当前资源的长度。这个响应也被禁止使用multipart/byteranges作为其 Content-Type
|
| 42 |
+
EXPECTION_FAILED: 417, //在请求头Expect中指定的预期内容无法被服务器满足,或者这个服务器是一个代理服务器,它有明显的证据证明在当前路由的下一个节点上,Expect的内容无法被满足
|
| 43 |
+
TOO_MANY_CONNECTIONS: 421, //从当前客户端所在的IP地址到服务器的连接数超过了服务器许可的最大范围。通常,这里的IP地址指的是从服务器上看到的客户端地址(比如用户的网关或者代理服务器地址)。在这种情况下,连接数的计算可能涉及到不止一个终端用户
|
| 44 |
+
UNPROCESSABLE_ENTITY: 422, //请求格式正确,但是由于含有语义错误,无法响应
|
| 45 |
+
FAILED_DEPENDENCY: 424, //由于之前的某个请求发生的错误,导致当前请求失败,例如PROPPATCH
|
| 46 |
+
UNORDERED_COLLECTION: 425, //在WebDav Advanced Collections 草案中定义,但是未出现在《WebDAV 顺序集协议》(RFC 3658)中
|
| 47 |
+
UPGRADE_REQUIRED: 426, //客户端应当切换到TLS/1.0
|
| 48 |
+
RETRY_WITH: 449, //由微软扩展,代表请求应当在执行完适当的操作后进行重试
|
| 49 |
+
|
| 50 |
+
INTERNAL_SERVER_ERROR: 500, //服务器遇到了一个未曾预料的状况,导致了它无法完成对请求的处理。一般来说,这个问题都会在服务器的程序码出错时出现
|
| 51 |
+
NOT_IMPLEMENTED: 501, //服务器不支持当前请求所需要的某个功能。当服务器无法识别请求的方法,并且无法支持其对任何资源的请求
|
| 52 |
+
BAD_GATEWAY: 502, //作为网关或者代理工作的服务器尝试执行请求时,从上游服务器接收到无效的响应
|
| 53 |
+
SERVICE_UNAVAILABLE: 503, //由于临时的服务器维护或者过载,服务器当前无法处理请求。这个状况是临时的,并且将在一段时间以后恢复。如果能够预计延迟时间,那么响应中可以包含一个 Retry-After 头用以标明这个延迟时间。如果没有给出这个 Retry-After 信息,那么客户端应当以处理500响应的方式处理它。注意:503状态码的存在并不意味着服务器在过载的时候必须使用它。某些服务器只不过是希望拒绝客户端的连接
|
| 54 |
+
GATEWAY_TIMEOUT: 504, //作为网关或者代理工作的服务器尝试执行请求时,未能及时从上游服务器(URI标识出的服务器,例如HTTP、FTP、LDAP)或者辅助服务器(例如DNS)收到响应。注意:某些代理服务器在DNS查询超时时会返回400或者500错误
|
| 55 |
+
HTTP_VERSION_NOT_SUPPORTED: 505, //服务器不支持,或者拒绝支持在请求中使用的HTTP版本。这暗示着服务器不能或不愿使用与客户端相同的版本。响应中应当包含一个描述了为何版本不被支持以及服务器支持哪些协议的实体
|
| 56 |
+
VARIANT_ALSO_NEGOTIATES: 506, //服务器存在内部配置错误:被请求的协商变元资源被配置为在透明内容协商中使用自己,因此在一个协商处理中不是一个合适的重点
|
| 57 |
+
INSUFFICIENT_STORAGE: 507, //服务器无法存储完成请求所必须的内容。这个状况被认为是临时的
|
| 58 |
+
BANDWIDTH_LIMIT_EXCEEDED: 509, //服务器达到带宽限制。这不是一个官方的状态码,但是仍被广泛使用
|
| 59 |
+
NOT_EXTENDED: 510 //获取资源所需要的策略并没有没满足
|
| 60 |
+
|
| 61 |
+
};
|
src/lib/initialize.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import logger from './logger.js';
|
| 2 |
+
|
| 3 |
+
// 允许无限量的监听器
|
| 4 |
+
process.setMaxListeners(Infinity);
|
| 5 |
+
// 输出未捕获异常
|
| 6 |
+
process.on("uncaughtException", (err, origin) => {
|
| 7 |
+
logger.error(`An unhandled error occurred: ${origin}`, err);
|
| 8 |
+
});
|
| 9 |
+
// 输出未处理的Promise.reject
|
| 10 |
+
process.on("unhandledRejection", (_, promise) => {
|
| 11 |
+
promise.catch(err => logger.error("An unhandled rejection occurred:", err));
|
| 12 |
+
});
|
| 13 |
+
// 输出系统警告信息
|
| 14 |
+
process.on("warning", warning => logger.warn("System warning: ", warning));
|
| 15 |
+
// 进程退出监听
|
| 16 |
+
process.on("exit", () => {
|
| 17 |
+
logger.info("Service exit");
|
| 18 |
+
logger.footer();
|
| 19 |
+
});
|
| 20 |
+
// 进程被kill
|
| 21 |
+
process.on("SIGTERM", () => {
|
| 22 |
+
logger.warn("received kill signal");
|
| 23 |
+
process.exit(2);
|
| 24 |
+
});
|
| 25 |
+
// Ctrl-C进程退出
|
| 26 |
+
process.on("SIGINT", () => {
|
| 27 |
+
process.exit(0);
|
| 28 |
+
});
|
src/lib/interfaces/ICompletionMessage.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export default interface ICompletionMessage {
|
| 2 |
+
role: 'system' | 'assistant' | 'user' | 'function';
|
| 3 |
+
content: string;
|
| 4 |
+
}
|
src/lib/logger.ts
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
import 'colors';
|
| 5 |
+
import _ from 'lodash';
|
| 6 |
+
import fs from 'fs-extra';
|
| 7 |
+
import { format as dateFormat } from 'date-fns';
|
| 8 |
+
|
| 9 |
+
import config from './config.ts';
|
| 10 |
+
import util from './util.ts';
|
| 11 |
+
|
| 12 |
+
const isVercelEnv = process.env.VERCEL;
|
| 13 |
+
|
| 14 |
+
class LogWriter {
|
| 15 |
+
|
| 16 |
+
#buffers = [];
|
| 17 |
+
|
| 18 |
+
constructor() {
|
| 19 |
+
!isVercelEnv && fs.ensureDirSync(config.system.logDirPath);
|
| 20 |
+
!isVercelEnv && this.work();
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
push(content) {
|
| 24 |
+
const buffer = Buffer.from(content);
|
| 25 |
+
this.#buffers.push(buffer);
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
writeSync(buffer) {
|
| 29 |
+
!isVercelEnv && fs.appendFileSync(path.join(config.system.logDirPath, `/${util.getDateString()}.log`), buffer);
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
async write(buffer) {
|
| 33 |
+
!isVercelEnv && await fs.appendFile(path.join(config.system.logDirPath, `/${util.getDateString()}.log`), buffer);
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
flush() {
|
| 37 |
+
if(!this.#buffers.length) return;
|
| 38 |
+
!isVercelEnv && fs.appendFileSync(path.join(config.system.logDirPath, `/${util.getDateString()}.log`), Buffer.concat(this.#buffers));
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
work() {
|
| 42 |
+
if (!this.#buffers.length) return setTimeout(this.work.bind(this), config.system.logWriteInterval);
|
| 43 |
+
const buffer = Buffer.concat(this.#buffers);
|
| 44 |
+
this.#buffers = [];
|
| 45 |
+
this.write(buffer)
|
| 46 |
+
.finally(() => setTimeout(this.work.bind(this), config.system.logWriteInterval))
|
| 47 |
+
.catch(err => console.error("Log write error:", err));
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
class LogText {
|
| 53 |
+
|
| 54 |
+
/** @type {string} 日志级别 */
|
| 55 |
+
level;
|
| 56 |
+
/** @type {string} 日志文本 */
|
| 57 |
+
text;
|
| 58 |
+
/** @type {string} 日志来源 */
|
| 59 |
+
source;
|
| 60 |
+
/** @type {Date} 日志发生时间 */
|
| 61 |
+
time = new Date();
|
| 62 |
+
|
| 63 |
+
constructor(level, ...params) {
|
| 64 |
+
this.level = level;
|
| 65 |
+
this.text = _util.format.apply(null, params);
|
| 66 |
+
this.source = this.#getStackTopCodeInfo();
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
#getStackTopCodeInfo() {
|
| 70 |
+
const unknownInfo = { name: "unknown", codeLine: 0, codeColumn: 0 };
|
| 71 |
+
const stackArray = new Error().stack.split("\n");
|
| 72 |
+
const text = stackArray[4];
|
| 73 |
+
if (!text)
|
| 74 |
+
return unknownInfo;
|
| 75 |
+
const match = text.match(/at (.+) \((.+)\)/) || text.match(/at (.+)/);
|
| 76 |
+
if (!match || !_.isString(match[2] || match[1]))
|
| 77 |
+
return unknownInfo;
|
| 78 |
+
const temp = match[2] || match[1];
|
| 79 |
+
const _match = temp.match(/([a-zA-Z0-9_\-\.]+)\:(\d+)\:(\d+)$/);
|
| 80 |
+
if (!_match)
|
| 81 |
+
return unknownInfo;
|
| 82 |
+
const [, scriptPath, codeLine, codeColumn] = _match as any;
|
| 83 |
+
return {
|
| 84 |
+
name: scriptPath ? scriptPath.replace(/.js$/, "") : "unknown",
|
| 85 |
+
path: scriptPath || null,
|
| 86 |
+
codeLine: parseInt(codeLine || 0),
|
| 87 |
+
codeColumn: parseInt(codeColumn || 0)
|
| 88 |
+
};
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
toString() {
|
| 92 |
+
return `[${dateFormat(this.time, "yyyy-MM-dd HH:mm:ss.SSS")}][${this.level}][${this.source.name}<${this.source.codeLine},${this.source.codeColumn}>] ${this.text}`;
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
class Logger {
|
| 98 |
+
|
| 99 |
+
/** @type {Object} 系统配置 */
|
| 100 |
+
config = {};
|
| 101 |
+
/** @type {Object} 日志级别映射 */
|
| 102 |
+
static Level = {
|
| 103 |
+
Success: "success",
|
| 104 |
+
Info: "info",
|
| 105 |
+
Log: "log",
|
| 106 |
+
Debug: "debug",
|
| 107 |
+
Warning: "warning",
|
| 108 |
+
Error: "error",
|
| 109 |
+
Fatal: "fatal"
|
| 110 |
+
};
|
| 111 |
+
/** @type {Object} 日志级别文本颜色樱色 */
|
| 112 |
+
static LevelColor = {
|
| 113 |
+
[Logger.Level.Success]: "green",
|
| 114 |
+
[Logger.Level.Info]: "brightCyan",
|
| 115 |
+
[Logger.Level.Debug]: "white",
|
| 116 |
+
[Logger.Level.Warning]: "brightYellow",
|
| 117 |
+
[Logger.Level.Error]: "brightRed",
|
| 118 |
+
[Logger.Level.Fatal]: "red"
|
| 119 |
+
};
|
| 120 |
+
#writer;
|
| 121 |
+
|
| 122 |
+
constructor() {
|
| 123 |
+
this.#writer = new LogWriter();
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
header() {
|
| 127 |
+
this.#writer.writeSync(Buffer.from(`\n\n===================== LOG START ${dateFormat(new Date(), "yyyy-MM-dd HH:mm:ss.SSS")} =====================\n\n`));
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
footer() {
|
| 131 |
+
this.#writer.flush(); //将未写入文件的日志缓存写入
|
| 132 |
+
this.#writer.writeSync(Buffer.from(`\n\n===================== LOG END ${dateFormat(new Date(), "yyyy-MM-dd HH:mm:ss.SSS")} =====================\n\n`));
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
success(...params) {
|
| 136 |
+
const content = new LogText(Logger.Level.Success, ...params).toString();
|
| 137 |
+
console.info(content[Logger.LevelColor[Logger.Level.Success]]);
|
| 138 |
+
this.#writer.push(content + "\n");
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
info(...params) {
|
| 142 |
+
const content = new LogText(Logger.Level.Info, ...params).toString();
|
| 143 |
+
console.info(content[Logger.LevelColor[Logger.Level.Info]]);
|
| 144 |
+
this.#writer.push(content + "\n");
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
log(...params) {
|
| 148 |
+
const content = new LogText(Logger.Level.Log, ...params).toString();
|
| 149 |
+
console.log(content[Logger.LevelColor[Logger.Level.Log]]);
|
| 150 |
+
this.#writer.push(content + "\n");
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
debug(...params) {
|
| 154 |
+
if(!config.system.debug) return; //非调试模式忽略debug
|
| 155 |
+
const content = new LogText(Logger.Level.Debug, ...params).toString();
|
| 156 |
+
console.debug(content[Logger.LevelColor[Logger.Level.Debug]]);
|
| 157 |
+
this.#writer.push(content + "\n");
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
warn(...params) {
|
| 161 |
+
const content = new LogText(Logger.Level.Warning, ...params).toString();
|
| 162 |
+
console.warn(content[Logger.LevelColor[Logger.Level.Warning]]);
|
| 163 |
+
this.#writer.push(content + "\n");
|
| 164 |
+
}
|
| 165 |
+
|
| 166 |
+
error(...params) {
|
| 167 |
+
const content = new LogText(Logger.Level.Error, ...params).toString();
|
| 168 |
+
console.error(content[Logger.LevelColor[Logger.Level.Error]]);
|
| 169 |
+
this.#writer.push(content);
|
| 170 |
+
}
|
| 171 |
+
|
| 172 |
+
fatal(...params) {
|
| 173 |
+
const content = new LogText(Logger.Level.Fatal, ...params).toString();
|
| 174 |
+
console.error(content[Logger.LevelColor[Logger.Level.Fatal]]);
|
| 175 |
+
this.#writer.push(content);
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
destory() {
|
| 179 |
+
this.#writer.destory();
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
export default new Logger();
|
src/lib/request/Request.ts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import _ from 'lodash';
|
| 2 |
+
|
| 3 |
+
import APIException from '@/lib/exceptions/APIException.ts';
|
| 4 |
+
import EX from '@/api/consts/exceptions.ts';
|
| 5 |
+
import logger from '@/lib/logger.ts';
|
| 6 |
+
import util from '@/lib/util.ts';
|
| 7 |
+
|
| 8 |
+
export interface RequestOptions {
|
| 9 |
+
time?: number;
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
export default class Request {
|
| 13 |
+
|
| 14 |
+
/** 请求方法 */
|
| 15 |
+
method: string;
|
| 16 |
+
/** 请求URL */
|
| 17 |
+
url: string;
|
| 18 |
+
/** 请求路径 */
|
| 19 |
+
path: string;
|
| 20 |
+
/** 请求载荷类型 */
|
| 21 |
+
type: string;
|
| 22 |
+
/** 请求headers */
|
| 23 |
+
headers: any;
|
| 24 |
+
/** 请求原始查询字符串 */
|
| 25 |
+
search: string;
|
| 26 |
+
/** 请求查询参数 */
|
| 27 |
+
query: any;
|
| 28 |
+
/** 请求URL参数 */
|
| 29 |
+
params: any;
|
| 30 |
+
/** 请求载荷 */
|
| 31 |
+
body: any;
|
| 32 |
+
/** 上传的文件 */
|
| 33 |
+
files: any[];
|
| 34 |
+
/** 客户端IP地址 */
|
| 35 |
+
remoteIP: string | null;
|
| 36 |
+
/** 请求接受时间戳(毫秒) */
|
| 37 |
+
time: number;
|
| 38 |
+
|
| 39 |
+
constructor(ctx, options: RequestOptions = {}) {
|
| 40 |
+
const { time } = options;
|
| 41 |
+
this.method = ctx.request.method;
|
| 42 |
+
this.url = ctx.request.url;
|
| 43 |
+
this.path = ctx.request.path;
|
| 44 |
+
this.type = ctx.request.type;
|
| 45 |
+
this.headers = ctx.request.headers || {};
|
| 46 |
+
this.search = ctx.request.search;
|
| 47 |
+
this.query = ctx.query || {};
|
| 48 |
+
this.params = ctx.params || {};
|
| 49 |
+
this.body = ctx.request.body || {};
|
| 50 |
+
this.files = ctx.request.files || {};
|
| 51 |
+
this.remoteIP = this.headers["X-Real-IP"] || this.headers["x-real-ip"] || this.headers["X-Forwarded-For"] || this.headers["x-forwarded-for"] || ctx.ip || null;
|
| 52 |
+
this.time = Number(_.defaultTo(time, util.timestamp()));
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
validate(key: string, fn?: Function, message?: string) {
|
| 56 |
+
try {
|
| 57 |
+
const value = _.get(this, key);
|
| 58 |
+
if (fn) {
|
| 59 |
+
if (fn(value) === false)
|
| 60 |
+
throw `[Mismatch] -> ${fn}`;
|
| 61 |
+
}
|
| 62 |
+
else if (_.isUndefined(value))
|
| 63 |
+
throw '[Undefined]';
|
| 64 |
+
}
|
| 65 |
+
catch (err) {
|
| 66 |
+
logger.warn(`Params ${key} invalid:`, err);
|
| 67 |
+
throw new APIException(EX.API_REQUEST_PARAMS_INVALID, message || `Params ${key} invalid`);
|
| 68 |
+
}
|
| 69 |
+
return this;
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
}
|
src/lib/response/Body.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import _ from 'lodash';
|
| 2 |
+
|
| 3 |
+
export interface BodyOptions {
|
| 4 |
+
code?: number;
|
| 5 |
+
message?: string;
|
| 6 |
+
data?: any;
|
| 7 |
+
statusCode?: number;
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
export default class Body {
|
| 11 |
+
|
| 12 |
+
/** 状态码 */
|
| 13 |
+
code: number;
|
| 14 |
+
/** 状态消息 */
|
| 15 |
+
message: string;
|
| 16 |
+
/** 载荷 */
|
| 17 |
+
data: any;
|
| 18 |
+
/** HTTP状态码 */
|
| 19 |
+
statusCode: number;
|
| 20 |
+
|
| 21 |
+
constructor(options: BodyOptions = {}) {
|
| 22 |
+
const { code, message, data, statusCode } = options;
|
| 23 |
+
this.code = Number(_.defaultTo(code, 0));
|
| 24 |
+
this.message = _.defaultTo(message, 'OK');
|
| 25 |
+
this.data = _.defaultTo(data, null);
|
| 26 |
+
this.statusCode = Number(_.defaultTo(statusCode, 200));
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
toObject() {
|
| 30 |
+
return {
|
| 31 |
+
code: this.code,
|
| 32 |
+
message: this.message,
|
| 33 |
+
data: this.data
|
| 34 |
+
};
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
static isInstance(value) {
|
| 38 |
+
return value instanceof Body;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
}
|
src/lib/response/FailureBody.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import _ from 'lodash';
|
| 2 |
+
|
| 3 |
+
import Body from './Body.ts';
|
| 4 |
+
import Exception from '../exceptions/Exception.ts';
|
| 5 |
+
import APIException from '../exceptions/APIException.ts';
|
| 6 |
+
import EX from '../consts/exceptions.ts';
|
| 7 |
+
import HTTP_STATUS_CODES from '../http-status-codes.ts';
|
| 8 |
+
|
| 9 |
+
export default class FailureBody extends Body {
|
| 10 |
+
|
| 11 |
+
constructor(error: APIException | Exception | Error, _data?: any) {
|
| 12 |
+
let errcode, errmsg, data = _data, httpStatusCode = HTTP_STATUS_CODES.OK;;
|
| 13 |
+
if(_.isString(error))
|
| 14 |
+
error = new Exception(EX.SYSTEM_ERROR, error);
|
| 15 |
+
else if(error instanceof APIException || error instanceof Exception)
|
| 16 |
+
({ errcode, errmsg, data, httpStatusCode } = error);
|
| 17 |
+
else if(_.isError(error))
|
| 18 |
+
({ errcode, errmsg, data, httpStatusCode } = new Exception(EX.SYSTEM_ERROR, error.message));
|
| 19 |
+
super({
|
| 20 |
+
code: errcode || -1,
|
| 21 |
+
message: errmsg || 'Internal error',
|
| 22 |
+
data,
|
| 23 |
+
statusCode: httpStatusCode
|
| 24 |
+
});
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
static isInstance(value) {
|
| 28 |
+
return value instanceof FailureBody;
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
}
|
src/lib/response/Response.ts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import mime from 'mime';
|
| 2 |
+
import _ from 'lodash';
|
| 3 |
+
|
| 4 |
+
import Body from './Body.ts';
|
| 5 |
+
import util from '../util.ts';
|
| 6 |
+
|
| 7 |
+
export interface ResponseOptions {
|
| 8 |
+
statusCode?: number;
|
| 9 |
+
type?: string;
|
| 10 |
+
headers?: Record<string, any>;
|
| 11 |
+
redirect?: string;
|
| 12 |
+
body?: any;
|
| 13 |
+
size?: number;
|
| 14 |
+
time?: number;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
export default class Response {
|
| 18 |
+
|
| 19 |
+
/** 响应HTTP状态码 */
|
| 20 |
+
statusCode: number;
|
| 21 |
+
/** 响应内容类型 */
|
| 22 |
+
type: string;
|
| 23 |
+
/** 响应headers */
|
| 24 |
+
headers: Record<string, any>;
|
| 25 |
+
/** 重定向目标 */
|
| 26 |
+
redirect: string;
|
| 27 |
+
/** 响应载荷 */
|
| 28 |
+
body: any;
|
| 29 |
+
/** 响应载荷大小 */
|
| 30 |
+
size: number;
|
| 31 |
+
/** 响应时间戳 */
|
| 32 |
+
time: number;
|
| 33 |
+
|
| 34 |
+
constructor(body: any, options: ResponseOptions = {}) {
|
| 35 |
+
const { statusCode, type, headers, redirect, size, time } = options;
|
| 36 |
+
this.statusCode = Number(_.defaultTo(statusCode, Body.isInstance(body) ? body.statusCode : undefined))
|
| 37 |
+
this.type = type;
|
| 38 |
+
this.headers = headers;
|
| 39 |
+
this.redirect = redirect;
|
| 40 |
+
this.size = size;
|
| 41 |
+
this.time = Number(_.defaultTo(time, util.timestamp()));
|
| 42 |
+
this.body = body;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
injectTo(ctx) {
|
| 46 |
+
this.redirect && ctx.redirect(this.redirect);
|
| 47 |
+
this.statusCode && (ctx.status = this.statusCode);
|
| 48 |
+
this.type && (ctx.type = mime.getType(this.type) || this.type);
|
| 49 |
+
const headers = this.headers || {};
|
| 50 |
+
if(this.size && !headers["Content-Length"] && !headers["content-length"])
|
| 51 |
+
headers["Content-Length"] = this.size;
|
| 52 |
+
ctx.set(headers);
|
| 53 |
+
if(Body.isInstance(this.body))
|
| 54 |
+
ctx.body = this.body.toObject();
|
| 55 |
+
else
|
| 56 |
+
ctx.body = this.body;
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
static isInstance(value) {
|
| 60 |
+
return value instanceof Response;
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
}
|
src/lib/response/SuccessfulBody.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import _ from 'lodash';
|
| 2 |
+
|
| 3 |
+
import Body from './Body.ts';
|
| 4 |
+
|
| 5 |
+
export default class SuccessfulBody extends Body {
|
| 6 |
+
|
| 7 |
+
constructor(data: any, message?: string) {
|
| 8 |
+
super({
|
| 9 |
+
code: 0,
|
| 10 |
+
message: _.defaultTo(message, "OK"),
|
| 11 |
+
data
|
| 12 |
+
});
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
static isInstance(value) {
|
| 16 |
+
return value instanceof SuccessfulBody;
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
}
|
src/lib/server.ts
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Koa from 'koa';
|
| 2 |
+
import KoaRouter from 'koa-router';
|
| 3 |
+
import koaRange from 'koa-range';
|
| 4 |
+
import koaCors from "koa2-cors";
|
| 5 |
+
import koaBody from 'koa-body';
|
| 6 |
+
import _ from 'lodash';
|
| 7 |
+
|
| 8 |
+
import Exception from './exceptions/Exception.ts';
|
| 9 |
+
import Request from './request/Request.ts';
|
| 10 |
+
import Response from './response/Response.js';
|
| 11 |
+
import FailureBody from './response/FailureBody.ts';
|
| 12 |
+
import EX from './consts/exceptions.ts';
|
| 13 |
+
import logger from './logger.ts';
|
| 14 |
+
import config from './config.ts';
|
| 15 |
+
|
| 16 |
+
class Server {
|
| 17 |
+
|
| 18 |
+
app;
|
| 19 |
+
router;
|
| 20 |
+
|
| 21 |
+
constructor() {
|
| 22 |
+
this.app = new Koa();
|
| 23 |
+
this.app.use(koaCors());
|
| 24 |
+
// 范围请求支持
|
| 25 |
+
this.app.use(koaRange);
|
| 26 |
+
this.router = new KoaRouter({ prefix: config.service.urlPrefix });
|
| 27 |
+
// 前置处理异常拦截
|
| 28 |
+
this.app.use(async (ctx: any, next: Function) => {
|
| 29 |
+
if(ctx.request.type === "application/xml" || ctx.request.type === "application/ssml+xml")
|
| 30 |
+
ctx.req.headers["content-type"] = "text/xml";
|
| 31 |
+
try { await next() }
|
| 32 |
+
catch (err) {
|
| 33 |
+
logger.error(err);
|
| 34 |
+
const failureBody = new FailureBody(err);
|
| 35 |
+
new Response(failureBody).injectTo(ctx);
|
| 36 |
+
}
|
| 37 |
+
});
|
| 38 |
+
// 自定义 JSON 解析中间件
|
| 39 |
+
this.app.use(async (ctx: any, next: Function) => {
|
| 40 |
+
if (ctx.is('application/json') && ['POST', 'PUT', 'PATCH'].includes(ctx.method)) {
|
| 41 |
+
logger.debug('开始自定义 JSON 解析');
|
| 42 |
+
const chunks: Buffer[] = [];
|
| 43 |
+
|
| 44 |
+
await new Promise((resolve, reject) => {
|
| 45 |
+
ctx.req.on('data', (chunk: Buffer) => {
|
| 46 |
+
chunks.push(chunk);
|
| 47 |
+
});
|
| 48 |
+
|
| 49 |
+
ctx.req.on('end', () => {
|
| 50 |
+
resolve(null);
|
| 51 |
+
});
|
| 52 |
+
|
| 53 |
+
ctx.req.on('error', reject);
|
| 54 |
+
});
|
| 55 |
+
|
| 56 |
+
const body = Buffer.concat(chunks).toString('utf8');
|
| 57 |
+
|
| 58 |
+
// 清理问题字符
|
| 59 |
+
let cleanedBody = body
|
| 60 |
+
.replace(/\r\n/g, '\n')
|
| 61 |
+
.replace(/\r/g, '\n')
|
| 62 |
+
.replace(/\u00A0/g, ' ')
|
| 63 |
+
.replace(/[\u2000-\u200B]/g, ' ')
|
| 64 |
+
.replace(/\uFEFF/g, '')
|
| 65 |
+
.trim();
|
| 66 |
+
|
| 67 |
+
const parsedBody = JSON.parse(cleanedBody);
|
| 68 |
+
|
| 69 |
+
logger.debug('JSON 解析成功,跳过 koa-body');
|
| 70 |
+
|
| 71 |
+
ctx.request.body = parsedBody;
|
| 72 |
+
ctx.request.rawBody = cleanedBody;
|
| 73 |
+
|
| 74 |
+
// 标记已处理,避免 koa-body 再次处理
|
| 75 |
+
ctx._jsonProcessed = true;
|
| 76 |
+
}
|
| 77 |
+
await next();
|
| 78 |
+
});
|
| 79 |
+
|
| 80 |
+
// 载荷解析器支持(只处理未被自定义解析器处理的请求)
|
| 81 |
+
this.app.use(async (ctx: any, next: Function) => {
|
| 82 |
+
if (!ctx._jsonProcessed) {
|
| 83 |
+
await koaBody(Object.assign(_.clone(config.system.requestBody), {
|
| 84 |
+
enableTypes: ['form', 'text', 'xml']
|
| 85 |
+
}))(ctx, next);
|
| 86 |
+
} else {
|
| 87 |
+
await next();
|
| 88 |
+
}
|
| 89 |
+
});
|
| 90 |
+
this.app.on("error", (err: any) => {
|
| 91 |
+
// 忽略连接重试、中断、管道、取消错误
|
| 92 |
+
if (["ECONNRESET", "ECONNABORTED", "EPIPE", "ECANCELED"].includes(err.code)) return;
|
| 93 |
+
logger.error(err);
|
| 94 |
+
});
|
| 95 |
+
logger.success("Server initialized");
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
/**
|
| 99 |
+
* 附加路由
|
| 100 |
+
*
|
| 101 |
+
* @param routes 路由列表
|
| 102 |
+
*/
|
| 103 |
+
attachRoutes(routes: any[]) {
|
| 104 |
+
routes.forEach((route: any) => {
|
| 105 |
+
const prefix = route.prefix || "";
|
| 106 |
+
for (let method in route) {
|
| 107 |
+
if(method === "prefix") continue;
|
| 108 |
+
if (!_.isObject(route[method])) {
|
| 109 |
+
logger.warn(`Router ${prefix} ${method} invalid`);
|
| 110 |
+
continue;
|
| 111 |
+
}
|
| 112 |
+
for (let uri in route[method]) {
|
| 113 |
+
this.router[method](`${prefix}${uri}`, async ctx => {
|
| 114 |
+
const { request, response } = await this.#requestProcessing(ctx, route[method][uri]);
|
| 115 |
+
if(response != null && config.system.requestLog)
|
| 116 |
+
logger.info(`<- ${request.method} ${request.url} ${response.time - request.time}ms`);
|
| 117 |
+
});
|
| 118 |
+
}
|
| 119 |
+
}
|
| 120 |
+
logger.info(`Route ${config.service.urlPrefix || ""}${prefix} attached`);
|
| 121 |
+
});
|
| 122 |
+
this.app.use(this.router.routes());
|
| 123 |
+
this.app.use((ctx: any) => {
|
| 124 |
+
const request = new Request(ctx);
|
| 125 |
+
logger.debug(`-> ${ctx.request.method} ${ctx.request.url} request is not supported - ${request.remoteIP || "unknown"}`);
|
| 126 |
+
// const failureBody = new FailureBody(new Exception(EX.SYSTEM_NOT_ROUTE_MATCHING, "Request is not supported"));
|
| 127 |
+
// const response = new Response(failureBody);
|
| 128 |
+
const message = `[请求有误]: 正确请求为 POST -> /v1/chat/completions,当前请求为 ${ctx.request.method} -> ${ctx.request.url} 请纠正`;
|
| 129 |
+
logger.warn(message);
|
| 130 |
+
const failureBody = new FailureBody(new Error(message));
|
| 131 |
+
const response = new Response(failureBody);
|
| 132 |
+
response.injectTo(ctx);
|
| 133 |
+
if(config.system.requestLog)
|
| 134 |
+
logger.info(`<- ${request.method} ${request.url} ${response.time - request.time}ms`);
|
| 135 |
+
});
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
/**
|
| 139 |
+
* 请求处理
|
| 140 |
+
*
|
| 141 |
+
* @param ctx 上下文
|
| 142 |
+
* @param routeFn 路由方法
|
| 143 |
+
*/
|
| 144 |
+
#requestProcessing(ctx: any, routeFn: Function): Promise<any> {
|
| 145 |
+
return new Promise(resolve => {
|
| 146 |
+
const request = new Request(ctx);
|
| 147 |
+
try {
|
| 148 |
+
if(config.system.requestLog)
|
| 149 |
+
logger.info(`-> ${request.method} ${request.url}`);
|
| 150 |
+
routeFn(request)
|
| 151 |
+
.then(response => {
|
| 152 |
+
try {
|
| 153 |
+
if(!Response.isInstance(response)) {
|
| 154 |
+
const _response = new Response(response);
|
| 155 |
+
_response.injectTo(ctx);
|
| 156 |
+
return resolve({ request, response: _response });
|
| 157 |
+
}
|
| 158 |
+
response.injectTo(ctx);
|
| 159 |
+
resolve({ request, response });
|
| 160 |
+
}
|
| 161 |
+
catch(err) {
|
| 162 |
+
logger.error(err);
|
| 163 |
+
const failureBody = new FailureBody(err);
|
| 164 |
+
const response = new Response(failureBody);
|
| 165 |
+
response.injectTo(ctx);
|
| 166 |
+
resolve({ request, response });
|
| 167 |
+
}
|
| 168 |
+
})
|
| 169 |
+
.catch(err => {
|
| 170 |
+
try {
|
| 171 |
+
logger.error(err);
|
| 172 |
+
const failureBody = new FailureBody(err);
|
| 173 |
+
const response = new Response(failureBody);
|
| 174 |
+
response.injectTo(ctx);
|
| 175 |
+
resolve({ request, response });
|
| 176 |
+
}
|
| 177 |
+
catch(err) {
|
| 178 |
+
logger.error(err);
|
| 179 |
+
const failureBody = new FailureBody(err);
|
| 180 |
+
const response = new Response(failureBody);
|
| 181 |
+
response.injectTo(ctx);
|
| 182 |
+
resolve({ request, response });
|
| 183 |
+
}
|
| 184 |
+
});
|
| 185 |
+
}
|
| 186 |
+
catch(err) {
|
| 187 |
+
logger.error(err);
|
| 188 |
+
const failureBody = new FailureBody(err);
|
| 189 |
+
const response = new Response(failureBody);
|
| 190 |
+
response.injectTo(ctx);
|
| 191 |
+
resolve({ request, response });
|
| 192 |
+
}
|
| 193 |
+
});
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
+
/**
|
| 197 |
+
* 监听端口
|
| 198 |
+
*/
|
| 199 |
+
async listen() {
|
| 200 |
+
const host = config.service.host;
|
| 201 |
+
const port = config.service.port;
|
| 202 |
+
await Promise.all([
|
| 203 |
+
new Promise((resolve, reject) => {
|
| 204 |
+
if(host === "0.0.0.0" || host === "localhost" || host === "127.0.0.1")
|
| 205 |
+
return resolve(null);
|
| 206 |
+
this.app.listen(port, "localhost", err => {
|
| 207 |
+
if(err) return reject(err);
|
| 208 |
+
resolve(null);
|
| 209 |
+
});
|
| 210 |
+
}),
|
| 211 |
+
new Promise((resolve, reject) => {
|
| 212 |
+
this.app.listen(port, host, err => {
|
| 213 |
+
if(err) return reject(err);
|
| 214 |
+
resolve(null);
|
| 215 |
+
});
|
| 216 |
+
})
|
| 217 |
+
]);
|
| 218 |
+
logger.success(`Server listening on port ${port} (${host})`);
|
| 219 |
+
}
|
| 220 |
+
|
| 221 |
+
}
|
| 222 |
+
|
| 223 |
+
export default new Server();
|
src/lib/util.ts
ADDED
|
@@ -0,0 +1,307 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os from "os";
|
| 2 |
+
import path from "path";
|
| 3 |
+
import crypto from "crypto";
|
| 4 |
+
import { Readable, Writable } from "stream";
|
| 5 |
+
|
| 6 |
+
import "colors";
|
| 7 |
+
import mime from "mime";
|
| 8 |
+
import axios from "axios";
|
| 9 |
+
import fs from "fs-extra";
|
| 10 |
+
import { v1 as uuid } from "uuid";
|
| 11 |
+
import { format as dateFormat } from "date-fns";
|
| 12 |
+
import CRC32 from "crc-32";
|
| 13 |
+
import randomstring from "randomstring";
|
| 14 |
+
import _ from "lodash";
|
| 15 |
+
import { CronJob } from "cron";
|
| 16 |
+
|
| 17 |
+
import HTTP_STATUS_CODE from "./http-status-codes.ts";
|
| 18 |
+
|
| 19 |
+
const autoIdMap = new Map();
|
| 20 |
+
|
| 21 |
+
const util = {
|
| 22 |
+
is2DArrays(value: any) {
|
| 23 |
+
return (
|
| 24 |
+
_.isArray(value) &&
|
| 25 |
+
(!value[0] || (_.isArray(value[0]) && _.isArray(value[value.length - 1])))
|
| 26 |
+
);
|
| 27 |
+
},
|
| 28 |
+
|
| 29 |
+
uuid: (separator = true) => (separator ? uuid() : uuid().replace(/\-/g, "")),
|
| 30 |
+
|
| 31 |
+
autoId: (prefix = "") => {
|
| 32 |
+
let index = autoIdMap.get(prefix);
|
| 33 |
+
if (index > 999999) index = 0; //超过最大数字则重置为0
|
| 34 |
+
autoIdMap.set(prefix, (index || 0) + 1);
|
| 35 |
+
return `${prefix}${index || 1}`;
|
| 36 |
+
},
|
| 37 |
+
|
| 38 |
+
ignoreJSONParse(value: string) {
|
| 39 |
+
const result = _.attempt(() => JSON.parse(value));
|
| 40 |
+
if (_.isError(result)) return null;
|
| 41 |
+
return result;
|
| 42 |
+
},
|
| 43 |
+
|
| 44 |
+
generateRandomString(options: any): string {
|
| 45 |
+
return randomstring.generate(options);
|
| 46 |
+
},
|
| 47 |
+
|
| 48 |
+
getResponseContentType(value: any): string | null {
|
| 49 |
+
return value.headers
|
| 50 |
+
? value.headers["content-type"] || value.headers["Content-Type"]
|
| 51 |
+
: null;
|
| 52 |
+
},
|
| 53 |
+
|
| 54 |
+
mimeToExtension(value: string) {
|
| 55 |
+
let extension = mime.getExtension(value);
|
| 56 |
+
if (extension == "mpga") return "mp3";
|
| 57 |
+
return extension;
|
| 58 |
+
},
|
| 59 |
+
|
| 60 |
+
extractURLExtension(value: string) {
|
| 61 |
+
const extname = path.extname(new URL(value).pathname);
|
| 62 |
+
return extname.substring(1).toLowerCase();
|
| 63 |
+
},
|
| 64 |
+
|
| 65 |
+
createCronJob(cronPatterns: any, callback?: Function) {
|
| 66 |
+
if (!_.isFunction(callback))
|
| 67 |
+
throw new Error("callback must be an Function");
|
| 68 |
+
return new CronJob(
|
| 69 |
+
cronPatterns,
|
| 70 |
+
() => callback(),
|
| 71 |
+
null,
|
| 72 |
+
false,
|
| 73 |
+
"Asia/Shanghai"
|
| 74 |
+
);
|
| 75 |
+
},
|
| 76 |
+
|
| 77 |
+
getDateString(format = "yyyy-MM-dd", date = new Date()) {
|
| 78 |
+
return dateFormat(date, format);
|
| 79 |
+
},
|
| 80 |
+
|
| 81 |
+
getIPAddressesByIPv4(): string[] {
|
| 82 |
+
const interfaces = os.networkInterfaces();
|
| 83 |
+
const addresses = [];
|
| 84 |
+
for (let name in interfaces) {
|
| 85 |
+
const networks = interfaces[name];
|
| 86 |
+
const results = networks.filter(
|
| 87 |
+
(network) =>
|
| 88 |
+
network.family === "IPv4" &&
|
| 89 |
+
network.address !== "127.0.0.1" &&
|
| 90 |
+
!network.internal
|
| 91 |
+
);
|
| 92 |
+
if (results[0] && results[0].address) addresses.push(results[0].address);
|
| 93 |
+
}
|
| 94 |
+
return addresses;
|
| 95 |
+
},
|
| 96 |
+
|
| 97 |
+
getMACAddressesByIPv4(): string[] {
|
| 98 |
+
const interfaces = os.networkInterfaces();
|
| 99 |
+
const addresses = [];
|
| 100 |
+
for (let name in interfaces) {
|
| 101 |
+
const networks = interfaces[name];
|
| 102 |
+
const results = networks.filter(
|
| 103 |
+
(network) =>
|
| 104 |
+
network.family === "IPv4" &&
|
| 105 |
+
network.address !== "127.0.0.1" &&
|
| 106 |
+
!network.internal
|
| 107 |
+
);
|
| 108 |
+
if (results[0] && results[0].mac) addresses.push(results[0].mac);
|
| 109 |
+
}
|
| 110 |
+
return addresses;
|
| 111 |
+
},
|
| 112 |
+
|
| 113 |
+
generateSSEData(event?: string, data?: string, retry?: number) {
|
| 114 |
+
return `event: ${event || "message"}\ndata: ${(data || "")
|
| 115 |
+
.replace(/\n/g, "\\n")
|
| 116 |
+
.replace(/\s/g, "\\s")}\nretry: ${retry || 3000}\n\n`;
|
| 117 |
+
},
|
| 118 |
+
|
| 119 |
+
buildDataBASE64(type, ext, buffer) {
|
| 120 |
+
return `data:${type}/${ext.replace("jpg", "jpeg")};base64,${buffer.toString(
|
| 121 |
+
"base64"
|
| 122 |
+
)}`;
|
| 123 |
+
},
|
| 124 |
+
|
| 125 |
+
isLinux() {
|
| 126 |
+
return os.platform() !== "win32";
|
| 127 |
+
},
|
| 128 |
+
|
| 129 |
+
isIPAddress(value) {
|
| 130 |
+
return (
|
| 131 |
+
_.isString(value) &&
|
| 132 |
+
(/^((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)$/.test(
|
| 133 |
+
value
|
| 134 |
+
) ||
|
| 135 |
+
/\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*/.test(
|
| 136 |
+
value
|
| 137 |
+
))
|
| 138 |
+
);
|
| 139 |
+
},
|
| 140 |
+
|
| 141 |
+
isPort(value) {
|
| 142 |
+
return _.isNumber(value) && value > 0 && value < 65536;
|
| 143 |
+
},
|
| 144 |
+
|
| 145 |
+
isReadStream(value): boolean {
|
| 146 |
+
return (
|
| 147 |
+
value &&
|
| 148 |
+
(value instanceof Readable || "readable" in value || value.readable)
|
| 149 |
+
);
|
| 150 |
+
},
|
| 151 |
+
|
| 152 |
+
isWriteStream(value): boolean {
|
| 153 |
+
return (
|
| 154 |
+
value &&
|
| 155 |
+
(value instanceof Writable || "writable" in value || value.writable)
|
| 156 |
+
);
|
| 157 |
+
},
|
| 158 |
+
|
| 159 |
+
isHttpStatusCode(value) {
|
| 160 |
+
return _.isNumber(value) && Object.values(HTTP_STATUS_CODE).includes(value);
|
| 161 |
+
},
|
| 162 |
+
|
| 163 |
+
isURL(value) {
|
| 164 |
+
return !_.isUndefined(value) && /^(http|https)/.test(value);
|
| 165 |
+
},
|
| 166 |
+
|
| 167 |
+
isSrc(value) {
|
| 168 |
+
return !_.isUndefined(value) && /^\/.+\.[0-9a-zA-Z]+(\?.+)?$/.test(value);
|
| 169 |
+
},
|
| 170 |
+
|
| 171 |
+
isBASE64(value) {
|
| 172 |
+
return !_.isUndefined(value) && /^[a-zA-Z0-9\/\+]+(=?)+$/.test(value);
|
| 173 |
+
},
|
| 174 |
+
|
| 175 |
+
isBASE64Data(value) {
|
| 176 |
+
return /^data:/.test(value);
|
| 177 |
+
},
|
| 178 |
+
|
| 179 |
+
extractBASE64DataFormat(value): string | null {
|
| 180 |
+
const match = value.trim().match(/^data:(.+);base64,/);
|
| 181 |
+
if (!match) return null;
|
| 182 |
+
return match[1];
|
| 183 |
+
},
|
| 184 |
+
|
| 185 |
+
removeBASE64DataHeader(value): string {
|
| 186 |
+
return value.replace(/^data:(.+);base64,/, "");
|
| 187 |
+
},
|
| 188 |
+
|
| 189 |
+
isDataString(value): boolean {
|
| 190 |
+
return /^(base64|json):/.test(value);
|
| 191 |
+
},
|
| 192 |
+
|
| 193 |
+
isStringNumber(value) {
|
| 194 |
+
return _.isFinite(Number(value));
|
| 195 |
+
},
|
| 196 |
+
|
| 197 |
+
isUnixTimestamp(value) {
|
| 198 |
+
return /^[0-9]{10}$/.test(`${value}`);
|
| 199 |
+
},
|
| 200 |
+
|
| 201 |
+
isTimestamp(value) {
|
| 202 |
+
return /^[0-9]{13}$/.test(`${value}`);
|
| 203 |
+
},
|
| 204 |
+
|
| 205 |
+
isEmail(value) {
|
| 206 |
+
return /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/.test(
|
| 207 |
+
value
|
| 208 |
+
);
|
| 209 |
+
},
|
| 210 |
+
|
| 211 |
+
isAsyncFunction(value) {
|
| 212 |
+
return Object.prototype.toString.call(value) === "[object AsyncFunction]";
|
| 213 |
+
},
|
| 214 |
+
|
| 215 |
+
async isAPNG(filePath) {
|
| 216 |
+
let head;
|
| 217 |
+
const readStream = fs.createReadStream(filePath, { start: 37, end: 40 });
|
| 218 |
+
const readPromise = new Promise((resolve, reject) => {
|
| 219 |
+
readStream.once("end", resolve);
|
| 220 |
+
readStream.once("error", reject);
|
| 221 |
+
});
|
| 222 |
+
readStream.once("data", (data) => (head = data));
|
| 223 |
+
await readPromise;
|
| 224 |
+
return head.compare(Buffer.from([0x61, 0x63, 0x54, 0x4c])) === 0;
|
| 225 |
+
},
|
| 226 |
+
|
| 227 |
+
unixTimestamp() {
|
| 228 |
+
return parseInt(`${Date.now() / 1000}`);
|
| 229 |
+
},
|
| 230 |
+
|
| 231 |
+
timestamp() {
|
| 232 |
+
return Date.now();
|
| 233 |
+
},
|
| 234 |
+
|
| 235 |
+
urlJoin(...values) {
|
| 236 |
+
let url = "";
|
| 237 |
+
for (let i = 0; i < values.length; i++)
|
| 238 |
+
url += `${i > 0 ? "/" : ""}${values[i]
|
| 239 |
+
.replace(/^\/*/, "")
|
| 240 |
+
.replace(/\/*$/, "")}`;
|
| 241 |
+
return url;
|
| 242 |
+
},
|
| 243 |
+
|
| 244 |
+
millisecondsToHmss(milliseconds) {
|
| 245 |
+
if (_.isString(milliseconds)) return milliseconds;
|
| 246 |
+
milliseconds = parseInt(milliseconds);
|
| 247 |
+
const sec = Math.floor(milliseconds / 1000);
|
| 248 |
+
const hours = Math.floor(sec / 3600);
|
| 249 |
+
const minutes = Math.floor((sec - hours * 3600) / 60);
|
| 250 |
+
const seconds = sec - hours * 3600 - minutes * 60;
|
| 251 |
+
const ms = (milliseconds % 60000) - seconds * 1000;
|
| 252 |
+
return `${hours > 9 ? hours : "0" + hours}:${
|
| 253 |
+
minutes > 9 ? minutes : "0" + minutes
|
| 254 |
+
}:${seconds > 9 ? seconds : "0" + seconds}.${ms}`;
|
| 255 |
+
},
|
| 256 |
+
|
| 257 |
+
millisecondsToTimeString(milliseconds) {
|
| 258 |
+
if (milliseconds < 1000) return `${milliseconds}ms`;
|
| 259 |
+
if (milliseconds < 60000)
|
| 260 |
+
return `${parseFloat((milliseconds / 1000).toFixed(2))}s`;
|
| 261 |
+
return `${Math.floor(milliseconds / 1000 / 60)}m${Math.floor(
|
| 262 |
+
(milliseconds / 1000) % 60
|
| 263 |
+
)}s`;
|
| 264 |
+
},
|
| 265 |
+
|
| 266 |
+
rgbToHex(r, g, b): string {
|
| 267 |
+
return ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
|
| 268 |
+
},
|
| 269 |
+
|
| 270 |
+
hexToRgb(hex) {
|
| 271 |
+
const value = parseInt(hex.replace(/^#/, ""), 16);
|
| 272 |
+
return [(value >> 16) & 255, (value >> 8) & 255, value & 255];
|
| 273 |
+
},
|
| 274 |
+
|
| 275 |
+
md5(value) {
|
| 276 |
+
return crypto.createHash("md5").update(value).digest("hex");
|
| 277 |
+
},
|
| 278 |
+
|
| 279 |
+
crc32(value) {
|
| 280 |
+
return _.isBuffer(value) ? CRC32.buf(value) : CRC32.str(value);
|
| 281 |
+
},
|
| 282 |
+
|
| 283 |
+
arrayParse(value): any[] {
|
| 284 |
+
return _.isArray(value) ? value : [value];
|
| 285 |
+
},
|
| 286 |
+
|
| 287 |
+
booleanParse(value) {
|
| 288 |
+
return value === "true" || value === true ? true : false;
|
| 289 |
+
},
|
| 290 |
+
|
| 291 |
+
encodeBASE64(value) {
|
| 292 |
+
return Buffer.from(value).toString("base64");
|
| 293 |
+
},
|
| 294 |
+
|
| 295 |
+
decodeBASE64(value) {
|
| 296 |
+
return Buffer.from(value, "base64").toString();
|
| 297 |
+
},
|
| 298 |
+
|
| 299 |
+
async fetchFileBASE64(url: string) {
|
| 300 |
+
const result = await axios.get(url, {
|
| 301 |
+
responseType: "arraybuffer",
|
| 302 |
+
});
|
| 303 |
+
return result.data.toString("base64");
|
| 304 |
+
},
|
| 305 |
+
};
|
| 306 |
+
|
| 307 |
+
export default util;
|
tsconfig.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"compilerOptions": {
|
| 3 |
+
"baseUrl": ".",
|
| 4 |
+
"module": "NodeNext",
|
| 5 |
+
"moduleResolution": "NodeNext",
|
| 6 |
+
"allowImportingTsExtensions": true,
|
| 7 |
+
"allowSyntheticDefaultImports": true,
|
| 8 |
+
"noEmit": true,
|
| 9 |
+
"paths": {
|
| 10 |
+
"@/*": ["src/*"]
|
| 11 |
+
},
|
| 12 |
+
"outDir": "./dist"
|
| 13 |
+
},
|
| 14 |
+
"include": ["src/**/*", "libs.d.ts"],
|
| 15 |
+
"exclude": ["node_modules", "dist"]
|
| 16 |
+
}
|
vercel.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"builds": [
|
| 3 |
+
{
|
| 4 |
+
"src": "./dist/*.html",
|
| 5 |
+
"use": "@vercel/static"
|
| 6 |
+
},
|
| 7 |
+
{
|
| 8 |
+
"src": "./dist/index.js",
|
| 9 |
+
"use": "@vercel/node"
|
| 10 |
+
}
|
| 11 |
+
],
|
| 12 |
+
"routes": [
|
| 13 |
+
{
|
| 14 |
+
"src": "/",
|
| 15 |
+
"dest": "/dist/welcome.html"
|
| 16 |
+
},
|
| 17 |
+
{
|
| 18 |
+
"src": "/(.*)",
|
| 19 |
+
"dest": "/dist",
|
| 20 |
+
"headers": {
|
| 21 |
+
"Access-Control-Allow-Credentials": "true",
|
| 22 |
+
"Access-Control-Allow-Methods": "GET,OPTIONS,PATCH,DELETE,POST,PUT",
|
| 23 |
+
"Access-Control-Allow-Headers": "X-CSRF-Token, X-Requested-With, Accept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 |
+
version "1.6.0"
|
| 7 |
+
resolved "https://registry.npmjs.org/@colors/colors/-/colors-1.6.0.tgz"
|
| 8 |
+
integrity sha512-Ir+AOibqzrIsL6ajt3Rz3LskB7OiMVHqltZmspbW/TJuTVuyOMirVqAkjfY6JISiLHgyNqicAC8AyHHGzNd/dA==
|
| 9 |
+
|
| 10 |
+
"@dabh/diagnostics@^2.0.2":
|
| 11 |
+
version "2.0.3"
|
| 12 |
+
resolved "https://registry.npmjs.org/@dabh/diagnostics/-/diagnostics-2.0.3.tgz"
|
| 13 |
+
integrity sha512-hrlQOIi7hAfzsMqlGSFyVucrx38O+j6wiGOf//H2ecvIEqYN4ADBSS2iLMh5UFyDunCNniUIPk/q3riFv45xRA==
|
| 14 |
+
dependencies:
|
| 15 |
+
colorspace "1.1.x"
|
| 16 |
+
enabled "2.0.x"
|
| 17 |
+
kuler "^2.0.0"
|
| 18 |
+
|
| 19 |
+
"@esbuild/linux-x64@0.23.0":
|
| 20 |
+
version "0.23.0"
|
| 21 |
+
resolved "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.23.0.tgz"
|
| 22 |
+
integrity sha512-a3pMQhUEJkITgAw6e0bWA+F+vFtCciMjW/LPtoj99MhVt+Mfb6bbL9hu2wmTZgNd994qTAEw+U/r6k3qHWWaOQ==
|
| 23 |
+
|
| 24 |
+
"@hapi/bourne@^3.0.0":
|
| 25 |
+
version "3.0.0"
|
| 26 |
+
resolved "https://registry.npmjs.org/@hapi/bourne/-/bourne-3.0.0.tgz"
|
| 27 |
+
integrity sha512-Waj1cwPXJDucOib4a3bAISsKJVb15MKi9IvmTI/7ssVEm6sywXGjVJDhl6/umt1pK1ZS7PacXU3A1PmFKHEZ2w==
|
| 28 |
+
|
| 29 |
+
"@isaacs/cliui@^8.0.2":
|
| 30 |
+
version "8.0.2"
|
| 31 |
+
resolved "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz"
|
| 32 |
+
integrity sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==
|
| 33 |
+
dependencies:
|
| 34 |
+
string-width "^5.1.2"
|
| 35 |
+
string-width-cjs "npm:string-width@^4.2.0"
|
| 36 |
+
strip-ansi "^7.0.1"
|
| 37 |
+
strip-ansi-cjs "npm:strip-ansi@^6.0.1"
|
| 38 |
+
wrap-ansi "^8.1.0"
|
| 39 |
+
wrap-ansi-cjs "npm:wrap-ansi@^7.0.0"
|
| 40 |
+
|
| 41 |
+
"@jridgewell/gen-mapping@^0.3.2":
|
| 42 |
+
version "0.3.5"
|
| 43 |
+
resolved "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz"
|
| 44 |
+
integrity sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==
|
| 45 |
+
dependencies:
|
| 46 |
+
"@jridgewell/set-array" "^1.2.1"
|
| 47 |
+
"@jridgewell/sourcemap-codec" "^1.4.10"
|
| 48 |
+
"@jridgewell/trace-mapping" "^0.3.24"
|
| 49 |
+
|
| 50 |
+
"@jridgewell/resolve-uri@^3.1.0":
|
| 51 |
+
version "3.1.2"
|
| 52 |
+
resolved "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz"
|
| 53 |
+
integrity sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==
|
| 54 |
+
|
| 55 |
+
"@jridgewell/set-array@^1.2.1":
|
| 56 |
+
version "1.2.1"
|
| 57 |
+
resolved "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz"
|
| 58 |
+
integrity sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==
|
| 59 |
+
|
| 60 |
+
"@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14":
|
| 61 |
+
version "1.5.0"
|
| 62 |
+
resolved "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz"
|
| 63 |
+
integrity sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==
|
| 64 |
+
|
| 65 |
+
"@jridgewell/trace-mapping@^0.3.24":
|
| 66 |
+
version "0.3.25"
|
| 67 |
+
resolved "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz"
|
| 68 |
+
integrity sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==
|
| 69 |
+
dependencies:
|
| 70 |
+
"@jridgewell/resolve-uri" "^3.1.0"
|
| 71 |
+
"@jridgewell/sourcemap-codec" "^1.4.14"
|
| 72 |
+
|
| 73 |
+
"@nodelib/fs.scandir@2.1.5":
|
| 74 |
+
version "2.1.5"
|
| 75 |
+
resolved "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz"
|
| 76 |
+
integrity sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==
|
| 77 |
+
dependencies:
|
| 78 |
+
"@nodelib/fs.stat" "2.0.5"
|
| 79 |
+
run-parallel "^1.1.9"
|
| 80 |
+
|
| 81 |
+
"@nodelib/fs.stat@^2.0.2", "@nodelib/fs.stat@2.0.5":
|
| 82 |
+
version "2.0.5"
|
| 83 |
+
resolved "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz"
|
| 84 |
+
integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==
|
| 85 |
+
|
| 86 |
+
"@nodelib/fs.walk@^1.2.3":
|
| 87 |
+
version "1.2.8"
|
| 88 |
+
resolved "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz"
|
| 89 |
+
integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==
|
| 90 |
+
dependencies:
|
| 91 |
+
"@nodelib/fs.scandir" "2.1.5"
|
| 92 |
+
fastq "^1.6.0"
|
| 93 |
+
|
| 94 |
+
"@pkgjs/parseargs@^0.11.0":
|
| 95 |
+
version "0.11.0"
|
| 96 |
+
resolved "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz"
|
| 97 |
+
integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==
|
| 98 |
+
|
| 99 |
+
"@rollup/rollup-linux-x64-gnu@4.19.1":
|
| 100 |
+
version "4.19.1"
|
| 101 |
+
resolved "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.19.1.tgz"
|
| 102 |
+
integrity sha512-XUXeI9eM8rMP8aGvii/aOOiMvTs7xlCosq9xCjcqI9+5hBxtjDpD+7Abm1ZhVIFE1J2h2VIg0t2DX/gjespC2Q==
|
| 103 |
+
|
| 104 |
+
"@rollup/rollup-linux-x64-musl@4.19.1":
|
| 105 |
+
version "4.19.1"
|
| 106 |
+
resolved "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.19.1.tgz"
|
| 107 |
+
integrity sha512-V7cBw/cKXMfEVhpSvVZhC+iGifD6U1zJ4tbibjjN+Xi3blSXaj/rJynAkCFFQfoG6VZrAiP7uGVzL440Q6Me2Q==
|
| 108 |
+
|
| 109 |
+
"@types/estree@1.0.5":
|
| 110 |
+
version "1.0.5"
|
| 111 |
+
resolved "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz"
|
| 112 |
+
integrity sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==
|
| 113 |
+
|
| 114 |
+
"@types/formidable@^2.0.4":
|
| 115 |
+
version "2.0.6"
|
| 116 |
+
resolved "https://registry.npmjs.org/@types/formidable/-/formidable-2.0.6.tgz"
|
| 117 |
+
integrity sha512-L4HcrA05IgQyNYJj6kItuIkXrInJvsXTPC5B1i64FggWKKqSL+4hgt7asiSNva75AoLQjq29oPxFfU4GAQ6Z2w==
|
| 118 |
+
dependencies:
|
| 119 |
+
"@types/node" "*"
|
| 120 |
+
|
| 121 |
+
"@types/lodash@^4.14.202":
|
| 122 |
+
version "4.17.7"
|
| 123 |
+
resolved "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.7.tgz"
|
| 124 |
+
integrity sha512-8wTvZawATi/lsmNu10/j2hk1KEP0IvjubqPE3cu1Xz7xfXXt5oCq3SNUz4fMIP4XGF9Ky+Ue2tBA3hcS7LSBlA==
|
| 125 |
+
|
| 126 |
+
"@types/luxon@~3.4.0":
|
| 127 |
+
version "3.4.2"
|
| 128 |
+
resolved "https://registry.npmjs.org/@types/luxon/-/luxon-3.4.2.tgz"
|
| 129 |
+
integrity sha512-TifLZlFudklWlMBfhubvgqTXRzLDI5pCbGa4P8a3wPyUQSW+1xQ5eDsreP9DWHX3tjq1ke96uYG/nwundroWcA==
|
| 130 |
+
|
| 131 |
+
"@types/mime@^3.0.4":
|
| 132 |
+
version "3.0.4"
|
| 133 |
+
resolved "https://registry.npmjs.org/@types/mime/-/mime-3.0.4.tgz"
|
| 134 |
+
integrity sha512-iJt33IQnVRkqeqC7PzBHPTC6fDlRNRW8vjrgqtScAhrmMwe8c4Eo7+fUGTa+XdWrpEgpyKWMYmi2dIwMAYRzPw==
|
| 135 |
+
|
| 136 |
+
"@types/node@*":
|
| 137 |
+
version "20.14.12"
|
| 138 |
+
resolved "https://registry.npmjs.org/@types/node/-/node-20.14.12.tgz"
|
| 139 |
+
integrity sha512-r7wNXakLeSsGT0H1AU863vS2wa5wBOK4bWMjZz2wj+8nBx+m5PeIn0k8AloSLpRuiwdRQZwarZqHE4FNArPuJQ==
|
| 140 |
+
dependencies:
|
| 141 |
+
undici-types "~5.26.4"
|
| 142 |
+
|
| 143 |
+
"@types/triple-beam@^1.3.2":
|
| 144 |
+
version "1.3.5"
|
| 145 |
+
resolved "https://registry.npmjs.org/@types/triple-beam/-/triple-beam-1.3.5.tgz"
|
| 146 |
+
integrity sha512-6WaYesThRMCl19iryMYP7/x2OVgCtbIVflDGFpWnb9irXI3UjYE4AzmYuiUKY1AJstGijoY+MgUszMgRxIYTYw==
|
| 147 |
+
|
| 148 |
+
accepts@^1.3.5:
|
| 149 |
+
version "1.3.8"
|
| 150 |
+
resolved "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz"
|
| 151 |
+
integrity sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==
|
| 152 |
+
dependencies:
|
| 153 |
+
mime-types "~2.1.34"
|
| 154 |
+
negotiator "0.6.3"
|
| 155 |
+
|
| 156 |
+
ansi-regex@^5.0.1:
|
| 157 |
+
version "5.0.1"
|
| 158 |
+
resolved "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz"
|
| 159 |
+
integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==
|
| 160 |
+
|
| 161 |
+
ansi-regex@^6.0.1:
|
| 162 |
+
version "6.0.1"
|
| 163 |
+
resolved "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz"
|
| 164 |
+
integrity sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==
|
| 165 |
+
|
| 166 |
+
ansi-styles@^4.0.0:
|
| 167 |
+
version "4.3.0"
|
| 168 |
+
resolved "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz"
|
| 169 |
+
integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==
|
| 170 |
+
dependencies:
|
| 171 |
+
color-convert "^2.0.1"
|
| 172 |
+
|
| 173 |
+
ansi-styles@^6.1.0:
|
| 174 |
+
version "6.2.1"
|
| 175 |
+
resolved "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz"
|
| 176 |
+
integrity sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==
|
| 177 |
+
|
| 178 |
+
any-promise@^1.0.0:
|
| 179 |
+
version "1.3.0"
|
| 180 |
+
resolved "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz"
|
| 181 |
+
integrity sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==
|
| 182 |
+
|
| 183 |
+
anymatch@~3.1.2:
|
| 184 |
+
version "3.1.3"
|
| 185 |
+
resolved "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz"
|
| 186 |
+
integrity sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==
|
| 187 |
+
dependencies:
|
| 188 |
+
normalize-path "^3.0.0"
|
| 189 |
+
picomatch "^2.0.4"
|
| 190 |
+
|
| 191 |
+
array-union@^2.1.0:
|
| 192 |
+
version "2.1.0"
|
| 193 |
+
resolved "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz"
|
| 194 |
+
integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==
|
| 195 |
+
|
| 196 |
+
asap@^2.0.0:
|
| 197 |
+
version "2.0.6"
|
| 198 |
+
resolved "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz"
|
| 199 |
+
integrity sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==
|
| 200 |
+
|
| 201 |
+
async@^3.2.3:
|
| 202 |
+
version "3.2.6"
|
| 203 |
+
resolved "https://registry.npmjs.org/async/-/async-3.2.6.tgz"
|
| 204 |
+
integrity sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==
|
| 205 |
+
|
| 206 |
+
asynckit@^0.4.0:
|
| 207 |
+
version "0.4.0"
|
| 208 |
+
resolved "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz"
|
| 209 |
+
integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==
|
| 210 |
+
|
| 211 |
+
axios@^1.6.7:
|
| 212 |
+
version "1.7.2"
|
| 213 |
+
resolved "https://registry.npmjs.org/axios/-/axios-1.7.2.tgz"
|
| 214 |
+
integrity sha512-2A8QhOMrbomlDuiLeK9XibIBzuHeRcqqNOHp0Cyp5EoJ1IFDh+XZH3A6BkXtv0K4gFGCI0Y4BM7B1wOEi0Rmgw==
|
| 215 |
+
dependencies:
|
| 216 |
+
follow-redirects "^1.15.6"
|
| 217 |
+
form-data "^4.0.0"
|
| 218 |
+
proxy-from-env "^1.1.0"
|
| 219 |
+
|
| 220 |
+
balanced-match@^1.0.0:
|
| 221 |
+
version "1.0.2"
|
| 222 |
+
resolved "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz"
|
| 223 |
+
integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==
|
| 224 |
+
|
| 225 |
+
binary-extensions@^2.0.0:
|
| 226 |
+
version "2.3.0"
|
| 227 |
+
resolved "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz"
|
| 228 |
+
integrity sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==
|
| 229 |
+
|
| 230 |
+
brace-expansion@^2.0.1:
|
| 231 |
+
version "2.0.1"
|
| 232 |
+
resolved "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz"
|
| 233 |
+
integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==
|
| 234 |
+
dependencies:
|
| 235 |
+
balanced-match "^1.0.0"
|
| 236 |
+
|
| 237 |
+
braces@^3.0.3, braces@~3.0.2:
|
| 238 |
+
version "3.0.3"
|
| 239 |
+
resolved "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz"
|
| 240 |
+
integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==
|
| 241 |
+
dependencies:
|
| 242 |
+
fill-range "^7.1.1"
|
| 243 |
+
|
| 244 |
+
build@^0.1.4:
|
| 245 |
+
version "0.1.4"
|
| 246 |
+
resolved "https://registry.npmjs.org/build/-/build-0.1.4.tgz"
|
| 247 |
+
integrity sha512-KwbDJ/zrsU8KZRRMfoURG14cKIAStUlS8D5jBDvtrZbwO5FEkYqc3oB8HIhRiyD64A48w1lc+sOmQ+mmBw5U/Q==
|
| 248 |
+
dependencies:
|
| 249 |
+
cssmin "0.3.x"
|
| 250 |
+
jsmin "1.x"
|
| 251 |
+
jxLoader "*"
|
| 252 |
+
moo-server "*"
|
| 253 |
+
promised-io "*"
|
| 254 |
+
timespan "2.x"
|
| 255 |
+
uglify-js "1.x"
|
| 256 |
+
walker "1.x"
|
| 257 |
+
winston "*"
|
| 258 |
+
wrench "1.3.x"
|
| 259 |
+
|
| 260 |
+
bundle-require@^5.0.0:
|
| 261 |
+
version "5.0.0"
|
| 262 |
+
resolved "https://registry.npmjs.org/bundle-require/-/bundle-require-5.0.0.tgz"
|
| 263 |
+
integrity sha512-GuziW3fSSmopcx4KRymQEJVbZUfqlCqcq7dvs6TYwKRZiegK/2buMxQTPs6MGlNv50wms1699qYO54R8XfRX4w==
|
| 264 |
+
dependencies:
|
| 265 |
+
load-tsconfig "^0.2.3"
|
| 266 |
+
|
| 267 |
+
bytes@3.1.2:
|
| 268 |
+
version "3.1.2"
|
| 269 |
+
resolved "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz"
|
| 270 |
+
integrity sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==
|
| 271 |
+
|
| 272 |
+
cac@^6.7.14:
|
| 273 |
+
version "6.7.14"
|
| 274 |
+
resolved "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz"
|
| 275 |
+
integrity sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==
|
| 276 |
+
|
| 277 |
+
cache-content-type@^1.0.0:
|
| 278 |
+
version "1.0.1"
|
| 279 |
+
resolved "https://registry.npmjs.org/cache-content-type/-/cache-content-type-1.0.1.tgz"
|
| 280 |
+
integrity sha512-IKufZ1o4Ut42YUrZSo8+qnMTrFuKkvyoLXUywKz9GJ5BrhOFGhLdkx9sG4KAnVvbY6kEcSFjLQul+DVmBm2bgA==
|
| 281 |
+
dependencies:
|
| 282 |
+
mime-types "^2.1.18"
|
| 283 |
+
ylru "^1.2.0"
|
| 284 |
+
|
| 285 |
+
call-bind@^1.0.7:
|
| 286 |
+
version "1.0.7"
|
| 287 |
+
resolved "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz"
|
| 288 |
+
integrity sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==
|
| 289 |
+
dependencies:
|
| 290 |
+
es-define-property "^1.0.0"
|
| 291 |
+
es-errors "^1.3.0"
|
| 292 |
+
function-bind "^1.1.2"
|
| 293 |
+
get-intrinsic "^1.2.4"
|
| 294 |
+
set-function-length "^1.2.1"
|
| 295 |
+
|
| 296 |
+
chokidar@^3.6.0:
|
| 297 |
+
version "3.6.0"
|
| 298 |
+
resolved "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz"
|
| 299 |
+
integrity sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==
|
| 300 |
+
dependencies:
|
| 301 |
+
anymatch "~3.1.2"
|
| 302 |
+
braces "~3.0.2"
|
| 303 |
+
glob-parent "~5.1.2"
|
| 304 |
+
is-binary-path "~2.1.0"
|
| 305 |
+
is-glob "~4.0.1"
|
| 306 |
+
normalize-path "~3.0.0"
|
| 307 |
+
readdirp "~3.6.0"
|
| 308 |
+
optionalDependencies:
|
| 309 |
+
fsevents "~2.3.2"
|
| 310 |
+
|
| 311 |
+
co-body@^5.1.1:
|
| 312 |
+
version "5.2.0"
|
| 313 |
+
resolved "https://registry.npmjs.org/co-body/-/co-body-5.2.0.tgz"
|
| 314 |
+
integrity sha512-sX/LQ7LqUhgyaxzbe7IqwPeTr2yfpfUIQ/dgpKo6ZI4y4lpQA0YxAomWIY+7I7rHWcG02PG+OuPREzMW/5tszQ==
|
| 315 |
+
dependencies:
|
| 316 |
+
inflation "^2.0.0"
|
| 317 |
+
qs "^6.4.0"
|
| 318 |
+
raw-body "^2.2.0"
|
| 319 |
+
type-is "^1.6.14"
|
| 320 |
+
|
| 321 |
+
co-body@^6.0.0:
|
| 322 |
+
version "6.2.0"
|
| 323 |
+
resolved "https://registry.npmjs.org/co-body/-/co-body-6.2.0.tgz"
|
| 324 |
+
integrity sha512-Kbpv2Yd1NdL1V/V4cwLVxraHDV6K8ayohr2rmH0J87Er8+zJjcTa6dAn9QMPC9CRgU8+aNajKbSf1TzDB1yKPA==
|
| 325 |
+
dependencies:
|
| 326 |
+
"@hapi/bourne" "^3.0.0"
|
| 327 |
+
inflation "^2.0.0"
|
| 328 |
+
qs "^6.5.2"
|
| 329 |
+
raw-body "^2.3.3"
|
| 330 |
+
type-is "^1.6.16"
|
| 331 |
+
|
| 332 |
+
co@^4.6.0:
|
| 333 |
+
version "4.6.0"
|
| 334 |
+
resolved "https://registry.npmjs.org/co/-/co-4.6.0.tgz"
|
| 335 |
+
integrity sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==
|
| 336 |
+
|
| 337 |
+
color-convert@^1.9.3:
|
| 338 |
+
version "1.9.3"
|
| 339 |
+
resolved "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz"
|
| 340 |
+
integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==
|
| 341 |
+
dependencies:
|
| 342 |
+
color-name "1.1.3"
|
| 343 |
+
|
| 344 |
+
color-convert@^2.0.1:
|
| 345 |
+
version "2.0.1"
|
| 346 |
+
resolved "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz"
|
| 347 |
+
integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==
|
| 348 |
+
dependencies:
|
| 349 |
+
color-name "~1.1.4"
|
| 350 |
+
|
| 351 |
+
color-name@^1.0.0, color-name@~1.1.4:
|
| 352 |
+
version "1.1.4"
|
| 353 |
+
resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz"
|
| 354 |
+
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
|
| 355 |
+
|
| 356 |
+
color-name@1.1.3:
|
| 357 |
+
version "1.1.3"
|
| 358 |
+
resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz"
|
| 359 |
+
integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==
|
| 360 |
+
|
| 361 |
+
color-string@^1.6.0:
|
| 362 |
+
version "1.9.1"
|
| 363 |
+
resolved "https://registry.npmjs.org/color-string/-/color-string-1.9.1.tgz"
|
| 364 |
+
integrity sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==
|
| 365 |
+
dependencies:
|
| 366 |
+
color-name "^1.0.0"
|
| 367 |
+
simple-swizzle "^0.2.2"
|
| 368 |
+
|
| 369 |
+
color@^3.1.3:
|
| 370 |
+
version "3.2.1"
|
| 371 |
+
resolved "https://registry.npmjs.org/color/-/color-3.2.1.tgz"
|
| 372 |
+
integrity sha512-aBl7dZI9ENN6fUGC7mWpMTPNHmWUSNan9tuWN6ahh5ZLNk9baLJOnSMlrQkHcrfFgz2/RigjUVAjdx36VcemKA==
|
| 373 |
+
dependencies:
|
| 374 |
+
color-convert "^1.9.3"
|
| 375 |
+
color-string "^1.6.0"
|
| 376 |
+
|
| 377 |
+
colors@^1.4.0:
|
| 378 |
+
version "1.4.0"
|
| 379 |
+
resolved "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz"
|
| 380 |
+
integrity sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==
|
| 381 |
+
|
| 382 |
+
colorspace@1.1.x:
|
| 383 |
+
version "1.1.4"
|
| 384 |
+
resolved "https://registry.npmjs.org/colorspace/-/colorspace-1.1.4.tgz"
|
| 385 |
+
integrity sha512-BgvKJiuVu1igBUF2kEjRCZXol6wiiGbY5ipL/oVPwm0BL9sIpMIzM8IK7vwuxIIzOXMV3Ey5w+vxhm0rR/TN8w==
|
| 386 |
+
dependencies:
|
| 387 |
+
color "^3.1.3"
|
| 388 |
+
text-hex "1.0.x"
|
| 389 |
+
|
| 390 |
+
combined-stream@^1.0.8:
|
| 391 |
+
version "1.0.8"
|
| 392 |
+
resolved "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz"
|
| 393 |
+
integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==
|
| 394 |
+
dependencies:
|
| 395 |
+
delayed-stream "~1.0.0"
|
| 396 |
+
|
| 397 |
+
commander@^4.0.0:
|
| 398 |
+
version "4.1.1"
|
| 399 |
+
resolved "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz"
|
| 400 |
+
integrity sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==
|
| 401 |
+
|
| 402 |
+
consola@^3.2.3:
|
| 403 |
+
version "3.2.3"
|
| 404 |
+
resolved "https://registry.npmjs.org/consola/-/consola-3.2.3.tgz"
|
| 405 |
+
integrity sha512-I5qxpzLv+sJhTVEoLYNcTW+bThDCPsit0vLNKShZx6rLtpilNpmmeTPaeqJb9ZE9dV3DGaeby6Vuhrw38WjeyQ==
|
| 406 |
+
|
| 407 |
+
content-disposition@~0.5.2:
|
| 408 |
+
version "0.5.4"
|
| 409 |
+
resolved "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz"
|
| 410 |
+
integrity sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==
|
| 411 |
+
dependencies:
|
| 412 |
+
safe-buffer "5.2.1"
|
| 413 |
+
|
| 414 |
+
content-type@^1.0.4:
|
| 415 |
+
version "1.0.5"
|
| 416 |
+
resolved "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz"
|
| 417 |
+
integrity sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==
|
| 418 |
+
|
| 419 |
+
cookies@~0.9.0:
|
| 420 |
+
version "0.9.1"
|
| 421 |
+
resolved "https://registry.npmjs.org/cookies/-/cookies-0.9.1.tgz"
|
| 422 |
+
integrity sha512-TG2hpqe4ELx54QER/S3HQ9SRVnQnGBtKUz5bLQWtYAQ+o6GpgMs6sYUvaiJjVxb+UXwhRhAEP3m7LbsIZ77Hmw==
|
| 423 |
+
dependencies:
|
| 424 |
+
depd "~2.0.0"
|
| 425 |
+
keygrip "~1.1.0"
|
| 426 |
+
|
| 427 |
+
copy-to@^2.0.1:
|
| 428 |
+
version "2.0.1"
|
| 429 |
+
resolved "https://registry.npmjs.org/copy-to/-/copy-to-2.0.1.tgz"
|
| 430 |
+
integrity sha512-3DdaFaU/Zf1AnpLiFDeNCD4TOWe3Zl2RZaTzUvWiIk5ERzcCodOE20Vqq4fzCbNoHURFHT4/us/Lfq+S2zyY4w==
|
| 431 |
+
|
| 432 |
+
crc-32@^1.2.2:
|
| 433 |
+
version "1.2.2"
|
| 434 |
+
resolved "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz"
|
| 435 |
+
integrity sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==
|
| 436 |
+
|
| 437 |
+
cron@^3.1.6:
|
| 438 |
+
version "3.1.7"
|
| 439 |
+
resolved "https://registry.npmjs.org/cron/-/cron-3.1.7.tgz"
|
| 440 |
+
integrity sha512-tlBg7ARsAMQLzgwqVxy8AZl/qlTc5nibqYwtNGoCrd+cV+ugI+tvZC1oT/8dFH8W455YrywGykx/KMmAqOr7Jw==
|
| 441 |
+
dependencies:
|
| 442 |
+
"@types/luxon" "~3.4.0"
|
| 443 |
+
luxon "~3.4.0"
|
| 444 |
+
|
| 445 |
+
cross-spawn@^7.0.0, cross-spawn@^7.0.3:
|
| 446 |
+
version "7.0.3"
|
| 447 |
+
resolved "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz"
|
| 448 |
+
integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==
|
| 449 |
+
dependencies:
|
| 450 |
+
path-key "^3.1.0"
|
| 451 |
+
shebang-command "^2.0.0"
|
| 452 |
+
which "^2.0.1"
|
| 453 |
+
|
| 454 |
+
cssmin@0.3.x:
|
| 455 |
+
version "0.3.2"
|
| 456 |
+
resolved "https://registry.npmjs.org/cssmin/-/cssmin-0.3.2.tgz"
|
| 457 |
+
integrity sha512-bynxGIAJ8ybrnFobjsQotIjA8HFDDgPwbeUWNXXXfR+B4f9kkxdcUyagJoQCSUOfMV+ZZ6bMn8bvbozlCzUGwQ==
|
| 458 |
+
|
| 459 |
+
date-fns@^3.3.1:
|
| 460 |
+
version "3.6.0"
|
| 461 |
+
resolved "https://registry.npmjs.org/date-fns/-/date-fns-3.6.0.tgz"
|
| 462 |
+
integrity sha512-fRHTG8g/Gif+kSh50gaGEdToemgfj74aRX3swtiouboip5JDLAyDE9F11nHMIcvOaXeOC6D7SpNhi7uFyB7Uww==
|
| 463 |
+
|
| 464 |
+
debug@^4.3.2, debug@^4.3.4, debug@^4.3.5:
|
| 465 |
+
version "4.3.6"
|
| 466 |
+
resolved "https://registry.npmjs.org/debug/-/debug-4.3.6.tgz"
|
| 467 |
+
integrity sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==
|
| 468 |
+
dependencies:
|
| 469 |
+
ms "2.1.2"
|
| 470 |
+
|
| 471 |
+
deep-equal@~1.0.1:
|
| 472 |
+
version "1.0.1"
|
| 473 |
+
resolved "https://registry.npmjs.org/deep-equal/-/deep-equal-1.0.1.tgz"
|
| 474 |
+
integrity sha512-bHtC0iYvWhyaTzvV3CZgPeZQqCOBGyGsVV7v4eevpdkLHfiSrXUdBG+qAuSz4RI70sszvjQ1QSZ98An1yNwpSw==
|
| 475 |
+
|
| 476 |
+
define-data-property@^1.1.4:
|
| 477 |
+
version "1.1.4"
|
| 478 |
+
resolved "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz"
|
| 479 |
+
integrity sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==
|
| 480 |
+
dependencies:
|
| 481 |
+
es-define-property "^1.0.0"
|
| 482 |
+
es-errors "^1.3.0"
|
| 483 |
+
gopd "^1.0.1"
|
| 484 |
+
|
| 485 |
+
delayed-stream@~1.0.0:
|
| 486 |
+
version "1.0.0"
|
| 487 |
+
resolved "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz"
|
| 488 |
+
integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==
|
| 489 |
+
|
| 490 |
+
delegates@^1.0.0:
|
| 491 |
+
version "1.0.0"
|
| 492 |
+
resolved "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz"
|
| 493 |
+
integrity sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==
|
| 494 |
+
|
| 495 |
+
depd@^2.0.0, depd@~2.0.0, depd@2.0.0:
|
| 496 |
+
version "2.0.0"
|
| 497 |
+
resolved "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz"
|
| 498 |
+
integrity sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==
|
| 499 |
+
|
| 500 |
+
depd@~1.1.2:
|
| 501 |
+
version "1.1.2"
|
| 502 |
+
resolved "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz"
|
| 503 |
+
integrity sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==
|
| 504 |
+
|
| 505 |
+
destroy@^1.0.4:
|
| 506 |
+
version "1.2.0"
|
| 507 |
+
resolved "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz"
|
| 508 |
+
integrity sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==
|
| 509 |
+
|
| 510 |
+
dezalgo@^1.0.4:
|
| 511 |
+
version "1.0.4"
|
| 512 |
+
resolved "https://registry.npmjs.org/dezalgo/-/dezalgo-1.0.4.tgz"
|
| 513 |
+
integrity sha512-rXSP0bf+5n0Qonsb+SVVfNfIsimO4HEtmnIpPHY8Q1UCzKlQrDMfdobr8nJOOsRgWCyMRqeSBQzmWUMq7zvVig==
|
| 514 |
+
dependencies:
|
| 515 |
+
asap "^2.0.0"
|
| 516 |
+
wrappy "1"
|
| 517 |
+
|
| 518 |
+
dir-glob@^3.0.1:
|
| 519 |
+
version "3.0.1"
|
| 520 |
+
resolved "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz"
|
| 521 |
+
integrity sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==
|
| 522 |
+
dependencies:
|
| 523 |
+
path-type "^4.0.0"
|
| 524 |
+
|
| 525 |
+
eastasianwidth@^0.2.0:
|
| 526 |
+
version "0.2.0"
|
| 527 |
+
resolved "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz"
|
| 528 |
+
integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==
|
| 529 |
+
|
| 530 |
+
ee-first@1.1.1:
|
| 531 |
+
version "1.1.1"
|
| 532 |
+
resolved "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz"
|
| 533 |
+
integrity sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==
|
| 534 |
+
|
| 535 |
+
emoji-regex@^8.0.0:
|
| 536 |
+
version "8.0.0"
|
| 537 |
+
resolved "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz"
|
| 538 |
+
integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==
|
| 539 |
+
|
| 540 |
+
emoji-regex@^9.2.2:
|
| 541 |
+
version "9.2.2"
|
| 542 |
+
resolved "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz"
|
| 543 |
+
integrity sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==
|
| 544 |
+
|
| 545 |
+
enabled@2.0.x:
|
| 546 |
+
version "2.0.0"
|
| 547 |
+
resolved "https://registry.npmjs.org/enabled/-/enabled-2.0.0.tgz"
|
| 548 |
+
integrity sha512-AKrN98kuwOzMIdAizXGI86UFBoo26CL21UM763y1h/GMSJ4/OHU9k2YlsmBpyScFo/wbLzWQJBMCW4+IO3/+OQ==
|
| 549 |
+
|
| 550 |
+
encodeurl@^1.0.2:
|
| 551 |
+
version "1.0.2"
|
| 552 |
+
resolved "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz"
|
| 553 |
+
integrity sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==
|
| 554 |
+
|
| 555 |
+
es-define-property@^1.0.0:
|
| 556 |
+
version "1.0.0"
|
| 557 |
+
resolved "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz"
|
| 558 |
+
integrity sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==
|
| 559 |
+
dependencies:
|
| 560 |
+
get-intrinsic "^1.2.4"
|
| 561 |
+
|
| 562 |
+
es-errors@^1.3.0:
|
| 563 |
+
version "1.3.0"
|
| 564 |
+
resolved "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz"
|
| 565 |
+
integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==
|
| 566 |
+
|
| 567 |
+
esbuild@^0.23.0, esbuild@>=0.18:
|
| 568 |
+
version "0.23.0"
|
| 569 |
+
resolved "https://registry.npmjs.org/esbuild/-/esbuild-0.23.0.tgz"
|
| 570 |
+
integrity sha512-1lvV17H2bMYda/WaFb2jLPeHU3zml2k4/yagNMG8Q/YtfMjCwEUZa2eXXMgZTVSL5q1n4H7sQ0X6CdJDqqeCFA==
|
| 571 |
+
optionalDependencies:
|
| 572 |
+
"@esbuild/aix-ppc64" "0.23.0"
|
| 573 |
+
"@esbuild/android-arm" "0.23.0"
|
| 574 |
+
"@esbuild/android-arm64" "0.23.0"
|
| 575 |
+
"@esbuild/android-x64" "0.23.0"
|
| 576 |
+
"@esbuild/darwin-arm64" "0.23.0"
|
| 577 |
+
"@esbuild/darwin-x64" "0.23.0"
|
| 578 |
+
"@esbuild/freebsd-arm64" "0.23.0"
|
| 579 |
+
"@esbuild/freebsd-x64" "0.23.0"
|
| 580 |
+
"@esbuild/linux-arm" "0.23.0"
|
| 581 |
+
"@esbuild/linux-arm64" "0.23.0"
|
| 582 |
+
"@esbuild/linux-ia32" "0.23.0"
|
| 583 |
+
"@esbuild/linux-loong64" "0.23.0"
|
| 584 |
+
"@esbuild/linux-mips64el" "0.23.0"
|
| 585 |
+
"@esbuild/linux-ppc64" "0.23.0"
|
| 586 |
+
"@esbuild/linux-riscv64" "0.23.0"
|
| 587 |
+
"@esbuild/linux-s390x" "0.23.0"
|
| 588 |
+
"@esbuild/linux-x64" "0.23.0"
|
| 589 |
+
"@esbuild/netbsd-x64" "0.23.0"
|
| 590 |
+
"@esbuild/openbsd-arm64" "0.23.0"
|
| 591 |
+
"@esbuild/openbsd-x64" "0.23.0"
|
| 592 |
+
"@esbuild/sunos-x64" "0.23.0"
|
| 593 |
+
"@esbuild/win32-arm64" "0.23.0"
|
| 594 |
+
"@esbuild/win32-ia32" "0.23.0"
|
| 595 |
+
"@esbuild/win32-x64" "0.23.0"
|
| 596 |
+
|
| 597 |
+
escape-html@^1.0.3:
|
| 598 |
+
version "1.0.3"
|
| 599 |
+
resolved "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz"
|
| 600 |
+
integrity sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==
|
| 601 |
+
|
| 602 |
+
eventsource-parser@^1.1.2:
|
| 603 |
+
version "1.1.2"
|
| 604 |
+
resolved "https://registry.npmjs.org/eventsource-parser/-/eventsource-parser-1.1.2.tgz"
|
| 605 |
+
integrity sha512-v0eOBUbiaFojBu2s2NPBfYUoRR9GjcDNvCXVaqEf5vVfpIAh9f8RCo4vXTP8c63QRKCFwoLpMpTdPwwhEKVgzA==
|
| 606 |
+
|
| 607 |
+
execa@^5.1.1:
|
| 608 |
+
version "5.1.1"
|
| 609 |
+
resolved "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz"
|
| 610 |
+
integrity sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==
|
| 611 |
+
dependencies:
|
| 612 |
+
cross-spawn "^7.0.3"
|
| 613 |
+
get-stream "^6.0.0"
|
| 614 |
+
human-signals "^2.1.0"
|
| 615 |
+
is-stream "^2.0.0"
|
| 616 |
+
merge-stream "^2.0.0"
|
| 617 |
+
npm-run-path "^4.0.1"
|
| 618 |
+
onetime "^5.1.2"
|
| 619 |
+
signal-exit "^3.0.3"
|
| 620 |
+
strip-final-newline "^2.0.0"
|
| 621 |
+
|
| 622 |
+
fast-glob@^3.2.9:
|
| 623 |
+
version "3.3.2"
|
| 624 |
+
resolved "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz"
|
| 625 |
+
integrity sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==
|
| 626 |
+
dependencies:
|
| 627 |
+
"@nodelib/fs.stat" "^2.0.2"
|
| 628 |
+
"@nodelib/fs.walk" "^1.2.3"
|
| 629 |
+
glob-parent "^5.1.2"
|
| 630 |
+
merge2 "^1.3.0"
|
| 631 |
+
micromatch "^4.0.4"
|
| 632 |
+
|
| 633 |
+
fastq@^1.6.0:
|
| 634 |
+
version "1.17.1"
|
| 635 |
+
resolved "https://registry.npmjs.org/fastq/-/fastq-1.17.1.tgz"
|
| 636 |
+
integrity sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==
|
| 637 |
+
dependencies:
|
| 638 |
+
reusify "^1.0.4"
|
| 639 |
+
|
| 640 |
+
fecha@^4.2.0:
|
| 641 |
+
version "4.2.3"
|
| 642 |
+
resolved "https://registry.npmjs.org/fecha/-/fecha-4.2.3.tgz"
|
| 643 |
+
integrity sha512-OP2IUU6HeYKJi3i0z4A19kHMQoLVs4Hc+DPqqxI2h/DPZHTm/vjsfC6P0b4jCMy14XizLBqvndQ+UilD7707Jw==
|
| 644 |
+
|
| 645 |
+
fill-range@^7.1.1:
|
| 646 |
+
version "7.1.1"
|
| 647 |
+
resolved "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz"
|
| 648 |
+
integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==
|
| 649 |
+
dependencies:
|
| 650 |
+
to-regex-range "^5.0.1"
|
| 651 |
+
|
| 652 |
+
fn.name@1.x.x:
|
| 653 |
+
version "1.1.0"
|
| 654 |
+
resolved "https://registry.npmjs.org/fn.name/-/fn.name-1.1.0.tgz"
|
| 655 |
+
integrity sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw==
|
| 656 |
+
|
| 657 |
+
follow-redirects@^1.15.6:
|
| 658 |
+
version "1.15.6"
|
| 659 |
+
resolved "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz"
|
| 660 |
+
integrity sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==
|
| 661 |
+
|
| 662 |
+
foreground-child@^3.1.0:
|
| 663 |
+
version "3.2.1"
|
| 664 |
+
resolved "https://registry.npmjs.org/foreground-child/-/foreground-child-3.2.1.tgz"
|
| 665 |
+
integrity sha512-PXUUyLqrR2XCWICfv6ukppP96sdFwWbNEnfEMt7jNsISjMsvaLNinAHNDYyvkyU+SZG2BTSbT5NjG+vZslfGTA==
|
| 666 |
+
dependencies:
|
| 667 |
+
cross-spawn "^7.0.0"
|
| 668 |
+
signal-exit "^4.0.1"
|
| 669 |
+
|
| 670 |
+
form-data@^4.0.0:
|
| 671 |
+
version "4.0.0"
|
| 672 |
+
resolved "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz"
|
| 673 |
+
integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==
|
| 674 |
+
dependencies:
|
| 675 |
+
asynckit "^0.4.0"
|
| 676 |
+
combined-stream "^1.0.8"
|
| 677 |
+
mime-types "^2.1.12"
|
| 678 |
+
|
| 679 |
+
formidable@^2.0.1:
|
| 680 |
+
version "2.1.2"
|
| 681 |
+
resolved "https://registry.npmjs.org/formidable/-/formidable-2.1.2.tgz"
|
| 682 |
+
integrity sha512-CM3GuJ57US06mlpQ47YcunuUZ9jpm8Vx+P2CGt2j7HpgkKZO/DJYQ0Bobim8G6PFQmK5lOqOOdUXboU+h73A4g==
|
| 683 |
+
dependencies:
|
| 684 |
+
dezalgo "^1.0.4"
|
| 685 |
+
hexoid "^1.0.0"
|
| 686 |
+
once "^1.4.0"
|
| 687 |
+
qs "^6.11.0"
|
| 688 |
+
|
| 689 |
+
fresh@~0.5.2:
|
| 690 |
+
version "0.5.2"
|
| 691 |
+
resolved "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz"
|
| 692 |
+
integrity sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==
|
| 693 |
+
|
| 694 |
+
fs-extra@^11.2.0:
|
| 695 |
+
version "11.2.0"
|
| 696 |
+
resolved "https://registry.npmjs.org/fs-extra/-/fs-extra-11.2.0.tgz"
|
| 697 |
+
integrity sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==
|
| 698 |
+
dependencies:
|
| 699 |
+
graceful-fs "^4.2.0"
|
| 700 |
+
jsonfile "^6.0.1"
|
| 701 |
+
universalify "^2.0.0"
|
| 702 |
+
|
| 703 |
+
function-bind@^1.1.2:
|
| 704 |
+
version "1.1.2"
|
| 705 |
+
resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz"
|
| 706 |
+
integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==
|
| 707 |
+
|
| 708 |
+
get-intrinsic@^1.1.3, get-intrinsic@^1.2.4:
|
| 709 |
+
version "1.2.4"
|
| 710 |
+
resolved "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz"
|
| 711 |
+
integrity sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==
|
| 712 |
+
dependencies:
|
| 713 |
+
es-errors "^1.3.0"
|
| 714 |
+
function-bind "^1.1.2"
|
| 715 |
+
has-proto "^1.0.1"
|
| 716 |
+
has-symbols "^1.0.3"
|
| 717 |
+
hasown "^2.0.0"
|
| 718 |
+
|
| 719 |
+
get-stream@^6.0.0:
|
| 720 |
+
version "6.0.1"
|
| 721 |
+
resolved "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz"
|
| 722 |
+
integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==
|
| 723 |
+
|
| 724 |
+
glob-parent@^5.1.2, glob-parent@~5.1.2:
|
| 725 |
+
version "5.1.2"
|
| 726 |
+
resolved "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz"
|
| 727 |
+
integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==
|
| 728 |
+
dependencies:
|
| 729 |
+
is-glob "^4.0.1"
|
| 730 |
+
|
| 731 |
+
glob@^10.3.10:
|
| 732 |
+
version "10.4.5"
|
| 733 |
+
resolved "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz"
|
| 734 |
+
integrity sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==
|
| 735 |
+
dependencies:
|
| 736 |
+
foreground-child "^3.1.0"
|
| 737 |
+
jackspeak "^3.1.2"
|
| 738 |
+
minimatch "^9.0.4"
|
| 739 |
+
minipass "^7.1.2"
|
| 740 |
+
package-json-from-dist "^1.0.0"
|
| 741 |
+
path-scurry "^1.11.1"
|
| 742 |
+
|
| 743 |
+
globby@^11.1.0:
|
| 744 |
+
version "11.1.0"
|
| 745 |
+
resolved "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz"
|
| 746 |
+
integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==
|
| 747 |
+
dependencies:
|
| 748 |
+
array-union "^2.1.0"
|
| 749 |
+
dir-glob "^3.0.1"
|
| 750 |
+
fast-glob "^3.2.9"
|
| 751 |
+
ignore "^5.2.0"
|
| 752 |
+
merge2 "^1.4.1"
|
| 753 |
+
slash "^3.0.0"
|
| 754 |
+
|
| 755 |
+
gopd@^1.0.1:
|
| 756 |
+
version "1.0.1"
|
| 757 |
+
resolved "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz"
|
| 758 |
+
integrity sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==
|
| 759 |
+
dependencies:
|
| 760 |
+
get-intrinsic "^1.1.3"
|
| 761 |
+
|
| 762 |
+
graceful-fs@^4.1.6, graceful-fs@^4.2.0:
|
| 763 |
+
version "4.2.11"
|
| 764 |
+
resolved "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz"
|
| 765 |
+
integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==
|
| 766 |
+
|
| 767 |
+
has-property-descriptors@^1.0.2:
|
| 768 |
+
version "1.0.2"
|
| 769 |
+
resolved "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz"
|
| 770 |
+
integrity sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==
|
| 771 |
+
dependencies:
|
| 772 |
+
es-define-property "^1.0.0"
|
| 773 |
+
|
| 774 |
+
has-proto@^1.0.1:
|
| 775 |
+
version "1.0.3"
|
| 776 |
+
resolved "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz"
|
| 777 |
+
integrity sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==
|
| 778 |
+
|
| 779 |
+
has-symbols@^1.0.3:
|
| 780 |
+
version "1.0.3"
|
| 781 |
+
resolved "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz"
|
| 782 |
+
integrity sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==
|
| 783 |
+
|
| 784 |
+
has-tostringtag@^1.0.0:
|
| 785 |
+
version "1.0.2"
|
| 786 |
+
resolved "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz"
|
| 787 |
+
integrity sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==
|
| 788 |
+
dependencies:
|
| 789 |
+
has-symbols "^1.0.3"
|
| 790 |
+
|
| 791 |
+
hasown@^2.0.0:
|
| 792 |
+
version "2.0.2"
|
| 793 |
+
resolved "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz"
|
| 794 |
+
integrity sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==
|
| 795 |
+
dependencies:
|
| 796 |
+
function-bind "^1.1.2"
|
| 797 |
+
|
| 798 |
+
hexoid@^1.0.0:
|
| 799 |
+
version "1.0.0"
|
| 800 |
+
resolved "https://registry.npmjs.org/hexoid/-/hexoid-1.0.0.tgz"
|
| 801 |
+
integrity sha512-QFLV0taWQOZtvIRIAdBChesmogZrtuXvVWsFHZTk2SU+anspqZ2vMnoLg7IE1+Uk16N19APic1BuF8bC8c2m5g==
|
| 802 |
+
|
| 803 |
+
http-assert@^1.3.0:
|
| 804 |
+
version "1.5.0"
|
| 805 |
+
resolved "https://registry.npmjs.org/http-assert/-/http-assert-1.5.0.tgz"
|
| 806 |
+
integrity sha512-uPpH7OKX4H25hBmU6G1jWNaqJGpTXxey+YOUizJUAgu0AjLUeC8D73hTrhvDS5D+GJN1DN1+hhc/eF/wpxtp0w==
|
| 807 |
+
dependencies:
|
| 808 |
+
deep-equal "~1.0.1"
|
| 809 |
+
http-errors "~1.8.0"
|
| 810 |
+
|
| 811 |
+
http-errors@^1.6.3, http-errors@~1.8.0:
|
| 812 |
+
version "1.8.1"
|
| 813 |
+
resolved "https://registry.npmjs.org/http-errors/-/http-errors-1.8.1.tgz"
|
| 814 |
+
integrity sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g==
|
| 815 |
+
dependencies:
|
| 816 |
+
depd "~1.1.2"
|
| 817 |
+
inherits "2.0.4"
|
| 818 |
+
setprototypeof "1.2.0"
|
| 819 |
+
statuses ">= 1.5.0 < 2"
|
| 820 |
+
toidentifier "1.0.1"
|
| 821 |
+
|
| 822 |
+
http-errors@^2.0.0:
|
| 823 |
+
version "2.0.0"
|
| 824 |
+
resolved "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz"
|
| 825 |
+
integrity sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==
|
| 826 |
+
dependencies:
|
| 827 |
+
depd "2.0.0"
|
| 828 |
+
inherits "2.0.4"
|
| 829 |
+
setprototypeof "1.2.0"
|
| 830 |
+
statuses "2.0.1"
|
| 831 |
+
toidentifier "1.0.1"
|
| 832 |
+
|
| 833 |
+
http-errors@2.0.0:
|
| 834 |
+
version "2.0.0"
|
| 835 |
+
resolved "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz"
|
| 836 |
+
integrity sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==
|
| 837 |
+
dependencies:
|
| 838 |
+
depd "2.0.0"
|
| 839 |
+
inherits "2.0.4"
|
| 840 |
+
setprototypeof "1.2.0"
|
| 841 |
+
statuses "2.0.1"
|
| 842 |
+
toidentifier "1.0.1"
|
| 843 |
+
|
| 844 |
+
human-signals@^2.1.0:
|
| 845 |
+
version "2.1.0"
|
| 846 |
+
resolved "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz"
|
| 847 |
+
integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==
|
| 848 |
+
|
| 849 |
+
iconv-lite@0.4.24:
|
| 850 |
+
version "0.4.24"
|
| 851 |
+
resolved "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz"
|
| 852 |
+
integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==
|
| 853 |
+
dependencies:
|
| 854 |
+
safer-buffer ">= 2.1.2 < 3"
|
| 855 |
+
|
| 856 |
+
ignore@^5.2.0:
|
| 857 |
+
version "5.3.1"
|
| 858 |
+
resolved "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz"
|
| 859 |
+
integrity sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==
|
| 860 |
+
|
| 861 |
+
inflation@^2.0.0:
|
| 862 |
+
version "2.1.0"
|
| 863 |
+
resolved "https://registry.npmjs.org/inflation/-/inflation-2.1.0.tgz"
|
| 864 |
+
integrity sha512-t54PPJHG1Pp7VQvxyVCJ9mBbjG3Hqryges9bXoOO6GExCPa+//i/d5GSuFtpx3ALLd7lgIAur6zrIlBQyJuMlQ==
|
| 865 |
+
|
| 866 |
+
inherits@^2.0.3, inherits@2.0.4:
|
| 867 |
+
version "2.0.4"
|
| 868 |
+
resolved "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz"
|
| 869 |
+
integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
|
| 870 |
+
|
| 871 |
+
is-arrayish@^0.3.1:
|
| 872 |
+
version "0.3.2"
|
| 873 |
+
resolved "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz"
|
| 874 |
+
integrity sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==
|
| 875 |
+
|
| 876 |
+
is-binary-path@~2.1.0:
|
| 877 |
+
version "2.1.0"
|
| 878 |
+
resolved "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz"
|
| 879 |
+
integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==
|
| 880 |
+
dependencies:
|
| 881 |
+
binary-extensions "^2.0.0"
|
| 882 |
+
|
| 883 |
+
is-extglob@^2.1.1:
|
| 884 |
+
version "2.1.1"
|
| 885 |
+
resolved "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz"
|
| 886 |
+
integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==
|
| 887 |
+
|
| 888 |
+
is-fullwidth-code-point@^3.0.0:
|
| 889 |
+
version "3.0.0"
|
| 890 |
+
resolved "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz"
|
| 891 |
+
integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==
|
| 892 |
+
|
| 893 |
+
is-generator-function@^1.0.7:
|
| 894 |
+
version "1.0.10"
|
| 895 |
+
resolved "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz"
|
| 896 |
+
integrity sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==
|
| 897 |
+
dependencies:
|
| 898 |
+
has-tostringtag "^1.0.0"
|
| 899 |
+
|
| 900 |
+
is-glob@^4.0.1, is-glob@~4.0.1:
|
| 901 |
+
version "4.0.3"
|
| 902 |
+
resolved "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz"
|
| 903 |
+
integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==
|
| 904 |
+
dependencies:
|
| 905 |
+
is-extglob "^2.1.1"
|
| 906 |
+
|
| 907 |
+
is-number@^7.0.0:
|
| 908 |
+
version "7.0.0"
|
| 909 |
+
resolved "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz"
|
| 910 |
+
integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==
|
| 911 |
+
|
| 912 |
+
is-stream@^2.0.0:
|
| 913 |
+
version "2.0.1"
|
| 914 |
+
resolved "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz"
|
| 915 |
+
integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==
|
| 916 |
+
|
| 917 |
+
isexe@^2.0.0:
|
| 918 |
+
version "2.0.0"
|
| 919 |
+
resolved "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz"
|
| 920 |
+
integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==
|
| 921 |
+
|
| 922 |
+
jackspeak@^3.1.2:
|
| 923 |
+
version "3.4.3"
|
| 924 |
+
resolved "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz"
|
| 925 |
+
integrity sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==
|
| 926 |
+
dependencies:
|
| 927 |
+
"@isaacs/cliui" "^8.0.2"
|
| 928 |
+
optionalDependencies:
|
| 929 |
+
"@pkgjs/parseargs" "^0.11.0"
|
| 930 |
+
|
| 931 |
+
joycon@^3.1.1:
|
| 932 |
+
version "3.1.1"
|
| 933 |
+
resolved "https://registry.npmjs.org/joycon/-/joycon-3.1.1.tgz"
|
| 934 |
+
integrity sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==
|
| 935 |
+
|
| 936 |
+
js-yaml@0.3.x:
|
| 937 |
+
version "0.3.7"
|
| 938 |
+
resolved "https://registry.npmjs.org/js-yaml/-/js-yaml-0.3.7.tgz"
|
| 939 |
+
integrity sha512-/7PsVDNP2tVe2Z1cF9kTEkjamIwz4aooDpRKmN1+g/9eePCgcxsv4QDvEbxO0EH+gdDD7MLyDoR6BASo3hH51g==
|
| 940 |
+
|
| 941 |
+
jsmin@1.x:
|
| 942 |
+
version "1.0.1"
|
| 943 |
+
resolved "https://registry.npmjs.org/jsmin/-/jsmin-1.0.1.tgz"
|
| 944 |
+
integrity sha512-OPuL5X/bFKgVdMvEIX3hnpx3jbVpFCrEM8pKPXjFkZUqg521r41ijdyTz7vACOhW6o1neVlcLyd+wkbK5fNHRg==
|
| 945 |
+
|
| 946 |
+
jsonfile@^6.0.1:
|
| 947 |
+
version "6.1.0"
|
| 948 |
+
resolved "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz"
|
| 949 |
+
integrity sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==
|
| 950 |
+
dependencies:
|
| 951 |
+
universalify "^2.0.0"
|
| 952 |
+
optionalDependencies:
|
| 953 |
+
graceful-fs "^4.1.6"
|
| 954 |
+
|
| 955 |
+
jxLoader@*:
|
| 956 |
+
version "0.1.1"
|
| 957 |
+
resolved "https://registry.npmjs.org/jxLoader/-/jxLoader-0.1.1.tgz"
|
| 958 |
+
integrity sha512-ClEvAj3K68y8uKhub3RgTmcRPo5DfIWvtxqrKQdDPyZ1UVHIIKvVvjrAsJFSVL5wjv0rt5iH9SMCZ0XRKNzeUA==
|
| 959 |
+
dependencies:
|
| 960 |
+
js-yaml "0.3.x"
|
| 961 |
+
moo-server "1.3.x"
|
| 962 |
+
promised-io "*"
|
| 963 |
+
walker "1.x"
|
| 964 |
+
|
| 965 |
+
keygrip@~1.1.0:
|
| 966 |
+
version "1.1.0"
|
| 967 |
+
resolved "https://registry.npmjs.org/keygrip/-/keygrip-1.1.0.tgz"
|
| 968 |
+
integrity sha512-iYSchDJ+liQ8iwbSI2QqsQOvqv58eJCEanyJPJi+Khyu8smkcKSFUCbPwzFcL7YVtZ6eONjqRX/38caJ7QjRAQ==
|
| 969 |
+
dependencies:
|
| 970 |
+
tsscmp "1.0.6"
|
| 971 |
+
|
| 972 |
+
koa-body@^5.0.0:
|
| 973 |
+
version "5.0.0"
|
| 974 |
+
resolved "https://registry.npmjs.org/koa-body/-/koa-body-5.0.0.tgz"
|
| 975 |
+
integrity sha512-nHwEODrQGiyKBILCWO8QSS40C87cKr2cp3y/Cw8u9Z8w5t0CdSkGm3+y9WK5BIAlPpo9tTw5RtSbxpVyG79vmw==
|
| 976 |
+
dependencies:
|
| 977 |
+
"@types/formidable" "^2.0.4"
|
| 978 |
+
co-body "^5.1.1"
|
| 979 |
+
formidable "^2.0.1"
|
| 980 |
+
|
| 981 |
+
koa-bodyparser@^4.4.1:
|
| 982 |
+
version "4.4.1"
|
| 983 |
+
resolved "https://registry.npmjs.org/koa-bodyparser/-/koa-bodyparser-4.4.1.tgz"
|
| 984 |
+
integrity sha512-kBH3IYPMb+iAXnrxIhXnW+gXV8OTzCu8VPDqvcDHW9SQrbkHmqPQtiZwrltNmSq6/lpipHnT7k7PsjlVD7kK0w==
|
| 985 |
+
dependencies:
|
| 986 |
+
co-body "^6.0.0"
|
| 987 |
+
copy-to "^2.0.1"
|
| 988 |
+
type-is "^1.6.18"
|
| 989 |
+
|
| 990 |
+
koa-compose@^4.1.0:
|
| 991 |
+
version "4.1.0"
|
| 992 |
+
resolved "https://registry.npmjs.org/koa-compose/-/koa-compose-4.1.0.tgz"
|
| 993 |
+
integrity sha512-8ODW8TrDuMYvXRwra/Kh7/rJo9BtOfPc6qO8eAfC80CnCvSjSl0bkRM24X6/XBBEyj0v1nRUQ1LyOy3dbqOWXw==
|
| 994 |
+
|
| 995 |
+
koa-convert@^2.0.0:
|
| 996 |
+
version "2.0.0"
|
| 997 |
+
resolved "https://registry.npmjs.org/koa-convert/-/koa-convert-2.0.0.tgz"
|
| 998 |
+
integrity sha512-asOvN6bFlSnxewce2e/DK3p4tltyfC4VM7ZwuTuepI7dEQVcvpyFuBcEARu1+Hxg8DIwytce2n7jrZtRlPrARA==
|
| 999 |
+
dependencies:
|
| 1000 |
+
co "^4.6.0"
|
| 1001 |
+
koa-compose "^4.1.0"
|
| 1002 |
+
|
| 1003 |
+
koa-range@^0.3.0:
|
| 1004 |
+
version "0.3.0"
|
| 1005 |
+
resolved "https://registry.npmjs.org/koa-range/-/koa-range-0.3.0.tgz"
|
| 1006 |
+
integrity sha512-Ich3pCz6RhtbajYXRWjIl6O5wtrLs6kE3nkXc9XmaWe+MysJyZO7K4L3oce1Jpg/iMgCbj+5UCiMm/rqVtcDIg==
|
| 1007 |
+
dependencies:
|
| 1008 |
+
stream-slice "^0.1.2"
|
| 1009 |
+
|
| 1010 |
+
koa-router@^12.0.1:
|
| 1011 |
+
version "12.0.1"
|
| 1012 |
+
resolved "https://registry.npmjs.org/koa-router/-/koa-router-12.0.1.tgz"
|
| 1013 |
+
integrity sha512-gaDdj3GtzoLoeosacd50kBBTnnh3B9AYxDThQUo4sfUyXdOhY6ku1qyZKW88tQCRgc3Sw6ChXYXWZwwgjOxE0w==
|
| 1014 |
+
dependencies:
|
| 1015 |
+
debug "^4.3.4"
|
| 1016 |
+
http-errors "^2.0.0"
|
| 1017 |
+
koa-compose "^4.1.0"
|
| 1018 |
+
methods "^1.1.2"
|
| 1019 |
+
path-to-regexp "^6.2.1"
|
| 1020 |
+
|
| 1021 |
+
koa@^2.15.0:
|
| 1022 |
+
version "2.15.3"
|
| 1023 |
+
resolved "https://registry.npmjs.org/koa/-/koa-2.15.3.tgz"
|
| 1024 |
+
integrity sha512-j/8tY9j5t+GVMLeioLaxweJiKUayFhlGqNTzf2ZGwL0ZCQijd2RLHK0SLW5Tsko8YyyqCZC2cojIb0/s62qTAg==
|
| 1025 |
+
dependencies:
|
| 1026 |
+
accepts "^1.3.5"
|
| 1027 |
+
cache-content-type "^1.0.0"
|
| 1028 |
+
content-disposition "~0.5.2"
|
| 1029 |
+
content-type "^1.0.4"
|
| 1030 |
+
cookies "~0.9.0"
|
| 1031 |
+
debug "^4.3.2"
|
| 1032 |
+
delegates "^1.0.0"
|
| 1033 |
+
depd "^2.0.0"
|
| 1034 |
+
destroy "^1.0.4"
|
| 1035 |
+
encodeurl "^1.0.2"
|
| 1036 |
+
escape-html "^1.0.3"
|
| 1037 |
+
fresh "~0.5.2"
|
| 1038 |
+
http-assert "^1.3.0"
|
| 1039 |
+
http-errors "^1.6.3"
|
| 1040 |
+
is-generator-function "^1.0.7"
|
| 1041 |
+
koa-compose "^4.1.0"
|
| 1042 |
+
koa-convert "^2.0.0"
|
| 1043 |
+
on-finished "^2.3.0"
|
| 1044 |
+
only "~0.0.2"
|
| 1045 |
+
parseurl "^1.3.2"
|
| 1046 |
+
statuses "^1.5.0"
|
| 1047 |
+
type-is "^1.6.16"
|
| 1048 |
+
vary "^1.1.2"
|
| 1049 |
+
|
| 1050 |
+
koa2-cors@^2.0.6:
|
| 1051 |
+
version "2.0.6"
|
| 1052 |
+
resolved "https://registry.npmjs.org/koa2-cors/-/koa2-cors-2.0.6.tgz"
|
| 1053 |
+
integrity sha512-JRCcSM4lamM+8kvKGDKlesYk2ASrmSTczDtGUnIadqMgnHU4Ct5Gw7Bxt3w3m6d6dy3WN0PU4oMP43HbddDEWg==
|
| 1054 |
+
|
| 1055 |
+
kuler@^2.0.0:
|
| 1056 |
+
version "2.0.0"
|
| 1057 |
+
resolved "https://registry.npmjs.org/kuler/-/kuler-2.0.0.tgz"
|
| 1058 |
+
integrity sha512-Xq9nH7KlWZmXAtodXDDRE7vs6DU1gTU8zYDHDiWLSip45Egwq3plLHzPn27NgvzL2r1LMPC1vdqh98sQxtqj4A==
|
| 1059 |
+
|
| 1060 |
+
lilconfig@^3.1.1:
|
| 1061 |
+
version "3.1.2"
|
| 1062 |
+
resolved "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.2.tgz"
|
| 1063 |
+
integrity sha512-eop+wDAvpItUys0FWkHIKeC9ybYrTGbU41U5K7+bttZZeohvnY7M9dZ5kB21GNWiFT2q1OoPTvncPCgSOVO5ow==
|
| 1064 |
+
|
| 1065 |
+
lines-and-columns@^1.1.6:
|
| 1066 |
+
version "1.2.4"
|
| 1067 |
+
resolved "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz"
|
| 1068 |
+
integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==
|
| 1069 |
+
|
| 1070 |
+
load-tsconfig@^0.2.3:
|
| 1071 |
+
version "0.2.5"
|
| 1072 |
+
resolved "https://registry.npmjs.org/load-tsconfig/-/load-tsconfig-0.2.5.tgz"
|
| 1073 |
+
integrity sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg==
|
| 1074 |
+
|
| 1075 |
+
lodash.sortby@^4.7.0:
|
| 1076 |
+
version "4.7.0"
|
| 1077 |
+
resolved "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz"
|
| 1078 |
+
integrity sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA==
|
| 1079 |
+
|
| 1080 |
+
lodash@^4.17.21:
|
| 1081 |
+
version "4.17.21"
|
| 1082 |
+
resolved "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz"
|
| 1083 |
+
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
|
| 1084 |
+
|
| 1085 |
+
logform@^2.7.0:
|
| 1086 |
+
version "2.7.0"
|
| 1087 |
+
resolved "https://registry.npmjs.org/logform/-/logform-2.7.0.tgz"
|
| 1088 |
+
integrity sha512-TFYA4jnP7PVbmlBIfhlSe+WKxs9dklXMTEGcBCIvLhE/Tn3H6Gk1norupVW7m5Cnd4bLcr08AytbyV/xj7f/kQ==
|
| 1089 |
+
dependencies:
|
| 1090 |
+
"@colors/colors" "1.6.0"
|
| 1091 |
+
"@types/triple-beam" "^1.3.2"
|
| 1092 |
+
fecha "^4.2.0"
|
| 1093 |
+
ms "^2.1.1"
|
| 1094 |
+
safe-stable-stringify "^2.3.1"
|
| 1095 |
+
triple-beam "^1.3.0"
|
| 1096 |
+
|
| 1097 |
+
lru-cache@^10.2.0:
|
| 1098 |
+
version "10.4.3"
|
| 1099 |
+
resolved "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz"
|
| 1100 |
+
integrity sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==
|
| 1101 |
+
|
| 1102 |
+
luxon@~3.4.0:
|
| 1103 |
+
version "3.4.4"
|
| 1104 |
+
resolved "https://registry.npmjs.org/luxon/-/luxon-3.4.4.tgz"
|
| 1105 |
+
integrity sha512-zobTr7akeGHnv7eBOXcRgMeCP6+uyYsczwmeRCauvpvaAltgNyTbLH/+VaEAPUeWBT+1GuNmz4wC/6jtQzbbVA==
|
| 1106 |
+
|
| 1107 |
+
makeerror@1.0.12:
|
| 1108 |
+
version "1.0.12"
|
| 1109 |
+
resolved "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz"
|
| 1110 |
+
integrity sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==
|
| 1111 |
+
dependencies:
|
| 1112 |
+
tmpl "1.0.5"
|
| 1113 |
+
|
| 1114 |
+
media-typer@0.3.0:
|
| 1115 |
+
version "0.3.0"
|
| 1116 |
+
resolved "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz"
|
| 1117 |
+
integrity sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==
|
| 1118 |
+
|
| 1119 |
+
merge-stream@^2.0.0:
|
| 1120 |
+
version "2.0.0"
|
| 1121 |
+
resolved "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz"
|
| 1122 |
+
integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==
|
| 1123 |
+
|
| 1124 |
+
merge2@^1.3.0, merge2@^1.4.1:
|
| 1125 |
+
version "1.4.1"
|
| 1126 |
+
resolved "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz"
|
| 1127 |
+
integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==
|
| 1128 |
+
|
| 1129 |
+
methods@^1.1.2:
|
| 1130 |
+
version "1.1.2"
|
| 1131 |
+
resolved "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz"
|
| 1132 |
+
integrity sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==
|
| 1133 |
+
|
| 1134 |
+
micromatch@^4.0.4:
|
| 1135 |
+
version "4.0.7"
|
| 1136 |
+
resolved "https://registry.npmjs.org/micromatch/-/micromatch-4.0.7.tgz"
|
| 1137 |
+
integrity sha512-LPP/3KorzCwBxfeUuZmaR6bG2kdeHSbe0P2tY3FLRU4vYrjYz5hI4QZwV0njUx3jeuKe67YukQ1LSPZBKDqO/Q==
|
| 1138 |
+
dependencies:
|
| 1139 |
+
braces "^3.0.3"
|
| 1140 |
+
picomatch "^2.3.1"
|
| 1141 |
+
|
| 1142 |
+
mime-db@1.52.0:
|
| 1143 |
+
version "1.52.0"
|
| 1144 |
+
resolved "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz"
|
| 1145 |
+
integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==
|
| 1146 |
+
|
| 1147 |
+
mime-types@^2.1.12, mime-types@^2.1.18, mime-types@~2.1.24, mime-types@~2.1.34:
|
| 1148 |
+
version "2.1.35"
|
| 1149 |
+
resolved "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz"
|
| 1150 |
+
integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==
|
| 1151 |
+
dependencies:
|
| 1152 |
+
mime-db "1.52.0"
|
| 1153 |
+
|
| 1154 |
+
mime@^4.0.1:
|
| 1155 |
+
version "4.0.4"
|
| 1156 |
+
resolved "https://registry.npmjs.org/mime/-/mime-4.0.4.tgz"
|
| 1157 |
+
integrity sha512-v8yqInVjhXyqP6+Kw4fV3ZzeMRqEW6FotRsKXjRS5VMTNIuXsdRoAvklpoRgSqXm6o9VNH4/C0mgedko9DdLsQ==
|
| 1158 |
+
|
| 1159 |
+
mimic-fn@^2.1.0:
|
| 1160 |
+
version "2.1.0"
|
| 1161 |
+
resolved "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz"
|
| 1162 |
+
integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==
|
| 1163 |
+
|
| 1164 |
+
minimatch@^9.0.4:
|
| 1165 |
+
version "9.0.5"
|
| 1166 |
+
resolved "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz"
|
| 1167 |
+
integrity sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==
|
| 1168 |
+
dependencies:
|
| 1169 |
+
brace-expansion "^2.0.1"
|
| 1170 |
+
|
| 1171 |
+
minimist@^1.2.8:
|
| 1172 |
+
version "1.2.8"
|
| 1173 |
+
resolved "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz"
|
| 1174 |
+
integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==
|
| 1175 |
+
|
| 1176 |
+
"minipass@^5.0.0 || ^6.0.2 || ^7.0.0", minipass@^7.1.2:
|
| 1177 |
+
version "7.1.2"
|
| 1178 |
+
resolved "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz"
|
| 1179 |
+
integrity sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==
|
| 1180 |
+
|
| 1181 |
+
moo-server@*, moo-server@1.3.x:
|
| 1182 |
+
version "1.3.0"
|
| 1183 |
+
resolved "https://registry.npmjs.org/moo-server/-/moo-server-1.3.0.tgz"
|
| 1184 |
+
integrity sha512-9A8/eor2DXwpv1+a4pZAAydqLFVrWoKoO1fzdzqLUhYVXAO1Kgd1FR2gFZi7YdHzF0s4W8cDNwCfKJQrvLqxDw==
|
| 1185 |
+
|
| 1186 |
+
ms@^2.1.1, ms@2.1.2:
|
| 1187 |
+
version "2.1.2"
|
| 1188 |
+
resolved "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz"
|
| 1189 |
+
integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==
|
| 1190 |
+
|
| 1191 |
+
mz@^2.7.0:
|
| 1192 |
+
version "2.7.0"
|
| 1193 |
+
resolved "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz"
|
| 1194 |
+
integrity sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==
|
| 1195 |
+
dependencies:
|
| 1196 |
+
any-promise "^1.0.0"
|
| 1197 |
+
object-assign "^4.0.1"
|
| 1198 |
+
thenify-all "^1.0.0"
|
| 1199 |
+
|
| 1200 |
+
negotiator@0.6.3:
|
| 1201 |
+
version "0.6.3"
|
| 1202 |
+
resolved "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz"
|
| 1203 |
+
integrity sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==
|
| 1204 |
+
|
| 1205 |
+
normalize-path@^3.0.0, normalize-path@~3.0.0:
|
| 1206 |
+
version "3.0.0"
|
| 1207 |
+
resolved "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz"
|
| 1208 |
+
integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==
|
| 1209 |
+
|
| 1210 |
+
npm-run-path@^4.0.1:
|
| 1211 |
+
version "4.0.1"
|
| 1212 |
+
resolved "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz"
|
| 1213 |
+
integrity sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==
|
| 1214 |
+
dependencies:
|
| 1215 |
+
path-key "^3.0.0"
|
| 1216 |
+
|
| 1217 |
+
object-assign@^4.0.1:
|
| 1218 |
+
version "4.1.1"
|
| 1219 |
+
resolved "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz"
|
| 1220 |
+
integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==
|
| 1221 |
+
|
| 1222 |
+
object-inspect@^1.13.1:
|
| 1223 |
+
version "1.13.2"
|
| 1224 |
+
resolved "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.2.tgz"
|
| 1225 |
+
integrity sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g==
|
| 1226 |
+
|
| 1227 |
+
on-finished@^2.3.0:
|
| 1228 |
+
version "2.4.1"
|
| 1229 |
+
resolved "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz"
|
| 1230 |
+
integrity sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==
|
| 1231 |
+
dependencies:
|
| 1232 |
+
ee-first "1.1.1"
|
| 1233 |
+
|
| 1234 |
+
once@^1.4.0:
|
| 1235 |
+
version "1.4.0"
|
| 1236 |
+
resolved "https://registry.npmjs.org/once/-/once-1.4.0.tgz"
|
| 1237 |
+
integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==
|
| 1238 |
+
dependencies:
|
| 1239 |
+
wrappy "1"
|
| 1240 |
+
|
| 1241 |
+
one-time@^1.0.0:
|
| 1242 |
+
version "1.0.0"
|
| 1243 |
+
resolved "https://registry.npmjs.org/one-time/-/one-time-1.0.0.tgz"
|
| 1244 |
+
integrity sha512-5DXOiRKwuSEcQ/l0kGCF6Q3jcADFv5tSmRaJck/OqkVFcOzutB134KRSfF0xDrL39MNnqxbHBbUUcjZIhTgb2g==
|
| 1245 |
+
dependencies:
|
| 1246 |
+
fn.name "1.x.x"
|
| 1247 |
+
|
| 1248 |
+
onetime@^5.1.2:
|
| 1249 |
+
version "5.1.2"
|
| 1250 |
+
resolved "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz"
|
| 1251 |
+
integrity sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==
|
| 1252 |
+
dependencies:
|
| 1253 |
+
mimic-fn "^2.1.0"
|
| 1254 |
+
|
| 1255 |
+
only@~0.0.2:
|
| 1256 |
+
version "0.0.2"
|
| 1257 |
+
resolved "https://registry.npmjs.org/only/-/only-0.0.2.tgz"
|
| 1258 |
+
integrity sha512-Fvw+Jemq5fjjyWz6CpKx6w9s7xxqo3+JCyM0WXWeCSOboZ8ABkyvP8ID4CZuChA/wxSx+XSJmdOm8rGVyJ1hdQ==
|
| 1259 |
+
|
| 1260 |
+
package-json-from-dist@^1.0.0:
|
| 1261 |
+
version "1.0.0"
|
| 1262 |
+
resolved "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.0.tgz"
|
| 1263 |
+
integrity sha512-dATvCeZN/8wQsGywez1mzHtTlP22H8OEfPrVMLNr4/eGa+ijtLn/6M5f0dY8UKNrC2O9UCU6SSoG3qRKnt7STw==
|
| 1264 |
+
|
| 1265 |
+
parseurl@^1.3.2:
|
| 1266 |
+
version "1.3.3"
|
| 1267 |
+
resolved "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz"
|
| 1268 |
+
integrity sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==
|
| 1269 |
+
|
| 1270 |
+
path-key@^3.0.0, path-key@^3.1.0:
|
| 1271 |
+
version "3.1.1"
|
| 1272 |
+
resolved "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz"
|
| 1273 |
+
integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==
|
| 1274 |
+
|
| 1275 |
+
path-scurry@^1.11.1:
|
| 1276 |
+
version "1.11.1"
|
| 1277 |
+
resolved "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz"
|
| 1278 |
+
integrity sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==
|
| 1279 |
+
dependencies:
|
| 1280 |
+
lru-cache "^10.2.0"
|
| 1281 |
+
minipass "^5.0.0 || ^6.0.2 || ^7.0.0"
|
| 1282 |
+
|
| 1283 |
+
path-to-regexp@^6.2.1:
|
| 1284 |
+
version "6.2.2"
|
| 1285 |
+
resolved "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.2.2.tgz"
|
| 1286 |
+
integrity sha512-GQX3SSMokngb36+whdpRXE+3f9V8UzyAorlYvOGx87ufGHehNTn5lCxrKtLyZ4Yl/wEKnNnr98ZzOwwDZV5ogw==
|
| 1287 |
+
|
| 1288 |
+
path-type@^4.0.0:
|
| 1289 |
+
version "4.0.0"
|
| 1290 |
+
resolved "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz"
|
| 1291 |
+
integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==
|
| 1292 |
+
|
| 1293 |
+
picocolors@^1.0.1:
|
| 1294 |
+
version "1.0.1"
|
| 1295 |
+
resolved "https://registry.npmjs.org/picocolors/-/picocolors-1.0.1.tgz"
|
| 1296 |
+
integrity sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==
|
| 1297 |
+
|
| 1298 |
+
picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.3.1:
|
| 1299 |
+
version "2.3.1"
|
| 1300 |
+
resolved "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz"
|
| 1301 |
+
integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==
|
| 1302 |
+
|
| 1303 |
+
pirates@^4.0.1:
|
| 1304 |
+
version "4.0.6"
|
| 1305 |
+
resolved "https://registry.npmjs.org/pirates/-/pirates-4.0.6.tgz"
|
| 1306 |
+
integrity sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==
|
| 1307 |
+
|
| 1308 |
+
postcss-load-config@^6.0.1:
|
| 1309 |
+
version "6.0.1"
|
| 1310 |
+
resolved "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-6.0.1.tgz"
|
| 1311 |
+
integrity sha512-oPtTM4oerL+UXmx+93ytZVN82RrlY/wPUV8IeDxFrzIjXOLF1pN+EmKPLbubvKHT2HC20xXsCAH2Z+CKV6Oz/g==
|
| 1312 |
+
dependencies:
|
| 1313 |
+
lilconfig "^3.1.1"
|
| 1314 |
+
|
| 1315 |
+
promised-io@*:
|
| 1316 |
+
version "0.3.6"
|
| 1317 |
+
resolved "https://registry.npmjs.org/promised-io/-/promised-io-0.3.6.tgz"
|
| 1318 |
+
integrity sha512-bNwZusuNIW4m0SPR8jooSyndD35ggirHlxVl/UhIaZD/F0OBv9ebfc6tNmbpZts3QXHggkjIBH8lvtnzhtcz0A==
|
| 1319 |
+
|
| 1320 |
+
proxy-from-env@^1.1.0:
|
| 1321 |
+
version "1.1.0"
|
| 1322 |
+
resolved "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz"
|
| 1323 |
+
integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==
|
| 1324 |
+
|
| 1325 |
+
punycode@^2.1.0:
|
| 1326 |
+
version "2.3.1"
|
| 1327 |
+
resolved "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz"
|
| 1328 |
+
integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==
|
| 1329 |
+
|
| 1330 |
+
qs@^6.11.0, qs@^6.4.0, qs@^6.5.2:
|
| 1331 |
+
version "6.12.3"
|
| 1332 |
+
resolved "https://registry.npmjs.org/qs/-/qs-6.12.3.tgz"
|
| 1333 |
+
integrity sha512-AWJm14H1vVaO/iNZ4/hO+HyaTehuy9nRqVdkTqlJt0HWvBiBIEXFmb4C0DGeYo3Xes9rrEW+TxHsaigCbN5ICQ==
|
| 1334 |
+
dependencies:
|
| 1335 |
+
side-channel "^1.0.6"
|
| 1336 |
+
|
| 1337 |
+
queue-microtask@^1.2.2:
|
| 1338 |
+
version "1.2.3"
|
| 1339 |
+
resolved "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz"
|
| 1340 |
+
integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==
|
| 1341 |
+
|
| 1342 |
+
randombytes@2.0.3:
|
| 1343 |
+
version "2.0.3"
|
| 1344 |
+
resolved "https://registry.npmjs.org/randombytes/-/randombytes-2.0.3.tgz"
|
| 1345 |
+
integrity sha512-lDVjxQQFoCG1jcrP06LNo2lbWp4QTShEXnhActFBwYuHprllQV6VUpwreApsYqCgD+N1mHoqJ/BI/4eV4R2GYg==
|
| 1346 |
+
|
| 1347 |
+
randomstring@^1.3.0:
|
| 1348 |
+
version "1.3.0"
|
| 1349 |
+
resolved "https://registry.npmjs.org/randomstring/-/randomstring-1.3.0.tgz"
|
| 1350 |
+
integrity sha512-gY7aQ4i1BgwZ8I1Op4YseITAyiDiajeZOPQUbIq9TPGPhUm5FX59izIaOpmKbME1nmnEiABf28d9K2VSii6BBg==
|
| 1351 |
+
dependencies:
|
| 1352 |
+
randombytes "2.0.3"
|
| 1353 |
+
|
| 1354 |
+
raw-body@^2.2.0, raw-body@^2.3.3:
|
| 1355 |
+
version "2.5.2"
|
| 1356 |
+
resolved "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz"
|
| 1357 |
+
integrity sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==
|
| 1358 |
+
dependencies:
|
| 1359 |
+
bytes "3.1.2"
|
| 1360 |
+
http-errors "2.0.0"
|
| 1361 |
+
iconv-lite "0.4.24"
|
| 1362 |
+
unpipe "1.0.0"
|
| 1363 |
+
|
| 1364 |
+
readable-stream@^3.4.0, readable-stream@^3.6.2:
|
| 1365 |
+
version "3.6.2"
|
| 1366 |
+
resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz"
|
| 1367 |
+
integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==
|
| 1368 |
+
dependencies:
|
| 1369 |
+
inherits "^2.0.3"
|
| 1370 |
+
string_decoder "^1.1.1"
|
| 1371 |
+
util-deprecate "^1.0.1"
|
| 1372 |
+
|
| 1373 |
+
readdirp@~3.6.0:
|
| 1374 |
+
version "3.6.0"
|
| 1375 |
+
resolved "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz"
|
| 1376 |
+
integrity sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==
|
| 1377 |
+
dependencies:
|
| 1378 |
+
picomatch "^2.2.1"
|
| 1379 |
+
|
| 1380 |
+
resolve-from@^5.0.0:
|
| 1381 |
+
version "5.0.0"
|
| 1382 |
+
resolved "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz"
|
| 1383 |
+
integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==
|
| 1384 |
+
|
| 1385 |
+
reusify@^1.0.4:
|
| 1386 |
+
version "1.0.4"
|
| 1387 |
+
resolved "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz"
|
| 1388 |
+
integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==
|
| 1389 |
+
|
| 1390 |
+
rollup@^4.19.0:
|
| 1391 |
+
version "4.19.1"
|
| 1392 |
+
resolved "https://registry.npmjs.org/rollup/-/rollup-4.19.1.tgz"
|
| 1393 |
+
integrity sha512-K5vziVlg7hTpYfFBI+91zHBEMo6jafYXpkMlqZjg7/zhIG9iHqazBf4xz9AVdjS9BruRn280ROqLI7G3OFRIlw==
|
| 1394 |
+
dependencies:
|
| 1395 |
+
"@types/estree" "1.0.5"
|
| 1396 |
+
optionalDependencies:
|
| 1397 |
+
"@rollup/rollup-android-arm-eabi" "4.19.1"
|
| 1398 |
+
"@rollup/rollup-android-arm64" "4.19.1"
|
| 1399 |
+
"@rollup/rollup-darwin-arm64" "4.19.1"
|
| 1400 |
+
"@rollup/rollup-darwin-x64" "4.19.1"
|
| 1401 |
+
"@rollup/rollup-linux-arm-gnueabihf" "4.19.1"
|
| 1402 |
+
"@rollup/rollup-linux-arm-musleabihf" "4.19.1"
|
| 1403 |
+
"@rollup/rollup-linux-arm64-gnu" "4.19.1"
|
| 1404 |
+
"@rollup/rollup-linux-arm64-musl" "4.19.1"
|
| 1405 |
+
"@rollup/rollup-linux-powerpc64le-gnu" "4.19.1"
|
| 1406 |
+
"@rollup/rollup-linux-riscv64-gnu" "4.19.1"
|
| 1407 |
+
"@rollup/rollup-linux-s390x-gnu" "4.19.1"
|
| 1408 |
+
"@rollup/rollup-linux-x64-gnu" "4.19.1"
|
| 1409 |
+
"@rollup/rollup-linux-x64-musl" "4.19.1"
|
| 1410 |
+
"@rollup/rollup-win32-arm64-msvc" "4.19.1"
|
| 1411 |
+
"@rollup/rollup-win32-ia32-msvc" "4.19.1"
|
| 1412 |
+
"@rollup/rollup-win32-x64-msvc" "4.19.1"
|
| 1413 |
+
fsevents "~2.3.2"
|
| 1414 |
+
|
| 1415 |
+
run-parallel@^1.1.9:
|
| 1416 |
+
version "1.2.0"
|
| 1417 |
+
resolved "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz"
|
| 1418 |
+
integrity sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==
|
| 1419 |
+
dependencies:
|
| 1420 |
+
queue-microtask "^1.2.2"
|
| 1421 |
+
|
| 1422 |
+
safe-buffer@~5.2.0, safe-buffer@5.2.1:
|
| 1423 |
+
version "5.2.1"
|
| 1424 |
+
resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz"
|
| 1425 |
+
integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==
|
| 1426 |
+
|
| 1427 |
+
safe-stable-stringify@^2.3.1:
|
| 1428 |
+
version "2.5.0"
|
| 1429 |
+
resolved "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.5.0.tgz"
|
| 1430 |
+
integrity sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA==
|
| 1431 |
+
|
| 1432 |
+
"safer-buffer@>= 2.1.2 < 3":
|
| 1433 |
+
version "2.1.2"
|
| 1434 |
+
resolved "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz"
|
| 1435 |
+
integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==
|
| 1436 |
+
|
| 1437 |
+
semver@^7.7.2:
|
| 1438 |
+
version "7.7.2"
|
| 1439 |
+
resolved "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz"
|
| 1440 |
+
integrity sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==
|
| 1441 |
+
|
| 1442 |
+
set-function-length@^1.2.1:
|
| 1443 |
+
version "1.2.2"
|
| 1444 |
+
resolved "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz"
|
| 1445 |
+
integrity sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==
|
| 1446 |
+
dependencies:
|
| 1447 |
+
define-data-property "^1.1.4"
|
| 1448 |
+
es-errors "^1.3.0"
|
| 1449 |
+
function-bind "^1.1.2"
|
| 1450 |
+
get-intrinsic "^1.2.4"
|
| 1451 |
+
gopd "^1.0.1"
|
| 1452 |
+
has-property-descriptors "^1.0.2"
|
| 1453 |
+
|
| 1454 |
+
setprototypeof@1.2.0:
|
| 1455 |
+
version "1.2.0"
|
| 1456 |
+
resolved "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz"
|
| 1457 |
+
integrity sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==
|
| 1458 |
+
|
| 1459 |
+
shebang-command@^2.0.0:
|
| 1460 |
+
version "2.0.0"
|
| 1461 |
+
resolved "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz"
|
| 1462 |
+
integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==
|
| 1463 |
+
dependencies:
|
| 1464 |
+
shebang-regex "^3.0.0"
|
| 1465 |
+
|
| 1466 |
+
shebang-regex@^3.0.0:
|
| 1467 |
+
version "3.0.0"
|
| 1468 |
+
resolved "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz"
|
| 1469 |
+
integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==
|
| 1470 |
+
|
| 1471 |
+
side-channel@^1.0.6:
|
| 1472 |
+
version "1.0.6"
|
| 1473 |
+
resolved "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz"
|
| 1474 |
+
integrity sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==
|
| 1475 |
+
dependencies:
|
| 1476 |
+
call-bind "^1.0.7"
|
| 1477 |
+
es-errors "^1.3.0"
|
| 1478 |
+
get-intrinsic "^1.2.4"
|
| 1479 |
+
object-inspect "^1.13.1"
|
| 1480 |
+
|
| 1481 |
+
signal-exit@^3.0.3:
|
| 1482 |
+
version "3.0.7"
|
| 1483 |
+
resolved "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz"
|
| 1484 |
+
integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==
|
| 1485 |
+
|
| 1486 |
+
signal-exit@^4.0.1:
|
| 1487 |
+
version "4.1.0"
|
| 1488 |
+
resolved "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz"
|
| 1489 |
+
integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==
|
| 1490 |
+
|
| 1491 |
+
simple-swizzle@^0.2.2:
|
| 1492 |
+
version "0.2.2"
|
| 1493 |
+
resolved "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz"
|
| 1494 |
+
integrity sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg==
|
| 1495 |
+
dependencies:
|
| 1496 |
+
is-arrayish "^0.3.1"
|
| 1497 |
+
|
| 1498 |
+
slash@^3.0.0:
|
| 1499 |
+
version "3.0.0"
|
| 1500 |
+
resolved "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz"
|
| 1501 |
+
integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==
|
| 1502 |
+
|
| 1503 |
+
source-map@0.8.0-beta.0:
|
| 1504 |
+
version "0.8.0-beta.0"
|
| 1505 |
+
resolved "https://registry.npmjs.org/source-map/-/source-map-0.8.0-beta.0.tgz"
|
| 1506 |
+
integrity sha512-2ymg6oRBpebeZi9UUNsgQ89bhx01TcTkmNTGnNO88imTmbSgy4nfujrgVEFKWpMTEGA11EDkTt7mqObTPdigIA==
|
| 1507 |
+
dependencies:
|
| 1508 |
+
whatwg-url "^7.0.0"
|
| 1509 |
+
|
| 1510 |
+
stack-trace@0.0.x:
|
| 1511 |
+
version "0.0.10"
|
| 1512 |
+
resolved "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz"
|
| 1513 |
+
integrity sha512-KGzahc7puUKkzyMt+IqAep+TVNbKP+k2Lmwhub39m1AsTSkaDutx56aDCo+HLDzf/D26BIHTJWNiTG1KAJiQCg==
|
| 1514 |
+
|
| 1515 |
+
statuses@^1.5.0, "statuses@>= 1.5.0 < 2":
|
| 1516 |
+
version "1.5.0"
|
| 1517 |
+
resolved "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz"
|
| 1518 |
+
integrity sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==
|
| 1519 |
+
|
| 1520 |
+
statuses@2.0.1:
|
| 1521 |
+
version "2.0.1"
|
| 1522 |
+
resolved "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz"
|
| 1523 |
+
integrity sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==
|
| 1524 |
+
|
| 1525 |
+
stream-slice@^0.1.2:
|
| 1526 |
+
version "0.1.2"
|
| 1527 |
+
resolved "https://registry.npmjs.org/stream-slice/-/stream-slice-0.1.2.tgz"
|
| 1528 |
+
integrity sha512-QzQxpoacatkreL6jsxnVb7X5R/pGw9OUv2qWTYWnmLpg4NdN31snPy/f3TdQE1ZUXaThRvj1Zw4/OGg0ZkaLMA==
|
| 1529 |
+
|
| 1530 |
+
string_decoder@^1.1.1:
|
| 1531 |
+
version "1.3.0"
|
| 1532 |
+
resolved "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz"
|
| 1533 |
+
integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==
|
| 1534 |
+
dependencies:
|
| 1535 |
+
safe-buffer "~5.2.0"
|
| 1536 |
+
|
| 1537 |
+
"string-width-cjs@npm:string-width@^4.2.0":
|
| 1538 |
+
version "4.2.3"
|
| 1539 |
+
resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz"
|
| 1540 |
+
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
|
| 1541 |
+
dependencies:
|
| 1542 |
+
emoji-regex "^8.0.0"
|
| 1543 |
+
is-fullwidth-code-point "^3.0.0"
|
| 1544 |
+
strip-ansi "^6.0.1"
|
| 1545 |
+
|
| 1546 |
+
string-width@^4.1.0:
|
| 1547 |
+
version "4.2.3"
|
| 1548 |
+
resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz"
|
| 1549 |
+
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
|
| 1550 |
+
dependencies:
|
| 1551 |
+
emoji-regex "^8.0.0"
|
| 1552 |
+
is-fullwidth-code-point "^3.0.0"
|
| 1553 |
+
strip-ansi "^6.0.1"
|
| 1554 |
+
|
| 1555 |
+
string-width@^5.0.1, string-width@^5.1.2:
|
| 1556 |
+
version "5.1.2"
|
| 1557 |
+
resolved "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz"
|
| 1558 |
+
integrity sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==
|
| 1559 |
+
dependencies:
|
| 1560 |
+
eastasianwidth "^0.2.0"
|
| 1561 |
+
emoji-regex "^9.2.2"
|
| 1562 |
+
strip-ansi "^7.0.1"
|
| 1563 |
+
|
| 1564 |
+
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
|
| 1565 |
+
version "6.0.1"
|
| 1566 |
+
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"
|
| 1567 |
+
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
|
| 1568 |
+
dependencies:
|
| 1569 |
+
ansi-regex "^5.0.1"
|
| 1570 |
+
|
| 1571 |
+
strip-ansi@^6.0.0, strip-ansi@^6.0.1:
|
| 1572 |
+
version "6.0.1"
|
| 1573 |
+
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"
|
| 1574 |
+
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
|
| 1575 |
+
dependencies:
|
| 1576 |
+
ansi-regex "^5.0.1"
|
| 1577 |
+
|
| 1578 |
+
strip-ansi@^7.0.1:
|
| 1579 |
+
version "7.1.0"
|
| 1580 |
+
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz"
|
| 1581 |
+
integrity sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==
|
| 1582 |
+
dependencies:
|
| 1583 |
+
ansi-regex "^6.0.1"
|
| 1584 |
+
|
| 1585 |
+
strip-final-newline@^2.0.0:
|
| 1586 |
+
version "2.0.0"
|
| 1587 |
+
resolved "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz"
|
| 1588 |
+
integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==
|
| 1589 |
+
|
| 1590 |
+
sucrase@^3.35.0:
|
| 1591 |
+
version "3.35.0"
|
| 1592 |
+
resolved "https://registry.npmjs.org/sucrase/-/sucrase-3.35.0.tgz"
|
| 1593 |
+
integrity sha512-8EbVDiu9iN/nESwxeSxDKe0dunta1GOlHufmSSXxMD2z2/tMZpDMpvXQGsc+ajGo8y2uYUmixaSRUc/QPoQ0GA==
|
| 1594 |
+
dependencies:
|
| 1595 |
+
"@jridgewell/gen-mapping" "^0.3.2"
|
| 1596 |
+
commander "^4.0.0"
|
| 1597 |
+
glob "^10.3.10"
|
| 1598 |
+
lines-and-columns "^1.1.6"
|
| 1599 |
+
mz "^2.7.0"
|
| 1600 |
+
pirates "^4.0.1"
|
| 1601 |
+
ts-interface-checker "^0.1.9"
|
| 1602 |
+
|
| 1603 |
+
text-hex@1.0.x:
|
| 1604 |
+
version "1.0.0"
|
| 1605 |
+
resolved "https://registry.npmjs.org/text-hex/-/text-hex-1.0.0.tgz"
|
| 1606 |
+
integrity sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg==
|
| 1607 |
+
|
| 1608 |
+
thenify-all@^1.0.0:
|
| 1609 |
+
version "1.6.0"
|
| 1610 |
+
resolved "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz"
|
| 1611 |
+
integrity sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==
|
| 1612 |
+
dependencies:
|
| 1613 |
+
thenify ">= 3.1.0 < 4"
|
| 1614 |
+
|
| 1615 |
+
"thenify@>= 3.1.0 < 4":
|
| 1616 |
+
version "3.3.1"
|
| 1617 |
+
resolved "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz"
|
| 1618 |
+
integrity sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==
|
| 1619 |
+
dependencies:
|
| 1620 |
+
any-promise "^1.0.0"
|
| 1621 |
+
|
| 1622 |
+
timespan@2.x:
|
| 1623 |
+
version "2.3.0"
|
| 1624 |
+
resolved "https://registry.npmjs.org/timespan/-/timespan-2.3.0.tgz"
|
| 1625 |
+
integrity sha512-0Jq9+58T2wbOyLth0EU+AUb6JMGCLaTWIykJFa7hyAybjVH9gpVMTfUAwo5fWAvtFt2Tjh/Elg8JtgNpnMnM8g==
|
| 1626 |
+
|
| 1627 |
+
tmpl@1.0.5:
|
| 1628 |
+
version "1.0.5"
|
| 1629 |
+
resolved "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz"
|
| 1630 |
+
integrity sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==
|
| 1631 |
+
|
| 1632 |
+
to-regex-range@^5.0.1:
|
| 1633 |
+
version "5.0.1"
|
| 1634 |
+
resolved "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz"
|
| 1635 |
+
integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==
|
| 1636 |
+
dependencies:
|
| 1637 |
+
is-number "^7.0.0"
|
| 1638 |
+
|
| 1639 |
+
toidentifier@1.0.1:
|
| 1640 |
+
version "1.0.1"
|
| 1641 |
+
resolved "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz"
|
| 1642 |
+
integrity sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==
|
| 1643 |
+
|
| 1644 |
+
tr46@^1.0.1:
|
| 1645 |
+
version "1.0.1"
|
| 1646 |
+
resolved "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz"
|
| 1647 |
+
integrity sha512-dTpowEjclQ7Kgx5SdBkqRzVhERQXov8/l9Ft9dVM9fmg0W0KQSVaXX9T4i6twCPNtYiZM53lpSSUAwJbFPOHxA==
|
| 1648 |
+
dependencies:
|
| 1649 |
+
punycode "^2.1.0"
|
| 1650 |
+
|
| 1651 |
+
tree-kill@^1.2.2:
|
| 1652 |
+
version "1.2.2"
|
| 1653 |
+
resolved "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz"
|
| 1654 |
+
integrity sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==
|
| 1655 |
+
|
| 1656 |
+
triple-beam@^1.3.0:
|
| 1657 |
+
version "1.4.1"
|
| 1658 |
+
resolved "https://registry.npmjs.org/triple-beam/-/triple-beam-1.4.1.tgz"
|
| 1659 |
+
integrity sha512-aZbgViZrg1QNcG+LULa7nhZpJTZSLm/mXnHXnbAbjmN5aSa0y7V+wvv6+4WaBtpISJzThKy+PIPxc1Nq1EJ9mg==
|
| 1660 |
+
|
| 1661 |
+
ts-interface-checker@^0.1.9:
|
| 1662 |
+
version "0.1.13"
|
| 1663 |
+
resolved "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz"
|
| 1664 |
+
integrity sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==
|
| 1665 |
+
|
| 1666 |
+
tsscmp@1.0.6:
|
| 1667 |
+
version "1.0.6"
|
| 1668 |
+
resolved "https://registry.npmjs.org/tsscmp/-/tsscmp-1.0.6.tgz"
|
| 1669 |
+
integrity sha512-LxhtAkPDTkVCMQjt2h6eBVY28KCjikZqZfMcC15YBeNjkgUpdCfBu5HoiOTDu86v6smE8yOjyEktJ8hlbANHQA==
|
| 1670 |
+
|
| 1671 |
+
tsup@^8.0.2:
|
| 1672 |
+
version "8.2.3"
|
| 1673 |
+
resolved "https://registry.npmjs.org/tsup/-/tsup-8.2.3.tgz"
|
| 1674 |
+
integrity sha512-6YNT44oUfXRbZuSMNmN36GzwPPIlD2wBccY7looM2fkTcxkf2NEmwr3OZuDZoySklnrIG4hoEtzy8yUXYOqNcg==
|
| 1675 |
+
dependencies:
|
| 1676 |
+
bundle-require "^5.0.0"
|
| 1677 |
+
cac "^6.7.14"
|
| 1678 |
+
chokidar "^3.6.0"
|
| 1679 |
+
consola "^3.2.3"
|
| 1680 |
+
debug "^4.3.5"
|
| 1681 |
+
esbuild "^0.23.0"
|
| 1682 |
+
execa "^5.1.1"
|
| 1683 |
+
globby "^11.1.0"
|
| 1684 |
+
joycon "^3.1.1"
|
| 1685 |
+
picocolors "^1.0.1"
|
| 1686 |
+
postcss-load-config "^6.0.1"
|
| 1687 |
+
resolve-from "^5.0.0"
|
| 1688 |
+
rollup "^4.19.0"
|
| 1689 |
+
source-map "0.8.0-beta.0"
|
| 1690 |
+
sucrase "^3.35.0"
|
| 1691 |
+
tree-kill "^1.2.2"
|
| 1692 |
+
|
| 1693 |
+
type-is@^1.6.14, type-is@^1.6.16, type-is@^1.6.18:
|
| 1694 |
+
version "1.6.18"
|
| 1695 |
+
resolved "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz"
|
| 1696 |
+
integrity sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==
|
| 1697 |
+
dependencies:
|
| 1698 |
+
media-typer "0.3.0"
|
| 1699 |
+
mime-types "~2.1.24"
|
| 1700 |
+
|
| 1701 |
+
typescript@^5.3.3, typescript@>=4.5.0:
|
| 1702 |
+
version "5.5.4"
|
| 1703 |
+
resolved "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz"
|
| 1704 |
+
integrity sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==
|
| 1705 |
+
|
| 1706 |
+
uglify-js@1.x:
|
| 1707 |
+
version "1.3.5"
|
| 1708 |
+
resolved "https://registry.npmjs.org/uglify-js/-/uglify-js-1.3.5.tgz"
|
| 1709 |
+
integrity sha512-YPX1DjKtom8l9XslmPFQnqWzTBkvI4N0pbkzLuPZZ4QTyig0uQqvZz9NgUdfEV+qccJzi7fVcGWdESvRIjWptQ==
|
| 1710 |
+
|
| 1711 |
+
undici-types@~5.26.4:
|
| 1712 |
+
version "5.26.5"
|
| 1713 |
+
resolved "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz"
|
| 1714 |
+
integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==
|
| 1715 |
+
|
| 1716 |
+
universalify@^2.0.0:
|
| 1717 |
+
version "2.0.1"
|
| 1718 |
+
resolved "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz"
|
| 1719 |
+
integrity sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==
|
| 1720 |
+
|
| 1721 |
+
unpipe@1.0.0:
|
| 1722 |
+
version "1.0.0"
|
| 1723 |
+
resolved "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz"
|
| 1724 |
+
integrity sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==
|
| 1725 |
+
|
| 1726 |
+
util-deprecate@^1.0.1:
|
| 1727 |
+
version "1.0.2"
|
| 1728 |
+
resolved "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz"
|
| 1729 |
+
integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==
|
| 1730 |
+
|
| 1731 |
+
uuid@^9.0.1:
|
| 1732 |
+
version "9.0.1"
|
| 1733 |
+
resolved "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz"
|
| 1734 |
+
integrity sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==
|
| 1735 |
+
|
| 1736 |
+
vary@^1.1.2:
|
| 1737 |
+
version "1.1.2"
|
| 1738 |
+
resolved "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz"
|
| 1739 |
+
integrity sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==
|
| 1740 |
+
|
| 1741 |
+
walker@1.x:
|
| 1742 |
+
version "1.0.8"
|
| 1743 |
+
resolved "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz"
|
| 1744 |
+
integrity sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==
|
| 1745 |
+
dependencies:
|
| 1746 |
+
makeerror "1.0.12"
|
| 1747 |
+
|
| 1748 |
+
webidl-conversions@^4.0.2:
|
| 1749 |
+
version "4.0.2"
|
| 1750 |
+
resolved "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz"
|
| 1751 |
+
integrity sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==
|
| 1752 |
+
|
| 1753 |
+
whatwg-url@^7.0.0:
|
| 1754 |
+
version "7.1.0"
|
| 1755 |
+
resolved "https://registry.npmjs.org/whatwg-url/-/whatwg-url-7.1.0.tgz"
|
| 1756 |
+
integrity sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==
|
| 1757 |
+
dependencies:
|
| 1758 |
+
lodash.sortby "^4.7.0"
|
| 1759 |
+
tr46 "^1.0.1"
|
| 1760 |
+
webidl-conversions "^4.0.2"
|
| 1761 |
+
|
| 1762 |
+
which@^2.0.1:
|
| 1763 |
+
version "2.0.2"
|
| 1764 |
+
resolved "https://registry.npmjs.org/which/-/which-2.0.2.tgz"
|
| 1765 |
+
integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==
|
| 1766 |
+
dependencies:
|
| 1767 |
+
isexe "^2.0.0"
|
| 1768 |
+
|
| 1769 |
+
winston-transport@^4.9.0:
|
| 1770 |
+
version "4.9.0"
|
| 1771 |
+
resolved "https://registry.npmjs.org/winston-transport/-/winston-transport-4.9.0.tgz"
|
| 1772 |
+
integrity sha512-8drMJ4rkgaPo1Me4zD/3WLfI/zPdA9o2IipKODunnGDcuqbHwjsbB79ylv04LCGGzU0xQ6vTznOMpQGaLhhm6A==
|
| 1773 |
+
dependencies:
|
| 1774 |
+
logform "^2.7.0"
|
| 1775 |
+
readable-stream "^3.6.2"
|
| 1776 |
+
triple-beam "^1.3.0"
|
| 1777 |
+
|
| 1778 |
+
winston@*:
|
| 1779 |
+
version "3.17.0"
|
| 1780 |
+
resolved "https://registry.npmjs.org/winston/-/winston-3.17.0.tgz"
|
| 1781 |
+
integrity sha512-DLiFIXYC5fMPxaRg832S6F5mJYvePtmO5G9v9IgUFPhXm9/GkXarH/TUrBAVzhTCzAj9anE/+GjrgXp/54nOgw==
|
| 1782 |
+
dependencies:
|
| 1783 |
+
"@colors/colors" "^1.6.0"
|
| 1784 |
+
"@dabh/diagnostics" "^2.0.2"
|
| 1785 |
+
async "^3.2.3"
|
| 1786 |
+
is-stream "^2.0.0"
|
| 1787 |
+
logform "^2.7.0"
|
| 1788 |
+
one-time "^1.0.0"
|
| 1789 |
+
readable-stream "^3.4.0"
|
| 1790 |
+
safe-stable-stringify "^2.3.1"
|
| 1791 |
+
stack-trace "0.0.x"
|
| 1792 |
+
triple-beam "^1.3.0"
|
| 1793 |
+
winston-transport "^4.9.0"
|
| 1794 |
+
|
| 1795 |
+
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
|
| 1796 |
+
version "7.0.0"
|
| 1797 |
+
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz"
|
| 1798 |
+
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
|
| 1799 |
+
dependencies:
|
| 1800 |
+
ansi-styles "^4.0.0"
|
| 1801 |
+
string-width "^4.1.0"
|
| 1802 |
+
strip-ansi "^6.0.0"
|
| 1803 |
+
|
| 1804 |
+
wrap-ansi@^8.1.0:
|
| 1805 |
+
version "8.1.0"
|
| 1806 |
+
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz"
|
| 1807 |
+
integrity sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==
|
| 1808 |
+
dependencies:
|
| 1809 |
+
ansi-styles "^6.1.0"
|
| 1810 |
+
string-width "^5.0.1"
|
| 1811 |
+
strip-ansi "^7.0.1"
|
| 1812 |
+
|
| 1813 |
+
wrappy@1:
|
| 1814 |
+
version "1.0.2"
|
| 1815 |
+
resolved "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz"
|
| 1816 |
+
integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==
|
| 1817 |
+
|
| 1818 |
+
wrench@1.3.x:
|
| 1819 |
+
version "1.3.9"
|
| 1820 |
+
resolved "https://registry.npmjs.org/wrench/-/wrench-1.3.9.tgz"
|
| 1821 |
+
integrity sha512-srTJQmLTP5YtW+F5zDuqjMEZqLLr/eJOZfDI5ibfPfRMeDh3oBUefAscuH0q5wBKE339ptH/S/0D18ZkfOfmKQ==
|
| 1822 |
+
|
| 1823 |
+
yaml@^2.3.4, yaml@^2.4.2:
|
| 1824 |
+
version "2.5.0"
|
| 1825 |
+
resolved "https://registry.npmjs.org/yaml/-/yaml-2.5.0.tgz"
|
| 1826 |
+
integrity sha512-2wWLbGbYDiSqqIKoPjar3MPgB94ErzCtrNE1FdqGuaO0pi2JGjmE8aW8TDZwzU7vuxcGRdL/4gPQwQ7hD5AMSw==
|
| 1827 |
+
|
| 1828 |
+
ylru@^1.2.0:
|
| 1829 |
+
version "1.4.0"
|
| 1830 |
+
resolved "https://registry.npmjs.org/ylru/-/ylru-1.4.0.tgz"
|
| 1831 |
+
integrity sha512-2OQsPNEmBCvXuFlIni/a+Rn+R2pHW9INm0BxXJ4hVDA8TirqMj+J/Rp9ItLatT/5pZqWwefVrTQcHpixsxnVlA==
|