wao 0.8.2 → 0.8.4
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 +15 -7
- package/cjs/aoconnect.js +496 -416
- package/cjs/cli.js +0 -0
- package/cjs/server.js +2 -1
- package/cjs/tao.js +0 -1
- package/cjs/tar.js +1 -1
- package/cjs/utils.js +4 -1
- package/esm/ao.js +11 -4
- package/esm/aoconnect.js +7 -18
- package/esm/cli.js +0 -0
- package/esm/server.js +1 -1
- package/esm/tao.js +1 -2
- package/esm/tar.js +1 -1
- package/esm/utils.js +3 -0
- package/package.json +1 -1
- package/.cache/data.mdb +0 -0
- package/.cache/lock.mdb +0 -0
package/cjs/aoconnect.js
CHANGED
|
@@ -136,49 +136,122 @@ var connect = exports.connect = function connect(mem) {
|
|
|
136
136
|
return _ref4.apply(this, arguments);
|
|
137
137
|
};
|
|
138
138
|
}();
|
|
139
|
-
var genEnv = function
|
|
140
|
-
var
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
139
|
+
var genEnv = /*#__PURE__*/function () {
|
|
140
|
+
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref5) {
|
|
141
|
+
var _yield$mem$get$tags, _yield$mem$get, _yield$mem$get$tags2, _yield$mem$get2;
|
|
142
|
+
var pid, _ref5$owner, owner, _ref5$module, module;
|
|
143
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
144
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
145
|
+
case 0:
|
|
146
|
+
pid = _ref5.pid, _ref5$owner = _ref5.owner, owner = _ref5$owner === void 0 ? "" : _ref5$owner, _ref5$module = _ref5.module, module = _ref5$module === void 0 ? "" : _ref5$module;
|
|
147
|
+
_context2.t0 = pid;
|
|
148
|
+
_context2.next = 4;
|
|
149
|
+
return mem.get("txs", pid);
|
|
150
|
+
case 4:
|
|
151
|
+
_context2.t3 = _yield$mem$get = _context2.sent;
|
|
152
|
+
_context2.t2 = _context2.t3 === null;
|
|
153
|
+
if (_context2.t2) {
|
|
154
|
+
_context2.next = 8;
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
_context2.t2 = _yield$mem$get === void 0;
|
|
158
|
+
case 8:
|
|
159
|
+
if (!_context2.t2) {
|
|
160
|
+
_context2.next = 12;
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
|
+
_context2.t4 = void 0;
|
|
164
|
+
_context2.next = 13;
|
|
165
|
+
break;
|
|
166
|
+
case 12:
|
|
167
|
+
_context2.t4 = _yield$mem$get.tags;
|
|
168
|
+
case 13:
|
|
169
|
+
_context2.t5 = _yield$mem$get$tags = _context2.t4;
|
|
170
|
+
_context2.t1 = _context2.t5 !== null;
|
|
171
|
+
if (!_context2.t1) {
|
|
172
|
+
_context2.next = 17;
|
|
173
|
+
break;
|
|
174
|
+
}
|
|
175
|
+
_context2.t1 = _yield$mem$get$tags !== void 0;
|
|
176
|
+
case 17:
|
|
177
|
+
if (!_context2.t1) {
|
|
178
|
+
_context2.next = 21;
|
|
179
|
+
break;
|
|
180
|
+
}
|
|
181
|
+
_context2.t6 = _yield$mem$get$tags;
|
|
182
|
+
_context2.next = 22;
|
|
183
|
+
break;
|
|
184
|
+
case 21:
|
|
185
|
+
_context2.t6 = [];
|
|
186
|
+
case 22:
|
|
187
|
+
_context2.t7 = _context2.t6;
|
|
188
|
+
_context2.t8 = owner;
|
|
189
|
+
_context2.t9 = {
|
|
190
|
+
Id: _context2.t0,
|
|
191
|
+
Tags: _context2.t7,
|
|
192
|
+
Owner: _context2.t8
|
|
193
|
+
};
|
|
194
|
+
_context2.t10 = module;
|
|
195
|
+
_context2.next = 28;
|
|
196
|
+
return mem.get("txs", module);
|
|
197
|
+
case 28:
|
|
198
|
+
_context2.t13 = _yield$mem$get2 = _context2.sent;
|
|
199
|
+
_context2.t12 = _context2.t13 === null;
|
|
200
|
+
if (_context2.t12) {
|
|
201
|
+
_context2.next = 32;
|
|
202
|
+
break;
|
|
203
|
+
}
|
|
204
|
+
_context2.t12 = _yield$mem$get2 === void 0;
|
|
205
|
+
case 32:
|
|
206
|
+
if (!_context2.t12) {
|
|
207
|
+
_context2.next = 36;
|
|
208
|
+
break;
|
|
209
|
+
}
|
|
210
|
+
_context2.t14 = void 0;
|
|
211
|
+
_context2.next = 37;
|
|
212
|
+
break;
|
|
213
|
+
case 36:
|
|
214
|
+
_context2.t14 = _yield$mem$get2.tags;
|
|
215
|
+
case 37:
|
|
216
|
+
_context2.t15 = _yield$mem$get$tags2 = _context2.t14;
|
|
217
|
+
_context2.t11 = _context2.t15 !== null;
|
|
218
|
+
if (!_context2.t11) {
|
|
219
|
+
_context2.next = 41;
|
|
220
|
+
break;
|
|
221
|
+
}
|
|
222
|
+
_context2.t11 = _yield$mem$get$tags2 !== void 0;
|
|
223
|
+
case 41:
|
|
224
|
+
if (!_context2.t11) {
|
|
225
|
+
_context2.next = 45;
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
228
|
+
_context2.t16 = _yield$mem$get$tags2;
|
|
229
|
+
_context2.next = 46;
|
|
230
|
+
break;
|
|
231
|
+
case 45:
|
|
232
|
+
_context2.t16 = [];
|
|
233
|
+
case 46:
|
|
234
|
+
_context2.t17 = _context2.t16;
|
|
235
|
+
_context2.t18 = {
|
|
236
|
+
Id: _context2.t10,
|
|
237
|
+
Tags: _context2.t17
|
|
238
|
+
};
|
|
239
|
+
return _context2.abrupt("return", {
|
|
240
|
+
Process: _context2.t9,
|
|
241
|
+
Module: _context2.t18
|
|
242
|
+
});
|
|
243
|
+
case 49:
|
|
244
|
+
case "end":
|
|
245
|
+
return _context2.stop();
|
|
246
|
+
}
|
|
247
|
+
}, _callee2);
|
|
248
|
+
}));
|
|
249
|
+
return function genEnv(_x7) {
|
|
250
|
+
return _ref6.apply(this, arguments);
|
|
178
251
|
};
|
|
179
|
-
};
|
|
252
|
+
}();
|
|
180
253
|
var spawn = /*#__PURE__*/function () {
|
|
181
|
-
var
|
|
254
|
+
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
182
255
|
var _opt$tags, _opt$memory;
|
|
183
256
|
var opt,
|
|
184
257
|
_yield$mem$getWasm,
|
|
@@ -206,7 +279,7 @@ var connect = exports.connect = function connect(mem) {
|
|
|
206
279
|
p,
|
|
207
280
|
_opt$data,
|
|
208
281
|
_yield$mem$get$data,
|
|
209
|
-
_yield$mem$
|
|
282
|
+
_yield$mem$get3,
|
|
210
283
|
data,
|
|
211
284
|
msg,
|
|
212
285
|
_env,
|
|
@@ -217,27 +290,27 @@ var connect = exports.connect = function connect(mem) {
|
|
|
217
290
|
_int,
|
|
218
291
|
cronTags,
|
|
219
292
|
_k,
|
|
220
|
-
|
|
221
|
-
return _regeneratorRuntime().wrap(function
|
|
222
|
-
while (1) switch (
|
|
293
|
+
_args3 = arguments;
|
|
294
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
295
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
223
296
|
case 0:
|
|
224
|
-
opt =
|
|
297
|
+
opt = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {};
|
|
225
298
|
if (opt.module) {
|
|
226
|
-
|
|
299
|
+
_context3.next = 3;
|
|
227
300
|
break;
|
|
228
301
|
}
|
|
229
302
|
throw Error("module missing");
|
|
230
303
|
case 3:
|
|
231
304
|
if (opt.scheduler) {
|
|
232
|
-
|
|
305
|
+
_context3.next = 5;
|
|
233
306
|
break;
|
|
234
307
|
}
|
|
235
308
|
throw Error("scheduler missing");
|
|
236
309
|
case 5:
|
|
237
|
-
|
|
310
|
+
_context3.next = 7;
|
|
238
311
|
return mem.getWasm(opt.module, mem);
|
|
239
312
|
case 7:
|
|
240
|
-
_yield$mem$getWasm =
|
|
313
|
+
_yield$mem$getWasm = _context3.sent;
|
|
241
314
|
mod = _yield$mem$getWasm.mod;
|
|
242
315
|
wasm = _yield$mem$getWasm.wasm;
|
|
243
316
|
format = _yield$mem$getWasm.format;
|
|
@@ -248,7 +321,8 @@ var connect = exports.connect = function connect(mem) {
|
|
|
248
321
|
SDK: "aoconnect",
|
|
249
322
|
Module: mod,
|
|
250
323
|
Scheduler: opt.scheduler,
|
|
251
|
-
"Content-Type": "text/plain"
|
|
324
|
+
"Content-Type": "text/plain",
|
|
325
|
+
Authority: _test.mu.addr
|
|
252
326
|
}));
|
|
253
327
|
ex = false;
|
|
254
328
|
_iterator = _createForOfIteratorHelper(opt.tags);
|
|
@@ -266,7 +340,7 @@ var connect = exports.connect = function connect(mem) {
|
|
|
266
340
|
name: "Type",
|
|
267
341
|
value: "Process"
|
|
268
342
|
});
|
|
269
|
-
|
|
343
|
+
_context3.next = 18;
|
|
270
344
|
return ar.dataitem({
|
|
271
345
|
item: opt.item,
|
|
272
346
|
data: opt.data,
|
|
@@ -274,14 +348,14 @@ var connect = exports.connect = function connect(mem) {
|
|
|
274
348
|
tags: (0, _utils.tags)(opt.tags)
|
|
275
349
|
});
|
|
276
350
|
case 18:
|
|
277
|
-
_yield$ar$dataitem =
|
|
351
|
+
_yield$ar$dataitem = _context3.sent;
|
|
278
352
|
id = _yield$ar$dataitem.id;
|
|
279
353
|
owner = _yield$ar$dataitem.owner;
|
|
280
354
|
item = _yield$ar$dataitem.item;
|
|
281
355
|
__tags = _yield$ar$dataitem.tags;
|
|
282
356
|
opt.tags = (0, _utils.buildTags)(null, __tags);
|
|
283
357
|
if (opt.item) opt.data = _base64url["default"].decode(item.data);
|
|
284
|
-
|
|
358
|
+
_context3.next = 27;
|
|
285
359
|
return ar.postItems(item, _test.su.jwk);
|
|
286
360
|
case 27:
|
|
287
361
|
now = Date.now;
|
|
@@ -289,37 +363,37 @@ var connect = exports.connect = function connect(mem) {
|
|
|
289
363
|
ext = t.Extension || "WeaveDrive";
|
|
290
364
|
wdrive = extensions[ext];
|
|
291
365
|
handle = null;
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
366
|
+
_context3.prev = 32;
|
|
367
|
+
_context3.t0 = _aoLoader["default"];
|
|
368
|
+
_context3.t1 = wasm;
|
|
369
|
+
_context3.t2 = format;
|
|
370
|
+
_context3.t3 = wdrive;
|
|
371
|
+
_context3.t4 = item;
|
|
372
|
+
_context3.next = 40;
|
|
299
373
|
return mem.get("txs", mod);
|
|
300
374
|
case 40:
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
format:
|
|
304
|
-
WeaveDrive:
|
|
305
|
-
spawn:
|
|
306
|
-
module:
|
|
375
|
+
_context3.t5 = _context3.sent;
|
|
376
|
+
_context3.t6 = {
|
|
377
|
+
format: _context3.t2,
|
|
378
|
+
WeaveDrive: _context3.t3,
|
|
379
|
+
spawn: _context3.t4,
|
|
380
|
+
module: _context3.t5
|
|
307
381
|
};
|
|
308
|
-
|
|
309
|
-
return (0,
|
|
382
|
+
_context3.next = 44;
|
|
383
|
+
return (0, _context3.t0)(_context3.t1, _context3.t6);
|
|
310
384
|
case 44:
|
|
311
|
-
handle =
|
|
312
|
-
|
|
385
|
+
handle = _context3.sent;
|
|
386
|
+
_context3.next = 49;
|
|
313
387
|
break;
|
|
314
388
|
case 47:
|
|
315
|
-
|
|
316
|
-
|
|
389
|
+
_context3.prev = 47;
|
|
390
|
+
_context3.t7 = _context3["catch"](32);
|
|
317
391
|
case 49:
|
|
318
392
|
if (handle) {
|
|
319
|
-
|
|
393
|
+
_context3.next = 51;
|
|
320
394
|
break;
|
|
321
395
|
}
|
|
322
|
-
return
|
|
396
|
+
return _context3.abrupt("return", null);
|
|
323
397
|
case 51:
|
|
324
398
|
_module = null;
|
|
325
399
|
_module = {
|
|
@@ -348,122 +422,124 @@ var connect = exports.connect = function connect(mem) {
|
|
|
348
422
|
opt: opt
|
|
349
423
|
};
|
|
350
424
|
if (!memory) {
|
|
351
|
-
|
|
425
|
+
_context3.next = 61;
|
|
352
426
|
break;
|
|
353
427
|
}
|
|
354
|
-
|
|
428
|
+
_context3.next = 103;
|
|
355
429
|
break;
|
|
356
430
|
case 61:
|
|
357
431
|
if (!(_tags["On-Boot"] || true)) {
|
|
358
|
-
|
|
432
|
+
_context3.next = 102;
|
|
359
433
|
break;
|
|
360
434
|
}
|
|
361
435
|
data = "";
|
|
362
436
|
if (!(_tags["On-Boot"] === "Data")) {
|
|
363
|
-
|
|
437
|
+
_context3.next = 67;
|
|
364
438
|
break;
|
|
365
439
|
}
|
|
366
440
|
data = (_opt$data = opt.data) !== null && _opt$data !== void 0 ? _opt$data : "";
|
|
367
|
-
|
|
441
|
+
_context3.next = 88;
|
|
368
442
|
break;
|
|
369
443
|
case 67:
|
|
370
|
-
|
|
444
|
+
_context3.next = 69;
|
|
371
445
|
return mem.get("msgs", _tags["On-Boot"]);
|
|
372
446
|
case 69:
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
if (
|
|
376
|
-
|
|
447
|
+
_context3.t10 = _yield$mem$get3 = _context3.sent;
|
|
448
|
+
_context3.t9 = _context3.t10 === null;
|
|
449
|
+
if (_context3.t9) {
|
|
450
|
+
_context3.next = 73;
|
|
377
451
|
break;
|
|
378
452
|
}
|
|
379
|
-
|
|
453
|
+
_context3.t9 = _yield$mem$get3 === void 0;
|
|
380
454
|
case 73:
|
|
381
|
-
if (!
|
|
382
|
-
|
|
455
|
+
if (!_context3.t9) {
|
|
456
|
+
_context3.next = 77;
|
|
383
457
|
break;
|
|
384
458
|
}
|
|
385
|
-
|
|
386
|
-
|
|
459
|
+
_context3.t11 = void 0;
|
|
460
|
+
_context3.next = 78;
|
|
387
461
|
break;
|
|
388
462
|
case 77:
|
|
389
|
-
|
|
463
|
+
_context3.t11 = _yield$mem$get3.data;
|
|
390
464
|
case 78:
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
if (!
|
|
394
|
-
|
|
465
|
+
_context3.t12 = _yield$mem$get$data = _context3.t11;
|
|
466
|
+
_context3.t8 = _context3.t12 !== null;
|
|
467
|
+
if (!_context3.t8) {
|
|
468
|
+
_context3.next = 82;
|
|
395
469
|
break;
|
|
396
470
|
}
|
|
397
|
-
|
|
471
|
+
_context3.t8 = _yield$mem$get$data !== void 0;
|
|
398
472
|
case 82:
|
|
399
|
-
if (!
|
|
400
|
-
|
|
473
|
+
if (!_context3.t8) {
|
|
474
|
+
_context3.next = 86;
|
|
401
475
|
break;
|
|
402
476
|
}
|
|
403
|
-
|
|
404
|
-
|
|
477
|
+
_context3.t13 = _yield$mem$get$data;
|
|
478
|
+
_context3.next = 87;
|
|
405
479
|
break;
|
|
406
480
|
case 86:
|
|
407
|
-
|
|
481
|
+
_context3.t13 = "";
|
|
408
482
|
case 87:
|
|
409
|
-
data =
|
|
483
|
+
data = _context3.t13;
|
|
410
484
|
case 88:
|
|
411
|
-
|
|
485
|
+
_context3.next = 90;
|
|
412
486
|
return genMsg(id, p, data, opt.tags, owner, _test.mu.addr, true);
|
|
413
487
|
case 90:
|
|
414
|
-
msg =
|
|
415
|
-
|
|
488
|
+
msg = _context3.sent;
|
|
489
|
+
_context3.next = 93;
|
|
490
|
+
return genEnv({
|
|
416
491
|
pid: p.id,
|
|
417
492
|
owner: p.owner,
|
|
418
|
-
module: p.module
|
|
419
|
-
auth: _test.mu.addr
|
|
493
|
+
module: p.module
|
|
420
494
|
});
|
|
421
|
-
|
|
495
|
+
case 93:
|
|
496
|
+
_env = _context3.sent;
|
|
497
|
+
_context3.next = 96;
|
|
422
498
|
return _module.handle(null, msg, _env);
|
|
423
|
-
case
|
|
424
|
-
res =
|
|
499
|
+
case 96:
|
|
500
|
+
res = _context3.sent;
|
|
425
501
|
p.memory = res.Memory;
|
|
426
502
|
delete res.Memory;
|
|
427
503
|
p.res[id] = res;
|
|
428
|
-
|
|
504
|
+
_context3.next = 103;
|
|
429
505
|
break;
|
|
430
|
-
case
|
|
506
|
+
case 102:
|
|
431
507
|
p.height += 1;
|
|
432
|
-
case 101:
|
|
433
|
-
_context2.next = 103;
|
|
434
|
-
return mem.set(opt, "msgs", id);
|
|
435
508
|
case 103:
|
|
509
|
+
_context3.next = 105;
|
|
510
|
+
return mem.set(opt, "msgs", id);
|
|
511
|
+
case 105:
|
|
436
512
|
if (!_tags["Cron-Interval"]) {
|
|
437
|
-
|
|
513
|
+
_context3.next = 129;
|
|
438
514
|
break;
|
|
439
515
|
}
|
|
440
516
|
_tags$CronInterval$s = _tags["Cron-Interval"].split("-"), _tags$CronInterval$s2 = _slicedToArray(_tags$CronInterval$s, 2), num = _tags$CronInterval$s2[0], unit = _tags$CronInterval$s2[1];
|
|
441
517
|
_int = 0;
|
|
442
|
-
|
|
443
|
-
|
|
518
|
+
_context3.t14 = unit.replace(/s$/, "");
|
|
519
|
+
_context3.next = _context3.t14 === "millisecond" ? 111 : _context3.t14 === "second" ? 113 : _context3.t14 === "minute" ? 115 : _context3.t14 === "hour" ? 117 : _context3.t14 === "day" ? 119 : _context3.t14 === "month" ? 121 : _context3.t14 === "year" ? 123 : 125;
|
|
444
520
|
break;
|
|
445
|
-
case 109:
|
|
446
|
-
_int = num;
|
|
447
|
-
return _context2.abrupt("break", 123);
|
|
448
521
|
case 111:
|
|
449
|
-
_int = num
|
|
450
|
-
return
|
|
522
|
+
_int = num;
|
|
523
|
+
return _context3.abrupt("break", 125);
|
|
451
524
|
case 113:
|
|
452
|
-
_int = num * 1000
|
|
453
|
-
return
|
|
525
|
+
_int = num * 1000;
|
|
526
|
+
return _context3.abrupt("break", 125);
|
|
454
527
|
case 115:
|
|
455
|
-
_int = num * 1000 * 60
|
|
456
|
-
return
|
|
528
|
+
_int = num * 1000 * 60;
|
|
529
|
+
return _context3.abrupt("break", 125);
|
|
457
530
|
case 117:
|
|
458
|
-
_int = num * 1000 * 60 * 60
|
|
459
|
-
return
|
|
531
|
+
_int = num * 1000 * 60 * 60;
|
|
532
|
+
return _context3.abrupt("break", 125);
|
|
460
533
|
case 119:
|
|
461
|
-
_int = num * 1000 * 60 * 60 * 24
|
|
462
|
-
return
|
|
534
|
+
_int = num * 1000 * 60 * 60 * 24;
|
|
535
|
+
return _context3.abrupt("break", 125);
|
|
463
536
|
case 121:
|
|
464
|
-
_int = num * 1000 * 60 * 60 * 24 *
|
|
465
|
-
return
|
|
537
|
+
_int = num * 1000 * 60 * 60 * 24 * 30;
|
|
538
|
+
return _context3.abrupt("break", 125);
|
|
466
539
|
case 123:
|
|
540
|
+
_int = num * 1000 * 60 * 60 * 24 * 365;
|
|
541
|
+
return _context3.abrupt("break", 125);
|
|
542
|
+
case 125:
|
|
467
543
|
cronTags = [];
|
|
468
544
|
for (_k in _tags) {
|
|
469
545
|
if (/^Cron-Tag-/.test(_k)) {
|
|
@@ -475,19 +551,19 @@ var connect = exports.connect = function connect(mem) {
|
|
|
475
551
|
}
|
|
476
552
|
p.cronTags = cronTags;
|
|
477
553
|
p.span = _int;
|
|
478
|
-
case 127:
|
|
479
|
-
_context2.next = 129;
|
|
480
|
-
return mem.set(p, "env", id);
|
|
481
554
|
case 129:
|
|
482
|
-
|
|
483
|
-
|
|
555
|
+
_context3.next = 131;
|
|
556
|
+
return mem.set(p, "env", id);
|
|
557
|
+
case 131:
|
|
558
|
+
return _context3.abrupt("return", id);
|
|
559
|
+
case 132:
|
|
484
560
|
case "end":
|
|
485
|
-
return
|
|
561
|
+
return _context3.stop();
|
|
486
562
|
}
|
|
487
|
-
},
|
|
563
|
+
}, _callee3, null, [[32, 47]]);
|
|
488
564
|
}));
|
|
489
565
|
return function spawn() {
|
|
490
|
-
return
|
|
566
|
+
return _ref7.apply(this, arguments);
|
|
491
567
|
};
|
|
492
568
|
}();
|
|
493
569
|
function genHashChain(previousHash) {
|
|
@@ -500,57 +576,57 @@ var connect = exports.connect = function connect(mem) {
|
|
|
500
576
|
return (0, _base64url["default"])(hasher.digest());
|
|
501
577
|
}
|
|
502
578
|
var _assign = /*#__PURE__*/function () {
|
|
503
|
-
var
|
|
579
|
+
var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(opt) {
|
|
504
580
|
var _opt$tags2;
|
|
505
|
-
var p, _opt, hash, _yield$ar$dataitem2, id, owner, item, _opt$data2,
|
|
506
|
-
return _regeneratorRuntime().wrap(function
|
|
507
|
-
while (1) switch (
|
|
581
|
+
var p, _opt, hash, _yield$ar$dataitem2, id, owner, item, _opt$data2, _ref9, _opt$from, _res$Messages, _res$Spawns, _res$Assignments, data, _tags, from, raw_owner, hashBuffer, msg, _env, _yield$mem$getWasm2, format, mod, wasm, wdrive, res, _iterator2, _step2, v, _iterator3, _step3, _v, __tags, _iterator4, _step4, _v2, _iterator5, _step5, v2;
|
|
582
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
583
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
508
584
|
case 0:
|
|
509
|
-
|
|
585
|
+
_context4.next = 2;
|
|
510
586
|
return mem.get("env", opt.process);
|
|
511
587
|
case 2:
|
|
512
|
-
p =
|
|
588
|
+
p = _context4.sent;
|
|
513
589
|
if (p) {
|
|
514
|
-
|
|
590
|
+
_context4.next = 5;
|
|
515
591
|
break;
|
|
516
592
|
}
|
|
517
|
-
return
|
|
593
|
+
return _context4.abrupt("return", null);
|
|
518
594
|
case 5:
|
|
519
|
-
|
|
595
|
+
_context4.next = 7;
|
|
520
596
|
return mem.get("msgs", opt.message);
|
|
521
597
|
case 7:
|
|
522
|
-
_opt =
|
|
598
|
+
_opt = _context4.sent;
|
|
523
599
|
hash = genHashChain(p.hash, opt.message);
|
|
524
600
|
p.hash = hash;
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
601
|
+
_context4.t0 = _utils.buildTags;
|
|
602
|
+
_context4.t1 = _ramda.mergeLeft;
|
|
603
|
+
_context4.t2 = (0, _utils.tags)((_opt$tags2 = opt.tags) !== null && _opt$tags2 !== void 0 ? _opt$tags2 : []);
|
|
604
|
+
_context4.t3 = Date.now();
|
|
605
|
+
_context4.t4 = p.epochs.length;
|
|
606
|
+
_context4.next = 17;
|
|
531
607
|
return mem.get("height");
|
|
532
608
|
case 17:
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
Timestamp:
|
|
539
|
-
Epoch:
|
|
609
|
+
_context4.t5 = _context4.sent;
|
|
610
|
+
_context4.t6 = opt.process;
|
|
611
|
+
_context4.t7 = opt.message;
|
|
612
|
+
_context4.t8 = hash;
|
|
613
|
+
_context4.t9 = {
|
|
614
|
+
Timestamp: _context4.t3,
|
|
615
|
+
Epoch: _context4.t4,
|
|
540
616
|
Nonce: "0",
|
|
541
617
|
"Data-Protocol": "ao",
|
|
542
618
|
Variant: "ao.TN.1",
|
|
543
619
|
SDK: "aoconnect",
|
|
544
620
|
Type: "Assignment",
|
|
545
|
-
"Block-Height":
|
|
546
|
-
Process:
|
|
547
|
-
Message:
|
|
548
|
-
"Hash-Chain":
|
|
621
|
+
"Block-Height": _context4.t5,
|
|
622
|
+
Process: _context4.t6,
|
|
623
|
+
Message: _context4.t7,
|
|
624
|
+
"Hash-Chain": _context4.t8
|
|
549
625
|
};
|
|
550
|
-
|
|
551
|
-
opt.tags = (0,
|
|
626
|
+
_context4.t10 = (0, _context4.t1)(_context4.t2, _context4.t9);
|
|
627
|
+
opt.tags = (0, _context4.t0)(null, _context4.t10);
|
|
552
628
|
p.epochs.push([opt.message]);
|
|
553
|
-
|
|
629
|
+
_context4.next = 27;
|
|
554
630
|
return ar.dataitem({
|
|
555
631
|
data: opt.data,
|
|
556
632
|
signer: opt.signer,
|
|
@@ -558,101 +634,103 @@ var connect = exports.connect = function connect(mem) {
|
|
|
558
634
|
target: opt.process
|
|
559
635
|
});
|
|
560
636
|
case 27:
|
|
561
|
-
_yield$ar$dataitem2 =
|
|
637
|
+
_yield$ar$dataitem2 = _context4.sent;
|
|
562
638
|
id = _yield$ar$dataitem2.id;
|
|
563
639
|
owner = _yield$ar$dataitem2.owner;
|
|
564
640
|
item = _yield$ar$dataitem2.item;
|
|
565
641
|
if (!opt.message_item) {
|
|
566
|
-
|
|
642
|
+
_context4.next = 36;
|
|
567
643
|
break;
|
|
568
644
|
}
|
|
569
|
-
|
|
645
|
+
_context4.next = 34;
|
|
570
646
|
return ar.postItems([opt.message_item, item], _test.su.jwk);
|
|
571
647
|
case 34:
|
|
572
|
-
|
|
648
|
+
_context4.next = 38;
|
|
573
649
|
break;
|
|
574
650
|
case 36:
|
|
575
|
-
|
|
651
|
+
_context4.next = 38;
|
|
576
652
|
return ar.postItems(item, _test.su.jwk);
|
|
577
653
|
case 38:
|
|
578
|
-
|
|
654
|
+
_context4.prev = 38;
|
|
579
655
|
data = (_opt$data2 = _opt.data) !== null && _opt$data2 !== void 0 ? _opt$data2 : "";
|
|
580
656
|
_tags = _opt.tags;
|
|
581
|
-
from = (
|
|
657
|
+
from = (_ref9 = (_opt$from = _opt.from) !== null && _opt$from !== void 0 ? _opt$from : opt.from) !== null && _ref9 !== void 0 ? _ref9 : owner;
|
|
582
658
|
if (!_opt.item) {
|
|
583
|
-
|
|
659
|
+
_context4.next = 59;
|
|
584
660
|
break;
|
|
585
661
|
}
|
|
586
|
-
|
|
662
|
+
_context4.prev = 43;
|
|
587
663
|
data = _base64url["default"].decode(_opt.item.data);
|
|
588
664
|
_tags = _opt.item.tags;
|
|
589
665
|
if (from) {
|
|
590
|
-
|
|
666
|
+
_context4.next = 54;
|
|
591
667
|
break;
|
|
592
668
|
}
|
|
593
669
|
raw_owner = _opt.item.rawOwner;
|
|
594
|
-
|
|
595
|
-
|
|
670
|
+
_context4.t11 = Buffer;
|
|
671
|
+
_context4.next = 51;
|
|
596
672
|
return _crypto["default"].subtle.digest("SHA-256", raw_owner);
|
|
597
673
|
case 51:
|
|
598
|
-
|
|
599
|
-
hashBuffer =
|
|
674
|
+
_context4.t12 = _context4.sent;
|
|
675
|
+
hashBuffer = _context4.t11.from.call(_context4.t11, _context4.t12);
|
|
600
676
|
from = _base64url["default"].encode(hashBuffer);
|
|
601
677
|
case 54:
|
|
602
|
-
|
|
678
|
+
_context4.next = 59;
|
|
603
679
|
break;
|
|
604
680
|
case 56:
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
console.log(
|
|
681
|
+
_context4.prev = 56;
|
|
682
|
+
_context4.t13 = _context4["catch"](43);
|
|
683
|
+
console.log(_context4.t13);
|
|
608
684
|
case 59:
|
|
609
|
-
|
|
685
|
+
_context4.next = 61;
|
|
610
686
|
return genMsg(opt.message, p, data, _tags, from, _test.mu.addr);
|
|
611
687
|
case 61:
|
|
612
|
-
msg =
|
|
613
|
-
|
|
688
|
+
msg = _context4.sent;
|
|
689
|
+
_context4.next = 64;
|
|
690
|
+
return genEnv({
|
|
614
691
|
pid: p.id,
|
|
615
692
|
owner: p.owner,
|
|
616
|
-
module: p.module
|
|
617
|
-
auth: _test.mu.addr
|
|
693
|
+
module: p.module
|
|
618
694
|
});
|
|
695
|
+
case 64:
|
|
696
|
+
_env = _context4.sent;
|
|
619
697
|
if (p.handle) {
|
|
620
|
-
|
|
698
|
+
_context4.next = 86;
|
|
621
699
|
break;
|
|
622
700
|
}
|
|
623
|
-
|
|
701
|
+
_context4.next = 68;
|
|
624
702
|
return mem.getWasm(p.modulea);
|
|
625
|
-
case
|
|
626
|
-
_yield$mem$getWasm2 =
|
|
703
|
+
case 68:
|
|
704
|
+
_yield$mem$getWasm2 = _context4.sent;
|
|
627
705
|
format = _yield$mem$getWasm2.format;
|
|
628
706
|
mod = _yield$mem$getWasm2.mod;
|
|
629
707
|
wasm = _yield$mem$getWasm2.wasm;
|
|
630
708
|
wdrive = extensions[p.extention];
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
709
|
+
_context4.t14 = _aoLoader["default"];
|
|
710
|
+
_context4.t15 = wasm;
|
|
711
|
+
_context4.t16 = format;
|
|
712
|
+
_context4.t17 = wdrive;
|
|
713
|
+
_context4.t18 = new DataItem(p.item);
|
|
714
|
+
_context4.next = 80;
|
|
637
715
|
return mem.get("txs", mod);
|
|
638
|
-
case
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
format:
|
|
642
|
-
WeaveDrive:
|
|
643
|
-
spawn:
|
|
644
|
-
module:
|
|
716
|
+
case 80:
|
|
717
|
+
_context4.t19 = _context4.sent;
|
|
718
|
+
_context4.t20 = {
|
|
719
|
+
format: _context4.t16,
|
|
720
|
+
WeaveDrive: _context4.t17,
|
|
721
|
+
spawn: _context4.t18,
|
|
722
|
+
module: _context4.t19
|
|
645
723
|
};
|
|
646
|
-
|
|
647
|
-
return (0,
|
|
648
|
-
case 82:
|
|
649
|
-
p.handle = _context3.sent;
|
|
650
|
-
mem.env[opt.process].handle = p.handle;
|
|
724
|
+
_context4.next = 84;
|
|
725
|
+
return (0, _context4.t14)(_context4.t15, _context4.t20);
|
|
651
726
|
case 84:
|
|
652
|
-
|
|
653
|
-
|
|
727
|
+
p.handle = _context4.sent;
|
|
728
|
+
mem.env[opt.process].handle = p.handle;
|
|
654
729
|
case 86:
|
|
655
|
-
|
|
730
|
+
_context4.next = 88;
|
|
731
|
+
return p.handle(p.memory, msg, _env);
|
|
732
|
+
case 88:
|
|
733
|
+
res = _context4.sent;
|
|
656
734
|
p.memory = res.Memory;
|
|
657
735
|
delete res.Memory;
|
|
658
736
|
p.res[opt.message] = res;
|
|
@@ -660,29 +738,29 @@ var connect = exports.connect = function connect(mem) {
|
|
|
660
738
|
p.txs.unshift(_objectSpread({
|
|
661
739
|
id: id
|
|
662
740
|
}, opt));
|
|
663
|
-
|
|
741
|
+
_context4.next = 96;
|
|
664
742
|
return mem.set(p, "env", opt.process);
|
|
665
|
-
case 94:
|
|
666
|
-
_context3.next = 96;
|
|
667
|
-
return mem.set(_opt, "msgs", opt.message);
|
|
668
743
|
case 96:
|
|
744
|
+
_context4.next = 98;
|
|
745
|
+
return mem.set(_opt, "msgs", opt.message);
|
|
746
|
+
case 98:
|
|
669
747
|
_iterator2 = _createForOfIteratorHelper((_res$Messages = res.Messages) !== null && _res$Messages !== void 0 ? _res$Messages : []);
|
|
670
|
-
|
|
748
|
+
_context4.prev = 99;
|
|
671
749
|
_iterator2.s();
|
|
672
|
-
case
|
|
750
|
+
case 101:
|
|
673
751
|
if ((_step2 = _iterator2.n()).done) {
|
|
674
|
-
|
|
752
|
+
_context4.next = 110;
|
|
675
753
|
break;
|
|
676
754
|
}
|
|
677
755
|
v = _step2.value;
|
|
678
|
-
|
|
756
|
+
_context4.next = 105;
|
|
679
757
|
return mem.get("env", v.Target);
|
|
680
|
-
case
|
|
681
|
-
if (!
|
|
682
|
-
|
|
758
|
+
case 105:
|
|
759
|
+
if (!_context4.sent) {
|
|
760
|
+
_context4.next = 108;
|
|
683
761
|
break;
|
|
684
762
|
}
|
|
685
|
-
|
|
763
|
+
_context4.next = 108;
|
|
686
764
|
return message({
|
|
687
765
|
process: v.Target,
|
|
688
766
|
tags: v.Tags,
|
|
@@ -690,32 +768,32 @@ var connect = exports.connect = function connect(mem) {
|
|
|
690
768
|
signer: _test.mu.signer,
|
|
691
769
|
from: opt.process
|
|
692
770
|
});
|
|
693
|
-
case 106:
|
|
694
|
-
_context3.next = 99;
|
|
695
|
-
break;
|
|
696
771
|
case 108:
|
|
697
|
-
|
|
772
|
+
_context4.next = 101;
|
|
698
773
|
break;
|
|
699
774
|
case 110:
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
775
|
+
_context4.next = 115;
|
|
776
|
+
break;
|
|
777
|
+
case 112:
|
|
778
|
+
_context4.prev = 112;
|
|
779
|
+
_context4.t21 = _context4["catch"](99);
|
|
780
|
+
_iterator2.e(_context4.t21);
|
|
781
|
+
case 115:
|
|
782
|
+
_context4.prev = 115;
|
|
705
783
|
_iterator2.f();
|
|
706
|
-
return
|
|
707
|
-
case
|
|
784
|
+
return _context4.finish(115);
|
|
785
|
+
case 118:
|
|
708
786
|
_iterator3 = _createForOfIteratorHelper((_res$Spawns = res.Spawns) !== null && _res$Spawns !== void 0 ? _res$Spawns : []);
|
|
709
|
-
|
|
787
|
+
_context4.prev = 119;
|
|
710
788
|
_iterator3.s();
|
|
711
|
-
case
|
|
789
|
+
case 121:
|
|
712
790
|
if ((_step3 = _iterator3.n()).done) {
|
|
713
|
-
|
|
791
|
+
_context4.next = 128;
|
|
714
792
|
break;
|
|
715
793
|
}
|
|
716
794
|
_v = _step3.value;
|
|
717
795
|
__tags = (0, _utils.tags)(_v.Tags);
|
|
718
|
-
|
|
796
|
+
_context4.next = 126;
|
|
719
797
|
return spawn({
|
|
720
798
|
module: __tags.Module,
|
|
721
799
|
scheduler: _test.scheduler,
|
|
@@ -724,115 +802,115 @@ var connect = exports.connect = function connect(mem) {
|
|
|
724
802
|
from: __tags["From-Process"],
|
|
725
803
|
signer: _test.mu.signer
|
|
726
804
|
});
|
|
727
|
-
case 124:
|
|
728
|
-
_context3.next = 119;
|
|
729
|
-
break;
|
|
730
805
|
case 126:
|
|
731
|
-
|
|
806
|
+
_context4.next = 121;
|
|
732
807
|
break;
|
|
733
808
|
case 128:
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
809
|
+
_context4.next = 133;
|
|
810
|
+
break;
|
|
811
|
+
case 130:
|
|
812
|
+
_context4.prev = 130;
|
|
813
|
+
_context4.t22 = _context4["catch"](119);
|
|
814
|
+
_iterator3.e(_context4.t22);
|
|
815
|
+
case 133:
|
|
816
|
+
_context4.prev = 133;
|
|
739
817
|
_iterator3.f();
|
|
740
|
-
return
|
|
741
|
-
case
|
|
818
|
+
return _context4.finish(133);
|
|
819
|
+
case 136:
|
|
742
820
|
_iterator4 = _createForOfIteratorHelper((_res$Assignments = res.Assignments) !== null && _res$Assignments !== void 0 ? _res$Assignments : []);
|
|
743
|
-
|
|
821
|
+
_context4.prev = 137;
|
|
744
822
|
_iterator4.s();
|
|
745
|
-
case
|
|
823
|
+
case 139:
|
|
746
824
|
if ((_step4 = _iterator4.n()).done) {
|
|
747
|
-
|
|
825
|
+
_context4.next = 160;
|
|
748
826
|
break;
|
|
749
827
|
}
|
|
750
828
|
_v2 = _step4.value;
|
|
751
829
|
_iterator5 = _createForOfIteratorHelper(_v2.Processes);
|
|
752
|
-
|
|
830
|
+
_context4.prev = 142;
|
|
753
831
|
_iterator5.s();
|
|
754
|
-
case
|
|
832
|
+
case 144:
|
|
755
833
|
if ((_step5 = _iterator5.n()).done) {
|
|
756
|
-
|
|
834
|
+
_context4.next = 150;
|
|
757
835
|
break;
|
|
758
836
|
}
|
|
759
837
|
v2 = _step5.value;
|
|
760
|
-
|
|
838
|
+
_context4.next = 148;
|
|
761
839
|
return _assign({
|
|
762
840
|
message: _v2.Message,
|
|
763
841
|
process: v2,
|
|
764
842
|
from: opt.process,
|
|
765
843
|
signer: _test.mu.signer
|
|
766
844
|
});
|
|
767
|
-
case 146:
|
|
768
|
-
_context3.next = 142;
|
|
769
|
-
break;
|
|
770
845
|
case 148:
|
|
771
|
-
|
|
846
|
+
_context4.next = 144;
|
|
772
847
|
break;
|
|
773
848
|
case 150:
|
|
774
|
-
|
|
775
|
-
_context3.t23 = _context3["catch"](140);
|
|
776
|
-
_iterator5.e(_context3.t23);
|
|
777
|
-
case 153:
|
|
778
|
-
_context3.prev = 153;
|
|
779
|
-
_iterator5.f();
|
|
780
|
-
return _context3.finish(153);
|
|
781
|
-
case 156:
|
|
782
|
-
_context3.next = 137;
|
|
849
|
+
_context4.next = 155;
|
|
783
850
|
break;
|
|
851
|
+
case 152:
|
|
852
|
+
_context4.prev = 152;
|
|
853
|
+
_context4.t23 = _context4["catch"](142);
|
|
854
|
+
_iterator5.e(_context4.t23);
|
|
855
|
+
case 155:
|
|
856
|
+
_context4.prev = 155;
|
|
857
|
+
_iterator5.f();
|
|
858
|
+
return _context4.finish(155);
|
|
784
859
|
case 158:
|
|
785
|
-
|
|
860
|
+
_context4.next = 139;
|
|
786
861
|
break;
|
|
787
862
|
case 160:
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
863
|
+
_context4.next = 165;
|
|
864
|
+
break;
|
|
865
|
+
case 162:
|
|
866
|
+
_context4.prev = 162;
|
|
867
|
+
_context4.t24 = _context4["catch"](137);
|
|
868
|
+
_iterator4.e(_context4.t24);
|
|
869
|
+
case 165:
|
|
870
|
+
_context4.prev = 165;
|
|
793
871
|
_iterator4.f();
|
|
794
|
-
return
|
|
795
|
-
case
|
|
796
|
-
return
|
|
797
|
-
case
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
console.log(
|
|
801
|
-
case
|
|
802
|
-
return
|
|
803
|
-
case
|
|
872
|
+
return _context4.finish(165);
|
|
873
|
+
case 168:
|
|
874
|
+
return _context4.abrupt("return", id);
|
|
875
|
+
case 171:
|
|
876
|
+
_context4.prev = 171;
|
|
877
|
+
_context4.t25 = _context4["catch"](38);
|
|
878
|
+
console.log(_context4.t25);
|
|
879
|
+
case 174:
|
|
880
|
+
return _context4.abrupt("return", null);
|
|
881
|
+
case 175:
|
|
804
882
|
case "end":
|
|
805
|
-
return
|
|
883
|
+
return _context4.stop();
|
|
806
884
|
}
|
|
807
|
-
},
|
|
885
|
+
}, _callee4, null, [[38, 171], [43, 56], [99, 112, 115, 118], [119, 130, 133, 136], [137, 162, 165, 168], [142, 152, 155, 158]]);
|
|
808
886
|
}));
|
|
809
|
-
return function assign(
|
|
810
|
-
return
|
|
887
|
+
return function assign(_x8) {
|
|
888
|
+
return _ref8.apply(this, arguments);
|
|
811
889
|
};
|
|
812
890
|
}();
|
|
813
891
|
var message = /*#__PURE__*/function () {
|
|
814
|
-
var
|
|
892
|
+
var _ref10 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(opt) {
|
|
815
893
|
var _opt$item$id, _opt$item, _opt$owner;
|
|
816
894
|
var p, ex, id, owner, item, _opt$tags3, _iterator6, _step6, v, _yield$ar$dataitem3;
|
|
817
|
-
return _regeneratorRuntime().wrap(function
|
|
818
|
-
while (1) switch (
|
|
895
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
896
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
819
897
|
case 0:
|
|
820
|
-
|
|
898
|
+
_context5.next = 2;
|
|
821
899
|
return mem.get("env", opt.process);
|
|
822
900
|
case 2:
|
|
823
|
-
p =
|
|
901
|
+
p = _context5.sent;
|
|
824
902
|
if (p) {
|
|
825
|
-
|
|
903
|
+
_context5.next = 5;
|
|
826
904
|
break;
|
|
827
905
|
}
|
|
828
|
-
return
|
|
906
|
+
return _context5.abrupt("return", null);
|
|
829
907
|
case 5:
|
|
830
908
|
ex = false;
|
|
831
909
|
id = (_opt$item$id = opt === null || opt === void 0 || (_opt$item = opt.item) === null || _opt$item === void 0 ? void 0 : _opt$item.id) !== null && _opt$item$id !== void 0 ? _opt$item$id : "";
|
|
832
910
|
owner = (_opt$owner = opt.owner) !== null && _opt$owner !== void 0 ? _opt$owner : "";
|
|
833
911
|
item = opt.item;
|
|
834
912
|
if (!(!opt.item && opt.signer)) {
|
|
835
|
-
|
|
913
|
+
_context5.next = 19;
|
|
836
914
|
break;
|
|
837
915
|
}
|
|
838
916
|
_iterator6 = _createForOfIteratorHelper(opt.tags);
|
|
@@ -852,7 +930,7 @@ var connect = exports.connect = function connect(mem) {
|
|
|
852
930
|
Type: "Message",
|
|
853
931
|
SDK: "aoconnect"
|
|
854
932
|
}));
|
|
855
|
-
|
|
933
|
+
_context5.next = 15;
|
|
856
934
|
return ar.dataitem({
|
|
857
935
|
data: opt.data,
|
|
858
936
|
signer: opt.signer,
|
|
@@ -860,15 +938,15 @@ var connect = exports.connect = function connect(mem) {
|
|
|
860
938
|
target: opt.process
|
|
861
939
|
});
|
|
862
940
|
case 15:
|
|
863
|
-
_yield$ar$dataitem3 =
|
|
941
|
+
_yield$ar$dataitem3 = _context5.sent;
|
|
864
942
|
item = _yield$ar$dataitem3.item;
|
|
865
943
|
id = _yield$ar$dataitem3.id;
|
|
866
944
|
owner = _yield$ar$dataitem3.owner;
|
|
867
945
|
case 19:
|
|
868
|
-
|
|
946
|
+
_context5.next = 21;
|
|
869
947
|
return mem.set(opt, "msgs", id);
|
|
870
948
|
case 21:
|
|
871
|
-
|
|
949
|
+
_context5.next = 23;
|
|
872
950
|
return _assign({
|
|
873
951
|
message_item: item,
|
|
874
952
|
message: id,
|
|
@@ -877,60 +955,60 @@ var connect = exports.connect = function connect(mem) {
|
|
|
877
955
|
signer: _test.mu.signer
|
|
878
956
|
});
|
|
879
957
|
case 23:
|
|
880
|
-
return
|
|
958
|
+
return _context5.abrupt("return", id);
|
|
881
959
|
case 24:
|
|
882
960
|
case "end":
|
|
883
|
-
return
|
|
961
|
+
return _context5.stop();
|
|
884
962
|
}
|
|
885
|
-
},
|
|
963
|
+
}, _callee5);
|
|
886
964
|
}));
|
|
887
|
-
return function message(
|
|
888
|
-
return
|
|
965
|
+
return function message(_x9) {
|
|
966
|
+
return _ref10.apply(this, arguments);
|
|
889
967
|
};
|
|
890
968
|
}();
|
|
891
969
|
return {
|
|
892
970
|
message: message,
|
|
893
971
|
unmonitor: function () {
|
|
894
|
-
var _unmonitor = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
972
|
+
var _unmonitor = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(opt) {
|
|
895
973
|
var p;
|
|
896
|
-
return _regeneratorRuntime().wrap(function
|
|
897
|
-
while (1) switch (
|
|
974
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
975
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
898
976
|
case 0:
|
|
899
|
-
|
|
977
|
+
_context6.next = 2;
|
|
900
978
|
return mem.get("env", opt.process);
|
|
901
979
|
case 2:
|
|
902
|
-
p =
|
|
980
|
+
p = _context6.sent;
|
|
903
981
|
try {
|
|
904
982
|
clearInterval(p.cron);
|
|
905
983
|
p.cron = null;
|
|
906
984
|
} catch (e) {}
|
|
907
985
|
case 4:
|
|
908
986
|
case "end":
|
|
909
|
-
return
|
|
987
|
+
return _context6.stop();
|
|
910
988
|
}
|
|
911
|
-
},
|
|
989
|
+
}, _callee6);
|
|
912
990
|
}));
|
|
913
|
-
function unmonitor(
|
|
991
|
+
function unmonitor(_x10) {
|
|
914
992
|
return _unmonitor.apply(this, arguments);
|
|
915
993
|
}
|
|
916
994
|
return unmonitor;
|
|
917
995
|
}(),
|
|
918
996
|
monitor: function () {
|
|
919
|
-
var _monitor = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
997
|
+
var _monitor = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(opt) {
|
|
920
998
|
var p;
|
|
921
|
-
return _regeneratorRuntime().wrap(function
|
|
922
|
-
while (1) switch (
|
|
999
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
1000
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
923
1001
|
case 0:
|
|
924
|
-
|
|
1002
|
+
_context8.next = 2;
|
|
925
1003
|
return mem.get("env", opt.process);
|
|
926
1004
|
case 2:
|
|
927
|
-
p =
|
|
1005
|
+
p = _context8.sent;
|
|
928
1006
|
if ((0, _ramda.isNil)(p.cron)) {
|
|
929
|
-
p.cron = setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
930
|
-
return _regeneratorRuntime().wrap(function
|
|
931
|
-
while (1) switch (
|
|
1007
|
+
p.cron = setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
1008
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
1009
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
932
1010
|
case 0:
|
|
933
|
-
|
|
1011
|
+
_context7.next = 2;
|
|
934
1012
|
return message({
|
|
935
1013
|
tags: p.cronTags,
|
|
936
1014
|
process: opt.process,
|
|
@@ -939,18 +1017,18 @@ var connect = exports.connect = function connect(mem) {
|
|
|
939
1017
|
});
|
|
940
1018
|
case 2:
|
|
941
1019
|
case "end":
|
|
942
|
-
return
|
|
1020
|
+
return _context7.stop();
|
|
943
1021
|
}
|
|
944
|
-
},
|
|
1022
|
+
}, _callee7);
|
|
945
1023
|
})), p.span);
|
|
946
1024
|
}
|
|
947
1025
|
case 4:
|
|
948
1026
|
case "end":
|
|
949
|
-
return
|
|
1027
|
+
return _context8.stop();
|
|
950
1028
|
}
|
|
951
|
-
},
|
|
1029
|
+
}, _callee8);
|
|
952
1030
|
}));
|
|
953
|
-
function monitor(
|
|
1031
|
+
function monitor(_x11) {
|
|
954
1032
|
return _monitor.apply(this, arguments);
|
|
955
1033
|
}
|
|
956
1034
|
return monitor;
|
|
@@ -959,47 +1037,47 @@ var connect = exports.connect = function connect(mem) {
|
|
|
959
1037
|
assign: _assign,
|
|
960
1038
|
ar: ar,
|
|
961
1039
|
result: function () {
|
|
962
|
-
var _result = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
963
|
-
return _regeneratorRuntime().wrap(function
|
|
964
|
-
while (1) switch (
|
|
1040
|
+
var _result = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(opt) {
|
|
1041
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
1042
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
965
1043
|
case 0:
|
|
966
|
-
|
|
1044
|
+
_context9.next = 2;
|
|
967
1045
|
return mem.get("env", opt.process);
|
|
968
1046
|
case 2:
|
|
969
|
-
|
|
970
|
-
return
|
|
1047
|
+
_context9.t0 = opt.message;
|
|
1048
|
+
return _context9.abrupt("return", _context9.sent.res[_context9.t0]);
|
|
971
1049
|
case 4:
|
|
972
1050
|
case "end":
|
|
973
|
-
return
|
|
1051
|
+
return _context9.stop();
|
|
974
1052
|
}
|
|
975
|
-
},
|
|
1053
|
+
}, _callee9);
|
|
976
1054
|
}));
|
|
977
|
-
function result(
|
|
1055
|
+
function result(_x12) {
|
|
978
1056
|
return _result.apply(this, arguments);
|
|
979
1057
|
}
|
|
980
1058
|
return result;
|
|
981
1059
|
}(),
|
|
982
1060
|
results: function () {
|
|
983
|
-
var _results = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1061
|
+
var _results = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(opt) {
|
|
984
1062
|
var _opt$limit;
|
|
985
1063
|
var p, results, limit, i, _i;
|
|
986
|
-
return _regeneratorRuntime().wrap(function
|
|
987
|
-
while (1) switch (
|
|
1064
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
1065
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
988
1066
|
case 0:
|
|
989
|
-
|
|
1067
|
+
_context10.next = 2;
|
|
990
1068
|
return mem.get("env", opt.process);
|
|
991
1069
|
case 2:
|
|
992
|
-
p =
|
|
1070
|
+
p = _context10.sent;
|
|
993
1071
|
results = [];
|
|
994
1072
|
limit = (_opt$limit = opt.limit) !== null && _opt$limit !== void 0 ? _opt$limit : 25;
|
|
995
1073
|
if (!(opt.sort === "DESC")) {
|
|
996
|
-
|
|
1074
|
+
_context10.next = 16;
|
|
997
1075
|
break;
|
|
998
1076
|
}
|
|
999
1077
|
i = p.results.length - 1;
|
|
1000
1078
|
case 7:
|
|
1001
1079
|
if (!(0 < i)) {
|
|
1002
|
-
|
|
1080
|
+
_context10.next = 14;
|
|
1003
1081
|
break;
|
|
1004
1082
|
}
|
|
1005
1083
|
results.push({
|
|
@@ -1007,85 +1085,85 @@ var connect = exports.connect = function connect(mem) {
|
|
|
1007
1085
|
node: p.res[p.results[i]]
|
|
1008
1086
|
});
|
|
1009
1087
|
if (!(results.length >= limit)) {
|
|
1010
|
-
|
|
1088
|
+
_context10.next = 11;
|
|
1011
1089
|
break;
|
|
1012
1090
|
}
|
|
1013
|
-
return
|
|
1091
|
+
return _context10.abrupt("break", 14);
|
|
1014
1092
|
case 11:
|
|
1015
1093
|
i--;
|
|
1016
|
-
|
|
1094
|
+
_context10.next = 7;
|
|
1017
1095
|
break;
|
|
1018
1096
|
case 14:
|
|
1019
|
-
|
|
1097
|
+
_context10.next = 24;
|
|
1020
1098
|
break;
|
|
1021
1099
|
case 16:
|
|
1022
1100
|
_i = 0;
|
|
1023
1101
|
case 17:
|
|
1024
1102
|
if (!(_i < p.results.length)) {
|
|
1025
|
-
|
|
1103
|
+
_context10.next = 24;
|
|
1026
1104
|
break;
|
|
1027
1105
|
}
|
|
1028
1106
|
results.push({
|
|
1029
1107
|
node: p.res[p.results[_i]]
|
|
1030
1108
|
});
|
|
1031
1109
|
if (!(results.length >= limit)) {
|
|
1032
|
-
|
|
1110
|
+
_context10.next = 21;
|
|
1033
1111
|
break;
|
|
1034
1112
|
}
|
|
1035
|
-
return
|
|
1113
|
+
return _context10.abrupt("break", 24);
|
|
1036
1114
|
case 21:
|
|
1037
1115
|
_i++;
|
|
1038
|
-
|
|
1116
|
+
_context10.next = 17;
|
|
1039
1117
|
break;
|
|
1040
1118
|
case 24:
|
|
1041
|
-
return
|
|
1119
|
+
return _context10.abrupt("return", {
|
|
1042
1120
|
edges: results
|
|
1043
1121
|
});
|
|
1044
1122
|
case 25:
|
|
1045
1123
|
case "end":
|
|
1046
|
-
return
|
|
1124
|
+
return _context10.stop();
|
|
1047
1125
|
}
|
|
1048
|
-
},
|
|
1126
|
+
}, _callee10);
|
|
1049
1127
|
}));
|
|
1050
|
-
function results(
|
|
1128
|
+
function results(_x13) {
|
|
1051
1129
|
return _results.apply(this, arguments);
|
|
1052
1130
|
}
|
|
1053
1131
|
return results;
|
|
1054
1132
|
}(),
|
|
1055
1133
|
dryrun: function () {
|
|
1056
|
-
var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1134
|
+
var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(opt) {
|
|
1057
1135
|
var _opt$id, _opt$owner2;
|
|
1058
1136
|
var p, id, owner, _yield$ar$dataitem4, _opt$data3, cloneMemory, msg, _env, _yield$mem$getWasm3, format, mod, wasm, wdrive, res;
|
|
1059
|
-
return _regeneratorRuntime().wrap(function
|
|
1060
|
-
while (1) switch (
|
|
1137
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
1138
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
1061
1139
|
case 0:
|
|
1062
|
-
|
|
1140
|
+
_context11.next = 2;
|
|
1063
1141
|
return mem.get("env", opt.process);
|
|
1064
1142
|
case 2:
|
|
1065
|
-
p =
|
|
1143
|
+
p = _context11.sent;
|
|
1066
1144
|
if (p) {
|
|
1067
|
-
|
|
1145
|
+
_context11.next = 5;
|
|
1068
1146
|
break;
|
|
1069
1147
|
}
|
|
1070
|
-
return
|
|
1148
|
+
return _context11.abrupt("return", null);
|
|
1071
1149
|
case 5:
|
|
1072
1150
|
id = (_opt$id = opt.id) !== null && _opt$id !== void 0 ? _opt$id : "";
|
|
1073
1151
|
owner = (_opt$owner2 = opt.owner) !== null && _opt$owner2 !== void 0 ? _opt$owner2 : "";
|
|
1074
1152
|
if (!(!opt.id && opt.signer)) {
|
|
1075
|
-
|
|
1153
|
+
_context11.next = 14;
|
|
1076
1154
|
break;
|
|
1077
1155
|
}
|
|
1078
1156
|
;
|
|
1079
|
-
|
|
1157
|
+
_context11.next = 11;
|
|
1080
1158
|
return ar.dataitem(_objectSpread(_objectSpread({}, opt), {}, {
|
|
1081
1159
|
target: opt.process
|
|
1082
1160
|
}));
|
|
1083
1161
|
case 11:
|
|
1084
|
-
_yield$ar$dataitem4 =
|
|
1162
|
+
_yield$ar$dataitem4 = _context11.sent;
|
|
1085
1163
|
id = _yield$ar$dataitem4.id;
|
|
1086
1164
|
owner = _yield$ar$dataitem4.owner;
|
|
1087
1165
|
case 14:
|
|
1088
|
-
|
|
1166
|
+
_context11.prev = 14;
|
|
1089
1167
|
cloneMemory = function cloneMemory(memory) {
|
|
1090
1168
|
var buffer = memory.buffer.slice(0);
|
|
1091
1169
|
return new WebAssembly.Memory({
|
|
@@ -1094,67 +1172,69 @@ var connect = exports.connect = function connect(mem) {
|
|
|
1094
1172
|
shared: memory.shared || false
|
|
1095
1173
|
});
|
|
1096
1174
|
};
|
|
1097
|
-
|
|
1175
|
+
_context11.next = 18;
|
|
1098
1176
|
return genMsg(id, p, (_opt$data3 = opt.data) !== null && _opt$data3 !== void 0 ? _opt$data3 : "", opt.tags, owner, _test.mu.addr, true);
|
|
1099
1177
|
case 18:
|
|
1100
|
-
msg =
|
|
1101
|
-
|
|
1178
|
+
msg = _context11.sent;
|
|
1179
|
+
_context11.next = 21;
|
|
1180
|
+
return genEnv({
|
|
1102
1181
|
pid: p.id,
|
|
1103
1182
|
owner: p.owner,
|
|
1104
|
-
module: p.module
|
|
1105
|
-
auth: _test.mu.addr
|
|
1183
|
+
module: p.module
|
|
1106
1184
|
});
|
|
1185
|
+
case 21:
|
|
1186
|
+
_env = _context11.sent;
|
|
1107
1187
|
if (p.handle) {
|
|
1108
|
-
|
|
1188
|
+
_context11.next = 43;
|
|
1109
1189
|
break;
|
|
1110
1190
|
}
|
|
1111
|
-
|
|
1191
|
+
_context11.next = 25;
|
|
1112
1192
|
return mem.getWasm(p.modulea);
|
|
1113
|
-
case
|
|
1114
|
-
_yield$mem$getWasm3 =
|
|
1193
|
+
case 25:
|
|
1194
|
+
_yield$mem$getWasm3 = _context11.sent;
|
|
1115
1195
|
format = _yield$mem$getWasm3.format;
|
|
1116
1196
|
mod = _yield$mem$getWasm3.mod;
|
|
1117
1197
|
wasm = _yield$mem$getWasm3.wasm;
|
|
1118
1198
|
wdrive = extensions[p.extention];
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1199
|
+
_context11.t0 = _aoLoader["default"];
|
|
1200
|
+
_context11.t1 = wasm;
|
|
1201
|
+
_context11.t2 = format;
|
|
1202
|
+
_context11.t3 = wdrive;
|
|
1203
|
+
_context11.t4 = new DataItem(p.item);
|
|
1204
|
+
_context11.next = 37;
|
|
1125
1205
|
return mem.get("txs", mod);
|
|
1126
|
-
case
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
format:
|
|
1130
|
-
WeaveDrive:
|
|
1131
|
-
spawn:
|
|
1132
|
-
module:
|
|
1206
|
+
case 37:
|
|
1207
|
+
_context11.t5 = _context11.sent;
|
|
1208
|
+
_context11.t6 = {
|
|
1209
|
+
format: _context11.t2,
|
|
1210
|
+
WeaveDrive: _context11.t3,
|
|
1211
|
+
spawn: _context11.t4,
|
|
1212
|
+
module: _context11.t5
|
|
1133
1213
|
};
|
|
1134
|
-
|
|
1135
|
-
return (0,
|
|
1136
|
-
case 39:
|
|
1137
|
-
p.handle = _context10.sent;
|
|
1138
|
-
mem.env[opt.process].handle = p.handle;
|
|
1214
|
+
_context11.next = 41;
|
|
1215
|
+
return (0, _context11.t0)(_context11.t1, _context11.t6);
|
|
1139
1216
|
case 41:
|
|
1140
|
-
|
|
1141
|
-
|
|
1217
|
+
p.handle = _context11.sent;
|
|
1218
|
+
mem.env[opt.process].handle = p.handle;
|
|
1142
1219
|
case 43:
|
|
1143
|
-
|
|
1144
|
-
return
|
|
1145
|
-
case
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1220
|
+
_context11.next = 45;
|
|
1221
|
+
return p.handle(p.memory, msg, _env);
|
|
1222
|
+
case 45:
|
|
1223
|
+
res = _context11.sent;
|
|
1224
|
+
return _context11.abrupt("return", res);
|
|
1225
|
+
case 49:
|
|
1226
|
+
_context11.prev = 49;
|
|
1227
|
+
_context11.t7 = _context11["catch"](14);
|
|
1228
|
+
console.log(_context11.t7);
|
|
1229
|
+
case 52:
|
|
1230
|
+
return _context11.abrupt("return", null);
|
|
1231
|
+
case 53:
|
|
1152
1232
|
case "end":
|
|
1153
|
-
return
|
|
1233
|
+
return _context11.stop();
|
|
1154
1234
|
}
|
|
1155
|
-
},
|
|
1235
|
+
}, _callee11, null, [[14, 49]]);
|
|
1156
1236
|
}));
|
|
1157
|
-
function dryrun(
|
|
1237
|
+
function dryrun(_x14) {
|
|
1158
1238
|
return _dryrun.apply(this, arguments);
|
|
1159
1239
|
}
|
|
1160
1240
|
return dryrun;
|