rootAPI to gatewayAPI

This commit is contained in:
2023-08-20 06:07:06 +00:00
parent 56a9c5bc45
commit f4640abe17
14 changed files with 21 additions and 21 deletions
@@ -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";
@@ -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";
@@ -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";
@@ -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";
@@ -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";
@@ -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";
@@ -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";
+9
View File
@@ -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<typeof structure>;
-9
View File
@@ -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<typeof structure>;
@@ -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) {
+3 -3
View File
@@ -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)