From f4640abe178a847fc4144daad741c5875189f343 Mon Sep 17 00:00:00 2001 From: Hide_D Date: Sun, 20 Aug 2023 06:07:06 +0000 Subject: [PATCH] rootAPI to gatewayAPI --- server/api/{RootAPI => GatewayAPI}/GetGameLoginToken.ts | 2 +- server/api/{RootAPI => GatewayAPI}/Install/index.ts | 0 server/api/{RootAPI => GatewayAPI}/Install/initAdmin.ts | 0 .../api/{RootAPI => GatewayAPI}/Login/ChangePassword.ts | 2 +- server/api/{RootAPI => GatewayAPI}/Login/LoginByID.ts | 2 +- server/api/{RootAPI => GatewayAPI}/Login/LoginByToken.ts | 2 +- server/api/{RootAPI => GatewayAPI}/Login/ReqNonce.ts | 2 +- server/api/{RootAPI => GatewayAPI}/Login/index.ts | 2 +- server/api/{RootAPI => GatewayAPI}/Login/test.ts | 2 +- server/api/gatewayAPI.ts | 9 +++++++++ server/api/root.ts | 9 --------- .../apiStructure/{sammoRootAPI.ts => sammoGatewayAPI.ts} | 0 server/clientAPI/{sammoRootAPI.ts => sammoGatewayAPI.ts} | 4 ++-- server/gateway.ts | 6 +++--- 14 files changed, 21 insertions(+), 21 deletions(-) rename server/api/{RootAPI => GatewayAPI}/GetGameLoginToken.ts (91%) rename server/api/{RootAPI => GatewayAPI}/Install/index.ts (100%) rename server/api/{RootAPI => GatewayAPI}/Install/initAdmin.ts (100%) rename server/api/{RootAPI => GatewayAPI}/Login/ChangePassword.ts (90%) rename server/api/{RootAPI => GatewayAPI}/Login/LoginByID.ts (96%) rename server/api/{RootAPI => GatewayAPI}/Login/LoginByToken.ts (95%) rename server/api/{RootAPI => GatewayAPI}/Login/ReqNonce.ts (93%) rename server/api/{RootAPI => GatewayAPI}/Login/index.ts (82%) rename server/api/{RootAPI => GatewayAPI}/Login/test.ts (87%) create mode 100644 server/api/gatewayAPI.ts delete mode 100644 server/api/root.ts rename server/apiStructure/{sammoRootAPI.ts => sammoGatewayAPI.ts} (100%) rename server/clientAPI/{sammoRootAPI.ts => sammoGatewayAPI.ts} (77%) diff --git a/server/api/RootAPI/GetGameLoginToken.ts b/server/api/GatewayAPI/GetGameLoginToken.ts similarity index 91% rename from server/api/RootAPI/GetGameLoginToken.ts rename to server/api/GatewayAPI/GetGameLoginToken.ts index 9eaaa26..4102adb 100644 --- a/server/api/RootAPI/GetGameLoginToken.ts +++ b/server/api/GatewayAPI/GetGameLoginToken.ts @@ -1,5 +1,5 @@ import { GET } from "../defs.js"; -import type { structure } from "../../apiStructure/sammoRootAPI.js"; +import type { structure } from "../../apiStructure/sammoGatewayAPI.js"; import type { ExtractError, ExtractQuery, ExtractResponse } from "../../apiStructure/defs.js"; import { StartSession } from "../../ProcDecorator/StartSession.js"; import { declProcDecorators } from "../../ProcDecorator/base.js"; diff --git a/server/api/RootAPI/Install/index.ts b/server/api/GatewayAPI/Install/index.ts similarity index 100% rename from server/api/RootAPI/Install/index.ts rename to server/api/GatewayAPI/Install/index.ts diff --git a/server/api/RootAPI/Install/initAdmin.ts b/server/api/GatewayAPI/Install/initAdmin.ts similarity index 100% rename from server/api/RootAPI/Install/initAdmin.ts rename to server/api/GatewayAPI/Install/initAdmin.ts diff --git a/server/api/RootAPI/Login/ChangePassword.ts b/server/api/GatewayAPI/Login/ChangePassword.ts similarity index 90% rename from server/api/RootAPI/Login/ChangePassword.ts rename to server/api/GatewayAPI/Login/ChangePassword.ts index 597b333..333e0d0 100644 --- a/server/api/RootAPI/Login/ChangePassword.ts +++ b/server/api/GatewayAPI/Login/ChangePassword.ts @@ -1,5 +1,5 @@ import { GET } from "../../defs.js"; -import type { structure } from "../../../apiStructure/sammoRootAPI.js"; +import type { structure } from "../../../apiStructure/sammoGatewayAPI.js"; import type { ExtractError, ExtractQuery, ExtractResponse } from "../../../apiStructure/defs.js"; import { declProcDecorators } from "../../../ProcDecorator/base.js"; import { ReqLogin } from "../../../ProcDecorator/ReqLogin.js"; diff --git a/server/api/RootAPI/Login/LoginByID.ts b/server/api/GatewayAPI/Login/LoginByID.ts similarity index 96% rename from server/api/RootAPI/Login/LoginByID.ts rename to server/api/GatewayAPI/Login/LoginByID.ts index 988d2ff..05cb719 100644 --- a/server/api/RootAPI/Login/LoginByID.ts +++ b/server/api/GatewayAPI/Login/LoginByID.ts @@ -1,5 +1,5 @@ import { POST } from "../../defs.js"; -import type { structure } from "../../../apiStructure/sammoRootAPI.js"; +import type { structure } from "../../../apiStructure/sammoGatewayAPI.js"; import type { ExtractError, ExtractQuery, ExtractResponse } from "../../../apiStructure/defs.js"; import { StartSession } from "../../../ProcDecorator/StartSession.js"; import { delay } from "../../../util/delay.js"; diff --git a/server/api/RootAPI/Login/LoginByToken.ts b/server/api/GatewayAPI/Login/LoginByToken.ts similarity index 95% rename from server/api/RootAPI/Login/LoginByToken.ts rename to server/api/GatewayAPI/Login/LoginByToken.ts index 14f4bb0..8dcd353 100644 --- a/server/api/RootAPI/Login/LoginByToken.ts +++ b/server/api/GatewayAPI/Login/LoginByToken.ts @@ -1,5 +1,5 @@ import { POST } from "../../defs.js"; -import type { structure } from "../../../apiStructure/sammoRootAPI.js"; +import type { structure } from "../../../apiStructure/sammoGatewayAPI.js"; import type { ExtractError, ExtractQuery, ExtractResponse } from "../../../apiStructure/defs.js"; import { StartSession } from "../../../ProcDecorator/StartSession.js"; import { delay } from "../../../util/delay.js"; diff --git a/server/api/RootAPI/Login/ReqNonce.ts b/server/api/GatewayAPI/Login/ReqNonce.ts similarity index 93% rename from server/api/RootAPI/Login/ReqNonce.ts rename to server/api/GatewayAPI/Login/ReqNonce.ts index 5cbbdbf..58115ab 100644 --- a/server/api/RootAPI/Login/ReqNonce.ts +++ b/server/api/GatewayAPI/Login/ReqNonce.ts @@ -1,5 +1,5 @@ import { GET } from "../../defs.js"; -import type { structure } from "../../../apiStructure/sammoRootAPI.js"; +import type { structure } from "../../../apiStructure/sammoGatewayAPI.js"; import type { ExtractError, ExtractQuery, ExtractResponse } from "../../../apiStructure/defs.js"; import { StartSession } from "../../../ProcDecorator/StartSession.js"; import { declProcDecorators } from "../../../ProcDecorator/base.js"; diff --git a/server/api/RootAPI/Login/index.ts b/server/api/GatewayAPI/Login/index.ts similarity index 82% rename from server/api/RootAPI/Login/index.ts rename to server/api/GatewayAPI/Login/index.ts index 48e5bae..4fc5a10 100644 --- a/server/api/RootAPI/Login/index.ts +++ b/server/api/GatewayAPI/Login/index.ts @@ -1,4 +1,4 @@ -import type { structure } from "../../../apiStructure/sammoRootAPI.js"; +import type { structure } from "../../../apiStructure/sammoGatewayAPI.js"; import type { APINamespaceType } from "../../defs.js"; import { LoginByID } from "./LoginByID.js"; import { LoginByToken } from "./LoginByToken.js"; diff --git a/server/api/RootAPI/Login/test.ts b/server/api/GatewayAPI/Login/test.ts similarity index 87% rename from server/api/RootAPI/Login/test.ts rename to server/api/GatewayAPI/Login/test.ts index 0a886c4..ef2e835 100644 --- a/server/api/RootAPI/Login/test.ts +++ b/server/api/GatewayAPI/Login/test.ts @@ -1,5 +1,5 @@ import { GET } from "../../defs.js"; -import type { structure } from "../../../apiStructure/sammoRootAPI.js"; +import type { structure } from "../../../apiStructure/sammoGatewayAPI.js"; import type { ExtractError, ExtractQuery, ExtractResponse } from "../../../apiStructure/defs.js"; import { EmptyProcDecorator } from "../../../ProcDecorator/base.js"; diff --git a/server/api/gatewayAPI.ts b/server/api/gatewayAPI.ts new file mode 100644 index 0000000..e75767a --- /dev/null +++ b/server/api/gatewayAPI.ts @@ -0,0 +1,9 @@ +import type { structure } from "../apiStructure/sammoGatewayAPI.js"; +import type { APINamespaceType } from "./defs.js"; +import { GetGameLoginToken } from "./GatewayAPI/GetGameLoginToken.js"; +import { Login } from "./GatewayAPI/Login/index.js"; + +export const sammoGatewayAPI = { + Login, + GetGameLoginToken +} satisfies APINamespaceType; \ No newline at end of file diff --git a/server/api/root.ts b/server/api/root.ts deleted file mode 100644 index 83c275f..0000000 --- a/server/api/root.ts +++ /dev/null @@ -1,9 +0,0 @@ -import type { structure } from "../apiStructure/sammoRootAPI.js"; -import type { APINamespaceType } from "./defs.js"; -import { GetGameLoginToken } from "./RootAPI/GetGameLoginToken.js"; -import { Login } from "./RootAPI/Login/index.js"; - -export const sammoRootAPI = { - Login, - GetGameLoginToken -} satisfies APINamespaceType; \ No newline at end of file diff --git a/server/apiStructure/sammoRootAPI.ts b/server/apiStructure/sammoGatewayAPI.ts similarity index 100% rename from server/apiStructure/sammoRootAPI.ts rename to server/apiStructure/sammoGatewayAPI.ts diff --git a/server/clientAPI/sammoRootAPI.ts b/server/clientAPI/sammoGatewayAPI.ts similarity index 77% rename from server/clientAPI/sammoRootAPI.ts rename to server/clientAPI/sammoGatewayAPI.ts index 1b1dcd1..f95c400 100644 --- a/server/clientAPI/sammoRootAPI.ts +++ b/server/clientAPI/sammoGatewayAPI.ts @@ -1,11 +1,11 @@ import { APIPathGen } from "./APIPathGen.js"; import type { APITail, RawArgType } from "../apiStructure/defs.js"; -import { structure } from "../apiStructure/sammoRootAPI.js"; +import { structure } from "../apiStructure/sammoGatewayAPI.js"; import { callClientAPI } from "./generator.js"; const apiRoot = process.env.API_ROOT_PATH ?? process.env.VITE_API_ROOT_PATH ?? '/rootAPI'; -export const SammoRootAPI = APIPathGen(structure, (path: string[], tail: APITail, pathParam) => { +export const SammoGatewayAPI = APIPathGen(structure, (path: string[], tail: APITail, pathParam) => { const method = tail.reqType; return (args?: RawArgType, returnError?: boolean) => { if (returnError) { diff --git a/server/gateway.ts b/server/gateway.ts index 10bc814..53f7e9f 100644 --- a/server/gateway.ts +++ b/server/gateway.ts @@ -5,9 +5,9 @@ import session from "express-session"; import path from 'node:path'; import { LiteHashDRBG } from './util/LiteHashDRBG.js'; import { simpleSerialize } from './util/simpleSerialize.js'; -import { SammoRootAPI } from './clientAPI/sammoRootAPI.js'; +import { SammoGatewayAPI } from './clientAPI/sammoGatewayAPI.js'; import { buildAPISystem } from './api/generator.js'; -import { sammoRootAPI } from './api/root.js'; +import { sammoGatewayAPI } from './api/gatewayAPI.js'; import { unwrap } from './util/unwrap.js'; import { gatewayConfig } from './gatewayConfig.js'; @@ -25,7 +25,7 @@ gatewayDB.then(async (gatewayDB) => { })) //app.set('etag', false); - app.use('/gateway_api', buildAPISystem(sammoRootAPI)); + app.use('/gateway_api', buildAPISystem(sammoGatewayAPI)); // start express server app.listen(gatewayConfig.port)