qlcodes 1.0.2 → 1.1.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # QLCodes
2
2
 
3
- A small utility that unifies SQL error codes (SQLSTATE) from different DBMS into a single, normalized structure through a curated dataset constructed at build time.
3
+ A small utility that unifies SQL codes describing states (SQLSTATE) from different DBMS into a single, normalized structure through a curated dataset constructed at build time.
4
4
 
5
5
  The module is built from authoritative vendor documentation (IBM, PostgreSQL, Oracle) and generates static reference data at build time. Find references bellow.
6
6
 
@@ -32,9 +32,9 @@ $ npm install qlcodes
32
32
  ```js
33
33
  import { lens } from "qlcodes";
34
34
 
35
- const error = lens("42501");
35
+ const state = lens("42501");
36
36
 
37
- console.log(error);
37
+ console.log(state);
38
38
  ```
39
39
 
40
40
  Output :
@@ -60,12 +60,25 @@ There are three mismatch levels that we detect.
60
60
 
61
61
  > ℹ️ ["SQLSTATE values are comprised of a two-character class code value, followed by a three-character subclass code value. (ISO/IEC 9075:1992)"](https://www.ibm.com/docs/en/db2-for-zos/12.0.0?topic=codes-sqlstate-values-common-error)
62
62
 
63
- **Class** : The provided code matches no code class
63
+ ```js
64
+ console.log(lens("123456"));
65
+ ```
66
+
67
+ Output:
64
68
 
65
69
  ```js
66
- const error = lens("ABCDE");
70
+ {
71
+ code: "123456",
72
+ keys: [],
73
+ qlcs: "qlcodes_malformed",
74
+ use: [],
75
+ r
76
+ ```
77
+
78
+ **Class** : The provided code matches no code class
67
79
 
68
- console.log(error);
80
+ ```js
81
+ console.log(lens("ABCDE"));
69
82
  ```
70
83
 
71
84
  Output:
@@ -83,9 +96,7 @@ Output:
83
96
  **Code** : The provided code matches no code within known classes
84
97
 
85
98
  ```js
86
- const error = lens("2000U");
87
-
88
- console.log(error);
99
+ console.log(lens("2000U"));
89
100
  ```
90
101
 
91
102
  Output:
@@ -107,7 +118,7 @@ Output:
107
118
  `lens(code: string): QLLens`
108
119
  |Parameters|Returns|
109
120
  |-|-|
110
- |**code** SQLSTATE error code | A structured error description|
121
+ |**code** SQLSTATE status code | A structured status description|
111
122
  || **code** — normalized SQLSTATE, or `-1` if not found
112
123
  || **keys** — semantic identifiers
113
124
  || **use** — `DBMS` where the code is applicable
@@ -124,7 +135,7 @@ If you want to extend or adjust the reference data:
124
135
  1) Clone the repository
125
136
 
126
137
  ```bash
127
- $ git clone <repository-url>
138
+ $ git clone https://github.com/ManuUseGitHub/QLCodes.git
128
139
  $ cd qlcodes
129
140
  $ npm install
130
141
  ```
package/build.sh CHANGED
@@ -75,24 +75,24 @@ echo -e "MODES"
75
75
  echo -e "${YELLOW} $@ ${NC}"
76
76
 
77
77
  SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
78
- echo -e "${BLUE}Creating codes from $SCRIPT_DIR/references/IBM_errors.csv ${NC}"
78
+ echo -e "${BLUE}Creating codes from $SCRIPT_DIR/references/IBM_states.csv ${NC}"
79
79
  cd src
80
80
 
81
- node readFile.mjs ../references/IBM_errors.csv |\
81
+ node readFile.mjs ../references/IBM_states.csv |\
82
82
  node fileTransformer/sanitize.mjs |\
83
83
  node generate.cjs --flag "ibm" |\
84
84
  node fileTransformer/stopNamedKeys.mjs> "$DIR/output1.txt"
85
85
 
86
86
  echo -e "$CHECK done"
87
87
 
88
- echo -e "${BLUE}Creating codes from $SCRIPT_DIR/references/PSQL_errors.csv ${NC}"
89
- node readFile.mjs ../references/PSQL_errors.csv |\
88
+ echo -e "${BLUE}Creating codes from $SCRIPT_DIR/references/PSQL_states.csv ${NC}"
89
+ node readFile.mjs ../references/PSQL_states.csv |\
90
90
  node generate.cjs --flag "postgres" > "$DIR/output2.txt"
91
91
 
92
92
  echo -e "$CHECK done"
93
93
 
94
- echo -e "${BLUE}Creating codes from $SCRIPT_DIR/references/ORACLE_errors.csv ${NC}"
95
- node readFile.mjs ../references/ORACLE_errors.csv |\
94
+ echo -e "${BLUE}Creating codes from $SCRIPT_DIR/references/ORACLE_states.csv ${NC}"
95
+ node readFile.mjs ../references/ORACLE_states.csv |\
96
96
  node fileTransformer/sanitize2.mjs |\
97
97
  node generate.cjs --flag "oracle"> "$DIR/output3.txt"
98
98
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qlcodes",
3
- "version": "1.0.2",
3
+ "version": "1.1.1",
4
4
  "main": "src/index.mjs",
5
5
  "scripts": {
6
6
  "build": "chmod +x ./build.sh; ./build.sh"
@@ -22,6 +22,6 @@
22
22
  "guidance"
23
23
  ],
24
24
  "repository": {
25
- "url": "https://github.com/ManuUseGitHub/QLCodes"
25
+ "url": "git+https://github.com/ManuUseGitHub/QLCodes.git"
26
26
  }
27
27
  }