@indra.ai/deva 1.6.93 → 1.6.95

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/index.js +40 -18
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1105,7 +1105,7 @@ class Deva {
1105
1105
 
1106
1106
  const hasOnStart = this.onStart && typeof this.onStart === 'function' ? true : false;
1107
1107
  if (hasOnStart) this.state('set', `hasOnStart:${data.id.uid}`); // state set to watch OnFinish
1108
-
1108
+
1109
1109
  this.action('return', `start:${data.id.uid}`); // return action finish
1110
1110
  return hasOnStart ? this.onStart(data, resolve) : this.enter(data, resolve)
1111
1111
  }
@@ -1496,23 +1496,33 @@ class Deva {
1496
1496
  /**************
1497
1497
  func: states
1498
1498
  params: none
1499
- describe: returns the avaiable staets values.
1499
+ describe: returns the available states values.
1500
1500
  ***************/
1501
1501
  states() {
1502
+ if (!this._active) return Promise.resolve(this._messages.offline);
1502
1503
  const id = this.uid();
1503
- this.action('states', id);
1504
+ const key = 'states';
1505
+ this.action(key, id.uid);
1506
+
1507
+ // set the data packet for the states
1508
+ this.state('data', `${key}:${id.uid}`);
1504
1509
  const data = {
1505
1510
  id,
1506
- key: 'states',
1511
+ key,
1507
1512
  value: this._states,
1513
+ agent: this.agent(),
1514
+ client: this.client(),
1508
1515
  created: Date.now(),
1509
1516
  }
1510
1517
 
1518
+ this.action('hash', `${data.key}:md5:${data.id.uid}`);
1511
1519
  data.md5 = this.hash(data);
1512
- data.sha256 = this.hash(data, 'sha256');
1520
+ this.action('hash', `${data.key}:sha256:${data.id.uid}`);
1521
+ data.sha256 = this.hash(data, 'sha256');
1522
+ this.action('hash', `${data.key}:sha512:${data.id.uid}`);
1513
1523
  data.sha512 = this.hash(data, 'sha512');
1514
1524
 
1515
- this.state('return', `states:${id.uid}`);
1525
+ this.action('return', `${data.key}:${id.uid}`);
1516
1526
  return data;
1517
1527
  }
1518
1528
 
@@ -1548,7 +1558,6 @@ class Deva {
1548
1558
  this.talk(this._events.zone, data);
1549
1559
  return data;
1550
1560
  } catch (e) {
1551
- this.state('catch', `zone:${value}:${id.uid}`);
1552
1561
  return this.err(e, value);
1553
1562
  }
1554
1563
  }
@@ -1559,23 +1568,29 @@ class Deva {
1559
1568
  describe: returns a listing of zones currently in the system.
1560
1569
  ***************/
1561
1570
  zones() {
1571
+ if (!this._active) return Promise.resolve(this._messages.offline);
1562
1572
  const id = this.uid();
1563
- this.action('zones', id.uid);
1564
- this.state('return', `zones:${id.uid}`);
1565
-
1573
+ const key = 'zones';
1574
+ this.action(key, id.uid);
1575
+
1576
+ this.state('data', `${key}:${id.uid}`);
1566
1577
  const data = {
1567
1578
  id, // set the uuid of the data
1568
- agent: this.agent(), // set the agent value
1569
- cleint: this.client(), // set the client value
1570
- key: 'zones', // set the key return value
1579
+ key, // set the key return value
1571
1580
  value: this._zones, // set the list of zones
1581
+ agent: this.agent(), // set the agent value
1582
+ client: this.client(), // set the client value
1572
1583
  created: Date.now(), // set the created date of the object.
1573
1584
  }
1574
1585
 
1586
+ this.action('hash', `${data.key}:md5:${data.id.uid}`);
1575
1587
  data.md5 = this.hash(data);
1576
- data.sha256 = this.hash(data, 'sha256');
1588
+ this.action('hash', `${data.key}:sha256:${data.id.uid}`);
1589
+ data.sha256 = this.hash(data, 'sha256');
1590
+ this.action('hash', `${data.key}:sha512:${data.id.uid}`);
1577
1591
  data.sha512 = this.hash(data, 'sha512');
1578
1592
 
1593
+ this.action('return', `${data.key}:${id.uid}`);
1579
1594
  return data
1580
1595
  }
1581
1596
 
@@ -1626,19 +1641,26 @@ class Deva {
1626
1641
  describe: Returns a list of available actions in the system.
1627
1642
  ***************/
1628
1643
  actions() {
1644
+ if (!this._active) return Promise.resolve(this._messages.offline);
1629
1645
  const id = this.uid();
1630
- this.action('actions', id.uid);
1646
+ const key = 'actions';
1647
+ this.action(key, id.uid);
1648
+
1649
+ this.state('data', `${key}:${id.uid}`);
1631
1650
  const data = {
1632
1651
  id, // set the id with a uuid
1652
+ key, // set the data key
1653
+ value: this._actions, // set the value to the actions list
1633
1654
  agent: this.agent(), // set the agent value
1634
1655
  client: this.client(), // set the client value
1635
- key: 'actions', // set the data key
1636
- value: this._actions, // set the value to the actions list
1637
1656
  created: Date.now(), // set the data created date
1638
1657
  };
1639
1658
 
1659
+ this.action('hash', `${data.key}:md5:${data.id.uid}`);
1640
1660
  data.md5 = this.hash(data);
1641
- data.sha256 = this.hash(data, 'sha256');
1661
+ this.action('hash', `${data.key}:sha256:${data.id.uid}`);
1662
+ data.sha256 = this.hash(data, 'sha256');
1663
+ this.action('hash', `${data.key}:sha512:${data.id.uid}`);
1642
1664
  data.sha512 = this.hash(data, 'sha512');
1643
1665
 
1644
1666
  this.state('return', `actions:${id.uid}`);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "44091450722329207445",
3
3
  "name": "@indra.ai/deva",
4
- "version": "1.6.93",
4
+ "version": "1.6.95",
5
5
  "description": "Deva Core a Vedic-inspired Event Based Context Aware Feature, Zone, Action, and State Machine integrated Artificial Intelligence Framework",
6
6
  "main": "index.js",
7
7
  "license": "VLA:44091450722329207445 LICENSE.md",