There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
fix(server): redirect to setup page if not initialized (#7875)
liuyi57449c1530ba
diff --git a/.github/helm/affine/charts/graphql/templates/deployment.yaml b/.github/helm/affine/charts/graphql/templates/deployment.yamlindex 7c1fd1dac8..679bea6057 100644--- a/.github/helm/affine/charts/graphql/templates/deployment.yaml+++ b/.github/helm/affine/charts/graphql/templates/deployment.yaml@@ -204,12 +204,12 @@ spec:protocol: TCPlivenessProbe:httpGet:- path: /+ path: /infoport: httpinitialDelaySeconds: {{ .Values.probe.initialDelaySeconds }}readinessProbe:httpGet:- path: /+ path: /infoport: httpinitialDelaySeconds: {{ .Values.probe.initialDelaySeconds }}resources:diff --git a/packages/backend/server/.gitignore b/packages/backend/server/.gitignoreindex 4c49bd78f1..5d609db0b7 100644--- a/packages/backend/server/.gitignore+++ b/packages/backend/server/.gitignore@@ -1 +1,2 @@.env+static/diff --git a/packages/backend/server/package.json b/packages/backend/server/package.jsonindex 0d346b1e51..b0bf7c2dae 100644--- a/packages/backend/server/package.json+++ b/packages/backend/server/package.json@@ -34,7 +34,6 @@"@nestjs/platform-express": "^10.3.7","@nestjs/platform-socket.io": "^10.3.7","@nestjs/schedule": "^4.0.1",- "@nestjs/serve-static": "^4.0.2","@nestjs/throttler": "5.2.0","@nestjs/websockets": "^10.3.7","@node-rs/argon2": "^1.8.0",@@ -138,6 +137,7 @@],"watchMode": {"ignoreChanges": [+ "static/**","**/*.gen.*"]},diff --git a/packages/backend/server/src/app.controller.ts b/packages/backend/server/src/app.controller.tsindex ff09b3b05a..f98b3a6a9a 100644--- a/packages/backend/server/src/app.controller.ts+++ b/packages/backend/server/src/app.controller.ts@@ -3,7 +3,7 @@ import { Controller, Get } from '@nestjs/common';import { Public } from './core/auth';import { Config, SkipThrottle } from './fundamentals';-@Controller('/')+@Controller('/info')export class AppController {constructor(private readonly config: Config) {}diff --git a/packages/backend/server/src/app.module.ts b/packages/backend/server/src/app.module.tsindex ac80a57801..1b3154b5fd 100644--- a/packages/backend/server/src/app.module.ts+++ b/packages/backend/server/src/app.module.ts@@ -1,5 +1,3 @@-import { join } from 'node:path';-import {DynamicModule,ForwardReference,@@ -7,7 +5,6 @@ import {Module,} from '@nestjs/common';import { ScheduleModule } from '@nestjs/schedule';-import { ServeStaticModule } from '@nestjs/serve-static';import { get } from 'lodash-es';import { AppController } from './app.controller';@@ -16,7 +13,7 @@ import { ADD_ENABLED_FEATURES, ServerConfigModule } from './core/config';import { DocModule } from './core/doc';import { FeatureModule } from './core/features';import { QuotaModule } from './core/quota';-import { CustomSetupModule } from './core/setup';+import { SelfhostModule } from './core/selfhost';import { StorageModule } from './core/storage';import { SyncModule } from './core/sync';import { UserModule } from './core/user';@@ -137,7 +134,7 @@ export class AppModuleBuilder {compile() {@Module({imports: this.modules,- controllers: this.config.isSelfhosted ? [] : [AppController],+ controllers: [AppController],})class AppModule {}@@ -145,7 +142,7 @@ export class AppModuleBuilder {}}-function buildAppModule() {+export function buildAppModule() {AFFiNE = mergeConfigOverride(AFFiNE);const factor = new AppModuleBuilder(AFFiNE);@@ -175,18 +172,7 @@ function buildAppModule() {)// self hosted server only- .useIf(- config => config.isSelfhosted,- CustomSetupModule,- ServeStaticModule.forRoot({- rootPath: join('/app', 'static'),- exclude: ['/admin*'],- }),- ServeStaticModule.forRoot({- rootPath: join('/app', 'static', 'admin'),- serveRoot: '/admin',- })- );+ .useIf(config => config.isSelfhosted, SelfhostModule);// plugin modulesENABLED_PLUGINS.forEach(name => {diff --git a/packages/backend/server/src/core/config/index.ts b/packages/backend/server/src/core/config/index.tsindex 174f34a7f5..1ea38185b9 100644--- a/packages/backend/server/src/core/config/index.ts+++ b/packages/backend/server/src/core/config/index.ts@@ -8,15 +8,19 @@ import {ServerRuntimeConfigResolver,ServerServiceConfigResolver,} from './resolver';+import { ServerService } from './service';@Module({providers: [+ ServerService,ServerConfigResolver,ServerFeatureConfigResolver,ServerRuntimeConfigResolver,ServerServiceConfigResolver,],+ exports: [ServerService],})export class ServerConfigModule {}+export { ServerService };export { ADD_ENABLED_FEATURES } from './server-feature';export { ServerFeature } from './types';diff --git a/packages/backend/server/src/core/config/resolver.ts b/packages/backend/server/src/core/config/resolver.tsindex cd78c10d47..d3e34629d3 100644--- a/packages/backend/server/src/core/config/resolver.ts+++ b/packages/backend/server/src/core/config/resolver.ts@@ -9,7 +9,7 @@ import {ResolveField,Resolver,} from '@nestjs/graphql';-import { PrismaClient, RuntimeConfig, RuntimeConfigType } from '@prisma/client';+import { RuntimeConfig, RuntimeConfigType } from '@prisma/client';import { GraphQLJSON, GraphQLJSONObject } from 'graphql-scalars';import { Config, URLHelper } from '../../fundamentals';@@ -19,6 +19,7 @@ import { FeatureType } from '../features';import { AvailableUserFeatureConfig } from '../features/resolver';import { ServerFlags } from './config';import { ENABLED_FEATURES } from './server-feature';+import { ServerService } from './service';import { ServerConfigType } from './types';@ObjectType()@@ -76,7 +77,7 @@ export class ServerConfigResolver {constructor(private readonly config: Config,private readonly url: URLHelper,- private readonly db: PrismaClient+ private readonly server: ServerService) {}@Public()@@ -131,7 +132,7 @@ export class ServerConfigResolver {description: 'whether server has been initialized',})async initialized() {- return (await this.db.user.count()) > 0;+ return this.server.initialized();}}diff --git a/packages/backend/server/src/core/config/service.ts b/packages/backend/server/src/core/config/service.tsnew file mode 100644index 0000000000..810d62cfbf--- /dev/null+++ b/packages/backend/server/src/core/config/service.ts@@ -0,0 +1,17 @@+import { Injectable } from '@nestjs/common';+import { PrismaClient } from '@prisma/client';++@Injectable()+export class ServerService {+ private _initialized: boolean | null = null;+ constructor(private readonly db: PrismaClient) {}++ async initialized() {+ if (!this._initialized) {+ const userCount = await this.db.user.count();+ this._initialized = userCount > 0;+ }++ return this._initialized;+ }+}diff --git a/packages/backend/server/src/core/setup/controller.ts b/packages/backend/server/src/core/selfhost/controller.tssimilarity index 89%rename from packages/backend/server/src/core/setup/controller.tsrename to packages/backend/server/src/core/selfhost/controller.tsindex 6ceeb87772..9a19db3b2a 100644--- a/packages/backend/server/src/core/setup/controller.ts+++ b/packages/backend/server/src/core/selfhost/controller.ts@@ -1,5 +1,4 @@import { Body, Controller, Post, Req, Res } from '@nestjs/common';-import { PrismaClient } from '@prisma/client';import type { Request, Response } from 'express';import {@@ -10,6 +9,7 @@ import {PasswordRequired,} from '../../fundamentals';import { AuthService, Public } from '../auth';+import { ServerService } from '../config';import { UserService } from '../user/service';interface CreateUserInput {@@ -20,11 +20,11 @@ interface CreateUserInput {@Controller('/api/setup')export class CustomSetupController {constructor(- private readonly db: PrismaClient,private readonly user: UserService,private readonly auth: AuthService,private readonly event: EventEmitter,- private readonly mutex: MutexService+ private readonly mutex: MutexService,+ private readonly server: ServerService) {}@Public()@@ -44,7 +44,7 @@ export class CustomSetupController {throw new InternalServerError();}- if ((await this.db.user.count()) > 0) {+ if (await this.server.initialized()) {throw new ActionForbidden('First user already created');}diff --git a/packages/backend/server/src/core/selfhost/index.ts b/packages/backend/server/src/core/selfhost/index.tsnew file mode 100644index 0000000000..58a780d170--- /dev/null+++ b/packages/backend/server/src/core/selfhost/index.ts@@ -0,0 +1,99 @@+import { join } from 'node:path';++import {+ Injectable,+ Module,+ NestMiddleware,+ OnModuleInit,+} from '@nestjs/common';+import { HttpAdapterHost } from '@nestjs/core';+import type { Application, Request, Response } from 'express';+import { static as serveStatic } from 'express';++import { Config } from '../../fundamentals';+import { AuthModule } from '../auth';+import { ServerConfigModule, ServerService } from '../config';+import { UserModule } from '../user';+import { CustomSetupController } from './controller';++@Injectable()+export class SetupMiddleware implements NestMiddleware {+ constructor(private readonly server: ServerService) {}++ use = (req: Request, res: Response, next: (error?: Error | any) => void) => {+ // never throw+ // eslint-disable-next-line @typescript-eslint/no-floating-promises+ this.server+ .initialized()+ .then(initialized => {+ // Redirect to setup page if not initialized+ if (!initialized && req.path !== '/admin/setup') {+ res.redirect('/admin/setup');+ return;+ }++ // redirect to admin page if initialized+ if (initialized && req.path === '/admin/setup') {+ res.redirect('/admin');+ return;+ }++ next();+ })+ .catch(() => {+ next();+ });+ };+}++@Module({+ imports: [AuthModule, UserModule, ServerConfigModule],+ providers: [SetupMiddleware],+ controllers: [CustomSetupController],+})+export class SelfhostModule implements OnModuleInit {+ constructor(+ private readonly config: Config,+ private readonly adapterHost: HttpAdapterHost,+ private readonly check: SetupMiddleware+ ) {}++ onModuleInit() {+ const staticPath = join(this.config.projectRoot, 'static');+ const app = this.adapterHost.httpAdapter.getInstance<Application>();+ const basePath = this.config.server.path;++ app.get(basePath + '/admin/index.html', (_req, res) => {+ res.redirect(basePath + '/admin');+ });+ app.use(+ basePath + '/admin',+ serveStatic(join(staticPath, 'admin'), {+ redirect: false,+ index: false,+ })+ );++ app.get(+ [basePath + '/admin', basePath + '/admin/*'],+ this.check.use,+ (_req, res) => {+ res.sendFile(join(staticPath, 'admin', 'index.html'));+ }+ );++ app.get(basePath + '/index.html', (_req, res) => {+ res.redirect(basePath);+ });+ app.use(+ basePath,+ serveStatic(staticPath, {+ redirect: false,+ index: false,+ })+ );+ app.get('*', this.check.use, (_req, res) => {+ res.sendFile(join(staticPath, 'index.html'));+ });+ }+}diff --git a/packages/backend/server/src/core/setup/index.ts b/packages/backend/server/src/core/setup/index.tsdeleted file mode 100644index 56fe7cfd79..0000000000--- a/packages/backend/server/src/core/setup/index.ts+++ /dev/null@@ -1,11 +0,0 @@-import { Module } from '@nestjs/common';--import { AuthModule } from '../auth';-import { UserModule } from '../user';-import { CustomSetupController } from './controller';--@Module({- imports: [AuthModule, UserModule],- controllers: [CustomSetupController],-})-export class CustomSetupModule {}diff --git a/packages/backend/server/src/fundamentals/config/def.ts b/packages/backend/server/src/fundamentals/config/def.tsindex a565c36dac..90051e2dd2 100644--- a/packages/backend/server/src/fundamentals/config/def.ts+++ b/packages/backend/server/src/fundamentals/config/def.ts@@ -17,6 +17,7 @@ export interface PreDefinedAFFiNEConfig {ENV_MAP: Record<string, ConfigPaths | [ConfigPaths, EnvConfigType?]>;serverId: string;serverName: string;+ readonly projectRoot: string;readonly AFFINE_ENV: AFFINE_ENV;readonly NODE_ENV: NODE_ENV;readonly version: string;diff --git a/packages/backend/server/src/fundamentals/config/default.ts b/packages/backend/server/src/fundamentals/config/default.tsindex ac12f7fff7..25727ab50b 100644--- a/packages/backend/server/src/fundamentals/config/default.ts+++ b/packages/backend/server/src/fundamentals/config/default.ts@@ -1,3 +1,6 @@+import { resolve } from 'node:path';+import { fileURLToPath } from 'node:url';+import pkg from '../../../package.json' assert { type: 'json' };import {AFFINE_ENV,@@ -62,6 +65,7 @@ function getPredefinedAFFiNEConfig(): PreDefinedAFFiNEConfig {affine,node,deploy: !node.dev && !node.test,+ projectRoot: resolve(fileURLToPath(import.meta.url), '../../../../'),};}diff --git a/packages/backend/server/tests/config.spec.ts b/packages/backend/server/tests/config.spec.tsindex 23e9345927..00cc1cdcf9 100644--- a/packages/backend/server/tests/config.spec.ts+++ b/packages/backend/server/tests/config.spec.ts@@ -17,6 +17,7 @@ test.afterEach.always(async () => {test('should be able to get config', t => {t.true(typeof config.server.host === 'string');+ t.is(config.projectRoot, process.cwd());t.is(config.NODE_ENV, 'test');});diff --git a/packages/backend/server/tests/selfhost/app.e2e.ts b/packages/backend/server/tests/selfhost/app.e2e.tsnew file mode 100644index 0000000000..ad47be64b6--- /dev/null+++ b/packages/backend/server/tests/selfhost/app.e2e.ts@@ -0,0 +1,166 @@+import { mkdirSync, writeFileSync } from 'node:fs';+import path from 'node:path';++import type { INestApplication } from '@nestjs/common';+import { PrismaClient } from '@prisma/client';+import type { TestFn } from 'ava';+import ava from 'ava';+import request from 'supertest';++import { buildAppModule } from '../../src/app.module';+import { ServerService } from '../../src/core/config';+import { Config } from '../../src/fundamentals';+import { createTestingApp, initTestingDB } from '../utils';++const test = ava as TestFn<{+ app: INestApplication;+ db: PrismaClient;+}>;++function initTestStaticFiles(staticPath: string) {+ mkdirSync(path.join(staticPath, 'admin'), { recursive: true });+ const files = {+ 'index.html': `<!DOCTYPE html><html><body>AFFiNE</body><script src="main.js"/></html>`,+ 'main.js': `const name = 'affine'`,+ 'admin/index.html': `<!DOCTYPE html><html><body>AFFiNE Admin</body><script src="/admin/main.js"/></html>`,+ 'admin/main.js': `const name = 'affine-admin'`,+ };++ for (const [filename, content] of Object.entries(files)) {+ writeFileSync(path.join(staticPath, filename), content);+ }+}++test.before('init selfhost server', async t => {+ // @ts-expect-error override+ AFFiNE.isSelfhosted = true;+ const { app } = await createTestingApp({+ imports: [buildAppModule()],+ });++ t.context.app = app;+ t.context.db = t.context.app.get(PrismaClient);+ const config = app.get(Config);++ const staticPath = path.join(config.projectRoot, 'static');+ initTestStaticFiles(staticPath);+});++test.beforeEach(async t => {+ await initTestingDB(t.context.db);+ const server = t.context.app.get(ServerService);+ // @ts-expect-error disable cache+ server._initialized = false;+});++test.afterEach.always(async t => {+ await t.context.app.close();+});++test('do not allow visit index.html directly', async t => {+ let res = await request(t.context.app.getHttpServer())+ .get('/index.html')+ .expect(302);++ t.is(res.header.location, '');++ res = await request(t.context.app.getHttpServer())+ .get('/admin/index.html')+ .expect(302);++ t.is(res.header.location, '/admin');+});++test('should always return static asset files', async t => {+ let res = await request(t.context.app.getHttpServer())+ .get('/main.js')+ .expect(200);+ t.is(res.text, "const name = 'affine'");++ res = await request(t.context.app.getHttpServer())+ .get('/admin/main.js')+ .expect(200);+ t.is(res.text, "const name = 'affine-admin'");++ await t.context.db.user.create({+ data: {+ name: 'test',+ email: '[email protected]',+ },+ });++ res = await request(t.context.app.getHttpServer())+ .get('/main.js')+ .expect(200);+ t.is(res.text, "const name = 'affine'");++ res = await request(t.context.app.getHttpServer())+ .get('/admin/main.js')+ .expect(200);+ t.is(res.text, "const name = 'affine-admin'");+});++test('should be able to call apis', async t => {+ await request(t.context.app.getHttpServer()).get('/info').expect(200);++ t.pass();+});++const blockedPages = [+ '/',+ '/workspace',+ '/admin',+ '/admin/',+ '/admin/accounts',+];++test('should redirect to setup if server is not initialized', async t => {+ for (const path of blockedPages) {+ const res = await request(t.context.app.getHttpServer()).get(path);++ t.is(res.status, 302, `Failed to redirect ${path}`);+ t.is(res.header.location, '/admin/setup');+ }++ t.pass();+});++test('should allow visiting all pages if initialized', async t => {+ await t.context.db.user.create({+ data: {+ name: 'test',+ email: '[email protected]',+ },+ });++ for (const path of blockedPages) {+ const res = await request(t.context.app.getHttpServer()).get(path);++ t.is(res.status, 200, `Failed to visit ${path}`);+ }++ t.pass();+});++test('should allow visiting setup page if not initialized', async t => {+ const res = await request(t.context.app.getHttpServer())+ .get('/admin/setup')+ .expect(200);++ t.true(res.text.includes('AFFiNE Admin'));+});++test('should redirect to admin if initialized', async t => {+ await t.context.db.user.create({+ data: {+ name: 'test',+ email: '[email protected]',+ },+ });++ const res = await request(t.context.app.getHttpServer())+ .get('/admin/setup')+ .expect(302);++ t.is(res.header.location, '/admin');+});diff --git a/packages/frontend/admin/src/app.tsx b/packages/frontend/admin/src/app.tsxindex a74235007c..ef0829c538 100644--- a/packages/frontend/admin/src/app.tsx+++ b/packages/frontend/admin/src/app.tsx@@ -48,7 +48,7 @@ function RootRoutes() {const config = useServerConfig();const location = useLocation();- if (!config.initialized) {+ if (!config.initialized && location.pathname !== '/admin/setup') {return <Navigate to="/admin/setup" />;}diff --git a/packages/frontend/admin/src/modules/auth/index.tsx b/packages/frontend/admin/src/modules/auth/index.tsxindex 6ec83baa21..aab9896d84 100644--- a/packages/frontend/admin/src/modules/auth/index.tsx+++ b/packages/frontend/admin/src/modules/auth/index.tsx@@ -52,14 +52,14 @@ export function Auth() {).then(res => res.json()).then(- ({+ async ({data: {currentUser: { features },},}) => {if (features.includes(FeatureType.Admin)) {toast.success('Logged in successfully');- revalidate();+ await revalidate();} else {toast.error('You are not an admin');}diff --git a/packages/frontend/admin/src/modules/common.ts b/packages/frontend/admin/src/modules/common.tsindex a8f219db7e..46c719de98 100644--- a/packages/frontend/admin/src/modules/common.ts+++ b/packages/frontend/admin/src/modules/common.ts@@ -1,5 +1,5 @@import { useMutateQueryResource } from '@affine/core/hooks/use-mutation';-import { useQueryImmutable } from '@affine/core/hooks/use-query';+import { useQuery } from '@affine/core/hooks/use-query';import type { GetCurrentUserFeaturesQuery } from '@affine/graphql';import {adminServerConfigQuery,@@ -8,22 +8,30 @@ import {} from '@affine/graphql';export const useServerConfig = () => {- const { data } = useQueryImmutable({+ const { data } = useQuery({query: adminServerConfigQuery,});return data.serverConfig;};+export const useRevalidateServerConfig = () => {+ const revalidate = useMutateQueryResource();++ return () => {+ return revalidate(adminServerConfigQuery);+ };+};+export const useRevalidateCurrentUser = () => {const revalidate = useMutateQueryResource();return () => {- revalidate(getCurrentUserFeaturesQuery);+ return revalidate(getCurrentUserFeaturesQuery);};};export const useCurrentUser = () => {- const { data } = useQueryImmutable({+ const { data } = useQuery({query: getCurrentUserFeaturesQuery,});return data.currentUser;diff --git a/packages/frontend/admin/src/modules/setup/form.tsx b/packages/frontend/admin/src/modules/setup/form.tsxindex 7dd696fe02..093fb4ed7b 100644--- a/packages/frontend/admin/src/modules/setup/form.tsx+++ b/packages/frontend/admin/src/modules/setup/form.tsx@@ -6,13 +6,11 @@ import {CarouselItem,} from '@affine/admin/components/ui/carousel';import { validateEmailAndPassword } from '@affine/admin/utils';-import { useMutateQueryResource } from '@affine/core/hooks/use-mutation';-import { serverConfigQuery } from '@affine/graphql';import { useCallback, useEffect, useState } from 'react';import { useNavigate } from 'react-router-dom';import { toast } from 'sonner';-import { useServerConfig } from '../common';+import { useRevalidateServerConfig, useServerConfig } from '../common';import { CreateAdmin } from './create-admin';export enum CarouselSteps {@@ -73,6 +71,7 @@ export const Form = () => {const [invalidPassword, setInvalidPassword] = useState(false);const serverConfig = useServerConfig();+ const refreshServerConfig = useRevalidateServerConfig();const passwordLimits = serverConfig.credentialsRequirement.password;const isCreateAdminStep = current - 1 === CarouselSteps.CreateAdmin;@@ -80,8 +79,6 @@ export const Form = () => {const disableContinue =(!nameValue || !emailValue || !passwordValue) && isCreateAdminStep;- const revalidate = useMutateQueryResource();-useEffect(() => {if (!api) {return;@@ -114,14 +111,14 @@ export const Form = () => {}await createResponse.json();- await revalidate(serverConfigQuery);+ await refreshServerConfig();toast.success('Admin account created successfully.');} catch (err) {toast.error((err as Error).message);console.error(err);throw err;}- }, [emailValue, passwordValue, revalidate]);+ }, [emailValue, passwordValue, refreshServerConfig]);const onNext = useCallback(async () => {if (isCreateAdminStep) {diff --git a/yarn.lock b/yarn.lockindex e117a749ff..c374bbfc0c 100644--- a/yarn.lock+++ b/yarn.lock@@ -751,7 +751,6 @@ __metadata:"@nestjs/platform-express": "npm:^10.3.7""@nestjs/platform-socket.io": "npm:^10.3.7""@nestjs/schedule": "npm:^4.0.1"- "@nestjs/serve-static": "npm:^4.0.2""@nestjs/testing": "npm:^10.3.7""@nestjs/throttler": "npm:5.2.0""@nestjs/websockets": "npm:^10.3.7"@@ -8716,28 +8715,6 @@ __metadata:languageName: nodelinkType: hard-"@nestjs/serve-static@npm:^4.0.2":- version: 4.0.2- resolution: "@nestjs/serve-static@npm:4.0.2"- dependencies:- path-to-regexp: "npm:0.2.5"- peerDependencies:- "@fastify/static": ^6.5.0 || ^7.0.0- "@nestjs/common": ^9.0.0 || ^10.0.0- "@nestjs/core": ^9.0.0 || ^10.0.0- express: ^4.18.1- fastify: ^4.7.0- peerDependenciesMeta:- "@fastify/static":- optional: true- express:- optional: true- fastify:- optional: true- checksum: 10/337905afb5545ef7280ed408e8929aa4ab7ecf754e11d0c4a7b3e641b50cd34ed9bdd70e16c19f01fb1446a17cd6098481db6de2719c808a43031fdcd8792ac8- languageName: node- linkType: hard-"@nestjs/testing@npm:^10.3.7":version: 10.3.10resolution: "@nestjs/testing@npm:10.3.10"@@ -31808,13 +31785,6 @@ __metadata:languageName: nodelinkType: hard-"path-to-regexp@npm:0.2.5":- version: 0.2.5- resolution: "path-to-regexp@npm:0.2.5"- checksum: 10/9652fd2b74ec932a0df8a868478478565da81e7445a8dde1e65ca80553ad03062336b1f79234068551ecc01f3b76ad774e34f784cc3a34a97c4646cb5cfcbea9- languageName: node- linkType: hard-"path-to-regexp@npm:2.2.1":version: 2.2.1resolution: "path-to-regexp@npm:2.2.1"