corebasic 1.0.110 → 1.0.112

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 +13 -6
  2. package/package.json +1 -1
package/libs/features.js CHANGED
@@ -53,6 +53,7 @@ export const send = async (meta, feature, data, params) => {
53
53
  }
54
54
 
55
55
  let payload = { ...meta, data, feature, txn: Utils.uid() }
56
+ service = service.replace('http://slyp.app', 'https://slyp.app')
56
57
 
57
58
  // return (await axios[method](`${service}${url}`, { data: payload, headers: {jwt: headers.jwt}, timeout: 1000 })).data
58
59
  return (await axios[method](`${service}${url}`, payload, {headers: {jwt: SERVICE_ACCESS_TOKEN, service: true}, timeout: 1000 })).data
@@ -115,13 +116,19 @@ export const start = async (app, url, file) => {
115
116
  continue
116
117
 
117
118
  app[method](url, async (req, res) => {
118
- if (!req.body.feature)
119
- console.warn(`Feature: ${req.body.feature} not available`, req.url, req.params, req.body, req)
120
- let feature = getFeature(req.body.feature)
121
- if (!feature)
122
- console.warn(`Feature: ${req.body.feature} not available`, req.url, req.params, req.body)
123
- let topic = feature.topic
124
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
125
132
  let params = getFeatureUrl(feature.api).split("/").filter(item => item.startsWith(":")).map(item => item.replace(":", ""))
126
133
  for (let param of params)
127
134
  if (!req.params[param])
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "corebasic",
3
3
  "type": "module",
4
- "version": "1.0.110",
4
+ "version": "1.0.112",
5
5
  "description": "",
6
6
  "main": "index.js",
7
7
  "scripts": {