@cwqt/refract
Advanced tools
Comparing version 1.3.7 to 1.3.8
import * as Types from '../../types'; | ||
export declare const Key: <T extends string>(...args: [name: T, ...modifiers: Types.Modifier<"EnumKey", "map" | "comment">[]] | [name: T, ...modifiers: Types.Modifier<"EnumKey", "map" | "comment">[], comment: string]) => Types.Fields.EnumKey<T>; | ||
declare type R<E extends Types.Fields.EnumKey[]> = (<M extends Types.Modifiers<'Enum'>>(initial?: E[number]['name'] | null | undefined, ...modifiers: Types.Modifier<'Enum', M>[]) => Types.Fields.Field<'Enum', M>) & Types.Blocks.Enum; | ||
declare type R<E extends Types.Fields.EnumKey[]> = (<M extends Types.Modifiers<'Enum'>>(initial?: E[number]['name'] | Types.Modifier<'Enum', M>, ...modifiers: Types.Modifier<'Enum', M>[]) => Types.Fields.Field<'Enum', M>) & Types.Blocks.Enum; | ||
export declare function Enum<E extends Types.Fields.EnumKey[]>(name: string, ...keys: E): R<E>; | ||
export declare function Enum<E extends Types.Fields.EnumKey[]>(name: string, comment: string, ...keys: E): R<E>; | ||
export {}; |
@@ -37,6 +37,6 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
return new Proxy(this, { | ||
apply: (target, _, args) => target._call(args[0], ...args.slice(1, args.length - 1)), | ||
apply: (target, _, args) => target._call(...args), | ||
}); | ||
} | ||
_call(initial = undefined, ...modifiers) { | ||
_call(initial, ...modifiers) { | ||
return { | ||
@@ -46,9 +46,11 @@ type: 'Enum', | ||
{ type: 'enum', value: this.name }, | ||
initial | ||
? { type: 'default', value: initial } | ||
: initial === null | ||
? { type: 'nullable', value: true } | ||
: | ||
undefined, | ||
...modifiers, | ||
...[ | ||
typeof initial == 'string' | ||
? { | ||
type: 'default', | ||
value: initial, | ||
} | ||
: initial, | ||
...modifiers, | ||
], | ||
].filter((v, i, a) => (0, utils_1.nonNullable)(v) && a.findIndex(m => m.type == v.type) === i), | ||
@@ -55,0 +57,0 @@ }; |
{ | ||
"name": "@cwqt/refract", | ||
"version": "1.3.7", | ||
"version": "1.3.8", | ||
"description": "Generate Prisma from TypeScript", | ||
@@ -5,0 +5,0 @@ "author": "cwqt", |
1837
130159