corebasic 1.0.97 → 1.0.98

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 +7 -6
  2. package/package.json +1 -1
package/libs/features.js CHANGED
@@ -12,20 +12,23 @@ const getFeatureMethod = api => api.split(' ')[0].toLowerCase()
12
12
  const getFeatureUrl = api => api.split(' ')[1]
13
13
  const getFeature = name => features[name]
14
14
 
15
+ const DEPLOY_TOKEN_SECRET = process.env.DEPLOY_TOKEN_SECRET || "MY_SECRET_DEPLOY_TOKEN"
16
+ const SERVICE_ACCESS_TOKEN = jwt.sign({app: process.env.APP_DEPLOYMENT_NAME}, DEPLOY_TOKEN_SECRET, { expiresIn: '365d' });
17
+
15
18
  async function loadLocalFeatures() { // For Local Testing
16
19
  let data = {}
17
20
  if (process.env.LOAD_LOCAL_FEATURES) {
18
21
  try {
19
22
  let url = 'https://slyp.app/slyp-main-dev/api/v1/features'
20
23
  let result = (await axios.get(url, { data: {}, headers: {jwt: SERVICE_ACCESS_TOKEN, service: true}, timeout: 1000 })).data
21
- await Utils.stringToFile('/.slyp/features.json', JSON.stringify(result.data, null, '\t'))
24
+ await Utils.stringToFile('/slyp.local.features.json', JSON.stringify(result.data, null, '\t'))
22
25
  } catch {
23
-
26
+ console.log('Error Fetching Remote Features')
24
27
  }
25
28
  try {
26
- data = JSON.parse(await Utils.fileToString('/.slyp/features.json'))
29
+ data = JSON.parse(await Utils.fileToString('/slyp.local.features.json'))
27
30
  } catch {
28
-
31
+ console.log('Error Loading Remote Features')
29
32
  }
30
33
  }
31
34
  return data
@@ -35,8 +38,6 @@ let SLYP_FEATURES_LIST = await loadLocalFeatures()
35
38
  let appId = Utils.uid()
36
39
  let SERVICE_ADDRESS = process.env.APP_ENDPOINT || 'http://127.0.0.1:3000'
37
40
 
38
- const DEPLOY_TOKEN_SECRET = process.env.DEPLOY_TOKEN_SECRET || "MY_SECRET_DEPLOY_TOKEN"
39
- const SERVICE_ACCESS_TOKEN = jwt.sign({app: process.env.APP_DEPLOYMENT_NAME}, DEPLOY_TOKEN_SECRET, { expiresIn: '365d' });
40
41
 
41
42
  export const send = async (feature, params, payload, headers) => {
42
43
  const throwError = () => {throw {message: `Feature ${feature} not found in internal or external list during inter feature call`}}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "corebasic",
3
3
  "type": "module",
4
- "version": "1.0.97",
4
+ "version": "1.0.98",
5
5
  "description": "",
6
6
  "main": "index.js",
7
7
  "scripts": {