wao 0.5.6 → 0.6.1
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.
- package/cjs/ao.js +240 -124
- package/cjs/aoconnect.js +159 -142
- package/cjs/ar.js +14 -6
- package/cjs/armem.js +2 -1
- package/cjs/gql.js +27 -15
- package/cjs/helpers.js +214 -87
- package/cjs/kv.js +335 -0
- package/cjs/lua/process.wasm +0 -0
- package/cjs/run.js +3 -1
- package/cjs/server.js +80 -153
- package/cjs/tao.js +13 -11
- package/cjs/tar.js +347 -206
- package/cjs/test.js +6 -0
- package/cjs/tgql.js +23 -8
- package/cjs/utils.js +157 -1
- package/cjs/weavedrive.js +248 -574
- package/esm/ao.js +55 -14
- package/esm/aoconnect.js +30 -18
- package/esm/ar.js +9 -3
- package/esm/armem.js +1 -0
- package/esm/gql.js +15 -6
- package/esm/helpers.js +47 -7
- package/esm/kv.js +226 -0
- package/esm/lua/process.wasm +0 -0
- package/esm/run.js +1 -1
- package/esm/server.js +30 -187
- package/esm/tao.js +7 -5
- package/esm/tar.js +125 -85
- package/esm/test.js +2 -1
- package/esm/tgql.js +12 -4
- package/esm/utils.js +241 -0
- package/esm/weavedrive.js +72 -292
- package/package.json +1 -1
package/cjs/gql.js
CHANGED
|
@@ -20,7 +20,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
20
20
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
21
21
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); 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; } }
|
|
22
22
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
23
|
-
var full = "id anchor signature recipient owner { address key } fee { winston ar } quantity { winston ar } data { size type } tags { name value } block { id timestamp height previous } parent { id }";
|
|
23
|
+
var full = "id anchor signature recipient owner { address key } fee { winston ar } quantity { winston ar } data { size type } tags { name value } block { id timestamp height previous } parent { id } bundledIn { id }";
|
|
24
24
|
var full_blocks = "id timestamp height previous";
|
|
25
25
|
var subs = {
|
|
26
26
|
owner: ["address", "key"],
|
|
@@ -29,7 +29,8 @@ var subs = {
|
|
|
29
29
|
data: ["size", "type"],
|
|
30
30
|
tags: ["name", "value"],
|
|
31
31
|
block: ["id", "timestamp", "height", "previous"],
|
|
32
|
-
parent: ["id"]
|
|
32
|
+
parent: ["id"],
|
|
33
|
+
bundledIn: ["id"]
|
|
33
34
|
};
|
|
34
35
|
var field = function field(key) {
|
|
35
36
|
var val = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
@@ -140,7 +141,11 @@ var query = function query() {
|
|
|
140
141
|
}
|
|
141
142
|
if (opt.first) cond.push("first: ".concat(opt.first));
|
|
142
143
|
if (opt.after) cond.push("after: \"".concat(opt.after, "\""));
|
|
143
|
-
if (opt.asc)
|
|
144
|
+
if (opt.asc) {
|
|
145
|
+
cond.push("sort: HEIGHT_ASC");
|
|
146
|
+
} else {
|
|
147
|
+
cond.push("sort: HEIGHT_DESC");
|
|
148
|
+
}
|
|
144
149
|
var _cond = "";
|
|
145
150
|
if (cond.length > 0) _cond = "(".concat(cond.join(", "), ")");
|
|
146
151
|
var fields = [];
|
|
@@ -172,7 +177,7 @@ var query = function query() {
|
|
|
172
177
|
}
|
|
173
178
|
}
|
|
174
179
|
var _fields = fields.length > 0 ? fields.join(" ") : full;
|
|
175
|
-
return "query {\n transactions ".concat(_cond, "{\n edges { cursor node { ").concat(_fields, " } }\n }\n}");
|
|
180
|
+
return "query {\n transactions ".concat(_cond, "{\n pageInfo { hasNextPage }\n edges { cursor node { ").concat(_fields, " } }\n }\n}");
|
|
176
181
|
};
|
|
177
182
|
var query_blocks = function query_blocks() {
|
|
178
183
|
var _height2, _height3;
|
|
@@ -230,7 +235,7 @@ var query_blocks = function query_blocks() {
|
|
|
230
235
|
}
|
|
231
236
|
}
|
|
232
237
|
var _fields = fields.length > 0 ? fields.join(" ") : full_blocks;
|
|
233
|
-
return "query {\n blocks ".concat(_cond, "{\n edges { cursor node { ").concat(_fields, " } }\n }\n}");
|
|
238
|
+
return "query {\n blocks ".concat(_cond, "{\n pageInfo { hasNextPage }\n edges { cursor node { ").concat(_fields, " } }\n }\n}");
|
|
234
239
|
};
|
|
235
240
|
var GQL = exports["default"] = /*#__PURE__*/function () {
|
|
236
241
|
function GQL() {
|
|
@@ -262,11 +267,14 @@ var GQL = exports["default"] = /*#__PURE__*/function () {
|
|
|
262
267
|
});
|
|
263
268
|
case 2:
|
|
264
269
|
json = _context.sent;
|
|
265
|
-
return _context.abrupt("return",
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
+
return _context.abrupt("return", {
|
|
271
|
+
isNext: json.data[tar].pageInfo.hasNextPage,
|
|
272
|
+
data: (0, _ramda.map)(function (v) {
|
|
273
|
+
return _objectSpread({
|
|
274
|
+
cursor: v.cursor
|
|
275
|
+
}, v.node);
|
|
276
|
+
})(json.data[tar].edges)
|
|
277
|
+
});
|
|
270
278
|
case 4:
|
|
271
279
|
case "end":
|
|
272
280
|
return _context.stop();
|
|
@@ -286,6 +294,8 @@ var GQL = exports["default"] = /*#__PURE__*/function () {
|
|
|
286
294
|
var opt,
|
|
287
295
|
query,
|
|
288
296
|
tar,
|
|
297
|
+
_yield$this$_fetch,
|
|
298
|
+
isNext,
|
|
289
299
|
data,
|
|
290
300
|
cursor,
|
|
291
301
|
next,
|
|
@@ -299,13 +309,15 @@ var GQL = exports["default"] = /*#__PURE__*/function () {
|
|
|
299
309
|
_context3.next = 5;
|
|
300
310
|
return this._fetch(query, tar);
|
|
301
311
|
case 5:
|
|
302
|
-
|
|
312
|
+
_yield$this$_fetch = _context3.sent;
|
|
313
|
+
isNext = _yield$this$_fetch.isNext;
|
|
314
|
+
data = _yield$this$_fetch.data;
|
|
303
315
|
if (!(opt.next === true)) {
|
|
304
|
-
_context3.next =
|
|
316
|
+
_context3.next = 15;
|
|
305
317
|
break;
|
|
306
318
|
}
|
|
307
319
|
cursor = null;
|
|
308
|
-
if (data.length > 0) cursor = (0, _ramda.last)(data).cursor;
|
|
320
|
+
if (isNext && data.length > 0) cursor = (0, _ramda.last)(data).cursor;
|
|
309
321
|
next = !cursor ? null : /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
310
322
|
var _opt;
|
|
311
323
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
@@ -327,9 +339,9 @@ var GQL = exports["default"] = /*#__PURE__*/function () {
|
|
|
327
339
|
data: data,
|
|
328
340
|
next: next
|
|
329
341
|
});
|
|
330
|
-
case
|
|
342
|
+
case 15:
|
|
331
343
|
return _context3.abrupt("return", data);
|
|
332
|
-
case
|
|
344
|
+
case 16:
|
|
333
345
|
case "end":
|
|
334
346
|
return _context3.stop();
|
|
335
347
|
}
|
package/cjs/helpers.js
CHANGED
|
@@ -4,12 +4,13 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.setup = exports.ok = exports.fail = exports.Src = void 0;
|
|
7
|
+
exports.setup = exports.ok = exports.fail = exports.Testnet = exports.Src = void 0;
|
|
8
8
|
var _index = require("./index.js");
|
|
9
9
|
var _assert = _interopRequireDefault(require("assert"));
|
|
10
10
|
var _aoconnect3 = require("@permaweb/aoconnect");
|
|
11
11
|
var _path = require("path");
|
|
12
12
|
var _fs = require("fs");
|
|
13
|
+
var _utils = require("./utils.js");
|
|
13
14
|
var _yargs = _interopRequireDefault(require("yargs"));
|
|
14
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
15
16
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -77,6 +78,45 @@ var Src = exports.Src = /*#__PURE__*/function () {
|
|
|
77
78
|
});
|
|
78
79
|
}
|
|
79
80
|
return _createClass(Src, [{
|
|
81
|
+
key: "init",
|
|
82
|
+
value: function () {
|
|
83
|
+
var _init = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(dir) {
|
|
84
|
+
var _dir;
|
|
85
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
86
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
87
|
+
case 0:
|
|
88
|
+
if (this.dir) {
|
|
89
|
+
_context2.next = 9;
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
if (!((_dir = dir) !== null && _dir !== void 0)) {
|
|
93
|
+
_context2.next = 5;
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
_dir;
|
|
97
|
+
_context2.next = 8;
|
|
98
|
+
break;
|
|
99
|
+
case 5:
|
|
100
|
+
_context2.next = 7;
|
|
101
|
+
return dirname();
|
|
102
|
+
case 7:
|
|
103
|
+
dir = _context2.sent;
|
|
104
|
+
case 8:
|
|
105
|
+
this.dir = (0, _path.resolve)(dir, "lua");
|
|
106
|
+
case 9:
|
|
107
|
+
return _context2.abrupt("return", this);
|
|
108
|
+
case 10:
|
|
109
|
+
case "end":
|
|
110
|
+
return _context2.stop();
|
|
111
|
+
}
|
|
112
|
+
}, _callee2, this);
|
|
113
|
+
}));
|
|
114
|
+
function init(_x) {
|
|
115
|
+
return _init.apply(this, arguments);
|
|
116
|
+
}
|
|
117
|
+
return init;
|
|
118
|
+
}()
|
|
119
|
+
}, {
|
|
80
120
|
key: "data",
|
|
81
121
|
value: function data(file) {
|
|
82
122
|
var ext = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "lua";
|
|
@@ -85,43 +125,136 @@ var Src = exports.Src = /*#__PURE__*/function () {
|
|
|
85
125
|
}, {
|
|
86
126
|
key: "upload",
|
|
87
127
|
value: function () {
|
|
88
|
-
var _upload = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
128
|
+
var _upload = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(file) {
|
|
89
129
|
var ext,
|
|
90
130
|
res,
|
|
91
|
-
|
|
92
|
-
return _regeneratorRuntime().wrap(function
|
|
93
|
-
while (1) switch (
|
|
131
|
+
_args3 = arguments;
|
|
132
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
133
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
94
134
|
case 0:
|
|
95
|
-
ext =
|
|
96
|
-
|
|
135
|
+
ext = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : "lua";
|
|
136
|
+
_context3.next = 3;
|
|
97
137
|
return this.ar.post({
|
|
98
138
|
data: this.data(file, ext)
|
|
99
139
|
});
|
|
100
140
|
case 3:
|
|
101
|
-
res =
|
|
102
|
-
return
|
|
141
|
+
res = _context3.sent;
|
|
142
|
+
return _context3.abrupt("return", res.err ? null : res.id);
|
|
103
143
|
case 5:
|
|
104
144
|
case "end":
|
|
105
|
-
return
|
|
145
|
+
return _context3.stop();
|
|
106
146
|
}
|
|
107
|
-
},
|
|
147
|
+
}, _callee3, this);
|
|
108
148
|
}));
|
|
109
|
-
function upload(
|
|
149
|
+
function upload(_x2) {
|
|
110
150
|
return _upload.apply(this, arguments);
|
|
111
151
|
}
|
|
112
152
|
return upload;
|
|
113
153
|
}()
|
|
114
154
|
}]);
|
|
115
155
|
}();
|
|
156
|
+
var Testnet = exports.Testnet = /*#__PURE__*/function () {
|
|
157
|
+
function Testnet() {
|
|
158
|
+
var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
159
|
+
_ref3$port = _ref3.port,
|
|
160
|
+
port = _ref3$port === void 0 ? 4000 : _ref3$port,
|
|
161
|
+
arweave = _ref3.arweave,
|
|
162
|
+
aoconnect = _ref3.aoconnect,
|
|
163
|
+
_ref3$docker = _ref3.docker,
|
|
164
|
+
docker = _ref3$docker === void 0 ? false : _ref3$docker;
|
|
165
|
+
_classCallCheck(this, Testnet);
|
|
166
|
+
this.docker = docker;
|
|
167
|
+
this.arweave = arweave !== null && arweave !== void 0 ? arweave : {
|
|
168
|
+
port: port
|
|
169
|
+
};
|
|
170
|
+
this.aoconnect = aoconnect !== null && aoconnect !== void 0 ? aoconnect : (0, _utils.optAO)(port);
|
|
171
|
+
this.ar = new _index.AR(this.arweave);
|
|
172
|
+
}
|
|
173
|
+
return _createClass(Testnet, [{
|
|
174
|
+
key: "init",
|
|
175
|
+
value: function () {
|
|
176
|
+
var _init2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(jwk) {
|
|
177
|
+
var _yield$this$ao$postMo, id, _yield$this$ao$postSc, scheduler;
|
|
178
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
179
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
180
|
+
case 0:
|
|
181
|
+
_context4.next = 2;
|
|
182
|
+
return fetch(this.aoconnect.SU_URL).then(function (r) {
|
|
183
|
+
return r.json();
|
|
184
|
+
});
|
|
185
|
+
case 2:
|
|
186
|
+
this.authority = _context4.sent.address;
|
|
187
|
+
_context4.next = 5;
|
|
188
|
+
return new Src({
|
|
189
|
+
ar: this.ar
|
|
190
|
+
}).init();
|
|
191
|
+
case 5:
|
|
192
|
+
this.src = _context4.sent;
|
|
193
|
+
_context4.next = 8;
|
|
194
|
+
return this.ar.init(jwk);
|
|
195
|
+
case 8:
|
|
196
|
+
this.jwk = this.ar.jwk;
|
|
197
|
+
this.addr = this.ar.addr;
|
|
198
|
+
this.gql = this.ar.gql;
|
|
199
|
+
_context4.next = 13;
|
|
200
|
+
return this.src.upload("aos2_0_1", "wasm");
|
|
201
|
+
case 13:
|
|
202
|
+
this.module_src = _context4.sent;
|
|
203
|
+
_context4.next = 16;
|
|
204
|
+
return new _index.AO({
|
|
205
|
+
ar: this.ar,
|
|
206
|
+
aoconnect: this.aoconnect,
|
|
207
|
+
authority: this.authority
|
|
208
|
+
}).init(this.ar.jwk);
|
|
209
|
+
case 16:
|
|
210
|
+
this.ao = _context4.sent;
|
|
211
|
+
_context4.t0 = this.ao;
|
|
212
|
+
_context4.next = 20;
|
|
213
|
+
return this.ar.data(this.module_src);
|
|
214
|
+
case 20:
|
|
215
|
+
_context4.t1 = _context4.sent;
|
|
216
|
+
_context4.t2 = {
|
|
217
|
+
data: _context4.t1,
|
|
218
|
+
overwrite: true
|
|
219
|
+
};
|
|
220
|
+
_context4.next = 24;
|
|
221
|
+
return _context4.t0.postModule.call(_context4.t0, _context4.t2);
|
|
222
|
+
case 24:
|
|
223
|
+
_yield$this$ao$postMo = _context4.sent;
|
|
224
|
+
id = _yield$this$ao$postMo.id;
|
|
225
|
+
this.module = id;
|
|
226
|
+
_context4.next = 29;
|
|
227
|
+
return this.ao.postScheduler({
|
|
228
|
+
url: this.docker ? "http://su" : this.aoconnect.SU_URL,
|
|
229
|
+
overwrite: true
|
|
230
|
+
});
|
|
231
|
+
case 29:
|
|
232
|
+
_yield$this$ao$postSc = _context4.sent;
|
|
233
|
+
scheduler = _yield$this$ao$postSc.scheduler;
|
|
234
|
+
this.scheduler = scheduler;
|
|
235
|
+
return _context4.abrupt("return", this);
|
|
236
|
+
case 33:
|
|
237
|
+
case "end":
|
|
238
|
+
return _context4.stop();
|
|
239
|
+
}
|
|
240
|
+
}, _callee4, this);
|
|
241
|
+
}));
|
|
242
|
+
function init(_x3) {
|
|
243
|
+
return _init2.apply(this, arguments);
|
|
244
|
+
}
|
|
245
|
+
return init;
|
|
246
|
+
}()
|
|
247
|
+
}]);
|
|
248
|
+
}();
|
|
116
249
|
var setup = exports.setup = /*#__PURE__*/function () {
|
|
117
|
-
var
|
|
250
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
118
251
|
var _arweave, _aoconnect, _aoconnect$CU_URL, _aoconnect2;
|
|
119
|
-
var
|
|
252
|
+
var _ref5,
|
|
120
253
|
aoconnect,
|
|
121
254
|
arweave,
|
|
122
|
-
|
|
255
|
+
_ref5$cacheDir,
|
|
123
256
|
cacheDir,
|
|
124
|
-
|
|
257
|
+
_ref5$targets,
|
|
125
258
|
targets,
|
|
126
259
|
opt,
|
|
127
260
|
dir,
|
|
@@ -146,32 +279,32 @@ var setup = exports.setup = /*#__PURE__*/function () {
|
|
|
146
279
|
_yield$ao$postSchedul,
|
|
147
280
|
scheduler,
|
|
148
281
|
ao2,
|
|
149
|
-
|
|
150
|
-
return _regeneratorRuntime().wrap(function
|
|
151
|
-
while (1) switch (
|
|
282
|
+
_args5 = arguments;
|
|
283
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
284
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
152
285
|
case 0:
|
|
153
|
-
|
|
286
|
+
_ref5 = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {}, aoconnect = _ref5.aoconnect, arweave = _ref5.arweave, _ref5$cacheDir = _ref5.cacheDir, cacheDir = _ref5$cacheDir === void 0 ? ".cache" : _ref5$cacheDir, _ref5$targets = _ref5.targets, targets = _ref5$targets === void 0 ? {
|
|
154
287
|
profile: false,
|
|
155
288
|
note: false,
|
|
156
289
|
asset: false
|
|
157
|
-
} :
|
|
290
|
+
} : _ref5$targets;
|
|
158
291
|
if (targets.asset || targets.note) targets.profile = true;
|
|
159
292
|
opt = null;
|
|
160
293
|
console.error = function () {};
|
|
161
294
|
console.warn = function () {};
|
|
162
|
-
|
|
163
|
-
|
|
295
|
+
_context5.t0 = _path.resolve;
|
|
296
|
+
_context5.next = 8;
|
|
164
297
|
return dirname();
|
|
165
298
|
case 8:
|
|
166
|
-
|
|
167
|
-
dir = (0,
|
|
168
|
-
|
|
169
|
-
|
|
299
|
+
_context5.t1 = _context5.sent;
|
|
300
|
+
dir = (0, _context5.t0)(_context5.t1, "lua");
|
|
301
|
+
_context5.t2 = _path.resolve;
|
|
302
|
+
_context5.next = 13;
|
|
170
303
|
return dirname();
|
|
171
304
|
case 13:
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
_cacheDir = (0,
|
|
305
|
+
_context5.t3 = _context5.sent;
|
|
306
|
+
_context5.t4 = cacheDir;
|
|
307
|
+
_cacheDir = (0, _context5.t2)(_context5.t3, _context5.t4);
|
|
175
308
|
optPath = "".concat(_cacheDir, "/opt.json");
|
|
176
309
|
if (cache && !reset) {
|
|
177
310
|
try {
|
|
@@ -185,29 +318,28 @@ var setup = exports.setup = /*#__PURE__*/function () {
|
|
|
185
318
|
}
|
|
186
319
|
}
|
|
187
320
|
if (!opt) {
|
|
188
|
-
|
|
321
|
+
_context5.next = 32;
|
|
189
322
|
break;
|
|
190
323
|
}
|
|
191
|
-
|
|
324
|
+
_context5.next = 21;
|
|
192
325
|
return new _index.AR(opt.ar).init(opt.jwk);
|
|
193
326
|
case 21:
|
|
194
|
-
_ar =
|
|
327
|
+
_ar = _context5.sent;
|
|
195
328
|
_src = new Src({
|
|
196
329
|
ar: _ar,
|
|
197
|
-
readFileSync: _fs.readFileSync,
|
|
198
330
|
dir: dir
|
|
199
331
|
});
|
|
200
|
-
|
|
332
|
+
_context5.next = 25;
|
|
201
333
|
return new _index.AO(opt.ao).init(opt.jwk);
|
|
202
334
|
case 25:
|
|
203
|
-
_ao =
|
|
204
|
-
|
|
335
|
+
_ao = _context5.sent;
|
|
336
|
+
_context5.next = 28;
|
|
205
337
|
return new _index.AO(opt.ao2).init(opt.jwk);
|
|
206
338
|
case 28:
|
|
207
|
-
_ao2 =
|
|
339
|
+
_ao2 = _context5.sent;
|
|
208
340
|
console.log("cache:\t", optPath);
|
|
209
341
|
console.log("addr:\t", _ar.addr);
|
|
210
|
-
return
|
|
342
|
+
return _context5.abrupt("return", {
|
|
211
343
|
opt: opt,
|
|
212
344
|
ar: _ar,
|
|
213
345
|
ao2: _ao2,
|
|
@@ -219,18 +351,13 @@ var setup = exports.setup = /*#__PURE__*/function () {
|
|
|
219
351
|
(_arweave = arweave) !== null && _arweave !== void 0 ? _arweave : arweave = {
|
|
220
352
|
port: 4000
|
|
221
353
|
};
|
|
222
|
-
(_aoconnect = aoconnect) !== null && _aoconnect !== void 0 ? _aoconnect : aoconnect =
|
|
223
|
-
MU_URL: "http://localhost:4002",
|
|
224
|
-
CU_URL: "http://localhost:4004",
|
|
225
|
-
GATEWAY_URL: "http://localhost:4000"
|
|
226
|
-
};
|
|
354
|
+
(_aoconnect = aoconnect) !== null && _aoconnect !== void 0 ? _aoconnect : aoconnect = (0, _utils.optAO)(4000);
|
|
227
355
|
ar = new _index.AR(arweave);
|
|
228
|
-
|
|
356
|
+
_context5.next = 37;
|
|
229
357
|
return ar.gen("10");
|
|
230
358
|
case 37:
|
|
231
359
|
src = new Src({
|
|
232
360
|
ar: ar,
|
|
233
|
-
readFileSync: _fs.readFileSync,
|
|
234
361
|
dir: dir
|
|
235
362
|
});
|
|
236
363
|
opt = {
|
|
@@ -238,81 +365,81 @@ var setup = exports.setup = /*#__PURE__*/function () {
|
|
|
238
365
|
jwk: ar.jwk
|
|
239
366
|
};
|
|
240
367
|
if (!(!auth && /localhost/.test((_aoconnect$CU_URL = (_aoconnect2 = aoconnect) === null || _aoconnect2 === void 0 ? void 0 : _aoconnect2.CU_URL) !== null && _aoconnect$CU_URL !== void 0 ? _aoconnect$CU_URL : ""))) {
|
|
241
|
-
|
|
368
|
+
_context5.next = 43;
|
|
242
369
|
break;
|
|
243
370
|
}
|
|
244
|
-
|
|
371
|
+
_context5.next = 42;
|
|
245
372
|
return fetch(aoconnect.CU_URL).then(function (r) {
|
|
246
373
|
return r.json();
|
|
247
374
|
});
|
|
248
375
|
case 42:
|
|
249
|
-
auth =
|
|
376
|
+
auth = _context5.sent.address;
|
|
250
377
|
case 43:
|
|
251
|
-
|
|
378
|
+
_context5.next = 45;
|
|
252
379
|
return src.upload("sqlite", "wasm");
|
|
253
380
|
case 45:
|
|
254
|
-
wasm =
|
|
255
|
-
|
|
381
|
+
wasm = _context5.sent;
|
|
382
|
+
_context5.next = 48;
|
|
256
383
|
return src.upload("aos", "wasm");
|
|
257
384
|
case 48:
|
|
258
|
-
wasm2 =
|
|
259
|
-
|
|
385
|
+
wasm2 = _context5.sent;
|
|
386
|
+
_context5.next = 51;
|
|
260
387
|
return src.upload("aos2_0_1", "wasm");
|
|
261
388
|
case 51:
|
|
262
|
-
wasm_aos2 =
|
|
389
|
+
wasm_aos2 = _context5.sent;
|
|
263
390
|
ao = new _index.AO({
|
|
264
391
|
aoconnect: aoconnect,
|
|
265
392
|
ar: ar,
|
|
266
393
|
authority: auth
|
|
267
394
|
});
|
|
268
|
-
|
|
269
|
-
|
|
395
|
+
_context5.t5 = ao;
|
|
396
|
+
_context5.next = 56;
|
|
270
397
|
return ar.data(wasm_aos2);
|
|
271
398
|
case 56:
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
data:
|
|
399
|
+
_context5.t6 = _context5.sent;
|
|
400
|
+
_context5.t7 = {
|
|
401
|
+
data: _context5.t6
|
|
275
402
|
};
|
|
276
|
-
|
|
277
|
-
return
|
|
403
|
+
_context5.next = 60;
|
|
404
|
+
return _context5.t5.postModule.call(_context5.t5, _context5.t7);
|
|
278
405
|
case 60:
|
|
279
|
-
_yield$ao$postModule =
|
|
406
|
+
_yield$ao$postModule = _context5.sent;
|
|
280
407
|
module_aos2 = _yield$ao$postModule.id;
|
|
281
|
-
|
|
282
|
-
|
|
408
|
+
_context5.t8 = ao;
|
|
409
|
+
_context5.next = 65;
|
|
283
410
|
return ar.data(wasm);
|
|
284
411
|
case 65:
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
data:
|
|
412
|
+
_context5.t9 = _context5.sent;
|
|
413
|
+
_context5.t10 = {
|
|
414
|
+
data: _context5.t9,
|
|
288
415
|
overwrite: true
|
|
289
416
|
};
|
|
290
|
-
|
|
291
|
-
return
|
|
417
|
+
_context5.next = 69;
|
|
418
|
+
return _context5.t8.postModule.call(_context5.t8, _context5.t10);
|
|
292
419
|
case 69:
|
|
293
|
-
_yield$ao$postModule2 =
|
|
420
|
+
_yield$ao$postModule2 = _context5.sent;
|
|
294
421
|
module_sqlite = _yield$ao$postModule2.id;
|
|
295
|
-
|
|
296
|
-
|
|
422
|
+
_context5.t11 = ao;
|
|
423
|
+
_context5.next = 74;
|
|
297
424
|
return ar.data(wasm2);
|
|
298
425
|
case 74:
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
data:
|
|
426
|
+
_context5.t12 = _context5.sent;
|
|
427
|
+
_context5.t13 = {
|
|
428
|
+
data: _context5.t12,
|
|
302
429
|
overwrite: true
|
|
303
430
|
};
|
|
304
|
-
|
|
305
|
-
return
|
|
431
|
+
_context5.next = 78;
|
|
432
|
+
return _context5.t11.postModule.call(_context5.t11, _context5.t13);
|
|
306
433
|
case 78:
|
|
307
|
-
_yield$ao$postModule3 =
|
|
434
|
+
_yield$ao$postModule3 = _context5.sent;
|
|
308
435
|
module = _yield$ao$postModule3.id;
|
|
309
|
-
|
|
436
|
+
_context5.next = 82;
|
|
310
437
|
return ao.postScheduler({
|
|
311
438
|
url: "http://su",
|
|
312
439
|
overwrite: true
|
|
313
440
|
});
|
|
314
441
|
case 82:
|
|
315
|
-
_yield$ao$postSchedul =
|
|
442
|
+
_yield$ao$postSchedul = _context5.sent;
|
|
316
443
|
scheduler = _yield$ao$postSchedul.scheduler;
|
|
317
444
|
opt.ao = {
|
|
318
445
|
module: module_sqlite,
|
|
@@ -323,7 +450,7 @@ var setup = exports.setup = /*#__PURE__*/function () {
|
|
|
323
450
|
};
|
|
324
451
|
|
|
325
452
|
// ao2
|
|
326
|
-
|
|
453
|
+
_context5.next = 87;
|
|
327
454
|
return new _index.AO({
|
|
328
455
|
aoconnect: aoconnect,
|
|
329
456
|
ar: ar,
|
|
@@ -332,7 +459,7 @@ var setup = exports.setup = /*#__PURE__*/function () {
|
|
|
332
459
|
scheduler: scheduler
|
|
333
460
|
}).init(ar.jwk);
|
|
334
461
|
case 87:
|
|
335
|
-
ao2 =
|
|
462
|
+
ao2 = _context5.sent;
|
|
336
463
|
opt.ao2 = {
|
|
337
464
|
module: module_aos2,
|
|
338
465
|
scheduler: scheduler,
|
|
@@ -352,7 +479,7 @@ var setup = exports.setup = /*#__PURE__*/function () {
|
|
|
352
479
|
if (!(0, _fs.existsSync)(_cacheDir)) (0, _fs.mkdirSync)(_cacheDir);
|
|
353
480
|
(0, _fs.writeFileSync)(optPath, JSON.stringify(opt));
|
|
354
481
|
}
|
|
355
|
-
return
|
|
482
|
+
return _context5.abrupt("return", {
|
|
356
483
|
opt: opt,
|
|
357
484
|
ao: ao,
|
|
358
485
|
ar: ar,
|
|
@@ -361,12 +488,12 @@ var setup = exports.setup = /*#__PURE__*/function () {
|
|
|
361
488
|
});
|
|
362
489
|
case 95:
|
|
363
490
|
case "end":
|
|
364
|
-
return
|
|
491
|
+
return _context5.stop();
|
|
365
492
|
}
|
|
366
|
-
},
|
|
493
|
+
}, _callee5);
|
|
367
494
|
}));
|
|
368
495
|
return function setup() {
|
|
369
|
-
return
|
|
496
|
+
return _ref4.apply(this, arguments);
|
|
370
497
|
};
|
|
371
498
|
}();
|
|
372
499
|
var ok = exports.ok = function ok(obj) {
|