sumak 0.0.3 → 0.0.5
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/README.md +650 -56
- package/dist/ast/expression.d.mts +26 -0
- package/dist/ast/expression.mjs +140 -0
- package/dist/ast/nodes.d.mts +298 -0
- package/dist/ast/nodes.mjs +59 -0
- package/dist/ast/transformer.d.mts +10 -0
- package/dist/ast/transformer.mjs +140 -0
- package/dist/ast/typed-expression.d.mts +37 -0
- package/dist/ast/typed-expression.mjs +77 -0
- package/dist/ast/visitor.d.mts +13 -0
- package/dist/ast/visitor.mjs +11 -0
- package/dist/builder/delete.d.mts +18 -0
- package/dist/builder/delete.mjs +94 -0
- package/dist/builder/eb.d.mts +210 -0
- package/dist/builder/eb.mjs +399 -0
- package/dist/builder/expression.d.mts +5 -0
- package/dist/builder/expression.mjs +10 -0
- package/dist/builder/insert.d.mts +40 -0
- package/dist/builder/insert.mjs +146 -0
- package/dist/builder/merge.d.mts +20 -0
- package/dist/builder/merge.mjs +100 -0
- package/dist/builder/raw.d.mts +2 -0
- package/dist/builder/raw.mjs +4 -0
- package/dist/builder/select.d.mts +38 -0
- package/dist/builder/select.mjs +242 -0
- package/dist/builder/typed-delete.d.mts +43 -0
- package/dist/builder/typed-delete.mjs +77 -0
- package/dist/builder/typed-insert.d.mts +74 -0
- package/dist/builder/typed-insert.mjs +136 -0
- package/dist/builder/typed-merge.d.mts +31 -0
- package/dist/builder/typed-merge.mjs +93 -0
- package/dist/builder/typed-select.d.mts +125 -0
- package/dist/builder/typed-select.mjs +217 -0
- package/dist/builder/typed-update.d.mts +55 -0
- package/dist/builder/typed-update.mjs +102 -0
- package/dist/builder/update.d.mts +18 -0
- package/dist/builder/update.mjs +102 -0
- package/dist/dialect/mssql.d.mts +2 -0
- package/dist/dialect/mssql.mjs +9 -0
- package/dist/dialect/mysql.d.mts +2 -0
- package/dist/dialect/mysql.mjs +9 -0
- package/dist/dialect/pg.d.mts +2 -0
- package/dist/dialect/pg.mjs +9 -0
- package/dist/dialect/sqlite.d.mts +2 -0
- package/dist/dialect/sqlite.mjs +9 -0
- package/dist/dialect/types.d.mts +6 -0
- package/dist/dialect/types.mjs +1 -0
- package/dist/errors.d.mts +12 -0
- package/dist/errors.mjs +24 -0
- package/dist/index.d.mts +49 -660
- package/dist/index.mjs +46 -3
- package/dist/mssql.d.mts +2 -0
- package/dist/mssql.mjs +2 -0
- package/dist/mysql.d.mts +2 -2
- package/dist/mysql.mjs +2 -1
- package/dist/pg.d.mts +2 -2
- package/dist/pg.mjs +2 -1
- package/dist/plugin/camel-case.d.mts +11 -0
- package/dist/plugin/camel-case.mjs +16 -0
- package/dist/plugin/hooks.d.mts +72 -0
- package/dist/plugin/hooks.mjs +49 -0
- package/dist/plugin/plugin-manager.d.mts +17 -0
- package/dist/plugin/plugin-manager.mjs +37 -0
- package/dist/plugin/soft-delete.d.mts +27 -0
- package/dist/plugin/soft-delete.mjs +52 -0
- package/dist/plugin/types.d.mts +19 -0
- package/dist/plugin/types.mjs +1 -0
- package/dist/plugin/with-schema.d.mts +21 -0
- package/dist/plugin/with-schema.mjs +53 -0
- package/dist/printer/base.d.mts +48 -0
- package/dist/printer/base.mjs +450 -0
- package/dist/printer/document.d.mts +45 -0
- package/dist/printer/document.mjs +153 -0
- package/dist/printer/formatter.d.mts +5 -0
- package/dist/printer/formatter.mjs +134 -0
- package/dist/printer/mssql.d.mts +10 -0
- package/dist/printer/mssql.mjs +161 -0
- package/dist/printer/mysql.d.mts +8 -0
- package/dist/printer/mysql.mjs +41 -0
- package/dist/printer/pg.d.mts +6 -0
- package/dist/printer/pg.mjs +9 -0
- package/dist/printer/sqlite.d.mts +8 -0
- package/dist/printer/sqlite.mjs +29 -0
- package/dist/printer/types.d.mts +11 -0
- package/dist/printer/types.mjs +1 -0
- package/dist/schema/column.d.mts +52 -0
- package/dist/schema/column.mjs +120 -0
- package/dist/schema/index.d.mts +6 -0
- package/dist/schema/index.mjs +4 -0
- package/dist/schema/table.d.mts +37 -0
- package/dist/schema/table.mjs +7 -0
- package/dist/schema/type-utils.d.mts +46 -0
- package/dist/schema/type-utils.mjs +1 -0
- package/dist/schema/types.d.mts +64 -0
- package/dist/schema/types.mjs +1 -0
- package/dist/schema.d.mts +2 -2
- package/dist/schema.mjs +1 -1
- package/dist/sqlite.d.mts +2 -2
- package/dist/sqlite.mjs +2 -1
- package/dist/sumak.d.mts +98 -0
- package/dist/sumak.mjs +132 -0
- package/dist/types.d.mts +14 -0
- package/dist/types.mjs +1 -0
- package/dist/utils/identifier.d.mts +3 -0
- package/dist/utils/identifier.mjs +14 -0
- package/dist/utils/param.d.mts +2 -0
- package/dist/utils/param.mjs +8 -0
- package/package.json +7 -1
- package/dist/_chunks/base.mjs +0 -1
- package/dist/_chunks/errors.mjs +0 -1
- package/dist/_chunks/index.d.mts +0 -136
- package/dist/_chunks/mysql.d.mts +0 -8
- package/dist/_chunks/mysql.mjs +0 -1
- package/dist/_chunks/pg.d.mts +0 -7
- package/dist/_chunks/pg.mjs +0 -1
- package/dist/_chunks/schema.mjs +0 -1
- package/dist/_chunks/sqlite.d.mts +0 -8
- package/dist/_chunks/sqlite.mjs +0 -1
- package/dist/_chunks/types.d.mts +0 -274
package/dist/_chunks/sqlite.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./base.mjs";import{i as t}from"./errors.mjs";var n=class extends e{constructor(){super(`sqlite`)}printSelect(e){if(e.forUpdate)throw new t(`sqlite`,`FOR UPDATE`);return super.printSelect(e)}printInsert(e){return super.printInsert(e)}};function r(){return{name:`sqlite`,createPrinter(){return new n}}}export{n,r as t};
|
package/dist/_chunks/types.d.mts
DELETED
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
type SQLDialect = "pg" | "mysql" | "sqlite";
|
|
2
|
-
interface CompiledQuery {
|
|
3
|
-
sql: string;
|
|
4
|
-
params: readonly unknown[];
|
|
5
|
-
}
|
|
6
|
-
type Primitive = string | number | boolean | null;
|
|
7
|
-
type OrderDirection = "ASC" | "DESC";
|
|
8
|
-
type JoinType = "INNER" | "LEFT" | "RIGHT" | "FULL" | "CROSS";
|
|
9
|
-
type SetOperator = "UNION" | "UNION ALL" | "INTERSECT" | "EXCEPT";
|
|
10
|
-
interface DialectConfig {
|
|
11
|
-
name: SQLDialect;
|
|
12
|
-
quoteIdentifier(name: string): string;
|
|
13
|
-
formatParam(index: number): string;
|
|
14
|
-
}
|
|
15
|
-
type ASTNode = SelectNode | InsertNode | UpdateNode | DeleteNode | ExpressionNode;
|
|
16
|
-
type ExpressionNode = ColumnRefNode | LiteralNode | BinaryOpNode | UnaryOpNode | FunctionCallNode | ParamNode | RawNode | SubqueryNode | BetweenNode | InNode | IsNullNode | CaseNode | CastNode | ExistsNode | StarNode | JsonAccessNode | ArrayExprNode | WindowFunctionNode;
|
|
17
|
-
interface ColumnRefNode {
|
|
18
|
-
type: "column_ref";
|
|
19
|
-
table?: string;
|
|
20
|
-
column: string;
|
|
21
|
-
alias?: string;
|
|
22
|
-
}
|
|
23
|
-
interface LiteralNode {
|
|
24
|
-
type: "literal";
|
|
25
|
-
value: string | number | boolean | null;
|
|
26
|
-
}
|
|
27
|
-
interface BinaryOpNode {
|
|
28
|
-
type: "binary_op";
|
|
29
|
-
op: string;
|
|
30
|
-
left: ExpressionNode;
|
|
31
|
-
right: ExpressionNode;
|
|
32
|
-
}
|
|
33
|
-
interface UnaryOpNode {
|
|
34
|
-
type: "unary_op";
|
|
35
|
-
op: string;
|
|
36
|
-
operand: ExpressionNode;
|
|
37
|
-
position: "prefix" | "postfix";
|
|
38
|
-
}
|
|
39
|
-
interface FunctionCallNode {
|
|
40
|
-
type: "function_call";
|
|
41
|
-
name: string;
|
|
42
|
-
args: ExpressionNode[];
|
|
43
|
-
alias?: string;
|
|
44
|
-
}
|
|
45
|
-
interface ParamNode {
|
|
46
|
-
type: "param";
|
|
47
|
-
index: number;
|
|
48
|
-
value: unknown;
|
|
49
|
-
}
|
|
50
|
-
interface RawNode {
|
|
51
|
-
type: "raw";
|
|
52
|
-
sql: string;
|
|
53
|
-
params: unknown[];
|
|
54
|
-
}
|
|
55
|
-
interface SubqueryNode {
|
|
56
|
-
type: "subquery";
|
|
57
|
-
query: SelectNode;
|
|
58
|
-
alias?: string;
|
|
59
|
-
}
|
|
60
|
-
interface BetweenNode {
|
|
61
|
-
type: "between";
|
|
62
|
-
expr: ExpressionNode;
|
|
63
|
-
low: ExpressionNode;
|
|
64
|
-
high: ExpressionNode;
|
|
65
|
-
negated: boolean;
|
|
66
|
-
}
|
|
67
|
-
interface InNode {
|
|
68
|
-
type: "in";
|
|
69
|
-
expr: ExpressionNode;
|
|
70
|
-
values: ExpressionNode[] | SelectNode;
|
|
71
|
-
negated: boolean;
|
|
72
|
-
}
|
|
73
|
-
interface IsNullNode {
|
|
74
|
-
type: "is_null";
|
|
75
|
-
expr: ExpressionNode;
|
|
76
|
-
negated: boolean;
|
|
77
|
-
}
|
|
78
|
-
interface CaseNode {
|
|
79
|
-
type: "case";
|
|
80
|
-
operand?: ExpressionNode;
|
|
81
|
-
whens: {
|
|
82
|
-
condition: ExpressionNode;
|
|
83
|
-
result: ExpressionNode;
|
|
84
|
-
}[];
|
|
85
|
-
else_?: ExpressionNode;
|
|
86
|
-
}
|
|
87
|
-
interface CastNode {
|
|
88
|
-
type: "cast";
|
|
89
|
-
expr: ExpressionNode;
|
|
90
|
-
dataType: string;
|
|
91
|
-
}
|
|
92
|
-
interface ExistsNode {
|
|
93
|
-
type: "exists";
|
|
94
|
-
query: SelectNode;
|
|
95
|
-
negated: boolean;
|
|
96
|
-
}
|
|
97
|
-
interface StarNode {
|
|
98
|
-
type: "star";
|
|
99
|
-
table?: string;
|
|
100
|
-
}
|
|
101
|
-
interface TableRefNode {
|
|
102
|
-
type: "table_ref";
|
|
103
|
-
name: string;
|
|
104
|
-
alias?: string;
|
|
105
|
-
schema?: string;
|
|
106
|
-
}
|
|
107
|
-
interface JoinNode {
|
|
108
|
-
type: "join";
|
|
109
|
-
joinType: JoinType;
|
|
110
|
-
table: TableRefNode | SubqueryNode;
|
|
111
|
-
on?: ExpressionNode;
|
|
112
|
-
}
|
|
113
|
-
interface JsonAccessNode {
|
|
114
|
-
type: "json_access";
|
|
115
|
-
expr: ExpressionNode;
|
|
116
|
-
path: string;
|
|
117
|
-
operator: "->" | "->>" | "#>" | "#>>";
|
|
118
|
-
alias?: string;
|
|
119
|
-
}
|
|
120
|
-
interface ArrayExprNode {
|
|
121
|
-
type: "array_expr";
|
|
122
|
-
elements: ExpressionNode[];
|
|
123
|
-
}
|
|
124
|
-
type FrameKind = "ROWS" | "RANGE" | "GROUPS";
|
|
125
|
-
type FrameBound = {
|
|
126
|
-
type: "unbounded_preceding";
|
|
127
|
-
} | {
|
|
128
|
-
type: "preceding";
|
|
129
|
-
value: number;
|
|
130
|
-
} | {
|
|
131
|
-
type: "current_row";
|
|
132
|
-
} | {
|
|
133
|
-
type: "following";
|
|
134
|
-
value: number;
|
|
135
|
-
} | {
|
|
136
|
-
type: "unbounded_following";
|
|
137
|
-
};
|
|
138
|
-
interface FrameSpec {
|
|
139
|
-
kind: FrameKind;
|
|
140
|
-
start: FrameBound;
|
|
141
|
-
end?: FrameBound;
|
|
142
|
-
}
|
|
143
|
-
interface WindowFunctionNode {
|
|
144
|
-
type: "window_function";
|
|
145
|
-
fn: FunctionCallNode;
|
|
146
|
-
partitionBy: ExpressionNode[];
|
|
147
|
-
orderBy: OrderByNode[];
|
|
148
|
-
frame?: FrameSpec;
|
|
149
|
-
alias?: string;
|
|
150
|
-
}
|
|
151
|
-
interface OrderByNode {
|
|
152
|
-
expr: ExpressionNode;
|
|
153
|
-
direction: OrderDirection;
|
|
154
|
-
nulls?: "FIRST" | "LAST";
|
|
155
|
-
}
|
|
156
|
-
interface CTENode {
|
|
157
|
-
name: string;
|
|
158
|
-
query: SelectNode;
|
|
159
|
-
recursive: boolean;
|
|
160
|
-
}
|
|
161
|
-
interface SelectNode {
|
|
162
|
-
type: "select";
|
|
163
|
-
distinct: boolean;
|
|
164
|
-
columns: ExpressionNode[];
|
|
165
|
-
from?: TableRefNode | SubqueryNode;
|
|
166
|
-
joins: JoinNode[];
|
|
167
|
-
where?: ExpressionNode;
|
|
168
|
-
groupBy: ExpressionNode[];
|
|
169
|
-
having?: ExpressionNode;
|
|
170
|
-
orderBy: OrderByNode[];
|
|
171
|
-
limit?: ExpressionNode;
|
|
172
|
-
offset?: ExpressionNode;
|
|
173
|
-
ctes: CTENode[];
|
|
174
|
-
setOp?: {
|
|
175
|
-
op: SetOperator;
|
|
176
|
-
query: SelectNode;
|
|
177
|
-
};
|
|
178
|
-
forUpdate: boolean;
|
|
179
|
-
}
|
|
180
|
-
interface InsertNode {
|
|
181
|
-
type: "insert";
|
|
182
|
-
table: TableRefNode;
|
|
183
|
-
columns: string[];
|
|
184
|
-
values: ExpressionNode[][];
|
|
185
|
-
returning: ExpressionNode[];
|
|
186
|
-
onConflict?: OnConflictNode;
|
|
187
|
-
ctes: CTENode[];
|
|
188
|
-
}
|
|
189
|
-
interface OnConflictNode {
|
|
190
|
-
columns: string[];
|
|
191
|
-
action: "nothing" | {
|
|
192
|
-
set: {
|
|
193
|
-
column: string;
|
|
194
|
-
value: ExpressionNode;
|
|
195
|
-
}[];
|
|
196
|
-
};
|
|
197
|
-
where?: ExpressionNode;
|
|
198
|
-
}
|
|
199
|
-
interface UpdateNode {
|
|
200
|
-
type: "update";
|
|
201
|
-
table: TableRefNode;
|
|
202
|
-
set: {
|
|
203
|
-
column: string;
|
|
204
|
-
value: ExpressionNode;
|
|
205
|
-
}[];
|
|
206
|
-
where?: ExpressionNode;
|
|
207
|
-
returning: ExpressionNode[];
|
|
208
|
-
from?: TableRefNode;
|
|
209
|
-
ctes: CTENode[];
|
|
210
|
-
}
|
|
211
|
-
interface DeleteNode {
|
|
212
|
-
type: "delete";
|
|
213
|
-
table: TableRefNode;
|
|
214
|
-
where?: ExpressionNode;
|
|
215
|
-
returning: ExpressionNode[];
|
|
216
|
-
ctes: CTENode[];
|
|
217
|
-
}
|
|
218
|
-
declare function tableRef(name: string, alias?: string, schema?: string): TableRefNode;
|
|
219
|
-
declare function createSelectNode(): SelectNode;
|
|
220
|
-
declare function createInsertNode(table: TableRefNode): InsertNode;
|
|
221
|
-
declare function createUpdateNode(table: TableRefNode): UpdateNode;
|
|
222
|
-
declare function createDeleteNode(table: TableRefNode): DeleteNode;
|
|
223
|
-
type PrintMode = "compact" | "formatted" | "debug";
|
|
224
|
-
interface PrinterOptions {
|
|
225
|
-
dialect: SQLDialect;
|
|
226
|
-
mode?: PrintMode;
|
|
227
|
-
indent?: string;
|
|
228
|
-
width?: number;
|
|
229
|
-
}
|
|
230
|
-
interface Printer {
|
|
231
|
-
print(node: ASTNode): CompiledQuery;
|
|
232
|
-
}
|
|
233
|
-
declare class BasePrinter implements Printer {
|
|
234
|
-
protected params: unknown[];
|
|
235
|
-
protected dialect: SQLDialect;
|
|
236
|
-
constructor(dialect: SQLDialect);
|
|
237
|
-
print(node: ASTNode): CompiledQuery;
|
|
238
|
-
protected printNode(node: ASTNode): string;
|
|
239
|
-
protected printSelect(node: SelectNode): string;
|
|
240
|
-
protected printInsert(node: InsertNode): string;
|
|
241
|
-
protected printOnConflict(node: OnConflictNode): string;
|
|
242
|
-
protected printUpdate(node: UpdateNode): string;
|
|
243
|
-
protected printDelete(node: DeleteNode): string;
|
|
244
|
-
protected printExpression(node: ExpressionNode): string;
|
|
245
|
-
protected printColumnRef(node: ColumnRefNode): string;
|
|
246
|
-
protected printLiteral(node: LiteralNode): string;
|
|
247
|
-
protected printBinaryOp(node: BinaryOpNode): string;
|
|
248
|
-
protected printUnaryOp(node: UnaryOpNode): string;
|
|
249
|
-
protected printFunctionCall(node: FunctionCallNode): string;
|
|
250
|
-
protected printParam(node: ParamNode): string;
|
|
251
|
-
protected printRaw(node: RawNode): string;
|
|
252
|
-
protected printSubquery(node: SubqueryNode): string;
|
|
253
|
-
protected printBetween(node: BetweenNode): string;
|
|
254
|
-
protected printIn(node: InNode): string;
|
|
255
|
-
protected printIsNull(node: IsNullNode): string;
|
|
256
|
-
protected printCase(node: CaseNode): string;
|
|
257
|
-
protected printCast(node: CastNode): string;
|
|
258
|
-
protected printExists(node: ExistsNode): string;
|
|
259
|
-
protected printStar(node: StarNode): string;
|
|
260
|
-
protected printTableRef(ref: TableRefNode): string;
|
|
261
|
-
protected printJoin(node: JoinNode): string;
|
|
262
|
-
protected printOrderBy(node: OrderByNode): string;
|
|
263
|
-
protected printCTEs(ctes: CTENode[]): string;
|
|
264
|
-
protected printJsonAccess(node: JsonAccessNode): string;
|
|
265
|
-
protected printArrayExpr(node: ArrayExprNode): string;
|
|
266
|
-
protected printWindowFunction(node: WindowFunctionNode): string;
|
|
267
|
-
protected printFrameSpec(frame: FrameSpec): string;
|
|
268
|
-
protected printFrameBound(bound: FrameBound): string;
|
|
269
|
-
}
|
|
270
|
-
interface Dialect {
|
|
271
|
-
name: SQLDialect;
|
|
272
|
-
createPrinter(): Printer;
|
|
273
|
-
}
|
|
274
|
-
export { RawNode as A, createSelectNode as B, IsNullNode as C, OnConflictNode as D, LiteralNode as E, UnaryOpNode as F, JoinType as G, tableRef as H, UpdateNode as I, SQLDialect as J, OrderDirection as K, WindowFunctionNode as L, StarNode as M, SubqueryNode as N, OrderByNode as O, TableRefNode as P, createDeleteNode as R, InsertNode as S, JsonAccessNode as T, CompiledQuery as U, createUpdateNode as V, DialectConfig as W, SetOperator as Y, FrameBound as _, PrinterOptions as a, FunctionCallNode as b, BetweenNode as c, CaseNode as d, CastNode as f, ExpressionNode as g, ExistsNode as h, Printer as i, SelectNode as j, ParamNode as k, BinaryOpNode as l, DeleteNode as m, BasePrinter as n, ASTNode as o, ColumnRefNode as p, Primitive as q, PrintMode as r, ArrayExprNode as s, Dialect as t, CTENode as u, FrameKind as v, JoinNode as w, InNode as x, FrameSpec as y, createInsertNode as z };
|