qlcodes 1.1.3 → 1.1.4
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 +1 -2
- package/build.sh +1 -1
- package/package.json +6 -1
- package/src/compose.mjs +4 -3
- package/src/fileTransformer/sanitize.mjs +2 -2
- package/src/fileTransformer/sanitize2.mjs +2 -2
- package/src/fileTransformer/stopNamedKeys.mjs +2 -2
- package/src/generate.cjs +3 -3
- package/src/pretty.mjs +3 -3
- package/src/readFile.mjs +1 -1
- package/src/utils/codeName.mjs +2 -2
- package/src/utils/args.mjs +0 -32
- package/src/utils/io.mjs +0 -11
- package/src/utils/str.mjs +0 -5
package/README.md
CHANGED
|
@@ -10,8 +10,7 @@ The project aims to cover sql states for most of RDBMS [drivers supported by **T
|
|
|
10
10
|
Find bellow the actual coverage:
|
|
11
11
|
|
|
12
12
|
🕓 MySQL | 🕓 MariaDB | ✅ PostgreSQL | 🕓 CockroachDB (Postgres-compatible)
|
|
13
|
-
🕓 Microsoft SQL Server | ✅ Oracle | 🕓 SQLite | 🕓 SAP HANA | 🕓 Google Spanner
|
|
14
|
-
✅ IBM*
|
|
13
|
+
🕓 Microsoft SQL Server | ✅ Oracle | 🕓 SQLite | 🕓 SAP HANA | 🕓 Google Spanner | ✅ IBM*
|
|
15
14
|
>( \* ) IBM defines and publishes SQLSTATE codes as part of the SQL standard, so their The codes should covere IBM products such as DB2, IBM Informix, IBM Netezza, IBM i (AS/400) .
|
|
16
15
|
|
|
17
16
|
## Installation
|
package/build.sh
CHANGED
|
@@ -99,7 +99,7 @@ node generate.cjs --flag "oracle"> "$DIR/output3.txt"
|
|
|
99
99
|
echo -e "$CHECK done"
|
|
100
100
|
|
|
101
101
|
echo -e "${BLUE}Composition of the JSON file at $DIR/qlCodes.json${NC}"
|
|
102
|
-
|
|
102
|
+
node compose.mjs --file "$DIR/output1.txt"|\
|
|
103
103
|
node compose.mjs --file "$DIR/output2.txt" |\
|
|
104
104
|
node compose.mjs --file "$DIR/output3.txt" |\
|
|
105
105
|
node pretty.mjs --file "$DIR/qlCodes.json"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qlcodes",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"main": "src/index.mjs",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "chmod +x ./build.sh; ./build.sh"
|
|
@@ -23,5 +23,10 @@
|
|
|
23
23
|
],
|
|
24
24
|
"repository": {
|
|
25
25
|
"url": "git+https://github.com/ManuUseGitHub/QLCodes.git"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"onstdin": "^1.0.0",
|
|
29
|
+
"reargv": "^1.0.2",
|
|
30
|
+
"to-snake-case": "^1.0.0"
|
|
26
31
|
}
|
|
27
32
|
}
|
package/src/compose.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
|
-
import {
|
|
2
|
+
import { onstdin } from "onstdin";
|
|
3
3
|
import { CODE_RE, CLASS_RE, COMMENT_RE } from "./regex.mjs";
|
|
4
|
-
import { reargv } from "
|
|
4
|
+
import { reargv } from "reargv";
|
|
5
5
|
const argv = reargv();
|
|
6
6
|
function flushBuffer(buffer, currentClass, currentCode) {
|
|
7
7
|
if (!buffer.length) return buffer;
|
|
@@ -95,10 +95,11 @@ const debugInFile = (file, data = null) => {
|
|
|
95
95
|
if (argv.options.file || argv.files.length) {
|
|
96
96
|
const file = argv.options.file || argv.files[0];
|
|
97
97
|
|
|
98
|
-
|
|
98
|
+
onstdin((content) => {
|
|
99
99
|
const isDebug = process.env.DEBUG;
|
|
100
100
|
let states;
|
|
101
101
|
try {
|
|
102
|
+
debugInFile(file, `content!${content}!`);
|
|
102
103
|
states = JSON.parse(content ? content : "{}");
|
|
103
104
|
} catch {
|
|
104
105
|
states = {};
|
package/src/generate.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const fs = require("fs");
|
|
2
2
|
const { ERROR_CODE_HEADER_RGX } = require("./regex.mjs");
|
|
3
3
|
const { newCode } = require("./utils/codeName.mjs");
|
|
4
|
-
const {
|
|
5
|
-
const {
|
|
4
|
+
const { onstdin } = require("onstdin");
|
|
5
|
+
const { reargv } = require("reargv");
|
|
6
6
|
|
|
7
7
|
const argv = reargv();
|
|
8
8
|
|
|
@@ -36,7 +36,7 @@ if (argv.options.file || argv.files.length) {
|
|
|
36
36
|
const file = argv.options.file || argv.files[0];
|
|
37
37
|
console.log(processCSVLines(fs.readFileSync(file, "utf8")));
|
|
38
38
|
} else {
|
|
39
|
-
|
|
39
|
+
onstdin((csv) => {
|
|
40
40
|
console.log(processCSVLines(csv));
|
|
41
41
|
});
|
|
42
42
|
}
|
package/src/pretty.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { onstdin } from "onstdin";
|
|
3
|
+
import { reargv } from "reargv";
|
|
4
4
|
|
|
5
5
|
const isDebug = process.env.DEBUG === "true";
|
|
6
6
|
const argv = reargv();
|
|
@@ -8,7 +8,7 @@ const argv = reargv();
|
|
|
8
8
|
if (argv.options.file || argv.files.length) {
|
|
9
9
|
const file = argv.options.file || argv.files[0];
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
onstdin((content) => {
|
|
12
12
|
fs.writeFile(
|
|
13
13
|
file,
|
|
14
14
|
JSON.stringify(JSON.parse(content), null, isDebug ? 2 : undefined),
|
package/src/readFile.mjs
CHANGED
package/src/utils/codeName.mjs
CHANGED
package/src/utils/args.mjs
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export const reargv = () => {
|
|
2
|
-
const args = process.argv.slice(2);
|
|
3
|
-
const argvs = { misc: [], options: {}, files: [] };
|
|
4
|
-
const len = args.length;
|
|
5
|
-
let jump = 0;
|
|
6
|
-
for (const [i, arg] of args.entries()) {
|
|
7
|
-
if (jump) {
|
|
8
|
-
jump--;
|
|
9
|
-
continue;
|
|
10
|
-
}
|
|
11
|
-
if (arg.startsWith("--")) {
|
|
12
|
-
const option = arg.replace(/^-+/g, "");
|
|
13
|
-
if (i + 1 < len) {
|
|
14
|
-
const nextArg = args[i + 1];
|
|
15
|
-
if (!nextArg.startsWith("--")) {
|
|
16
|
-
argvs.options[option] = args[i + 1];
|
|
17
|
-
jump++;
|
|
18
|
-
} else {
|
|
19
|
-
argvs.options[option] = true;
|
|
20
|
-
jump++;
|
|
21
|
-
}
|
|
22
|
-
} else {
|
|
23
|
-
argvs.options[option] = true;
|
|
24
|
-
}
|
|
25
|
-
} else if (/(\.(?:[a-zA-Z]+)+)$/.test(arg)) {
|
|
26
|
-
argvs.files.push(arg);
|
|
27
|
-
} else {
|
|
28
|
-
argvs.misc.push(arg);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return argvs;
|
|
32
|
-
};
|
package/src/utils/io.mjs
DELETED