@xuda.io/xuda-dbs-plugin-xuda 1.0.32 → 1.0.34
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 +5 -7
package/package.json
CHANGED
package/server.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
const _ = require("lodash");
|
2
2
|
|
3
|
-
const check_unique = async function (docP, table_obj) {
|
3
|
+
const check_unique = async function (e, docP, table_obj) {
|
4
4
|
var len = docP.udfIndex.length;
|
5
5
|
if (!len) {
|
6
6
|
return { code: -11, data: "table must have primary index" };
|
@@ -171,9 +171,7 @@ const find_item_by_key = function (arr, key, val) {
|
|
171
171
|
};
|
172
172
|
|
173
173
|
const get_cast_val = async function (source, attributeP, typeP, valP) {
|
174
|
-
const module =
|
175
|
-
"https://dist.xuda.io/runtime/js/modules/xuda-get-cast-util-module.mjs"
|
176
|
-
);
|
174
|
+
const module = require("@xuda.io/xu_cast");
|
177
175
|
|
178
176
|
return module.cast(
|
179
177
|
typeP,
|
@@ -217,7 +215,7 @@ exports.create = async (params, setup_doc, resolve, reject) => {
|
|
217
215
|
if (index_ret < 0) throw index_ret.data;
|
218
216
|
doc.udfIndex = index_ret.data;
|
219
217
|
|
220
|
-
const ret = await check_unique(doc, table_obj);
|
218
|
+
const ret = await check_unique(e, doc, table_obj);
|
221
219
|
if (ret.code < 0) {
|
222
220
|
throw ret;
|
223
221
|
}
|
@@ -253,7 +251,7 @@ exports.create = async (params, setup_doc, resolve, reject) => {
|
|
253
251
|
return index_ret;
|
254
252
|
}
|
255
253
|
doc.udfIndex = index_ret.data;
|
256
|
-
const ret = await check_unique(doc, table_obj);
|
254
|
+
const ret = await check_unique(e, doc, table_obj);
|
257
255
|
if (ret.code < 0) {
|
258
256
|
return ret;
|
259
257
|
}
|
@@ -996,7 +994,7 @@ exports.update = async (params, setup_doc, resolve, reject) => {
|
|
996
994
|
return index_ret;
|
997
995
|
}
|
998
996
|
doc.udfIndex = index_ret.data;
|
999
|
-
const ret = await check_unique(doc, table_obj);
|
997
|
+
const ret = await check_unique(e, doc, table_obj);
|
1000
998
|
if (ret.code < 0) {
|
1001
999
|
return ret;
|
1002
1000
|
}
|