diff --git a/src/index.ts b/src/index.ts index 9d6dd32..c36604d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,3 @@ // export * from './lib/index'; -import { body } from './lib/index'; +// import { body, method } from './lib/index'; diff --git a/src/lib/schema/flag.ts b/src/lib/schema/flag.ts new file mode 100644 index 0000000..cc08257 --- /dev/null +++ b/src/lib/schema/flag.ts @@ -0,0 +1,11 @@ + +interface FlagOptions { + data?: any; +} + +export class Flag { + constructor( + readonly name: string, + readonly options: FlagOptions = null, + ) {} +} diff --git a/src/lib/schema/index.ts b/src/lib/schema/index.ts new file mode 100644 index 0000000..a72753a --- /dev/null +++ b/src/lib/schema/index.ts @@ -0,0 +1,3 @@ + +export * from './flag'; +export * from './schema'; diff --git a/src/lib/schema.ts b/src/lib/schema/schema.ts similarity index 81% rename from src/lib/schema.ts rename to src/lib/schema/schema.ts index 1aabd98..3037be1 100644 --- a/src/lib/schema.ts +++ b/src/lib/schema/schema.ts @@ -3,10 +3,11 @@ * @name Schema * @description A schema which can be validated, stringify, parsed easily transferred over internet. */ +import { Flag } from './flag'; export class EpiSchema { readonly methods: string[] = []; readonly locations: string[] = []; readonly fieldNames: string[] = []; - readonly flags: string[] = []; + readonly flags: Flag[] = []; } diff --git a/src/lib/types/any.type.ts b/src/lib/types/any.type.ts index e7574a8..8c46936 100644 --- a/src/lib/types/any.type.ts +++ b/src/lib/types/any.type.ts @@ -4,7 +4,7 @@ * @description AnyType */ -import { EpiSchema } from '../schema'; +import { EpiSchema, Flag } from '../schema/index'; export abstract class AnyType { protected _schema: EpiSchema = new EpiSchema(); @@ -15,6 +15,7 @@ export abstract class AnyType { */ allow(...values: T[]): this { // TO DO + this._schema.flags.push(new Flag('allow', {data: values})); return this; } /** diff --git a/src/lib/validators/flags.ts b/src/lib/validators/flags.ts index 4ef048c..a448c46 100644 --- a/src/lib/validators/flags.ts +++ b/src/lib/validators/flags.ts @@ -2,7 +2,7 @@ * @description All validator flags. */ -import {} from '../schema'; +import {} from '../schema/schema'; function trim() { // diff --git a/tsconfig.json b/tsconfig.json index 142b418..e2d778b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,7 +4,7 @@ "outDir": "dist/", "noImplicitAny": true, "removeComments": true, - "preserveConstEnums": true, + "experimentalDecorators": true, "sourceMap": true, "declaration": true, "target": "es5",