bullmq升级到最新

This commit is contained in:
COOL 2025-01-16 21:30:13 +08:00
parent 4d736987f2
commit 33e7e508f2
26 changed files with 8808 additions and 135 deletions

View File

@ -1,7 +1,7 @@
{
"name": "@cool-midway/core",
"version": "8.0.0",
"description": "cool-admin core",
"description": "cool-admin midway core",
"main": "dist/index.js",
"typings": "index.d.ts",
"bin": {
@ -35,13 +35,13 @@
"@midwayjs/logger": "^3.4.2",
"mwtsc": "^1.15.1",
"@midwayjs/cli": "2.1.1",
"@midwayjs/core": "^3.19.0",
"@midwayjs/koa": "^3.19.2",
"@midwayjs/mock": "^3.19.2",
"@midwayjs/typeorm": "^3.19.2",
"@midwayjs/core": "^3.20.0",
"@midwayjs/koa": "^3.20.0",
"@midwayjs/mock": "^3.20.0",
"@midwayjs/typeorm": "^3.20.0",
"@types/download": "^8.0.5",
"@types/jest": "^29.5.14",
"@types/node": "^22.10.5",
"@types/node": "^22.10.7",
"aedes": "^0.51.3",
"cross-env": "^7.0.3",
"jest": "^29.7.0",
@ -53,10 +53,9 @@
"dependencies": {
"@cool-midway/cache-manager-fs-hash": "^7.0.0",
"@midwayjs/cache": "^3.14.0",
"@midwayjs/cache-manager": "^3.19.3",
"@midwayjs/cache-manager": "^3.20.0",
"axios": "^1.7.9",
"commander": "^13.0.0",
"decompress": "^4.2.1",
"download": "^8.0.0",
"glob": "^11.0.1",
"javascript-obfuscator": "^4.1.1",

213
core/pnpm-lock.yaml generated
View File

@ -15,17 +15,14 @@ importers:
specifier: ^3.14.0
version: 3.14.0
'@midwayjs/cache-manager':
specifier: ^3.19.3
version: 3.19.3
specifier: ^3.20.0
version: 3.20.0
axios:
specifier: ^1.7.9
version: 1.7.9
commander:
specifier: ^13.0.0
version: 13.0.0
decompress:
specifier: ^4.2.1
version: 4.2.1
download:
specifier: ^8.0.0
version: 8.0.0
@ -62,22 +59,22 @@ importers:
devDependencies:
'@midwayjs/cli':
specifier: 2.1.1
version: 2.1.1(@midwayjs/mock@3.19.2)(@types/node@22.10.5)(typescript@5.7.3)
version: 2.1.1(@midwayjs/mock@3.20.0)(@types/node@22.10.7)(typescript@5.7.3)
'@midwayjs/core':
specifier: ^3.19.0
version: 3.19.0
specifier: ^3.20.0
version: 3.20.0
'@midwayjs/koa':
specifier: ^3.19.2
version: 3.19.2
specifier: ^3.20.0
version: 3.20.0
'@midwayjs/logger':
specifier: ^3.4.2
version: 3.4.2
'@midwayjs/mock':
specifier: ^3.19.2
version: 3.19.2
specifier: ^3.20.0
version: 3.20.0
'@midwayjs/typeorm':
specifier: ^3.19.2
version: 3.19.2
specifier: ^3.20.0
version: 3.20.0
'@types/download':
specifier: ^8.0.5
version: 8.0.5
@ -85,8 +82,8 @@ importers:
specifier: ^29.5.14
version: 29.5.14
'@types/node':
specifier: ^22.10.5
version: 22.10.5
specifier: ^22.10.7
version: 22.10.7
aedes:
specifier: ^0.51.3
version: 0.51.3
@ -95,7 +92,7 @@ importers:
version: 7.0.3
jest:
specifier: ^29.7.0
version: 29.7.0(@types/node@22.10.5)(ts-node@10.9.2(@types/node@22.10.5)(typescript@5.7.3))
version: 29.7.0(@types/node@22.10.7)(ts-node@10.9.2(@types/node@22.10.7)(typescript@5.7.3))
mwts:
specifier: ^1.3.0
version: 1.3.0(typescript@5.7.3)
@ -104,10 +101,10 @@ importers:
version: 1.15.1
ts-jest:
specifier: ^29.2.5
version: 29.2.5(@babel/core@7.26.0)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.26.0))(jest@29.7.0(@types/node@22.10.5)(ts-node@10.9.2(@types/node@22.10.5)(typescript@5.7.3)))(typescript@5.7.3)
version: 29.2.5(@babel/core@7.26.0)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.26.0))(jest@29.7.0(@types/node@22.10.7)(ts-node@10.9.2(@types/node@22.10.7)(typescript@5.7.3)))(typescript@5.7.3)
typeorm:
specifier: ^0.3.20
version: 0.3.20(ts-node@10.9.2(@types/node@22.10.5)(typescript@5.7.3))
version: 0.3.20(ts-node@10.9.2(@types/node@22.10.7)(typescript@5.7.3))
typescript:
specifier: ~5.7.3
version: 5.7.3
@ -443,12 +440,12 @@ packages:
resolution: {integrity: sha512-sYcHglGKTxGF+hQ6x67xDfkE9o+NhVlRHBqq6gLywaMc6CojK/5vFZByphdonKinYlMLkEkacm+HEse9HzwgTA==}
engines: {node: '>= 12'}
'@midwayjs/async-hooks-context-manager@3.19.0':
resolution: {integrity: sha512-jPVBR2wweN8F1bBx6gZhm70+drA0bo3TQBRsfTCIt0MJv3lTzsn/agRi1YgcQ+BXQnLDaGEUiTVTV4J2Ak/Rqw==}
'@midwayjs/async-hooks-context-manager@3.20.0':
resolution: {integrity: sha512-uHhUs5jlbBGC6cG3H+SICjY/VKBTzXNlIfEEycQ9kbUVfF+y5gI8MyF/vhtmP/Y5sdqHoQI7BFx1XATqt85rxg==}
engines: {node: '>=12.17.0'}
'@midwayjs/cache-manager@3.19.3':
resolution: {integrity: sha512-aksDyxpFOm9fRCdi3efA9v3NsXlMUm2YxaO/00ZQRAM3pDcNom55WiV3MKsZUDugvYa6+HsYAmL2wJR8PJcu/Q==}
'@midwayjs/cache-manager@3.20.0':
resolution: {integrity: sha512-dbEidbEMwbgCGYjbQt+EyFhqRXgOfkj80JrbCSPki33EhAxCcNjg8popJCe25iVKMU4JlKQrLm7mcJyk3R4z2g==}
engines: {node: '>=12'}
'@midwayjs/cache@3.14.0':
@ -490,8 +487,8 @@ packages:
resolution: {integrity: sha512-gdfAXk3+uL+9qcNo9lNnUFJCUGXXxCitBjyz9QJR08dcZ11mqTbxVNXhea525e3ZwKREy6f4PHAWofFwlPOZzQ==}
engines: {node: '>=10'}
'@midwayjs/core@3.19.0':
resolution: {integrity: sha512-qFoaFeN8c0UcfJKwmXoFmFxhMVMIT+MwUcTt1A9r/7lGmuqTukUICv5dxhTFffIr6YJHhSMOXEK5u9FV/NxGGA==}
'@midwayjs/core@3.20.0':
resolution: {integrity: sha512-Y7FrdaWgIUdyl0kVub+YhAIimgZugOPYw3ud/aUcB813ZN17IbGnmSFFyssO5xcoH8c8D0PRWVrT0jUdWUdS9A==}
engines: {node: '>=12'}
'@midwayjs/debugger@1.0.9':
@ -501,8 +498,8 @@ packages:
'@midwayjs/glob@1.1.1':
resolution: {integrity: sha512-xoNU+JdCxE214KQrB0qgs88+Da7KYVICeuTL9VeKwaxZXj6a/PbpmEaH4+5BHLvZRRe78tHGR19+nKZrmMHBJg==}
'@midwayjs/koa@3.19.2':
resolution: {integrity: sha512-F25hMArjUoGlfKddbbH3VqvjPkxp8tdN6Jv/hKr4Hs1sMWuJd3IjBOkdKP9EhYL6adza9eJuBkX8QbzkKHz3Jw==}
'@midwayjs/koa@3.20.0':
resolution: {integrity: sha512-1G24TqwfxQxRculIyVNZDocoFSREL7BOK9d9B2ufGduPIVRJ4g7LL1ggRDuSWKyjysX7SzeIhVqEjN8zHqfLMA==}
engines: {node: '>=12'}
'@midwayjs/locate@1.8.1':
@ -517,20 +514,20 @@ packages:
engines: {node: '>= 10.0.0'}
hasBin: true
'@midwayjs/mock@3.19.2':
resolution: {integrity: sha512-gwgMoB3u2JhS59AmVM8uA9rlsQXZeYBJzzGGMsmZ/bz0qaFinyPrUIPPQik4NMfa+v7i3hTPf1U9yxWaLSzZHA==}
'@midwayjs/mock@3.20.0':
resolution: {integrity: sha512-ZZASgdhHWkqyXuuNxMozKhCTDY6/wCCiogHL+Y/YGW50VdMfs2DXMzCH7Y3eihDF8IcZa7V0z48S9dA/aOB2Eg==}
engines: {node: '>=12'}
'@midwayjs/serverless-spec-builder@2.1.0':
resolution: {integrity: sha512-OGf2zQ+RxctguVNpSXJAGAM9qeP97vD9S0Cc8hwiMomTYjNWW5WvRKtCyb8KWBnP2hEkWPuhPJ4WQo8wEg0AgQ==}
engines: {node: '>= 10'}
'@midwayjs/session@3.19.2':
resolution: {integrity: sha512-SRZWFrEw5BPDTIRjOyh0/YoAiafQBbeR+by62kl/s9noy47UlJIRzGcXORbUHpKIbv+7u9jCnZyniXpNNJ53EA==}
'@midwayjs/session@3.20.0':
resolution: {integrity: sha512-W5y6Q6JYx7y6gqfztOKjF/CxBtd298R2/sd/DpH0U+JwJECnG6+T528jbP2s6TPYUOjx12nVvRMHQ9w+VtM3qw==}
engines: {node: '>=12'}
'@midwayjs/typeorm@3.19.2':
resolution: {integrity: sha512-dJnkEZsGr7wON0HkKys51a4iHPzP1gyjyPcbcgqLJdfeJ3iCTOuQ7dDsBz0TTU8V7iYMTgzHcSgtkkl5j9+4jA==}
'@midwayjs/typeorm@3.20.0':
resolution: {integrity: sha512-PaqsALHVmw877zGuu16LjGeFY/5AdVk01hqxkk6NfvW7KJ3iU18vE+WVk9Wxeh/2ue/LK+itCgVX5aam0kle0A==}
engines: {node: '>=12'}
hasBin: true
@ -705,8 +702,8 @@ packages:
'@types/minimist@1.2.5':
resolution: {integrity: sha512-hov8bUuiLiyFPGyFPE1lwWhmzYbirOXQNNo40+y3zow8aFVTeyn3VWL0VFFfdNddA8S4Vf0Tc062rzyNr7Paag==}
'@types/node@22.10.5':
resolution: {integrity: sha512-F8Q+SeGimwOo86fiovQh8qiXfFEh2/ocYv7tU5pJ3EXMSSxk1Joj5wefpFK2fHTf/N6HKGSxIDBT9f3gCxXPkQ==}
'@types/node@22.10.7':
resolution: {integrity: sha512-V09KvXxFiutGp6B7XkpaDXlNadZxrzajcY50EuoLIpQ6WWYCSvf19lVIazzfIzQvhUN2HjX12spLojTnhuKlGg==}
'@types/normalize-package-data@2.4.4':
resolution: {integrity: sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==}
@ -4418,27 +4415,27 @@ snapshots:
'@jest/console@29.7.0':
dependencies:
'@jest/types': 29.6.3
'@types/node': 22.10.5
'@types/node': 22.10.7
chalk: 4.1.2
jest-message-util: 29.7.0
jest-util: 29.7.0
slash: 3.0.0
'@jest/core@29.7.0(ts-node@10.9.2(@types/node@22.10.5)(typescript@5.7.3))':
'@jest/core@29.7.0(ts-node@10.9.2(@types/node@22.10.7)(typescript@5.7.3))':
dependencies:
'@jest/console': 29.7.0
'@jest/reporters': 29.7.0
'@jest/test-result': 29.7.0
'@jest/transform': 29.7.0
'@jest/types': 29.6.3
'@types/node': 22.10.5
'@types/node': 22.10.7
ansi-escapes: 4.3.2
chalk: 4.1.2
ci-info: 3.9.0
exit: 0.1.2
graceful-fs: 4.2.11
jest-changed-files: 29.7.0
jest-config: 29.7.0(@types/node@22.10.5)(ts-node@10.9.2(@types/node@22.10.5)(typescript@5.7.3))
jest-config: 29.7.0(@types/node@22.10.7)(ts-node@10.9.2(@types/node@22.10.7)(typescript@5.7.3))
jest-haste-map: 29.7.0
jest-message-util: 29.7.0
jest-regex-util: 29.6.3
@ -4463,7 +4460,7 @@ snapshots:
dependencies:
'@jest/fake-timers': 29.7.0
'@jest/types': 29.6.3
'@types/node': 22.10.5
'@types/node': 22.10.7
jest-mock: 29.7.0
'@jest/expect-utils@29.7.0':
@ -4481,7 +4478,7 @@ snapshots:
dependencies:
'@jest/types': 29.6.3
'@sinonjs/fake-timers': 10.3.0
'@types/node': 22.10.5
'@types/node': 22.10.7
jest-message-util: 29.7.0
jest-mock: 29.7.0
jest-util: 29.7.0
@ -4503,7 +4500,7 @@ snapshots:
'@jest/transform': 29.7.0
'@jest/types': 29.6.3
'@jridgewell/trace-mapping': 0.3.25
'@types/node': 22.10.5
'@types/node': 22.10.7
chalk: 4.1.2
collect-v8-coverage: 1.0.2
exit: 0.1.2
@ -4573,7 +4570,7 @@ snapshots:
'@jest/schemas': 29.6.3
'@types/istanbul-lib-coverage': 2.0.6
'@types/istanbul-reports': 3.0.4
'@types/node': 22.10.5
'@types/node': 22.10.7
'@types/yargs': 17.0.33
chalk: 4.1.2
@ -4609,9 +4606,9 @@ snapshots:
transitivePeerDependencies:
- supports-color
'@midwayjs/async-hooks-context-manager@3.19.0': {}
'@midwayjs/async-hooks-context-manager@3.20.0': {}
'@midwayjs/cache-manager@3.19.3':
'@midwayjs/cache-manager@3.20.0':
dependencies:
lodash.clonedeep: 4.5.0
lru-cache: 7.18.3
@ -4644,11 +4641,11 @@ snapshots:
'@midwayjs/serverless-spec-builder': 2.1.0
fs-extra: 8.1.0
'@midwayjs/cli-plugin-dev@2.1.1(@midwayjs/mock@3.19.2)':
'@midwayjs/cli-plugin-dev@2.1.1(@midwayjs/mock@3.20.0)':
dependencies:
'@midwayjs/command-core': 2.1.0
'@midwayjs/debugger': 1.0.9
'@midwayjs/mock': 3.19.2
'@midwayjs/mock': 3.20.0
chalk: 4.1.2
chokidar: 3.6.0
detect-port: 1.6.1
@ -4667,30 +4664,30 @@ snapshots:
- supports-color
- utf-8-validate
'@midwayjs/cli-plugin-test@2.1.0(@types/node@22.10.5)':
'@midwayjs/cli-plugin-test@2.1.0(@types/node@22.10.7)':
dependencies:
'@midwayjs/command-core': 2.1.0
globby: 10.0.2
ts-node: 10.9.2(@types/node@22.10.5)(typescript@4.9.5)
ts-node: 10.9.2(@types/node@22.10.7)(typescript@4.9.5)
typescript: 4.9.5
transitivePeerDependencies:
- '@swc/core'
- '@swc/wasm'
- '@types/node'
'@midwayjs/cli@2.1.1(@midwayjs/mock@3.19.2)(@types/node@22.10.5)(typescript@5.7.3)':
'@midwayjs/cli@2.1.1(@midwayjs/mock@3.20.0)(@types/node@22.10.7)(typescript@5.7.3)':
dependencies:
'@midwayjs/cli-plugin-build': 2.1.0
'@midwayjs/cli-plugin-check': 2.1.0
'@midwayjs/cli-plugin-clean': 2.1.0
'@midwayjs/cli-plugin-dev': 2.1.1(@midwayjs/mock@3.19.2)
'@midwayjs/cli-plugin-test': 2.1.0(@types/node@22.10.5)
'@midwayjs/cli-plugin-dev': 2.1.1(@midwayjs/mock@3.20.0)
'@midwayjs/cli-plugin-test': 2.1.0(@types/node@22.10.7)
'@midwayjs/command-core': 2.1.0
enquirer: 2.4.1
minimist: 1.2.8
mod-info: 1.0.2
source-map-support: 0.5.21
ts-node: 10.9.2(@types/node@22.10.5)(typescript@5.7.3)
ts-node: 10.9.2(@types/node@22.10.7)(typescript@5.7.3)
transitivePeerDependencies:
- '@midwayjs/mock'
- '@swc/core'
@ -4715,7 +4712,7 @@ snapshots:
scmp: 2.1.0
should-send-same-site-none: 2.0.5
'@midwayjs/core@3.19.0':
'@midwayjs/core@3.20.0':
dependencies:
'@midwayjs/glob': 1.1.1
class-transformer: 0.5.1
@ -4735,12 +4732,12 @@ snapshots:
dependencies:
picomatch: 2.3.1
'@midwayjs/koa@3.19.2':
'@midwayjs/koa@3.20.0':
dependencies:
'@koa/router': 12.0.2
'@midwayjs/cookies': 1.2.0
'@midwayjs/core': 3.19.0
'@midwayjs/session': 3.19.2
'@midwayjs/core': 3.20.0
'@midwayjs/session': 3.20.0
'@types/koa': 2.15.0
'@types/qs': 6.9.17
koa: 2.15.3
@ -4767,9 +4764,9 @@ snapshots:
semver: 7.6.3
supports-color: 8.1.1
'@midwayjs/mock@3.19.2':
'@midwayjs/mock@3.20.0':
dependencies:
'@midwayjs/async-hooks-context-manager': 3.19.0
'@midwayjs/async-hooks-context-manager': 3.20.0
'@types/superagent': 4.1.14
'@types/supertest': 2.0.16
js-yaml: 4.1.0
@ -4784,11 +4781,11 @@ snapshots:
js-yaml: 4.1.0
mkdirp: 0.5.6
'@midwayjs/session@3.19.2':
'@midwayjs/session@3.20.0':
dependencies:
'@midwayjs/cookies': 1.2.0
'@midwayjs/typeorm@3.19.2': {}
'@midwayjs/typeorm@3.20.0': {}
'@midwayjs/version@3.19.3': {}
@ -4890,7 +4887,7 @@ snapshots:
'@types/accepts@1.3.7':
dependencies:
'@types/node': 22.10.5
'@types/node': 22.10.7
'@types/babel__core@7.20.5':
dependencies:
@ -4916,11 +4913,11 @@ snapshots:
'@types/body-parser@1.19.5':
dependencies:
'@types/connect': 3.4.38
'@types/node': 22.10.5
'@types/node': 22.10.7
'@types/connect@3.4.38':
dependencies:
'@types/node': 22.10.5
'@types/node': 22.10.7
'@types/content-disposition@0.5.8': {}
@ -4931,21 +4928,21 @@ snapshots:
'@types/connect': 3.4.38
'@types/express': 5.0.0
'@types/keygrip': 1.0.6
'@types/node': 22.10.5
'@types/node': 22.10.7
'@types/decompress@4.2.7':
dependencies:
'@types/node': 22.10.5
'@types/node': 22.10.7
'@types/download@8.0.5':
dependencies:
'@types/decompress': 4.2.7
'@types/got': 9.6.12
'@types/node': 22.10.5
'@types/node': 22.10.7
'@types/express-serve-static-core@5.0.4':
dependencies:
'@types/node': 22.10.5
'@types/node': 22.10.7
'@types/qs': 6.9.17
'@types/range-parser': 1.2.7
'@types/send': 0.17.4
@ -4960,17 +4957,17 @@ snapshots:
'@types/glob@7.2.0':
dependencies:
'@types/minimatch': 5.1.2
'@types/node': 22.10.5
'@types/node': 22.10.7
'@types/got@9.6.12':
dependencies:
'@types/node': 22.10.5
'@types/node': 22.10.7
'@types/tough-cookie': 4.0.5
form-data: 2.5.2
'@types/graceful-fs@4.1.9':
dependencies:
'@types/node': 22.10.5
'@types/node': 22.10.7
'@types/http-assert@1.5.6': {}
@ -4999,7 +4996,7 @@ snapshots:
'@types/keyv@3.1.4':
dependencies:
'@types/node': 22.10.5
'@types/node': 22.10.7
'@types/koa-compose@3.2.8':
dependencies:
@ -5014,7 +5011,7 @@ snapshots:
'@types/http-errors': 2.0.4
'@types/keygrip': 1.0.6
'@types/koa-compose': 3.2.8
'@types/node': 22.10.5
'@types/node': 22.10.7
'@types/mime@1.3.5': {}
@ -5024,7 +5021,7 @@ snapshots:
'@types/minimist@1.2.5': {}
'@types/node@22.10.5':
'@types/node@22.10.7':
dependencies:
undici-types: 6.20.0
@ -5036,24 +5033,24 @@ snapshots:
'@types/readable-stream@4.0.18':
dependencies:
'@types/node': 22.10.5
'@types/node': 22.10.7
safe-buffer: 5.1.2
'@types/responselike@1.0.3':
dependencies:
'@types/node': 22.10.5
'@types/node': 22.10.7
'@types/semver@7.5.8': {}
'@types/send@0.17.4':
dependencies:
'@types/mime': 1.3.5
'@types/node': 22.10.5
'@types/node': 22.10.7
'@types/serve-static@1.15.7':
dependencies:
'@types/http-errors': 2.0.4
'@types/node': 22.10.5
'@types/node': 22.10.7
'@types/send': 0.17.4
'@types/stack-utils@2.0.3': {}
@ -5061,7 +5058,7 @@ snapshots:
'@types/superagent@4.1.14':
dependencies:
'@types/cookiejar': 2.1.5
'@types/node': 22.10.5
'@types/node': 22.10.7
'@types/supertest@2.0.16':
dependencies:
@ -5718,13 +5715,13 @@ snapshots:
core-util-is@1.0.3: {}
create-jest@29.7.0(@types/node@22.10.5)(ts-node@10.9.2(@types/node@22.10.5)(typescript@5.7.3)):
create-jest@29.7.0(@types/node@22.10.7)(ts-node@10.9.2(@types/node@22.10.7)(typescript@5.7.3)):
dependencies:
'@jest/types': 29.6.3
chalk: 4.1.2
exit: 0.1.2
graceful-fs: 4.2.11
jest-config: 29.7.0(@types/node@22.10.5)(ts-node@10.9.2(@types/node@22.10.5)(typescript@5.7.3))
jest-config: 29.7.0(@types/node@22.10.7)(ts-node@10.9.2(@types/node@22.10.7)(typescript@5.7.3))
jest-util: 29.7.0
prompts: 2.4.2
transitivePeerDependencies:
@ -6817,7 +6814,7 @@ snapshots:
'@jest/expect': 29.7.0
'@jest/test-result': 29.7.0
'@jest/types': 29.6.3
'@types/node': 22.10.5
'@types/node': 22.10.7
chalk: 4.1.2
co: 4.6.0
dedent: 1.5.3
@ -6837,16 +6834,16 @@ snapshots:
- babel-plugin-macros
- supports-color
jest-cli@29.7.0(@types/node@22.10.5)(ts-node@10.9.2(@types/node@22.10.5)(typescript@5.7.3)):
jest-cli@29.7.0(@types/node@22.10.7)(ts-node@10.9.2(@types/node@22.10.7)(typescript@5.7.3)):
dependencies:
'@jest/core': 29.7.0(ts-node@10.9.2(@types/node@22.10.5)(typescript@5.7.3))
'@jest/core': 29.7.0(ts-node@10.9.2(@types/node@22.10.7)(typescript@5.7.3))
'@jest/test-result': 29.7.0
'@jest/types': 29.6.3
chalk: 4.1.2
create-jest: 29.7.0(@types/node@22.10.5)(ts-node@10.9.2(@types/node@22.10.5)(typescript@5.7.3))
create-jest: 29.7.0(@types/node@22.10.7)(ts-node@10.9.2(@types/node@22.10.7)(typescript@5.7.3))
exit: 0.1.2
import-local: 3.2.0
jest-config: 29.7.0(@types/node@22.10.5)(ts-node@10.9.2(@types/node@22.10.5)(typescript@5.7.3))
jest-config: 29.7.0(@types/node@22.10.7)(ts-node@10.9.2(@types/node@22.10.7)(typescript@5.7.3))
jest-util: 29.7.0
jest-validate: 29.7.0
yargs: 17.7.2
@ -6856,7 +6853,7 @@ snapshots:
- supports-color
- ts-node
jest-config@29.7.0(@types/node@22.10.5)(ts-node@10.9.2(@types/node@22.10.5)(typescript@5.7.3)):
jest-config@29.7.0(@types/node@22.10.7)(ts-node@10.9.2(@types/node@22.10.7)(typescript@5.7.3)):
dependencies:
'@babel/core': 7.26.0
'@jest/test-sequencer': 29.7.0
@ -6881,8 +6878,8 @@ snapshots:
slash: 3.0.0
strip-json-comments: 3.1.1
optionalDependencies:
'@types/node': 22.10.5
ts-node: 10.9.2(@types/node@22.10.5)(typescript@5.7.3)
'@types/node': 22.10.7
ts-node: 10.9.2(@types/node@22.10.7)(typescript@5.7.3)
transitivePeerDependencies:
- babel-plugin-macros
- supports-color
@ -6911,7 +6908,7 @@ snapshots:
'@jest/environment': 29.7.0
'@jest/fake-timers': 29.7.0
'@jest/types': 29.6.3
'@types/node': 22.10.5
'@types/node': 22.10.7
jest-mock: 29.7.0
jest-util: 29.7.0
@ -6921,7 +6918,7 @@ snapshots:
dependencies:
'@jest/types': 29.6.3
'@types/graceful-fs': 4.1.9
'@types/node': 22.10.5
'@types/node': 22.10.7
anymatch: 3.1.3
fb-watchman: 2.0.2
graceful-fs: 4.2.11
@ -6960,7 +6957,7 @@ snapshots:
jest-mock@29.7.0:
dependencies:
'@jest/types': 29.6.3
'@types/node': 22.10.5
'@types/node': 22.10.7
jest-util: 29.7.0
jest-pnp-resolver@1.2.3(jest-resolve@29.7.0):
@ -6995,7 +6992,7 @@ snapshots:
'@jest/test-result': 29.7.0
'@jest/transform': 29.7.0
'@jest/types': 29.6.3
'@types/node': 22.10.5
'@types/node': 22.10.7
chalk: 4.1.2
emittery: 0.13.1
graceful-fs: 4.2.11
@ -7023,7 +7020,7 @@ snapshots:
'@jest/test-result': 29.7.0
'@jest/transform': 29.7.0
'@jest/types': 29.6.3
'@types/node': 22.10.5
'@types/node': 22.10.7
chalk: 4.1.2
cjs-module-lexer: 1.4.1
collect-v8-coverage: 1.0.2
@ -7069,7 +7066,7 @@ snapshots:
jest-util@29.7.0:
dependencies:
'@jest/types': 29.6.3
'@types/node': 22.10.5
'@types/node': 22.10.7
chalk: 4.1.2
ci-info: 3.9.0
graceful-fs: 4.2.11
@ -7088,7 +7085,7 @@ snapshots:
dependencies:
'@jest/test-result': 29.7.0
'@jest/types': 29.6.3
'@types/node': 22.10.5
'@types/node': 22.10.7
ansi-escapes: 4.3.2
chalk: 4.1.2
emittery: 0.13.1
@ -7097,17 +7094,17 @@ snapshots:
jest-worker@29.7.0:
dependencies:
'@types/node': 22.10.5
'@types/node': 22.10.7
jest-util: 29.7.0
merge-stream: 2.0.0
supports-color: 8.1.1
jest@29.7.0(@types/node@22.10.5)(ts-node@10.9.2(@types/node@22.10.5)(typescript@5.7.3)):
jest@29.7.0(@types/node@22.10.7)(ts-node@10.9.2(@types/node@22.10.7)(typescript@5.7.3)):
dependencies:
'@jest/core': 29.7.0(ts-node@10.9.2(@types/node@22.10.5)(typescript@5.7.3))
'@jest/core': 29.7.0(ts-node@10.9.2(@types/node@22.10.7)(typescript@5.7.3))
'@jest/types': 29.6.3
import-local: 3.2.0
jest-cli: 29.7.0(@types/node@22.10.5)(ts-node@10.9.2(@types/node@22.10.5)(typescript@5.7.3))
jest-cli: 29.7.0(@types/node@22.10.7)(ts-node@10.9.2(@types/node@22.10.7)(typescript@5.7.3))
transitivePeerDependencies:
- '@types/node'
- babel-plugin-macros
@ -8426,12 +8423,12 @@ snapshots:
dependencies:
escape-string-regexp: 1.0.5
ts-jest@29.2.5(@babel/core@7.26.0)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.26.0))(jest@29.7.0(@types/node@22.10.5)(ts-node@10.9.2(@types/node@22.10.5)(typescript@5.7.3)))(typescript@5.7.3):
ts-jest@29.2.5(@babel/core@7.26.0)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.26.0))(jest@29.7.0(@types/node@22.10.7)(ts-node@10.9.2(@types/node@22.10.7)(typescript@5.7.3)))(typescript@5.7.3):
dependencies:
bs-logger: 0.2.6
ejs: 3.1.10
fast-json-stable-stringify: 2.1.0
jest: 29.7.0(@types/node@22.10.5)(ts-node@10.9.2(@types/node@22.10.5)(typescript@5.7.3))
jest: 29.7.0(@types/node@22.10.7)(ts-node@10.9.2(@types/node@22.10.7)(typescript@5.7.3))
jest-util: 29.7.0
json5: 2.2.3
lodash.memoize: 4.1.2
@ -8445,14 +8442,14 @@ snapshots:
'@jest/types': 29.6.3
babel-jest: 29.7.0(@babel/core@7.26.0)
ts-node@10.9.2(@types/node@22.10.5)(typescript@4.9.5):
ts-node@10.9.2(@types/node@22.10.7)(typescript@4.9.5):
dependencies:
'@cspotcode/source-map-support': 0.8.1
'@tsconfig/node10': 1.0.11
'@tsconfig/node12': 1.0.11
'@tsconfig/node14': 1.0.3
'@tsconfig/node16': 1.0.4
'@types/node': 22.10.5
'@types/node': 22.10.7
acorn: 8.14.0
acorn-walk: 8.3.4
arg: 4.1.3
@ -8463,14 +8460,14 @@ snapshots:
v8-compile-cache-lib: 3.0.1
yn: 3.1.1
ts-node@10.9.2(@types/node@22.10.5)(typescript@5.7.3):
ts-node@10.9.2(@types/node@22.10.7)(typescript@5.7.3):
dependencies:
'@cspotcode/source-map-support': 0.8.1
'@tsconfig/node10': 1.0.11
'@tsconfig/node12': 1.0.11
'@tsconfig/node14': 1.0.3
'@tsconfig/node16': 1.0.4
'@types/node': 22.10.5
'@types/node': 22.10.7
acorn: 8.14.0
acorn-walk: 8.3.4
arg: 4.1.3
@ -8548,7 +8545,7 @@ snapshots:
dependencies:
is-typedarray: 1.0.0
typeorm@0.3.20(ts-node@10.9.2(@types/node@22.10.5)(typescript@5.7.3)):
typeorm@0.3.20(ts-node@10.9.2(@types/node@22.10.7)(typescript@5.7.3)):
dependencies:
'@sqltools/formatter': 1.2.5
app-root-path: 3.1.0
@ -8566,7 +8563,7 @@ snapshots:
uuid: 9.0.1
yargs: 17.7.2
optionalDependencies:
ts-node: 10.9.2(@types/node@22.10.5)(typescript@5.7.3)
ts-node: 10.9.2(@types/node@22.10.7)(typescript@5.7.3)
transitivePeerDependencies:
- supports-color

