@indra.ai/deva 1.1.127 → 1.1.129

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 +29 -3
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -4,8 +4,10 @@
4
4
  const {EventEmitter} = require('events');
5
5
  const fs = require('fs');
6
6
  const path = require('path');
7
+ const os = require('os');
8
+ const crypto = require('crypto');
9
+ const { createHash, randomUUID, createCipheriv, createDecipheriv, randomBytes } = crypto;
7
10
 
8
- const { createHash, randomUUID, createCipheriv, createDecipheriv, randomBytes } = require('crypto');
9
11
  const config = require('./config.json').DATA // load the deva core configuration data.
10
12
  class Deva {
11
13
  constructor(opts) {
@@ -26,9 +28,31 @@ class Deva {
26
28
  this._business = false; // inherited Business features.
27
29
  this._legal = false; // inherited Legal features.
28
30
  this._assistant = false; // inherited Assistant features.
31
+ this.os = require('os'); // It is used to provide basic operating system related utility functions.
32
+ this.buffer = require('buffer'); // It is used to provide basic operating system related utility functions.
33
+ this.util = require('util'); // The supports the needs of internal APIs.
34
+ this.report = require('report'); // It is used to provide basic operating system related utility functions.
35
+ this.querystring = require('querystring'); // Provides utilities for parsing and formatting URL query strings.
36
+ this.readline = require('readline'); // Provides utilities for parsing and formatting URL query strings.
37
+ this.fs = require('fs'); // this is so file system functions are in the core.
38
+ this.path = require('path'); // this is so we can get path in the system.
39
+ this.crypto = require('crypto'); // It is used to support cryptography for encryption and decryption.
40
+ this.zlib = require('zlib'); // provides compression functionality using Gzip, Deflate/Inflate, and Brotli.
41
+ this.console = require('console'); // It is used to write data to console.
42
+ this.readline = require('readline/promises'); // It is used to write data to console.
43
+ this.cluster = require('cluster'); // used to take advantage of multi-core systems.
44
+ this.dns = require('dns'); // It is used to lookup and resolve on domain names.
45
+ this.net = require('net'); // It used to create TCP server/client communicate using TCP protocol.
46
+ this.http = require('http'); // It is used to create Http server and Http client.
47
+ this.https = require('https'); // It is used to create Http server and Http client.
48
+ this.stream = require('stream/promises'); // It is used to stream data between two entities.
49
+ this.inspector = require('inspector'); // It is used to stream data between two entities.
50
+ this.url = require('url'); // It is used for URL resolution and parsing.
51
+ this.vm = require('vm'); // It provides an access to virtual machine to compile and execute code.
52
+ this.assert = require('assert'); // It is used for testing itself.
29
53
  this.events = opts.events || new EventEmitter({}); // Event Bus
30
54
  this.lib = opts.lib || {}; // used for loading library functions
31
- this.utils = opts.util || {}; // parse function
55
+ this.utils = opts.utils || {}; // parse function
32
56
  this.devas = opts.devas || {}; // Devas which are loaded
33
57
  this.vars = opts.vars || {}; // Variables object
34
58
  this.listeners = opts.listeners || {}; // local Listeners
@@ -753,7 +777,6 @@ class Deva {
753
777
  packet_answer.meta.hash = this.hash(packet_answer);
754
778
 
755
779
  packet.a = packet_answer;
756
- this.prompt('TALK TALK TALK ANSWER')
757
780
  this.action('answer_talk');
758
781
  this.talk(config.events.answer, this.copy(packet)); // global talk event
759
782
  return this.finish(packet, resolve) // resolve the packet to the caller.
@@ -1637,6 +1660,9 @@ class Deva {
1637
1660
  system based on the language and locale in the client profile.
1638
1661
  ***************/
1639
1662
  formatDate(d, format='milli', time=false) {
1663
+ if (!d) d = Date.now();
1664
+ d = new Date(d);
1665
+
1640
1666
  if (format === 'milli') return d.getTime();
1641
1667
  // pre-set date formats for returning user dates.
1642
1668
  const formats = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indra.ai/deva",
3
- "version": "1.1.127",
3
+ "version": "1.1.129",
4
4
  "description": "The Deva Core",
5
5
  "main": "index.js",
6
6
  "scripts": {