wip
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
"@strpc/def": "workspace:^"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/express": "^4.17.17",
|
||||
"express": "^4.18.2",
|
||||
"express-session": "^1.17.3",
|
||||
"lodash-es": "^4.17.21",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Router, type Request, type Response } from 'express';
|
||||
import type { AnyAPIExecuter, APINamespace } from './defs.js';
|
||||
import type { RawArgType } from '@strpc/def';
|
||||
import type { SafeParseReturnType, ZodType, z } from 'zod';
|
||||
import type { SafeParseReturnType, ZodType } from 'zod';
|
||||
import { flatten } from 'lodash-es';
|
||||
|
||||
const PRINT_API_CALL = true;
|
||||
@@ -107,14 +107,14 @@ async function apiRun<Q extends RawArgType>(query: Q, req: Request, res: Respons
|
||||
let tmp_result = true;
|
||||
let tmp_reason = undefined;
|
||||
if('result' in result){
|
||||
tmp_result = result.result;
|
||||
tmp_result = result.result;
|
||||
}
|
||||
if('reason' in result){
|
||||
tmp_reason = result.reason;
|
||||
}
|
||||
console.log(JSON.stringify([(new Date).toISOString(), req.ip, req.path, tmp_result, tmp_reason]));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (result !== true) {
|
||||
|
||||
@@ -21,8 +21,7 @@ export type DecoratorStack = DecoratorResult[];
|
||||
|
||||
export interface ProcDecorator<Out extends object, In extends object = Empty> {
|
||||
(inCtx: In & Partial<Out>, req: Request, res: Response)
|
||||
: MayBePromise<[DecoratorResultTrue, Out]>
|
||||
| MayBePromise<[DecoratorResultFalse, In & Partial<Out>]>;
|
||||
: MayBePromise<[DecoratorResultTrue, Out] | [DecoratorResultFalse, In & Partial<Out>]>;
|
||||
}
|
||||
|
||||
export interface PostProcDecorator<T extends object> {
|
||||
|
||||
Reference in New Issue
Block a user