@dnax/core 0.0.5 → 0.0.6
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/driver/mongo/rest.ts +6 -6
- package/package.json +1 -1
- package/types/index.ts +1 -1
- package/utils/index.ts +7 -3
package/driver/mongo/rest.ts
CHANGED
|
@@ -266,7 +266,7 @@ class useRest {
|
|
|
266
266
|
c: this.#c,
|
|
267
267
|
io: Cfg.io,
|
|
268
268
|
driver: "mongodb",
|
|
269
|
-
result: data,
|
|
269
|
+
result: toJson(data),
|
|
270
270
|
action: "insertOne",
|
|
271
271
|
session: sessionStorage(),
|
|
272
272
|
rest: new useRest({
|
|
@@ -367,7 +367,7 @@ class useRest {
|
|
|
367
367
|
io: Cfg.io,
|
|
368
368
|
driver: "mongodb",
|
|
369
369
|
action: "insertMany",
|
|
370
|
-
result: data,
|
|
370
|
+
result: toJson(data),
|
|
371
371
|
session: sessionStorage(),
|
|
372
372
|
rest: new useRest({
|
|
373
373
|
useHook: false,
|
|
@@ -709,7 +709,7 @@ class useRest {
|
|
|
709
709
|
action: "updateOne",
|
|
710
710
|
update: update,
|
|
711
711
|
session: sessionStorage(),
|
|
712
|
-
result: result.doc,
|
|
712
|
+
result: toJson(result.doc),
|
|
713
713
|
rest: new useRest({
|
|
714
714
|
useHook: false,
|
|
715
715
|
tenant_id: this.#tenant_id,
|
|
@@ -965,7 +965,7 @@ class useRest {
|
|
|
965
965
|
action: "updateMany",
|
|
966
966
|
update: update,
|
|
967
967
|
session: sessionStorage(),
|
|
968
|
-
result: result.docs,
|
|
968
|
+
result: toJson(result.docs),
|
|
969
969
|
io: Cfg.io,
|
|
970
970
|
rest: new useRest({
|
|
971
971
|
useHook: false,
|
|
@@ -1059,7 +1059,7 @@ class useRest {
|
|
|
1059
1059
|
c: this.#c,
|
|
1060
1060
|
driver: "mongodb",
|
|
1061
1061
|
action: "deleteOne",
|
|
1062
|
-
result: doc,
|
|
1062
|
+
result: toJson(doc),
|
|
1063
1063
|
io: Cfg.io,
|
|
1064
1064
|
session: sessionStorage(),
|
|
1065
1065
|
rest: new useRest({
|
|
@@ -1097,7 +1097,7 @@ class useRest {
|
|
|
1097
1097
|
return resolve(result!);
|
|
1098
1098
|
}
|
|
1099
1099
|
|
|
1100
|
-
let deletedIds: any = [];
|
|
1100
|
+
let deletedIds: any = ids || [];
|
|
1101
1101
|
|
|
1102
1102
|
if (!ids) fn.error("List of id required", 400);
|
|
1103
1103
|
|
package/package.json
CHANGED
package/types/index.ts
CHANGED
package/utils/index.ts
CHANGED
|
@@ -65,9 +65,13 @@ const jwt = {
|
|
|
65
65
|
},
|
|
66
66
|
};
|
|
67
67
|
|
|
68
|
-
function toJson(data: object) {
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
function toJson(data: object): object | null | undefined | any {
|
|
69
|
+
try {
|
|
70
|
+
let obj = JSON.stringify(data);
|
|
71
|
+
return JSON.parse(obj);
|
|
72
|
+
} catch (err) {
|
|
73
|
+
return data;
|
|
74
|
+
}
|
|
71
75
|
}
|
|
72
76
|
|
|
73
77
|
function isDate(date: string): boolean {
|