corebasic 1.0.106 → 1.0.108

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 CHANGED
@@ -85,7 +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
+ if (Utils.isEmpty(meta?.company)) throw {message: "Error: meta argument not provided in Dip.insert()"}
89
89
  collection = `${meta.company}.${collection}`
90
90
  if (meta.company !== "GLOBAL") {
91
91
  if (typeof value === "object" && !Array.isArray(value))
@@ -156,7 +156,7 @@ function collectionArray(col) {
156
156
 
157
157
  export const update = async (meta, collection, query, update, options) => {
158
158
  // Multi Company Support
159
- if (Utils.isEmpty(meta?.company)) throw {message: "Error: meta argument not provided in Dip.query()"}
159
+ if (Utils.isEmpty(meta?.company)) throw {message: "Error: meta argument not provided in Dip.update()"}
160
160
  collection = `${meta.company}.${collection}`
161
161
  if (meta.company !== "GLOBAL") {
162
162
  query.company = meta.company
@@ -186,7 +186,7 @@ export const update = async (meta, collection, query, update, options) => {
186
186
 
187
187
  export const remove = async (meta, collection, query) => {
188
188
  // Multi Company Support
189
- if (Utils.isEmpty(meta?.company)) throw {message: "Error: meta argument not provided in Dip.query()"}
189
+ if (Utils.isEmpty(meta?.company)) throw {message: "Error: meta argument not provided in Dip.remove()"}
190
190
  collection = `${meta.company}.${collection}`
191
191
  if (meta.company !== "GLOBAL")
192
192
  query.company = meta.company
package/libs/features.js CHANGED
@@ -161,6 +161,8 @@ export const start = async (app, url, file) => {
161
161
  // Subscribe to each topic
162
162
  for (let topic of kafkaTopics) {
163
163
  Kafka.receive(`Features.${topic}`, async (topic, message) => {
164
+ if (Utils.isEmpty(message.meta.company))
165
+ message.meta = { ...message.meta, company: "GLOBAL", outlet: "GLOBAL" }
164
166
 
165
167
  const timer = ms => new Promise(res => setTimeout(res, ms)) // A promise that resolves after "ms" Milliseconds
166
168
  topic = topic.replace(/^.*Features./,'')
package/libs/session.js CHANGED
@@ -22,6 +22,8 @@ export const start = (expressApp, allowedUrls) => {
22
22
 
23
23
  // return next() // Disable session
24
24
 
25
+ let allowedDefaults = req.url === '/features' || req.url.startsWith('/messages/')
26
+
25
27
  if (urlsAllowed.includes(req.path))
26
28
  return next()
27
29
 
@@ -30,7 +32,7 @@ export const start = (expressApp, allowedUrls) => {
30
32
  const service = req.header('SERVICE'); // Case insensitive search
31
33
  if (service && jwt.verify(token, DEPLOY_TOKEN_SECRET))
32
34
  return next()
33
- else if (jwt.verify(token, ACCESS_TOKEN_SECRET) && (process.env.GRANT_FULL_ACCESS || await Privilege.checkRequest(req)))
35
+ else if (jwt.verify(token, ACCESS_TOKEN_SECRET) && (process.env.GRANT_FULL_ACCESS || allowedDefaults || await Privilege.checkRequest(req)))
34
36
  return next()
35
37
  throw null;
36
38
  } catch (error) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "corebasic",
3
3
  "type": "module",
4
- "version": "1.0.106",
4
+ "version": "1.0.108",
5
5
  "description": "",
6
6
  "main": "index.js",
7
7
  "scripts": {