corebasic 1.0.104 → 1.0.106
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 +4 -0
- package/libs/privileges.js +2 -0
- package/package.json +1 -1
package/libs/elabase.js
CHANGED
|
@@ -85,6 +85,7 @@ export function transactionCommit(arg) {
|
|
|
85
85
|
|
|
86
86
|
export const insert = async (meta, collection, value, _id) => {
|
|
87
87
|
// Multi Company Support
|
|
88
|
+
if (Utils.isEmpty(meta?.company)) throw {message: "Error: meta argument not provided in Dip.query()"}
|
|
88
89
|
collection = `${meta.company}.${collection}`
|
|
89
90
|
if (meta.company !== "GLOBAL") {
|
|
90
91
|
if (typeof value === "object" && !Array.isArray(value))
|
|
@@ -114,6 +115,7 @@ export const insert = async (meta, collection, value, _id) => {
|
|
|
114
115
|
|
|
115
116
|
export const query = async (meta, collection, query, options) => {
|
|
116
117
|
// Multi Company Support
|
|
118
|
+
if (Utils.isEmpty(meta?.company)) throw {message: "Error: meta argument not provided in Dip.query()"}
|
|
117
119
|
collection = `${meta.company}.${collection}`
|
|
118
120
|
if (meta.company !== "GLOBAL")
|
|
119
121
|
query.company = meta.company
|
|
@@ -154,6 +156,7 @@ function collectionArray(col) {
|
|
|
154
156
|
|
|
155
157
|
export const update = async (meta, collection, query, update, options) => {
|
|
156
158
|
// Multi Company Support
|
|
159
|
+
if (Utils.isEmpty(meta?.company)) throw {message: "Error: meta argument not provided in Dip.query()"}
|
|
157
160
|
collection = `${meta.company}.${collection}`
|
|
158
161
|
if (meta.company !== "GLOBAL") {
|
|
159
162
|
query.company = meta.company
|
|
@@ -183,6 +186,7 @@ export const update = async (meta, collection, query, update, options) => {
|
|
|
183
186
|
|
|
184
187
|
export const remove = async (meta, collection, query) => {
|
|
185
188
|
// Multi Company Support
|
|
189
|
+
if (Utils.isEmpty(meta?.company)) throw {message: "Error: meta argument not provided in Dip.query()"}
|
|
186
190
|
collection = `${meta.company}.${collection}`
|
|
187
191
|
if (meta.company !== "GLOBAL")
|
|
188
192
|
query.company = meta.company
|
package/libs/privileges.js
CHANGED
|
@@ -75,6 +75,8 @@ const check = async (company, user, feature, req) => {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
export const checkRequest = async (req) => {
|
|
78
|
+
let meta = {...req.body, data: undefined}
|
|
79
|
+
req.meta = meta
|
|
78
80
|
return await check(req.body.company, req.body.user, req.body.feature, req)
|
|
79
81
|
}
|
|
80
82
|
|