rawsql-ts 0.1.0-beta.7 → 0.1.0-beta.8

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.
Files changed (2) hide show
  1. package/package.json +3 -4
  2. package/src/index.d.ts +0 -378
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "rawsql-ts",
3
- "version": "0.1.0-beta.7",
3
+ "version": "0.1.0-beta.8",
4
4
  "description": "[beta]High-performance SQL parser and AST analyzer written in TypeScript. Provides fast parsing and advanced transformation capabilities.",
5
5
  "main": "dist/index.js",
6
- "types": "src/index.d.ts",
6
+ "types": "dist/index.d.ts",
7
7
  "scripts": {
8
8
  "test": "vitest run",
9
9
  "test:watch": "vitest",
@@ -34,7 +34,6 @@
34
34
  "vitest": "^1.5.2"
35
35
  },
36
36
  "files": [
37
- "dist",
38
- "src/index.d.ts"
37
+ "dist"
39
38
  ]
40
39
  }
package/src/index.d.ts DELETED
@@ -1,378 +0,0 @@
1
- // Type definitions for rawsql-ts
2
- // Project: rawsql-ts
3
-
4
- /**
5
- * Represents a parser for SQL SELECT queries.
6
- */
7
- export declare class SelectQueryParser {
8
- /**
9
- * Parses a SQL string and returns a SelectQuery object.
10
- * @param sql The SQL query string.
11
- */
12
- static parseFromText(sql: string): SelectQuery;
13
- }
14
-
15
- /**
16
- * Represents a binary SELECT query (e.g., UNION, INTERSECT, EXCEPT).
17
- */
18
- export declare class BinarySelectQuery {
19
- static kind: symbol;
20
- left: SelectQuery;
21
- operator: RawString;
22
- right: SelectQuery;
23
- constructor(left: SelectQuery, operator: string, right: SelectQuery);
24
- union(query: SelectQuery): BinarySelectQuery;
25
- // ...other methods...
26
- }
27
-
28
- /**
29
- * Represents a SELECT query (simple, binary, or values).
30
- */
31
- export type SelectQuery = SimpleSelectQuery | BinarySelectQuery | ValuesQuery;
32
-
33
- /**
34
- * Represents a value component in SQL (column, literal, etc).
35
- */
36
- export type ValueComponent = ValueList |
37
- ColumnReference |
38
- FunctionCall |
39
- UnaryExpression |
40
- BinaryExpression |
41
- LiteralValue |
42
- ParameterExpression |
43
- SwitchCaseArgument |
44
- CaseKeyValuePair |
45
- RawString |
46
- IdentifierString |
47
- ParenExpression |
48
- CastExpression |
49
- CaseExpression |
50
- ArrayExpression |
51
- BetweenExpression |
52
- InlineQuery |
53
- StringSpecifierExpression |
54
- TypeValue |
55
- TupleExpression;
56
-
57
- export declare class InlineQuery {
58
- static kind: symbol;
59
- selectQuery: SelectQuery;
60
- constructor(selectQuery: SelectQuery);
61
- }
62
-
63
- export declare class ValueList {
64
- static kind: symbol;
65
- values: ValueComponent[];
66
- constructor(values: ValueComponent[]);
67
- }
68
-
69
- /**
70
- * Represents a VALUES query.
71
- */
72
- export declare class ValuesQuery {
73
- static kind: symbol;
74
- tuples: TupleExpression[];
75
- constructor(tuples: TupleExpression[]);
76
- }
77
-
78
- /**
79
- * Collects CTEs from a query.
80
- */
81
- export declare class CTECollector {
82
- // Main method to collect CTEs from a query
83
- collect(query: SelectQuery): any;
84
- }
85
-
86
- /**
87
- * Normalizes CTEs in a query.
88
- */
89
- export declare class CTENormalizer {
90
- constructor();
91
- normalize(query: SelectQuery): SelectQuery;
92
- }
93
-
94
- /**
95
- * Formats a query object into a SQL string.
96
- */
97
- export declare class Formatter {
98
- constructor();
99
- visit(query: any): string;
100
- }
101
-
102
- /**
103
- * Normalizes queries (e.g., flattens unions).
104
- */
105
- export declare class QueryNormalizer {
106
- normalize(query: SelectQuery): SimpleSelectQuery;
107
- }
108
-
109
- /**
110
- * Collects select values from a query.
111
- */
112
- export declare class SelectValueCollector {
113
- constructor(tableColumnResolver?: (tableName: string) => string[], initialCommonTables?: any[] | null);
114
- // ...other methods...
115
- }
116
-
117
- /**
118
- * Collects selectable columns from a query.
119
- */
120
- export declare class SelectableColumnCollector {
121
- constructor(tableColumnResolver?: (tableName: string) => string[]);
122
- // ...other methods...
123
- }
124
-
125
- /**
126
- * Collects table sources from a query.
127
- */
128
- export declare class TableSourceCollector {
129
- constructor(selectableOnly?: boolean);
130
- // ...other methods...
131
- }
132
-
133
- /**
134
- * Finds upstream select queries.
135
- */
136
- export declare class UpstreamSelectQueryFinder {
137
- constructor(tableColumnResolver?: (tableName: string) => string[]);
138
- find(query: SelectQuery, columnNames: string[]): SelectQuery[];
139
- }
140
-
141
- /**
142
- * Represents a simple SELECT query in SQL.
143
- */
144
- export declare class SimpleSelectQuery {
145
- static kind: symbol;
146
- WithClause: WithClause | null;
147
- selectClause: SelectClause;
148
- fromClause: FromClause | null;
149
- whereClause: WhereClause | null;
150
- groupByClause: GroupByClause | null;
151
- havingClause: HavingClause | null;
152
- orderByClause: OrderByClause | null;
153
- windowFrameClause: WindowFrameClause | null;
154
- rowLimitClause: LimitClause | null;
155
- forClause: ForClause | null;
156
- constructor(
157
- withClause: WithClause | null,
158
- selectClause: SelectClause,
159
- fromClause: FromClause | null,
160
- whereClause: WhereClause | null,
161
- groupByClause: GroupByClause | null,
162
- havingClause: HavingClause | null,
163
- orderByClause: OrderByClause | null,
164
- windowFrameClause: WindowFrameClause | null,
165
- rowLimitClause: LimitClause | null,
166
- forClause: ForClause | null
167
- );
168
- }
169
-
170
- export declare class RawString {
171
- static kind: symbol;
172
- value: string;
173
- constructor(value: string);
174
- }
175
-
176
- export declare class IdentifierString {
177
- static kind: symbol;
178
- name: string;
179
- constructor(alias: string);
180
- }
181
-
182
- export declare class TupleExpression {
183
- static kind: symbol;
184
- values: ValueComponent[];
185
- constructor(values: ValueComponent[]);
186
- }
187
-
188
- export declare class LiteralValue {
189
- static kind: symbol;
190
- value: string | number | boolean | null;
191
- constructor(value: string | number | boolean | null);
192
- }
193
-
194
- export declare class UnaryExpression {
195
- static kind: symbol;
196
- operator: RawString;
197
- expression: ValueComponent;
198
- constructor(operator: string, expression: ValueComponent);
199
- }
200
-
201
- export declare class BinaryExpression {
202
- static kind: symbol;
203
- left: ValueComponent;
204
- operator: RawString;
205
- right: ValueComponent;
206
- constructor(left: ValueComponent, operator: string, right: ValueComponent);
207
- }
208
-
209
- export declare class ParameterExpression {
210
- static kind: symbol;
211
- name: RawString;
212
- constructor(name: string);
213
- }
214
-
215
- export declare class SwitchCaseArgument {
216
- static kind: symbol;
217
- cases: CaseKeyValuePair[];
218
- elseValue: ValueComponent | null;
219
- constructor(cases: CaseKeyValuePair[], elseValue?: ValueComponent | null);
220
- }
221
-
222
- export declare class CaseKeyValuePair {
223
- static kind: symbol;
224
- key: ValueComponent;
225
- value: ValueComponent;
226
- constructor(key: ValueComponent, value: ValueComponent);
227
- }
228
-
229
- export declare class ParenExpression {
230
- static kind: symbol;
231
- expression: ValueComponent;
232
- constructor(expression: ValueComponent);
233
- }
234
-
235
- export declare class CastExpression {
236
- static kind: symbol;
237
- input: ValueComponent;
238
- castType: TypeValue;
239
- constructor(input: ValueComponent, castType: TypeValue);
240
- }
241
-
242
- export declare class CaseExpression {
243
- static kind: symbol;
244
- condition: ValueComponent | null;
245
- switchCase: SwitchCaseArgument;
246
- constructor(condition: ValueComponent | null, switchCase: SwitchCaseArgument);
247
- }
248
-
249
- export declare class ArrayExpression {
250
- static kind: symbol;
251
- expression: ValueComponent;
252
- constructor(expression: ValueComponent);
253
- }
254
-
255
- export declare class BetweenExpression {
256
- static kind: symbol;
257
- expression: ValueComponent;
258
- lower: ValueComponent;
259
- upper: ValueComponent;
260
- negated: boolean;
261
- constructor(expression: ValueComponent, lower: ValueComponent, upper: ValueComponent, negated: boolean);
262
- }
263
-
264
- export declare class StringSpecifierExpression {
265
- static kind: symbol;
266
- specifier: RawString;
267
- value: ValueComponent;
268
- constructor(specifier: string, value: string);
269
- }
270
-
271
- export declare class TypeValue {
272
- static kind: symbol;
273
- type: RawString;
274
- argument: ValueComponent | null;
275
- constructor(type: string, argument?: ValueComponent | null);
276
- }
277
-
278
- export declare class ColumnReference {
279
- static kind: symbol;
280
- namespaces: IdentifierString[] | null;
281
- column: IdentifierString;
282
- constructor(namespaces: string[] | null, column: string);
283
- }
284
-
285
- export declare class FunctionCall {
286
- static kind: symbol;
287
- name: RawString;
288
- argument: ValueComponent | null;
289
- over: any | null;
290
- constructor(name: string, argument: ValueComponent | null, over: any | null);
291
- }
292
-
293
- export declare class SelectClause {
294
- static kind: symbol;
295
- items: SelectComponent[];
296
- distinct: DistinctComponent | null;
297
- constructor(items: SelectComponent[], distinct?: DistinctComponent | null);
298
- }
299
-
300
- export declare type SelectComponent = SelectItem | ValueComponent;
301
-
302
- export declare class SelectItem {
303
- static kind: symbol;
304
- value: ValueComponent;
305
- identifier: IdentifierString;
306
- constructor(value: ValueComponent, name: string);
307
- }
308
-
309
- export declare type DistinctComponent = Distinct | DistinctOn;
310
-
311
- export declare class Distinct {
312
- static kind: symbol;
313
- constructor();
314
- }
315
-
316
- export declare class DistinctOn {
317
- static kind: symbol;
318
- value: ValueComponent;
319
- constructor(value: ValueComponent);
320
- }
321
-
322
- export declare class WhereClause {
323
- static kind: symbol;
324
- condition: ValueComponent;
325
- constructor(condition: ValueComponent);
326
- }
327
-
328
- export declare class WindowFrameClause {
329
- static kind: symbol;
330
- name: IdentifierString;
331
- expression: any;
332
- constructor(name: string, expression: any);
333
- }
334
-
335
- export declare class FromClause {
336
- static kind: symbol;
337
- source: any;
338
- joins: any[] | null;
339
- constructor(source: any, joins?: any[] | null);
340
- }
341
-
342
- export declare class GroupByClause {
343
- static kind: symbol;
344
- grouping: ValueComponent[];
345
- constructor(grouping: ValueComponent[]);
346
- }
347
-
348
- export declare class HavingClause {
349
- static kind: symbol;
350
- condition: ValueComponent;
351
- constructor(condition: ValueComponent);
352
- }
353
-
354
- export declare class OrderByClause {
355
- static kind: symbol;
356
- order: any[];
357
- constructor(order: any[]);
358
- }
359
-
360
- export declare class LimitClause {
361
- static kind: symbol;
362
- limit: ValueComponent;
363
- offset?: ValueComponent;
364
- constructor(limit: ValueComponent, offset?: ValueComponent);
365
- }
366
-
367
- export declare class ForClause {
368
- static kind: symbol;
369
- lockMode: string;
370
- constructor(lockMode: string);
371
- }
372
-
373
- export declare class WithClause {
374
- static kind: symbol;
375
- tables: any[];
376
- recursive: boolean;
377
- constructor(tables: any[], recursive?: boolean);
378
- }