|
1 | 1 | import chalk from "chalk";
|
2 | 2 | import * as path from "path";
|
3 | 3 | import { TSBuffer } from 'tsbuffer';
|
| 4 | +import { CustomTypeSchema } from "tsbuffer-schema"; |
4 | 5 | import { Counter, Flow, getCustomObjectIdTypes, MsgHandlerManager, MsgService, ParsedServerInput, ServiceMap, ServiceMapUtil, TransportDataUtil } from 'tsrpc-base-client';
|
5 | 6 | import { ApiReturn, ApiServiceDef, BaseServiceType, Logger, LogLevel, ServerInputData, ServiceProto, setLogLevel, TsrpcError, TsrpcErrorType } from 'tsrpc-proto';
|
6 | 7 | import { getClassObjectId } from "../../models/getClassObjectId";
|
@@ -170,7 +171,8 @@ export abstract class BaseServer<ServiceType extends BaseServiceType = BaseServi
|
170 | 171 | // Support mongodb/ObjectId
|
171 | 172 | ...getCustomObjectIdTypes(getClassObjectId())
|
172 | 173 | }, {
|
173 |
| - strictNullChecks: this.options.strictNullChecks |
| 174 | + strictNullChecks: this.options.strictNullChecks, |
| 175 | + customTypes: this.options.customTypes, |
174 | 176 | });
|
175 | 177 | this.serviceMap = ServiceMapUtil.getServiceMap(proto);
|
176 | 178 | this.logger = this.options.logger;
|
@@ -967,6 +969,11 @@ export interface BaseServerOptions<ServiceType extends BaseServiceType> {
|
967 | 969 | * If `NODE_ENV` equals to `production`, the default value is `false`, otherwise is `true`.
|
968 | 970 | */
|
969 | 971 | returnInnerError: boolean;
|
| 972 | + |
| 973 | + /** |
| 974 | + * Customize the protocol data type |
| 975 | + */ |
| 976 | + customTypes?: { [schemaId: string]: CustomTypeSchema } |
970 | 977 | }
|
971 | 978 |
|
972 | 979 | export const defaultBaseServerOptions: BaseServerOptions<any> = {
|
|
0 commit comments