godprotocol 1.0.77 → 1.0.79

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 (71) hide show
  1. package/Index.js +3 -15
  2. package/Loader_sequence/main.js +255 -55
  3. package/Objects/Account.js +24 -21
  4. package/Objects/Block.js +4 -1
  5. package/Objects/Chain.js +8 -1
  6. package/Objects/Filesystem.js +11 -15
  7. package/Objects/Manager.js +19 -8
  8. package/Objects/Opcodes.js +5 -3
  9. package/Objects/Oracle.js +10 -0
  10. package/Objects/Virtual_machine.js +1 -7
  11. package/framer.js +2 -4
  12. package/opcodes/std.js +2 -1
  13. package/opcodes.js +6 -4
  14. package/package.json +13 -3
  15. package/readme.md +2 -2
  16. package/utils/create_server.js +23 -3
  17. package/.github/workflows/npm-publish-github-packages.yml +0 -36
  18. package/Accounts/59eb3cb130074f7b1ddb99c8fe14f27e1dbca735bb3da82e1ff0305340a32419/0ee263de3fb9e3e08e7d5abe21db8c0fe66188829979996dcddd3533d855a817/30dc10d3485923c0c19083559094fe636f9491bff9c997306ffdbf3e1618a402/74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b +0 -1
  19. package/Accounts/59eb3cb130074f7b1ddb99c8fe14f27e1dbca735bb3da82e1ff0305340a32419/0ee263de3fb9e3e08e7d5abe21db8c0fe66188829979996dcddd3533d855a817/4dc569813ce0a2f446a3eec01358f5774f8564641ef8d579ff5b6d94b4d031a7/74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b +0 -1
  20. package/Accounts/59eb3cb130074f7b1ddb99c8fe14f27e1dbca735bb3da82e1ff0305340a32419/0ee263de3fb9e3e08e7d5abe21db8c0fe66188829979996dcddd3533d855a817/74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b +0 -1
  21. package/Accounts/59eb3cb130074f7b1ddb99c8fe14f27e1dbca735bb3da82e1ff0305340a32419/0ee263de3fb9e3e08e7d5abe21db8c0fe66188829979996dcddd3533d855a817/a965464a6d9f981543ce3aede226bd0fb989d9300cd8468f41cd1fc0139c8f44/74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b +0 -1
  22. package/Accounts/59eb3cb130074f7b1ddb99c8fe14f27e1dbca735bb3da82e1ff0305340a32419/12cd650efa4f63b7c61c3345db3daa0534f4c370a003ea6d8ae0d29a49f6f928/74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b +0 -1
  23. package/Accounts/59eb3cb130074f7b1ddb99c8fe14f27e1dbca735bb3da82e1ff0305340a32419/3ff3661353ccadcaf9c6759a539d8d31e19c07ed0dd888170b9e55c7a18721da/74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b +0 -1
  24. package/Accounts/59eb3cb130074f7b1ddb99c8fe14f27e1dbca735bb3da82e1ff0305340a32419/3ff3661353ccadcaf9c6759a539d8d31e19c07ed0dd888170b9e55c7a18721da/de551b5a493859e532316cbbf1e4a14eb06e0512556b1c1295ad60ffe07c185b/19270ea4f98808a63fbb99bc26a5ee6f0fe8df9c8182cf1d710b115d57250578 +0 -1
  25. package/Accounts/59eb3cb130074f7b1ddb99c8fe14f27e1dbca735bb3da82e1ff0305340a32419/3ff3661353ccadcaf9c6759a539d8d31e19c07ed0dd888170b9e55c7a18721da/f8a165e3f556ca2ea189f4d4401d139b22a6f19d0b38329fe4a5f14599840634/4f52f1dc77e0233034c6566fc73c30234de85d2298ff90885a7c56502dffa0b2 +0 -1
  26. package/Accounts/59eb3cb130074f7b1ddb99c8fe14f27e1dbca735bb3da82e1ff0305340a32419/3ff3661353ccadcaf9c6759a539d8d31e19c07ed0dd888170b9e55c7a18721da/f8a165e3f556ca2ea189f4d4401d139b22a6f19d0b38329fe4a5f14599840634/8d3c916f9c93a6f4c8be9c3f4493b1c02d3eb7516eac153a98320924b27739d8 +0 -1
  27. package/Accounts/59eb3cb130074f7b1ddb99c8fe14f27e1dbca735bb3da82e1ff0305340a32419/f968ed8cf7958218d4604b3de0bf074f09bac7925e86f7d1f495f8b2c67f31a7/61bdf0593cd727752cb917ab968a08853d45142b8a8e4cdcd0fe03d1616f3586/74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b +0 -1
  28. package/Accounts/59eb3cb130074f7b1ddb99c8fe14f27e1dbca735bb3da82e1ff0305340a32419/f968ed8cf7958218d4604b3de0bf074f09bac7925e86f7d1f495f8b2c67f31a7/74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b +0 -1
  29. package/Loader_sequence/functions/parse_expression.js +0 -107
  30. package/Loader_sequence/functions/parse_to_obj.js +0 -38
  31. package/Loader_sequence/functions/parse_variable.js +0 -38
  32. package/Loader_sequence/functions/tokenise.js +0 -135
  33. package/Loader_sequence/functions/utils.js +0 -14
  34. package/Loader_sequence/keywords/parse.js +0 -23
  35. package/Loader_sequence/native_classes/Variable.js +0 -49
  36. package/Loader_sequence/native_classes/datatypes/Array.js +0 -56
  37. package/Loader_sequence/native_classes/datatypes/Boolean.js +0 -42
  38. package/Loader_sequence/native_classes/datatypes/Number.js +0 -42
  39. package/Loader_sequence/native_classes/datatypes/String.js +0 -42
  40. package/Loader_sequence/native_classes/datatypes/Twain.js +0 -65
  41. package/Loader_sequence/native_classes/datatypes/Void.js +0 -42
  42. package/Loader_sequence/native_classes/global.js +0 -48
  43. package/Loader_sequence/native_classes/native.js +0 -63
  44. package/Loader_sequence/native_classes/operators.js +0 -64
  45. package/Loader_sequence/native_classes/parse.js +0 -54
  46. package/Loader_sequence/utils/format_instructions.js +0 -52
  47. package/build/Account.js +0 -245
  48. package/build/Array.js +0 -142
  49. package/build/Block.js +0 -100
  50. package/build/Blockweb.js +0 -78
  51. package/build/Boolean.js +0 -128
  52. package/build/Chain.js +0 -198
  53. package/build/Explorer.js +0 -85
  54. package/build/Filesystem.js +0 -173
  55. package/build/Frame.js +0 -108
  56. package/build/Index.js +0 -31
  57. package/build/Manager.js +0 -167
  58. package/build/Number.js +0 -128
  59. package/build/Opcodes.js +0 -75
  60. package/build/Oracle.js +0 -70
  61. package/build/String.js +0 -128
  62. package/build/Twain.js +0 -151
  63. package/build/Variable.js +0 -135
  64. package/build/Virtual_machine.js +0 -220
  65. package/build/Void.js +0 -128
  66. package/build/format_instructions.js +0 -52
  67. package/build/framer.js +0 -90
  68. package/build/global.js +0 -134
  69. package/build/main.js +0 -83
  70. package/build/native.js +0 -101
  71. package/build/operators.js +0 -150
