corebasic 1.0.111 → 1.0.113

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.
Files changed (2) hide show
  1. package/libs/features.js +16 -6
  2. package/package.json +1 -1
package/libs/features.js CHANGED
@@ -116,13 +116,19 @@ export const start = async (app, url, file) => {
116
116
  continue
117
117
 
118
118
  app[method](url, async (req, res) => {
119
- if (!req.body.feature)
120
- console.warn(`Feature: ${req.body.feature} not available`, req.url, req.params, req.body, req)
121
- let feature = getFeature(req.body.feature)
122
- if (!feature)
123
- console.warn(`Feature: ${req.body.feature} not available`, req.url, req.params, req.body)
124
- let topic = feature.topic
125
119
  try {
120
+ if (!req.body.feature) {
121
+ console.warn(`Feature: feature not sent by client`)
122
+ throw { status: 404, message: "Resource not found. Feature not sent by client." }
123
+ }
124
+
125
+ let feature = getFeature(req.body.feature)
126
+ if (!feature) {
127
+ console.warn(`Feature: ${req.body.feature} not available`)
128
+ throw { status: 404, message: `Resource not found. Feature ${req.body.feature} not available.` }
129
+ }
130
+
131
+ let topic = feature.topic
126
132
  let params = getFeatureUrl(feature.api).split("/").filter(item => item.startsWith(":")).map(item => item.replace(":", ""))
127
133
  for (let param of params)
128
134
  if (!req.params[param])
@@ -130,6 +136,10 @@ export const start = async (app, url, file) => {
130
136
 
131
137
  let meta = {...req.body, data: undefined}
132
138
  req.meta = meta
139
+ if (process.env.USE_DEFAULT_COMPANY) {
140
+ req.meta.company = 'DEFAULT_COMPANY'
141
+ req.meta.outlet = 'DEFAULT_OUTLET'
142
+ }
133
143
 
134
144
  if (method === "get") {
135
145
  try {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "corebasic",
3
3
  "type": "module",
4
- "version": "1.0.111",
4
+ "version": "1.0.113",
5
5
  "description": "",
6
6
  "main": "index.js",
7
7
  "scripts": {