@l-v-yonsama/multi-platform-database-drivers 0.11.15 → 0.13.25
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 +5 -0
- package/built/schema/log-parse-config.schema.json +406 -0
- package/built/src/drivers/aws/AwsServiceClient.js +0 -1
- package/built/src/drivers/aws/AwsServiceClient.js.map +1 -1
- package/built/src/drivers/memcache/helper.js +1 -1
- package/built/src/drivers/memcache/helper.js.map +1 -1
- package/built/src/helpers/SQLHelper.d.ts +7 -2
- package/built/src/helpers/SQLHelper.js +41 -4
- package/built/src/helpers/SQLHelper.js.map +1 -1
- package/built/src/types/helpers/index.d.ts +2 -0
- package/built/src/types/helpers/index.js +3 -1
- package/built/src/types/helpers/index.js.map +1 -1
- package/built/src/types/index.d.ts +1 -0
- package/built/src/types/index.js +1 -0
- package/built/src/types/index.js.map +1 -1
- package/built/src/types/utils/index.d.ts +187 -0
- package/built/src/types/utils/index.js +29 -0
- package/built/src/types/utils/index.js.map +1 -0
- package/built/src/utils/index.d.ts +1 -0
- package/built/src/utils/index.js +1 -0
- package/built/src/utils/index.js.map +1 -1
- package/built/src/utils/log/LogParser.d.ts +8 -0
- package/built/src/utils/log/LogParser.js +163 -0
- package/built/src/utils/log/LogParser.js.map +1 -0
- package/built/src/utils/log/buildSqlExecutions.d.ts +7 -0
- package/built/src/utils/log/buildSqlExecutions.js +267 -0
- package/built/src/utils/log/buildSqlExecutions.js.map +1 -0
- package/built/src/utils/log/classify/classifyEvent.d.ts +3 -0
- package/built/src/utils/log/classify/classifyEvent.js +91 -0
- package/built/src/utils/log/classify/classifyEvent.js.map +1 -0
- package/built/src/utils/log/constant/base.d.ts +97 -0
- package/built/src/utils/log/constant/base.js +136 -0
- package/built/src/utils/log/constant/base.js.map +1 -0
- package/built/src/utils/log/constant/index.d.ts +3 -0
- package/built/src/utils/log/constant/index.js +7 -0
- package/built/src/utils/log/constant/index.js.map +1 -0
- package/built/src/utils/log/constant/logEventSplitPreset.d.ts +34 -0
- package/built/src/utils/log/constant/logEventSplitPreset.js +299 -0
- package/built/src/utils/log/constant/logEventSplitPreset.js.map +1 -0
- package/built/src/utils/log/constant/sqlLogParsePreset.d.ts +328 -0
- package/built/src/utils/log/constant/sqlLogParsePreset.js +383 -0
- package/built/src/utils/log/constant/sqlLogParsePreset.js.map +1 -0
- package/built/src/utils/log/detect/presetDetector.d.ts +11 -0
- package/built/src/utils/log/detect/presetDetector.js +140 -0
- package/built/src/utils/log/detect/presetDetector.js.map +1 -0
- package/built/src/utils/log/extract/runExtractors.d.ts +2 -0
- package/built/src/utils/log/extract/runExtractors.js +105 -0
- package/built/src/utils/log/extract/runExtractors.js.map +1 -0
- package/built/src/utils/log/index.d.ts +10 -0
- package/built/src/utils/log/index.js +14 -0
- package/built/src/utils/log/index.js.map +1 -0
- package/built/src/utils/log/logSummary.d.ts +6 -0
- package/built/src/utils/log/logSummary.js +91 -0
- package/built/src/utils/log/logSummary.js.map +1 -0
- package/built/src/utils/log/pattern/logEventPattern.d.ts +3 -0
- package/built/src/utils/log/pattern/logEventPattern.js +121 -0
- package/built/src/utils/log/pattern/logEventPattern.js.map +1 -0
- package/built/src/utils/log/rdh/convertExtractedSqlRdhResult.d.ts +12 -0
- package/built/src/utils/log/rdh/convertExtractedSqlRdhResult.js +170 -0
- package/built/src/utils/log/rdh/convertExtractedSqlRdhResult.js.map +1 -0
- package/built/src/utils/log/split/splitLogEvents.d.ts +2 -0
- package/built/src/utils/log/split/splitLogEvents.js +38 -0
- package/built/src/utils/log/split/splitLogEvents.js.map +1 -0
- package/built/src/utils/log/sql/removeSqlComments.d.ts +1 -0
- package/built/src/utils/log/sql/removeSqlComments.js +11 -0
- package/built/src/utils/log/sql/removeSqlComments.js.map +1 -0
- package/built/src/utils/log/validator.d.ts +6 -0
- package/built/src/utils/log/validator.js +272 -0
- package/built/src/utils/log/validator.js.map +1 -0
- package/package.json +15 -7
package/README.md
CHANGED
|
@@ -6,6 +6,11 @@ cd ./docker
|
|
|
6
6
|
docker compose -f unit-test.yml build
|
|
7
7
|
|
|
8
8
|
docker compose -f unit-test.yml up -d
|
|
9
|
+
|
|
10
|
+
cd ..
|
|
11
|
+
cat __tests__/setup/mssql/init.sql| docker exec -i mssql_container \
|
|
12
|
+
/opt/mssql-tools/bin/sqlcmd \
|
|
13
|
+
-S localhost -U sa -P 'Pass123zxcv!'
|
|
9
14
|
```
|
|
10
15
|
|
|
11
16
|
```sh
|
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"additionalProperties": false,
|
|
4
|
+
"definitions": {
|
|
5
|
+
"BuiltInPattern": {
|
|
6
|
+
"enum": [
|
|
7
|
+
"DATA",
|
|
8
|
+
"EPOCH_TIMESTAMP",
|
|
9
|
+
"GREEDY_DATA",
|
|
10
|
+
"GREEDY_MULTILINE",
|
|
11
|
+
"INT",
|
|
12
|
+
"ISO8601_LENIENT",
|
|
13
|
+
"ISO8601_STRICT",
|
|
14
|
+
"JUL_TIMESTAMP",
|
|
15
|
+
"LEVEL",
|
|
16
|
+
"LOGGER",
|
|
17
|
+
"NUMBER",
|
|
18
|
+
"SLASH_TIMESTAMP",
|
|
19
|
+
"WORD"
|
|
20
|
+
],
|
|
21
|
+
"type": "string"
|
|
22
|
+
},
|
|
23
|
+
"ExtractorStepAction": {
|
|
24
|
+
"enum": [
|
|
25
|
+
"captureColumns",
|
|
26
|
+
"captureError",
|
|
27
|
+
"captureErrorDetail",
|
|
28
|
+
"captureField",
|
|
29
|
+
"captureParams",
|
|
30
|
+
"captureResult",
|
|
31
|
+
"captureRow",
|
|
32
|
+
"captureSql"
|
|
33
|
+
],
|
|
34
|
+
"type": "string"
|
|
35
|
+
},
|
|
36
|
+
"FrameworkName": {
|
|
37
|
+
"description": "Known SQL framework names used by built-in extractors.\nCustom names are also allowed.",
|
|
38
|
+
"enum": [
|
|
39
|
+
"Doma",
|
|
40
|
+
"Hibernate",
|
|
41
|
+
"MyBatis",
|
|
42
|
+
"S2Jdbc",
|
|
43
|
+
"SpringJdbc"
|
|
44
|
+
],
|
|
45
|
+
"type": "string"
|
|
46
|
+
},
|
|
47
|
+
"LogEventField": {
|
|
48
|
+
"anyOf": [
|
|
49
|
+
{
|
|
50
|
+
"$ref": "#/definitions/LogEventFieldRegex",
|
|
51
|
+
"description": "Field parsed using a custom regular expression."
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"$ref": "#/definitions/LogEventFieldLiteral",
|
|
55
|
+
"description": "Field representing a fixed literal string."
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"$ref": "#/definitions/LogEventFieldLineBreakLiteral",
|
|
59
|
+
"description": "Field representing a line break in multiline logs."
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"$ref": "#/definitions/LogEventFieldBuiltin",
|
|
63
|
+
"description": "Field parsed using a built-in pattern."
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
"description": "Defines a single field in a log event.\nEach field can be a regex, literal text, builtin pattern, or line-break marker."
|
|
67
|
+
},
|
|
68
|
+
"LogEventFieldBuiltin": {
|
|
69
|
+
"additionalProperties": false,
|
|
70
|
+
"description": "Field parsed using a built-in pattern.",
|
|
71
|
+
"properties": {
|
|
72
|
+
"enclosure": {
|
|
73
|
+
"$ref": "#/definitions/LogEventFieldEnclosure",
|
|
74
|
+
"description": "Optional enclosure characters around the field."
|
|
75
|
+
},
|
|
76
|
+
"eventStartMarker": {
|
|
77
|
+
"description": "Indicates that this field marks the start of a log event.",
|
|
78
|
+
"type": "boolean"
|
|
79
|
+
},
|
|
80
|
+
"name": {
|
|
81
|
+
"type": "string"
|
|
82
|
+
},
|
|
83
|
+
"pattern": {
|
|
84
|
+
"$ref": "#/definitions/BuiltInPattern"
|
|
85
|
+
},
|
|
86
|
+
"type": {
|
|
87
|
+
"const": "builtin",
|
|
88
|
+
"type": "string"
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"required": [
|
|
92
|
+
"eventStartMarker",
|
|
93
|
+
"name",
|
|
94
|
+
"pattern",
|
|
95
|
+
"type"
|
|
96
|
+
],
|
|
97
|
+
"type": "object"
|
|
98
|
+
},
|
|
99
|
+
"LogEventFieldEnclosure": {
|
|
100
|
+
"enum": [
|
|
101
|
+
"()",
|
|
102
|
+
"[]"
|
|
103
|
+
],
|
|
104
|
+
"type": "string"
|
|
105
|
+
},
|
|
106
|
+
"LogEventFieldLineBreakLiteral": {
|
|
107
|
+
"additionalProperties": false,
|
|
108
|
+
"description": "Field representing a line break in multiline logs.",
|
|
109
|
+
"properties": {
|
|
110
|
+
"enclosure": {
|
|
111
|
+
"$ref": "#/definitions/LogEventFieldEnclosure",
|
|
112
|
+
"description": "Optional enclosure characters around the field."
|
|
113
|
+
},
|
|
114
|
+
"eventStartMarker": {
|
|
115
|
+
"description": "Indicates that this field marks the start of a log event.",
|
|
116
|
+
"type": "boolean"
|
|
117
|
+
},
|
|
118
|
+
"type": {
|
|
119
|
+
"const": "line-break-literal",
|
|
120
|
+
"type": "string"
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
"required": [
|
|
124
|
+
"eventStartMarker",
|
|
125
|
+
"type"
|
|
126
|
+
],
|
|
127
|
+
"type": "object"
|
|
128
|
+
},
|
|
129
|
+
"LogEventFieldLiteral": {
|
|
130
|
+
"additionalProperties": false,
|
|
131
|
+
"description": "Field representing a fixed literal string.",
|
|
132
|
+
"properties": {
|
|
133
|
+
"enclosure": {
|
|
134
|
+
"$ref": "#/definitions/LogEventFieldEnclosure",
|
|
135
|
+
"description": "Optional enclosure characters around the field."
|
|
136
|
+
},
|
|
137
|
+
"eventStartMarker": {
|
|
138
|
+
"description": "Indicates that this field marks the start of a log event.",
|
|
139
|
+
"type": "boolean"
|
|
140
|
+
},
|
|
141
|
+
"pattern": {
|
|
142
|
+
"type": "string"
|
|
143
|
+
},
|
|
144
|
+
"type": {
|
|
145
|
+
"const": "literal",
|
|
146
|
+
"type": "string"
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
"required": [
|
|
150
|
+
"eventStartMarker",
|
|
151
|
+
"pattern",
|
|
152
|
+
"type"
|
|
153
|
+
],
|
|
154
|
+
"type": "object"
|
|
155
|
+
},
|
|
156
|
+
"LogEventFieldRegex": {
|
|
157
|
+
"additionalProperties": false,
|
|
158
|
+
"description": "Field parsed using a custom regular expression.",
|
|
159
|
+
"properties": {
|
|
160
|
+
"enclosure": {
|
|
161
|
+
"$ref": "#/definitions/LogEventFieldEnclosure",
|
|
162
|
+
"description": "Optional enclosure characters around the field."
|
|
163
|
+
},
|
|
164
|
+
"eventStartMarker": {
|
|
165
|
+
"description": "Indicates that this field marks the start of a log event.",
|
|
166
|
+
"type": "boolean"
|
|
167
|
+
},
|
|
168
|
+
"name": {
|
|
169
|
+
"type": "string"
|
|
170
|
+
},
|
|
171
|
+
"pattern": {
|
|
172
|
+
"type": "string"
|
|
173
|
+
},
|
|
174
|
+
"type": {
|
|
175
|
+
"const": "regex",
|
|
176
|
+
"type": "string"
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
"required": [
|
|
180
|
+
"eventStartMarker",
|
|
181
|
+
"name",
|
|
182
|
+
"pattern",
|
|
183
|
+
"type"
|
|
184
|
+
],
|
|
185
|
+
"type": "object"
|
|
186
|
+
},
|
|
187
|
+
"LogEventType": {
|
|
188
|
+
"enum": [
|
|
189
|
+
"CONN_AUTOCOMMIT",
|
|
190
|
+
"CONN_TRANSACTIONAL",
|
|
191
|
+
"DATA_SOURCE",
|
|
192
|
+
"DDL",
|
|
193
|
+
"ERROR",
|
|
194
|
+
"FW_ERROR",
|
|
195
|
+
"NORMAL",
|
|
196
|
+
"SQL_COLUMNS",
|
|
197
|
+
"SQL_ERROR",
|
|
198
|
+
"SQL_ERROR_DETAIL",
|
|
199
|
+
"SQL_PARAMS",
|
|
200
|
+
"SQL_RESULT",
|
|
201
|
+
"SQL_ROW",
|
|
202
|
+
"SQL_SINGLE",
|
|
203
|
+
"SQL_START",
|
|
204
|
+
"TX_BEGIN",
|
|
205
|
+
"TX_COMMIT",
|
|
206
|
+
"TX_METHOD_ENTER",
|
|
207
|
+
"TX_METHOD_EXIT",
|
|
208
|
+
"TX_ROLLBACK"
|
|
209
|
+
],
|
|
210
|
+
"type": "string"
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
"description": "Root configuration for the log parser.\nDefines how logs are split into events, classified, and converted into SQL executions.",
|
|
214
|
+
"properties": {
|
|
215
|
+
"classify": {
|
|
216
|
+
"description": "Rules used to classify log events into semantic event types.",
|
|
217
|
+
"items": {
|
|
218
|
+
"additionalProperties": false,
|
|
219
|
+
"description": "Rule used to classify a log event into a semantic event type.",
|
|
220
|
+
"properties": {
|
|
221
|
+
"context": {
|
|
222
|
+
"description": "Optional context extraction rules.",
|
|
223
|
+
"items": {
|
|
224
|
+
"additionalProperties": false,
|
|
225
|
+
"properties": {
|
|
226
|
+
"contextName": {
|
|
227
|
+
"type": "string"
|
|
228
|
+
},
|
|
229
|
+
"eventFieldName": {
|
|
230
|
+
"type": "string"
|
|
231
|
+
},
|
|
232
|
+
"pattern": {
|
|
233
|
+
"type": "string"
|
|
234
|
+
},
|
|
235
|
+
"replace": {
|
|
236
|
+
"type": "string"
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
"required": [
|
|
240
|
+
"contextName",
|
|
241
|
+
"pattern",
|
|
242
|
+
"replace"
|
|
243
|
+
],
|
|
244
|
+
"type": "object"
|
|
245
|
+
},
|
|
246
|
+
"type": "array"
|
|
247
|
+
},
|
|
248
|
+
"expandMessage": {
|
|
249
|
+
"description": "Expands message to include following lines.",
|
|
250
|
+
"type": "boolean"
|
|
251
|
+
},
|
|
252
|
+
"field": {
|
|
253
|
+
"description": "Optional log event field to apply the rule to.",
|
|
254
|
+
"type": "string"
|
|
255
|
+
},
|
|
256
|
+
"pattern": {
|
|
257
|
+
"description": "Regular expression used to detect the event.",
|
|
258
|
+
"type": "string"
|
|
259
|
+
},
|
|
260
|
+
"transforms": {
|
|
261
|
+
"description": "Optional transformation rule applied to the matched message.",
|
|
262
|
+
"items": {
|
|
263
|
+
"additionalProperties": false,
|
|
264
|
+
"properties": {
|
|
265
|
+
"flags": {
|
|
266
|
+
"additionalProperties": false,
|
|
267
|
+
"properties": {
|
|
268
|
+
"dotAll": {
|
|
269
|
+
"type": "boolean"
|
|
270
|
+
},
|
|
271
|
+
"multiline": {
|
|
272
|
+
"type": "boolean"
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
"type": "object"
|
|
276
|
+
},
|
|
277
|
+
"pattern": {
|
|
278
|
+
"type": "string"
|
|
279
|
+
},
|
|
280
|
+
"replace": {
|
|
281
|
+
"type": "string"
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
"required": [
|
|
285
|
+
"pattern",
|
|
286
|
+
"replace"
|
|
287
|
+
],
|
|
288
|
+
"type": "object"
|
|
289
|
+
},
|
|
290
|
+
"type": "array"
|
|
291
|
+
},
|
|
292
|
+
"type": {
|
|
293
|
+
"$ref": "#/definitions/LogEventType",
|
|
294
|
+
"description": "Target event type when the rule matches."
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
"required": [
|
|
298
|
+
"pattern",
|
|
299
|
+
"type"
|
|
300
|
+
],
|
|
301
|
+
"type": "object"
|
|
302
|
+
},
|
|
303
|
+
"type": "array"
|
|
304
|
+
},
|
|
305
|
+
"extractors": {
|
|
306
|
+
"description": "SQL extraction state machines used to build SQL execution events.",
|
|
307
|
+
"items": {
|
|
308
|
+
"additionalProperties": false,
|
|
309
|
+
"description": "SQL extractor definition using a simple state machine.",
|
|
310
|
+
"properties": {
|
|
311
|
+
"framework": {
|
|
312
|
+
"$ref": "#/definitions/FrameworkName",
|
|
313
|
+
"description": "Optional framework name associated with the extractor.\nKnown frameworks will appear in IDE completion."
|
|
314
|
+
},
|
|
315
|
+
"name": {
|
|
316
|
+
"description": "Unique name of the extractor.",
|
|
317
|
+
"type": "string"
|
|
318
|
+
},
|
|
319
|
+
"start": {
|
|
320
|
+
"$ref": "#/definitions/LogEventType",
|
|
321
|
+
"description": "Event type that starts SQL extraction."
|
|
322
|
+
},
|
|
323
|
+
"steps": {
|
|
324
|
+
"description": "Sequence of steps used to collect SQL fragments.",
|
|
325
|
+
"items": {
|
|
326
|
+
"additionalProperties": false,
|
|
327
|
+
"description": "Single step in the SQL extraction state machine.",
|
|
328
|
+
"properties": {
|
|
329
|
+
"action": {
|
|
330
|
+
"$ref": "#/definitions/ExtractorStepAction",
|
|
331
|
+
"description": "Action performed when the step is triggered."
|
|
332
|
+
},
|
|
333
|
+
"field": {
|
|
334
|
+
"description": "Target field where extracted value will be stored.",
|
|
335
|
+
"enum": [
|
|
336
|
+
"daoClass",
|
|
337
|
+
"daoMethod",
|
|
338
|
+
"endLine",
|
|
339
|
+
"error",
|
|
340
|
+
"errorDetail",
|
|
341
|
+
"formattedSql",
|
|
342
|
+
"framework",
|
|
343
|
+
"params",
|
|
344
|
+
"result",
|
|
345
|
+
"schema",
|
|
346
|
+
"sql",
|
|
347
|
+
"startLine",
|
|
348
|
+
"table",
|
|
349
|
+
"thread",
|
|
350
|
+
"timestamp",
|
|
351
|
+
"type"
|
|
352
|
+
],
|
|
353
|
+
"type": "string"
|
|
354
|
+
},
|
|
355
|
+
"optional": {
|
|
356
|
+
"description": "Whether this step is optional.",
|
|
357
|
+
"type": "boolean"
|
|
358
|
+
},
|
|
359
|
+
"type": {
|
|
360
|
+
"$ref": "#/definitions/LogEventType",
|
|
361
|
+
"description": "Event type that triggers this step."
|
|
362
|
+
}
|
|
363
|
+
},
|
|
364
|
+
"required": [
|
|
365
|
+
"type"
|
|
366
|
+
],
|
|
367
|
+
"type": "object"
|
|
368
|
+
},
|
|
369
|
+
"type": "array"
|
|
370
|
+
}
|
|
371
|
+
},
|
|
372
|
+
"required": [
|
|
373
|
+
"name",
|
|
374
|
+
"start",
|
|
375
|
+
"steps"
|
|
376
|
+
],
|
|
377
|
+
"type": "object"
|
|
378
|
+
},
|
|
379
|
+
"type": "array"
|
|
380
|
+
},
|
|
381
|
+
"split": {
|
|
382
|
+
"additionalProperties": false,
|
|
383
|
+
"description": "Configuration used to split raw log text into structured log events.",
|
|
384
|
+
"properties": {
|
|
385
|
+
"fields": {
|
|
386
|
+
"description": "Ordered list of field definitions used to parse a log line.",
|
|
387
|
+
"items": {
|
|
388
|
+
"$ref": "#/definitions/LogEventField"
|
|
389
|
+
},
|
|
390
|
+
"type": "array"
|
|
391
|
+
}
|
|
392
|
+
},
|
|
393
|
+
"required": [
|
|
394
|
+
"fields"
|
|
395
|
+
],
|
|
396
|
+
"type": "object"
|
|
397
|
+
}
|
|
398
|
+
},
|
|
399
|
+
"required": [
|
|
400
|
+
"classify",
|
|
401
|
+
"extractors",
|
|
402
|
+
"split"
|
|
403
|
+
],
|
|
404
|
+
"type": "object"
|
|
405
|
+
}
|
|
406
|
+
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AwsServiceClient.js","sourceRoot":"","sources":["../../../../src/drivers/aws/AwsServiceClient.ts"],"names":[],"mappings":";;;;AAMA,MAAsB,gBAAgB;IAIpC,YACE,MAAyB,EACf,MAAwB,EACxB,SAAoB;QADpB,WAAM,GAAN,MAAM,CAAkB;QACxB,cAAS,GAAT,SAAS,CAAW;QAE9B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;IAC3B,CAAC;IAEK,OAAO;;YACX,IAAI,WAAW,GAAG,EAAE,CAAC;YACrB,IAAI;gBACF,IAAI,CAAC,cAAc,EAAE,CAAC;gBACtB,IAAI,IAAI,CAAC,MAAM,EAAE;oBAIf,WAAW,GAAG,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;iBACvC;qBAAM;oBACL,WAAW,GAAG,gCAAgC,CAAC;iBAChD;aACF;YAAC,OAAO,CAAC,EAAE;gBACV,WAAW,GAAG,CAAC,CAAC,OAAO,CAAC;aACzB;YACD,IAAI,CAAC,WAAW,GAAG,WAAW,KAAK,EAAE,CAAC;YACtC,OAAO,WAAW,CAAC;QACrB,CAAC;KAAA;IAEK,IAAI,CAAC,YAAY,GAAG,KAAK;;YAC7B,IAAI,WAAW,GAAG,EAAE,CAAC;YACrB,IAAI,YAAY,EAAE;gBAChB,WAAW,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;aACpC;YACD,IAAI,CAAC,WAAW,EAAE;gBAChB,IAAI;oBACF,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;iBACtB;gBAAC,OAAO,CAAC,EAAE;
|
|
1
|
+
{"version":3,"file":"AwsServiceClient.js","sourceRoot":"","sources":["../../../../src/drivers/aws/AwsServiceClient.ts"],"names":[],"mappings":";;;;AAMA,MAAsB,gBAAgB;IAIpC,YACE,MAAyB,EACf,MAAwB,EACxB,SAAoB;QADpB,WAAM,GAAN,MAAM,CAAkB;QACxB,cAAS,GAAT,SAAS,CAAW;QAE9B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;IAC3B,CAAC;IAEK,OAAO;;YACX,IAAI,WAAW,GAAG,EAAE,CAAC;YACrB,IAAI;gBACF,IAAI,CAAC,cAAc,EAAE,CAAC;gBACtB,IAAI,IAAI,CAAC,MAAM,EAAE;oBAIf,WAAW,GAAG,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;iBACvC;qBAAM;oBACL,WAAW,GAAG,gCAAgC,CAAC;iBAChD;aACF;YAAC,OAAO,CAAC,EAAE;gBACV,WAAW,GAAG,CAAC,CAAC,OAAO,CAAC;aACzB;YACD,IAAI,CAAC,WAAW,GAAG,WAAW,KAAK,EAAE,CAAC;YACtC,OAAO,WAAW,CAAC;QACrB,CAAC;KAAA;IAEK,IAAI,CAAC,YAAY,GAAG,KAAK;;YAC7B,IAAI,WAAW,GAAG,EAAE,CAAC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;AACvC,CAAC;AAXD,0CAWC;AAED,SAAgB,eAAe,CAAC,KAAa;IAC3C,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,OAAO,KAAK,CAAC;IAEtC,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AACxC,CAAC;AALD,0CAKC"}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { DiffToUndoChangesResult, RdhKey } from '@l-v-yonsama/rdh';
|
|
2
2
|
import { DbSchema } from '../resource';
|
|
3
3
|
import { DbTable } from '../resource/DbResource';
|
|
4
|
-
import { BindOptions, CreateTableDefinitionsForPromptParams, Proposal, ProposalParams, QStatement, QueryWithBindsResult, ResourcePosition, ResourcePositionParams, SQLLang, ToViewDataQueryParams } from '../types';
|
|
4
|
+
import { BindOptions, CreateTableDefinitionsForPromptParams, DBType, Proposal, ProposalParams, QStatement, QueryWithBindsResult, ResourcePosition, ResourcePositionParams, SQLLang, ToViewDataQueryParams } from '../types';
|
|
5
|
+
import { FormatOptionsWithLanguage, SqlLanguage } from 'sql-formatter';
|
|
6
|
+
export declare const getSqlLanguage: (dbType: DBType) => SqlLanguage;
|
|
7
|
+
export declare const formatQuery: (query: string, cfg?: Partial<FormatOptionsWithLanguage> & {
|
|
8
|
+
dbType?: DBType;
|
|
9
|
+
}) => string;
|
|
5
10
|
export declare const createUndoChangeSQL: ({ schemaName, tableName, columns, diffResult, bindOption, quote, sqlLang, idQuoteCharacter, }: {
|
|
6
11
|
schemaName?: string;
|
|
7
12
|
tableName: string;
|
|
@@ -54,7 +59,7 @@ export declare const toDeleteStatement: ({ schemaName, tableName, columns, condi
|
|
|
54
59
|
idQuoteCharacter?: string;
|
|
55
60
|
sqlLang?: SQLLang;
|
|
56
61
|
}) => QueryWithBindsResult;
|
|
57
|
-
export declare function toViewRecordsQuery({ tableRes, schemaName, idQuoteCharacter, sqlLang, limit, limitAsTop, limitMode, limitLastColumn }: ToViewDataQueryParams & {
|
|
62
|
+
export declare function toViewRecordsQuery({ tableRes, schemaName, idQuoteCharacter, sqlLang, limit, limitAsTop, limitMode, limitLastColumn, }: ToViewDataQueryParams & {
|
|
58
63
|
limitMode: 'top' | 'last';
|
|
59
64
|
limitLastColumn?: string;
|
|
60
65
|
}): string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.separateMultipleQueries = exports.toCreateTableDDL = exports.needsQuoting = exports.wrapQuote = exports.wrapBackQuote = exports.wrapDoubleQuote = exports.wrapSingleQuote = exports.resolveLastOrderByColumn = exports.getResourcePositions = exports.getProposals = exports.createTableDefinisionsForPrompt = exports.normalizeSimpleParametersQuery = exports.normalizePositionedParametersQuery = exports.normalizeQuery = exports.parseQuery = exports.hasSetVariableClause = exports.toSafeQueryForPgsqlAst = exports.toViewDataNormalizedQuery = exports.toViewDataQuery = exports.createColumnNames = exports.createTableNames = exports.toCountRecordsQuery = exports.toViewRecordsQuery = exports.toDeleteStatement = exports.toUpdateStatement = exports.toInsertStatement = exports.createUndoChangeSQL = void 0;
|
|
3
|
+
exports.separateMultipleQueries = exports.toCreateTableDDL = exports.needsQuoting = exports.wrapQuote = exports.wrapBackQuote = exports.wrapDoubleQuote = exports.wrapSingleQuote = exports.resolveLastOrderByColumn = exports.getResourcePositions = exports.getProposals = exports.createTableDefinisionsForPrompt = exports.normalizeSimpleParametersQuery = exports.normalizePositionedParametersQuery = exports.normalizeQuery = exports.parseQuery = exports.hasSetVariableClause = exports.toSafeQueryForPgsqlAst = exports.toViewDataNormalizedQuery = exports.toViewDataQuery = exports.createColumnNames = exports.createTableNames = exports.toCountRecordsQuery = exports.toViewRecordsQuery = exports.toDeleteStatement = exports.toUpdateStatement = exports.toInsertStatement = exports.createUndoChangeSQL = exports.formatQuery = exports.getSqlLanguage = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const rdh_1 = require("@l-v-yonsama/rdh");
|
|
6
6
|
const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
|
|
@@ -11,6 +11,45 @@ const DbResource_1 = require("../resource/DbResource");
|
|
|
11
11
|
const types_1 = require("../types");
|
|
12
12
|
const constant_1 = require("./constant");
|
|
13
13
|
const RuleEngine_1 = require("./RuleEngine");
|
|
14
|
+
const sql_formatter_1 = require("sql-formatter");
|
|
15
|
+
const DEFAULT_FORMAT_OPTIONS = {
|
|
16
|
+
language: 'mysql',
|
|
17
|
+
tabWidth: 2,
|
|
18
|
+
useTabs: false,
|
|
19
|
+
keywordCase: 'upper',
|
|
20
|
+
identifierCase: 'preserve',
|
|
21
|
+
dataTypeCase: 'upper',
|
|
22
|
+
functionCase: 'upper',
|
|
23
|
+
indentStyle: 'standard',
|
|
24
|
+
logicalOperatorNewline: 'before',
|
|
25
|
+
expressionWidth: 120,
|
|
26
|
+
linesBetweenQueries: 1,
|
|
27
|
+
denseOperators: false,
|
|
28
|
+
newlineBeforeSemicolon: false,
|
|
29
|
+
};
|
|
30
|
+
const DBTypeToSqlLanguageMap = {
|
|
31
|
+
MySQL: 'mysql',
|
|
32
|
+
Postgres: 'postgresql',
|
|
33
|
+
SQLServer: 'transactsql',
|
|
34
|
+
SQLite: 'sqlite',
|
|
35
|
+
Redis: 'mysql',
|
|
36
|
+
Memcache: 'mysql',
|
|
37
|
+
Keycloak: 'mysql',
|
|
38
|
+
Auth0: 'mysql',
|
|
39
|
+
Aws: 'mysql',
|
|
40
|
+
Mqtt: 'mysql',
|
|
41
|
+
};
|
|
42
|
+
const getSqlLanguage = (dbType) => {
|
|
43
|
+
return DBTypeToSqlLanguageMap[dbType];
|
|
44
|
+
};
|
|
45
|
+
exports.getSqlLanguage = getSqlLanguage;
|
|
46
|
+
const formatQuery = (query, cfg) => {
|
|
47
|
+
const _a = cfg !== null && cfg !== void 0 ? cfg : {}, { dbType, language } = _a, rest = tslib_1.__rest(_a, ["dbType", "language"]);
|
|
48
|
+
const resolvedLanguage = language !== null && language !== void 0 ? language : (dbType ? (0, exports.getSqlLanguage)(dbType) : undefined);
|
|
49
|
+
const merged = Object.assign(Object.assign(Object.assign({}, DEFAULT_FORMAT_OPTIONS), rest), (resolvedLanguage ? { language: resolvedLanguage } : {}));
|
|
50
|
+
return (0, sql_formatter_1.format)(query, merged);
|
|
51
|
+
};
|
|
52
|
+
exports.formatQuery = formatQuery;
|
|
14
53
|
const createUndoChangeSQL = ({ schemaName, tableName, columns, diffResult, bindOption, quote, sqlLang, idQuoteCharacter, }) => {
|
|
15
54
|
const { ok, toBeInserted, toBeUpdated, toBeDeleted } = diffResult;
|
|
16
55
|
if (!ok) {
|
|
@@ -253,7 +292,7 @@ const toDeleteStatement = ({ schemaName, tableName, columns, conditions, bindOpt
|
|
|
253
292
|
};
|
|
254
293
|
};
|
|
255
294
|
exports.toDeleteStatement = toDeleteStatement;
|
|
256
|
-
function toViewRecordsQuery({ tableRes, schemaName, idQuoteCharacter, sqlLang, limit, limitAsTop, limitMode, limitLastColumn }) {
|
|
295
|
+
function toViewRecordsQuery({ tableRes, schemaName, idQuoteCharacter, sqlLang, limit, limitAsTop, limitMode, limitLastColumn, }) {
|
|
257
296
|
const tableNameWithSchema = createTableNameWithSchema({
|
|
258
297
|
schema: schemaName,
|
|
259
298
|
table: tableRes.name,
|
|
@@ -558,8 +597,6 @@ const parseQuery = (sql) => {
|
|
|
558
597
|
names: undefined,
|
|
559
598
|
};
|
|
560
599
|
}
|
|
561
|
-
console.log('sql=', sql);
|
|
562
|
-
console.log('replacedSql=', replacedSql);
|
|
563
600
|
}
|
|
564
601
|
return undefined;
|
|
565
602
|
};
|