wao 0.8.3 → 0.8.5

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