rado 0.1.52 → 0.1.53
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.
- package/dist/CPU.20230126.092143.12244.0.001.cpuprofile +1 -0
- package/dist/Column.d.ts +54 -0
- package/dist/Column.js +63 -0
- package/dist/Cursor.d.ts +77 -0
- package/dist/Cursor.js +221 -0
- package/dist/Driver.d.ts +89 -0
- package/dist/Driver.js +262 -0
- package/dist/Expr.d.ts +149 -0
- package/dist/Expr.js +284 -0
- package/dist/Fields.d.ts +11 -0
- package/dist/Fields.js +0 -0
- package/dist/Formatter.d.ts +55 -0
- package/dist/Formatter.js +496 -0
- package/dist/Functions.d.ts +7 -0
- package/dist/Functions.js +11 -0
- package/dist/Id.d.ts +3 -0
- package/dist/Id.js +0 -0
- package/dist/Ops.d.ts +8 -0
- package/dist/Ops.js +45 -0
- package/dist/OrderBy.d.ts +9 -0
- package/dist/OrderBy.js +9 -0
- package/dist/Param.d.ts +15 -0
- package/dist/Param.js +18 -0
- package/dist/Query.d.ts +107 -0
- package/dist/Query.js +74 -0
- package/dist/Sanitizer.d.ts +4 -0
- package/dist/Sanitizer.js +0 -0
- package/dist/Schema.d.ts +23 -0
- package/dist/Schema.js +60 -0
- package/dist/Selection.d.ts +20 -0
- package/dist/Selection.js +7 -0
- package/dist/Statement.d.ts +57 -0
- package/dist/Statement.js +184 -0
- package/dist/Table.d.ts +56 -0
- package/dist/Table.js +104 -0
- package/dist/Target.d.ts +30 -0
- package/dist/Target.js +37 -0
- package/dist/Update.d.ts +4 -0
- package/dist/Update.js +0 -0
- package/dist/define/Column.d.ts +58 -58
- package/dist/define/Cursor.d.ts +85 -85
- package/dist/define/Expr.d.ts +154 -154
- package/dist/define/Fields.d.ts +13 -13
- package/dist/define/Functions.d.ts +5 -5
- package/dist/define/Id.d.ts +3 -3
- package/dist/define/Index.d.ts +17 -17
- package/dist/define/Ops.d.ts +7 -7
- package/dist/define/OrderBy.d.ts +9 -9
- package/dist/define/Param.d.ts +15 -15
- package/dist/define/Query.d.ts +109 -109
- package/dist/define/Schema.d.ts +18 -18
- package/dist/define/Selection.d.ts +20 -20
- package/dist/define/Table.d.ts +62 -62
- package/dist/define/Target.d.ts +38 -38
- package/dist/define/Update.d.ts +4 -4
- package/dist/driver/better-sqlite3.d.ts +15 -15
- package/dist/driver/bun-sqlite.d.ts +18 -18
- package/dist/driver/sql.js.d.ts +15 -15
- package/dist/driver/sqlite3.d.ts +18 -18
- package/dist/index.d.ts +21 -21
- package/dist/lib/Column.d.ts +57 -0
- package/dist/lib/Column.js +63 -0
- package/dist/lib/Cursor.d.ts +79 -0
- package/dist/lib/Cursor.js +231 -0
- package/dist/lib/Driver.d.ts +110 -110
- package/dist/lib/Expr.d.ts +154 -0
- package/dist/lib/Expr.js +284 -0
- package/dist/lib/Fields.d.ts +13 -0
- package/dist/lib/Fields.js +0 -0
- package/dist/lib/Formatter.d.ts +78 -67
- package/dist/lib/Formatter.js +13 -9
- package/dist/lib/Functions.d.ts +5 -0
- package/dist/lib/Functions.js +11 -0
- package/dist/lib/Id.d.ts +3 -0
- package/dist/lib/Id.js +0 -0
- package/dist/lib/Index.d.ts +17 -0
- package/dist/lib/Index.js +20 -0
- package/dist/lib/Ops.d.ts +8 -0
- package/dist/lib/Ops.js +45 -0
- package/dist/lib/OrderBy.d.ts +9 -0
- package/dist/lib/OrderBy.js +9 -0
- package/dist/lib/Param.d.ts +20 -0
- package/dist/lib/Param.js +27 -0
- package/dist/lib/Query.d.ts +109 -0
- package/dist/lib/Query.js +74 -0
- package/dist/lib/Sanitizer.d.ts +5 -5
- package/dist/lib/Schema.d.ts +18 -0
- package/dist/lib/Schema.js +67 -0
- package/dist/lib/Selection.d.ts +20 -0
- package/dist/lib/Selection.js +7 -0
- package/dist/lib/SqlError.d.ts +3 -3
- package/dist/lib/Statement.d.ts +33 -29
- package/dist/lib/Statement.js +10 -7
- package/dist/lib/Table.d.ts +62 -0
- package/dist/lib/Table.js +130 -0
- package/dist/lib/Target.d.ts +30 -0
- package/dist/lib/Target.js +37 -0
- package/dist/lib/Update.d.ts +4 -0
- package/dist/lib/Update.js +0 -0
- package/dist/sqlite/SqliteFormatter.d.ts +11 -11
- package/dist/sqlite/SqliteFunctions.d.ts +165 -165
- package/dist/sqlite/SqliteSchema.d.ts +25 -25
- package/dist/sqlite/index.d.ts +2 -0
- package/dist/sqlite/index.js +3 -0
- package/dist/sqlite.d.ts +2 -2
- package/dist/src/driver/better-sqlite3.js +49 -0
- package/dist/src/driver/sql.js.js +66 -0
- package/dist/src/driver/sqlite3.js +87 -0
- package/dist/src/index.js +24 -0
- package/dist/src/lib/Column.js +63 -0
- package/dist/src/lib/Cursor.js +231 -0
- package/dist/src/lib/Driver.js +316 -0
- package/dist/src/lib/Expr.js +284 -0
- package/dist/src/lib/Fields.js +0 -0
- package/dist/src/lib/Formatter.js +625 -0
- package/dist/src/lib/Functions.js +11 -0
- package/dist/src/lib/Id.js +0 -0
- package/dist/src/lib/Index.js +20 -0
- package/dist/src/lib/Ops.js +45 -0
- package/dist/src/lib/OrderBy.js +9 -0
- package/dist/src/lib/Param.js +27 -0
- package/dist/src/lib/Query.js +74 -0
- package/dist/src/lib/Sanitizer.js +0 -0
- package/dist/src/lib/Schema.js +67 -0
- package/dist/src/lib/Selection.js +7 -0
- package/dist/src/lib/Statement.js +103 -0
- package/dist/src/lib/Table.js +130 -0
- package/dist/src/lib/Target.js +37 -0
- package/dist/src/lib/Update.js +0 -0
- package/dist/src/sqlite/SqliteFormatter.js +67 -0
- package/dist/src/sqlite/SqliteFunctions.js +146 -0
- package/dist/src/sqlite/SqliteSchema.js +47 -0
- package/dist/src/sqlite.js +3 -0
- package/dist/test/DbSuite.js +28 -0
- package/dist/test/TSTestTypes.js +6 -0
- package/dist/test/TestBasic.js +172 -0
- package/dist/test/TestExtend.js +68 -0
- package/dist/test/TestFts5.js +34 -0
- package/dist/test/TestFunctions.js +28 -0
- package/dist/test/TestJoins.js +34 -0
- package/dist/test/TestJson.js +33 -0
- package/dist/test/TestPrepare.js +27 -0
- package/dist/test/TestRawSql.js +31 -0
- package/dist/test/TestSchema.js +69 -0
- package/dist/test/TestSubQueries.js +79 -0
- package/dist/test/TestTransaction.js +54 -0
- package/dist/test/TestUpdate.js +95 -0
- package/dist/test/index.js +14 -0
- package/package.json +60 -60
package/dist/lib/Driver.d.ts
CHANGED
|
@@ -1,110 +1,110 @@
|
|
|
1
|
-
import { Cursor } from '../define/Cursor';
|
|
2
|
-
import { Expr } from '../define/Expr';
|
|
3
|
-
import { Query } from '../define/Query';
|
|
4
|
-
import { SchemaInstructions } from '../define/Schema';
|
|
5
|
-
import { Table } from '../define/Table';
|
|
6
|
-
import { Formatter } from './Formatter';
|
|
7
|
-
import { Statement } from './Statement';
|
|
8
|
-
declare class Callable extends Function {
|
|
9
|
-
constructor(fn: Function);
|
|
10
|
-
}
|
|
11
|
-
declare abstract class DriverBase extends Callable {
|
|
12
|
-
formatter: Formatter;
|
|
13
|
-
constructor(formatter: Formatter);
|
|
14
|
-
compile<T extends Array<Expr<any>>, R>(create: (...params: T) => Cursor<R>): [Query<T>, Statement];
|
|
15
|
-
all(...args: Array<any>): any;
|
|
16
|
-
get(...args: Array<any>): any;
|
|
17
|
-
sql(strings: TemplateStringsArray, ...params: Array<any>): Cursor<unknown>;
|
|
18
|
-
executeTemplate(expectedReturn: Query.RawReturn, strings: TemplateStringsArray, ...params: Array<any>): any;
|
|
19
|
-
abstract executeQuery(query: Query<any>): any;
|
|
20
|
-
}
|
|
21
|
-
type ParamTypes<Params extends [...any[]]> = {
|
|
22
|
-
[K in keyof Params]: Params[K] extends Expr<infer T> ? T : never;
|
|
23
|
-
} & {
|
|
24
|
-
length: Params['length'];
|
|
25
|
-
};
|
|
26
|
-
interface SyncDriver {
|
|
27
|
-
<T>(query: Cursor<T>): T;
|
|
28
|
-
<T>(...queries: Array<Cursor<any>>): T;
|
|
29
|
-
(strings: TemplateStringsArray, ...values: any[]): any;
|
|
30
|
-
}
|
|
31
|
-
declare abstract class SyncDriver extends DriverBase {
|
|
32
|
-
transactionId: number;
|
|
33
|
-
abstract prepareStatement(stmt: Statement, discardAfter: boolean): SyncPreparedStatement;
|
|
34
|
-
abstract schemaInstructions(tableName: string): SchemaInstructions | undefined;
|
|
35
|
-
prepare<T extends Array<Expr<any>>, R>(create: (...params: T) => Cursor<R>): (...params: ParamTypes<T>) => R;
|
|
36
|
-
migrateSchema(...tables: Array<Table<any>>): unknown;
|
|
37
|
-
executeQuery<T>(query: Query<T>, stmt?: SyncPreparedStatement, params?: Array<any>): T;
|
|
38
|
-
all<T>(cursor: Cursor.SelectSingle<T>): Array<T>;
|
|
39
|
-
all<T>(cursor: Cursor<T>): T;
|
|
40
|
-
all<T>(strings: TemplateStringsArray, ...params: Array<any>): Array<T>;
|
|
41
|
-
get<T>(cursor: Cursor.SelectMultiple<T>): T | null;
|
|
42
|
-
get<T>(cursor: Cursor<T>): T;
|
|
43
|
-
get<T>(strings: TemplateStringsArray, ...params: Array<any>): T;
|
|
44
|
-
iterate<T>(cursor: Cursor.SelectMultiple<T>): Iterable<T>;
|
|
45
|
-
transaction<T>(run: (query: SyncDriver) => T): T;
|
|
46
|
-
toAsync(): SyncWrapper;
|
|
47
|
-
}
|
|
48
|
-
interface SyncPreparedStatement {
|
|
49
|
-
run(params?: Array<any>): {
|
|
50
|
-
rowsAffected: number;
|
|
51
|
-
};
|
|
52
|
-
iterate<T>(params?: Array<any>): Iterable<T>;
|
|
53
|
-
all<T>(params?: Array<any>): Array<T>;
|
|
54
|
-
get<T>(params?: Array<any>): T;
|
|
55
|
-
execute(params?: Array<any>): void;
|
|
56
|
-
}
|
|
57
|
-
interface AsyncDriver {
|
|
58
|
-
<T>(query: Cursor<T>): Promise<T>;
|
|
59
|
-
<T>(...queries: Array<Cursor<any>>): Promise<T>;
|
|
60
|
-
(strings: TemplateStringsArray, ...values: any[]): Promise<any>;
|
|
61
|
-
}
|
|
62
|
-
declare abstract class AsyncDriver extends DriverBase {
|
|
63
|
-
transactionId: number;
|
|
64
|
-
abstract isolate(): [connection: AsyncDriver, release: () => Promise<void>];
|
|
65
|
-
abstract prepareStatement(stmt: Statement, discardAfter: boolean): AsyncPreparedStatement;
|
|
66
|
-
abstract schemaInstructions(tableName: string): Promise<SchemaInstructions | undefined>;
|
|
67
|
-
prepare<T extends Array<Expr<any>>, R>(create: (...params: T) => Cursor<R>): (...params: ParamTypes<T>) => Promise<R>;
|
|
68
|
-
migrateSchema(...tables: Array<Table<any>>): Promise<unknown>;
|
|
69
|
-
executeQuery<T>(query: Query<T>, stmt?: AsyncPreparedStatement, params?: Array<any>): Promise<T>;
|
|
70
|
-
all<T>(cursor: Cursor.SelectSingle<T>): Promise<Array<T>>;
|
|
71
|
-
all<T>(cursor: Cursor<T>): Promise<T>;
|
|
72
|
-
all<T>(strings: TemplateStringsArray, ...params: Array<any>): Promise<Array<T>>;
|
|
73
|
-
get<T>(cursor: Cursor.SelectMultiple<T>): Promise<T | null>;
|
|
74
|
-
get<T>(cursor: Cursor<T>): Promise<T>;
|
|
75
|
-
get<T>(strings: TemplateStringsArray, ...params: Array<any>): Promise<T>;
|
|
76
|
-
iterate<T>(cursor: Cursor.SelectMultiple<T>): AsyncIterable<T>;
|
|
77
|
-
transaction<T>(run: (query: AsyncDriver) => T): Promise<T>;
|
|
78
|
-
}
|
|
79
|
-
declare class SyncWrapper extends AsyncDriver {
|
|
80
|
-
private sync;
|
|
81
|
-
lock: Promise<void> | undefined;
|
|
82
|
-
constructor(sync: SyncDriver);
|
|
83
|
-
executeQuery<T>(query: Query<T>, stmt?: AsyncPreparedStatement, params?: Array<any>): Promise<T>;
|
|
84
|
-
prepareStatement(stmt: Statement, discardAfter: boolean): AsyncPreparedStatement;
|
|
85
|
-
schemaInstructions(tableName: string): Promise<SchemaInstructions | undefined>;
|
|
86
|
-
isolate(): [connection: AsyncDriver, release: () => Promise<void>];
|
|
87
|
-
}
|
|
88
|
-
interface AsyncPreparedStatement {
|
|
89
|
-
run(params?: Array<any>): Promise<{
|
|
90
|
-
rowsAffected: number;
|
|
91
|
-
}>;
|
|
92
|
-
iterate<T>(params?: Array<any>): AsyncIterable<T>;
|
|
93
|
-
all<T>(params?: Array<any>): Promise<Array<T>>;
|
|
94
|
-
get<T>(params?: Array<any>): Promise<T>;
|
|
95
|
-
execute(params?: Array<any>): Promise<void>;
|
|
96
|
-
}
|
|
97
|
-
export type Driver = SyncDriver | AsyncDriver;
|
|
98
|
-
export declare namespace Driver {
|
|
99
|
-
type Sync = SyncDriver;
|
|
100
|
-
const Sync: typeof SyncDriver;
|
|
101
|
-
namespace Sync {
|
|
102
|
-
type PreparedStatement = SyncPreparedStatement;
|
|
103
|
-
}
|
|
104
|
-
type Async = AsyncDriver;
|
|
105
|
-
const Async: typeof AsyncDriver;
|
|
106
|
-
namespace Async {
|
|
107
|
-
type PreparedStatement = AsyncPreparedStatement;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
export {};
|
|
1
|
+
import { Cursor } from '../define/Cursor';
|
|
2
|
+
import { Expr } from '../define/Expr';
|
|
3
|
+
import { Query } from '../define/Query';
|
|
4
|
+
import { SchemaInstructions } from '../define/Schema';
|
|
5
|
+
import { Table } from '../define/Table';
|
|
6
|
+
import { Formatter } from './Formatter';
|
|
7
|
+
import { Statement } from './Statement';
|
|
8
|
+
declare class Callable extends Function {
|
|
9
|
+
constructor(fn: Function);
|
|
10
|
+
}
|
|
11
|
+
declare abstract class DriverBase extends Callable {
|
|
12
|
+
formatter: Formatter;
|
|
13
|
+
constructor(formatter: Formatter);
|
|
14
|
+
compile<T extends Array<Expr<any>>, R>(create: (...params: T) => Cursor<R>): [Query<T>, Statement];
|
|
15
|
+
all(...args: Array<any>): any;
|
|
16
|
+
get(...args: Array<any>): any;
|
|
17
|
+
sql(strings: TemplateStringsArray, ...params: Array<any>): Cursor<unknown>;
|
|
18
|
+
executeTemplate(expectedReturn: Query.RawReturn, strings: TemplateStringsArray, ...params: Array<any>): any;
|
|
19
|
+
abstract executeQuery(query: Query<any>): any;
|
|
20
|
+
}
|
|
21
|
+
type ParamTypes<Params extends [...any[]]> = {
|
|
22
|
+
[K in keyof Params]: Params[K] extends Expr<infer T> ? T : never;
|
|
23
|
+
} & {
|
|
24
|
+
length: Params['length'];
|
|
25
|
+
};
|
|
26
|
+
interface SyncDriver {
|
|
27
|
+
<T>(query: Cursor<T>): T;
|
|
28
|
+
<T>(...queries: Array<Cursor<any>>): T;
|
|
29
|
+
(strings: TemplateStringsArray, ...values: any[]): any;
|
|
30
|
+
}
|
|
31
|
+
declare abstract class SyncDriver extends DriverBase {
|
|
32
|
+
transactionId: number;
|
|
33
|
+
abstract prepareStatement(stmt: Statement, discardAfter: boolean): SyncPreparedStatement;
|
|
34
|
+
abstract schemaInstructions(tableName: string): SchemaInstructions | undefined;
|
|
35
|
+
prepare<T extends Array<Expr<any>>, R>(create: (...params: T) => Cursor<R>): (...params: ParamTypes<T>) => R;
|
|
36
|
+
migrateSchema(...tables: Array<Table<any>>): unknown;
|
|
37
|
+
executeQuery<T>(query: Query<T>, stmt?: SyncPreparedStatement, params?: Array<any>): T;
|
|
38
|
+
all<T>(cursor: Cursor.SelectSingle<T>): Array<T>;
|
|
39
|
+
all<T>(cursor: Cursor<T>): T;
|
|
40
|
+
all<T>(strings: TemplateStringsArray, ...params: Array<any>): Array<T>;
|
|
41
|
+
get<T>(cursor: Cursor.SelectMultiple<T>): T | null;
|
|
42
|
+
get<T>(cursor: Cursor<T>): T;
|
|
43
|
+
get<T>(strings: TemplateStringsArray, ...params: Array<any>): T;
|
|
44
|
+
iterate<T>(cursor: Cursor.SelectMultiple<T>): Iterable<T>;
|
|
45
|
+
transaction<T>(run: (query: SyncDriver) => T): T;
|
|
46
|
+
toAsync(): SyncWrapper;
|
|
47
|
+
}
|
|
48
|
+
interface SyncPreparedStatement {
|
|
49
|
+
run(params?: Array<any>): {
|
|
50
|
+
rowsAffected: number;
|
|
51
|
+
};
|
|
52
|
+
iterate<T>(params?: Array<any>): Iterable<T>;
|
|
53
|
+
all<T>(params?: Array<any>): Array<T>;
|
|
54
|
+
get<T>(params?: Array<any>): T;
|
|
55
|
+
execute(params?: Array<any>): void;
|
|
56
|
+
}
|
|
57
|
+
interface AsyncDriver {
|
|
58
|
+
<T>(query: Cursor<T>): Promise<T>;
|
|
59
|
+
<T>(...queries: Array<Cursor<any>>): Promise<T>;
|
|
60
|
+
(strings: TemplateStringsArray, ...values: any[]): Promise<any>;
|
|
61
|
+
}
|
|
62
|
+
declare abstract class AsyncDriver extends DriverBase {
|
|
63
|
+
transactionId: number;
|
|
64
|
+
abstract isolate(): [connection: AsyncDriver, release: () => Promise<void>];
|
|
65
|
+
abstract prepareStatement(stmt: Statement, discardAfter: boolean): AsyncPreparedStatement;
|
|
66
|
+
abstract schemaInstructions(tableName: string): Promise<SchemaInstructions | undefined>;
|
|
67
|
+
prepare<T extends Array<Expr<any>>, R>(create: (...params: T) => Cursor<R>): (...params: ParamTypes<T>) => Promise<R>;
|
|
68
|
+
migrateSchema(...tables: Array<Table<any>>): Promise<unknown>;
|
|
69
|
+
executeQuery<T>(query: Query<T>, stmt?: AsyncPreparedStatement, params?: Array<any>): Promise<T>;
|
|
70
|
+
all<T>(cursor: Cursor.SelectSingle<T>): Promise<Array<T>>;
|
|
71
|
+
all<T>(cursor: Cursor<T>): Promise<T>;
|
|
72
|
+
all<T>(strings: TemplateStringsArray, ...params: Array<any>): Promise<Array<T>>;
|
|
73
|
+
get<T>(cursor: Cursor.SelectMultiple<T>): Promise<T | null>;
|
|
74
|
+
get<T>(cursor: Cursor<T>): Promise<T>;
|
|
75
|
+
get<T>(strings: TemplateStringsArray, ...params: Array<any>): Promise<T>;
|
|
76
|
+
iterate<T>(cursor: Cursor.SelectMultiple<T>): AsyncIterable<T>;
|
|
77
|
+
transaction<T>(run: (query: AsyncDriver) => T): Promise<T>;
|
|
78
|
+
}
|
|
79
|
+
declare class SyncWrapper extends AsyncDriver {
|
|
80
|
+
private sync;
|
|
81
|
+
lock: Promise<void> | undefined;
|
|
82
|
+
constructor(sync: SyncDriver);
|
|
83
|
+
executeQuery<T>(query: Query<T>, stmt?: AsyncPreparedStatement, params?: Array<any>): Promise<T>;
|
|
84
|
+
prepareStatement(stmt: Statement, discardAfter: boolean): AsyncPreparedStatement;
|
|
85
|
+
schemaInstructions(tableName: string): Promise<SchemaInstructions | undefined>;
|
|
86
|
+
isolate(): [connection: AsyncDriver, release: () => Promise<void>];
|
|
87
|
+
}
|
|
88
|
+
interface AsyncPreparedStatement {
|
|
89
|
+
run(params?: Array<any>): Promise<{
|
|
90
|
+
rowsAffected: number;
|
|
91
|
+
}>;
|
|
92
|
+
iterate<T>(params?: Array<any>): AsyncIterable<T>;
|
|
93
|
+
all<T>(params?: Array<any>): Promise<Array<T>>;
|
|
94
|
+
get<T>(params?: Array<any>): Promise<T>;
|
|
95
|
+
execute(params?: Array<any>): Promise<void>;
|
|
96
|
+
}
|
|
97
|
+
export type Driver = SyncDriver | AsyncDriver;
|
|
98
|
+
export declare namespace Driver {
|
|
99
|
+
type Sync = SyncDriver;
|
|
100
|
+
const Sync: typeof SyncDriver;
|
|
101
|
+
namespace Sync {
|
|
102
|
+
type PreparedStatement = SyncPreparedStatement;
|
|
103
|
+
}
|
|
104
|
+
type Async = AsyncDriver;
|
|
105
|
+
const Async: typeof AsyncDriver;
|
|
106
|
+
namespace Async {
|
|
107
|
+
type PreparedStatement = AsyncPreparedStatement;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
export {};
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { Cursor } from './Cursor';
|
|
2
|
+
import { Fields } from './Fields';
|
|
3
|
+
import { OrderBy } from './OrderBy';
|
|
4
|
+
import { ParamData } from './Param';
|
|
5
|
+
import { Query } from './Query';
|
|
6
|
+
import { Selection } from './Selection';
|
|
7
|
+
import { Target } from './Target';
|
|
8
|
+
export declare enum UnOp {
|
|
9
|
+
Not = "Not",
|
|
10
|
+
IsNull = "IsNull"
|
|
11
|
+
}
|
|
12
|
+
export declare enum BinOp {
|
|
13
|
+
Add = "Add",
|
|
14
|
+
Subt = "Subt",
|
|
15
|
+
Mult = "Mult",
|
|
16
|
+
Mod = "Mod",
|
|
17
|
+
Div = "Div",
|
|
18
|
+
Greater = "Greater",
|
|
19
|
+
GreaterOrEqual = "GreaterOrEqual",
|
|
20
|
+
Less = "Less",
|
|
21
|
+
LessOrEqual = "LessOrEqual",
|
|
22
|
+
Equals = "Equals",
|
|
23
|
+
NotEquals = "NotEquals",
|
|
24
|
+
And = "And",
|
|
25
|
+
Or = "Or",
|
|
26
|
+
Like = "Like",
|
|
27
|
+
Glob = "Glob",
|
|
28
|
+
Match = "Match",
|
|
29
|
+
In = "In",
|
|
30
|
+
NotIn = "NotIn",
|
|
31
|
+
Concat = "Concat"
|
|
32
|
+
}
|
|
33
|
+
export declare enum ExprType {
|
|
34
|
+
UnOp = "UnOp",
|
|
35
|
+
BinOp = "BinOp",
|
|
36
|
+
Field = "Field",
|
|
37
|
+
Param = "Param",
|
|
38
|
+
Call = "Call",
|
|
39
|
+
Query = "Query",
|
|
40
|
+
Record = "Record",
|
|
41
|
+
Row = "Row",
|
|
42
|
+
Map = "Map",
|
|
43
|
+
Filter = "Filter",
|
|
44
|
+
Merge = "Merge",
|
|
45
|
+
Case = "Case"
|
|
46
|
+
}
|
|
47
|
+
export type ExprData = {
|
|
48
|
+
type: ExprType.UnOp;
|
|
49
|
+
op: UnOp;
|
|
50
|
+
expr: ExprData;
|
|
51
|
+
} | {
|
|
52
|
+
type: ExprType.BinOp;
|
|
53
|
+
op: BinOp;
|
|
54
|
+
a: ExprData;
|
|
55
|
+
b: ExprData;
|
|
56
|
+
} | {
|
|
57
|
+
type: ExprType.Field;
|
|
58
|
+
expr: ExprData;
|
|
59
|
+
field: string;
|
|
60
|
+
} | {
|
|
61
|
+
type: ExprType.Param;
|
|
62
|
+
param: ParamData;
|
|
63
|
+
} | {
|
|
64
|
+
type: ExprType.Call;
|
|
65
|
+
method: string;
|
|
66
|
+
params: Array<ExprData>;
|
|
67
|
+
} | {
|
|
68
|
+
type: ExprType.Query;
|
|
69
|
+
query: Query.Select;
|
|
70
|
+
} | {
|
|
71
|
+
type: ExprType.Record;
|
|
72
|
+
fields: Record<string, ExprData>;
|
|
73
|
+
} | {
|
|
74
|
+
type: ExprType.Merge;
|
|
75
|
+
a: ExprData;
|
|
76
|
+
b: ExprData;
|
|
77
|
+
} | {
|
|
78
|
+
type: ExprType.Row;
|
|
79
|
+
target: Target;
|
|
80
|
+
} | {
|
|
81
|
+
type: ExprType.Map;
|
|
82
|
+
target: Target;
|
|
83
|
+
result: ExprData;
|
|
84
|
+
} | {
|
|
85
|
+
type: ExprType.Filter;
|
|
86
|
+
target: Target;
|
|
87
|
+
condition: ExprData;
|
|
88
|
+
} | {
|
|
89
|
+
type: ExprType.Case;
|
|
90
|
+
expr: ExprData;
|
|
91
|
+
cases: Record<string, ExprData>;
|
|
92
|
+
defaultCase?: ExprData;
|
|
93
|
+
};
|
|
94
|
+
export declare const ExprData: {
|
|
95
|
+
UnOp(op: UnOp, expr: ExprData): ExprData;
|
|
96
|
+
BinOp(op: BinOp, a: ExprData, b: ExprData): ExprData;
|
|
97
|
+
Field(expr: ExprData, field: string): ExprData;
|
|
98
|
+
Param(param: ParamData): ExprData;
|
|
99
|
+
Call(method: string, params: Array<ExprData>): ExprData;
|
|
100
|
+
Query(query: Query.Select): ExprData;
|
|
101
|
+
Record(fields: Record<string, ExprData>): ExprData;
|
|
102
|
+
Merge(a: ExprData, b: ExprData): ExprData;
|
|
103
|
+
Row(target: Target): ExprData;
|
|
104
|
+
Map(target: Target, result: ExprData): ExprData;
|
|
105
|
+
Filter(target: Target, condition: ExprData): ExprData;
|
|
106
|
+
Case(expr: ExprData, cases: Record<string, ExprData>, defaultCase?: ExprData): ExprData;
|
|
107
|
+
create(input: any): ExprData;
|
|
108
|
+
};
|
|
109
|
+
/** Expression or value of type T */
|
|
110
|
+
export type EV<T> = Expr<T> | T;
|
|
111
|
+
export declare class Expr<T> {
|
|
112
|
+
expr: ExprData;
|
|
113
|
+
static NULL: ExprData;
|
|
114
|
+
static value<T>(value: T): Expr<T>;
|
|
115
|
+
static create<T>(input: EV<T>): Expr<T>;
|
|
116
|
+
static and(...conditions: Array<EV<boolean>>): Expr<boolean>;
|
|
117
|
+
static or(...conditions: Array<EV<boolean>>): Expr<boolean>;
|
|
118
|
+
constructor(expr: ExprData);
|
|
119
|
+
asc(): OrderBy;
|
|
120
|
+
desc(): OrderBy;
|
|
121
|
+
not(): Expr<boolean>;
|
|
122
|
+
or(this: Expr<boolean>, that: EV<boolean>): Expr<boolean>;
|
|
123
|
+
and(this: Expr<boolean>, that: EV<boolean>): Expr<boolean>;
|
|
124
|
+
isNull(): Expr<boolean>;
|
|
125
|
+
isNotNull(): Expr<boolean>;
|
|
126
|
+
isNot(that: EV<T>): Expr<boolean>;
|
|
127
|
+
is(that: EV<T> | Cursor.SelectSingle<T>): Expr<boolean>;
|
|
128
|
+
isIn(that: EV<Array<T>> | Cursor<T>): Expr<boolean>;
|
|
129
|
+
isNotIn(that: EV<Array<T>> | Cursor<T>): Expr<boolean>;
|
|
130
|
+
add(this: Expr<number>, that: EV<number>): Expr<number>;
|
|
131
|
+
substract(this: Expr<number>, that: EV<number>): Expr<number>;
|
|
132
|
+
multiply(this: Expr<number>, that: EV<number>): Expr<number>;
|
|
133
|
+
remainder(this: Expr<number>, that: EV<number>): Expr<number>;
|
|
134
|
+
divide(this: Expr<number>, that: EV<number>): Expr<number>;
|
|
135
|
+
greater(that: EV<any>): Expr<boolean>;
|
|
136
|
+
greaterOrEqual(that: EV<any>): Expr<boolean>;
|
|
137
|
+
less(that: EV<any>): Expr<boolean>;
|
|
138
|
+
lessOrEqual(that: EV<any>): Expr<boolean>;
|
|
139
|
+
concat(this: Expr<string>, that: EV<string>): Expr<string>;
|
|
140
|
+
like(this: Expr<string>, that: EV<string>): Expr<boolean>;
|
|
141
|
+
glob(this: Expr<string>, that: EV<string>): Expr<boolean>;
|
|
142
|
+
match(this: Expr<string>, that: EV<string>): Expr<boolean>;
|
|
143
|
+
with<X extends Selection>(that: X): Selection.With<T, X>;
|
|
144
|
+
at<T>(this: Expr<Array<T>>, index: number): Expr<T | null>;
|
|
145
|
+
filter<T>(this: Expr<Array<T>>, fn: (cursor: Fields<T>) => Expr<boolean>): Expr<Array<T>>;
|
|
146
|
+
map<T, X extends Selection>(this: Expr<Array<T>>, fn: (cursor: Fields<T>) => X): Expr<Array<Selection.Infer<X>>>;
|
|
147
|
+
sure(): Expr<NonNullable<T>>;
|
|
148
|
+
get<T>(name: string): Expr<T>;
|
|
149
|
+
}
|
|
150
|
+
export declare namespace Expr {
|
|
151
|
+
type Record<T> = Expr<T> & {
|
|
152
|
+
[K in keyof T]: Expr<T[K]>;
|
|
153
|
+
};
|
|
154
|
+
}
|
package/dist/lib/Expr.js
ADDED
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => {
|
|
4
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
+
return value;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
// src/lib/Expr.ts
|
|
9
|
+
import { OrderDirection } from "./OrderBy.js";
|
|
10
|
+
import { ParamData, ParamType } from "./Param.js";
|
|
11
|
+
import { Target } from "./Target.js";
|
|
12
|
+
var UnOp = /* @__PURE__ */ ((UnOp2) => {
|
|
13
|
+
UnOp2["Not"] = "Not";
|
|
14
|
+
UnOp2["IsNull"] = "IsNull";
|
|
15
|
+
return UnOp2;
|
|
16
|
+
})(UnOp || {});
|
|
17
|
+
var BinOp = /* @__PURE__ */ ((BinOp2) => {
|
|
18
|
+
BinOp2["Add"] = "Add";
|
|
19
|
+
BinOp2["Subt"] = "Subt";
|
|
20
|
+
BinOp2["Mult"] = "Mult";
|
|
21
|
+
BinOp2["Mod"] = "Mod";
|
|
22
|
+
BinOp2["Div"] = "Div";
|
|
23
|
+
BinOp2["Greater"] = "Greater";
|
|
24
|
+
BinOp2["GreaterOrEqual"] = "GreaterOrEqual";
|
|
25
|
+
BinOp2["Less"] = "Less";
|
|
26
|
+
BinOp2["LessOrEqual"] = "LessOrEqual";
|
|
27
|
+
BinOp2["Equals"] = "Equals";
|
|
28
|
+
BinOp2["NotEquals"] = "NotEquals";
|
|
29
|
+
BinOp2["And"] = "And";
|
|
30
|
+
BinOp2["Or"] = "Or";
|
|
31
|
+
BinOp2["Like"] = "Like";
|
|
32
|
+
BinOp2["Glob"] = "Glob";
|
|
33
|
+
BinOp2["Match"] = "Match";
|
|
34
|
+
BinOp2["In"] = "In";
|
|
35
|
+
BinOp2["NotIn"] = "NotIn";
|
|
36
|
+
BinOp2["Concat"] = "Concat";
|
|
37
|
+
return BinOp2;
|
|
38
|
+
})(BinOp || {});
|
|
39
|
+
var ExprType = /* @__PURE__ */ ((ExprType2) => {
|
|
40
|
+
ExprType2["UnOp"] = "UnOp";
|
|
41
|
+
ExprType2["BinOp"] = "BinOp";
|
|
42
|
+
ExprType2["Field"] = "Field";
|
|
43
|
+
ExprType2["Param"] = "Param";
|
|
44
|
+
ExprType2["Call"] = "Call";
|
|
45
|
+
ExprType2["Query"] = "Query";
|
|
46
|
+
ExprType2["Record"] = "Record";
|
|
47
|
+
ExprType2["Row"] = "Row";
|
|
48
|
+
ExprType2["Map"] = "Map";
|
|
49
|
+
ExprType2["Filter"] = "Filter";
|
|
50
|
+
ExprType2["Merge"] = "Merge";
|
|
51
|
+
ExprType2["Case"] = "Case";
|
|
52
|
+
return ExprType2;
|
|
53
|
+
})(ExprType || {});
|
|
54
|
+
var ExprData = {
|
|
55
|
+
UnOp(op, expr) {
|
|
56
|
+
return { type: "UnOp" /* UnOp */, op, expr };
|
|
57
|
+
},
|
|
58
|
+
BinOp(op, a, b) {
|
|
59
|
+
return { type: "BinOp" /* BinOp */, op, a, b };
|
|
60
|
+
},
|
|
61
|
+
Field(expr, field) {
|
|
62
|
+
return { type: "Field" /* Field */, expr, field };
|
|
63
|
+
},
|
|
64
|
+
Param(param) {
|
|
65
|
+
return { type: "Param" /* Param */, param };
|
|
66
|
+
},
|
|
67
|
+
Call(method, params) {
|
|
68
|
+
return { type: "Call" /* Call */, method, params };
|
|
69
|
+
},
|
|
70
|
+
Query(query) {
|
|
71
|
+
return { type: "Query" /* Query */, query };
|
|
72
|
+
},
|
|
73
|
+
Record(fields) {
|
|
74
|
+
return { type: "Record" /* Record */, fields };
|
|
75
|
+
},
|
|
76
|
+
Merge(a, b) {
|
|
77
|
+
return { type: "Merge" /* Merge */, a, b };
|
|
78
|
+
},
|
|
79
|
+
Row(target) {
|
|
80
|
+
return { type: "Row" /* Row */, target };
|
|
81
|
+
},
|
|
82
|
+
Map(target, result) {
|
|
83
|
+
return { type: "Map" /* Map */, target, result };
|
|
84
|
+
},
|
|
85
|
+
Filter(target, condition) {
|
|
86
|
+
return { type: "Filter" /* Filter */, target, condition };
|
|
87
|
+
},
|
|
88
|
+
Case(expr, cases, defaultCase) {
|
|
89
|
+
return { type: "Case" /* Case */, expr, cases, defaultCase };
|
|
90
|
+
},
|
|
91
|
+
create(input) {
|
|
92
|
+
if (input === null || input === void 0)
|
|
93
|
+
return ExprData.Param(ParamData.Value(null));
|
|
94
|
+
if (input && typeof input === "object" && typeof input.toExpr === "function")
|
|
95
|
+
input = input.toExpr();
|
|
96
|
+
if (input instanceof Expr)
|
|
97
|
+
return input.expr;
|
|
98
|
+
if (input && typeof input === "object" && !Array.isArray(input))
|
|
99
|
+
return ExprData.Record(
|
|
100
|
+
Object.fromEntries(
|
|
101
|
+
Object.entries(input).map(([key, value]) => [
|
|
102
|
+
key,
|
|
103
|
+
ExprData.create(value)
|
|
104
|
+
])
|
|
105
|
+
)
|
|
106
|
+
);
|
|
107
|
+
return ExprData.Param(ParamData.Value(input));
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
var toExpr = ExprData.create;
|
|
111
|
+
function isConstant(e, value) {
|
|
112
|
+
switch (e.type) {
|
|
113
|
+
case "Param" /* Param */:
|
|
114
|
+
switch (e.param.type) {
|
|
115
|
+
case ParamType.Value:
|
|
116
|
+
return e.param.value == value;
|
|
117
|
+
default:
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
default:
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
var _Expr = class {
|
|
125
|
+
constructor(expr) {
|
|
126
|
+
this.expr = expr;
|
|
127
|
+
return new Proxy(this, {
|
|
128
|
+
get(target, key) {
|
|
129
|
+
return key in target ? target[key] : target.get(key);
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
static value(value) {
|
|
134
|
+
return new _Expr(ExprData.Param(ParamData.Value(value)));
|
|
135
|
+
}
|
|
136
|
+
static create(input) {
|
|
137
|
+
if (input instanceof _Expr)
|
|
138
|
+
return input;
|
|
139
|
+
return new _Expr(ExprData.create(input));
|
|
140
|
+
}
|
|
141
|
+
static and(...conditions) {
|
|
142
|
+
return conditions.map(_Expr.create).reduce((condition, expr) => condition.and(expr), _Expr.value(true));
|
|
143
|
+
}
|
|
144
|
+
static or(...conditions) {
|
|
145
|
+
return conditions.map(_Expr.create).reduce((condition, expr) => condition.or(expr), _Expr.value(false));
|
|
146
|
+
}
|
|
147
|
+
asc() {
|
|
148
|
+
return { expr: this.expr, order: OrderDirection.Asc };
|
|
149
|
+
}
|
|
150
|
+
desc() {
|
|
151
|
+
return { expr: this.expr, order: OrderDirection.Desc };
|
|
152
|
+
}
|
|
153
|
+
not() {
|
|
154
|
+
return unop(this, "Not" /* Not */);
|
|
155
|
+
}
|
|
156
|
+
or(that) {
|
|
157
|
+
const a = this.expr;
|
|
158
|
+
const b = toExpr(that);
|
|
159
|
+
if (isConstant(b, true) || isConstant(a, false))
|
|
160
|
+
return new _Expr(b);
|
|
161
|
+
if (isConstant(a, true) || isConstant(b, false))
|
|
162
|
+
return this;
|
|
163
|
+
return new _Expr(ExprData.BinOp("Or" /* Or */, a, b));
|
|
164
|
+
}
|
|
165
|
+
and(that) {
|
|
166
|
+
const a = this.expr;
|
|
167
|
+
const b = toExpr(that);
|
|
168
|
+
if (isConstant(b, true) || isConstant(a, false))
|
|
169
|
+
return this;
|
|
170
|
+
if (isConstant(a, true) || isConstant(b, false))
|
|
171
|
+
return new _Expr(b);
|
|
172
|
+
return new _Expr(ExprData.BinOp("And" /* And */, a, b));
|
|
173
|
+
}
|
|
174
|
+
isNull() {
|
|
175
|
+
return unop(this, "IsNull" /* IsNull */);
|
|
176
|
+
}
|
|
177
|
+
isNotNull() {
|
|
178
|
+
return this.isNull().not();
|
|
179
|
+
}
|
|
180
|
+
isNot(that) {
|
|
181
|
+
if (that == null || that instanceof _Expr && isConstant(that.expr, null))
|
|
182
|
+
return this.isNotNull();
|
|
183
|
+
return binop(this, "NotEquals" /* NotEquals */, that);
|
|
184
|
+
}
|
|
185
|
+
is(that) {
|
|
186
|
+
if (that === null || that instanceof _Expr && isConstant(that.expr, null))
|
|
187
|
+
return this.isNull();
|
|
188
|
+
return binop(this, "Equals" /* Equals */, that);
|
|
189
|
+
}
|
|
190
|
+
isIn(that) {
|
|
191
|
+
return binop(this, "In" /* In */, that);
|
|
192
|
+
}
|
|
193
|
+
isNotIn(that) {
|
|
194
|
+
return binop(this, "NotIn" /* NotIn */, that);
|
|
195
|
+
}
|
|
196
|
+
add(that) {
|
|
197
|
+
return binop(this, "Add" /* Add */, that);
|
|
198
|
+
}
|
|
199
|
+
substract(that) {
|
|
200
|
+
return binop(this, "Subt" /* Subt */, that);
|
|
201
|
+
}
|
|
202
|
+
multiply(that) {
|
|
203
|
+
return binop(this, "Mult" /* Mult */, that);
|
|
204
|
+
}
|
|
205
|
+
remainder(that) {
|
|
206
|
+
return binop(this, "Mod" /* Mod */, that);
|
|
207
|
+
}
|
|
208
|
+
divide(that) {
|
|
209
|
+
return binop(this, "Div" /* Div */, that);
|
|
210
|
+
}
|
|
211
|
+
greater(that) {
|
|
212
|
+
return binop(this, "Greater" /* Greater */, that);
|
|
213
|
+
}
|
|
214
|
+
greaterOrEqual(that) {
|
|
215
|
+
return binop(this, "GreaterOrEqual" /* GreaterOrEqual */, that);
|
|
216
|
+
}
|
|
217
|
+
less(that) {
|
|
218
|
+
return binop(this, "Less" /* Less */, that);
|
|
219
|
+
}
|
|
220
|
+
lessOrEqual(that) {
|
|
221
|
+
return binop(this, "LessOrEqual" /* LessOrEqual */, that);
|
|
222
|
+
}
|
|
223
|
+
concat(that) {
|
|
224
|
+
return binop(this, "Concat" /* Concat */, that);
|
|
225
|
+
}
|
|
226
|
+
like(that) {
|
|
227
|
+
return binop(this, "Like" /* Like */, that);
|
|
228
|
+
}
|
|
229
|
+
glob(that) {
|
|
230
|
+
return binop(this, "Glob" /* Glob */, that);
|
|
231
|
+
}
|
|
232
|
+
match(that) {
|
|
233
|
+
return binop(this, "Match" /* Match */, that);
|
|
234
|
+
}
|
|
235
|
+
with(that) {
|
|
236
|
+
return new _Expr(
|
|
237
|
+
ExprData.Merge(this.expr, ExprData.create(that))
|
|
238
|
+
);
|
|
239
|
+
}
|
|
240
|
+
at(index) {
|
|
241
|
+
return this.get(`[${Number(index)}]`);
|
|
242
|
+
}
|
|
243
|
+
filter(fn) {
|
|
244
|
+
const alias = `__${Math.random().toString(36).slice(2, 9)}`;
|
|
245
|
+
const target = Target.Each(this.expr, alias);
|
|
246
|
+
return new _Expr(
|
|
247
|
+
ExprData.Filter(
|
|
248
|
+
target,
|
|
249
|
+
ExprData.create(fn(new _Expr(ExprData.Row(target))))
|
|
250
|
+
)
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
map(fn) {
|
|
254
|
+
const alias = `__${Math.random().toString(36).slice(2, 9)}`;
|
|
255
|
+
const target = Target.Each(this.expr, alias);
|
|
256
|
+
return new _Expr(
|
|
257
|
+
ExprData.Map(
|
|
258
|
+
target,
|
|
259
|
+
ExprData.create(fn(new _Expr(ExprData.Row(target))))
|
|
260
|
+
)
|
|
261
|
+
);
|
|
262
|
+
}
|
|
263
|
+
sure() {
|
|
264
|
+
return this;
|
|
265
|
+
}
|
|
266
|
+
get(name) {
|
|
267
|
+
return new _Expr(ExprData.Field(this.expr, name));
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
var Expr = _Expr;
|
|
271
|
+
__publicField(Expr, "NULL", toExpr(null));
|
|
272
|
+
function unop(self, type) {
|
|
273
|
+
return new Expr(ExprData.UnOp(type, self.expr));
|
|
274
|
+
}
|
|
275
|
+
function binop(self, type, that) {
|
|
276
|
+
return new Expr(ExprData.BinOp(type, self.expr, toExpr(that)));
|
|
277
|
+
}
|
|
278
|
+
export {
|
|
279
|
+
BinOp,
|
|
280
|
+
Expr,
|
|
281
|
+
ExprData,
|
|
282
|
+
ExprType,
|
|
283
|
+
UnOp
|
|
284
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Column, PrimaryKey } from './Column';
|
|
2
|
+
import { Expr } from './Expr';
|
|
3
|
+
type ObjectUnion<T> = {
|
|
4
|
+
[K in T extends infer P ? keyof P : never]: T extends infer P ? K extends keyof P ? P[K] : never : never;
|
|
5
|
+
};
|
|
6
|
+
type RecordField<T> = Expr<T> & FieldsOf<ObjectUnion<T>>;
|
|
7
|
+
type Field<T> = [T] extends [Array<any>] ? Expr<T> : [T] extends [Column.IsPrimary<infer V, infer K>] ? Expr<PrimaryKey<V, K>> : [T] extends [Column.IsOptional<infer V>] ? Field<V> : [T] extends [number | string | boolean] ? Expr<T> : [T] extends [Record<string, any> | null] ? RecordField<T> : Expr<T>;
|
|
8
|
+
type FieldsOf<Row> = Row extends Record<string, any> ? {
|
|
9
|
+
[K in keyof Row]-?: Field<Row[K]>;
|
|
10
|
+
} : never;
|
|
11
|
+
type IsStrictlyAny<T> = (T extends never ? true : false) extends false ? false : true;
|
|
12
|
+
export type Fields<T> = IsStrictlyAny<T> extends true ? any : T extends object ? FieldsOf<T> : Field<T>;
|
|
13
|
+
export {};
|
|
File without changes
|