diff --git a/docker-compose.yml b/docker-compose.yml index c335b64..e4ad85a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,6 +2,14 @@ networks: transcendance-network: driver: bridge services: + # this is a special container that will not be used when *running* the code, + # but will be used to build the utils library + utils-builder: + build: ./src/utils/ + container_name: utils-builder + image: utils-builder + restart: never + # service_name: # build: ./service_name # container_name: service_name @@ -23,6 +31,8 @@ services: - transcendance-network ports: - '8888:443' + volumes: + - images-volume:/volumes/icons environment: - NGINX_DOMAIN=local.maix.me - NGINX_USE_LOCAL_RESOLVER=yes @@ -34,14 +44,10 @@ services: networks: - transcendance-network volumes: - - /store + - images-volume:/store environment: - USER_ICONS_STORE=/store + depends_on: + - utils-builder volumes: -# service_name-vol: -# driver: local -# driver_opts: -# type: 'none' -# o: 'bind' -# device: ${DATA_DIR:-/tmp/ft_deadge}/service_name -# name: "service_name-vol" + images-volume: diff --git a/nginx/15-local-resolvers.envsh b/nginx/15-local-resolvers.envsh index 6c76285..bc406b4 100755 --- a/nginx/15-local-resolvers.envsh +++ b/nginx/15-local-resolvers.envsh @@ -10,6 +10,5 @@ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin NGINX_RESOLVERS=$(awk 'BEGIN{ORS=" "} $1=="nameserver" {if ($2 ~ ":") {print "["$2"]"} else {print $2}}' /etc/resolv.conf) # remove trailing space NGINX_RESOLVERS="${NGINX_RESOLVERS% }" -echo "_${NGINX_RESOLVERS}_" export NGINX_RESOLVERS diff --git a/nginx/17-add-template-prefix.sh b/nginx/17-add-template-prefix.sh index b26feaf..185703f 100755 --- a/nginx/17-add-template-prefix.sh +++ b/nginx/17-add-template-prefix.sh @@ -4,7 +4,6 @@ set -e ME=$(basename "$0") -echo "_{$NGINX_LOCAL_RESOLVERS}_" entrypoint_log() { if [ -z "${NGINX_ENTRYPOINT_QUIET_LOGS:-}" ]; then echo "$@" diff --git a/nginx/Dockerfile b/nginx/Dockerfile index 586c438..7c0518f 100644 --- a/nginx/Dockerfile +++ b/nginx/Dockerfile @@ -6,13 +6,15 @@ # By: maiboyer +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2025/06/12 16:42:38 by maiboyer #+# #+# # -# Updated: 2025/06/16 16:26:48 by maiboyer ### ########.fr # +# Updated: 2025/06/16 21:21:16 by maiboyer ### ########.fr # # # # **************************************************************************** # FROM nginx:stable-alpine -RUN mkdir -p /etc/nginx/ && \ +RUN \ + mkdir -p /volumes/ && \ + mkdir -p /etc/nginx/ && \ mkdir -p /etc/ssl/certs && \ mkdir -p /etc/ssl/private && \ apk add openssl && \ diff --git a/nginx/conf/locations/icons.conf b/nginx/conf/locations/icons.conf index 19dca17..2f24928 100644 --- a/nginx/conf/locations/icons.conf +++ b/nginx/conf/locations/icons.conf @@ -1,4 +1,9 @@ -location /api/icons { - rewrite ^/api/icons/(.*) /$1 break; - proxy_pass http://icons-service/$uri$is_args$args; +location /api/icons/set/ { + rewrite ^/api/icons/set/(.*) $1 break; + proxy_pass http://icons-service/set/$uri; +} + +location /api/icons/get/ { + rewrite ^/api/icons/get/(.*) /$1 break; + root /volumes/icons; } diff --git a/src/@shared/dist/auth.d.ts b/src/@shared/dist/auth.d.ts new file mode 100644 index 0000000..b39a703 --- /dev/null +++ b/src/@shared/dist/auth.d.ts @@ -0,0 +1,2 @@ +import { FastifyInstance } from 'fastify'; +export default function (_fastify: FastifyInstance, _options: any): Promise; diff --git a/src/@shared/dist/auth.js b/src/@shared/dist/auth.js new file mode 100644 index 0000000..2b670a0 --- /dev/null +++ b/src/@shared/dist/auth.js @@ -0,0 +1,3 @@ +export default async function (_fastify, _options) { + console.log("inside the plugin !"); +} diff --git a/src/@shared/dist/database/a.d.ts b/src/@shared/dist/database/a.d.ts new file mode 100644 index 0000000..0524742 --- /dev/null +++ b/src/@shared/dist/database/a.d.ts @@ -0,0 +1,23 @@ +import { Result } from 'typescript-result'; +import { UUIDv7 } from '@shared/uuid'; +export declare class DBUserExists extends Error { + readonly type = "db-user-exists"; +} +export declare class Database { + private db; + private st; + constructor(db_path: string); + destroy(): void; + private prepare; + createUser(user: string): Result; +} +declare module 'fastify' { + interface FastifyInstance { + db: Database; + } +} +export type DatabaseOption = { + path: string; +}; +export declare const uDatabase: import("fastify").FastifyPluginCallback; +export default uDatabase; diff --git a/src/@shared/dist/database/a.js b/src/@shared/dist/database/a.js new file mode 100644 index 0000000..ea6ea5e --- /dev/null +++ b/src/@shared/dist/database/a.js @@ -0,0 +1,43 @@ +import fp from 'fastify-plugin'; +import sqlite from 'better-sqlite3'; +import { Result } from 'typescript-result'; +import initSql from "./init.sql.js"; +import { newUUIDv7 } from '@shared/uuid'; +export class DBUserExists extends Error { + type = 'db-user-exists'; +} +export class Database { + db; + st = new Map(); + constructor(db_path) { + this.db = sqlite(db_path, {}); + this.db.pragma('journal_mode = WAL'); + this.db.transaction(() => this.db.exec(initSql))(); + } + destroy() { + this.st.clear(); + this.db?.close(); + } + prepare(query) { + let st = this.st.get(query); + if (st !== undefined) + return st; + st = this.db.prepare(query); + this.st.set(query, st); + return st; + } + createUser(user) { + const st = this.prepare('INSERT INTO users VALUES (?, ?) RETURNING id'); + try { + st.get(newUUIDv7(), user); + } + catch (e) { + console.log(e); + console.log(typeof e); + } + return Result.ok(newUUIDv7()); + } +} +export const uDatabase = fp(async function (_fastify, _options) { +}); +export default uDatabase; diff --git a/src/@shared/dist/database/index.d.ts b/src/@shared/dist/database/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/src/@shared/dist/database/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/src/@shared/dist/database/index.js b/src/@shared/dist/database/index.js new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/src/@shared/dist/database/index.js @@ -0,0 +1 @@ +export {}; diff --git a/src/@shared/dist/database/init.sql.d.ts b/src/@shared/dist/database/init.sql.d.ts new file mode 100644 index 0000000..e8252fe --- /dev/null +++ b/src/@shared/dist/database/init.sql.d.ts @@ -0,0 +1,2 @@ +declare const _default: "-- this file will make sure that the database is always up to date with the correct schema\n-- when editing this file, make sure to always include stuff like `IF NOT EXISTS` such as to not throw error\n-- NEVER DROP ANYTHING IN THIS FILE\nCREATE TABLE IF NOT EXISTS users (\n id STRING UNIQUE PRIMARY KEY, -- UUIDv7 as a string\n name STRING UNIQUE, -- name of the user\n token STRING UNIQUE, -- the token of the user (aka the cookie)\n);\n\n"; +export default _default; diff --git a/src/@shared/dist/database/init.sql.js b/src/@shared/dist/database/init.sql.js new file mode 100644 index 0000000..c6aab82 --- /dev/null +++ b/src/@shared/dist/database/init.sql.js @@ -0,0 +1 @@ +export default "-- this file will make sure that the database is always up to date with the correct schema\n-- when editing this file, make sure to always include stuff like `IF NOT EXISTS` such as to not throw error\n-- NEVER DROP ANYTHING IN THIS FILE\nCREATE TABLE IF NOT EXISTS users (\n id STRING UNIQUE PRIMARY KEY, -- UUIDv7 as a string\n name STRING UNIQUE, -- name of the user\n token STRING UNIQUE, -- the token of the user (aka the cookie)\n);\n\n"; diff --git a/src/@shared/dist/uuid/index.d.ts b/src/@shared/dist/uuid/index.d.ts new file mode 100644 index 0000000..ddbdd1f --- /dev/null +++ b/src/@shared/dist/uuid/index.d.ts @@ -0,0 +1,10 @@ +import { Result } from "typescript-result"; +export declare class InvalidUUID extends Error { + readonly type = "invalid-uuid"; +} +export type UUIDv7 = string & { + readonly __brand: unique symbol; +}; +export declare function isUUIDv7(value: string): value is UUIDv7; +export declare function toUUIDv7(value: string): Result; +export declare function newUUIDv7(): UUIDv7; diff --git a/src/@shared/dist/uuid/index.js b/src/@shared/dist/uuid/index.js new file mode 100644 index 0000000..e2646a3 --- /dev/null +++ b/src/@shared/dist/uuid/index.js @@ -0,0 +1,18 @@ +import { Result } from "typescript-result"; +import { uuidv7 } from "uuidv7"; +export class InvalidUUID extends Error { + type = 'invalid-uuid'; +} +; +const uuidv7Regex = /^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i; +export function isUUIDv7(value) { + return uuidv7Regex.test(value); +} +export function toUUIDv7(value) { + if (!isUUIDv7(value)) + return Result.error(new InvalidUUID()); + return Result.ok(value.toLowerCase()); +} +export function newUUIDv7() { + return uuidv7(); +} diff --git a/src/db/README.md b/src/db/README.md deleted file mode 100644 index 2d5e417..0000000 --- a/src/db/README.md +++ /dev/null @@ -1,23 +0,0 @@ -# Getting Started with [Fastify-CLI](https://www.npmjs.com/package/fastify-cli) -This project was bootstrapped with Fastify-CLI. - -## Available Scripts - -In the project directory, you can run: - -### `npm run dev` - -To start the app in dev mode.\ -Open [http://localhost:3000](http://localhost:3000) to view it in the browser. - -### `npm start` - -For production mode - -### `npm run test` - -Run the test cases. - -## Learn More - -To learn Fastify, check out the [Fastify documentation](https://fastify.dev/docs/latest/). diff --git a/src/db/package.json b/src/db/package.json deleted file mode 100644 index 5fdd844..0000000 --- a/src/db/package.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "type": "module", - "name": "db", - "version": "1.0.0", - "description": "This project was bootstrapped with Fastify-CLI.", - "main": "app.ts", - "directories": { - "test": "test" - }, - "scripts": { - "test": "npm run build:ts && tsc -p test/tsconfig.json && FASTIFY_AUTOLOAD_TYPESCRIPT=1 node --test --experimental-test-coverage --loader ts-node/esm test/**/*.ts", - "start": "npm run build:ts && fastify start -l info dist/app.js", - "build:ts": "tsc", - "watch:ts": "tsc -w", - "dev": "npm run build:ts && concurrently -k -p \"[{name}]\" -n \"TypeScript,App\" -c \"yellow.bold,cyan.bold\" \"npm:watch:ts\" \"npm:dev:start\"", - "dev:start": "fastify start --ignore-watch=.ts$ -w -l info -P dist/app.js" - }, - "keywords": [], - "author": "", - "license": "ISC", - "dependencies": { - "fastify": "^5.0.0", - "fastify-plugin": "^5.0.0", - "@fastify/autoload": "^6.0.0", - "@fastify/sensible": "^6.0.0", - "fastify-cli": "^7.4.0" - }, - "devDependencies": { - "@types/node": "^22.1.0", - "c8": "^10.1.2", - "ts-node": "^10.4.0", - "concurrently": "^9.0.0", - "fastify-tsconfig": "^3.0.0", - "typescript": "~5.8.2" - } -} \ No newline at end of file diff --git a/src/db/src/app.ts b/src/db/src/app.ts deleted file mode 100644 index 74d9ff0..0000000 --- a/src/db/src/app.ts +++ /dev/null @@ -1,46 +0,0 @@ -import * as path from 'node:path' -import AutoLoad, { AutoloadPluginOptions } from '@fastify/autoload' -import { FastifyPluginAsync } from 'fastify' -import { fileURLToPath } from 'node:url' - -const __filename = fileURLToPath(import.meta.url) -const __dirname = path.dirname(__filename) - -export type AppOptions = { - // Place your custom options for app below here. -} & Partial - -// Pass --options via CLI arguments in command to enable these options. -const options: AppOptions = { -} - -const app: FastifyPluginAsync = async ( - fastify, - opts -): Promise => { - // Place here your custom code! - - // Do not touch the following lines - - // This loads all plugins defined in plugins - // those should be support plugins that are reused - // through your application - // eslint-disable-next-line no-void - void fastify.register(AutoLoad, { - dir: path.join(__dirname, 'plugins'), - options: opts, - forceESM: true - }) - - // This loads all plugins defined in routes - // define your routes in one of these - // eslint-disable-next-line no-void - void fastify.register(AutoLoad, { - dir: path.join(__dirname, 'routes'), - options: opts, - forceESM: true - }) -} - -export default app -export { app, options } diff --git a/src/db/src/plugins/README.md b/src/db/src/plugins/README.md deleted file mode 100644 index 1e61ee5..0000000 --- a/src/db/src/plugins/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# Plugins Folder - -Plugins define behavior that is common to all the routes in your -application. Authentication, caching, templates, and all the other cross -cutting concerns should be handled by plugins placed in this folder. - -Files in this folder are typically defined through the -[`fastify-plugin`](https://github.com/fastify/fastify-plugin) module, -making them non-encapsulated. They can define decorators and set hooks -that will then be used in the rest of your application. - -Check out: - -* [The hitchhiker's guide to plugins](https://fastify.dev/docs/latest/Guides/Plugins-Guide/) -* [Fastify decorators](https://fastify.dev/docs/latest/Reference/Decorators/). -* [Fastify lifecycle](https://fastify.dev/docs/latest/Reference/Lifecycle/). diff --git a/src/db/src/plugins/sensible.ts b/src/db/src/plugins/sensible.ts deleted file mode 100644 index 5be2c8a..0000000 --- a/src/db/src/plugins/sensible.ts +++ /dev/null @@ -1,11 +0,0 @@ -import fp from 'fastify-plugin' -import sensible, { FastifySensibleOptions } from '@fastify/sensible' - -/** - * This plugins adds some utilities to handle http errors - * - * @see https://github.com/fastify/fastify-sensible - */ -export default fp(async (fastify) => { - fastify.register(sensible) -}) diff --git a/src/db/src/plugins/support.ts b/src/db/src/plugins/support.ts deleted file mode 100644 index 94bae4f..0000000 --- a/src/db/src/plugins/support.ts +++ /dev/null @@ -1,20 +0,0 @@ -import fp from 'fastify-plugin' - -export interface SupportPluginOptions { - // Specify Support plugin options here -} - -// The use of fastify-plugin is required to be able -// to export the decorators to the outer scope -export default fp(async (fastify, opts) => { - fastify.decorate('someSupport', function () { - return 'hugs' - }) -}) - -// When using .decorate you have to specify added properties for Typescript -declare module 'fastify' { - export interface FastifyInstance { - someSupport(): string; - } -} diff --git a/src/db/src/routes/README.md b/src/db/src/routes/README.md deleted file mode 100644 index 75b5658..0000000 --- a/src/db/src/routes/README.md +++ /dev/null @@ -1,29 +0,0 @@ -# Routes Folder - -Routes define the pathways within your application. -Fastify's structure supports the modular monolith approach, where your -application is organized into distinct, self-contained modules. -This facilitates easier scaling and future transition to a microservice architecture. -In the future you might want to independently deploy some of those. - -In this folder you should define all the routes that define the endpoints -of your web application. -Each service is a [Fastify -plugin](https://fastify.dev/docs/latest/Reference/Plugins/), it is -encapsulated (it can have its own independent plugins) and it is -typically stored in a file; be careful to group your routes logically, -e.g. all `/users` routes in a `users.js` file. We have added -a `root.js` file for you with a '/' root added. - -If a single file becomes too large, create a folder and add a `index.js` file there: -this file must be a Fastify plugin, and it will be loaded automatically -by the application. You can now add as many files as you want inside that folder. -In this way you can create complex routes within a single monolith, -and eventually extract them. - -If you need to share functionality between routes, place that -functionality into the `plugins` folder, and share it via -[decorators](https://fastify.dev/docs/latest/Reference/Decorators/). - -If you're a bit confused about using `async/await` to write routes, you would -better take a look at [Promise resolution](https://fastify.dev/docs/latest/Reference/Routes/#promise-resolution) for more details. diff --git a/src/db/src/routes/root.ts b/src/db/src/routes/root.ts deleted file mode 100644 index 2225885..0000000 --- a/src/db/src/routes/root.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { FastifyPluginAsync } from 'fastify' - -const root: FastifyPluginAsync = async (fastify, opts): Promise => { - fastify.get('/', async function(request, reply) { - reply.code(403) - }) -} - -export default root diff --git a/src/db/src/routes/user/index.ts b/src/db/src/routes/user/index.ts deleted file mode 100644 index 68a0ea1..0000000 --- a/src/db/src/routes/user/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { FastifyPluginAsync } from 'fastify' - -const example: FastifyPluginAsync = async (fastify, opts): Promise => { - fastify.get('/', async function (request, reply) { - return 'this is an example' - }) -} - -export default example diff --git a/src/db/test/helper.ts b/src/db/test/helper.ts deleted file mode 100644 index c42414a..0000000 --- a/src/db/test/helper.ts +++ /dev/null @@ -1,43 +0,0 @@ -// This file contains code that we reuse between our tests. -import helper from 'fastify-cli/helper.js' -import * as test from 'node:test' -import * as path from 'node:path' -import { fileURLToPath } from 'node:url' - -export type TestContext = { - after: typeof test.after -} - -const __filename = fileURLToPath(import.meta.url) -const __dirname = path.dirname(__filename) -const AppPath = path.join(__dirname, '..', 'src', 'app.ts') - -// Fill in this config with all the configurations -// needed for testing the application -function config () { - return { - skipOverride: true // Register our application with fastify-plugin - } -} - -// Automatically build and tear down our instance -async function build (t: TestContext) { - // you can set all the options supported by the fastify CLI command - const argv = [AppPath] - - // fastify-plugin ensures that all decorators - // are exposed for testing purposes, this is - // different from the production setup - const app = await helper.build(argv, config()) - - // Tear down our app after we are done - // eslint-disable-next-line no-void - t.after(() => void app.close()) - - return app -} - -export { - config, - build -} diff --git a/src/db/test/plugins/support.test.ts b/src/db/test/plugins/support.test.ts deleted file mode 100644 index b260072..0000000 --- a/src/db/test/plugins/support.test.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { test } from 'node:test' -import * as assert from 'node:assert' -import Fastify from 'fastify' -import Support from '../../src/plugins/support.js' - -test('support works standalone', async (t) => { - const fastify = Fastify() - // eslint-disable-next-line no-void - void fastify.register(Support) - await fastify.ready() - - assert.equal(fastify.someSupport(), 'hugs') -}) diff --git a/src/db/test/routes/example.test.ts b/src/db/test/routes/example.test.ts deleted file mode 100644 index 87f26ab..0000000 --- a/src/db/test/routes/example.test.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { test } from 'node:test' -import * as assert from 'node:assert' -import { build } from '../helper.js' - -test('example is loaded', async (t) => { - const app = await build(t) - - const res = await app.inject({ - url: '/example' - }) - - assert.equal(res.payload, 'this is an example') -}) diff --git a/src/db/test/routes/root.test.ts b/src/db/test/routes/root.test.ts deleted file mode 100644 index 743b610..0000000 --- a/src/db/test/routes/root.test.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { test } from 'node:test' -import * as assert from 'node:assert' -import { build } from '../helper.js' - -test('default root route', async (t) => { - const app = await build(t) - - const res = await app.inject({ - url: '/' - }) - assert.deepStrictEqual(JSON.parse(res.payload), { root: true }) -}) diff --git a/src/db/test/tsconfig.json b/src/db/test/tsconfig.json deleted file mode 100644 index 3b443e0..0000000 --- a/src/db/test/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "noEmit": false - }, - "include": ["../src/**/*.ts", "**/*.ts"] -} diff --git a/src/icons-service/Dockerfile b/src/icons-service/Dockerfile index cae216d..702da1a 100644 --- a/src/icons-service/Dockerfile +++ b/src/icons-service/Dockerfile @@ -6,26 +6,28 @@ # By: maiboyer +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2025/06/16 14:57:11 by maiboyer #+# #+# # -# Updated: 2025/06/16 15:28:33 by maiboyer ### ########.fr # +# Updated: 2025/06/16 23:05:12 by maiboyer ### ########.fr # # # # **************************************************************************** # +FROM utils-builder AS utils-builder FROM node:24-alpine AS builder # Don't forget to edit the .dockerignore if needed -COPY . /app +COPY . /src/app +COPY --from=utils-builder /out /src/utils -WORKDIR /app +WORKDIR /src/app RUN npm install && npm run build:ts; FROM node:24-alpine -WORKDIR /app - -COPY --from=builder /app/dist ./dist -COPY --from=builder /app/package*.json . +WORKDIR /src/app +COPY --from=utils-builder /out /src/utils +COPY --from=builder /src/app/dist ./dist +COPY --from=builder /src/app/package*.json . RUN npm ci --omit=dev; # Start the app -CMD ["node", "dist/run.js"] +CMD ["node", "/src/app/dist/run.js"] diff --git a/src/icons-service/package-lock.json b/src/icons-service/package-lock.json index 43ad2bd..1ca378a 100644 --- a/src/icons-service/package-lock.json +++ b/src/icons-service/package-lock.json @@ -1,11 +1,11 @@ { - "name": "user-icons", + "name": "icons-service", "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "user-icons", + "name": "icons-service", "version": "1.0.0", "license": "ISC", "dependencies": { @@ -18,7 +18,24 @@ "fastify-cli": "^7.4.0", "fastify-plugin": "^5.0.0", "fastify-raw-body": "^5.0.0", - "sharp": "^0.34.2" + "sharp": "^0.34.2", + "utils": "file:../utils/" + }, + "devDependencies": { + "@types/node": "^22.1.0", + "c8": "^10.1.2", + "concurrently": "^9.0.0", + "fastify-tsconfig": "^3.0.0", + "ts-node": "^10.4.0", + "typescript": "~5.8.2" + } + }, + "../utils": { + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "fastify": "^5.0.0", + "fastify-plugin": "^5.0.0" }, "devDependencies": { "@types/node": "^22.1.0", @@ -3077,6 +3094,10 @@ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", "license": "MIT" }, + "node_modules/utils": { + "resolved": "../utils", + "link": true + }, "node_modules/v8-compile-cache-lib": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", diff --git a/src/icons-service/package.json b/src/icons-service/package.json index d16c574..53d7b4b 100644 --- a/src/icons-service/package.json +++ b/src/icons-service/package.json @@ -10,8 +10,8 @@ "scripts": { "test": "npm run build:ts && tsc -p test/tsconfig.json && FASTIFY_AUTOLOAD_TYPESCRIPT=1 node --test --experimental-test-coverage --loader ts-node/esm test/**/*.ts", "start": "npm run build:ts && fastify start -l info dist/app.js", - "build:ts": "tsc", - "watch:ts": "tsc -w", + "build:ts": "tsc -d", + "watch:ts": "tsc -d -w", "dev": "npm run build:ts && concurrently -k -p \"[{name}]\" -n \"TypeScript,App\" -c \"yellow.bold,cyan.bold\" \"npm:watch:ts\" \"npm:dev:start\"", "dev:start": "fastify start --ignore-watch=.ts$ -w -l info -P dist/app.js" }, @@ -28,7 +28,8 @@ "fastify-cli": "^7.4.0", "fastify-plugin": "^5.0.0", "fastify-raw-body": "^5.0.0", - "sharp": "^0.34.2" + "sharp": "^0.34.2", + "utils": "file:../utils/" }, "devDependencies": { "@types/node": "^22.1.0", diff --git a/src/icons-service/src/app.ts b/src/icons-service/src/app.ts index 7d5b1b3..cefd974 100644 --- a/src/icons-service/src/app.ts +++ b/src/icons-service/src/app.ts @@ -6,6 +6,7 @@ import fastifyFormBody from '@fastify/formbody' import fastifyMultipart from '@fastify/multipart' import { mkdir } from 'node:fs/promises' import fp from 'fastify-plugin' +import MyPlugin from 'utils' const __filename = fileURLToPath(import.meta.url) const __dirname = path.dirname(__filename) @@ -31,6 +32,7 @@ const app: FastifyPluginAsync = async ( ): Promise => { // Place here your custom code! + void fastify.register(MyPlugin, {}) void fastify.register(fastifyFormBody, {}) void fastify.register(fastifyMultipart, {}) diff --git a/src/icons-service/src/routes/get/index.ts b/src/icons-service/src/routes/get/index.ts deleted file mode 100644 index 3711bb0..0000000 --- a/src/icons-service/src/routes/get/index.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { FastifyPluginAsync } from 'fastify' -import fastifyStatic from '@fastify/static' - -const example: FastifyPluginAsync = async (fastify, opts): Promise => { - fastify.register(fastifyStatic, { - root: fastify.getDecorator('image_store')!, - prefix: '/', - }) - fastify.get('/:userid', async (req, res) => { - const filename = (req.params as any)['userid'] + '.png'; - await res.sendFile(filename) - }) -} - -export default example - diff --git a/src/icons-service/src/routes/root.ts b/src/icons-service/src/routes/root.ts deleted file mode 100644 index ebccaed..0000000 --- a/src/icons-service/src/routes/root.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { FastifyPluginAsync } from 'fastify' - - -const example: FastifyPluginAsync = async (fastify, opts): Promise => { - fastify.get('*', async (req, res) => res.code(403)) -} - -export default example diff --git a/src/icons-service/src/routes/set/index.ts b/src/icons-service/src/routes/set/index.ts index 17be1e9..499e5b1 100644 --- a/src/icons-service/src/routes/set/index.ts +++ b/src/icons-service/src/routes/set/index.ts @@ -4,15 +4,16 @@ import { open } from 'node:fs/promises' import fastifyRawBody from 'fastify-raw-body' const example: FastifyPluginAsync = async (fastify, opts): Promise => { - // fastify.register(DeadgeInternalApi, {}) + // await fastify.register(authMethod, {}); await fastify.register(fastifyRawBody, { encoding: false }); fastify.post('/:userid', { config: { rawBody: true, encoding: false } }, async function(request, reply) { + console.log(request.headers); const userid: string | undefined = (request.params as any)['userid']; if (userid === undefined) { return await reply.code(403); } const image_store: string = fastify.getDecorator('image_store') - const image_path = join(image_store, userid + ".png") + const image_path = join(image_store, userid) let image_file = await open(image_path, "w", 0o666) await image_file.write(request.rawBody as Buffer); await image_file.close() diff --git a/src/icons/dist/app.d.ts b/src/icons/dist/app.d.ts new file mode 100644 index 0000000..97ecd65 --- /dev/null +++ b/src/icons/dist/app.d.ts @@ -0,0 +1,12 @@ +import { AutoloadPluginOptions } from '@fastify/autoload'; +import { FastifyPluginAsync } from 'fastify'; +export type AppOptions = {} & Partial; +declare const options: AppOptions; +declare module 'fastify' { + interface FastifyInstance { + image_store: string; + } +} +declare const app: FastifyPluginAsync; +export default app; +export { app, options }; diff --git a/src/icons/dist/app.js b/src/icons/dist/app.js new file mode 100644 index 0000000..3183c25 --- /dev/null +++ b/src/icons/dist/app.js @@ -0,0 +1,31 @@ +import * as path from 'node:path'; +import AutoLoad from '@fastify/autoload'; +import { fileURLToPath } from 'node:url'; +import fastifyFormBody from '@fastify/formbody'; +import fastifyMultipart from '@fastify/multipart'; +import { mkdir } from 'node:fs/promises'; +import fp from 'fastify-plugin'; +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); +const options = {}; +const app = async (fastify, opts) => { + void fastify.register(fastifyFormBody, {}); + void fastify.register(fastifyMultipart, {}); + void fastify.register(fp(async (fastify) => { + const image_store = process.env.USER_ICONS_STORE ?? "/tmp/icons"; + fastify.decorate('image_store', image_store); + await mkdir(fastify.image_store, { recursive: true }); + })); + void fastify.register(AutoLoad, { + dir: path.join(__dirname, 'plugins'), + options: opts, + forceESM: true + }); + void fastify.register(AutoLoad, { + dir: path.join(__dirname, 'routes'), + options: opts, + forceESM: true + }); +}; +export default app; +export { app, options }; diff --git a/src/icons/dist/app.js.map b/src/icons/dist/app.js.map new file mode 100644 index 0000000..7c38c1f --- /dev/null +++ b/src/icons/dist/app.js.map @@ -0,0 +1 @@ +{"version":3,"file":"app.js","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,QAAmC,MAAM,mBAAmB,CAAA;AAEnE,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,eAAe,MAAM,mBAAmB,CAAA;AAC/C,OAAO,gBAAgB,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACxC,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAC/B,OAAO,QAAQ,MAAM,QAAQ,CAAA;AAE7B,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACjD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAA;AAO1C,MAAM,OAAO,GAAe,EAC3B,CAAA;AASD,MAAM,GAAG,GAAmC,KAAK,EAChD,OAAO,EACP,IAAI,EACY,EAAE;IAGlB,KAAK,OAAO,CAAC,QAAQ,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAA;IACnC,KAAK,OAAO,CAAC,QAAQ,CAAC,eAAe,EAAE,EAAE,CAAC,CAAA;IAC1C,KAAK,OAAO,CAAC,QAAQ,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAA;IAI3C,KAAK,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;QAC1C,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,YAAY,CAAC;QACjE,OAAO,CAAC,QAAQ,CAAC,aAAa,EAAE,WAAW,CAAC,CAAA;QAC5C,MAAM,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;IACtD,CAAC,CAAC,CAAC,CAAA;IAUH,KAAK,OAAO,CAAC,QAAQ,CAAC,QAAQ,EAAE;QAC/B,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC;QACpC,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,IAAI;KACd,CAAC,CAAA;IAKF,KAAK,OAAO,CAAC,QAAQ,CAAC,QAAQ,EAAE;QAC/B,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC;QACnC,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,IAAI;KACd,CAAC,CAAA;AAEH,CAAC,CAAA;AAED,eAAe,GAAG,CAAA;AAClB,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,CAAA"} \ No newline at end of file diff --git a/src/icons/dist/plugins/sensible.d.ts b/src/icons/dist/plugins/sensible.d.ts new file mode 100644 index 0000000..b5c8bb4 --- /dev/null +++ b/src/icons/dist/plugins/sensible.d.ts @@ -0,0 +1,3 @@ +import sensible from '@fastify/sensible'; +declare const _default: import("fastify").FastifyPluginCallback; +export default _default; diff --git a/src/icons/dist/plugins/sensible.js b/src/icons/dist/plugins/sensible.js new file mode 100644 index 0000000..6ad7356 --- /dev/null +++ b/src/icons/dist/plugins/sensible.js @@ -0,0 +1,5 @@ +import fp from 'fastify-plugin'; +import sensible from '@fastify/sensible'; +export default fp(async (fastify) => { + fastify.register(sensible); +}); diff --git a/src/icons/dist/plugins/sensible.js.map b/src/icons/dist/plugins/sensible.js.map new file mode 100644 index 0000000..45a9a19 --- /dev/null +++ b/src/icons/dist/plugins/sensible.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sensible.js","sourceRoot":"","sources":["../../src/plugins/sensible.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAC/B,OAAO,QAAoC,MAAM,mBAAmB,CAAA;AAOpE,eAAe,EAAE,CAAyB,KAAK,EAAE,OAAO,EAAE,EAAE;IAC1D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;AAC5B,CAAC,CAAC,CAAA"} \ No newline at end of file diff --git a/src/icons/dist/routes/set/index.d.ts b/src/icons/dist/routes/set/index.d.ts new file mode 100644 index 0000000..6bf9935 --- /dev/null +++ b/src/icons/dist/routes/set/index.d.ts @@ -0,0 +1,3 @@ +import { FastifyPluginAsync } from 'fastify'; +declare const example: FastifyPluginAsync; +export default example; diff --git a/src/icons/dist/routes/set/index.js b/src/icons/dist/routes/set/index.js new file mode 100644 index 0000000..09aca6e --- /dev/null +++ b/src/icons/dist/routes/set/index.js @@ -0,0 +1,33 @@ +import { join } from 'node:path'; +import { open } from 'node:fs/promises'; +import fastifyRawBody from 'fastify-raw-body'; +import sharp from 'sharp'; +const example = async (fastify, opts) => { + await fastify.register(fastifyRawBody, { encoding: false }); + fastify.post('/:userid', { config: { rawBody: true, encoding: false } }, async function (request, reply) { + const userid = request.params['userid']; + if (userid === undefined) { + return await reply.code(403); + } + const image_store = fastify.getDecorator('image_store'); + const image_path = join(image_store, userid); + try { + let img = sharp(request.rawBody); + img.resize({ + height: 512, + width: 512, + fit: 'fill', + }); + const data = await img.png({ compressionLevel: 6 }).toBuffer(); + let image_file = await open(image_path, "w", 0o666); + await image_file.write(data); + await image_file.close(); + } + catch (e) { + fastify.log.error(`Error: ${e}`); + reply.code(400); + return { status: "error", message: e.toString() }; + } + }); +}; +export default example; diff --git a/src/icons/dist/routes/set/index.js.map b/src/icons/dist/routes/set/index.js.map new file mode 100644 index 0000000..8bfe255 --- /dev/null +++ b/src/icons/dist/routes/set/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/routes/set/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AACvC,OAAO,cAAc,MAAM,kBAAkB,CAAA;AAC7C,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,MAAM,OAAO,GAAuB,KAAK,EAAE,OAAO,EAAE,IAAI,EAAiB,EAAE;IAI1E,MAAM,OAAO,CAAC,QAAQ,CAAC,cAAc,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;IAI5D,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,WAAU,OAAO,EAAE,KAAK;QAGrG,MAAM,MAAM,GAAwB,OAAO,CAAC,MAAc,CAAC,QAAQ,CAAC,CAAC;QACrE,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YAC1B,OAAO,MAAM,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC9B,CAAC;QACD,MAAM,WAAW,GAAW,OAAO,CAAC,YAAY,CAAC,aAAa,CAAC,CAAA;QAC/D,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,CAAA;QAC5C,IAAI,CAAC;YACJ,IAAI,GAAG,GAAG,KAAK,CAAC,OAAO,CAAC,OAAiB,CAAC,CAAC;YAC3C,GAAG,CAAC,MAAM,CAAC;gBACV,MAAM,EAAE,GAAG;gBACX,KAAK,EAAE,GAAG;gBACV,GAAG,EAAE,MAAM;aACX,CAAC,CAAA;YACF,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,GAAG,CAAC,EAAE,gBAAgB,EAAE,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAA;YAC9D,IAAI,UAAU,GAAG,MAAM,IAAI,CAAC,UAAU,EAAE,GAAG,EAAE,KAAK,CAAC,CAAA;YACnD,MAAM,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAC7B,MAAM,UAAU,CAAC,KAAK,EAAE,CAAA;QACzB,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YACjB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;YACjC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAChB,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC;QACnD,CAAC;IACF,CAAC,CAAC,CAAA;AACH,CAAC,CAAA;AAED,eAAe,OAAO,CAAA"} \ No newline at end of file diff --git a/src/icons/dist/run.d.ts b/src/icons/dist/run.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/src/icons/dist/run.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/src/icons/dist/run.js b/src/icons/dist/run.js new file mode 100644 index 0000000..c34bcc8 --- /dev/null +++ b/src/icons/dist/run.js @@ -0,0 +1,14 @@ +import fastify from "fastify"; +import app from './app.js'; +const start = async () => { + const f = fastify({ logger: true }); + try { + await f.register(app, {}); + await f.listen({ port: 80, host: '0.0.0.0' }); + } + catch (err) { + f.log.error(err); + process.exit(1); + } +}; +start(); diff --git a/src/icons/dist/run.js.map b/src/icons/dist/run.js.map new file mode 100644 index 0000000..904647e --- /dev/null +++ b/src/icons/dist/run.js.map @@ -0,0 +1 @@ +{"version":3,"file":"run.js","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":"AAEA,OAAO,OAA4B,MAAM,SAAS,CAAC;AACnD,OAAO,GAAG,MAAM,UAAU,CAAA;AAE1B,MAAM,KAAK,GAAG,KAAK,IAAI,EAAE;IACxB,MAAM,CAAC,GAAoB,OAAO,CAAC,EAAC,MAAM,EAAE,IAAI,EAAC,CAAC,CAAC;IACnD,IAAI,CAAC;QACJ,MAAM,CAAC,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QAC1B,MAAM,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAA;IAC9C,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACd,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QAChB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAChB,CAAC;AACF,CAAC,CAAA;AACD,KAAK,EAAE,CAAA"} \ No newline at end of file diff --git a/src/schemas/package.json b/src/schemas/package.json deleted file mode 100644 index 4ab23f9..0000000 --- a/src/schemas/package.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "deadge_schemas", - "version": "1.0.0", - "description": "", - "license": "ISC", - "author": "", - "main": "index.js", - "scripts": {}, - "dependencies": { - "fastify-cli": "^7.4.0" - } -} diff --git a/src/utils/.dockerignore b/src/utils/.dockerignore new file mode 100644 index 0000000..c925c21 --- /dev/null +++ b/src/utils/.dockerignore @@ -0,0 +1,2 @@ +/dist +/node_modules diff --git a/src/db/.gitignore b/src/utils/.gitignore similarity index 100% rename from src/db/.gitignore rename to src/utils/.gitignore diff --git a/src/utils/Dockerfile b/src/utils/Dockerfile new file mode 100644 index 0000000..e9c0e91 --- /dev/null +++ b/src/utils/Dockerfile @@ -0,0 +1,19 @@ +# **************************************************************************** # +# # +# ::: :::::::: # +# Dockerfile :+: :+: :+: # +# +:+ +:+ +:+ # +# By: maiboyer +#+ +:+ +#+ # +# +#+#+#+#+#+ +#+ # +# Created: 2025/06/16 22:41:22 by maiboyer #+# #+# # +# Updated: 2025/06/16 23:06:04 by maiboyer ### ########.fr # +# # +# **************************************************************************** # + +FROM node:24-alpine + +WORKDIR /app +COPY . /app +RUN set -x && npm install && npm run build:ts && mkdir /out && \ + (npm pack | xargs tar xz -C /out -f) +CMD [ "/bin/true" ] diff --git a/src/db/package-lock.json b/src/utils/package-lock.json similarity index 75% rename from src/db/package-lock.json rename to src/utils/package-lock.json index 4e9dcd2..3dc0a1b 100644 --- a/src/db/package-lock.json +++ b/src/utils/package-lock.json @@ -1,18 +1,15 @@ { - "name": "db", + "name": "utils", "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "db", + "name": "utils", "version": "1.0.0", "license": "ISC", "dependencies": { - "@fastify/autoload": "^6.0.0", - "@fastify/sensible": "^6.0.0", "fastify": "^5.0.0", - "fastify-cli": "^7.4.0", "fastify-plugin": "^5.0.0" }, "devDependencies": { @@ -68,38 +65,6 @@ "fast-uri": "^3.0.0" } }, - "node_modules/@fastify/autoload": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@fastify/autoload/-/autoload-6.3.1.tgz", - "integrity": "sha512-0fsG+lO3m5yEZVjXKpltCe+2eHhM6rfAPQhvlGUgLUFTw/N2wA9WqPTObMtrF3oUCUrxbSDv60HlUIoh+aFM1A==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/fastify" - }, - { - "type": "opencollective", - "url": "https://opencollective.com/fastify" - } - ], - "license": "MIT" - }, - "node_modules/@fastify/deepmerge": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@fastify/deepmerge/-/deepmerge-2.0.2.tgz", - "integrity": "sha512-3wuLdX5iiiYeZWP6bQrjqhrcvBIf0NHbQH1Ur1WbHvoiuTYUEItgygea3zs8aHpiitn0lOB8gX20u1qO+FDm7Q==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/fastify" - }, - { - "type": "opencollective", - "url": "https://opencollective.com/fastify" - } - ], - "license": "MIT" - }, "node_modules/@fastify/error": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/@fastify/error/-/error-4.2.0.tgz", @@ -170,31 +135,6 @@ "ipaddr.js": "^2.1.0" } }, - "node_modules/@fastify/sensible": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/@fastify/sensible/-/sensible-6.0.3.tgz", - "integrity": "sha512-Iyn8698hp/e5+v8SNBBruTa7UfrMEP52R16dc9jMpqSyEcPsvWFQo+R6WwHCUnJiLIsuci2ZoEZ7ilrSSCPIVg==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/fastify" - }, - { - "type": "opencollective", - "url": "https://opencollective.com/fastify" - } - ], - "license": "MIT", - "dependencies": { - "@lukeed/ms": "^2.0.2", - "dequal": "^2.0.3", - "fastify-plugin": "^5.0.0", - "forwarded": "^0.2.0", - "http-errors": "^2.0.0", - "type-is": "^1.6.18", - "vary": "^1.1.2" - } - }, "node_modules/@isaacs/cliui": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", @@ -251,15 +191,6 @@ "@jridgewell/sourcemap-codec": "^1.4.10" } }, - "node_modules/@lukeed/ms": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@lukeed/ms/-/ms-2.0.2.tgz", - "integrity": "sha512-9I2Zn6+NJLfaGoz9jN3lpwDgAYvfGeNYdbAIjJOqzs4Tpc+VU3Jqq4IofSUBKajiDS8k9fZIg18/z13mpk1bsA==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/@pkgjs/parseargs": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", @@ -307,9 +238,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "22.15.31", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.15.31.tgz", - "integrity": "sha512-jnVe5ULKl6tijxUhvQeNbQG/84fHfg+yMak02cT8QVhBx/F05rAVxCGBYYTh2EKz22D6JF5ktXuNwdx7b9iEGw==", + "version": "22.15.32", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.15.32.tgz", + "integrity": "sha512-3jigKqgSjsH6gYZv2nEsqdXfZqIFGAV36XYYjf9KGZ3PSG+IhLecqPnI310RvjutyMwifE2hhhNEklOUrvx/wA==", "dev": true, "license": "MIT", "dependencies": { @@ -398,6 +329,7 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, "license": "MIT", "dependencies": { "color-convert": "^2.0.1" @@ -490,6 +422,7 @@ "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", @@ -506,6 +439,7 @@ "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, "license": "MIT", "dependencies": { "has-flag": "^4.0.0" @@ -514,21 +448,6 @@ "node": ">=8" } }, - "node_modules/chokidar": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz", - "integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==", - "license": "MIT", - "dependencies": { - "readdirp": "^4.0.1" - }, - "engines": { - "node": ">= 14.16.0" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, "node_modules/cliui": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", @@ -607,16 +526,11 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, - "node_modules/close-with-grace": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/close-with-grace/-/close-with-grace-2.2.0.tgz", - "integrity": "sha512-OdcFxnxTm/AMLPHA4Aq3J1BLpkojXP7I4G5QBQLN5TT55ED/rk04rAoDbtfNnfZ988kGXPxh1bdRLeIU9bz/lA==", - "license": "MIT" - }, "node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, "license": "MIT", "dependencies": { "color-name": "~1.1.4" @@ -629,18 +543,7 @@ "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "license": "MIT" - }, - "node_modules/colorette": { - "version": "2.0.20", - "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", - "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", - "license": "MIT" - }, - "node_modules/commist": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/commist/-/commist-3.2.0.tgz", - "integrity": "sha512-4PIMoPniho+LqXmpS5d3NuGYncG6XWlkBSVGiWycL22dd42OYdUGil2CWuzklaJoNxyxUSpO4MKIBU94viWNAw==", + "dev": true, "license": "MIT" }, "node_modules/concurrently": { @@ -707,24 +610,6 @@ "node": ">= 8" } }, - "node_modules/dateformat": { - "version": "4.6.3", - "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-4.6.3.tgz", - "integrity": "sha512-2P0p0pFGzHS5EMnhdxQi7aJN+iMheud0UhG4dlE1DLAlvL8JHjJJTX/CSm4JXwV0Ka5nGk3zC5mcb5bUQUxxMA==", - "license": "MIT", - "engines": { - "node": "*" - } - }, - "node_modules/depd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", - "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, "node_modules/dequal": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", @@ -744,18 +629,6 @@ "node": ">=0.3.1" } }, - "node_modules/dotenv": { - "version": "16.5.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.5.0.tgz", - "integrity": "sha512-m/C+AwOAr9/W1UOIZUo232ejMNnJAJtYQjUbHoNTBNTJSvqzzDh7vnrei3o3r3m9blf6ZoDkvcw0VmozNRFJxg==", - "license": "BSD-2-Clause", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://dotenvx.com" - } - }, "node_modules/eastasianwidth": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", @@ -770,15 +643,6 @@ "dev": true, "license": "MIT" }, - "node_modules/end-of-stream": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", - "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "license": "MIT", - "dependencies": { - "once": "^1.4.0" - } - }, "node_modules/escalade": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", @@ -789,12 +653,6 @@ "node": ">=6" } }, - "node_modules/fast-copy": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/fast-copy/-/fast-copy-3.0.2.tgz", - "integrity": "sha512-dl0O9Vhju8IrcLndv2eU4ldt1ftXMqqfgN4H1cpmGV7P6jeB9FwpN9a2c8DPGE1Ys88rNUJVYDHq73CGAGOPfQ==", - "license": "MIT" - }, "node_modules/fast-decode-uri-component": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/fast-decode-uri-component/-/fast-decode-uri-component-1.0.1.tgz", @@ -849,12 +707,6 @@ "node": ">=6" } }, - "node_modules/fast-safe-stringify": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz", - "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==", - "license": "MIT" - }, "node_modules/fast-uri": { "version": "3.0.6", "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.0.6.tgz", @@ -904,33 +756,6 @@ "toad-cache": "^3.7.0" } }, - "node_modules/fastify-cli": { - "version": "7.4.0", - "resolved": "https://registry.npmjs.org/fastify-cli/-/fastify-cli-7.4.0.tgz", - "integrity": "sha512-cAPFRAN59VGYcdwzgDptguCW11haYshKIxb2jVbcvAp8DC1Dca6aPB73uyPjt+qn5HobWPGF04loy+j29AZ6ig==", - "license": "MIT", - "dependencies": { - "@fastify/deepmerge": "^2.0.0", - "chalk": "^4.1.2", - "chokidar": "^4.0.0", - "close-with-grace": "^2.1.0", - "commist": "^3.0.0", - "dotenv": "^16.0.0", - "fastify": "^5.0.0", - "fastify-plugin": "^5.0.0", - "generify": "^4.0.0", - "help-me": "^5.0.0", - "is-docker": "^2.0.0", - "pino-pretty": "^13.0.0", - "pkg-up": "^3.1.0", - "resolve-from": "^5.0.0", - "semver": "^7.3.5", - "yargs-parser": "^21.1.1" - }, - "bin": { - "fastify": "cli.js" - } - }, "node_modules/fastify-plugin": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/fastify-plugin/-/fastify-plugin-5.0.1.tgz", @@ -1014,30 +839,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/forwarded": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", - "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/generify": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/generify/-/generify-4.2.0.tgz", - "integrity": "sha512-b4cVhbPfbgbCZtK0dcUc1lASitXGEAIqukV5DDAyWm25fomWnV+C+a1yXvqikcRZXHN2j0pSDyj3cTfzq8pC7Q==", - "license": "MIT", - "dependencies": { - "isbinaryfile": "^4.0.2", - "pump": "^3.0.0", - "split2": "^3.0.0", - "walker": "^1.0.6" - }, - "bin": { - "generify": "generify.js" - } - }, "node_modules/get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", @@ -1073,17 +874,12 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, "license": "MIT", "engines": { "node": ">=8" } }, - "node_modules/help-me": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/help-me/-/help-me-5.0.0.tgz", - "integrity": "sha512-7xgomUX6ADmcYzFik0HzAxh/73YlKR9bmFzf51CZwR+b6YtzU2m0u49hQCqV6SvlqIqsaxovfwdvbnsw3b/zpg==", - "license": "MIT" - }, "node_modules/html-escaper": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", @@ -1091,28 +887,6 @@ "dev": true, "license": "MIT" }, - "node_modules/http-errors": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", - "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", - "license": "MIT", - "dependencies": { - "depd": "2.0.0", - "inherits": "2.0.4", - "setprototypeof": "1.2.0", - "statuses": "2.0.1", - "toidentifier": "1.0.1" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "license": "ISC" - }, "node_modules/ipaddr.js": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-2.2.0.tgz", @@ -1122,21 +896,6 @@ "node": ">= 10" } }, - "node_modules/is-docker": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", - "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", - "license": "MIT", - "bin": { - "is-docker": "cli.js" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", @@ -1147,18 +906,6 @@ "node": ">=8" } }, - "node_modules/isbinaryfile": { - "version": "4.0.10", - "resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-4.0.10.tgz", - "integrity": "sha512-iHrqe5shvBUcFbmZq9zOQHBoeOhZJu6RQGrDpBgenUm/Am+F3JM2MgQj+rK3Z601fzrL5gLZWtAPH2OBaSVcyw==", - "license": "MIT", - "engines": { - "node": ">= 8.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/gjtorikian/" - } - }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -1234,15 +981,6 @@ "@pkgjs/parseargs": "^0.11.0" } }, - "node_modules/joycon": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/joycon/-/joycon-3.1.1.tgz", - "integrity": "sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==", - "license": "MIT", - "engines": { - "node": ">=10" - } - }, "node_modules/json-schema-ref-resolver": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/json-schema-ref-resolver/-/json-schema-ref-resolver-2.0.1.tgz", @@ -1358,45 +1096,6 @@ "dev": true, "license": "ISC" }, - "node_modules/makeerror": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz", - "integrity": "sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==", - "license": "BSD-3-Clause", - "dependencies": { - "tmpl": "1.0.5" - } - }, - "node_modules/media-typer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "license": "MIT", - "dependencies": { - "mime-db": "1.52.0" - }, - "engines": { - "node": ">= 0.6" - } - }, "node_modules/minimatch": { "version": "9.0.5", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", @@ -1413,15 +1112,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/minimist": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", - "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/minipass": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", @@ -1441,15 +1131,6 @@ "node": ">=14.0.0" } }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "license": "ISC", - "dependencies": { - "wrappy": "1" - } - }, "node_modules/p-limit": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", @@ -1482,15 +1163,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, "node_modules/package-json-from-dist": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", @@ -1566,124 +1238,12 @@ "split2": "^4.0.0" } }, - "node_modules/pino-abstract-transport/node_modules/split2": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz", - "integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==", - "license": "ISC", - "engines": { - "node": ">= 10.x" - } - }, - "node_modules/pino-pretty": { - "version": "13.0.0", - "resolved": "https://registry.npmjs.org/pino-pretty/-/pino-pretty-13.0.0.tgz", - "integrity": "sha512-cQBBIVG3YajgoUjo1FdKVRX6t9XPxwB9lcNJVD5GCnNM4Y6T12YYx8c6zEejxQsU0wrg9TwmDulcE9LR7qcJqA==", - "license": "MIT", - "dependencies": { - "colorette": "^2.0.7", - "dateformat": "^4.6.3", - "fast-copy": "^3.0.2", - "fast-safe-stringify": "^2.1.1", - "help-me": "^5.0.0", - "joycon": "^3.1.1", - "minimist": "^1.2.6", - "on-exit-leak-free": "^2.1.0", - "pino-abstract-transport": "^2.0.0", - "pump": "^3.0.0", - "secure-json-parse": "^2.4.0", - "sonic-boom": "^4.0.1", - "strip-json-comments": "^3.1.1" - }, - "bin": { - "pino-pretty": "bin.js" - } - }, - "node_modules/pino-pretty/node_modules/secure-json-parse": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/secure-json-parse/-/secure-json-parse-2.7.0.tgz", - "integrity": "sha512-6aU+Rwsezw7VR8/nyvKTx8QpWH9FrcYiXXlqC4z5d5XQBDRqtbfsRjnwGyqbi3gddNtWHuEk9OANUotL26qKUw==", - "license": "BSD-3-Clause" - }, "node_modules/pino-std-serializers": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/pino-std-serializers/-/pino-std-serializers-7.0.0.tgz", "integrity": "sha512-e906FRY0+tV27iq4juKzSYPbUj2do2X2JX4EzSca1631EB2QJQUqGbDuERal7LCtOpxl6x3+nvo9NPZcmjkiFA==", "license": "MIT" }, - "node_modules/pkg-up": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/pkg-up/-/pkg-up-3.1.0.tgz", - "integrity": "sha512-nDywThFk1i4BQK4twPQ6TA4RT8bDY96yeuCVBWL3ePARCiEKDRSrNGbFIgUJpLp+XeIR65v8ra7WuJOFUBtkMA==", - "license": "MIT", - "dependencies": { - "find-up": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/pkg-up/node_modules/find-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", - "license": "MIT", - "dependencies": { - "locate-path": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/pkg-up/node_modules/locate-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", - "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", - "license": "MIT", - "dependencies": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/pkg-up/node_modules/p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "license": "MIT", - "dependencies": { - "p-try": "^2.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/pkg-up/node_modules/p-locate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", - "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", - "license": "MIT", - "dependencies": { - "p-limit": "^2.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/pkg-up/node_modules/path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", - "license": "MIT", - "engines": { - "node": ">=4" - } - }, "node_modules/process-warning": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/process-warning/-/process-warning-5.0.0.tgz", @@ -1700,49 +1260,12 @@ ], "license": "MIT" }, - "node_modules/pump": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.2.tgz", - "integrity": "sha512-tUPXtzlGM8FE3P0ZL6DVs/3P58k9nk8/jZeQCurTJylQA8qFYzHFfhBJkuqyE0FifOsQ0uKWekiZ5g8wtr28cw==", - "license": "MIT", - "dependencies": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, "node_modules/quick-format-unescaped": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/quick-format-unescaped/-/quick-format-unescaped-4.0.4.tgz", "integrity": "sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg==", "license": "MIT" }, - "node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "license": "MIT", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/readdirp": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz", - "integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==", - "license": "MIT", - "engines": { - "node": ">= 14.18.0" - }, - "funding": { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - }, "node_modules/real-require": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/real-require/-/real-require-0.2.0.tgz", @@ -1771,15 +1294,6 @@ "node": ">=0.10.0" } }, - "node_modules/resolve-from": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", - "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/ret": { "version": "0.5.0", "resolved": "https://registry.npmjs.org/ret/-/ret-0.5.0.tgz", @@ -1815,26 +1329,6 @@ "tslib": "^2.1.0" } }, - "node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, "node_modules/safe-regex2": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/safe-regex2/-/safe-regex2-5.0.0.tgz", @@ -1897,12 +1391,6 @@ "integrity": "sha512-IOc8uWeOZgnb3ptbCURJWNjWUPcO3ZnTTdzsurqERrP6nPyv+paC55vJM0LpOlT2ne+Ix+9+CRG1MNLlyZ4GjQ==", "license": "MIT" }, - "node_modules/setprototypeof": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", - "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", - "license": "ISC" - }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -1962,30 +1450,12 @@ } }, "node_modules/split2": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/split2/-/split2-3.2.2.tgz", - "integrity": "sha512-9NThjpgZnifTkJpzTZ7Eue85S49QwpNhZTq6GRJwObb6jnLFNGB7Qm73V5HewTROPyxD0C29xqmaI68bQtV+hg==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz", + "integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==", "license": "ISC", - "dependencies": { - "readable-stream": "^3.0.0" - } - }, - "node_modules/statuses": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", - "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", - "license": "MIT", "engines": { - "node": ">= 0.8" - } - }, - "node_modules/string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "license": "MIT", - "dependencies": { - "safe-buffer": "~5.2.0" + "node": ">= 10.x" } }, "node_modules/string-width": { @@ -2092,18 +1562,6 @@ "node": ">=8" } }, - "node_modules/strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", - "license": "MIT", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/supports-color": { "version": "8.1.1", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", @@ -2144,12 +1602,6 @@ "real-require": "^0.2.0" } }, - "node_modules/tmpl": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", - "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==", - "license": "BSD-3-Clause" - }, "node_modules/toad-cache": { "version": "3.7.0", "resolved": "https://registry.npmjs.org/toad-cache/-/toad-cache-3.7.0.tgz", @@ -2159,15 +1611,6 @@ "node": ">=12" } }, - "node_modules/toidentifier": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", - "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", - "license": "MIT", - "engines": { - "node": ">=0.6" - } - }, "node_modules/tree-kill": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", @@ -2229,19 +1672,6 @@ "dev": true, "license": "0BSD" }, - "node_modules/type-is": { - "version": "1.6.18", - "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", - "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", - "license": "MIT", - "dependencies": { - "media-typer": "0.3.0", - "mime-types": "~2.1.24" - }, - "engines": { - "node": ">= 0.6" - } - }, "node_modules/typescript": { "version": "5.8.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz", @@ -2263,12 +1693,6 @@ "dev": true, "license": "MIT" }, - "node_modules/util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", - "license": "MIT" - }, "node_modules/v8-compile-cache-lib": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", @@ -2302,24 +1726,6 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, - "node_modules/vary": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", - "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/walker": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", - "integrity": "sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==", - "license": "Apache-2.0", - "dependencies": { - "makeerror": "1.0.12" - } - }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -2431,12 +1837,6 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "license": "ISC" - }, "node_modules/y18n": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", @@ -2470,6 +1870,7 @@ "version": "21.1.1", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, "license": "ISC", "engines": { "node": ">=12" diff --git a/src/utils/package.json b/src/utils/package.json new file mode 100644 index 0000000..061d2d5 --- /dev/null +++ b/src/utils/package.json @@ -0,0 +1,29 @@ +{ + "type": "module", + "name": "utils", + "version": "1.0.0", + "description": "utils library", + "scripts": { + "build:ts": "tsc -d", + "watch:ts": "tsc -d -w" + }, + "exports": { + ".": "./dist/auth.js" + }, + "main": "./dist/auth.js", + "keywords": [], + "author": "", + "license": "ISC", + "dependencies": { + "fastify": "^5.0.0", + "fastify-plugin": "^5.0.0" + }, + "devDependencies": { + "@types/node": "^22.1.0", + "c8": "^10.1.2", + "concurrently": "^9.0.0", + "fastify-tsconfig": "^3.0.0", + "ts-node": "^10.4.0", + "typescript": "~5.8.2" + } +} diff --git a/src/utils/src/auth.ts b/src/utils/src/auth.ts new file mode 100644 index 0000000..32c1abc --- /dev/null +++ b/src/utils/src/auth.ts @@ -0,0 +1,21 @@ +// ************************************************************************** // +// // +// ::: :::::::: // +// auth.ts :+: :+: :+: // +// +:+ +:+ +:+ // +// By: maiboyer +#+ +:+ +#+ // +// +#+#+#+#+#+ +#+ // +// Created: 2025/06/16 22:02:49 by maiboyer #+# #+# // +// Updated: 2025/06/16 23:07:21 by maiboyer ### ########.fr // +// // +// ************************************************************************** // + +import { FastifyInstance } from 'fastify' + +export default async function( + _fastify: FastifyInstance, + _options: any) { + console.log("inside the plugin !") +} +console.log("hello !") + diff --git a/src/db/tsconfig.json b/src/utils/tsconfig.json similarity index 100% rename from src/db/tsconfig.json rename to src/utils/tsconfig.json