qlcodes 1.3.0 → 1.3.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 +50 -1
- package/dist/index.mjs +6 -5
- package/dist/qlCodes.json +1 -37539
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -55,9 +55,58 @@ Output :
|
|
|
55
55
|
}
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
+
Alternatively, you may need to retrive matching codes via a known key for some technologies
|
|
59
|
+
|
|
60
|
+
```js
|
|
61
|
+
import { lens } from "qlcodes";
|
|
62
|
+
|
|
63
|
+
const state = lens("insufficient_privilege");
|
|
64
|
+
|
|
65
|
+
console.log(state);
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Output :
|
|
69
|
+
|
|
70
|
+
```js
|
|
71
|
+
{
|
|
72
|
+
"key": "insufficient_privilege",
|
|
73
|
+
"qlcs": "qlcodes_success",
|
|
74
|
+
"matches": [
|
|
75
|
+
{
|
|
76
|
+
"code": "42501",
|
|
77
|
+
"keys": [
|
|
78
|
+
"insufficient_privilege",
|
|
79
|
+
"authorization_id_does_not_have_privilege_to_perform_specified_operation_on_identified_object"
|
|
80
|
+
],
|
|
81
|
+
"reasons": [
|
|
82
|
+
"The authorization ID does not have the privilege to perform the specified operation on the identified object."
|
|
83
|
+
],
|
|
84
|
+
"use": [
|
|
85
|
+
"pgsql",
|
|
86
|
+
"ibm"
|
|
87
|
+
],
|
|
88
|
+
"class": "42 - Syntax Error or Access Rule Violation"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"code": "258",
|
|
92
|
+
"keys": [
|
|
93
|
+
"insufficient_privilege"
|
|
94
|
+
],
|
|
95
|
+
"reasons": [
|
|
96
|
+
"Insufficient privilege"
|
|
97
|
+
],
|
|
98
|
+
"use": [
|
|
99
|
+
"sap_hana"
|
|
100
|
+
],
|
|
101
|
+
"class": "NA - Non associable class codes"
|
|
102
|
+
}
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
58
107
|
### Mismatches
|
|
59
108
|
|
|
60
|
-
If the provided SQLSTATE does not match any known entry, we return a normalized fallback object
|
|
109
|
+
If the provided SQLSTATE code or provided key does not match any known entry, we return a normalized fallback object
|
|
61
110
|
This guarantees that lens() always returns a predictable object shape.
|
|
62
111
|
|
|
63
112
|
There are three mismatch levels that we detect.
|
package/dist/index.mjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import data from "./qlCodes.json" with {type
|
|
1
|
+
import data from "./qlCodes.json" with { type: "json" };
|
|
2
2
|
|
|
3
3
|
const keyRegex = /^[a-zA-Z0-9_]+$/;
|
|
4
4
|
const codeRegex = /^[A-Z0-9]{5}$/;
|
|
5
5
|
|
|
6
6
|
const NON_ASSOCIATED_CLASS = "NA";
|
|
7
7
|
|
|
8
|
-
const QLCODES_ERR_MALFORMED = "qlcodes_malformed"
|
|
9
|
-
const QLCODES_ERR_NOT_FOUND = "qlcodes_no_code_found"
|
|
10
|
-
const QLCODES_ERR_UNEXPECTED_ERR = "qlcodes_unexpected_error"
|
|
8
|
+
const QLCODES_ERR_MALFORMED = "qlcodes_malformed";
|
|
9
|
+
const QLCODES_ERR_NOT_FOUND = "qlcodes_no_code_found";
|
|
10
|
+
const QLCODES_ERR_UNEXPECTED_ERR = "qlcodes_unexpected_error";
|
|
11
11
|
|
|
12
|
-
const QLCODES_SUCCESS = "qlcodes_success"
|
|
12
|
+
const QLCODES_SUCCESS = "qlcodes_success";
|
|
13
13
|
|
|
14
14
|
const _validateSearch = (search, response) => {
|
|
15
15
|
if (
|
|
@@ -68,6 +68,7 @@ const _classesForCodeSearch = (entries, paddedSearch) => {
|
|
|
68
68
|
data: data[NON_ASSOCIATED_CLASS],
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
|
+
return classesToSearch;
|
|
71
72
|
};
|
|
72
73
|
|
|
73
74
|
const _classesForKeySearche = (entries) => {
|