View File

@ -10,7 +10,7 @@ export default {
// 是否自动导入模块菜单
initMenu: true,
// 判断是否初始化的方式
initJudge: 'file',
initJudge: 'db',
// crud配置
crud: {
// 软删除

View File

@ -1,5 +1,7 @@
import {
ALL,
App,
Config,
ILifeCycle,
ILogger,
IMidwayApplication,
@ -41,6 +43,9 @@ export class CoolConfiguration implements ILifeCycle {
@Inject()
coolEventManager: CoolEventManager;
@Config(ALL)
allConfig;
@Inject()
webRouterService: MidwayWebRouterService;
@ -57,7 +62,7 @@ export class CoolConfiguration implements ILifeCycle {
// 注册一个路由,用于处理静态资源
this.webRouterService.addRouter(
async ctx => {
ctx.redirect('/public/index.html');
ctx.redirect('/index.html');
},
{
url: '/',

View File

@ -162,7 +162,7 @@ export abstract class BaseMysqlService {
find.addOrderBy(order, sort.toUpperCase());
}
return {
list: await dataFind.getMany(),
list: await dataFind.getRawMany(),
pagination: {
page: parseInt(page),
size: parseInt(size),

View File

@ -191,7 +191,7 @@ export abstract class BasePgService {
find.addOrderBy(order, sort.toUpperCase());
}
return {
list: await dataFind.getMany(),
list: await dataFind.getRawMany(),
pagination: {
page: parseInt(page),
size: parseInt(size),

View File

@ -190,7 +190,7 @@ export abstract class BaseSqliteService {
find.addOrderBy(order, sort.toUpperCase());
}
return {
list: await dataFind.getMany(),
list: await dataFind.getRawMany(),
pagination: {
page: parseInt(page),
size: parseInt(size),

View File

@ -1,14 +0,0 @@
import { createLightApp } from '@midwayjs/mock';
import * as custom from '../src';
describe('/test/index.test.ts', () => {
it('test component', async () => {
const app = await createLightApp('', {
imports: [
custom
]
});
const bookService = await app.getApplicationContext().getAsync(custom.BookService);
expect(await bookService.getBookById()).toEqual('hello world');
});
});

11
task/.editorconfig Normal file
View File

@ -0,0 +1,11 @@
# 🎨 editorconfig.org
root = true
[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true

21
task/.eslintrc.json Normal file
View File

@ -0,0 +1,21 @@
{
"extends": "./node_modules/mwts/",
"ignorePatterns": ["node_modules", "dist", "test", "jest.config.js", "typings"],
"env": {
"jest": true
},
"rules": {
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/ban-ts-comment": "off",
"node/no-extraneous-import": "off",
"no-empty": "off",
"node/no-extraneous-require": "off",
"node/no-unpublished-import": "off",
"eqeqeq": "off",
"node/no-unsupported-features/node-builtins": "off",
"@typescript-eslint/ban-types": "off",
"no-control-regex": "off",
"prefer-const": "off"
}
}

4
task/.gitattributes vendored Normal file
View File

@ -0,0 +1,4 @@
*.js text eol=lf
*.json text eol=lf
*.ts text eol=lf
*.code-snippets text eol=lf

13
task/.gitignore vendored Normal file
View File

@ -0,0 +1,13 @@
logs/
npm-debug.log
yarn-error.log
node_modules/
coverage/
dist/
.idea/
run/
.DS_Store
*.sw*
*.un~
.tsbuildinfo
.tsbuildinfo.*

3
task/.prettierrc.js Normal file
View File

@ -0,0 +1,3 @@
module.exports = {
...require('mwts/.prettierrc.json')
}

10
task/index.d.ts vendored Normal file
View File

@ -0,0 +1,10 @@
export * from './dist/index';
declare module '@midwayjs/core/dist/interface' {
interface MidwayConfig {
book?: PowerPartial<{
a: number;
b: string;
}>;
}
}

7
task/jest.config.js Normal file
View File

@ -0,0 +1,7 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
testPathIgnorePatterns: ['<rootDir>/test/fixtures'],
coveragePathIgnorePatterns: ['<rootDir>/test/'],
setupFilesAfterEnv: ['./jest.setup.js']
};

1
task/jest.setup.js Normal file
View File

@ -0,0 +1 @@
jest.setTimeout(30000);

54
task/package.json Normal file
View File

@ -0,0 +1,54 @@
{
"name": "@cool-midway/task",
"version": "8.0.0",
"description": "cool-admin midway task",
"main": "dist/index.js",
"typings": "index.d.ts",
"bin": {
"cool": "dist/bin/index.js"
},
"scripts": {
"build": "mwtsc --cleanOutDir",
"test": "cross-env NODE_ENV=unittest jest",
"cov": "jest --coverage",
"lint": "mwts check",
"lint:fix": "mwts fix"
},
"keywords": [
"cool",
"cool-admin",
"cooljs"
],
"author": "COOL",
"files": [
"dist/**/*.js",
"dist/**/*.d.ts",
"index.d.ts"
],
"readme": "README.md",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://cool-js.com"
},
"devDependencies": {
"@cool-midway/core": "file:/Users/ap/Documents/src/admin/midway-packages/core",
"@midwayjs/cli": "^2.1.1",
"@midwayjs/core": "^3.20.0",
"@midwayjs/mock": "^3.20.0",
"@midwayjs/redis": "^3.20.0",
"@types/jest": "^29.5.14",
"@types/node": "^22.10.7",
"cross-env": "^7.0.3",
"mwtsc": "^1.15.1",
"jest": "^29.7.0",
"lodash": "^4.17.21",
"mwts": "^1.3.0",
"ts-jest": "^29.2.5",
"typescript": "^5.7.3"
},
"dependencies": {
"bullmq": "^5.34.10",
"ioredis": "^5.4.2"
}
}

8200
task/pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

27
task/src/README.md Normal file
View File

@ -0,0 +1,27 @@
### COOL-ADMIN
cool-admin一个很酷的后台权限管理系统开源免费模块化、插件化、极速开发CRUD方便快速构建迭代后台管理系统
大数据、微服务、AI编码快速开发
### 技术栈
- 后端node.js midway.js koa.js mysql typescript
- 前端vue.js element-plus jsx pinia vue-router
### 官网
[https://cool-js.com](https://cool-js.com)
### 演示地址
[https://show.cool-admin.com](https://show.cool-admin.com)
- 账户admin
- 密码123456
### 项目地址
[https://github.com/cool-team-official/cool-admin-midway](https://github.com/cool-team-official/cool-admin-midway)

107
task/src/base.ts Normal file
View File

@ -0,0 +1,107 @@
import { Job, JobsOptions, Queue, QueueGetters, Worker } from 'bullmq';
/**
*
*/
export abstract class BaseCoolQueue {
/**
* @deprecated
*/
queue: BaseCoolQueue;
// 获得者
getters: QueueGetters;
// 消费者
worker: Worker;
// 队列名
queueName: string;
// 原始队列
metaQueue: Queue;
constructor() {
this.queue = this;
}
// 数据
async data(job: Job, done: Function) {}
/**
*
* @param data
* @param opts
*/
async add(data: any, opts?: JobsOptions): Promise<Job<any, any, string>> {
return this.metaQueue.add(this.queueName, data, opts);
}
/**
*
* @param datas
* @param opts
*/
async addBulk(
datas: any[],
opts?: JobsOptions
): Promise<Job<any, any, string>[]> {
return this.metaQueue.addBulk(
datas.map(data => {
return {
name: this.queueName,
data,
opts,
};
})
);
}
defaultJobOptions(): JobsOptions {
return this.metaQueue.defaultJobOptions;
}
async repeat() {
return this.metaQueue.repeat;
}
async pause() {
this.metaQueue.pause();
}
async resume() {
this.metaQueue.resume();
}
async isPaused() {
return this.metaQueue.isPaused();
}
async getJobSchedulers(start?: number, end?: number, asc?: boolean) {
return this.metaQueue.getJobSchedulers(start, end, asc);
}
async removeJobScheduler(jobId: string) {
this.metaQueue.removeJobScheduler(jobId);
}
async remove(jobId: string) {
return this.metaQueue.remove(jobId);
}
async drain(delayed?: boolean) {
this.metaQueue.drain(delayed);
}
async clean(
grace: number,
limit: number,
type?: 'completed' | 'wait' | 'active' | 'paused' | 'delayed' | 'failed'
) {
return this.metaQueue.clean(grace, limit, type);
}
async obliterate(opts?: { force?: boolean; count?: number }) {
this.metaQueue.obliterate(opts);
}
async trimEvents(maxLength: number) {
return this.metaQueue.trimEvents(maxLength);
}
}

View File

@ -0,0 +1,6 @@
/**
* cool的配置
*/
export default {
cool: {},
};

19
task/src/configuration.ts Normal file
View File

@ -0,0 +1,19 @@
import { Configuration } from '@midwayjs/core';
import * as DefaultConfig from './config/config.default';
import { IMidwayContainer } from '@midwayjs/core';
import { CoolQueueHandle } from './queue';
@Configuration({
namespace: 'cool:task',
importConfigs: [
{
default: DefaultConfig,
},
],
})
export class CoolTaskConfiguration {
async onReady(container: IMidwayContainer) {
await container.getAsync(CoolQueueHandle);
// TODO something
}
}

View File

@ -0,0 +1,26 @@
import {
Scope,
ScopeEnum,
saveClassMetadata,
saveModule,
} from '@midwayjs/core';
import { JobsOptions } from 'bullmq';
export const COOL_TASK_KEY = 'decorator:cool:task';
export function CoolQueue(
config = { type: 'comm', queue: {}, worker: {} } as {
type?: 'comm' | 'getter' | 'noworker' | 'single';
queue?: JobsOptions;
worker?: WorkerOptions;
}
): ClassDecorator {
return (target: any) => {
// 将装饰的类,绑定到该装饰器,用于后续能获取到 class
saveModule(COOL_TASK_KEY, target);
// 保存一些元数据信息,任意你希望存的东西
saveClassMetadata(COOL_TASK_KEY, config, target);
// 指定 IoC 容器创建实例的作用域,这里注册为请求作用域,这样能取到 ctx
Scope(ScopeEnum.Singleton)(target);
};
}

7
task/src/index.ts Normal file
View File

@ -0,0 +1,7 @@
export { CoolTaskConfiguration as Configuration } from './configuration';
export * from './base';
export * from './queue';
export * from './decorator/queue';

142
task/src/queue.ts Normal file
View File

@ -0,0 +1,142 @@
import { ILogger, IMidwayApplication } from '@midwayjs/core';
import {
App,
Config,
getClassMetadata,
Init,
listModule,
Logger,
Provide,
Scope,
ScopeEnum,
} from '@midwayjs/core';
import { Job, QueueGetters, Queue, Worker } from 'bullmq';
import { BaseCoolQueue } from './base';
import { COOL_TASK_KEY } from './decorator/queue';
import Redis from 'ioredis';
/**
*
*/
@Provide()
@Scope(ScopeEnum.Singleton)
export class CoolQueueHandle {
@Config('cool.redis')
redisConfig;
@Logger()
coreLogger: ILogger;
@App()
app: IMidwayApplication;
redis;
@Init()
async init() {
if (!this.redisConfig) {
this.coreLogger.error('@cool-midway/task组件 redis未配置');
}
await this.scan();
}
/**
*
*/
async scan() {
const modules = listModule(COOL_TASK_KEY);
for (let mod of modules) {
const cls: BaseCoolQueue = await this.app
.getApplicationContext()
.getAsync(mod);
this.createQueue(cls, mod);
}
}
/**
*
* @param key
* @param expireTime
* @returns
*/
async getLock(key, expireTime) {
const lockSuccessful = await this.redis.setnx(key, 'locked');
if (lockSuccessful) {
await this.redis.expire(key, expireTime);
return true;
} else {
return false;
}
}
/**
*
* @param cls
* @param mod
*/
async createQueue(cls: BaseCoolQueue, mod: any) {
this.redis;
if (this.redisConfig instanceof Array) {
this.redis = new Redis.Cluster(this.redisConfig, {
enableReadyCheck: false,
});
} else {
this.redis = new Redis({
...this.redisConfig,
enableReadyCheck: false,
maxRetriesPerRequest: null,
});
}
const name = mod.name;
const config = getClassMetadata(COOL_TASK_KEY, mod);
const opts = {
connection: this.redis,
prefix: `{queue${name}}`,
defaultJobOptions: {
removeOnComplete: true,
removeOnFail: true,
attempts: 5,
backoff: {
type: 'fixed',
delay: 10000,
},
...(config.queue || {}),
},
};
const queue = new Queue(name, opts);
cls.metaQueue = queue;
cls.queueName = name;
let lock = false;
// 本地开发的情况下直接获得锁
if (config.type == 'single') {
if (this.app.getEnv() == 'local') {
lock = true;
} else {
// cluster 需要配合redis 获得锁
if (await this.getLock('COOL_QUEUE_SINGLE', 15)) {
lock = true;
}
}
}
if (config.type == 'comm' || (config.type == 'single' && lock)) {
cls.worker = new Worker(
name,
async (job: Job) => {
await cls.data(job, async () => {
await job.isCompleted();
});
},
{
connection: opts.connection,
prefix: opts.prefix,
...(config.worker || {}),
}
);
} else {
cls.getters = new QueueGetters(name, opts);
}
this.coreLogger.info(`\x1B[36m [cool:task] create ${name} queue \x1B[0m`);
}
}

28
task/tsconfig.json Normal file
View File

@ -0,0 +1,28 @@
{
"compileOnSave": true,
"compilerOptions": {
"target": "es2018",
"module": "commonjs",
"moduleResolution": "node",
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"inlineSourceMap":false,
"noImplicitThis": true,
"noUnusedLocals": true,
"stripInternal": true,
"skipLibCheck": true,
"noImplicitReturns": false,
"pretty": true,
"declaration": true,
"forceConsistentCasingInFileNames": true,
"outDir": "dist",
"rootDir": "src"
},
"exclude": [
"*.js",
"*.ts",
"dist",
"node_modules",
"test"
]
}