@xuda.io/xuda-dbs-plugin-xuda 1.0.29 → 1.0.31
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/package.json +1 -1
- package/server.js +25 -1
package/package.json
CHANGED
package/server.js
CHANGED
@@ -164,6 +164,31 @@ const find_item_by_key_root = function (arr, key, val) {
|
|
164
164
|
});
|
165
165
|
};
|
166
166
|
|
167
|
+
const find_item_by_key = function (arr, key, val) {
|
168
|
+
return _.find(arr, function (e) {
|
169
|
+
return e.data[key] === val;
|
170
|
+
});
|
171
|
+
};
|
172
|
+
|
173
|
+
const get_cast_val = async function (source, attributeP, typeP, valP) {
|
174
|
+
const module = await import(
|
175
|
+
"https://dist.xuda.io/runtime/js/modules/xuda-get-cast-util-module.mjs"
|
176
|
+
);
|
177
|
+
|
178
|
+
return module.cast(
|
179
|
+
typeP,
|
180
|
+
valP,
|
181
|
+
function (res) {
|
182
|
+
var msg = `error converting ${attributeP} from ${valP} to ${typeP}`;
|
183
|
+
console.error(source, msg);
|
184
|
+
},
|
185
|
+
function (res) {
|
186
|
+
var msg = `type mismatch auto conversion made to ${attributeP} from value ${valP} to ${typeP}`;
|
187
|
+
console.warn(source, msg);
|
188
|
+
}
|
189
|
+
);
|
190
|
+
};
|
191
|
+
|
167
192
|
exports.create = async (params, setup_doc, resolve, reject) => {
|
168
193
|
const e = params.e;
|
169
194
|
const db = params.db;
|
@@ -1044,7 +1069,6 @@ exports.restore = async (params, setup_doc, resolve, reject) => {
|
|
1044
1069
|
|
1045
1070
|
exports.test_connection = async (params, setup_doc, resolve, reject) => {
|
1046
1071
|
try {
|
1047
|
-
debugger;
|
1048
1072
|
if (!setup_doc.db_connection_string) throw "db_connection_string missing";
|
1049
1073
|
const nano = require("nano")(setup_doc.db_connection_string);
|
1050
1074
|
|