qlcodes 1.0.0 → 1.0.2
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 +45 -14
- package/package.json +6 -3
- package/qlCodes.json +7601 -1
- package/src/index.mjs +12 -5
- package/types/index.d.ts +5 -0
package/README.md
CHANGED
|
@@ -24,27 +24,28 @@ The module is built from authoritative vendor documentation (IBM, PostgreSQL, Or
|
|
|
24
24
|
## Installation
|
|
25
25
|
|
|
26
26
|
```bash
|
|
27
|
-
npm install qlcodes
|
|
27
|
+
$ npm install qlcodes
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
## Usage
|
|
31
31
|
|
|
32
32
|
```js
|
|
33
|
-
|
|
33
|
+
import { lens } from "qlcodes";
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
const error = lens("42501");
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
console.log(error);
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
Output :
|
|
41
41
|
|
|
42
42
|
```js
|
|
43
43
|
{
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
code: "42501",
|
|
45
|
+
keys: [ "insufficient_privilege" ],
|
|
46
|
+
use: [ "ibm", "postgres" ],
|
|
47
|
+
reason: "The authorization ID does not have the privilege to perform the specified operation on the identified object.",
|
|
48
|
+
qlcs: "qlcodes_sucess"
|
|
48
49
|
}
|
|
49
50
|
```
|
|
50
51
|
|
|
@@ -53,8 +54,36 @@ Output :
|
|
|
53
54
|
If the provided SQLSTATE does not match any known entry, we return a normalized fallback object
|
|
54
55
|
This guarantees that lens() always returns a predictable object shape.
|
|
55
56
|
|
|
57
|
+
There are three mismatch levels that we detect.
|
|
58
|
+
|
|
59
|
+
**Format** : The provided code is malformed and is not validate the expression /[0-9A-Z]{5}/
|
|
60
|
+
|
|
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
|
+
|
|
63
|
+
**Class** : The provided code matches no code class
|
|
64
|
+
|
|
65
|
+
```js
|
|
66
|
+
const error = lens("ABCDE");
|
|
67
|
+
|
|
68
|
+
console.log(error);
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Output:
|
|
72
|
+
|
|
73
|
+
```js
|
|
74
|
+
{
|
|
75
|
+
code: "ABCDE",
|
|
76
|
+
keys: [],
|
|
77
|
+
qlcs: "qlcodes_no_class_found",
|
|
78
|
+
use: [],
|
|
79
|
+
reason: "The code 'ABCDE' does not match any entries in qlcodes. This may be a qlcode issue only to provide you with the correct information"
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**Code** : The provided code matches no code within known classes
|
|
84
|
+
|
|
56
85
|
```js
|
|
57
|
-
const error = lens("
|
|
86
|
+
const error = lens("2000U");
|
|
58
87
|
|
|
59
88
|
console.log(error);
|
|
60
89
|
```
|
|
@@ -63,10 +92,11 @@ Output:
|
|
|
63
92
|
|
|
64
93
|
```js
|
|
65
94
|
{
|
|
66
|
-
code: "
|
|
67
|
-
keys: [
|
|
95
|
+
code: "2000U",
|
|
96
|
+
keys: [],
|
|
97
|
+
qlcs: "qlcodes_no_code_found",
|
|
68
98
|
use: [],
|
|
69
|
-
reason: "The code '
|
|
99
|
+
reason: "The code '2000U' does not match any entries in qlcodes. This may be a qlcode issue only to provide you with the correct information"
|
|
70
100
|
}
|
|
71
101
|
```
|
|
72
102
|
|
|
@@ -82,6 +112,7 @@ Output:
|
|
|
82
112
|
|| **keys** — semantic identifiers
|
|
83
113
|
|| **use** — `DBMS` where the code is applicable
|
|
84
114
|
|| **reason** — human-readable explanation
|
|
115
|
+
|| **qlcs** — 'qlcode status', shows the lens call status
|
|
85
116
|
|
|
86
117
|
## Customization & Rebuild (Contributors)
|
|
87
118
|
|
|
@@ -117,8 +148,8 @@ $ npm run build
|
|
|
117
148
|
You may pass argument to the build script to enforce a few behaviours to help you seing through the process...
|
|
118
149
|
|argument|effect|
|
|
119
150
|
|-|-|
|
|
120
|
-
|
|
121
|
-
|
|
151
|
+
|`--debug`|prevents the cleanup of middle stage file created during the data processing|
|
|
152
|
+
|`--make-keys`|allows the creation of keys when a description is given...through the 'generate' step (`generate.cjs`)|
|
|
122
153
|
|
|
123
154
|
|
|
124
155
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qlcodes",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"main": "src/index.mjs",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "chmod +x ./build.sh; ./build.sh"
|
|
@@ -20,5 +20,8 @@
|
|
|
20
20
|
"appendix",
|
|
21
21
|
"codes",
|
|
22
22
|
"guidance"
|
|
23
|
-
]
|
|
24
|
-
|
|
23
|
+
],
|
|
24
|
+
"repository": {
|
|
25
|
+
"url": "https://github.com/ManuUseGitHub/QLCodes"
|
|
26
|
+
}
|
|
27
|
+
}
|