diff --git a/.github/workflows/cd.deploy.stg.yml b/.github/workflows/cd.deploy.stg.yml index 3288f655a..103f9523a 100644 --- a/.github/workflows/cd.deploy.stg.yml +++ b/.github/workflows/cd.deploy.stg.yml @@ -13,15 +13,13 @@ jobs: node-version: "20" os: "ubuntu-latest" - bundle-deploy: + deploy-api: needs: build runs-on: ubuntu-latest env: CI: true STAGE: staging SSH_ADDRESS_STG: ${{ secrets.SSH_ADDRESS_STG }} - CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} DEPLOY_VERSION: ${{ github.ref_type == 'tag' && github.ref_name || format('stg-0.0.0-{0}-{1}-{2}', github.ref_name, github.run_number, github.run_attempt) }} steps: @@ -42,24 +40,73 @@ jobs: with: key: ${{ secrets.SSH_KEY }} known_hosts: ${{ secrets.SSH_KNOWN_HOSTS }} - - name: "Bundle info" + - name: "Generate Bundle info" run: npm run generate:bundle-info $DEPLOY_VERSION stage - - name: "Bundle ./web" - run: npx lerna run bundle:alone --scope @dzcode.io/web - name: "Sentry Release" - run: npm run generate:sentry-release $DEPLOY_VERSION stage ${{ secrets.SENTRY_AUTH_TOKEN }} - - name: "Pre-deploy" - run: npm run pre-deploy + # todo-zm: remove sentry entirely + run: cd ./api && npm run generate:sentry-release $DEPLOY_VERSION stage ${{ secrets.SENTRY_AUTH_TOKEN }} - name: "Deploy" - run: npm run deploy:stg + run: cd ./api && npm run deploy:stg - lighthouse: - needs: bundle-deploy - uses: ./.github/workflows/ci.reusable.lighthouse.yml - with: - serverBaseUrl: "https://lh-stage.dzcode.io" - testBaseUrl: "https://stage.dzcode.io" - stage: "staging" - secrets: - LH_SERVER_TOKEN_STG: ${{ secrets.LH_SERVER_TOKEN_STG }} - LH_SERVER_TOKEN_PRD: ${{ secrets.LH_SERVER_TOKEN_PRD }} + deploy-web-server: + needs: build + runs-on: ubuntu-latest + env: + CI: true + STAGE: staging + DEPLOY_VERSION: ${{ github.ref_type == 'tag' && github.ref_name || format('stg-0.0.0-{0}-{1}-{2}', github.ref_name, github.run_number, github.run_attempt) }} + + steps: + - name: "Git" + uses: actions/checkout@v4 + - name: "Nodejs" + uses: actions/setup-node@v4 + with: + node-version: "20" + cache: "npm" + - run: npm ci + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: build output (ubuntu-latest, 20) + + - name: "Generate Bundle info" + run: npm run generate:bundle-info $DEPLOY_VERSION stage + + - name: "Sentry Release" + # todo-zm: remove sentry entirely + run: cd ./web && npm run generate:sentry-release $DEPLOY_VERSION stage ${{ secrets.SENTRY_AUTH_TOKEN }} + + - name: "Bundle ./web for deployment" + run: | + cd ./web + npm run bundle + npm run pre-deploy + + - name: "Write ./web-server deps into Dockerfile..." + run: | + cd ./web-server + npm run prepare-dockerfile + + - name: Build docker image + run: | + docker buildx build -f web-server.Dockerfile . -t ghcr.io/dzcode-io/stage-dot-dzcode-dot-io-server:latest + env: + DOCKER_BUILDKIT: 1 + + - name: Push docker image + run: | + echo $CR_PAT | docker login ghcr.io -u dzcode-io --password-stdin + docker push ghcr.io/dzcode-io/stage-dot-dzcode-dot-io-server:latest + env: + CR_PAT: ${{ secrets.CR_PAT }} + + - name: install zcluster + run: | + curl -fsSL https://infra.zak-man.com/install.sh | sh + echo "/home/runner/.zcluster/bin" >> $GITHUB_PATH + + - name: Deploy to zcluster + run: zcluster deploy -p stage-dzcode ./docker-compose.stage.yml + env: + ADMIN_AUTH_TOKEN: ${{ secrets.ADMIN_AUTH_TOKEN }} diff --git a/.github/workflows/cd.deploy.yml b/.github/workflows/cd.deploy.yml index cb434cd37..656d1fd03 100644 --- a/.github/workflows/cd.deploy.yml +++ b/.github/workflows/cd.deploy.yml @@ -19,8 +19,6 @@ jobs: CI: true STAGE: production SSH_ADDRESS_PRD: ${{ secrets.SSH_ADDRESS_PRD }} - CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} DEPLOY_VERSION: ${{ github.ref_type == 'tag' && github.ref_name || format('0.0.0-{0}-{1}-{2}', github.ref_name, github.run_number, github.run_attempt) }} steps: diff --git a/.github/workflows/ci.reusable.misc.yml b/.github/workflows/ci.reusable.misc.yml index 9937b381d..2cfbf05c8 100644 --- a/.github/workflows/ci.reusable.misc.yml +++ b/.github/workflows/ci.reusable.misc.yml @@ -27,4 +27,3 @@ jobs: - run: npx lerna run bundle:alone --scope "@dzcode.io/web" - run: npx lerna run generate:sitemap --scope "@dzcode.io/web" - run: npx lerna run generate:htmls --scope "@dzcode.io/web" - - run: npm run --prefix web/cloudflare ts:check diff --git a/.gitignore b/.gitignore index 394464964..9f53a20ce 100644 --- a/.gitignore +++ b/.gitignore @@ -28,11 +28,10 @@ build src/_e2e-test/downloads src/_e2e-test/videos src/_e2e-test/screenshots -cloudflare/public/* -**/cloudflare/public/* **.lighthouseci -.wrangler -**/cloudflare/wrangler.toml + +# web server +web-server/nodemon.json # data data/nodemon.json diff --git a/api/src/digest/cron.ts b/api/src/digest/cron.ts index 9706fe327..0a4110d1a 100644 --- a/api/src/digest/cron.ts +++ b/api/src/digest/cron.ts @@ -19,6 +19,7 @@ import { AIResponseTranslateNameDto, AIResponseTranslateTitleDto } from "./dto"; import { DataProjectEntity } from "src/data/types"; import { RepositoryEntity } from "@dzcode.io/models/dist/repository"; import { BitbucketService } from "src/bitbucket/service"; +import { ConfigService } from "src/config/service"; type RepoInfo = Pick; interface RepoContributor { @@ -56,6 +57,7 @@ export class DigestCron { private readonly tagRepository: TagRepository, private readonly aiService: AIService, private readonly bitbucketService: BitbucketService, + private readonly configService: ConfigService, ) { const SentryCronJob = cron.instrumentCron(CronJob, "DigestCron"); new SentryCronJob( @@ -98,14 +100,14 @@ export class DigestCron { const runId = Math.random().toString(36).slice(2); this.logger.info({ message: `Digest cron started, runId: ${runId}` }); - const projectsFromDataFolder = await this.dataService.listProjects(); - // todo-ZM: make this configurable - // uncomment during development - // const projectsFromDataFolder = (await this.dataService.listProjects()).filter((p) => - // ["Open-listings", "dzcode.io website", "Mishkal", "System Monitor"].includes(p.name), - // ); - // or uncomment to skip the cron - // if (Math.random()) return; + let projectsFromDataFolder = await this.dataService.listProjects(); + + if (this.configService.env().NODE_ENV === "development") { + this.logger.info({ message: `Running in development mode, filtering projects` }); + projectsFromDataFolder = projectsFromDataFolder.filter((p) => + ["Open-listings", "dzcode.io website", "Mishkal", "System Monitor"].includes(p.name), + ); + } const projectTitleSystemPrompt = `user will give you an open-source project name, and you will translate it to Arabic. it may contain non-translatable parts like acronyms, keep them as is.`; diff --git a/data/package.json b/data/package.json index 9efe47634..7451f0c8b 100644 --- a/data/package.json +++ b/data/package.json @@ -3,9 +3,9 @@ "description": "data.dzcode.io code", "version": "6.1.0", "author": { - "email": "contact@zakiii.com", + "email": "zakman.dev@gmail.com", "name": "Zakaria Mansouri", - "url": "https://www.zakiii.com" + "url": "https://zak-man.com" }, "dependencies": { "fs-extra": "^11.2.0", diff --git a/docker-compose.stage.yml b/docker-compose.stage.yml new file mode 100644 index 000000000..0b0dbf1d5 --- /dev/null +++ b/docker-compose.stage.yml @@ -0,0 +1,15 @@ +services: + web: + image: ghcr.io/dzcode-io/stage-dot-dzcode-dot-io-server:latest + pull_policy: always + restart: unless-stopped + environment: + - VIRTUAL_HOST=stage.dzcode.io + - LETSENCRYPT_HOST=stage.dzcode.io + - STAGE=staging + networks: + - main-infra-network + +networks: + main-infra-network: + external: true diff --git a/package-lock.json b/package-lock.json index 712720ea7..46ca1fa6d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "api", "data", "web", - "web/cloudflare" + "web-server" ], "devDependencies": { "@eslint/compat": "^1.1.1", @@ -775,124 +775,13 @@ "dev": true, "license": "MIT" }, - "node_modules/@cloudflare/kv-asset-handler": { - "version": "0.3.4", - "resolved": "https://registry.npmjs.org/@cloudflare/kv-asset-handler/-/kv-asset-handler-0.3.4.tgz", - "integrity": "sha512-YLPHc8yASwjNkmcDMQMY35yiWjoKAKnhUbPRszBRS0YgH+IXtsMp61j+yTcnCE3oO2DgP0U3iejLC8FTtKDC8Q==", - "dev": true, - "license": "MIT OR Apache-2.0", - "dependencies": { - "mime": "^3.0.0" - }, - "engines": { - "node": ">=16.13" - } - }, - "node_modules/@cloudflare/workerd-darwin-64": { - "version": "1.20241022.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20241022.0.tgz", - "integrity": "sha512-1NNYun37myMTgCUiPQEJ0cMal4mKZVTpkD0b2tx9hV70xji+frVJcSK8YVLeUm1P+Rw1d/ct8DMgQuCpsz3Fsw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "Apache-2.0", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=16" - } - }, - "node_modules/@cloudflare/workerd-darwin-arm64": { - "version": "1.20241022.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20241022.0.tgz", - "integrity": "sha512-FOO/0P0U82EsTLTdweNVgw+4VOk5nghExLPLSppdOziq6IR5HVgP44Kmq5LdsUeHUhwUmfOh9hzaTpkNzUqKvw==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "Apache-2.0", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=16" - } - }, - "node_modules/@cloudflare/workerd-linux-64": { - "version": "1.20241022.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20241022.0.tgz", - "integrity": "sha512-RsNc19BQJG9yd+ngnjuDeG9ywZG+7t1L4JeglgceyY5ViMNMKVO7Zpbsu69kXslU9h6xyQG+lrmclg3cBpnhYA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "Apache-2.0", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=16" - } - }, - "node_modules/@cloudflare/workerd-linux-arm64": { - "version": "1.20241022.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20241022.0.tgz", - "integrity": "sha512-x5mUXpKxfsosxcFmcq5DaqLs37PejHYVRsNz1cWI59ma7aC4y4Qn6Tf3i0r9MwQTF/MccP4SjVslMU6m4W7IaA==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "Apache-2.0", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=16" - } - }, - "node_modules/@cloudflare/workerd-windows-64": { - "version": "1.20241022.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20241022.0.tgz", - "integrity": "sha512-eBCClx4szCOgKqOlxxbdNszMqQf3MRG1B9BRIqEM/diDfdR9IrZ8l3FaEm+l9gXgPmS6m1NBn40aWuGBl8UTSw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "Apache-2.0", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=16" - } - }, - "node_modules/@cloudflare/workers-shared": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workers-shared/-/workers-shared-0.7.0.tgz", - "integrity": "sha512-LLQRTqx7lKC7o2eCYMpyc5FXV8d0pUX6r3A+agzhqS9aoR5A6zCPefwQGcvbKx83ozX22ATZcemwxQXn12UofQ==", - "dev": true, - "license": "MIT OR Apache-2.0", - "dependencies": { - "mime": "^3.0.0", - "zod": "^3.22.3" - }, - "engines": { - "node": ">=16.7.0" - } - }, "node_modules/@cloudflare/workers-types": { "version": "4.20241022.0", "resolved": "https://registry.npmjs.org/@cloudflare/workers-types/-/workers-types-4.20241022.0.tgz", "integrity": "sha512-1zOAw5QIDKItzGatzCrEpfLOB1AuMTwVqKmbw9B9eBfCUGRFNfJYMrJxIwcse9EmKahsQt2GruqU00pY/GyXgg==", - "devOptional": true, - "license": "MIT OR Apache-2.0" + "license": "MIT OR Apache-2.0", + "optional": true, + "peer": true }, "node_modules/@colors/colors": { "version": "1.5.0", @@ -1012,10 +901,6 @@ "resolved": "api", "link": true }, - "node_modules/@dzcode.io/cloudflare": { - "resolved": "web/cloudflare", - "link": true - }, "node_modules/@dzcode.io/data": { "resolved": "data", "link": true @@ -1036,6 +921,10 @@ "resolved": "web", "link": true }, + "node_modules/@dzcode.io/web-server": { + "resolved": "web-server", + "link": true + }, "node_modules/@effect/schema": { "version": "0.71.1", "resolved": "https://registry.npmjs.org/@effect/schema/-/schema-0.71.1.tgz", @@ -1527,30 +1416,6 @@ "get-tsconfig": "^4.7.0" } }, - "node_modules/@esbuild-plugins/node-globals-polyfill": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/@esbuild-plugins/node-globals-polyfill/-/node-globals-polyfill-0.2.3.tgz", - "integrity": "sha512-r3MIryXDeXDOZh7ih1l/yE9ZLORCd5e8vWg02azWRGj5SPTuoh69A2AIyn0Z31V/kHBfZ4HgWJ+OK3GTTwLmnw==", - "dev": true, - "license": "ISC", - "peerDependencies": { - "esbuild": "*" - } - }, - "node_modules/@esbuild-plugins/node-modules-polyfill": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/@esbuild-plugins/node-modules-polyfill/-/node-modules-polyfill-0.2.2.tgz", - "integrity": "sha512-LXV7QsWJxRuMYvKbiznh+U1ilIop3g2TeKRzUxOG5X3YITc8JyyTa90BmLwqqv0YnX4v32CSlG+vsziZp9dMvA==", - "dev": true, - "license": "ISC", - "dependencies": { - "escape-string-regexp": "^4.0.0", - "rollup-plugin-node-polyfills": "^0.2.1" - }, - "peerDependencies": { - "esbuild": "*" - } - }, "node_modules/@esbuild/aix-ppc64": { "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.23.1.tgz", @@ -2114,16 +1979,6 @@ "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, - "node_modules/@fastify/busboy": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz", - "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=14" - } - }, "node_modules/@hapi/bourne": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/@hapi/bourne/-/bourne-3.0.0.tgz", @@ -6232,16 +6087,6 @@ "form-data": "^4.0.0" } }, - "node_modules/@types/node-forge": { - "version": "1.3.11", - "resolved": "https://registry.npmjs.org/@types/node-forge/-/node-forge-1.3.11.tgz", - "integrity": "sha512-FQx220y22OKNTqaByeBGqHWYz4cl94tpcxeFdvBo3wjG6XPBuZ0BNgNZRV5J5TFmmcsJ4IzsLkmGRiQbnYsBEQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/normalize-package-data": { "version": "2.4.4", "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.4.tgz", @@ -7423,16 +7268,6 @@ "node": ">=0.10.0" } }, - "node_modules/as-table": { - "version": "1.0.55", - "resolved": "https://registry.npmjs.org/as-table/-/as-table-1.0.55.tgz", - "integrity": "sha512-xvsWESUJn0JN421Xb9MQw6AsMHRCUknCe0Wjlxvjud80mU4E6hQf1A6NzQKcYNmYw62MfzEtXc+badstZP3JpQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "printable-characters": "^1.0.42" - } - }, "node_modules/asn1": { "version": "0.2.6", "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz", @@ -7832,13 +7667,6 @@ "readable-stream": "^3.4.0" } }, - "node_modules/blake3-wasm": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/blake3-wasm/-/blake3-wasm-2.1.5.tgz", - "integrity": "sha512-F1+K8EbfOZE49dtoPtmxUQrpXaBIl3ICvasLh+nJta0xkz+9kF/7uet9fLnwKqhDrmj6g+6K3Tw9yQPUg2ka5g==", - "dev": true, - "license": "MIT" - }, "node_modules/blob-util": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/blob-util/-/blob-util-2.0.2.tgz", @@ -8223,6 +8051,7 @@ "version": "1.0.7", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", + "dev": true, "license": "MIT", "dependencies": { "es-define-property": "^1.0.0", @@ -8238,6 +8067,35 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -8347,17 +8205,6 @@ ], "license": "CC-BY-4.0" }, - "node_modules/capnp-ts": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/capnp-ts/-/capnp-ts-0.7.0.tgz", - "integrity": "sha512-XKxXAC3HVPv7r674zP0VC3RTXz+/JKhfyw94ljvF80yynK6VkTnqE3jMuN8b3dUVmmc43TjyxjW4KTsmB3c86g==", - "dev": true, - "license": "MIT", - "dependencies": { - "debug": "^4.3.1", - "tslib": "^2.2.0" - } - }, "node_modules/caseless": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", @@ -9866,7 +9713,6 @@ "version": "0.7.2", "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", - "devOptional": true, "license": "MIT", "engines": { "node": ">= 0.6" @@ -10727,13 +10573,6 @@ "node": ">=0.10" } }, - "node_modules/data-uri-to-buffer": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-2.0.2.tgz", - "integrity": "sha512-ND9qDTLc6diwj+Xe5cdAgVTbLVdXbtxTJRXRhli8Mowuaan+0EJOtdqJ0QCHNSSPyoXGx9HX2/VMnKeC34AChA==", - "dev": true, - "license": "MIT" - }, "node_modules/data-view-buffer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.1.tgz", @@ -10788,17 +10627,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/date-fns": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-4.1.0.tgz", - "integrity": "sha512-Ukq0owbQXxa/U3EGtsdVBkR1w7KOQ5gIBqdH2hkvknzZPYvBxb/aa6E8L7tmjFtkwZBu3UXBbjIgPo/Ez4xaNg==", - "dev": true, - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/kossnocorp" - } - }, "node_modules/dateformat": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-3.0.3.tgz", @@ -10817,9 +10645,9 @@ "license": "MIT" }, "node_modules/debug": { - "version": "4.3.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", - "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", + "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", "license": "MIT", "dependencies": { "ms": "^2.1.3" @@ -10953,6 +10781,7 @@ "version": "1.1.4", "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "dev": true, "license": "MIT", "dependencies": { "es-define-property": "^1.0.0", @@ -10994,13 +10823,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/defu": { - "version": "6.1.4", - "resolved": "https://registry.npmjs.org/defu/-/defu-6.1.4.tgz", - "integrity": "sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg==", - "dev": true, - "license": "MIT" - }, "node_modules/del": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/del/-/del-7.1.0.tgz", @@ -11884,6 +11706,20 @@ } } }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/duplexer": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz", @@ -12155,13 +11991,10 @@ } }, "node_modules/es-define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", - "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", "license": "MIT", - "dependencies": { - "get-intrinsic": "^1.2.4" - }, "engines": { "node": ">= 0.4" } @@ -12211,10 +12044,9 @@ "peer": true }, "node_modules/es-object-atoms": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.0.0.tgz", - "integrity": "sha512-MZ4iQ6JwHOBQjahnjwaC1ZtIBH+2ohjamzAO3oaHcXYup7qxjF2fixyH+Q71voWHeOkI2q/TnJao/KfXYIZWbw==", - "dev": true, + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", "license": "MIT", "dependencies": { "es-errors": "^1.3.0" @@ -12631,13 +12463,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/estree-walker": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz", - "integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==", - "dev": true, - "license": "MIT" - }, "node_modules/esutils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", @@ -12752,19 +12577,6 @@ "node": ">= 0.8.0" } }, - "node_modules/exit-hook": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/exit-hook/-/exit-hook-2.2.1.tgz", - "integrity": "sha512-eNTPlAD67BmP31LDINZ3U7HSF8l57TxOY2PmBJ1shpCvpnxBF93mWCE8YHBnXs8qiUZJc9WDcWIeC3a2HIAMfw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/expect": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/expect/-/expect-29.7.0.tgz", @@ -13216,6 +13028,23 @@ "node": ">=8" } }, + "node_modules/finalhandler": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.0.tgz", + "integrity": "sha512-/t88Ty3d5JWQbWYgaOGCCYfXRwV1+be02WqYYlL6h0lEiUAMPM8o8qKGO01YIkOHzka2up08wvgYD0mDiI+q3Q==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "on-finished": "^2.4.1", + "parseurl": "^1.3.3", + "statuses": "^2.0.1" + }, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/find-up": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", @@ -13564,16 +13393,21 @@ } }, "node_modules/get-intrinsic": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", - "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", "license": "MIT", "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", "function-bind": "^1.1.2", - "has-proto": "^1.0.1", - "has-symbols": "^1.0.3", - "hasown": "^2.0.0" + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" }, "engines": { "node": ">= 0.4" @@ -13748,15 +13582,17 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/get-source": { - "version": "2.0.12", - "resolved": "https://registry.npmjs.org/get-source/-/get-source-2.0.12.tgz", - "integrity": "sha512-X5+4+iD+HoSeEED+uwrQ07BOQr0kEDFMVqqpBuI+RaZBpBpHCuXxo70bjar6f0b0u/DQJsJ7ssurpP0V60Az+w==", - "dev": true, - "license": "Unlicense", + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", "dependencies": { - "data-uri-to-buffer": "^2.0.0", - "source-map": "^0.6.1" + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" } }, "node_modules/get-stream": { @@ -14253,7 +14089,9 @@ "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", "dev": true, - "license": "BSD-2-Clause" + "license": "BSD-2-Clause", + "optional": true, + "peer": true }, "node_modules/global-dirs": { "version": "3.0.1", @@ -14360,12 +14198,12 @@ } }, "node_modules/gopd": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", - "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", "license": "MIT", - "dependencies": { - "get-intrinsic": "^1.1.3" + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -14440,6 +14278,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "dev": true, "license": "MIT", "dependencies": { "es-define-property": "^1.0.0" @@ -14452,6 +14291,7 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", + "dev": true, "license": "MIT", "engines": { "node": ">= 0.4" @@ -14461,9 +14301,9 @@ } }, "node_modules/has-symbols": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", - "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", "license": "MIT", "engines": { "node": ">= 0.4" @@ -15620,6 +15460,12 @@ "node": ">=0.10.0" } }, + "node_modules/is-promise": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz", + "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==", + "license": "MIT" + }, "node_modules/is-regex": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", @@ -15943,13 +15789,6 @@ "node": ">= 0.4" } }, - "node_modules/itty-time": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/itty-time/-/itty-time-1.0.6.tgz", - "integrity": "sha512-+P8IZaLLBtFv8hCkIjcymZOp4UJ+xW6bSlQsXGqrkmJh7vSiMFSlNne0mCYagEE0N7HDNR5jJBRxwN0oYv61Rw==", - "dev": true, - "license": "MIT" - }, "node_modules/jackspeak": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-4.0.2.tgz", @@ -18138,16 +17977,6 @@ "node": ">=12" } }, - "node_modules/magic-string": { - "version": "0.25.9", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz", - "integrity": "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "sourcemap-codec": "^1.4.8" - } - }, "node_modules/make-dir": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", @@ -18217,9 +18046,18 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/mdast-util-from-markdown": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-2.0.2.tgz", + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/mdast-util-from-markdown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-2.0.2.tgz", "integrity": "sha512-uZhTV/8NBuw0WHkPTrCqDOl0zVe1BIng5ZtHoDk49ME1qqcjYmmLmOf0gELgcRMxN4w2iuIeVso5/6QymSrgmA==", "dev": true, "license": "MIT", @@ -19055,19 +18893,6 @@ "node": ">=8.6" } }, - "node_modules/mime": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz", - "integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==", - "dev": true, - "license": "MIT", - "bin": { - "mime": "cli.js" - }, - "engines": { - "node": ">=10.0.0" - } - }, "node_modules/mime-db": { "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", @@ -19109,33 +18934,6 @@ "node": ">=4" } }, - "node_modules/miniflare": { - "version": "3.20241022.0", - "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-3.20241022.0.tgz", - "integrity": "sha512-x9Fbq1Hmz1f0osIT9Qmj78iX4UpCP2EqlZnA/tzj/3+I49vc3Kq0fNqSSKplcdf6HlCHdL3fOBicmreQF4BUUQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@cspotcode/source-map-support": "0.8.1", - "acorn": "^8.8.0", - "acorn-walk": "^8.2.0", - "capnp-ts": "^0.7.0", - "exit-hook": "^2.2.1", - "glob-to-regexp": "^0.4.1", - "stoppable": "^1.1.0", - "undici": "^5.28.4", - "workerd": "1.20241022.0", - "ws": "^8.17.1", - "youch": "^3.2.2", - "zod": "^3.22.3" - }, - "bin": { - "miniflare": "bootstrap.js" - }, - "engines": { - "node": ">=16.13" - } - }, "node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", @@ -19546,16 +19344,6 @@ "node": ">=8" } }, - "node_modules/mustache": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/mustache/-/mustache-4.2.0.tgz", - "integrity": "sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==", - "dev": true, - "license": "MIT", - "bin": { - "mustache": "bin/mustache" - } - }, "node_modules/mute-stream": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", @@ -19664,16 +19452,6 @@ } } }, - "node_modules/node-forge": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz", - "integrity": "sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==", - "dev": true, - "license": "(BSD-3-Clause OR GPL-2.0)", - "engines": { - "node": ">= 6.13.0" - } - }, "node_modules/node-gyp": { "version": "10.2.0", "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-10.2.0.tgz", @@ -20405,9 +20183,9 @@ } }, "node_modules/object-inspect": { - "version": "1.13.2", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.2.tgz", - "integrity": "sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g==", + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", "license": "MIT", "engines": { "node": ">= 0.4" @@ -20497,13 +20275,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/ohash": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/ohash/-/ohash-1.1.4.tgz", - "integrity": "sha512-FlDryZAahJmEF3VR3w1KogSEdWX3WhA5GPakFx4J81kEAiHyLMpdLLElS8n8dfNadMgAne/MywcvmogzscVt4g==", - "dev": true, - "license": "MIT" - }, "node_modules/on-finished": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", @@ -20529,7 +20300,6 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, "license": "ISC", "dependencies": { "wrappy": "1" @@ -21275,8 +21045,8 @@ "version": "6.3.0", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.3.0.tgz", "integrity": "sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ==", - "devOptional": true, - "license": "MIT" + "license": "MIT", + "optional": true }, "node_modules/path-type": { "version": "4.0.0", @@ -21288,13 +21058,6 @@ "node": ">=8" } }, - "node_modules/pathe": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.2.tgz", - "integrity": "sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==", - "dev": true, - "license": "MIT" - }, "node_modules/pend": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", @@ -22295,13 +22058,6 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/printable-characters": { - "version": "1.0.42", - "resolved": "https://registry.npmjs.org/printable-characters/-/printable-characters-1.0.42.tgz", - "integrity": "sha512-dKp+C4iXWK4vVYZmYSd0KBH5F/h1HoZRsbJ82AVKRO3PEo8L4lBS/vLwhVtpwwuYcoIsVY+1JYKR268yn480uQ==", - "dev": true, - "license": "Unlicense" - }, "node_modules/proc-log": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/proc-log/-/proc-log-4.2.0.tgz", @@ -23568,37 +23324,29 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/rollup-plugin-inject": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rollup-plugin-inject/-/rollup-plugin-inject-3.0.2.tgz", - "integrity": "sha512-ptg9PQwzs3orn4jkgXJ74bfs5vYz1NCZlSQMBUA0wKcGp5i5pA1AO3fOUEte8enhGUC+iapTCzEWw2jEFFUO/w==", - "deprecated": "This package has been deprecated and is no longer maintained. Please use @rollup/plugin-inject.", - "dev": true, - "license": "MIT", - "dependencies": { - "estree-walker": "^0.6.1", - "magic-string": "^0.25.3", - "rollup-pluginutils": "^2.8.1" - } - }, - "node_modules/rollup-plugin-node-polyfills": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/rollup-plugin-node-polyfills/-/rollup-plugin-node-polyfills-0.2.1.tgz", - "integrity": "sha512-4kCrKPTJ6sK4/gLL/U5QzVT8cxJcofO0OU74tnB19F40cmuAKSzH5/siithxlofFEjwvw1YAhPmbvGNA6jEroA==", - "dev": true, + "node_modules/router": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz", + "integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==", "license": "MIT", "dependencies": { - "rollup-plugin-inject": "^3.0.0" + "debug": "^4.4.0", + "depd": "^2.0.0", + "is-promise": "^4.0.0", + "parseurl": "^1.3.3", + "path-to-regexp": "^8.0.0" + }, + "engines": { + "node": ">= 18" } }, - "node_modules/rollup-pluginutils": { - "version": "2.8.2", - "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz", - "integrity": "sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ==", - "dev": true, + "node_modules/router/node_modules/path-to-regexp": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.2.0.tgz", + "integrity": "sha512-TdrF7fW9Rphjq4RjrW0Kp2AW0Ahwu9sRGTkS6bvDi0SCwZlEZYmcfDbEsTz8RVk0EHIS/Vd1bv3JhG+1xZuAyQ==", "license": "MIT", - "dependencies": { - "estree-walker": "^0.6.1" + "engines": { + "node": ">=16" } }, "node_modules/routing-controllers": { @@ -23867,20 +23615,6 @@ "url": "https://opencollective.com/webpack" } }, - "node_modules/selfsigned": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-2.4.1.tgz", - "integrity": "sha512-th5B4L2U+eGLq1TVh7zNRGBapioSORUeymIydxgFpwww9d2qyKvtuPU2jJuHvYAwwqi2Y596QBL3eEqcPEYL8Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node-forge": "^1.3.0", - "node-forge": "^1" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/semver": { "version": "7.6.3", "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", @@ -23991,6 +23725,7 @@ "version": "1.2.2", "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "dev": true, "license": "MIT", "dependencies": { "define-data-property": "^1.1.4", @@ -24083,15 +23818,69 @@ "license": "BSD-2-Clause" }, "node_modules/side-channel": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", - "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", "license": "MIT", "dependencies": { - "call-bind": "^1.0.7", "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.4", - "object-inspect": "^1.13.1" + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" }, "engines": { "node": ">= 0.4" @@ -24336,14 +24125,6 @@ "source-map": "^0.6.0" } }, - "node_modules/sourcemap-codec": { - "version": "1.4.8", - "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", - "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", - "deprecated": "Please use @jridgewell/sourcemap-codec instead", - "dev": true, - "license": "MIT" - }, "node_modules/space-separated-tokens": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz", @@ -24504,17 +24285,6 @@ "dev": true, "license": "MIT" }, - "node_modules/stacktracey": { - "version": "2.1.8", - "resolved": "https://registry.npmjs.org/stacktracey/-/stacktracey-2.1.8.tgz", - "integrity": "sha512-Kpij9riA+UNg7TnphqjH7/CzctQ/owJGNbFkfEeve4Z4uxT5+JapVLFXcsurIfN34gnTWZNJ/f7NMG0E8JDzTw==", - "dev": true, - "license": "Unlicense", - "dependencies": { - "as-table": "^1.0.36", - "get-source": "^2.0.12" - } - }, "node_modules/statuses": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", @@ -24537,17 +24307,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/stoppable": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/stoppable/-/stoppable-1.1.0.tgz", - "integrity": "sha512-KXDYZ9dszj6bzvnEMRYvxgeTHU74QBFL54XKtP3nyMuJ81CFYtABZ3bAzL2EdFUaEwJOBOgENyFj3R7oTzDyyw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4", - "npm": ">=6" - } - }, "node_modules/streamsearch": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", @@ -26591,13 +26350,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/ufo": { - "version": "1.5.4", - "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.5.4.tgz", - "integrity": "sha512-UsUk3byDzKd04EyoZ7U4DOlxQaD14JUKQl6/P7wiX4FNvUfm3XL246n9W5AmqwW5RSFJ27NAuM0iLscAOYUiGQ==", - "dev": true, - "license": "MIT" - }, "node_modules/uglify-js": { "version": "3.19.3", "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.19.3.tgz", @@ -26648,39 +26400,12 @@ "dev": true, "license": "MIT" }, - "node_modules/undici": { - "version": "5.28.4", - "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.4.tgz", - "integrity": "sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@fastify/busboy": "^2.0.0" - }, - "engines": { - "node": ">=14.0" - } - }, "node_modules/undici-types": { "version": "6.19.8", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", "license": "MIT" }, - "node_modules/unenv": { - "name": "unenv-nightly", - "version": "2.0.0-20241018-011344-e666fcf", - "resolved": "https://registry.npmjs.org/unenv-nightly/-/unenv-nightly-2.0.0-20241018-011344-e666fcf.tgz", - "integrity": "sha512-D00bYn8rzkCBOlLx+k1iHQlc69jvtJRT7Eek4yIGQ6461a2tUBjngGZdRpqsoXAJCz/qBW0NgPting7Zvg+ysg==", - "dev": true, - "license": "MIT", - "dependencies": { - "defu": "^6.1.4", - "ohash": "^1.1.4", - "pathe": "^1.1.2", - "ufo": "^1.5.4" - } - }, "node_modules/unicorn-magic": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/unicorn-magic/-/unicorn-magic-0.1.0.tgz", @@ -27529,577 +27254,80 @@ "dev": true, "license": "MIT" }, - "node_modules/workerd": { - "version": "1.20241022.0", - "resolved": "https://registry.npmjs.org/workerd/-/workerd-1.20241022.0.tgz", - "integrity": "sha512-jyGXsgO9DRcJyx6Ovv7gUyDPc3UYC2i/E0p9GFUg6GUzpldw4Y93y9kOmdfsOnKZ3+lY53veSiUniiBPE6Q2NQ==", - "dev": true, - "hasInstallScript": true, - "license": "Apache-2.0", - "bin": { - "workerd": "bin/workerd" + "node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" }, "engines": { - "node": ">=16" + "node": ">=12" }, - "optionalDependencies": { - "@cloudflare/workerd-darwin-64": "1.20241022.0", - "@cloudflare/workerd-darwin-arm64": "1.20241022.0", - "@cloudflare/workerd-linux-64": "1.20241022.0", - "@cloudflare/workerd-linux-arm64": "1.20241022.0", - "@cloudflare/workerd-windows-64": "1.20241022.0" + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, - "node_modules/wrangler": { - "version": "3.83.0", - "resolved": "https://registry.npmjs.org/wrangler/-/wrangler-3.83.0.tgz", - "integrity": "sha512-qDzdUuTngKqmm2OJUZm7Gk4+Hv37F2nNNAHuhIgItEIhxBdOVDsgKmvpd+f41MFxyuGg3fbGWYANHI+0V2Z5yw==", - "dev": true, - "license": "MIT OR Apache-2.0", + "node_modules/wrap-ansi-cjs": { + "name": "wrap-ansi", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "license": "MIT", "dependencies": { - "@cloudflare/kv-asset-handler": "0.3.4", - "@cloudflare/workers-shared": "0.7.0", - "@esbuild-plugins/node-globals-polyfill": "^0.2.3", - "@esbuild-plugins/node-modules-polyfill": "^0.2.2", - "blake3-wasm": "^2.1.5", - "chokidar": "^3.5.3", - "date-fns": "^4.1.0", - "esbuild": "0.17.19", - "itty-time": "^1.0.6", - "miniflare": "3.20241022.0", - "nanoid": "^3.3.3", - "path-to-regexp": "^6.3.0", - "resolve": "^1.22.8", - "resolve.exports": "^2.0.2", - "selfsigned": "^2.0.1", - "source-map": "^0.6.1", - "unenv": "npm:unenv-nightly@2.0.0-20241018-011344-e666fcf", - "workerd": "1.20241022.0", - "xxhash-wasm": "^1.0.1" - }, - "bin": { - "wrangler": "bin/wrangler.js", - "wrangler2": "bin/wrangler.js" + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" }, "engines": { - "node": ">=16.17.0" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" - }, - "peerDependencies": { - "@cloudflare/workers-types": "^4.20241022.0" + "node": ">=10" }, - "peerDependenciesMeta": { - "@cloudflare/workers-types": { - "optional": true - } + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, - "node_modules/wrangler/node_modules/@esbuild/android-arm": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.17.19.tgz", - "integrity": "sha512-rIKddzqhmav7MSmoFCmDIb6e2W57geRsM94gV2l38fzhXMwq7hZoClug9USI2pFRGL06f4IOPHHpFNOkWieR8A==", - "cpu": [ - "arm" - ], - "dev": true, + "node_modules/wrap-ansi-cjs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "license": "MIT" + }, + "node_modules/wrap-ansi-cjs/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", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "license": "MIT", - "optional": true, - "os": [ - "android" - ], "engines": { - "node": ">=12" + "node": ">=8" } }, - "node_modules/wrangler/node_modules/@esbuild/android-arm64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.17.19.tgz", - "integrity": "sha512-KBMWvEZooR7+kzY0BtbTQn0OAYY7CsiydT63pVEaPtVYF0hXbUaOyZog37DKxK7NF3XacBJOpYT4adIJh+avxA==", - "cpu": [ - "arm64" - ], - "dev": true, + "node_modules/wrap-ansi-cjs/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "license": "MIT", - "optional": true, - "os": [ - "android" - ], + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, "engines": { - "node": ">=12" + "node": ">=8" } }, - "node_modules/wrangler/node_modules/@esbuild/android-x64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.17.19.tgz", - "integrity": "sha512-uUTTc4xGNDT7YSArp/zbtmbhO0uEEK9/ETW29Wk1thYUJBz3IVnvgEiEwEa9IeLyvnpKrWK64Utw2bgUmDveww==", - "cpu": [ - "x64" - ], - "dev": true, + "node_modules/wrap-ansi/node_modules/ansi-regex": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", + "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", "license": "MIT", - "optional": true, - "os": [ - "android" - ], "engines": { "node": ">=12" - } - }, - "node_modules/wrangler/node_modules/@esbuild/darwin-arm64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.17.19.tgz", - "integrity": "sha512-80wEoCfF/hFKM6WE1FyBHc9SfUblloAWx6FJkFWTWiCoht9Mc0ARGEM47e67W9rI09YoUxJL68WHfDRYEAvOhg==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/wrangler/node_modules/@esbuild/darwin-x64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.17.19.tgz", - "integrity": "sha512-IJM4JJsLhRYr9xdtLytPLSH9k/oxR3boaUIYiHkAawtwNOXKE8KoU8tMvryogdcT8AU+Bflmh81Xn6Q0vTZbQw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/wrangler/node_modules/@esbuild/freebsd-arm64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.19.tgz", - "integrity": "sha512-pBwbc7DufluUeGdjSU5Si+P3SoMF5DQ/F/UmTSb8HXO80ZEAJmrykPyzo1IfNbAoaqw48YRpv8shwd1NoI0jcQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/wrangler/node_modules/@esbuild/freebsd-x64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.17.19.tgz", - "integrity": "sha512-4lu+n8Wk0XlajEhbEffdy2xy53dpR06SlzvhGByyg36qJw6Kpfk7cp45DR/62aPH9mtJRmIyrXAS5UWBrJT6TQ==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/wrangler/node_modules/@esbuild/linux-arm": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.17.19.tgz", - "integrity": "sha512-cdmT3KxjlOQ/gZ2cjfrQOtmhG4HJs6hhvm3mWSRDPtZ/lP5oe8FWceS10JaSJC13GBd4eH/haHnqf7hhGNLerA==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/wrangler/node_modules/@esbuild/linux-arm64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.17.19.tgz", - "integrity": "sha512-ct1Tg3WGwd3P+oZYqic+YZF4snNl2bsnMKRkb3ozHmnM0dGWuxcPTTntAF6bOP0Sp4x0PjSF+4uHQ1xvxfRKqg==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/wrangler/node_modules/@esbuild/linux-ia32": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.17.19.tgz", - "integrity": "sha512-w4IRhSy1VbsNxHRQpeGCHEmibqdTUx61Vc38APcsRbuVgK0OPEnQ0YD39Brymn96mOx48Y2laBQGqgZ0j9w6SQ==", - "cpu": [ - "ia32" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/wrangler/node_modules/@esbuild/linux-loong64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.17.19.tgz", - "integrity": "sha512-2iAngUbBPMq439a+z//gE+9WBldoMp1s5GWsUSgqHLzLJ9WoZLZhpwWuym0u0u/4XmZ3gpHmzV84PonE+9IIdQ==", - "cpu": [ - "loong64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/wrangler/node_modules/@esbuild/linux-mips64el": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.17.19.tgz", - "integrity": "sha512-LKJltc4LVdMKHsrFe4MGNPp0hqDFA1Wpt3jE1gEyM3nKUvOiO//9PheZZHfYRfYl6AwdTH4aTcXSqBerX0ml4A==", - "cpu": [ - "mips64el" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/wrangler/node_modules/@esbuild/linux-ppc64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.17.19.tgz", - "integrity": "sha512-/c/DGybs95WXNS8y3Ti/ytqETiW7EU44MEKuCAcpPto3YjQbyK3IQVKfF6nbghD7EcLUGl0NbiL5Rt5DMhn5tg==", - "cpu": [ - "ppc64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/wrangler/node_modules/@esbuild/linux-riscv64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.17.19.tgz", - "integrity": "sha512-FC3nUAWhvFoutlhAkgHf8f5HwFWUL6bYdvLc/TTuxKlvLi3+pPzdZiFKSWz/PF30TB1K19SuCxDTI5KcqASJqA==", - "cpu": [ - "riscv64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/wrangler/node_modules/@esbuild/linux-s390x": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.17.19.tgz", - "integrity": "sha512-IbFsFbxMWLuKEbH+7sTkKzL6NJmG2vRyy6K7JJo55w+8xDk7RElYn6xvXtDW8HCfoKBFK69f3pgBJSUSQPr+4Q==", - "cpu": [ - "s390x" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/wrangler/node_modules/@esbuild/linux-x64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.17.19.tgz", - "integrity": "sha512-68ngA9lg2H6zkZcyp22tsVt38mlhWde8l3eJLWkyLrp4HwMUr3c1s/M2t7+kHIhvMjglIBrFpncX1SzMckomGw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/wrangler/node_modules/@esbuild/netbsd-x64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.17.19.tgz", - "integrity": "sha512-CwFq42rXCR8TYIjIfpXCbRX0rp1jo6cPIUPSaWwzbVI4aOfX96OXY8M6KNmtPcg7QjYeDmN+DD0Wp3LaBOLf4Q==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/wrangler/node_modules/@esbuild/openbsd-x64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.17.19.tgz", - "integrity": "sha512-cnq5brJYrSZ2CF6c35eCmviIN3k3RczmHz8eYaVlNasVqsNY+JKohZU5MKmaOI+KkllCdzOKKdPs762VCPC20g==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/wrangler/node_modules/@esbuild/sunos-x64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.17.19.tgz", - "integrity": "sha512-vCRT7yP3zX+bKWFeP/zdS6SqdWB8OIpaRq/mbXQxTGHnIxspRtigpkUcDMlSCOejlHowLqII7K2JKevwyRP2rg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/wrangler/node_modules/@esbuild/win32-arm64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.17.19.tgz", - "integrity": "sha512-yYx+8jwowUstVdorcMdNlzklLYhPxjniHWFKgRqH7IFlUEa0Umu3KuYplf1HUZZ422e3NU9F4LGb+4O0Kdcaag==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/wrangler/node_modules/@esbuild/win32-ia32": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.17.19.tgz", - "integrity": "sha512-eggDKanJszUtCdlVs0RB+h35wNlb5v4TWEkq4vZcmVt5u/HiDZrTXe2bWFQUez3RgNHwx/x4sk5++4NSSicKkw==", - "cpu": [ - "ia32" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/wrangler/node_modules/@esbuild/win32-x64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.17.19.tgz", - "integrity": "sha512-lAhycmKnVOuRYNtRtatQR1LPQf2oYCkRGkSFnseDAKPl8lu5SOsK/e1sXe5a0Pc5kHIHe6P2I/ilntNv2xf3cA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/wrangler/node_modules/esbuild": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.17.19.tgz", - "integrity": "sha512-XQ0jAPFkK/u3LcVRcvVHQcTIqD6E2H1fvZMA5dQPSOWb3suUbWbfbRf94pjc0bNzRYLfIrDRQXr7X+LHIm5oHw==", - "dev": true, - "hasInstallScript": true, - "license": "MIT", - "bin": { - "esbuild": "bin/esbuild" - }, - "engines": { - "node": ">=12" - }, - "optionalDependencies": { - "@esbuild/android-arm": "0.17.19", - "@esbuild/android-arm64": "0.17.19", - "@esbuild/android-x64": "0.17.19", - "@esbuild/darwin-arm64": "0.17.19", - "@esbuild/darwin-x64": "0.17.19", - "@esbuild/freebsd-arm64": "0.17.19", - "@esbuild/freebsd-x64": "0.17.19", - "@esbuild/linux-arm": "0.17.19", - "@esbuild/linux-arm64": "0.17.19", - "@esbuild/linux-ia32": "0.17.19", - "@esbuild/linux-loong64": "0.17.19", - "@esbuild/linux-mips64el": "0.17.19", - "@esbuild/linux-ppc64": "0.17.19", - "@esbuild/linux-riscv64": "0.17.19", - "@esbuild/linux-s390x": "0.17.19", - "@esbuild/linux-x64": "0.17.19", - "@esbuild/netbsd-x64": "0.17.19", - "@esbuild/openbsd-x64": "0.17.19", - "@esbuild/sunos-x64": "0.17.19", - "@esbuild/win32-arm64": "0.17.19", - "@esbuild/win32-ia32": "0.17.19", - "@esbuild/win32-x64": "0.17.19" - } - }, - "node_modules/wrangler/node_modules/resolve": { - "version": "1.22.8", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", - "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", - "dev": true, - "license": "MIT", - "dependencies": { - "is-core-module": "^2.13.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - }, - "bin": { - "resolve": "bin/resolve" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/wrap-ansi": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", - "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", - "license": "MIT", - "dependencies": { - "ansi-styles": "^6.1.0", - "string-width": "^5.0.1", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/wrap-ansi-cjs": { - "name": "wrap-ansi", - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/wrap-ansi-cjs/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "license": "MIT" - }, - "node_modules/wrap-ansi-cjs/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", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/wrap-ansi-cjs/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/wrap-ansi/node_modules/ansi-regex": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", - "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" } }, "node_modules/wrap-ansi/node_modules/ansi-styles": { @@ -28133,7 +27361,6 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true, "license": "ISC" }, "node_modules/write-file-atomic": { @@ -28253,28 +27480,6 @@ "node": ">=6" } }, - "node_modules/ws": { - "version": "8.18.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz", - "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10.0.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": ">=5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, "node_modules/xtend": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", @@ -28284,13 +27489,6 @@ "node": ">=0.4" } }, - "node_modules/xxhash-wasm": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/xxhash-wasm/-/xxhash-wasm-1.0.2.tgz", - "integrity": "sha512-ibF0Or+FivM9lNrg+HGJfVX8WJqgo+kCLDc4vx6xMeTce7Aj+DLttKbxxRR/gNLSAelRc1omAPlJ77N/Jem07A==", - "dev": true, - "license": "MIT" - }, "node_modules/y18n": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", @@ -28423,28 +27621,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/youch": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/youch/-/youch-3.3.4.tgz", - "integrity": "sha512-UeVBXie8cA35DS6+nBkls68xaBBXCye0CNznrhszZjTbRVnJKQuNsyLKBTTL4ln1o1rh2PKtv35twV7irj5SEg==", - "dev": true, - "license": "MIT", - "dependencies": { - "cookie": "^0.7.1", - "mustache": "^4.2.0", - "stacktracey": "^2.1.8" - } - }, - "node_modules/zod": { - "version": "3.23.8", - "resolved": "https://registry.npmjs.org/zod/-/zod-3.23.8.tgz", - "integrity": "sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==", - "dev": true, - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/colinhacks" - } - }, "node_modules/zwitch": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz", @@ -28519,12 +27695,306 @@ }, "engines": { "node": ">=20", - "npm run": ">=1.4.2" + "npm": ">=1.4.2" + } + }, + "web-server": { + "name": "@dzcode.io/web-server", + "version": "1.0.0", + "license": "MIT", + "dependencies": { + "@dzcode.io/api": "*", + "@dzcode.io/models": "*", + "@dzcode.io/utils": "*", + "@dzcode.io/web": "*", + "express": "^5.1.0" + }, + "devDependencies": { + "@types/express": "^5.0.1" + }, + "engines": { + "node": ">=20", + "npm": ">=1.4.2" + } + }, + "web-server/node_modules/@types/express": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@types/express/-/express-5.0.1.tgz", + "integrity": "sha512-UZUw8vjpWFXuDnjFTh7/5c2TWDlQqeXHi6hcN7F2XSVT5P+WmUnnbFS3KA6Jnc6IsEqI2qCVu2bK0R0J4A8ZQQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/body-parser": "*", + "@types/express-serve-static-core": "^5.0.0", + "@types/serve-static": "*" + } + }, + "web-server/node_modules/@types/express-serve-static-core": { + "version": "5.0.6", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-5.0.6.tgz", + "integrity": "sha512-3xhRnjJPkULekpSzgtoNYYcTWgEZkp4myc+Saevii5JPnHNvHMRlBSHDbs7Bh1iPPoVTERHEZXyhyLbMEsExsA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "@types/qs": "*", + "@types/range-parser": "*", + "@types/send": "*" + } + }, + "web-server/node_modules/accepts": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz", + "integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==", + "license": "MIT", + "dependencies": { + "mime-types": "^3.0.0", + "negotiator": "^1.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "web-server/node_modules/body-parser": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.0.tgz", + "integrity": "sha512-02qvAaxv8tp7fBa/mw1ga98OGm+eCbqzJOKoRt70sLmfEEi+jyBYVTDGfCL/k06/4EMk/z01gCe7HoCH/f2LTg==", + "license": "MIT", + "dependencies": { + "bytes": "^3.1.2", + "content-type": "^1.0.5", + "debug": "^4.4.0", + "http-errors": "^2.0.0", + "iconv-lite": "^0.6.3", + "on-finished": "^2.4.1", + "qs": "^6.14.0", + "raw-body": "^3.0.0", + "type-is": "^2.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "web-server/node_modules/content-disposition": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.0.0.tgz", + "integrity": "sha512-Au9nRL8VNUut/XSzbQA38+M78dzP4D+eqg3gfJHMIHHYa3bg067xj1KxMUWj+VULbiZMowKngFFbKczUrNJ1mg==", + "license": "MIT", + "dependencies": { + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "web-server/node_modules/cookie-signature": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz", + "integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==", + "license": "MIT", + "engines": { + "node": ">=6.6.0" + } + }, + "web-server/node_modules/express": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/express/-/express-5.1.0.tgz", + "integrity": "sha512-DT9ck5YIRU+8GYzzU5kT3eHGA5iL+1Zd0EutOmTE9Dtk+Tvuzd23VBU+ec7HPNSTxXYO55gPV/hq4pSBJDjFpA==", + "license": "MIT", + "dependencies": { + "accepts": "^2.0.0", + "body-parser": "^2.2.0", + "content-disposition": "^1.0.0", + "content-type": "^1.0.5", + "cookie": "^0.7.1", + "cookie-signature": "^1.2.1", + "debug": "^4.4.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "finalhandler": "^2.1.0", + "fresh": "^2.0.0", + "http-errors": "^2.0.0", + "merge-descriptors": "^2.0.0", + "mime-types": "^3.0.0", + "on-finished": "^2.4.1", + "once": "^1.4.0", + "parseurl": "^1.3.3", + "proxy-addr": "^2.0.7", + "qs": "^6.14.0", + "range-parser": "^1.2.1", + "router": "^2.2.0", + "send": "^1.1.0", + "serve-static": "^2.2.0", + "statuses": "^2.0.1", + "type-is": "^2.0.1", + "vary": "^1.1.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "web-server/node_modules/fresh": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz", + "integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "web-server/node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "web-server/node_modules/media-typer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz", + "integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "web-server/node_modules/merge-descriptors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz", + "integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "web-server/node_modules/mime-db": { + "version": "1.54.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", + "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "web-server/node_modules/mime-types": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.1.tgz", + "integrity": "sha512-xRc4oEhT6eaBpU1XF7AjpOFD+xQmXNB5OVKwp4tqCuBpHLS/ZbBDrc07mYTDqVMg6PfxUjjNp85O6Cd2Z/5HWA==", + "license": "MIT", + "dependencies": { + "mime-db": "^1.54.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "web-server/node_modules/negotiator": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz", + "integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "web-server/node_modules/qs": { + "version": "6.14.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.14.0.tgz", + "integrity": "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w==", + "license": "BSD-3-Clause", + "dependencies": { + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "web-server/node_modules/raw-body": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.0.tgz", + "integrity": "sha512-RmkhL8CAyCRPXCE28MMH0z2PNWQBNk2Q09ZdxM9IOOXwxwZbN+qbWaatPkdkWIKL2ZVDImrN/pK5HTRz2PcS4g==", + "license": "MIT", + "dependencies": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.6.3", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "web-server/node_modules/send": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/send/-/send-1.2.0.tgz", + "integrity": "sha512-uaW0WwXKpL9blXE2o0bRhoL2EGXIrZxQ2ZQ4mgcfoBxdFmQold+qWsD2jLrfZ0trjKL6vOw0j//eAwcALFjKSw==", + "license": "MIT", + "dependencies": { + "debug": "^4.3.5", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "fresh": "^2.0.0", + "http-errors": "^2.0.0", + "mime-types": "^3.0.1", + "ms": "^2.1.3", + "on-finished": "^2.4.1", + "range-parser": "^1.2.1", + "statuses": "^2.0.1" + }, + "engines": { + "node": ">= 18" + } + }, + "web-server/node_modules/serve-static": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.0.tgz", + "integrity": "sha512-61g9pCh0Vnh7IutZjtLGGpTA355+OPn2TyDv/6ivP2h/AdAVX9azsoxmg2/M6nZeQZNYBEwIcsne1mJd9oQItQ==", + "license": "MIT", + "dependencies": { + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "parseurl": "^1.3.3", + "send": "^1.2.0" + }, + "engines": { + "node": ">= 18" + } + }, + "web-server/node_modules/type-is": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-2.0.1.tgz", + "integrity": "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==", + "license": "MIT", + "dependencies": { + "content-type": "^1.0.5", + "media-typer": "^1.1.0", + "mime-types": "^3.0.0" + }, + "engines": { + "node": ">= 0.6" } }, "web/cloudflare": { "name": "@dzcode.io/cloudflare", "version": "0.0.0", + "extraneous": true, "dependencies": { "@dzcode.io/api": "*", "@dzcode.io/models": "*", @@ -28536,20 +28006,6 @@ "typescript": "^5.6.2", "wrangler": "^3.78.7" } - }, - "web/node_modules/typescript": { - "version": "5.6.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.3.tgz", - "integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==", - "dev": true, - "license": "Apache-2.0", - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } } } } diff --git a/package.json b/package.json index 1b52695bd..52bc01380 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,6 @@ "build:watch": "lerna run build:alone:watch --parallel", "clean": "lerna run clean:alone --stream", "deploy": "lerna run deploy --parallel --stream", - "deploy:stg": "lerna run deploy:stg --parallel --stream", "dev": "echo \"Please run one of these commands:\\n\\nnpm run dev:web\\nnpm run dev:api\\nnpm run dev:all\n\"", "dev:all": "npm-run-all \"build --include-dependencies {@}\" --parallel \"build:watch --include-dependencies {@}\" \"start:dev {@}\" --", "dev:api": "npm run dev:all --scope=@dzcode.io/api", @@ -68,7 +67,6 @@ "e2e:dev": "lerna run e2e:dev --parallel", "e2e:web": "BROWSER=none npm run e2e:all --scope=@dzcode.io/{web,api}", "generate:bundle-info": "lerna run generate:bundle-info --parallel --stream --", - "generate:sentry-release": "lerna run generate:sentry-release --concurrency 1 --stream --", "lint": "npm run build && npm run lint:alone", "lint:alone": "lerna run lint:alone --parallel --stream", "lint:fix": "npm run build && npm run lint:fix:alone", @@ -76,8 +74,7 @@ "lint:staged": "lerna exec --since HEAD --concurrency 1 --stream -- lint-staged && lint-staged", "patch-package": "patch-package --patch-dir packages/tooling/patches", "postinstall": "npm run patch-package && (husky install && husky set .husky/pre-commit \"npm run lint:staged\") || exit 0", - "pre-deploy": "lerna run pre-deploy --parallel --stream", - "prepare": "ts-patch install -s", + "prepare": "ts-patch install -s || exit 0", "start:dev": "lerna run start:dev --parallel --stream", "test": "npm run build && npm run test:alone", "test:alone": "lerna run test:alone --stream", @@ -89,6 +86,6 @@ "api", "data", "web", - "web/cloudflare" + "web-server" ] } diff --git a/packages/models/package.json b/packages/models/package.json index d356f0207..7f95f9f1c 100644 --- a/packages/models/package.json +++ b/packages/models/package.json @@ -3,7 +3,7 @@ "description": "Model definitions", "version": "6.1.0", "author": { - "email": "contact@zakiii.com", + "email": "zakman.dev@gmail.com", "name": "Zakaria Mansouri", "url": "https://zakiii.com/" }, diff --git a/packages/tooling/.prettierignore b/packages/tooling/.prettierignore index 024d5f137..44960f697 100644 --- a/packages/tooling/.prettierignore +++ b/packages/tooling/.prettierignore @@ -30,3 +30,4 @@ nodemon.json *.patch *.sql *.conf +*.Dockerfile diff --git a/packages/tooling/package.json b/packages/tooling/package.json index 99f99f86a..2c99bf2e7 100644 --- a/packages/tooling/package.json +++ b/packages/tooling/package.json @@ -3,7 +3,7 @@ "description": "tooling related files, such as tsconfig.json ...etc", "version": "6.1.0", "author": { - "email": "contact@zakiii.com", + "email": "zakman.dev@gmail.com", "name": "Zakaria Mansouri", "url": "https://zakiii.com/" }, diff --git a/packages/tooling/setup-ts-prune.ts b/packages/tooling/setup-ts-prune.ts index c1c5e201e..363d82288 100644 --- a/packages/tooling/setup-ts-prune.ts +++ b/packages/tooling/setup-ts-prune.ts @@ -3,7 +3,7 @@ import { join } from "path"; console.log("Setting up .ts-prunerc ..."); -const paths = ["node_modules", "coverage", "dist", "oracle-cloud/build", "cloudflare", "bundle"]; +const paths = ["node_modules", "coverage", "dist", "oracle-cloud/build", "bundle"]; const tsPruneJson = { ignore: paths.join("|") }; writeFileSync(join(process.cwd(), ".ts-prunerc"), JSON.stringify(tsPruneJson, null, 2)); diff --git a/packages/tooling/write-dockerfile.ts b/packages/tooling/write-dockerfile.ts new file mode 100644 index 000000000..c40a62c2e --- /dev/null +++ b/packages/tooling/write-dockerfile.ts @@ -0,0 +1,39 @@ +import { execSync } from "child_process"; +import { existsSync, readFileSync, writeFileSync } from "fs"; +import { join } from "path"; + +const workspaceRoot = join(__dirname, "../.."); +const dockerFilePath = join(workspaceRoot, "web-server.Dockerfile"); + +console.log(`writing ${dockerFilePath} ...`); + +const stdout = execSync( + `lerna list --include-dependencies --json --all --loglevel silent --scope @dzcode.io/web-server`, +); +const dependencies = JSON.parse(stdout.toString()) as Array<{ name: string; location: string }>; +const subPaths = ["dist", "bundle", "package.json"]; +const directoriesToCopy = dependencies + .map(({ location }) => location) + .reduce>( + (pV, location) => [...pV, ...subPaths.map((subPath) => join(location, subPath))], + [], + ) + .filter((location) => existsSync(location)); + +const dockerfileContent = readFileSync(dockerFilePath, { encoding: "utf-8" }); +const newContent = directoriesToCopy + .map((dir) => { + const relativePath = dir.replace(workspaceRoot, ".").replace(/\\/g, "/"); + return `COPY ${relativePath} ${relativePath}`; + }) + .join("\n"); + +const newDockerfileContent = dockerfileContent.replace( + /# AUTO_GEN[\s\S]*?# AUTO_GEN_END/, + `# AUTO_GEN +${newContent} +# AUTO_GEN_END`, +); +writeFileSync(dockerFilePath, newDockerfileContent); + +console.log("Done writing Dockerfile"); diff --git a/packages/utils/package.json b/packages/utils/package.json index 67228d5b0..ab32b4572 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -3,7 +3,7 @@ "description": "utility functions and types", "version": "6.1.0", "author": { - "email": "contact@zakiii.com", + "email": "zakman.dev@gmail.com", "name": "Zakaria Mansouri", "url": "https://zakiii.com/" }, diff --git a/scripts/deploy.rs b/scripts/deploy.rs new file mode 100755 index 000000000..075a7badf --- /dev/null +++ b/scripts/deploy.rs @@ -0,0 +1,85 @@ +#!/usr/bin/env RUST_BACKTRACE=1 cargo +nightly -Zscript + +--- +package.edition = "2024" + +[dependencies] +cli-run = { git = "https://github.com/zibanpirate/cli-rs.git" } +clap = { version = "4", features = ["derive"] } +--- + +use clap::Parser; + +#[derive(Clone, Debug, clap::ValueEnum)] +enum Env { + Stage, + Prod, +} + +/// Deploy dzcode to stage or prod +#[derive(Parser, Debug)] +struct Args { + /// Environment to deploy to + #[arg(short, long, value_enum)] + env: Env, +} + +fn main() { + + let args = Args::parse(); + let env = args.env; + + println!("Ensuring docker is running ..."); + cli_run::cli_run("docker", vec!["ps"]); + + println!("Building ./web-server ..."); + cli_run::cli_run("npm", vec!["run", "clean"]); + cli_run::cli_run("npm", vec!["run", "bundle", "--workspace=@dzcode.io/web"]); + cli_run::cli_run("npm", vec!["run", "pre-deploy", "--workspace=@dzcode.io/web"]); + cli_run::cli_run("npm", vec!["run", "build", "--workspace=@dzcode.io/web-server"]); + + println!("Writing ./web-server deps into Dockerfile..."); + cli_run::cli_run("npm", vec!["run", "prepare-dockerfile", "--workspace=@dzcode.io/web-server"]); + + println!("Building docker image ..."); + let env_str = format!("{:?}", env).to_lowercase(); + cli_run::cli_run( + "docker", + vec![ + "buildx", + "build", + "-f", + "web-server.Dockerfile", + ".", + "-t", + &format!("ghcr.io/dzcode-io/{}-dot-dzcode-dot-io-server:latest", env_str), + ], + ); + + println!("Logging in to GitHub Container Registry ..."); + let gh_token = std::env::var("DOCKER_REGISTRY_PASSWORD") + .expect("DOCKER_REGISTRY_PASSWORD environment variable not set"); + cli_run::cli_run( + "docker", + vec![ + "login", + "ghcr.io", + "-u", + "dzcode-io", + "--password", + &gh_token, + ], + ); + + println!("Pushing docker image ..."); + cli_run::cli_run( + "docker", + vec!["push", &format!("ghcr.io/dzcode-io/{}-dot-dzcode-dot-io-server:latest", env_str)], + ); + + println!("Deploying to zcluster ..."); + cli_run::cli_run( + "zcluster", + vec!["deploy", "-p", &format!("{}-dzcode", env_str), &format!("./docker-compose.{}.yml", env_str)], + ); +} diff --git a/web-server.Dockerfile b/web-server.Dockerfile new file mode 100644 index 000000000..ae5fc9a5b --- /dev/null +++ b/web-server.Dockerfile @@ -0,0 +1,28 @@ +FROM --platform=linux/amd64 node:22 + +WORKDIR /usr/src/repo + +COPY ./package.json ./package.json + +# AUTO_GEN +COPY ./web-server/dist ./web-server/dist +COPY ./web-server/package.json ./web-server/package.json +COPY ./api/dist ./api/dist +COPY ./api/package.json ./api/package.json +COPY ./packages/models/dist ./packages/models/dist +COPY ./packages/models/package.json ./packages/models/package.json +COPY ./packages/utils/dist ./packages/utils/dist +COPY ./packages/utils/package.json ./packages/utils/package.json +COPY ./web/dist ./web/dist +COPY ./web/bundle ./web/bundle +COPY ./web/package.json ./web/package.json +COPY ./packages/tooling/package.json ./packages/tooling/package.json +COPY ./data/dist ./data/dist +COPY ./data/package.json ./data/package.json +# AUTO_GEN_END + +RUN npm install --install-strategy=nested --omit=dev --workspace=@dzcode.io/web-server + +ENV PORT=80 +WORKDIR /usr/src/repo/web-server +CMD [ "npm", "run", "start" ] diff --git a/web-server/_global.d.ts b/web-server/_global.d.ts new file mode 100644 index 000000000..c879b3011 --- /dev/null +++ b/web-server/_global.d.ts @@ -0,0 +1,11 @@ +/// + +import { Environment } from "@dzcode.io/utils/dist/config/environment"; + +declare global { + namespace NodeJS { + interface ProcessEnv { + STAGE: Environment; + } + } +} diff --git a/web-server/package.json b/web-server/package.json new file mode 100644 index 000000000..bb99b77c4 --- /dev/null +++ b/web-server/package.json @@ -0,0 +1,57 @@ +{ + "name": "@dzcode.io/web-server", + "description": "www.dzcode.io server code", + "version": "1.0.0", + "author": { + "email": "zakman.dev@gmail.com", + "name": "Zakaria Mansouri", + "url": "https://zak-man.com" + }, + "dependencies": { + "@dzcode.io/api": "*", + "@dzcode.io/models": "*", + "@dzcode.io/utils": "*", + "@dzcode.io/web": "*", + "express": "^5.1.0" + }, + "devDependencies": { + "@types/express": "^5.0.1" + }, + "engines": { + "node": ">=20", + "npm": ">=1.4.2" + }, + "license": "MIT", + "lint-staged": { + "*.*": [ + "npm run lint:eslint --fix", + "npm run lint:prettier -- --write" + ] + }, + "private": true, + "repository": { + "type": "git", + "repository": "https://github.com/dzcode-io/dzcode.io.git" + }, + "scripts": { + "build": "lerna run build:alone --scope=@dzcode.io/web-server --include-dependencies --stream", + "build:alone": "tspc", + "build:alone:watch": "tspc --watch --preserveWatchOutput", + "build:watch": "lerna run build:alone:watch --scope=@dzcode.io/web-server --include-dependencies --parallel", + "clean": "lerna run clean:alone --scope=@dzcode.io/web-server --include-dependencies --stream", + "clean:alone": "del dist coverage node_modules/.cache", + "lint": "npm run build && npm run lint:alone", + "lint:alone": "npm run lint:eslint . && npm run lint:prettier -- --check . && npm run lint:tsc && npm run lint:ts-prune", + "lint:eslint": "eslint --config ../packages/tooling/eslint.config.mjs", + "lint:fix": "npm run build && npm run lint:fix:alone", + "lint:fix:alone": "npm run lint:eslint --fix . && npm run lint:prettier -- --write .", + "lint:prettier": "prettier --config ../packages/tooling/.prettierrc --ignore-path ../packages/tooling/.prettierignore --log-level warn", + "lint:ts-prune": "tsx ../packages/tooling/setup-ts-prune.ts && ts-prune --error", + "lint:tsc": "tsc --noEmit", + "prepare-dockerfile": "tsx ../packages/tooling/write-dockerfile.ts", + "prepare-web": "lerna run bundle --scope=@dzcode.io/web --include-dependencies --stream && lerna run pre-deploy --scope=@dzcode.io/web --include-dependencies --stream", + "start": "node dist/app/index.js", + "start:dev": "npm run prepare-web && tsx ../packages/tooling/nodemon.ts \"@dzcode.io/web-server\" && npm run start:nodemon", + "start:nodemon": "nodemon dist/app/index.js" + } +} diff --git a/web-server/src/app/index.ts b/web-server/src/app/index.ts new file mode 100644 index 000000000..a0c27991e --- /dev/null +++ b/web-server/src/app/index.ts @@ -0,0 +1,66 @@ +import express from "express"; +import { renderContributionPage } from "src/handler/contribution"; +import { renderContributorPage } from "src/handler/contributor"; +import { renderProjectPage } from "src/handler/project"; +import { generateContributionsSitemap } from "src/handler/sitemap/contributions"; +import { generateContributorsSitemap } from "src/handler/sitemap/contributors"; +import { generateProjectsSitemap } from "src/handler/sitemap/projects"; +import { validateLangOrDefault } from "src/utils/languages"; +import { indexPath, staticPath } from "src/utils/paths"; + +const app = express(); +const port = process.env.PORT || 6060; + +app.get("/w/contributions-sitemap.xml", async (req, res) => { + const xml = await generateContributionsSitemap(); + res.setHeader("Content-Type", "application/xml; charset=utf-8"); + res.status(200).send(xml); +}); + +app.get("/w/contributors-sitemap.xml", async (req, res) => { + const xml = await generateContributorsSitemap(); + res.setHeader("Content-Type", "application/xml; charset=utf-8"); + res.status(200).send(xml); +}); + +app.get("/w/projects-sitemap.xml", async (req, res) => { + const xml = await generateProjectsSitemap(); + res.setHeader("Content-Type", "application/xml; charset=utf-8"); + res.status(200).send(xml); +}); + +app.get(/^\/(?:([a-z]{2})\/)?projects\/(.*)$/, (req, res) => { + const lang = validateLangOrDefault(req.params[0]); + const projectId = req.params[1]; + + renderProjectPage(res, lang, projectId); +}); + +app.get(/^\/(?:([a-z]{2})\/)?contribute\/(.*)$/, (req, res) => { + const lang = validateLangOrDefault(req.params[0]); + const contributionId = req.params[1].split("-").slice(-2).join("-"); + + renderContributionPage(res, lang, contributionId); +}); + +app.get(/^\/(?:([a-z]{2})\/)?team\/(.*)$/, (req, res) => { + const lang = validateLangOrDefault(req.params[0]); + const contributorId = req.params[1]; + + renderContributorPage(res, lang, contributorId); +}); + +app.use(express.static(staticPath)); + +app.use((req, res) => { + res.sendFile(indexPath); +}); + +app + .listen(port, () => { + console.log(`Web Server running at http://localhost:${port}`); + }) + .on("error", (err) => { + console.log(`Failed to start server: ${err.message}`); + process.exit(1); + }); diff --git a/web-server/src/handler/contribution.ts b/web-server/src/handler/contribution.ts new file mode 100644 index 000000000..86118dc73 --- /dev/null +++ b/web-server/src/handler/contribution.ts @@ -0,0 +1,43 @@ +import { Language } from "@dzcode.io/models/dist/language"; +import { Response } from "express"; +import { plainLocalize } from "@dzcode.io/web/dist/components/locale/utils"; +import { dictionary, AllDictionaryKeys } from "@dzcode.io/web/dist/components/locale/dictionary"; +import { fetchV2Factory } from "@dzcode.io/utils/dist/fetch/factory"; +import { Endpoints } from "@dzcode.io/api/dist/app/endpoints"; +import { fullstackConfig } from "src/utils/config"; +import { getContributionURL } from "@dzcode.io/web/dist/utils/contribution"; +import { templateContent } from "./templates"; +import { notFoundPath } from "src/utils/paths"; + +export const renderContributionPage = async ( + res: Response, + lang: Language, + contributionId: string, +) => { + const localize = (key: AllDictionaryKeys) => + plainLocalize(dictionary, lang.code, key, "NO-TRANSLATION"); + const fetchV2 = fetchV2Factory(fullstackConfig, lang.code); + + try { + const { contribution } = await fetchV2("api:contributions/:id/title", { + params: { id: contributionId }, + }); + const pageTitle = `${localize("contribution-title-pre")} ${contribution.title} ${localize("contribution-title-post")}`; + + const newData = templateContent + .replace(/{{template-title}}/g, pageTitle) + .replace(/{{template-description}}/g, localize("contribute-description")) + .replace(/{{template-lang}}/g, lang.code) + .replace( + /{{template-canonical}}/g, + getContributionURL({ id: contributionId, title: contribution.title }, lang), + ); + + res.setHeader("Content-Type", "text/html; charset=utf-8"); + res.status(200).send(newData); + } catch (error) { + // @TODO-ZM: log error to loki + console.error(error); + res.status(404).sendFile(notFoundPath); + } +}; diff --git a/web-server/src/handler/contributor.ts b/web-server/src/handler/contributor.ts new file mode 100644 index 000000000..a14a8ca3b --- /dev/null +++ b/web-server/src/handler/contributor.ts @@ -0,0 +1,40 @@ +import { Language } from "@dzcode.io/models/dist/language"; +import { Response } from "express"; +import { plainLocalize } from "@dzcode.io/web/dist/components/locale/utils"; +import { dictionary, AllDictionaryKeys } from "@dzcode.io/web/dist/components/locale/dictionary"; +import { fetchV2Factory } from "@dzcode.io/utils/dist/fetch/factory"; +import { Endpoints } from "@dzcode.io/api/dist/app/endpoints"; +import { fullstackConfig } from "src/utils/config"; +import { getContributorURL } from "@dzcode.io/web/dist/utils/contributor"; +import { templateContent } from "./templates"; +import { notFoundPath } from "src/utils/paths"; + +export const renderContributorPage = async ( + res: Response, + lang: Language, + contributorId: string, +) => { + const localize = (key: AllDictionaryKeys) => + plainLocalize(dictionary, lang.code, key, "NO-TRANSLATION"); + const fetchV2 = fetchV2Factory(fullstackConfig, lang.code); + + try { + const { contributor } = await fetchV2("api:contributors/:id/name", { + params: { id: contributorId }, + }); + const pageTitle = `${localize("contributor-title-pre")} ${contributor.name} ${localize("contributor-title-post")}`; + + const newData = templateContent + .replace(/{{template-title}}/g, pageTitle) + .replace(/{{template-description}}/g, localize("team-description")) + .replace(/{{template-lang}}/g, lang.code) + .replace(/{{template-canonical}}/g, getContributorURL({ id: contributorId }, lang)); + + res.setHeader("Content-Type", "text/html; charset=utf-8"); + res.status(200).send(newData); + } catch (error) { + // @TODO-ZM: log error to loki + console.error(error); + res.status(404).sendFile(notFoundPath); + } +}; diff --git a/web-server/src/handler/project.ts b/web-server/src/handler/project.ts new file mode 100644 index 000000000..cdcf9042c --- /dev/null +++ b/web-server/src/handler/project.ts @@ -0,0 +1,34 @@ +import { Language } from "@dzcode.io/models/dist/language"; +import { Response } from "express"; +import { plainLocalize } from "@dzcode.io/web/dist/components/locale/utils"; +import { dictionary, AllDictionaryKeys } from "@dzcode.io/web/dist/components/locale/dictionary"; +import { fetchV2Factory } from "@dzcode.io/utils/dist/fetch/factory"; +import { Endpoints } from "@dzcode.io/api/dist/app/endpoints"; +import { fullstackConfig } from "src/utils/config"; +import { getProjectURL } from "@dzcode.io/web/dist/utils/project"; +import { templateContent } from "./templates"; +import { notFoundPath } from "src/utils/paths"; + +export const renderProjectPage = async (res: Response, lang: Language, projectId: string) => { + const localize = (key: AllDictionaryKeys) => + plainLocalize(dictionary, lang.code, key, "NO-TRANSLATION"); + const fetchV2 = fetchV2Factory(fullstackConfig, lang.code); + + try { + const { project } = await fetchV2("api:projects/:id/name", { params: { id: projectId } }); + const pageTitle = `${localize("project-title-pre")} ${project.name} ${localize("project-title-post")}`; + + const newData = templateContent + .replace(/{{template-title}}/g, pageTitle) + .replace(/{{template-description}}/g, localize("projects-description")) + .replace(/{{template-lang}}/g, lang.code) + .replace(/{{template-canonical}}/g, getProjectURL({ id: projectId }, lang)); + + res.setHeader("Content-Type", "text/html; charset=utf-8"); + res.status(200).send(newData); + } catch (error) { + // @TODO-ZM: log error to loki + console.error(error); + res.status(404).sendFile(notFoundPath); + } +}; diff --git a/web-server/src/handler/sitemap/contributions.ts b/web-server/src/handler/sitemap/contributions.ts new file mode 100644 index 000000000..51a224077 --- /dev/null +++ b/web-server/src/handler/sitemap/contributions.ts @@ -0,0 +1,22 @@ +import { LANGUAGES } from "@dzcode.io/models/dist/language"; +import { fullstackConfig } from "src/utils/config"; +import { fetchV2Factory } from "@dzcode.io/utils/dist/fetch/factory"; +import { Endpoints } from "@dzcode.io/api/dist/app/endpoints"; +import { getContributionURL } from "@dzcode.io/web/dist/utils/contribution"; +import { generateXmlSitemap, SiteMapLink } from "./generate-xml-sitemap"; + +export const generateContributionsSitemap = async () => { + const links: SiteMapLink[] = []; + for (const lang of LANGUAGES) { + const fetchV2 = fetchV2Factory(fullstackConfig, lang.code); + const { contributions } = await fetchV2("api:contributions/for-sitemap", {}); + for (const contribution of contributions) { + links.push({ + url: `${lang.baseUrl}${getContributionURL(contribution)}`, + lang: lang.code, + }); + } + } + + return generateXmlSitemap(links, fullstackConfig.web.url); +}; diff --git a/web-server/src/handler/sitemap/contributors.ts b/web-server/src/handler/sitemap/contributors.ts new file mode 100644 index 000000000..85ede59db --- /dev/null +++ b/web-server/src/handler/sitemap/contributors.ts @@ -0,0 +1,22 @@ +import { LANGUAGES } from "@dzcode.io/models/dist/language"; +import { fullstackConfig } from "src/utils/config"; +import { fetchV2Factory } from "@dzcode.io/utils/dist/fetch/factory"; +import { Endpoints } from "@dzcode.io/api/dist/app/endpoints"; +import { getContributorURL } from "@dzcode.io/web/dist/utils/contributor"; +import { generateXmlSitemap, SiteMapLink } from "./generate-xml-sitemap"; + +export const generateContributorsSitemap = async () => { + const links: SiteMapLink[] = []; + for (const lang of LANGUAGES) { + const fetchV2 = fetchV2Factory(fullstackConfig, lang.code); + const { contributors } = await fetchV2("api:contributors/for-sitemap", {}); + for (const contributor of contributors) { + links.push({ + url: `${lang.baseUrl}${getContributorURL(contributor)}`, + lang: lang.code, + }); + } + } + + return generateXmlSitemap(links, fullstackConfig.web.url); +}; diff --git a/web-server/src/handler/sitemap/generate-xml-sitemap.ts b/web-server/src/handler/sitemap/generate-xml-sitemap.ts new file mode 100644 index 000000000..b0d2a2c06 --- /dev/null +++ b/web-server/src/handler/sitemap/generate-xml-sitemap.ts @@ -0,0 +1,38 @@ +import { LanguageCode } from "@dzcode.io/utils/dist/language"; + +export interface SiteMapLink { + url: string; + lang: LanguageCode; +} + +function xmlEscape(s: string) { + return s.replace( + /[<>&"']/g, + (c) => ({ "<": "<", ">": ">", "&": "&", '"': """, "'": "'" })[c] as string, + ); +} + +export function generateXmlSitemap( + links: Array<{ url: string; lang: LanguageCode }>, + hostname: string, +) { + const xml = ` + + ${links + .map((link) => { + const escapedUrl = xmlEscape(link.url); + return ` + + ${hostname}${escapedUrl} + + `; + }) + .join("")} +`; + + return xml; +} diff --git a/web-server/src/handler/sitemap/projects.ts b/web-server/src/handler/sitemap/projects.ts new file mode 100644 index 000000000..c8415b71f --- /dev/null +++ b/web-server/src/handler/sitemap/projects.ts @@ -0,0 +1,22 @@ +import { LANGUAGES } from "@dzcode.io/models/dist/language"; +import { fullstackConfig } from "src/utils/config"; +import { fetchV2Factory } from "@dzcode.io/utils/dist/fetch/factory"; +import { Endpoints } from "@dzcode.io/api/dist/app/endpoints"; +import { getProjectURL } from "@dzcode.io/web/dist/utils/project"; +import { generateXmlSitemap, SiteMapLink } from "./generate-xml-sitemap"; + +export const generateProjectsSitemap = async () => { + const links: SiteMapLink[] = []; + for (const lang of LANGUAGES) { + const fetchV2 = fetchV2Factory(fullstackConfig, lang.code); + const { projects } = await fetchV2("api:projects/for-sitemap", {}); + for (const project of projects) { + links.push({ + url: `${lang.baseUrl}${getProjectURL(project)}`, + lang: lang.code, + }); + } + } + + return generateXmlSitemap(links, fullstackConfig.web.url); +}; diff --git a/web-server/src/handler/templates.ts b/web-server/src/handler/templates.ts new file mode 100644 index 000000000..9fa4470a9 --- /dev/null +++ b/web-server/src/handler/templates.ts @@ -0,0 +1,4 @@ +import { readFileSync } from "fs"; +import { templatePath } from "src/utils/paths"; + +export const templateContent = Object.freeze(readFileSync(templatePath, "utf-8")); diff --git a/web-server/src/utils/config.ts b/web-server/src/utils/config.ts new file mode 100644 index 000000000..ae9c306c9 --- /dev/null +++ b/web-server/src/utils/config.ts @@ -0,0 +1,4 @@ +import { fsConfig } from "@dzcode.io/utils/dist/config"; +import { getEnv } from "./environment"; + +export const fullstackConfig = fsConfig(getEnv()); diff --git a/web-server/src/utils/environment.ts b/web-server/src/utils/environment.ts new file mode 100644 index 000000000..31510b144 --- /dev/null +++ b/web-server/src/utils/environment.ts @@ -0,0 +1,11 @@ +import { environments } from "@dzcode.io/utils/dist/config/environment"; + +export const getEnv = () => { + let stage = process.env.STAGE; + if (!environments.includes(stage)) { + console.log(`No STAGE provided, falling back to "development"`); + stage = "development"; + } + + return stage; +}; diff --git a/web-server/src/utils/languages.ts b/web-server/src/utils/languages.ts new file mode 100644 index 000000000..ea894413d --- /dev/null +++ b/web-server/src/utils/languages.ts @@ -0,0 +1,5 @@ +import { LANGUAGES, DEFAULT_LANGUAGE } from "@dzcode.io/models/dist/language"; + +export const validateLangOrDefault = (lang: string) => { + return LANGUAGES.find((l) => l.code === lang) ?? DEFAULT_LANGUAGE; +}; diff --git a/web-server/src/utils/paths.ts b/web-server/src/utils/paths.ts new file mode 100644 index 000000000..b2a9582fa --- /dev/null +++ b/web-server/src/utils/paths.ts @@ -0,0 +1,6 @@ +import { join } from "path"; + +export const staticPath = join(__dirname, "../../../web/bundle"); +export const indexPath = join(staticPath, "index.html"); +export const templatePath = join(staticPath, "template.html"); +export const notFoundPath = join(staticPath, "404.html"); diff --git a/web-server/tsconfig.json b/web-server/tsconfig.json new file mode 100644 index 000000000..61d078fc1 --- /dev/null +++ b/web-server/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../packages/tooling/tsconfig.json", + "compilerOptions": { + "outDir": "dist", + "baseUrl": "." + }, + "include": ["src", "_global.d.ts"] +} diff --git a/web/cloudflare/functions/ar/contribute/[slug].ts b/web/cloudflare/functions/ar/contribute/[slug].ts deleted file mode 100644 index b006b233e..000000000 --- a/web/cloudflare/functions/ar/contribute/[slug].ts +++ /dev/null @@ -1,3 +0,0 @@ -import { Env, handleContributionRequest } from "handler/contribution"; - -export const onRequest: PagesFunction = handleContributionRequest; diff --git a/web/cloudflare/functions/ar/projects/[slug].ts b/web/cloudflare/functions/ar/projects/[slug].ts deleted file mode 100644 index ae73c09cc..000000000 --- a/web/cloudflare/functions/ar/projects/[slug].ts +++ /dev/null @@ -1,3 +0,0 @@ -import { Env, handleProjectRequest } from "handler/project"; - -export const onRequest: PagesFunction = handleProjectRequest; diff --git a/web/cloudflare/functions/ar/team/[slug].ts b/web/cloudflare/functions/ar/team/[slug].ts deleted file mode 100644 index b7342ae76..000000000 --- a/web/cloudflare/functions/ar/team/[slug].ts +++ /dev/null @@ -1,3 +0,0 @@ -import { Env, handleContributorRequest } from "handler/contributor"; - -export const onRequest: PagesFunction = handleContributorRequest; diff --git a/web/cloudflare/functions/contribute/[slug].ts b/web/cloudflare/functions/contribute/[slug].ts deleted file mode 100644 index b006b233e..000000000 --- a/web/cloudflare/functions/contribute/[slug].ts +++ /dev/null @@ -1,3 +0,0 @@ -import { Env, handleContributionRequest } from "handler/contribution"; - -export const onRequest: PagesFunction = handleContributionRequest; diff --git a/web/cloudflare/functions/projects/[slug].ts b/web/cloudflare/functions/projects/[slug].ts deleted file mode 100644 index ae73c09cc..000000000 --- a/web/cloudflare/functions/projects/[slug].ts +++ /dev/null @@ -1,3 +0,0 @@ -import { Env, handleProjectRequest } from "handler/project"; - -export const onRequest: PagesFunction = handleProjectRequest; diff --git a/web/cloudflare/functions/team/[slug].ts b/web/cloudflare/functions/team/[slug].ts deleted file mode 100644 index b7342ae76..000000000 --- a/web/cloudflare/functions/team/[slug].ts +++ /dev/null @@ -1,3 +0,0 @@ -import { Env, handleContributorRequest } from "handler/contributor"; - -export const onRequest: PagesFunction = handleContributorRequest; diff --git a/web/cloudflare/functions/w/contributions-sitemap.xml.ts b/web/cloudflare/functions/w/contributions-sitemap.xml.ts deleted file mode 100644 index 54f7d4214..000000000 --- a/web/cloudflare/functions/w/contributions-sitemap.xml.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { Env } from "handler/contribution"; -import { environments } from "@dzcode.io/utils/dist/config/environment"; -import { LANGUAGES } from "@dzcode.io/models/dist/language"; -import { getContributionURL } from "@dzcode.io/web/dist/utils/contribution"; -import { fsConfig } from "@dzcode.io/utils/dist/config"; -import { fetchV2Factory } from "@dzcode.io/utils/dist/fetch/factory"; -import { Endpoints } from "@dzcode.io/api/dist/app/endpoints"; -import { LanguageCode } from "@dzcode.io/utils/dist/language"; - -function xmlEscape(s: string) { - return s.replace( - /[<>&"']/g, - (c) => ({ "<": "<", ">": ">", "&": "&", '"': """, "'": "'" })[c] as string, - ); -} - -export const onRequest: PagesFunction = async (context) => { - let stage = context.env.STAGE; - if (!environments.includes(stage)) { - console.log(`⚠️ No STAGE provided, falling back to "development"`); - stage = "development"; - } - const fullstackConfig = fsConfig(stage); - const links: Array<{ url: string; lang: LanguageCode }> = []; - - for (const lang of LANGUAGES) { - const fetchV2 = fetchV2Factory(fullstackConfig, lang.code); - const { contributions } = await fetchV2("api:contributions/for-sitemap", {}); - - for (const contribution of contributions) { - links.push({ - url: xmlEscape(`${lang.baseUrl}${getContributionURL(contribution)}`), - lang: lang.code, - }); - } - } - - const hostname = "https://www.dzCode.io"; - const xml = ` - - ${links - .map( - (link) => ` - - ${hostname}${link.url} - - `, - ) - .join("")} -`; - - return new Response(xml, { headers: { "content-type": "application/xml; charset=utf-8" } }); -}; diff --git a/web/cloudflare/functions/w/contributors-sitemap.xml.ts b/web/cloudflare/functions/w/contributors-sitemap.xml.ts deleted file mode 100644 index d04a6c04c..000000000 --- a/web/cloudflare/functions/w/contributors-sitemap.xml.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { Env } from "handler/contributor"; -import { environments } from "@dzcode.io/utils/dist/config/environment"; -import { LANGUAGES } from "@dzcode.io/models/dist/language"; -import { getContributorURL } from "@dzcode.io/web/dist/utils/contributor"; -import { fsConfig } from "@dzcode.io/utils/dist/config"; -import { fetchV2Factory } from "@dzcode.io/utils/dist/fetch/factory"; -import { Endpoints } from "@dzcode.io/api/dist/app/endpoints"; -import { LanguageCode } from "@dzcode.io/utils/dist/language"; - -export const onRequest: PagesFunction = async (context) => { - let stage = context.env.STAGE; - if (!environments.includes(stage)) { - console.log(`⚠️ No STAGE provided, falling back to "development"`); - stage = "development"; - } - const fullstackConfig = fsConfig(stage); - const links: Array<{ url: string; lang: LanguageCode }> = []; - for (const lang of LANGUAGES) { - const fetchV2 = fetchV2Factory(fullstackConfig, lang.code); - const { contributors } = await fetchV2("api:contributors/for-sitemap", {}); - for (const contributor of contributors) { - links.push({ - url: `${lang.baseUrl}${getContributorURL(contributor)}`, - lang: lang.code, - }); - } - } - - const hostname = "https://www.dzcode.io"; - const xml = ` - - ${links - .map( - (link) => ` - - ${hostname}${link.url} - - `, - ) - .join("")} -`; - - return new Response(xml, { headers: { "content-type": "application/xml; charset=utf-8" } }); -}; diff --git a/web/cloudflare/functions/w/projects-sitemap.xml.ts b/web/cloudflare/functions/w/projects-sitemap.xml.ts deleted file mode 100644 index d912f4a14..000000000 --- a/web/cloudflare/functions/w/projects-sitemap.xml.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { Env } from "handler/project"; -import { environments } from "@dzcode.io/utils/dist/config/environment"; -import { getProjectURL } from "@dzcode.io/web/dist/utils/project"; -import { fsConfig } from "@dzcode.io/utils/dist/config"; -import { fetchV2Factory } from "@dzcode.io/utils/dist/fetch/factory"; -import { Endpoints } from "@dzcode.io/api/dist/app/endpoints"; -import { LANGUAGES } from "@dzcode.io/models/dist/language"; -import { LanguageCode } from "@dzcode.io/utils/dist/language"; - -export const onRequest: PagesFunction = async (context) => { - let stage = context.env.STAGE; - if (!environments.includes(stage)) { - console.log(`⚠️ No STAGE provided, falling back to "development"`); - stage = "development"; - } - const fullstackConfig = fsConfig(stage); - const links: Array<{ url: string; lang: LanguageCode }> = []; - for (const lang of LANGUAGES) { - const fetchV2 = fetchV2Factory(fullstackConfig, lang.code); - const { projects } = await fetchV2("api:projects/for-sitemap", {}); - for (const project of projects) { - links.push({ - url: `${lang.baseUrl}${getProjectURL(project)}`, - lang: lang.code, - }); - } - } - - const hostname = "https://www.dzCode.io"; - const xml = ` - - ${links - .map( - (link) => ` - - ${hostname}${link.url} - - `, - ) - .join("")} -`; - - return new Response(xml, { headers: { "content-type": "application/xml; charset=utf-8" } }); -}; diff --git a/web/cloudflare/handler/contribution.ts b/web/cloudflare/handler/contribution.ts deleted file mode 100644 index 9800071e7..000000000 --- a/web/cloudflare/handler/contribution.ts +++ /dev/null @@ -1,71 +0,0 @@ -declare const htmlTemplate: string; // @ts-expect-error cloudflare converts this to a string using esbuild -import htmlTemplate from "../public/template.html"; -declare const notFoundEn: string; // @ts-expect-error cloudflare converts this to a string using esbuild -import notFoundEn from "../public/404.html"; -declare const notFoundAr: string; // @ts-expect-error cloudflare converts this to a string using esbuild -import notFoundAr from "../public/ar/404.html"; - -import { Environment, environments } from "@dzcode.io/utils/dist/config/environment"; -import { fsConfig } from "@dzcode.io/utils/dist/config"; -import { plainLocalize } from "@dzcode.io/web/dist/components/locale/utils"; -import { dictionary, AllDictionaryKeys } from "@dzcode.io/web/dist/components/locale/dictionary"; -import { fetchV2Factory } from "@dzcode.io/utils/dist/fetch/factory"; -import { Endpoints } from "@dzcode.io/api/dist/app/endpoints"; -import { LanguageCode } from "@dzcode.io/utils/dist/language"; - -export interface Env { - STAGE: Environment; -} - -export const handleContributionRequest: PagesFunction = async (context) => { - let stage = context.env.STAGE; - if (!environments.includes(stage)) { - console.log(`⚠️ No STAGE provided, falling back to "development"`); - stage = "development"; - } - - const pathName = new URL(context.request.url).pathname; - - const languageRegex = /^\/(ar|en)\//i; - const language = (pathName?.match(languageRegex)?.[1]?.toLowerCase() || "en") as LanguageCode; - const notFound = language === "ar" ? notFoundAr : notFoundEn; - - const contributionIdRegex = /contribute\/(.*)-(.*)-(.*)/; - const contributionId = - pathName?.match(contributionIdRegex)?.[2] + "-" + pathName?.match(contributionIdRegex)?.[3]; - - if (!contributionId) - return new Response(notFound, { - headers: { "content-type": "text/html; charset=utf-8" }, - status: 404, - }); - - const localize = (key: AllDictionaryKeys) => - plainLocalize(dictionary, language, key, "NO-TRANSLATION"); - - const fullstackConfig = fsConfig(stage); - const fetchV2 = fetchV2Factory(fullstackConfig, language); - - try { - const { contribution } = await fetchV2("api:contributions/:id/title", { - params: { id: contributionId }, - }); - const pageTitle = `${localize("contribution-title-pre")} ${contribution.title} ${localize("contribution-title-post")}`; - - const newData = htmlTemplate - .replace(/{{template-title}}/g, pageTitle) - .replace(/{{template-description}}/g, localize("contribute-description")) - .replace(/{{template-lang}}/g, language) - .replace(/{{template-canonical}}/g, `${fullstackConfig.web.url}${pathName}`); - - return new Response(newData, { headers: { "content-type": "text/html; charset=utf-8" } }); - } catch (error) { - // @TODO-ZM: log error to sentry - console.error(error); - - return new Response(notFound, { - headers: { "content-type": "text/html; charset=utf-8" }, - status: 404, - }); - } -}; diff --git a/web/cloudflare/handler/contributor.ts b/web/cloudflare/handler/contributor.ts deleted file mode 100644 index 04116a4d0..000000000 --- a/web/cloudflare/handler/contributor.ts +++ /dev/null @@ -1,70 +0,0 @@ -declare const htmlTemplate: string; // @ts-expect-error cloudflare converts this to a string using esbuild -import htmlTemplate from "../public/template.html"; -declare const notFoundEn: string; // @ts-expect-error cloudflare converts this to a string using esbuild -import notFoundEn from "../public/404.html"; -declare const notFoundAr: string; // @ts-expect-error cloudflare converts this to a string using esbuild -import notFoundAr from "../public/ar/404.html"; - -import { Environment, environments } from "@dzcode.io/utils/dist/config/environment"; -import { fsConfig } from "@dzcode.io/utils/dist/config"; -import { plainLocalize } from "@dzcode.io/web/dist/components/locale/utils"; -import { dictionary, AllDictionaryKeys } from "@dzcode.io/web/dist/components/locale/dictionary"; -import { fetchV2Factory } from "@dzcode.io/utils/dist/fetch/factory"; -import { Endpoints } from "@dzcode.io/api/dist/app/endpoints"; -import { LanguageCode } from "@dzcode.io/utils/dist/language"; - -export interface Env { - STAGE: Environment; -} - -export const handleContributorRequest: PagesFunction = async (context) => { - let stage = context.env.STAGE; - if (!environments.includes(stage)) { - console.log(`⚠️ No STAGE provided, falling back to "development"`); - stage = "development"; - } - - const pathName = new URL(context.request.url).pathname; - - const languageRegex = /^\/(ar|en)\//i; - const language = (pathName?.match(languageRegex)?.[1]?.toLowerCase() || "en") as LanguageCode; - const notFound = language === "ar" ? notFoundAr : notFoundEn; - - const contributorIdRegex = /team\/(.*)/; - const contributorId = pathName?.match(contributorIdRegex)?.[1]; - - if (!contributorId) - return new Response(notFound, { - headers: { "content-type": "text/html; charset=utf-8" }, - status: 404, - }); - - const localize = (key: AllDictionaryKeys) => - plainLocalize(dictionary, language, key, "NO-TRANSLATION"); - - const fullstackConfig = fsConfig(stage); - const fetchV2 = fetchV2Factory(fullstackConfig, language); - - try { - const { contributor } = await fetchV2("api:contributors/:id/name", { - params: { id: contributorId }, - }); - const pageTitle = `${localize("contributor-title-pre")} ${contributor.name} ${localize("contributor-title-post")}`; - - const newData = htmlTemplate - .replace(/{{template-title}}/g, pageTitle) - .replace(/{{template-description}}/g, localize("team-description")) - .replace(/{{template-lang}}/g, language) - .replace(/{{template-canonical}}/g, `${fullstackConfig.web.url}${pathName}`); - - return new Response(newData, { headers: { "content-type": "text/html; charset=utf-8" } }); - } catch (error) { - // @TODO-ZM: log error to sentry - console.error(error); - - return new Response(notFound, { - headers: { "content-type": "text/html; charset=utf-8" }, - status: 404, - }); - } -}; diff --git a/web/cloudflare/handler/project.ts b/web/cloudflare/handler/project.ts deleted file mode 100644 index 7fcf6ea7d..000000000 --- a/web/cloudflare/handler/project.ts +++ /dev/null @@ -1,68 +0,0 @@ -declare const htmlTemplate: string; // @ts-expect-error cloudflare converts this to a string using esbuild -import htmlTemplate from "../public/template.html"; -declare const notFoundEn: string; // @ts-expect-error cloudflare converts this to a string using esbuild -import notFoundEn from "../public/404.html"; -declare const notFoundAr: string; // @ts-expect-error cloudflare converts this to a string using esbuild -import notFoundAr from "../public/ar/404.html"; - -import { Environment, environments } from "@dzcode.io/utils/dist/config/environment"; -import { fsConfig } from "@dzcode.io/utils/dist/config"; -import { plainLocalize } from "@dzcode.io/web/dist/components/locale/utils"; -import { dictionary, AllDictionaryKeys } from "@dzcode.io/web/dist/components/locale/dictionary"; -import { fetchV2Factory } from "@dzcode.io/utils/dist/fetch/factory"; -import { Endpoints } from "@dzcode.io/api/dist/app/endpoints"; -import { LanguageCode } from "@dzcode.io/utils/dist/language"; - -export interface Env { - STAGE: Environment; -} - -export const handleProjectRequest: PagesFunction = async (context) => { - let stage = context.env.STAGE; - if (!environments.includes(stage)) { - console.log(`⚠️ No STAGE provided, falling back to "development"`); - stage = "development"; - } - - const pathName = new URL(context.request.url).pathname; - - const languageRegex = /^\/(ar|en)\//i; - const language = (pathName?.match(languageRegex)?.[1]?.toLowerCase() || "en") as LanguageCode; - const notFound = language === "ar" ? notFoundAr : notFoundEn; - - const projectIdRegex = /projects\/(.*)/; - const projectId = pathName?.match(projectIdRegex)?.[1]; - - if (!projectId) - return new Response(notFound, { - headers: { "content-type": "text/html; charset=utf-8" }, - status: 404, - }); - - const localize = (key: AllDictionaryKeys) => - plainLocalize(dictionary, language, key, "NO-TRANSLATION"); - - const fullstackConfig = fsConfig(stage); - const fetchV2 = fetchV2Factory(fullstackConfig, language); - - try { - const { project } = await fetchV2("api:projects/:id/name", { params: { id: projectId } }); - const pageTitle = `${localize("project-title-pre")} ${project.name} ${localize("project-title-post")}`; - - const newData = htmlTemplate - .replace(/{{template-title}}/g, pageTitle) - .replace(/{{template-description}}/g, localize("projects-description")) - .replace(/{{template-lang}}/g, language) - .replace(/{{template-canonical}}/g, `${fullstackConfig.web.url}${pathName}`); - - return new Response(newData, { headers: { "content-type": "text/html; charset=utf-8" } }); - } catch (error) { - // @TODO-ZM: log error to sentry - console.error(error); - - return new Response(notFound, { - headers: { "content-type": "text/html; charset=utf-8" }, - status: 404, - }); - } -}; diff --git a/web/cloudflare/package.json b/web/cloudflare/package.json deleted file mode 100644 index 0c629f5e0..000000000 --- a/web/cloudflare/package.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "name": "@dzcode.io/cloudflare", - "version": "0.0.0", - "dependencies": { - "@dzcode.io/api": "*", - "@dzcode.io/models": "*", - "@dzcode.io/utils": "*", - "@dzcode.io/web": "*" - }, - "devDependencies": { - "@cloudflare/workers-types": "^4.20240919.0", - "typescript": "^5.6.2", - "wrangler": "^3.78.7" - }, - "private": true, - "scripts": { - "build": "lerna run build:alone --scope=@dzcode.io/web --include-dependencies --stream", - "deploy:prd": "npm run generate:config -- production && wrangler pages deploy --branch main", - "deploy:stg": "npm run generate:config -- staging && wrangler pages deploy --branch main", - "dev": "npm run build && wrangler pages dev . --port 8081", - "dev:prepare": "npm run build && cd .. && npm run bundle && npm run pre-deploy", - "generate:config": "npx tsx scripts/generate-config.ts", - "lint:eslint": "eslint --config ../../packages/tooling/eslint.config.mjs", - "lint:prettier": "prettier --config ../../packages/tooling/.prettierrc --ignore-path ../../packages/tooling/.prettierignore --log-level warn", - "ts:check": "tsc --noEmit" - } -} diff --git a/web/cloudflare/scripts/generate-config.ts b/web/cloudflare/scripts/generate-config.ts deleted file mode 100644 index 6b6d3f2b2..000000000 --- a/web/cloudflare/scripts/generate-config.ts +++ /dev/null @@ -1,24 +0,0 @@ -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-nocheck - -import { writeFileSync } from "fs"; - -// Get the environment passed as argument -const STAGE = process.argv[2]; -if (!STAGE) throw new Error("Please provide a STAGE"); - -console.log(`Creating wrangler.toml ...`); - -writeFileSync( - "wrangler.toml", - ` -name = ${STAGE === "production" ? '"dzcode-dot-io"' : '"stage-dot-dzcode-dot-io"'} -compatibility_date = "2024-09-28" -pages_build_output_dir = "./public" - -[vars] -STAGE = "${STAGE}" -`, -); - -console.log(`Done creating .bundle-info.json`); diff --git a/web/cloudflare/tsconfig.json b/web/cloudflare/tsconfig.json deleted file mode 100644 index b31ddfa8e..000000000 --- a/web/cloudflare/tsconfig.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "extends": "../../packages/tooling/tsconfig.json", - "compilerOptions": { - "outDir": "dist", - "baseUrl": ".", - "target": "esnext", - "module": "esnext", - "lib": ["esnext"], - "types": ["@cloudflare/workers-types"] - } -} diff --git a/web/package.json b/web/package.json index f4f9435f7..855740f2f 100644 --- a/web/package.json +++ b/web/package.json @@ -3,9 +3,9 @@ "description": "www.dzcode.io code", "version": "6.1.0", "author": { - "email": "contact@zakiii.com", + "email": "zakman.dev@gmail.com", "name": "Zakaria Mansouri", - "url": "https://www.zakiii.com" + "url": "https://zak-man.com" }, "browserslist": [ "defaults" @@ -45,7 +45,7 @@ }, "engines": { "node": ">=20", - "npm run": ">=1.4.2" + "npm": ">=1.4.2" }, "license": "MIT", "lint-staged": { @@ -62,14 +62,13 @@ "scripts": { "build": "lerna run build:alone --scope=@dzcode.io/web --include-dependencies --stream", "build:alone": "tspc", + "build:alone:watch": "tspc --watch --preserveWatchOutput", "build:watch": "lerna run build:alone:watch --scope=@dzcode.io/web --include-dependencies --parallel", "bundle": "npm run build && npm run bundle:alone", "bundle:alone": "cross-env NODE_ENV=production rsbuild build", "bundle:preview": "rsbuild preview", "clean": "lerna run clean:alone --scope=@dzcode.io/web --include-dependencies --stream", - "clean:alone": "del dist coverage bundle node_modules/.cache && del ./cloudflare/public", - "deploy": "cd ./cloudflare && npm install && npm run deploy:prd ", - "deploy:stg": "cd ./cloudflare && npm install && npm run deploy:stg", + "clean:alone": "del dist coverage bundle node_modules/.cache", "e2e:dev": "npx wait-on http://localhost:8080/ && npx cypress open", "generate:bundle-info": "tsx ../packages/tooling/bundle-info.ts", "generate:htmls": "npx tsx src/_build/gen-multiple-htmls.ts", @@ -86,7 +85,7 @@ "lint:prettier": "prettier --config ../packages/tooling/.prettierrc --ignore-path ../packages/tooling/.prettierignore --log-level warn", "lint:ts-prune": "tsx ../packages/tooling/setup-ts-prune.ts && ts-prune --error", "lint:tsc": "tsc --noEmit", - "pre-deploy": "npm run generate:htmls && npm run generate:robots-txt && npm run generate:sitemap && del ./cloudflare/public && cpy \"./bundle/**/*\" ./cloudflare/public", + "pre-deploy": "npm run generate:htmls && npm run generate:robots-txt && npm run generate:sitemap", "prune:dictionary": "npx tsx ../packages/tooling/prune-dictionary.ts", "start:dev": "rsbuild dev --open", "test": "npm run build && npm run test:alone", diff --git a/web/src/utils/contribution.ts b/web/src/utils/contribution.ts index 9f06e2b27..2e671cafb 100644 --- a/web/src/utils/contribution.ts +++ b/web/src/utils/contribution.ts @@ -1,8 +1,16 @@ import { ContributionNoLang } from "@dzcode.io/models/dist/contribution"; +import { DEFAULT_LANGUAGE, Language } from "@dzcode.io/models/dist/language"; -export function getContributionURL({ - id, - title, -}: Pick): string { - return `/contribute/${title.replace(/\s/g, "-")}-${id}`; +export function getContributionURL( + { id, title }: Pick, + lang?: Language, +): string { + const escapedTitle = encodeURIComponent(title); + const restOfUrl = `${escapedTitle}-${id}`; + + if (!lang) return `/contribute/${restOfUrl}`; + + if (lang === DEFAULT_LANGUAGE) return `/contribute/${restOfUrl}`; + + return `/${lang.code}/contribute/${restOfUrl}`; } diff --git a/web/src/utils/contributor.ts b/web/src/utils/contributor.ts index b36ce114e..eeb149dc0 100644 --- a/web/src/utils/contributor.ts +++ b/web/src/utils/contributor.ts @@ -1,5 +1,10 @@ import { ContributorEntity } from "@dzcode.io/models/dist/contributor"; +import { DEFAULT_LANGUAGE, Language } from "@dzcode.io/models/dist/language"; -export function getContributorURL({ id }: Pick): string { - return `/team/${id}`; +export function getContributorURL({ id }: Pick, lang?: Language): string { + if (!lang) return `/team/${id}`; + + if (lang === DEFAULT_LANGUAGE) return `/team/${id}`; + + return `/${lang.code}/team/${id}`; } diff --git a/web/src/utils/project.ts b/web/src/utils/project.ts index 606a4827f..bfb2cce2c 100644 --- a/web/src/utils/project.ts +++ b/web/src/utils/project.ts @@ -1,5 +1,10 @@ +import { DEFAULT_LANGUAGE, Language } from "@dzcode.io/models/dist/language"; import { ProjectEntity } from "@dzcode.io/models/dist/project"; -export function getProjectURL({ id }: Pick): string { - return `/projects/${id}`; +export function getProjectURL({ id }: Pick, lang?: Language): string { + if (!lang) return `/projects/${id}`; + + if (lang === DEFAULT_LANGUAGE) return `/projects/${id}`; + + return `/${lang.code}/projects/${id}`; } diff --git a/web/tsconfig.json b/web/tsconfig.json index 93a0c1d45..c7c4658b6 100644 --- a/web/tsconfig.json +++ b/web/tsconfig.json @@ -1,7 +1,6 @@ { "extends": "@dzcode.io/tooling/tsconfig.json", "compilerOptions": { - "module": "esnext", "outDir": "dist", "baseUrl": "." },