package/build/Boolean.js DELETED
@@ -1,128 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
- var _native = _interopRequireDefault(require("../native"));
8
- function _interopRequireDefault(e) {
9
- return e && e.__esModule ? e : {
10
- "default": e
11
- };
12
- }
13
- function _typeof(o) {
14
- "@babel/helpers - typeof";
15
-
16
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
17
- return typeof o;
18
- } : function (o) {
19
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
20
- }, _typeof(o);
21
- }
22
- function _defineProperties(e, r) {
23
- for (var t = 0; t < r.length; t++) {
24
- var o = r[t];
25
- o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
26
- }
27
- }
28
- function _createClass(e, r, t) {
29
- return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
30
- writable: !1
31
- }), e;
32
- }
33
- function _classCallCheck(a, n) {
34
- if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
35
- }
36
- function _inherits(t, e) {
37
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
38
- t.prototype = Object.create(e && e.prototype, {
39
- constructor: {
40
- value: t,
41
- writable: !0,
42
- configurable: !0
43
- }
44
- }), Object.defineProperty(t, "prototype", {
45
- writable: !1
46
- }), e && _setPrototypeOf(t, e);
47
- }
48
- function _setPrototypeOf(t, e) {
49
- return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
50
- return t.__proto__ = e, t;
51
- }, _setPrototypeOf(t, e);
52
- }
53
- function _createSuper(t) {
54
- var r = _isNativeReflectConstruct();
55
- return function () {
56
- var e,
57
- o = _getPrototypeOf(t);
58
- if (r) {
59
- var s = _getPrototypeOf(this).constructor;
60
- e = Reflect.construct(o, arguments, s);
61
- } else e = o.apply(this, arguments);
62
- return _possibleConstructorReturn(this, e);
63
- };
64
- }
65
- function _possibleConstructorReturn(t, e) {
66
- if (e && ("object" == _typeof(e) || "function" == typeof e)) return e;
67
- if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
68
- return _assertThisInitialized(t);
69
- }
70
- function _assertThisInitialized(e) {
71
- if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
72
- return e;
73
- }
74
- function _isNativeReflectConstruct() {
75
- try {
76
- var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
77
- } catch (t) {}
78
- return (_isNativeReflectConstruct = function _isNativeReflectConstruct() {
79
- return !!t;
80
- })();
81
- }
82
- function _getPrototypeOf(t) {
83
- return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
84
- return t.__proto__ || Object.getPrototypeOf(t);
85
- }, _getPrototypeOf(t);
86
- }
87
- function _defineProperty(e, r, t) {
88
- return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
89
- value: t,
90
- enumerable: !0,
91
- configurable: !0,
92
- writable: !0
93
- }) : e[r] = t, e;
94
- }
95
- function _toPropertyKey(t) {
96
- var i = _toPrimitive(t, "string");
97
- return "symbol" == _typeof(i) ? i : i + "";
98
- }
99
- function _toPrimitive(t, r) {
100
- if ("object" != _typeof(t) || !t) return t;
101
- var e = t[Symbol.toPrimitive];
102
- if (void 0 !== e) {
103
- var i = e.call(t, r || "default");
104
- if ("object" != _typeof(i)) return i;
105
- throw new TypeError("@@toPrimitive must return a primitive value.");
106
- }
107
- return ("string" === r ? String : Number)(t);
108
- }
109
- var Bool = /*#__PURE__*/function (_Native) {
110
- _inherits(Bool, _Native);
111
- var _super = _createSuper(Bool);
112
- function Bool(token) {
113
- var _this;
114
- _classCallCheck(this, Bool);
115
- _this = _super.call(this);
116
- _defineProperty(_assertThisInitialized(_this), "generate_assembly", function (sequence) {
117
- sequence.push("link ".concat(_this.token.compiler.account.physical_address, "/Datatypes/Boolean"));
118
- sequence.push("write ".concat(_this.name));
119
- sequence.push("pop Datatypes/Boolean");
120
- });
121
- _this.token = token;
122
- _this.name = _this.token.value;
123
- return _this;
124
- }
125
- return _createClass(Bool);
126
- }(_native["default"]);
127
- var _default = Bool;
128
- exports["default"] = _default;
package/build/Chain.js DELETED
@@ -1,198 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
- var _hash = require("../utils/hash");
8
- var _Block = _interopRequireDefault(require("./Block"));
9
- var _Explorer2 = _interopRequireDefault(require("./Explorer"));
10
- function _interopRequireDefault(e) {
11
- return e && e.__esModule ? e : {
12
- "default": e
13
- };
14
- }
15
- function _typeof(o) {
16
- "@babel/helpers - typeof";
17
-
18
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
19
- return typeof o;
20
- } : function (o) {
21
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
22
- }, _typeof(o);
23
- }
24
- function _defineProperties(e, r) {
25
- for (var t = 0; t < r.length; t++) {
26
- var o = r[t];
27
- o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
28
- }
29
- }
30
- function _createClass(e, r, t) {
31
- return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
32
- writable: !1
33
- }), e;
34
- }
35
- function _classCallCheck(a, n) {
36
- if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
37
- }
38
- function _inherits(t, e) {
39
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
40
- t.prototype = Object.create(e && e.prototype, {
41
- constructor: {
42
- value: t,
43
- writable: !0,
44
- configurable: !0
45
- }
46
- }), Object.defineProperty(t, "prototype", {
47
- writable: !1
48
- }), e && _setPrototypeOf(t, e);
49
- }
50
- function _setPrototypeOf(t, e) {
51
- return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
52
- return t.__proto__ = e, t;
53
- }, _setPrototypeOf(t, e);
54
- }
55
- function _createSuper(t) {
56
- var r = _isNativeReflectConstruct();
57
- return function () {
58
- var e,
59
- o = _getPrototypeOf(t);
60
- if (r) {
61
- var s = _getPrototypeOf(this).constructor;
62
- e = Reflect.construct(o, arguments, s);
63
- } else e = o.apply(this, arguments);
64
- return _possibleConstructorReturn(this, e);
65
- };
66
- }
67
- function _possibleConstructorReturn(t, e) {
68
- if (e && ("object" == _typeof(e) || "function" == typeof e)) return e;
69
- if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
70
- return _assertThisInitialized(t);
71
- }
72
- function _assertThisInitialized(e) {
73
- if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
74
- return e;
75
- }
76
- function _isNativeReflectConstruct() {
77
- try {
78
- var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
79
- } catch (t) {}
80
- return (_isNativeReflectConstruct = function _isNativeReflectConstruct() {
81
- return !!t;
82
- })();
83
- }
84
- function _getPrototypeOf(t) {
85
- return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
86
- return t.__proto__ || Object.getPrototypeOf(t);
87
- }, _getPrototypeOf(t);
88
- }
89
- function _defineProperty(e, r, t) {
90
- return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
91
- value: t,
92
- enumerable: !0,
93
- configurable: !0,
94
- writable: !0
95
- }) : e[r] = t, e;
96
- }
97
- function _toPropertyKey(t) {
98
- var i = _toPrimitive(t, "string");
99
- return "symbol" == _typeof(i) ? i : i + "";
100
- }
101
- function _toPrimitive(t, r) {
102
- if ("object" != _typeof(t) || !t) return t;
103
- var e = t[Symbol.toPrimitive];
104
- if (void 0 !== e) {
105
- var i = e.call(t, r || "default");
106
- if ("object" != _typeof(i)) return i;
107
- throw new TypeError("@@toPrimitive must return a primitive value.");
108
- }
109
- return ("string" === r ? String : Number)(t);
110
- }
111
- var Chain = /*#__PURE__*/function (_Explorer) {
112
- _inherits(Chain, _Explorer);
113
- var _super = _createSuper(Chain);
114
- function Chain(parent, _name) {
115
- var _this;
116
- _classCallCheck(this, Chain);
117
- _this = _super.call(this);
118
- _defineProperty(_assertThisInitialized(_this), "append_buffer", function () {
119
- _this.buffs.push({});
120
- _this.cursors.push(_this.cursor);
121
- _this.cursor = -1;
122
- });
123
- _defineProperty(_assertThisInitialized(_this), "get_buffer", function () {
124
- return _this.buffs.slice(-1)[0];
125
- });
126
- _defineProperty(_assertThisInitialized(_this), "generate_hash", function () {
127
- _this.hash = (0, _hash.hash)(_this.physical_address);
128
- });
129
- _defineProperty(_assertThisInitialized(_this), "get_block", function (index) {
130
- return _this.blocks[index];
131
- });
132
- _defineProperty(_assertThisInitialized(_this), "add_tx", function (instruction) {
133
- if (!_this.txs.length) _this.start_time = Date.now();
134
- _this.txs.push(instruction);
135
- });
136
- _defineProperty(_assertThisInitialized(_this), "mine", function (vm, no_curs) {
137
- var block = new _Block["default"](_assertThisInitialized(_this));
138
- block.generate_hash();
139
- _this.add_block(block);
140
- block.store(no_curs);
141
- block.children = _this.pending_children;
142
- _this.pending_children = new Array();
143
- var prev_context = vm.get_context(-2);
144
- if (prev_context) {
145
- prev_context.pending_children.push(block);
146
- prev_context.connections.push(block);
147
- }
148
- _this.txs = new Array();
149
- block.timelapse = Date.now() - _this.start_time;
150
- return block;
151
- });
152
- _defineProperty(_assertThisInitialized(_this), "add_block", function (block) {
153
- return _this.blocks.push(block);
154
- });
155
- _defineProperty(_assertThisInitialized(_this), "get_latest_block", function () {
156
- return _this.blocks.slice(-1)[0];
157
- });
158
- _defineProperty(_assertThisInitialized(_this), "stringify", function (str) {
159
- var obj = {};
160
- obj.physical_address = _this.physical_address;
161
- obj.height = _this.blocks.length;
162
- obj.parent = _this.parent.path;
163
- obj.account = _this.parent.account.name;
164
- obj.name = _this.name;
165
- obj.connections = _this.connections.map(function (b) {
166
- return new Object({
167
- chain: b.chain.hash,
168
- block: b.hash
169
- });
170
- });
171
- obj.hash = _this.hash;
172
- obj.blocks = _this.blocks.map(function (blk) {
173
- return blk.hash;
174
- });
175
- return str ? JSON.stringify(obj) : obj;
176
- });
177
- _defineProperty(_assertThisInitialized(_this), "add_chain", function (name) {
178
- return _this.account.add_chain(name, _assertThisInitialized(_this));
179
- });
180
- _this.parent = parent;
181
- _this.account = _this.parent.account;
182
- _this.name = _name || _this.parent.name;
183
- _this.physical_address = _this.parent.manager || !_name ? _this.parent.physical_address : "".concat(_this.parent.physical_address, "/").concat(_this.name);
184
- _this.pending_children = new Array();
185
- _this.connections = new Array();
186
- _this.blocks = new Array();
187
- _this.txs = new Array();
188
- _this.cursor = -1;
189
- _this.cursors = new Array();
190
- _this.buffs = new Array();
191
- _this.generate_hash();
192
- _this.account.set_paths(_assertThisInitialized(_this));
193
- return _this;
194
- }
195
- return _createClass(Chain);
196
- }(_Explorer2["default"]);
197
- var _default = Chain;
198
- exports["default"] = _default;
package/build/Explorer.js DELETED
@@ -1,85 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
- function _typeof(o) {
8
- "@babel/helpers - typeof";
9
-
10
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
11
- return typeof o;
12
- } : function (o) {
13
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
14
- }, _typeof(o);
15
- }
16
- function _defineProperties(e, r) {
17
- for (var t = 0; t < r.length; t++) {
18
- var o = r[t];
19
- o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
20
- }
21
- }
22
- function _createClass(e, r, t) {
23
- return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
24
- writable: !1
25
- }), e;
26
- }
27
- function _classCallCheck(a, n) {
28
- if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
29
- }
30
- function _defineProperty(e, r, t) {
31
- return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
32
- value: t,
33
- enumerable: !0,
34
- configurable: !0,
35
- writable: !0
36
- }) : e[r] = t, e;
37
- }
38
- function _toPropertyKey(t) {
39
- var i = _toPrimitive(t, "string");
40
- return "symbol" == _typeof(i) ? i : i + "";
41
- }
42
- function _toPrimitive(t, r) {
43
- if ("object" != _typeof(t) || !t) return t;
44
- var e = t[Symbol.toPrimitive];
45
- if (void 0 !== e) {
46
- var i = e.call(t, r || "default");
47
- if ("object" != _typeof(i)) return i;
48
- throw new TypeError("@@toPrimitive must return a primitive value.");
49
- }
50
- return ("string" === r ? String : Number)(t);
51
- }
52
- var Explorer = /*#__PURE__*/_createClass(function Explorer() {
53
- var _this = this;
54
- _classCallCheck(this, Explorer);
55
- _defineProperty(this, "chain_props", ["blocks"]);
56
- _defineProperty(this, "explore", function (query) {
57
- if (!query) return;
58
- if (query.startsWith("{")) query = query.slice(1, -1);
59
- query = query.split(":");
60
- query[0] = query[0].split(".");
61
- var q2 = Number(query[1]),
62
- prop;
63
- if (_this.chain_props.includes(query[0][0])) prop = query[0][0];
64
- var obj;
65
- if (isNaN(q2)) {
66
- obj = _this[prop || "connections"].find(function (c) {
67
- return c.hash === query[1];
68
- });
69
- } else if (q2 >= 0) {
70
- obj = _this[prop || "connections"].find(function (q) {
71
- return q.index === q2;
72
- });
73
- } else {
74
- obj = _this[prop || "connections"].slice(q2)[0];
75
- }
76
- if (!prop) for (var q = 0; q < query[0].length; q++) {
77
- var que = query[0][q];
78
- if (!obj) break;
79
- obj = obj[que];
80
- }
81
- return obj;
82
- });
83
- });
84
- var _default = Explorer;
85
- exports["default"] = _default;
@@ -1,173 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
- var _fs = _interopRequireDefault(require("fs"));
8
- var _hash = require("../utils/hash");
9
- function _interopRequireDefault(e) {
10
- return e && e.__esModule ? e : {
11
- "default": e
12
- };
13
- }
14
- function _typeof(o) {
15
- "@babel/helpers - typeof";
16
-
17
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
18
- return typeof o;
19
- } : function (o) {
20
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
21
- }, _typeof(o);
22
- }
23
- function _defineProperties(e, r) {
24
- for (var t = 0; t < r.length; t++) {
25
- var o = r[t];
26
- o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
27
- }
28
- }
29
- function _createClass(e, r, t) {
30
- return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
31
- writable: !1
32
- }), e;
33
- }
34
- function _classCallCheck(a, n) {
35
- if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
36
- }
37
- function _defineProperty(e, r, t) {
38
- return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
39
- value: t,
40
- enumerable: !0,
41
- configurable: !0,
42
- writable: !0
43
- }) : e[r] = t, e;
44
- }
45
- function _toPropertyKey(t) {
46
- var i = _toPrimitive(t, "string");
47
- return "symbol" == _typeof(i) ? i : i + "";
48
- }
49
- function _toPrimitive(t, r) {
50
- if ("object" != _typeof(t) || !t) return t;
51
- var e = t[Symbol.toPrimitive];
52
- if (void 0 !== e) {
53
- var i = e.call(t, r || "default");
54
- if ("object" != _typeof(i)) return i;
55
- throw new TypeError("@@toPrimitive must return a primitive value.");
56
- }
57
- return ("string" === r ? String : Number)(t);
58
- }
59
- var Filesystem = /*#__PURE__*/_createClass(function Filesystem() {
60
- var _this = this;
61
- _classCallCheck(this, Filesystem);
62
- _defineProperty(this, "parse_path", function (path) {
63
- if (!path || path && !path.includes("/")) return path;
64
- return _this.read(path);
65
- });
66
- _defineProperty(this, "read", function (datapath) {
67
- if (!datapath) return null;
68
- var type_folder = _this.account.manager.oracle.get(datapath);
69
- if (!type_folder) return datapath;
70
- type_folder.obj = JSON.parse(type_folder.obj);
71
- var content;
72
- if (type_folder.type === "twain") {
73
- content = {};
74
- for (var prop in type_folder.obj) {
75
- var val = type_folder.obj[prop];
76
- content[_this.parse_path(prop)] = _this.parse_path(val);
77
- }
78
- } else if (type_folder.type === "array") {
79
- content = [];
80
- type_folder.obj.map(function (t) {
81
- content.push(type_folder.parse_path(t));
82
- });
83
- } else content = type_folder.obj;
84
- return content;
85
- });
86
- _defineProperty(this, "save", function (content, chain, just_obj) {
87
- var addr, obj;
88
- var type = _this.get_type(chain);
89
- if (type === "array" || type === "string") {
90
- obj = [];
91
- for (var curs in content) {
92
- obj.splice(Number(curs) || -1, 0, content[curs]);
93
- }
94
- if (type === "string") obj = obj.join(" ");
95
- } else if (type === "twain") {
96
- obj = {};
97
- for (var _curs in content) {
98
- obj[_curs] = content[_curs];
99
- }
100
- } else if (type === "number") {
101
- obj = Number(content["-1"]) || -1;
102
- } else {
103
- content = content["-1"];
104
- if (content === "True") obj = true;else if (content === "False") obj = false;else obj = null;
105
- }
106
- if (just_obj) return obj;
107
- obj = JSON.stringify(obj);
108
- addr = "".concat(chain.path, "/").concat((0, _hash.hash)(obj));
109
- _fs["default"].writeFileSync(addr, obj, {
110
- encoding: "utf-8"
111
- });
112
- _this.manager.oracle.set(addr, {
113
- obj: obj,
114
- type: type
115
- });
116
- return addr;
117
- });
118
- _defineProperty(this, "data_addr", function (type) {
119
- return "".concat(_this.physical_address, "/Datatypes/").concat(type);
120
- });
121
- _defineProperty(this, "get_type", function (chain) {
122
- switch (chain.physical_address) {
123
- case _this.data_addr("Number"):
124
- return "number";
125
- case _this.data_addr("String"):
126
- return "string";
127
- case _this.data_addr("Twain"):
128
- return "twain";
129
- case _this.data_addr("Array"):
130
- return "array";
131
- case _this.data_addr("Boolean"):
132
- return "boolean";
133
- case _this.data_addr("Void"):
134
- return "void";
135
- }
136
- });
137
- _defineProperty(this, "write", function (arg, context) {
138
- var content = context.get_buffer();
139
- if (!content || !arg) return;
140
- content[context.cursor] = arg;
141
- // console.log(`Writing: ${arg}`);
142
- });
143
- _defineProperty(this, "name_hash", function () {
144
- _this.hash = (0, _hash.hash)(_this.name);
145
- });
146
- _defineProperty(this, "set_paths", function (chain) {
147
- if (chain.parent && chain.parent.manager) {
148
- chain.path = chain.parent.path;
149
- return;
150
- }
151
- chain.path = "".concat(chain.parent ? chain.parent.path : _this.base_address, "/").concat(chain.hash);
152
- if (!_fs["default"].existsSync(chain.path)) {
153
- _fs["default"].mkdirSync(chain.path, {
154
- recursive: true
155
- });
156
- }
157
- });
158
- _defineProperty(this, "add_chain", function (name, parent) {
159
- var chain = _this.manager.web.get("".concat(parent.physical_address, "/").concat(name));
160
- if (!chain) chain = _this.manager.web.set(parent, name);
161
- return chain;
162
- });
163
- _defineProperty(this, "account_chain", function (account) {
164
- var chain = _this.manager.web.get(account.physical_address);
165
- if (!chain) {
166
- chain = _this.manager.web.set(account);
167
- }
168
- return chain;
169
- });
170
- this.base_address = process.env.BASE_ADDRESS || "Accounts";
171
- });
172
- var _default = Filesystem;
173
- exports["default"] = _default;
package/build/Frame.js DELETED
@@ -1,108 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
- var _functions = require("../utils/functions");
8
- function _typeof(o) {
9
- "@babel/helpers - typeof";
10
-
11
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
12
- return typeof o;
13
- } : function (o) {
14
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
15
- }, _typeof(o);
16
- }
17
- function _toConsumableArray(r) {
18
- return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
19
- }
20
- function _nonIterableSpread() {
21
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
22
- }
23
- function _unsupportedIterableToArray(r, a) {
24
- if (r) {
25
- if ("string" == typeof r) return _arrayLikeToArray(r, a);
26
- var t = {}.toString.call(r).slice(8, -1);
27
- return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
28
- }
29
- }
30
- function _iterableToArray(r) {
31
- if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
32
- }
33
- function _arrayWithoutHoles(r) {
34
- if (Array.isArray(r)) return _arrayLikeToArray(r);
35
- }
36
- function _arrayLikeToArray(r, a) {
37
- (null == a || a > r.length) && (a = r.length);
38
- for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
39
- return n;
40
- }
41
- function _defineProperties(e, r) {
42
- for (var t = 0; t < r.length; t++) {
43
- var o = r[t];
44
- o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
45
- }
46
- }
47
- function _createClass(e, r, t) {
48
- return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
49
- writable: !1
50
- }), e;
51
- }
52
- function _classCallCheck(a, n) {
53
- if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
54
- }
55
- function _defineProperty(e, r, t) {
56
- return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
57
- value: t,
58
- enumerable: !0,
59
- configurable: !0,
60
- writable: !0
61
- }) : e[r] = t, e;
62
- }
63
- function _toPropertyKey(t) {
64
- var i = _toPrimitive(t, "string");
65
- return "symbol" == _typeof(i) ? i : i + "";
66
- }
67
- function _toPrimitive(t, r) {
68
- if ("object" != _typeof(t) || !t) return t;
69
- var e = t[Symbol.toPrimitive];
70
- if (void 0 !== e) {
71
- var i = e.call(t, r || "default");
72
- if ("object" != _typeof(i)) return i;
73
- throw new TypeError("@@toPrimitive must return a primitive value.");
74
- }
75
- return ("string" === r ? String : Number)(t);
76
- }
77
- var Frame = /*#__PURE__*/_createClass(function Frame(_object, parent) {
78
- var _this = this;
79
- _classCallCheck(this, Frame);
80
- _defineProperty(this, "frame", function (object) {
81
- var frame = new Frame(object, _this);
82
- _this.instructions.push(frame);
83
- _this.children.push(frame);
84
- return frame;
85
- });
86
- _defineProperty(this, "to_instruction", function () {
87
- for (var prop in _this.object) {
88
- var val = _this.object[prop];
89
- _this.instructions.push("chain ".concat(prop));
90
- val && _this.frame(val).to_instruction();
91
- _this.instructions.push("pop ".concat(prop));
92
- }
93
- });
94
- _defineProperty(this, "flatten_instructions", function () {
95
- var inss = new Array();
96
- for (var i = 0; i < _this.instructions.length; i++) {
97
- var ins = _this.instructions[i];
98
- if (ins instanceof Frame) inss.push.apply(inss, _toConsumableArray(ins.flatten_instructions()));else inss.push(ins);
99
- }
100
- return inss;
101
- });
102
- this.parent = parent;
103
- this.object = Array.isArray(_object) ? (0, _functions.array_to_nested_objects)(_object) : _object;
104
- this.children = new Array();
105
- this.instructions = new Array();
106
- });
107
- var _default = Frame;
108
- exports["default"] = _default;