@idb-orm/core 1.0.10 → 1.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,108 +0,0 @@
1
- import { Literable, Promisable } from '../util-types.js';
2
- declare const enum TypeLabel {
3
- string = 0,
4
- number = 1,
5
- boolean = 2,
6
- literal = 3,
7
- date = 4,
8
- symbol = 5,
9
- bigint = 6,
10
- array = 7,
11
- set = 8,
12
- union = 9,
13
- optional = 10,
14
- file = 11,
15
- unknown = 12,
16
- default = 13,
17
- object = 14,
18
- custom = 15
19
- }
20
- export interface StringTag {
21
- tag: TypeLabel.string;
22
- }
23
- export interface NumberTag {
24
- tag: TypeLabel.number;
25
- }
26
- export interface DateTag {
27
- tag: TypeLabel.date;
28
- }
29
- interface BooleanTag {
30
- tag: TypeLabel.boolean;
31
- }
32
- interface SymbolTag {
33
- tag: TypeLabel.symbol;
34
- }
35
- interface BigIntTag {
36
- tag: TypeLabel.bigint;
37
- }
38
- interface UnknownTag {
39
- tag: TypeLabel.unknown;
40
- }
41
- interface FileTag {
42
- tag: TypeLabel.file;
43
- }
44
- interface LiteralTag<V = unknown> {
45
- tag: TypeLabel.literal;
46
- value: V;
47
- }
48
- interface ArrayTag<V extends TypeTag = TypeTag> {
49
- tag: TypeLabel.array;
50
- of: V;
51
- }
52
- interface SetTag<V extends TypeTag = TypeTag> {
53
- tag: TypeLabel.set;
54
- of: V;
55
- }
56
- interface OptionalTag<V extends TypeTag = TypeTag> {
57
- tag: TypeLabel.optional;
58
- of: V;
59
- }
60
- interface UnionTag<V extends TypeTag[] = TypeTag[]> {
61
- tag: TypeLabel.union;
62
- options: V;
63
- }
64
- interface ObjectTag<P extends Record<string, TypeTag> = Record<string, TypeTag>> {
65
- tag: TypeLabel.object;
66
- props: P;
67
- }
68
- interface DefaultTag<V extends TypeTag = TypeTag> {
69
- tag: TypeLabel.default;
70
- of: V;
71
- }
72
- interface CustomTag<V = any> {
73
- tag: TypeLabel.custom;
74
- isType: (test: unknown) => boolean;
75
- serialize?: (value: V) => Promisable<unknown>;
76
- deserialize?: (value: unknown) => Promisable<V>;
77
- }
78
- export type TypeTag = LiteralTag | StringTag | NumberTag | DateTag | BooleanTag | SymbolTag | UnknownTag | FileTag | BigIntTag | SetTag | OptionalTag | UnionTag | ArrayTag | ObjectTag | DefaultTag | CustomTag;
79
- export declare class Type {
80
- static readonly String: StringTag;
81
- static readonly Number: NumberTag;
82
- static readonly Boolean: BooleanTag;
83
- static readonly BigInt: BigIntTag;
84
- static readonly Symbol: SymbolTag;
85
- static readonly File: FileTag;
86
- static readonly Date: DateTag;
87
- static readonly Unknown: UnknownTag;
88
- static Literal<const V extends Literable>(value: V): LiteralTag<V>;
89
- static Array<V extends TypeTag>(element: V): ArrayTag<V>;
90
- static Set<V extends TypeTag>(element: V): SetTag<V>;
91
- static Union<const V extends TypeTag[]>(types: V): UnionTag<V>;
92
- static Optional<V extends TypeTag>(type: V): OptionalTag<V>;
93
- static Object<R extends Record<string, TypeTag>>(props: R): ObjectTag<R>;
94
- static Custom<V>({ isType, serialize, deserialize, }: {
95
- isType: (test: unknown) => boolean;
96
- serialize?: (value: V) => unknown;
97
- deserialize?: (value: unknown) => V;
98
- }): CustomTag<V>;
99
- /**
100
- * Serialize's a type into JSON
101
- * @param type Type
102
- * @param value Value to serialize
103
- */
104
- static serialize(type: TypeTag, value: unknown): Promise<unknown>;
105
- static deserialize<T extends TypeTag>(type: T, value: unknown): Promise<unknown>;
106
- static is<T extends TypeTag>(type: T, value: unknown): boolean;
107
- }
108
- export {};
@@ -1,13 +0,0 @@
1
- import { ParseFn } from './property.js';
2
- /**
3
- *
4
- */
5
- export declare const VALIDATORS: {
6
- 0: ParseFn<string>;
7
- 1: ParseFn<number>;
8
- 6: ParseFn<bigint>;
9
- 2: ParseFn<boolean>;
10
- 5: ParseFn<symbol>;
11
- 12: ParseFn<any>;
12
- 4: ParseFn<Date>;
13
- };