rawsql-ts 0.11.5-beta → 0.11.6-beta
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/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.min.js +14 -14
- package/dist/esm/index.min.js.map +4 -4
- package/dist/esm/src/index.js +1 -0
- package/dist/esm/src/index.js.map +1 -1
- package/dist/esm/src/parsers/SqlPrintTokenParser.js +28 -6
- package/dist/esm/src/parsers/SqlPrintTokenParser.js.map +1 -1
- package/dist/esm/src/transformers/SchemaCollector.js +76 -9
- package/dist/esm/src/transformers/SchemaCollector.js.map +1 -1
- package/dist/esm/src/utils/CommentEditor.js +190 -0
- package/dist/esm/src/utils/CommentEditor.js.map +1 -0
- package/dist/esm/tsconfig.browser.tsbuildinfo +1 -1
- package/dist/esm/types/src/index.d.ts +1 -0
- package/dist/esm/types/src/parsers/SqlPrintTokenParser.d.ts +1 -0
- package/dist/esm/types/src/transformers/SchemaCollector.d.ts +6 -1
- package/dist/esm/types/src/utils/CommentEditor.d.ts +72 -0
- package/dist/index.min.js +14 -14
- package/dist/index.min.js.map +4 -4
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/parsers/SqlPrintTokenParser.d.ts +1 -0
- package/dist/src/parsers/SqlPrintTokenParser.js +28 -6
- package/dist/src/parsers/SqlPrintTokenParser.js.map +1 -1
- package/dist/src/transformers/SchemaCollector.d.ts +6 -1
- package/dist/src/transformers/SchemaCollector.js +76 -9
- package/dist/src/transformers/SchemaCollector.js.map +1 -1
- package/dist/src/utils/CommentEditor.d.ts +72 -0
- package/dist/src/utils/CommentEditor.js +194 -0
- package/dist/src/utils/CommentEditor.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { SqlComponent } from '../models/SqlComponent';
|
|
2
|
+
/**
|
|
3
|
+
* Utility class for editing comments on SQL components.
|
|
4
|
+
* Provides functions to add, edit, delete, and search comments in SQL AST.
|
|
5
|
+
*/
|
|
6
|
+
export declare class CommentEditor {
|
|
7
|
+
/**
|
|
8
|
+
* Add a comment to a SQL component
|
|
9
|
+
* @param component The SQL component to add comment to
|
|
10
|
+
* @param comment The comment text to add
|
|
11
|
+
*/
|
|
12
|
+
static addComment(component: SqlComponent, comment: string): void;
|
|
13
|
+
/**
|
|
14
|
+
* Edit an existing comment by index
|
|
15
|
+
* @param component The SQL component containing the comment
|
|
16
|
+
* @param index The index of the comment to edit (0-based)
|
|
17
|
+
* @param newComment The new comment text
|
|
18
|
+
* @throws Error if index is invalid
|
|
19
|
+
*/
|
|
20
|
+
static editComment(component: SqlComponent, index: number, newComment: string): void;
|
|
21
|
+
/**
|
|
22
|
+
* Delete a comment by index
|
|
23
|
+
* @param component The SQL component containing the comment
|
|
24
|
+
* @param index The index of the comment to delete (0-based)
|
|
25
|
+
* @throws Error if index is invalid
|
|
26
|
+
*/
|
|
27
|
+
static deleteComment(component: SqlComponent, index: number): void;
|
|
28
|
+
/**
|
|
29
|
+
* Delete all comments from a component
|
|
30
|
+
* @param component The SQL component to clear comments from
|
|
31
|
+
*/
|
|
32
|
+
static deleteAllComments(component: SqlComponent): void;
|
|
33
|
+
/**
|
|
34
|
+
* Get all comments from a component
|
|
35
|
+
* @param component The SQL component to get comments from
|
|
36
|
+
* @returns Array of comment strings (empty array if no comments)
|
|
37
|
+
*/
|
|
38
|
+
static getComments(component: SqlComponent): string[];
|
|
39
|
+
/**
|
|
40
|
+
* Find all components in the AST that have comments containing the search text
|
|
41
|
+
* @param root The root SQL component to search from
|
|
42
|
+
* @param searchText The text to search for in comments
|
|
43
|
+
* @param caseSensitive Whether the search should be case-sensitive (default: false)
|
|
44
|
+
* @returns Array of components that have matching comments
|
|
45
|
+
*/
|
|
46
|
+
static findComponentsWithComment(root: SqlComponent, searchText: string, caseSensitive?: boolean): SqlComponent[];
|
|
47
|
+
/**
|
|
48
|
+
* Replace all occurrences of a text in comments across the entire AST
|
|
49
|
+
* @param root The root SQL component to search and replace in
|
|
50
|
+
* @param searchText The text to search for
|
|
51
|
+
* @param replaceText The text to replace with
|
|
52
|
+
* @param caseSensitive Whether the search should be case-sensitive (default: false)
|
|
53
|
+
* @returns Number of replacements made
|
|
54
|
+
*/
|
|
55
|
+
static replaceInComments(root: SqlComponent, searchText: string, replaceText: string, caseSensitive?: boolean): number;
|
|
56
|
+
/**
|
|
57
|
+
* Count total number of comments in the AST
|
|
58
|
+
* @param root The root SQL component to count comments in
|
|
59
|
+
* @returns Total number of comments
|
|
60
|
+
*/
|
|
61
|
+
static countComments(root: SqlComponent): number;
|
|
62
|
+
/**
|
|
63
|
+
* Get all comments from the entire AST as a flat array with their source components
|
|
64
|
+
* @param root The root SQL component to extract comments from
|
|
65
|
+
* @returns Array of objects containing comment text and the component they belong to
|
|
66
|
+
*/
|
|
67
|
+
static getAllComments(root: SqlComponent): {
|
|
68
|
+
comment: string;
|
|
69
|
+
component: SqlComponent;
|
|
70
|
+
index: number;
|
|
71
|
+
}[];
|
|
72
|
+
}
|