corebasic 1.0.126 → 1.0.128
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/libs/elabase.js +11 -8
- package/package.json +1 -1
package/libs/elabase.js
CHANGED
|
@@ -103,12 +103,11 @@ export const insert = async (meta, collection, value, _id) => {
|
|
|
103
103
|
if (_id)
|
|
104
104
|
arg._id = _id
|
|
105
105
|
|
|
106
|
-
if (!(["string", "number"].includes(typeof
|
|
106
|
+
if (!(["string", "number"].includes(typeof value?._id)))
|
|
107
107
|
throw {message: "Error: invalid _id in Dip.insert()"}
|
|
108
|
-
if (typeof
|
|
108
|
+
if (typeof value?._id === "string" && value._id.trim().length === 0)
|
|
109
109
|
throw {message: "Error: invalid _id in Dip.insert()"}
|
|
110
110
|
|
|
111
|
-
if ((!arg._id && arg._id !== 0))
|
|
112
111
|
|
|
113
112
|
if (isTransaction) {
|
|
114
113
|
transactions.push(arg)
|
|
@@ -124,11 +123,15 @@ export const insert = async (meta, collection, value, _id) => {
|
|
|
124
123
|
}
|
|
125
124
|
|
|
126
125
|
export const query = async (meta, collection, query, options) => {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
126
|
+
if (meta?.USE_EMPTY_COMPANY) {
|
|
127
|
+
|
|
128
|
+
} else {
|
|
129
|
+
// Multi Company Support
|
|
130
|
+
if (Utils.isEmpty(meta?.company)) throw {message: "Error: meta argument not provided in Dip.query()"}
|
|
131
|
+
collection = `${meta.company}.${collection}`
|
|
132
|
+
if (meta.company !== "GLOBAL")
|
|
133
|
+
query.company = meta.company
|
|
134
|
+
}
|
|
132
135
|
// ---------------------
|
|
133
136
|
|
|
134
137
|
|