corebasic 1.0.105 → 1.0.107

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,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/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.105",
4
+ "version": "1.0.107",
5
5
  "description": "",
6
6
  "main": "index.js",
7
7
  "scripts": {