From a8f80abc88ada69146dd34bf436c40395c68751b Mon Sep 17 00:00:00 2001 From: xion Date: Fri, 20 Sep 2024 22:04:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 23 +- .../@abearxiong__router@0.0.1-alpha.28.patch | 41 ++ pnpm-lock.yaml | 529 ++++++++++++++++-- src/modules/index.ts | 2 + src/modules/minio.ts | 14 + src/routes/container/list.ts | 52 +- src/routes/container/models/index.ts | 25 +- src/routes/index.ts | 4 +- src/routes/page/list.ts | 2 +- src/routes/resource/index.ts | 2 + src/routes/resource/lib/index.ts | 1 + src/routes/resource/lib/publish-minio.ts | 35 ++ src/routes/resource/list.ts | 72 +++ src/routes/resource/models/index.ts | 87 +++ src/routes/resource/publish.ts | 69 +++ 15 files changed, 892 insertions(+), 66 deletions(-) create mode 100644 patches/@abearxiong__router@0.0.1-alpha.28.patch create mode 100644 src/modules/minio.ts create mode 100644 src/routes/resource/index.ts create mode 100644 src/routes/resource/lib/index.ts create mode 100644 src/routes/resource/lib/publish-minio.ts create mode 100644 src/routes/resource/list.ts create mode 100644 src/routes/resource/models/index.ts create mode 100644 src/routes/resource/publish.ts diff --git a/package.json b/package.json index 5476b3d..5745c61 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,8 @@ "docker:run": "docker run -it --name code-flow -p 4000:4000 docker.xiongxiao.me/code-flow:v0.0.2", "docker:build:gitea": "docker build -t git.xiongxiao.me/abearxiong/code-flow:v0.0.2 .", "docker:push:gitea": "docker push git.xiongxiao.me/abearxiong/code-flow:v0.0.2", - "dts": "./node_modules/.bin/dts-bundle-generator -o types/index.d.ts src/type.ts" + "dts": "./node_modules/.bin/dts-bundle-generator -o types/index.d.ts src/type.ts", + "postinstall": "patch-package" }, "keywords": [], "types": "types/index.d.ts", @@ -30,18 +31,21 @@ ], "license": "ISC", "dependencies": { - "@abearxiong/router": "0.0.1-alpha.27", - "@abearxiong/use-config": "^0.0.1", + "@abearxiong/router": "0.0.1-alpha.28", + "@abearxiong/use-config": "^0.0.2", "@babel/core": "^7.25.2", "@babel/preset-env": "^7.25.4", "@babel/preset-typescript": "^7.24.7", + "@types/semver": "^7.5.8", "dayjs": "^1.11.13", "dts-bundle-generator": "^9.5.1", "json5": "^2.2.3", "jsonwebtoken": "^9.0.2", "lodash-es": "^4.17.21", + "minio": "^8.0.1", "nanoid": "^5.0.7", - "pg": "^8.12.0", + "pg": "^8.13.0", + "semver": "^7.6.3", "sequelize": "^6.37.3", "socket.io": "^4.7.5", "strip-ansi": "^7.1.0", @@ -51,7 +55,7 @@ "devDependencies": { "@types/crypto-js": "^4.2.2", "@types/jest": "^29.5.13", - "@types/jsonwebtoken": "^9.0.6", + "@types/jsonwebtoken": "^9.0.7", "@types/lodash-es": "^4.17.12", "@types/node": "^22.5.5", "@types/superagent": "^8.1.9", @@ -62,7 +66,9 @@ "cross-env": "^7.0.3", "fork-ts-checker-webpack-plugin": "^9.0.2", "jest": "^29.7.0", - "nodemon": "^3.1.4", + "nodemon": "^3.1.6", + "patch-package": "^8.0.0", + "postinstall-postinstall": "^2.1.0", "supertest": "^7.0.0", "ts-jest": "^29.2.5", "ts-loader": "^9.5.1", @@ -71,5 +77,10 @@ "webpack": "^5.94.0", "webpack-cli": "^5.1.4", "webpack-node-externals": "^3.0.0" + }, + "pnpm": { + "patchedDependencies": { + "@abearxiong/router@0.0.1-alpha.28": "patches/@abearxiong__router@0.0.1-alpha.28.patch" + } } } \ No newline at end of file diff --git a/patches/@abearxiong__router@0.0.1-alpha.28.patch b/patches/@abearxiong__router@0.0.1-alpha.28.patch new file mode 100644 index 0000000..276a941 --- /dev/null +++ b/patches/@abearxiong__router@0.0.1-alpha.28.patch @@ -0,0 +1,41 @@ +diff --git a/dist/route.d.ts b/dist/route.d.ts +index 28ae5103aea403c9bf71f7fc897d3d0aecd17c70..f900e21871df3586f05105504228695e31725256 100644 +--- a/dist/route.d.ts ++++ b/dist/route.d.ts +@@ -1,4 +1,5 @@ + import { Schema, Rule } from './validator/index.ts'; ++export type RouterContextT = { code?:number, [key: string]: any}; + export type RouteContext = { +@@ -22,7 +23,7 @@ export type RouteContext = (ctx?: RouteContext) => Promise; ++export type Run = (ctx?: RouteContext) => Promise | null | void>; + export type NextRoute = Pick; + export type RouteOpts = { + path?: string; +@@ -43,7 +44,7 @@ export type RouteOpts = { + verifyKey?: (key: string, ctx?: RouteContext, dev?: boolean) => boolean; + idUsePath?: boolean; + }; +-export type DefineRouteOpts = Omit; ++export type DefineRouteOpts = Omit; + declare const pickValue: readonly ["path", "key", "id", "description", "type", "validator", "middleware"]; + export type RouteInfo = Pick; + export declare class Route { +@@ -109,9 +110,9 @@ export declare class Route { + error?: undefined; + }; + define(opts: DefineRouteOpts): this; +- define(fn: Run): this; +- define(key: string, fn: Run): this; +- define(path: string, key: string, fn: Run): this; ++ define(fn: Run): this; ++ define(key: string, fn: Run): this; ++ define(path: string, key: string, fn: Run): this; + addTo(router: QueryRouter | { + add: (route: Route) => void; + [key: string]: any; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 34b1f6b..7583c91 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,16 +4,21 @@ settings: autoInstallPeers: true excludeLinksFromLockfile: false +patchedDependencies: + '@abearxiong/router@0.0.1-alpha.28': + hash: 5da5h3tdxupyye4tbx43bkkmem + path: patches/@abearxiong__router@0.0.1-alpha.28.patch + importers: .: dependencies: '@abearxiong/router': - specifier: 0.0.1-alpha.27 - version: 0.0.1-alpha.27 + specifier: 0.0.1-alpha.28 + version: 0.0.1-alpha.28(patch_hash=5da5h3tdxupyye4tbx43bkkmem) '@abearxiong/use-config': - specifier: ^0.0.1 - version: 0.0.1(typescript@5.6.2)(webpack-cli@5.1.4(webpack@5.94.0)) + specifier: ^0.0.2 + version: 0.0.2 '@babel/core': specifier: ^7.25.2 version: 7.25.2 @@ -23,6 +28,9 @@ importers: '@babel/preset-typescript': specifier: ^7.24.7 version: 7.24.7(@babel/core@7.25.2) + '@types/semver': + specifier: ^7.5.8 + version: 7.5.8 dayjs: specifier: ^1.11.13 version: 1.11.13 @@ -38,15 +46,21 @@ importers: lodash-es: specifier: ^4.17.21 version: 4.17.21 + minio: + specifier: ^8.0.1 + version: 8.0.1 nanoid: specifier: ^5.0.7 version: 5.0.7 pg: - specifier: ^8.12.0 - version: 8.12.0 + specifier: ^8.13.0 + version: 8.13.0 + semver: + specifier: ^7.6.3 + version: 7.6.3 sequelize: specifier: ^6.37.3 - version: 6.37.3(pg@8.12.0) + version: 6.37.3(pg@8.13.0) socket.io: specifier: ^4.7.5 version: 4.7.5 @@ -67,8 +81,8 @@ importers: specifier: ^29.5.13 version: 29.5.13 '@types/jsonwebtoken': - specifier: ^9.0.6 - version: 9.0.6 + specifier: ^9.0.7 + version: 9.0.7 '@types/lodash-es': specifier: ^4.17.12 version: 4.17.12 @@ -100,8 +114,14 @@ importers: specifier: ^29.7.0 version: 29.7.0(@types/node@22.5.5)(ts-node@10.9.2(@types/node@22.5.5)(typescript@5.6.2)) nodemon: - specifier: ^3.1.4 - version: 3.1.4 + specifier: ^3.1.6 + version: 3.1.6 + patch-package: + specifier: ^8.0.0 + version: 8.0.0 + postinstall-postinstall: + specifier: ^2.1.0 + version: 2.1.0 supertest: specifier: ^7.0.0 version: 7.0.0 @@ -129,11 +149,11 @@ importers: packages: - '@abearxiong/router@0.0.1-alpha.27': - resolution: {integrity: sha512-jyl4YzO0g/s43SiS6D0htqBBvRvkNlgtesciHPbBiQHcycyaRMPthpI/q/IX7CNvrfqRSVK8GonM1ZiIDYkjqg==, tarball: https://npm.pkg.github.com/download/@abearxiong/router/0.0.1-alpha.27/41d6b46cace8f82d8e6bdf507aa6ee26dc6737ec} + '@abearxiong/router@0.0.1-alpha.28': + resolution: {integrity: sha512-WOSonpdaadxdyIhCExGSfb012npyRCuuHU7NuiPCzbwLqooUipJxEtGrMLNa0SyIlVjx7CdZpdaW0GCeKEloKA==, tarball: https://npm.pkg.github.com/download/@abearxiong/router/0.0.1-alpha.28/305eca3912cb26298f205410f562695f99086463} - '@abearxiong/use-config@0.0.1': - resolution: {integrity: sha512-rGPuc+nh4y4UdAnifDtxvdTys3OIJ0u2sjsj4hod+xuSJXOCe8dwRabNKH7M62806JMIerD617mG7rW9YFMZFw==, tarball: https://npm.pkg.github.com/download/@abearxiong/use-config/0.0.1/0b6f4e7bfd208938c9a0ef8f6830d4f10a455f39} + '@abearxiong/use-config@0.0.2': + resolution: {integrity: sha512-IBOmeP46ykbDlkplFS65UsAHjyPDKnvS2oqbkpLWhbSwDbF5zhBnD4ibsFZKPCyc3lMlPeRqYva4x6puX3E/qQ==, tarball: https://npm.pkg.github.com/download/@abearxiong/use-config/0.0.2/59fbeec8c8e086ec48e55024fe39020b079e6fa5} '@ampproject/remapping@2.3.0': resolution: {integrity: sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==} @@ -937,8 +957,8 @@ packages: '@types/json-schema@7.0.15': resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} - '@types/jsonwebtoken@9.0.6': - resolution: {integrity: sha512-/5hndP5dCjloafCXns6SZyESp3Ldq7YjH3zwzwczYnjxIT0Fqzk5ROSYVGfFyczIue7IUEj8hkvLbPoLQ18vQw==} + '@types/jsonwebtoken@9.0.7': + resolution: {integrity: sha512-ugo316mmTYBl2g81zDFnZ7cfxlut3o+/EQdaP7J8QN2kY6lJ22hmQYCK5EHcJHbrW+dkCGSCPgbG8JtYj6qSrg==} '@types/lodash-es@4.17.12': resolution: {integrity: sha512-0NgftHUcV4v34VhXm8QBSftKVXtbkBG3ViCjs6+eJ5a6y6Mi/jiFGPc1sC7QK+9BFhWrURE3EOggmWaSxL9OzQ==} @@ -955,6 +975,9 @@ packages: '@types/node@22.5.5': resolution: {integrity: sha512-Xjs4y5UPO/CLdzpgR6GirZJx36yScjh73+2NlLlkFRSoQN8B0DpfXPdZGnvVmLRLOsqDpOfTNv7D9trgGhmOIA==} + '@types/semver@7.5.8': + resolution: {integrity: sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==} + '@types/stack-utils@2.0.3': resolution: {integrity: sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==} @@ -1052,6 +1075,12 @@ packages: '@xtuc/long@4.2.2': resolution: {integrity: sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==} + '@yarnpkg/lockfile@1.1.0': + resolution: {integrity: sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ==} + + '@zxing/text-encoding@0.9.0': + resolution: {integrity: sha512-U/4aVJ2mxI0aDNI8Uq0wEhMgY+u4CNtEb0om3+y3+niDAsoTCOB33UF0sxpzqzdqXLqmvc+vZyAt4O8pPdfkwA==} + accepts@1.3.8: resolution: {integrity: sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==} engines: {node: '>= 0.6'} @@ -1140,6 +1169,14 @@ packages: asynckit@0.4.0: resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} + at-least-node@1.0.0: + resolution: {integrity: sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==} + engines: {node: '>= 4.0.0'} + + available-typed-arrays@1.0.7: + resolution: {integrity: sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==} + engines: {node: '>= 0.4'} + babel-jest@29.7.0: resolution: {integrity: sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -1191,6 +1228,9 @@ packages: resolution: {integrity: sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==} engines: {node: '>=8'} + block-stream2@2.1.0: + resolution: {integrity: sha512-suhjmLI57Ewpmq00qaygS8UgEq2ly2PCItenIyhMqVjo4t4pGzqMvfgJuX8iWTeSDdfSSqS6j38fL4ToNL7Pfg==} + brace-expansion@1.1.11: resolution: {integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==} @@ -1201,6 +1241,9 @@ packages: resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} engines: {node: '>=8'} + browser-or-node@2.1.1: + resolution: {integrity: sha512-8CVjaLJGuSKMVTxJ2DpBl5XnlNDiT4cQFeuCJJrvJmts9YrTZDizTX7PjC2s6W4x+MBGZeEY6dGMrF04/6Hgqg==} + browserslist@4.23.3: resolution: {integrity: sha512-btwCFJVjI4YWDNfau8RhZ+B1Q/VLoUITrm3RlP6y1tYGWIOa+InuYiRGXUBXo8nA1qKmHMyLB/iVQg5TT4eFoA==} engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} @@ -1213,6 +1256,10 @@ packages: bser@2.1.1: resolution: {integrity: sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==} + buffer-crc32@1.0.0: + resolution: {integrity: sha512-Db1SbgBS/fg/392AblrMJk97KggmvYhr4pB5ZIMTWtaivCPMWLkmb7m21cJvpvgK+J3nsU2CmmixNBZx4vFj/w==} + engines: {node: '>=8.0.0'} + buffer-equal-constant-time@1.0.1: resolution: {integrity: sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==} @@ -1379,6 +1426,10 @@ packages: supports-color: optional: true + decode-uri-component@0.2.2: + resolution: {integrity: sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==} + engines: {node: '>=0.10'} + dedent@1.5.3: resolution: {integrity: sha512-NHQtfOOW68WD8lgypbLA5oT+Bt0xXJhiYvoR6SmmNXZfpzOGXwdKWmcwG8N7PwVVWV3eF/68nmD9BaJSsTBhyQ==} peerDependencies: @@ -1508,6 +1559,9 @@ packages: resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} engines: {node: '>=0.10.0'} + eventemitter3@5.0.1: + resolution: {integrity: sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==} + events@3.3.0: resolution: {integrity: sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==} engines: {node: '>=0.8.x'} @@ -1540,6 +1594,10 @@ packages: fast-uri@3.0.1: resolution: {integrity: sha512-MWipKbbYiYI0UC7cl8m/i/IWTqfC8YXsqjzybjddLsFjStroQzsHXkc73JutMvBiXmOvapk+axIl79ig5t55Bw==} + fast-xml-parser@4.5.0: + resolution: {integrity: sha512-/PlTQCI96+fZMAOLMZK4CWG1ItCbfZ/0jx7UIJFChPNrx7tcEgerUgWbeieCM9MfHInUDyK8DWYZ+YrywDJuTg==} + hasBin: true + fastest-levenshtein@1.0.16: resolution: {integrity: sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==} engines: {node: '>= 4.9.1'} @@ -1557,14 +1615,24 @@ packages: resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} engines: {node: '>=8'} + filter-obj@1.1.0: + resolution: {integrity: sha512-8rXg1ZnX7xzy2NGDVkBVaAy+lSlPNwad13BtgSlLuxfIslyt5Vg64U7tFcCt4WS1R0hvtnQybT/IyCkGZ3DpXQ==} + engines: {node: '>=0.10.0'} + find-up@4.1.0: resolution: {integrity: sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==} engines: {node: '>=8'} + find-yarn-workspace-root@2.0.0: + resolution: {integrity: sha512-1IMnbjt4KzsQfnhnzNd8wUEgXZ44IzZaZmnLYx7D5FZlaHt2gW20Cri8Q+E/t5tIj4+epTBub+2Zxu/vNILzqQ==} + flat@5.0.2: resolution: {integrity: sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==} hasBin: true + for-each@0.3.3: + resolution: {integrity: sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==} + fork-ts-checker-webpack-plugin@9.0.2: resolution: {integrity: sha512-Uochze2R8peoN1XqlSi/rGUkDQpRogtLFocP9+PGu68zk1BDAKXfdeCdyVZpgTk8V8WFVQXdEz426VKjXLO1Gg==} engines: {node: '>=12.13.0', yarn: '>=1.0.0'} @@ -1583,6 +1651,10 @@ packages: resolution: {integrity: sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==} engines: {node: '>=12'} + fs-extra@9.1.0: + resolution: {integrity: sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==} + engines: {node: '>=10'} + fs-monkey@1.0.6: resolution: {integrity: sha512-b1FMfwetIKymC0eioW7mTywihSQE4oLzQn1dB6rZB5fx/3NpNEdAWeCSMB+60/AeT0TCXsxzAlcYVEFCTAksWg==} @@ -1665,6 +1737,10 @@ packages: resolution: {integrity: sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==} engines: {node: '>= 0.4'} + has-tostringtag@1.0.2: + resolution: {integrity: sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==} + engines: {node: '>= 0.4'} + hasown@2.0.2: resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==} engines: {node: '>= 0.4'} @@ -1715,6 +1791,14 @@ packages: resolution: {integrity: sha512-6xwYfHbajpoF0xLW+iwLkhwgvLoZDfjYfoFNu8ftMoXINzwuymNLd9u/KmwtdT2GbR+/Cz66otEGEVVUHX9QLQ==} engines: {node: '>=10.13.0'} + ipaddr.js@2.2.0: + resolution: {integrity: sha512-Ag3wB2o37wslZS19hZqorUnrnzSkpOVy+IiiDEiTqNubEYpYuHWIf6K4psgN2ZWKExS4xhVCrRVfb/wfW8fWJA==} + engines: {node: '>= 10'} + + is-arguments@1.1.1: + resolution: {integrity: sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==} + engines: {node: '>= 0.4'} + is-arrayish@0.2.1: resolution: {integrity: sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==} @@ -1722,10 +1806,19 @@ packages: resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==} engines: {node: '>=8'} + is-callable@1.2.7: + resolution: {integrity: sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==} + engines: {node: '>= 0.4'} + is-core-module@2.15.1: resolution: {integrity: sha512-z0vtXSwucUJtANQWldhbtbt7BnL0vxiFjIdDLAatwhDYty2bad6s+rijD6Ri4YuYJubLzIJLUidCh09e1djEVQ==} engines: {node: '>= 0.4'} + is-docker@2.2.1: + resolution: {integrity: sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==} + engines: {node: '>=8'} + hasBin: true + is-extglob@2.1.1: resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} engines: {node: '>=0.10.0'} @@ -1738,6 +1831,10 @@ packages: resolution: {integrity: sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==} engines: {node: '>=6'} + is-generator-function@1.0.10: + resolution: {integrity: sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==} + engines: {node: '>= 0.4'} + is-glob@4.0.3: resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} engines: {node: '>=0.10.0'} @@ -1754,6 +1851,17 @@ packages: resolution: {integrity: sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==} engines: {node: '>=8'} + is-typed-array@1.1.13: + resolution: {integrity: sha512-uZ25/bUAlUY5fR4OKT4rZQEBrzQWYV9ZJYGGsUmEJ6thodVJ1HX64ePQ6Z0qPWP+m+Uq6e9UugrE38jeYsDSMw==} + engines: {node: '>= 0.4'} + + is-wsl@2.2.0: + resolution: {integrity: sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==} + engines: {node: '>=8'} + + isarray@2.0.5: + resolution: {integrity: sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==} + isexe@2.0.0: resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} @@ -1952,6 +2060,10 @@ packages: json-schema-traverse@1.0.0: resolution: {integrity: sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==} + json-stable-stringify@1.1.1: + resolution: {integrity: sha512-SU/971Kt5qVQfJpyDveVhQ/vya+5hvrjClFOcr8c0Fq5aODJjMwutrOfCU+eCnVD5gpx1Q3fEqkyom77zH1iIg==} + engines: {node: '>= 0.4'} + json5@2.2.3: resolution: {integrity: sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==} engines: {node: '>=6'} @@ -1960,6 +2072,9 @@ packages: jsonfile@6.1.0: resolution: {integrity: sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==} + jsonify@0.0.1: + resolution: {integrity: sha512-2/Ki0GcmuqSrgFyelQq9M05y7PS0mEwuIzrf3f1fPqkVDVRvZrPZtVSMHxdgo8Aq0sxAOb/cr2aqqA3LeWHVPg==} + jsonwebtoken@9.0.2: resolution: {integrity: sha512-PRp66vJ865SSqOlgqS8hujT5U4AOgMfhrwYIuIhfKaoSCZcirrmASQr8CX7cUg+RMih+hgznrjp99o+W4pJLHQ==} engines: {node: '>=12', npm: '>=6'} @@ -1974,6 +2089,9 @@ packages: resolution: {integrity: sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==} engines: {node: '>=0.10.0'} + klaw-sync@6.0.0: + resolution: {integrity: sha512-nIeuVSzdCCs6TDPTqI8w1Yre34sSq7AkZ4B3sfOBbI2CgVSB4Du4aLQijFU2+lhAFCwt9+42Hel6lQNIv6AntQ==} + kleur@3.0.3: resolution: {integrity: sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==} engines: {node: '>=6'} @@ -2082,6 +2200,13 @@ packages: resolution: {integrity: sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==} engines: {node: '>=10'} + minimist@1.2.8: + resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} + + minio@8.0.1: + resolution: {integrity: sha512-FzDO6yGnqLtm8sp3mXafWtiRUOslJSSg/aI0v9YbN5vjw5KLoODKAROCyi766NIvTSxcfHBrbhCSGk1A+MOzDg==} + engines: {node: ^16 || ^18 || >=20} + moment-timezone@0.5.45: resolution: {integrity: sha512-HIWmqA86KcmCAhnMAN0wuDOARV/525R2+lOLotuGFzn4HO+FH+/645z2wx0Dt3iDv6/p61SIvKnDstISainhLQ==} @@ -2115,8 +2240,8 @@ packages: node-releases@2.0.18: resolution: {integrity: sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g==} - nodemon@3.1.4: - resolution: {integrity: sha512-wjPBbFhtpJwmIeY2yP7QF+UKzPfltVGtfce1g/bB15/8vCGZj8uxD62b/b9M9/WVgme0NZudpownKN+c0plXlQ==} + nodemon@3.1.6: + resolution: {integrity: sha512-C8ymJbXpTTinxjWuMfMxw0rZhTn/r7ypSGldQyqPEgDEaVwAthqC0aodsMwontnAInN9TuPwRLeBoyhmfv+iSA==} engines: {node: '>=10'} hasBin: true @@ -2136,6 +2261,10 @@ packages: resolution: {integrity: sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g==} engines: {node: '>= 0.4'} + object-keys@1.1.1: + resolution: {integrity: sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==} + engines: {node: '>= 0.4'} + once@1.4.0: resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} @@ -2143,6 +2272,14 @@ packages: resolution: {integrity: sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==} engines: {node: '>=6'} + open@7.4.2: + resolution: {integrity: sha512-MVHddDVweXZF3awtlAS+6pgKLlm/JgxZ90+/NBurBoQctVOOB/zDdVjcyPzQ+0laDGbsWgrRkflI65sQeOgT9Q==} + engines: {node: '>=8'} + + os-tmpdir@1.0.2: + resolution: {integrity: sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==} + engines: {node: '>=0.10.0'} + p-limit@2.3.0: resolution: {integrity: sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==} engines: {node: '>=6'} @@ -2167,6 +2304,11 @@ packages: resolution: {integrity: sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==} engines: {node: '>=8'} + patch-package@8.0.0: + resolution: {integrity: sha512-da8BVIhzjtgScwDJ2TtKsfT5JFWz1hYoBl9rUQ1f38MC2HwnEIkK8VN3dKMKcP7P7bvvgzNDbfNHtx3MsQb5vA==} + engines: {node: '>=14', npm: '>5'} + hasBin: true + path-exists@4.0.0: resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} engines: {node: '>=8'} @@ -2196,24 +2338,27 @@ packages: pg-connection-string@2.6.4: resolution: {integrity: sha512-v+Z7W/0EO707aNMaAEfiGnGL9sxxumwLl2fJvCQtMn9Fxsg+lPpPkdcyBSv/KFgpGdYkMfn+EI1Or2EHjpgLCA==} + pg-connection-string@2.7.0: + resolution: {integrity: sha512-PI2W9mv53rXJQEOb8xNR8lH7Hr+EKa6oJa38zsK0S/ky2er16ios1wLKhZyxzD7jUReiWokc9WK5nxSnC7W1TA==} + pg-int8@1.0.1: resolution: {integrity: sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==} engines: {node: '>=4.0.0'} - pg-pool@3.6.2: - resolution: {integrity: sha512-Htjbg8BlwXqSBQ9V8Vjtc+vzf/6fVUuak/3/XXKA9oxZprwW3IMDQTGHP+KDmVL7rtd+R1QjbnCFPuTHm3G4hg==} + pg-pool@3.7.0: + resolution: {integrity: sha512-ZOBQForurqh4zZWjrgSwwAtzJ7QiRX0ovFkZr2klsen3Nm0aoh33Ls0fzfv3imeH/nw/O27cjdz5kzYJfeGp/g==} peerDependencies: pg: '>=8.0' - pg-protocol@1.6.1: - resolution: {integrity: sha512-jPIlvgoD63hrEuihvIg+tJhoGjUsLPn6poJY9N5CnlPd91c2T18T/9zBtLxZSb1EhYxBRoZJtzScCaWlYLtktg==} + pg-protocol@1.7.0: + resolution: {integrity: sha512-hTK/mE36i8fDDhgDFjy6xNOG+LCorxLG3WO17tku+ij6sVHXh1jQUJ8hYAnRhNla4QVD2H8er/FOjc/+EgC6yQ==} pg-types@2.2.0: resolution: {integrity: sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==} engines: {node: '>=4'} - pg@8.12.0: - resolution: {integrity: sha512-A+LHUSnwnxrnL/tZ+OLfqR1SxLN3c/pgDztZ47Rpbsd4jUytsTtwQo/TLPRzPJMp/1pbhYVhH9cuSZLAajNfjQ==} + pg@8.13.0: + resolution: {integrity: sha512-34wkUTh3SxTClfoHB3pQ7bIMvw9dpFU1audQQeZG837fmHfHpr14n/AELVDoOYVDW2h5RDWU78tFjkD+erSBsw==} engines: {node: '>= 8.0.0'} peerDependencies: pg-native: '>=3.0.1' @@ -2239,6 +2384,10 @@ packages: resolution: {integrity: sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==} engines: {node: '>=8'} + possible-typed-array-names@1.0.0: + resolution: {integrity: sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q==} + engines: {node: '>= 0.4'} + postgres-array@2.0.0: resolution: {integrity: sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==} engines: {node: '>=4'} @@ -2255,6 +2404,9 @@ packages: resolution: {integrity: sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==} engines: {node: '>=0.10.0'} + postinstall-postinstall@2.1.0: + resolution: {integrity: sha512-7hQX6ZlZXIoRiWNrbMQaLzUUfH+sSx39u8EJ9HYuDc1kLo9IXKWjM5RSquZN1ad5GnH8CGFM78fsAAQi3OKEEQ==} + pretty-format@29.7.0: resolution: {integrity: sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -2277,6 +2429,10 @@ packages: resolution: {integrity: sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==} engines: {node: '>=0.6'} + query-string@7.1.3: + resolution: {integrity: sha512-hh2WYhq4fi8+b+/2Kg9CEge4fDPvHS534aOOvOZeQ3+Vf2mCFsaFBYj0i+iXcAq6I9Vzp5fjMFBlONvayDC1qg==} + engines: {node: '>=6'} + queue-microtask@1.2.3: resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} @@ -2286,6 +2442,10 @@ packages: react-is@18.3.1: resolution: {integrity: sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==} + readable-stream@3.6.2: + resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==} + engines: {node: '>= 6'} + readdirp@3.6.0: resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} engines: {node: '>=8.10.0'} @@ -2350,6 +2510,11 @@ packages: resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==} engines: {iojs: '>=1.0.0', node: '>=0.10.0'} + rimraf@2.7.1: + resolution: {integrity: sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==} + deprecated: Rimraf versions prior to v4 are no longer supported + hasBin: true + run-parallel@1.2.0: resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} @@ -2359,6 +2524,9 @@ packages: safe-buffer@5.2.1: resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} + sax@1.4.1: + resolution: {integrity: sha512-+aWOz7yVScEGoKNd4PA10LZ8sk0A/z5+nXQG5giUO5rprX9jgYsTdov9qCchZiPIZezbZH+jRut8nPodFAX4Jg==} + schema-utils@3.3.0: resolution: {integrity: sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==} engines: {node: '>= 10.13.0'} @@ -2449,6 +2617,10 @@ packages: sisteransi@1.0.5: resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==} + slash@2.0.0: + resolution: {integrity: sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==} + engines: {node: '>=6'} + slash@3.0.0: resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} engines: {node: '>=8'} @@ -2482,6 +2654,10 @@ packages: resolution: {integrity: sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==} engines: {node: '>= 8'} + split-on-first@1.1.0: + resolution: {integrity: sha512-43ZssAJaMusuKWL8sKUBQXHWOpq8d6CfN/u1p4gUzfJkM05C8rxTmYrkIPTXapZpORA6LkkzcUulJ8FqA7Uudw==} + engines: {node: '>=6'} + split2@4.2.0: resolution: {integrity: sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==} engines: {node: '>= 10.x'} @@ -2493,6 +2669,16 @@ packages: resolution: {integrity: sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==} engines: {node: '>=10'} + stream-chain@2.2.5: + resolution: {integrity: sha512-1TJmBx6aSWqZ4tx7aTpBDXK0/e2hhcNSTV8+CbFJtDjbb+I1mZ8lHit0Grw9GRT+6JbIrrDd8esncgBi8aBXGA==} + + stream-json@1.8.0: + resolution: {integrity: sha512-HZfXngYHUAr1exT4fxlbc1IOce1RYxp2ldeaf97LYCOPSoOqY/1Psp7iGvpb+6JIOgkra9zDYnPX01hGAHzEPw==} + + strict-uri-encode@2.0.0: + resolution: {integrity: sha512-QwiXZgpRcKkhTj2Scnn++4PKtWsH0kpzZ62L2R6c/LUVYv7hVnZqcg2+sMuT6R7Jusu1vviK/MFsu6kNJfWlEQ==} + engines: {node: '>=4'} + string-length@4.0.2: resolution: {integrity: sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ==} engines: {node: '>=10'} @@ -2501,6 +2687,9 @@ packages: resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} engines: {node: '>=8'} + string_decoder@1.3.0: + resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==} + strip-ansi@6.0.1: resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} engines: {node: '>=8'} @@ -2521,6 +2710,9 @@ packages: resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} engines: {node: '>=8'} + strnum@1.0.5: + resolution: {integrity: sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA==} + superagent@9.0.2: resolution: {integrity: sha512-xuW7dzkUpcJq7QnhOsnNUgtYp3xRwpt2F7abdRYIpCsAt0hhUqia0EdxyXZQQpNmGtsCzYHryaKSV3q3GJnq7w==} engines: {node: '>=14.18.0'} @@ -2574,6 +2766,13 @@ packages: resolution: {integrity: sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==} engines: {node: '>=8'} + through2@4.0.2: + resolution: {integrity: sha512-iOqSav00cVxEEICeD7TjLB1sueEL+81Wpzp2bY17uZjZN0pWZPuo4suZ/61VujxmqSGFfgOcNuTZ85QJwNZQpw==} + + tmp@0.0.33: + resolution: {integrity: sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==} + engines: {node: '>=0.6.0'} + tmpl@1.0.5: resolution: {integrity: sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==} @@ -2696,6 +2895,12 @@ packages: uri-js@4.4.1: resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} + util-deprecate@1.0.2: + resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} + + util@0.12.5: + resolution: {integrity: sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==} + uuid@10.0.0: resolution: {integrity: sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==} hasBin: true @@ -2726,6 +2931,9 @@ packages: resolution: {integrity: sha512-TnbFSbcOCcDgjZ4piURLCbJ3nJhznVh9kw6F6iokjiFPl8ONxe9A6nMDVXDiNbrSfLILs6vB07F7wLBrwPYzJw==} engines: {node: '>=10.13.0'} + web-encoding@1.1.5: + resolution: {integrity: sha512-HYLeVCdJ0+lBYV2FvNZmv3HJ2Nt0QYXqZojk3d9FJOLkwnuhzM9tmamh8d7HPM8QqjKH8DeHkFTx+CFlWpZZDA==} + webpack-cli@5.1.4: resolution: {integrity: sha512-pIDJHIEI9LR0yxHXQ+Qh95k2EvXpWzZ5l+d+jIo+RdSm9MiHfzazIxwwni/p7+x4eJZuvG1AJwgC4TNQ7NRgsg==} engines: {node: '>=14.15.0'} @@ -2765,6 +2973,10 @@ packages: webpack-cli: optional: true + which-typed-array@1.1.15: + resolution: {integrity: sha512-oV0jmFtUky6CXfkqehVvBP/LSWJ2sy4vWMioiENyJLePrBO/yKyV9OyJySfAKosh+RYkIl5zJCNZ8/4JncrpdA==} + engines: {node: '>= 0.4'} + which@2.0.2: resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} engines: {node: '>= 8'} @@ -2799,6 +3011,14 @@ packages: utf-8-validate: optional: true + xml2js@0.5.0: + resolution: {integrity: sha512-drPFnkQJik/O+uPKpqSgr22mpuFHqKdbS835iAQrUC73L2F5WkboIRd63ai/2Yg6I1jzifPFKH2NTK+cfglkIA==} + engines: {node: '>=4.0.0'} + + xmlbuilder@11.0.1: + resolution: {integrity: sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==} + engines: {node: '>=4.0'} + xtend@4.0.2: resolution: {integrity: sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==} engines: {node: '>=0.4'} @@ -2810,6 +3030,11 @@ packages: yallist@3.1.1: resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==} + yaml@2.5.1: + resolution: {integrity: sha512-bLQOjaX/ADgQ20isPJRvF0iRUHIxVhYvr53Of7wGcWlO2jvtUlH5m87DsmulFVxRpNLOnI4tB6p/oh8D7kpn9Q==} + engines: {node: '>= 14'} + hasBin: true + yargs-parser@21.1.1: resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==} engines: {node: '>=12'} @@ -2831,19 +3056,9 @@ packages: snapshots: - '@abearxiong/router@0.0.1-alpha.27': {} + '@abearxiong/router@0.0.1-alpha.28(patch_hash=5da5h3tdxupyye4tbx43bkkmem)': {} - '@abearxiong/use-config@0.0.1(typescript@5.6.2)(webpack-cli@5.1.4(webpack@5.94.0))': - dependencies: - json5: 2.2.3 - ts-loader: 9.5.1(typescript@5.6.2)(webpack@5.94.0(webpack-cli@5.1.4)) - webpack: 5.94.0(webpack-cli@5.1.4) - transitivePeerDependencies: - - '@swc/core' - - esbuild - - typescript - - uglify-js - - webpack-cli + '@abearxiong/use-config@0.0.2': {} '@ampproject/remapping@2.3.0': dependencies: @@ -3947,7 +4162,7 @@ snapshots: '@types/json-schema@7.0.15': {} - '@types/jsonwebtoken@9.0.6': + '@types/jsonwebtoken@9.0.7': dependencies: '@types/node': 22.5.5 @@ -3965,6 +4180,8 @@ snapshots: dependencies: undici-types: 6.19.8 + '@types/semver@7.5.8': {} + '@types/stack-utils@2.0.3': {} '@types/superagent@8.1.9': @@ -4084,6 +4301,11 @@ snapshots: '@xtuc/long@4.2.2': {} + '@yarnpkg/lockfile@1.1.0': {} + + '@zxing/text-encoding@0.9.0': + optional: true + accepts@1.3.8: dependencies: mime-types: 2.1.35 @@ -4163,6 +4385,12 @@ snapshots: asynckit@0.4.0: {} + at-least-node@1.0.0: {} + + available-typed-arrays@1.0.7: + dependencies: + possible-typed-array-names: 1.0.0 + babel-jest@29.7.0(@babel/core@7.25.2): dependencies: '@babel/core': 7.25.2 @@ -4248,6 +4476,10 @@ snapshots: binary-extensions@2.3.0: {} + block-stream2@2.1.0: + dependencies: + readable-stream: 3.6.2 + brace-expansion@1.1.11: dependencies: balanced-match: 1.0.2 @@ -4261,6 +4493,8 @@ snapshots: dependencies: fill-range: 7.1.1 + browser-or-node@2.1.1: {} + browserslist@4.23.3: dependencies: caniuse-lite: 1.0.30001660 @@ -4276,6 +4510,8 @@ snapshots: dependencies: node-int64: 0.4.0 + buffer-crc32@1.0.0: {} + buffer-equal-constant-time@1.0.1: {} buffer-from@1.1.2: {} @@ -4448,6 +4684,8 @@ snapshots: optionalDependencies: supports-color: 5.5.0 + decode-uri-component@0.2.2: {} + dedent@1.5.3: {} deepmerge@4.3.1: {} @@ -4553,6 +4791,8 @@ snapshots: esutils@2.0.3: {} + eventemitter3@5.0.1: {} + events@3.3.0: {} execa@5.1.1: @@ -4593,6 +4833,10 @@ snapshots: fast-uri@3.0.1: {} + fast-xml-parser@4.5.0: + dependencies: + strnum: 1.0.5 + fastest-levenshtein@1.0.16: {} fastq@1.17.1: @@ -4611,13 +4855,23 @@ snapshots: dependencies: to-regex-range: 5.0.1 + filter-obj@1.1.0: {} + find-up@4.1.0: dependencies: locate-path: 5.0.0 path-exists: 4.0.0 + find-yarn-workspace-root@2.0.0: + dependencies: + micromatch: 4.0.8 + flat@5.0.2: {} + for-each@0.3.3: + dependencies: + is-callable: 1.2.7 + fork-ts-checker-webpack-plugin@9.0.2(typescript@5.6.2)(webpack@5.94.0(webpack-cli@5.1.4)): dependencies: '@babel/code-frame': 7.24.7 @@ -4653,6 +4907,13 @@ snapshots: jsonfile: 6.1.0 universalify: 2.0.1 + fs-extra@9.1.0: + dependencies: + at-least-node: 1.0.0 + graceful-fs: 4.2.11 + jsonfile: 6.1.0 + universalify: 2.0.1 + fs-monkey@1.0.6: {} fs.realpath@1.0.0: {} @@ -4726,6 +4987,10 @@ snapshots: has-symbols@1.0.3: {} + has-tostringtag@1.0.2: + dependencies: + has-symbols: 1.0.3 + hasown@2.0.2: dependencies: function-bind: 1.1.2 @@ -4763,22 +5028,37 @@ snapshots: interpret@3.1.1: {} + ipaddr.js@2.2.0: {} + + is-arguments@1.1.1: + dependencies: + call-bind: 1.0.7 + has-tostringtag: 1.0.2 + is-arrayish@0.2.1: {} is-binary-path@2.1.0: dependencies: binary-extensions: 2.3.0 + is-callable@1.2.7: {} + is-core-module@2.15.1: dependencies: hasown: 2.0.2 + is-docker@2.2.1: {} + is-extglob@2.1.1: {} is-fullwidth-code-point@3.0.0: {} is-generator-fn@2.1.0: {} + is-generator-function@1.0.10: + dependencies: + has-tostringtag: 1.0.2 + is-glob@4.0.3: dependencies: is-extglob: 2.1.1 @@ -4791,6 +5071,16 @@ snapshots: is-stream@2.0.1: {} + is-typed-array@1.1.13: + dependencies: + which-typed-array: 1.1.15 + + is-wsl@2.2.0: + dependencies: + is-docker: 2.2.1 + + isarray@2.0.5: {} + isexe@2.0.0: {} isobject@3.0.1: {} @@ -5179,6 +5469,13 @@ snapshots: json-schema-traverse@1.0.0: {} + json-stable-stringify@1.1.1: + dependencies: + call-bind: 1.0.7 + isarray: 2.0.5 + jsonify: 0.0.1 + object-keys: 1.1.1 + json5@2.2.3: {} jsonfile@6.1.0: @@ -5187,6 +5484,8 @@ snapshots: optionalDependencies: graceful-fs: 4.2.11 + jsonify@0.0.1: {} + jsonwebtoken@9.0.2: dependencies: jws: 3.2.2 @@ -5213,6 +5512,10 @@ snapshots: kind-of@6.0.3: {} + klaw-sync@6.0.0: + dependencies: + graceful-fs: 4.2.11 + kleur@3.0.3: {} leven@3.1.0: {} @@ -5294,6 +5597,25 @@ snapshots: dependencies: brace-expansion: 2.0.1 + minimist@1.2.8: {} + + minio@8.0.1: + dependencies: + async: 3.2.6 + block-stream2: 2.1.0 + browser-or-node: 2.1.1 + buffer-crc32: 1.0.0 + eventemitter3: 5.0.1 + fast-xml-parser: 4.5.0 + ipaddr.js: 2.2.0 + lodash: 4.17.21 + mime-types: 2.1.35 + query-string: 7.1.3 + stream-json: 1.8.0 + through2: 4.0.2 + web-encoding: 1.1.5 + xml2js: 0.5.0 + moment-timezone@0.5.45: dependencies: moment: 2.30.1 @@ -5316,7 +5638,7 @@ snapshots: node-releases@2.0.18: {} - nodemon@3.1.4: + nodemon@3.1.6: dependencies: chokidar: 3.6.0 debug: 4.3.7(supports-color@5.5.0) @@ -5339,6 +5661,8 @@ snapshots: object-inspect@1.13.2: {} + object-keys@1.1.1: {} + once@1.4.0: dependencies: wrappy: 1.0.2 @@ -5347,6 +5671,13 @@ snapshots: dependencies: mimic-fn: 2.1.0 + open@7.4.2: + dependencies: + is-docker: 2.2.1 + is-wsl: 2.2.0 + + os-tmpdir@1.0.2: {} + p-limit@2.3.0: dependencies: p-try: 2.2.0 @@ -5372,6 +5703,24 @@ snapshots: json-parse-even-better-errors: 2.3.1 lines-and-columns: 1.2.4 + patch-package@8.0.0: + dependencies: + '@yarnpkg/lockfile': 1.1.0 + chalk: 4.1.2 + ci-info: 3.9.0 + cross-spawn: 7.0.3 + find-yarn-workspace-root: 2.0.0 + fs-extra: 9.1.0 + json-stable-stringify: 1.1.1 + klaw-sync: 6.0.0 + minimist: 1.2.8 + open: 7.4.2 + rimraf: 2.7.1 + semver: 7.6.3 + slash: 2.0.0 + tmp: 0.0.33 + yaml: 2.5.1 + path-exists@4.0.0: {} path-is-absolute@1.0.1: {} @@ -5389,13 +5738,15 @@ snapshots: pg-connection-string@2.6.4: {} + pg-connection-string@2.7.0: {} + pg-int8@1.0.1: {} - pg-pool@3.6.2(pg@8.12.0): + pg-pool@3.7.0(pg@8.13.0): dependencies: - pg: 8.12.0 + pg: 8.13.0 - pg-protocol@1.6.1: {} + pg-protocol@1.7.0: {} pg-types@2.2.0: dependencies: @@ -5405,11 +5756,11 @@ snapshots: postgres-date: 1.0.7 postgres-interval: 1.2.0 - pg@8.12.0: + pg@8.13.0: dependencies: - pg-connection-string: 2.6.4 - pg-pool: 3.6.2(pg@8.12.0) - pg-protocol: 1.6.1 + pg-connection-string: 2.7.0 + pg-pool: 3.7.0(pg@8.13.0) + pg-protocol: 1.7.0 pg-types: 2.2.0 pgpass: 1.0.5 optionalDependencies: @@ -5429,6 +5780,8 @@ snapshots: dependencies: find-up: 4.1.0 + possible-typed-array-names@1.0.0: {} + postgres-array@2.0.0: {} postgres-bytea@1.0.0: {} @@ -5439,6 +5792,8 @@ snapshots: dependencies: xtend: 4.0.2 + postinstall-postinstall@2.1.0: {} + pretty-format@29.7.0: dependencies: '@jest/schemas': 29.6.3 @@ -5460,6 +5815,13 @@ snapshots: dependencies: side-channel: 1.0.6 + query-string@7.1.3: + dependencies: + decode-uri-component: 0.2.2 + filter-obj: 1.1.0 + split-on-first: 1.1.0 + strict-uri-encode: 2.0.0 + queue-microtask@1.2.3: {} randombytes@2.1.0: @@ -5468,6 +5830,12 @@ snapshots: react-is@18.3.1: {} + readable-stream@3.6.2: + dependencies: + inherits: 2.0.4 + string_decoder: 1.3.0 + util-deprecate: 1.0.2 + readdirp@3.6.0: dependencies: picomatch: 2.3.1 @@ -5525,6 +5893,10 @@ snapshots: reusify@1.0.4: {} + rimraf@2.7.1: + dependencies: + glob: 7.2.3 + run-parallel@1.2.0: dependencies: queue-microtask: 1.2.3 @@ -5535,6 +5907,8 @@ snapshots: safe-buffer@5.2.1: {} + sax@1.4.1: {} + schema-utils@3.3.0: dependencies: '@types/json-schema': 7.0.15 @@ -5554,7 +5928,7 @@ snapshots: sequelize-pool@7.1.0: {} - sequelize@6.37.3(pg@8.12.0): + sequelize@6.37.3(pg@8.13.0): dependencies: '@types/debug': 4.1.12 '@types/validator': 13.12.1 @@ -5573,7 +5947,7 @@ snapshots: validator: 13.12.0 wkx: 0.5.0 optionalDependencies: - pg: 8.12.0 + pg: 8.13.0 transitivePeerDependencies: - supports-color @@ -5617,6 +5991,8 @@ snapshots: sisteransi@1.0.5: {} + slash@2.0.0: {} + slash@3.0.0: {} slash@5.1.0: {} @@ -5665,6 +6041,8 @@ snapshots: source-map@0.7.4: {} + split-on-first@1.1.0: {} + split2@4.2.0: {} sprintf-js@1.0.3: {} @@ -5673,6 +6051,14 @@ snapshots: dependencies: escape-string-regexp: 2.0.0 + stream-chain@2.2.5: {} + + stream-json@1.8.0: + dependencies: + stream-chain: 2.2.5 + + strict-uri-encode@2.0.0: {} + string-length@4.0.2: dependencies: char-regex: 1.0.2 @@ -5684,6 +6070,10 @@ snapshots: is-fullwidth-code-point: 3.0.0 strip-ansi: 6.0.1 + string_decoder@1.3.0: + dependencies: + safe-buffer: 5.2.1 + strip-ansi@6.0.1: dependencies: ansi-regex: 5.0.1 @@ -5698,6 +6088,8 @@ snapshots: strip-json-comments@3.1.1: {} + strnum@1.0.5: {} + superagent@9.0.2: dependencies: component-emitter: 1.3.1 @@ -5757,6 +6149,14 @@ snapshots: glob: 7.2.3 minimatch: 3.1.2 + through2@4.0.2: + dependencies: + readable-stream: 3.6.2 + + tmp@0.0.33: + dependencies: + os-tmpdir: 1.0.2 + tmpl@1.0.5: {} to-fast-properties@2.0.0: {} @@ -5855,6 +6255,16 @@ snapshots: dependencies: punycode: 2.3.1 + util-deprecate@1.0.2: {} + + util@0.12.5: + dependencies: + inherits: 2.0.4 + is-arguments: 1.1.1 + is-generator-function: 1.0.10 + is-typed-array: 1.1.13 + which-typed-array: 1.1.15 + uuid@10.0.0: {} uuid@8.3.2: {} @@ -5880,6 +6290,12 @@ snapshots: glob-to-regexp: 0.4.1 graceful-fs: 4.2.11 + web-encoding@1.1.5: + dependencies: + util: 0.12.5 + optionalDependencies: + '@zxing/text-encoding': 0.9.0 + webpack-cli@5.1.4(webpack@5.94.0): dependencies: '@discoveryjs/json-ext': 0.5.7 @@ -5939,6 +6355,14 @@ snapshots: - esbuild - uglify-js + which-typed-array@1.1.15: + dependencies: + available-typed-arrays: 1.0.7 + call-bind: 1.0.7 + for-each: 0.3.3 + gopd: 1.0.1 + has-tostringtag: 1.0.2 + which@2.0.2: dependencies: isexe: 2.0.0 @@ -5964,12 +6388,21 @@ snapshots: ws@8.17.1: {} + xml2js@0.5.0: + dependencies: + sax: 1.4.1 + xmlbuilder: 11.0.1 + + xmlbuilder@11.0.1: {} + xtend@4.0.2: {} y18n@5.0.8: {} yallist@3.1.1: {} + yaml@2.5.1: {} + yargs-parser@21.1.1: {} yargs@17.7.2: diff --git a/src/modules/index.ts b/src/modules/index.ts index 8b50f47..194bd30 100644 --- a/src/modules/index.ts +++ b/src/modules/index.ts @@ -1 +1,3 @@ export { sequelize } from './sequelize.ts'; + +export * from './minio.ts' \ No newline at end of file diff --git a/src/modules/minio.ts b/src/modules/minio.ts new file mode 100644 index 0000000..44084a6 --- /dev/null +++ b/src/modules/minio.ts @@ -0,0 +1,14 @@ +import { Client, ClientOptions } from 'minio'; +import { useConfig } from '@abearxiong/use-config'; + +type MinioConfig = { + minio: ClientOptions & { bucketName: string }; +}; +const config = useConfig(); + +const { bucketName, ...minioRest } = config.minio; +export const minioClient = new Client(minioRest); +export { bucketName }; +if (!minioClient) { + throw new Error('Minio client not initialized'); +} diff --git a/src/routes/container/list.ts b/src/routes/container/list.ts index 21e60de..c72380c 100644 --- a/src/routes/container/list.ts +++ b/src/routes/container/list.ts @@ -1,13 +1,15 @@ import { CustomError } from '@abearxiong/router'; import { app } from '../../app.ts'; import { ContainerModel, ContainerData, Container } from './models/index.ts'; - +import semver from 'semver'; const list = app.route({ path: 'container', key: 'list', }); list.run = async (ctx) => { - const list = await ContainerModel.findAll(); + const list = await ContainerModel.findAll({ + order: [['updatedAt', 'DESC']], + }); ctx.body = list; return ctx; }; @@ -91,3 +93,49 @@ deleteRoute.run = async (ctx) => { return ctx; }; deleteRoute.addTo(app); + +const publish = app.route({ + path: 'container', + key: 'publish', +}); +publish.nextRoute = { path: 'resource', key: 'publishContainer' }; + +publish + .define(async (ctx) => { + const { data } = ctx.query; + const { id, publish, type = 'patch', beta = false } = data; + type PublishType = 'patch' | 'minor' | 'major'; + if (!id) { + throw new CustomError('id is required'); + } + const container = await ContainerModel.findByPk(id); + if (!container) { + throw new CustomError('container not found'); + } + const { name, description } = publish; + const oldPublish = container.publish; + let _version = ''; + if (!oldPublish.version) { + if (publish.name) { + throw new CustomError('publish name is required'); + } + container.publish = { + name, + description, + version: '0.0.1', + }; + } else { + _version = semver.inc(oldPublish.version, type as PublishType, beta ? 'beta' : undefined); + container.publish.version = _version; + } + if (ctx.state) { + ctx.state.container = container; + } else { + ctx.state = { + container, + }; + } + // 执行下一步操作了 + ctx.body = 'run ok'; + }) + .addTo(app); diff --git a/src/routes/container/models/index.ts b/src/routes/container/models/index.ts index 14f8755..e27ec77 100644 --- a/src/routes/container/models/index.ts +++ b/src/routes/container/models/index.ts @@ -7,16 +7,14 @@ export interface ContainerData { showChild?: boolean; shadowRoot?: boolean; } -export type Container = { - id?: string; - title?: string; +export type ContainerPublish = { + rid?: string; // resource id + name?: string; description?: string; - type?: string; - code?: string; - source?: string; - sourceType?: string; - data?: ContainerData; + version?: string; }; +export type Container = Partial>; + export class ContainerModel extends Model { declare id: string; declare title: string; @@ -26,6 +24,12 @@ export class ContainerModel extends Model { declare source: string; declare sourceType: string; declare data: ContainerData; + declare publish: ContainerPublish; + declare uid: string; + + // timestamps + public readonly createdAt!: Date; + public readonly updatedAt!: Date; } ContainerModel.init( { @@ -63,6 +67,11 @@ ContainerModel.init( type: DataTypes.JSON, defaultValue: {}, }, + publish: { + type: DataTypes.JSON, + defaultValue: {}, + }, + uid: { type: DataTypes.UUID, allowNull: true, diff --git a/src/routes/index.ts b/src/routes/index.ts index d0cfe6b..658fc15 100644 --- a/src/routes/index.ts +++ b/src/routes/index.ts @@ -1,3 +1,5 @@ import './container/index.ts'; -import './page/index.ts'; \ No newline at end of file +import './page/index.ts'; + +import './resource/index.ts'; diff --git a/src/routes/page/list.ts b/src/routes/page/list.ts index b0603a6..7c7b2fa 100644 --- a/src/routes/page/list.ts +++ b/src/routes/page/list.ts @@ -210,7 +210,7 @@ app path: 'page', key: 'getDeck', }) - .define(async (ctx) => { + .define(async (ctx) => { const id = ctx.query.id; if (!id) { throw new CustomError('id is required'); diff --git a/src/routes/resource/index.ts b/src/routes/resource/index.ts new file mode 100644 index 0000000..a3e8ab4 --- /dev/null +++ b/src/routes/resource/index.ts @@ -0,0 +1,2 @@ +import './publish.ts'; +import './list.ts'; diff --git a/src/routes/resource/lib/index.ts b/src/routes/resource/lib/index.ts new file mode 100644 index 0000000..b002fd9 --- /dev/null +++ b/src/routes/resource/lib/index.ts @@ -0,0 +1 @@ +export * from './publish-minio.ts'; diff --git a/src/routes/resource/lib/publish-minio.ts b/src/routes/resource/lib/publish-minio.ts new file mode 100644 index 0000000..7d822df --- /dev/null +++ b/src/routes/resource/lib/publish-minio.ts @@ -0,0 +1,35 @@ +import { Resource } from '../models/index.ts'; +import { minioClient, bucketName } from '../../../modules/minio.ts'; + +type MinioRes = { + etag?: string; // 文件的etag, 用于后续的文件下载 + versionId?: string; +}; + +type PublishOptions = { + name: string; + version: string; + code: string; +}; + +export const publishJsCode = async ({ name, version, code }: PublishOptions) => { + // publish to minio + const codeBuffer = Buffer.from(code); + const codePath = `${name}/${version}/index.js`; + try { + const res = await minioClient.putObject(bucketName, codePath, codeBuffer, codeBuffer.length, { + 'Content-Type': 'application/javascript', + 'Cache-Control': 'max-age=31536000, immutable', + }); + return { + code: 200, + data: { ...res, path: codePath }, + }; + } catch (e) { + console.error('publish error', e.message); + return { + code: 500, + message: e.message, + }; + } +}; diff --git a/src/routes/resource/list.ts b/src/routes/resource/list.ts new file mode 100644 index 0000000..9f7cb63 --- /dev/null +++ b/src/routes/resource/list.ts @@ -0,0 +1,72 @@ +import { ResourceData, ResourceModel } from './models/index.ts'; +import { app } from '../../app.ts'; +import { CustomError } from '@abearxiong/router'; + +app + .route({ + path: 'resource', + key: 'list', + }) + .define(async (ctx) => { + const list = await ResourceModel.findAll({ + order: [['updatedAt', 'DESC']], + }); + ctx.body = list; + return ctx; + }) + .addTo(app); + +app + .route({ + path: 'resource', + key: 'get', + }) + .define(async (ctx) => { + const id = ctx.query.id; + if (!id) { + throw new CustomError('id is required'); + } + const rm = await ResourceModel.findByPk(id); + if (!rm) { + throw new CustomError('resource not found'); + } + ctx.body = rm; + return ctx; + }) + .addTo(app); + +app + .route({ path: 'resource', key: 'update' }) + .define(async (ctx) => { + const { data, id, ...rest } = ctx.query.data; + if (id) { + const resource = await ResourceModel.findByPk(id); + if (resource) { + const newResource = await resource.update({ data, ...rest }); + ctx.body = newResource; + } + } else if (data) { + const resource = await ResourceModel.create({ data, ...rest }); + ctx.body = resource; + } + }) + .addTo(app); + +app + .route({ + path: 'resource', + key: 'delete', + }) + .define(async (ctx) => { + const id = ctx.query.id; + if (!id) { + throw new CustomError('id is required'); + } + const resource = await ResourceModel.findByPk(id); + if (!resource) { + throw new CustomError('resource not found'); + } + await resource.destroy(); + ctx.body = 'success'; + }) + .addTo(app); diff --git a/src/routes/resource/models/index.ts b/src/routes/resource/models/index.ts new file mode 100644 index 0000000..3a89a92 --- /dev/null +++ b/src/routes/resource/models/index.ts @@ -0,0 +1,87 @@ +import { sequelize } from '../../../modules/sequelize.ts'; +import { DataTypes, Model } from 'sequelize'; + +type FileUrlList = { + path: string; + etag: string; + versionId: string; +}; +export interface ResourceData { + list: FileUrlList[]; + lastestVersion: string; + updatedAt: string; + [key: string]: any; +} +export const defaultData: ResourceData = { + list: [], + lastestVersion: '0.0.0', + updatedAt: '', +}; +export type Resource = { + id?: string; + name?: string; + description?: string; + source?: string; + sourceId?: string; + data?: ResourceData; + version?: string; + uid?: string; +}; + +export class ResourceModel extends Model { + declare id: string; + declare name: string; + declare description: string; + declare source: string; + declare sourceId: string; + declare data: ResourceData; + declare version: string; + declare uid: string; +} + +ResourceModel.init( + { + id: { + type: DataTypes.UUID, + primaryKey: true, + defaultValue: DataTypes.UUIDV4, + comment: 'id', + }, + name: { + type: DataTypes.STRING, // 第一次创建之后就不能修改了,因为这个是用来做唯一标识的 + defaultValue: '', + }, + description: { + type: DataTypes.TEXT, + defaultValue: '', + }, + source: { + type: DataTypes.STRING, + defaultValue: '', + }, + sourceId: { + type: DataTypes.STRING, + defaultValue: '', + }, + version: { + type: DataTypes.STRING, + defaultValue: '0.0.0', + }, + data: { + type: DataTypes.JSON, + defaultValue: {}, + }, + uid: { + type: DataTypes.UUID, + allowNull: true, + }, + }, + { + sequelize, + tableName: 'kv_resource', + }, +); + +ResourceModel.sync({ alter: true, logging: false }).catch((e) => { + console.error('ResourceModel sync', e); +}); diff --git a/src/routes/resource/publish.ts b/src/routes/resource/publish.ts new file mode 100644 index 0000000..c553215 --- /dev/null +++ b/src/routes/resource/publish.ts @@ -0,0 +1,69 @@ +import { defaultData, Resource, ResourceModel } from './models/index.ts'; +import { ContainerModel } from './../container/models/index.ts'; + +import { app } from '../../app.ts'; +import { Op } from 'sequelize'; +import { publishJsCode } from './lib/publish-minio.ts'; +import { CustomError } from '@abearxiong/router'; + +app + .route({ + path: 'resource', + key: 'publishContainer', + idUsePath: true, + }) + .define(async (ctx) => { + const container = ctx.state.container as ContainerModel; + const publish = container.publish; + const code = container.code; + let { name, rid, description, version = '0.0.1' } = publish; + const where = []; + if (rid) { + where.push({ id: rid }); + } + if (name) { + where.push({ name }); + } + let resource = await ResourceModel.findOne({ where: { [Op.or]: where } }); + let isCreate = false; + if (!resource) { + isCreate = true; + resource = await ResourceModel.create({ + name, + description, + version, + source: 'container', + sourceId: container.id, + data: { + ...defaultData, + updatedAt: new Date().toISOString(), + }, + }); + } + publish.rid = publish.rid || resource.id; + // TODO: check version + const res = await publishJsCode({ name, version, code }); + if (res.code === 200) { + await container.update({ publish }); + const { etag, versionId, path } = res.data; + resource.version = version; + const newData = { + list: [], + ...resource.data, + }; + newData.list.push({ + etag, + versionId, + path, + }); + newData.lastestVersion = version; + newData.updatedAt = new Date().toISOString(); + resource.data = newData; + await resource.save(); + ctx.body = { resource, container, resourceIsNew: isCreate }; + } else { + throw new CustomError(res.message); + } + // await container.update({ publish }); + }) + .addTo(app);