From 4cf853fd604465b836dda2fd3030024e63b39e92 Mon Sep 17 00:00:00 2001 From: Syd Amir Date: Tue, 31 Oct 2023 20:29:36 +0330 Subject: [PATCH] :bug: fixed objectId validation union --- src/types.ts | 62 +++++++++++++++++++++++++++------------------------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/src/types.ts b/src/types.ts index 759d08f3..5174c97c 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,23 +1,25 @@ -import { ObjectId } from "./npmDeps.ts"; +import { ObjectId, union } from "./npmDeps.ts"; import { instance, size, string } from "./npmDeps.ts"; -import { TLesanBody } from "./utils/checkWants.ts"; -export const objectIdValidation = instance(ObjectId) || size(string(), 24); +export const objectIdValidation = union([ + instance(ObjectId), + size(string(), 24), +]); /** * details of input is include set , get * @public */ export interface Details { - /** - * set of query - */ - set: Record; - /** - * get pf query - * What the client wants to return - */ - get: Record; + /** + * set of query + */ + set: Record; + /** + * get pf query + * What the client wants to return + */ + get: Record; } /** @@ -25,21 +27,21 @@ export interface Details { * @public */ export interface TLesanBody { - /** - * name of service - * "main" | "blog" | "ecommerce" - */ - service?: string; - /** - * model : schema name that client wants - * act : name of Actions - */ - model: string; - act: string; - /** - * details of request set and get - */ - details: Details; + /** + * name of service + * "main" | "blog" | "ecommerce" + */ + service?: string; + /** + * model : schema name that client wants + * act : name of Actions + */ + model: string; + act: string; + /** + * details of request set and get + */ + details: Details; } /** @@ -55,7 +57,7 @@ export interface TLesanBody { * } * */ export interface LesanContenxt { - [key: string]: any; - Headers: Headers; - body: TLesanBody | null; + [key: string]: any; + Headers: Headers; + body: TLesanBody | null; }