@xuda.io/xuda-dbs-plugin-xuda 1.0.179 → 1.0.180
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/server.js +9 -9
- package/studio.mjs +15 -14
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@xuda.io/xuda-dbs-plugin-xuda",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.180",
|
4
4
|
"description": "Xuda Database Socket for Xuda's proprietary structure powered by CouchDB",
|
5
5
|
"scripts": {
|
6
6
|
"pub": "npm version patch --force && npm publish --access public"
|
package/server.js
CHANGED
@@ -245,9 +245,9 @@ const get_opt = function (e, table_obj) {
|
|
245
245
|
|
246
246
|
var opt = {
|
247
247
|
selector,
|
248
|
-
limit
|
249
|
-
skip
|
250
|
-
fields
|
248
|
+
limit,
|
249
|
+
skip,
|
250
|
+
fields,
|
251
251
|
};
|
252
252
|
|
253
253
|
if (sort.length) {
|
@@ -465,7 +465,7 @@ const get_opt = function (e, table_obj) {
|
|
465
465
|
for (const [key, val] of Object.entries(opt.fields)) {
|
466
466
|
opt.fields[key] = "udfData.data." + val;
|
467
467
|
}
|
468
|
-
if (!e?.sortModel
|
468
|
+
if (!e?.sortModel || !JSON.parse(e.sortModel).length) {
|
469
469
|
// added 2021 09 10
|
470
470
|
if (opt.sort) {
|
471
471
|
for (const [key, val] of Object.entries(opt.sort)) {
|
@@ -794,10 +794,10 @@ const query_db = async function (e, db, app_id_reference, table_obj) {
|
|
794
794
|
var view_opt = undefined;
|
795
795
|
if (key) {
|
796
796
|
view_opt = {
|
797
|
-
key
|
797
|
+
key,
|
798
798
|
include_docs: !e.ids && view !== "db_index_reduce",
|
799
|
-
limit
|
800
|
-
skip
|
799
|
+
limit,
|
800
|
+
skip,
|
801
801
|
};
|
802
802
|
} else {
|
803
803
|
if (e.reduce) {
|
@@ -815,8 +815,8 @@ const query_db = async function (e, db, app_id_reference, table_obj) {
|
|
815
815
|
startkey: e.startkey ? JSON.parse(e.startkey) : "",
|
816
816
|
endkey: e.endkey ? JSON.parse(e.endkey) : "",
|
817
817
|
include_docs: !e.ids,
|
818
|
-
limit
|
819
|
-
skip
|
818
|
+
limit,
|
819
|
+
skip,
|
820
820
|
descending: e.desc,
|
821
821
|
};
|
822
822
|
}
|
package/studio.mjs
CHANGED
@@ -274,9 +274,9 @@ const get_opt = function (e, table_obj) {
|
|
274
274
|
|
275
275
|
var opt = {
|
276
276
|
selector,
|
277
|
-
limit
|
278
|
-
skip
|
279
|
-
fields
|
277
|
+
limit,
|
278
|
+
skip,
|
279
|
+
fields,
|
280
280
|
};
|
281
281
|
|
282
282
|
if (sort.length) {
|
@@ -494,7 +494,7 @@ const get_opt = function (e, table_obj) {
|
|
494
494
|
for (const [key, val] of Object.entries(opt.fields)) {
|
495
495
|
opt.fields[key] = "udfData.data." + val;
|
496
496
|
}
|
497
|
-
if (!e?.sortModel
|
497
|
+
if (!e?.sortModel || !JSON.parse(e.sortModel).length) {
|
498
498
|
// added 2021 09 10
|
499
499
|
if (opt.sort) {
|
500
500
|
for (const [key, val] of Object.entries(opt.sort)) {
|
@@ -535,13 +535,14 @@ const get_opt = function (e, table_obj) {
|
|
535
535
|
opt.selector.stat = e.archived ? 4 : 3;
|
536
536
|
|
537
537
|
// fill selector with sort field if not exist
|
538
|
-
|
539
|
-
let
|
540
|
-
|
541
|
-
opt.selector[field_id]
|
538
|
+
if (opt.sort) {
|
539
|
+
for (let val of opt.sort) {
|
540
|
+
let field_id = Object.keys(val)[0];
|
541
|
+
if (!opt.selector[field_id]) {
|
542
|
+
opt.selector[field_id] = { $gt: null };
|
543
|
+
}
|
542
544
|
}
|
543
545
|
}
|
544
|
-
|
545
546
|
opt.fields.push("_id");
|
546
547
|
opt.fields.push("_rev");
|
547
548
|
|
@@ -863,10 +864,10 @@ const query_db = async function (e, db, table_obj) {
|
|
863
864
|
var view_opt = undefined;
|
864
865
|
if (key) {
|
865
866
|
view_opt = {
|
866
|
-
key
|
867
|
+
key,
|
867
868
|
include_docs: !e.ids && view !== "db_index_reduce",
|
868
|
-
limit
|
869
|
-
skip
|
869
|
+
limit,
|
870
|
+
skip,
|
870
871
|
};
|
871
872
|
} else {
|
872
873
|
if (e.reduce) {
|
@@ -884,8 +885,8 @@ const query_db = async function (e, db, table_obj) {
|
|
884
885
|
startkey: e.startkey ? JSON.parse(e.startkey) : "",
|
885
886
|
endkey: e.endkey ? JSON.parse(e.endkey) : "",
|
886
887
|
include_docs: !e.ids,
|
887
|
-
limit
|
888
|
-
skip
|
888
|
+
limit,
|
889
|
+
skip,
|
889
890
|
descending: e.desc,
|
890
891
|
};
|
891
892
|
}
|