wao 0.37.8 → 0.38.0

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 CHANGED
@@ -113,7 +113,12 @@ var AO = /*#__PURE__*/function () {
113
113
  _opt$in_memory = _opt.in_memory,
114
114
  in_memory = _opt$in_memory === void 0 ? false : _opt$in_memory,
115
115
  port = _opt.port;
116
- if (_hb) this.hb = new _hb2["default"]();
116
+ if (_hb) {
117
+ this.format = _hb === "ans104" ? _hb : "httpsig";
118
+ this.hb = new _hb2["default"]({
119
+ format: this.format
120
+ });
121
+ }
117
122
  if (!_port && port) _port = port;
118
123
  if (!aoconnect && _port) aoconnect = (0, _utils.optAO)(_port);
119
124
  if (!ar && _port) ar = {
package/cjs/hb.js CHANGED
@@ -1047,17 +1047,28 @@ var HB = /*#__PURE__*/function () {
1047
1047
  _context27.n = 1;
1048
1048
  return this.setInfo();
1049
1049
  case 1:
1050
- t = (0, _ramda.mergeLeft)(tags, {
1051
- "Data-Protocol": "ao",
1052
- Variant: "ao.TN.1",
1053
- Authority: this.operator,
1054
- module: module !== null && module !== void 0 ? module : "ISShJH1ij-hPPt9St5UFFr_8Ys3Kj5cyg7zrMGt7H9s",
1055
- device: "process@1.0",
1056
- "execution-device": "stack@1.0",
1057
- "push-device": "push@1.0",
1058
- "device-stack": ["genesis-wasm@1.0", "patch@1.0"],
1059
- "patch-from": "/results/outbox"
1060
- });
1050
+ t = {};
1051
+ if (this.format === "ans104") {
1052
+ t = (0, _ramda.mergeLeft)(tags, {
1053
+ "Data-Protocol": "ao",
1054
+ Variant: "ao.TN.1",
1055
+ Authority: this.operator,
1056
+ Scheduler: this.operator,
1057
+ Module: module !== null && module !== void 0 ? module : "ISShJH1ij-hPPt9St5UFFr_8Ys3Kj5cyg7zrMGt7H9s",
1058
+ device: "process@1.0",
1059
+ "execution-device": "genesis-wasm@1.0"
1060
+ });
1061
+ } else {
1062
+ t = (0, _ramda.mergeLeft)(tags, {
1063
+ "Data-Protocol": "ao",
1064
+ Variant: "ao.TN.1",
1065
+ Authority: this.operator,
1066
+ Scheduler: this.operator,
1067
+ Module: module !== null && module !== void 0 ? module : "ISShJH1ij-hPPt9St5UFFr_8Ys3Kj5cyg7zrMGt7H9s",
1068
+ device: "process@1.0",
1069
+ "execution-device": "genesis-wasm@1.0"
1070
+ });
1071
+ }
1061
1072
  if (data) t.data = data;
1062
1073
  _context27.n = 2;
1063
1074
  return this.spawn(t);
package/esm/ao.js CHANGED
@@ -95,7 +95,10 @@ class AO {
95
95
  in_memory = false,
96
96
  port,
97
97
  } = opt
98
- if (_hb) this.hb = new HB()
98
+ if (_hb) {
99
+ this.format = _hb === "ans104" ? _hb : "httpsig"
100
+ this.hb = new HB({ format: this.format })
101
+ }
99
102
  if (!_port && port) _port = port
100
103
  if (!aoconnect && _port) aoconnect = optAO(_port)
101
104
  if (!ar && _port) ar = { port: _port }
package/esm/hb.js CHANGED
@@ -174,6 +174,7 @@ class HB {
174
174
  })
175
175
  return { slot: res.out.slot, res, pid }
176
176
  }
177
+
177
178
  async send104({ path = "/~process@1.0/schedule", item }) {
178
179
  let res = await fetch(`${this.url}${path}`, {
179
180
  method: "POST",
@@ -185,6 +186,7 @@ class HB {
185
186
  })
186
187
  return await result(res)
187
188
  }
189
+
188
190
  async post104({
189
191
  path = "/~process@1.0/schedule",
190
192
  tags = {},
@@ -303,20 +305,32 @@ class HB {
303
305
 
304
306
  async spawnLegacy({ module, tags = {}, data } = {}) {
305
307
  await this.setInfo()
306
- let t = mergeLeft(tags, {
307
- "Data-Protocol": "ao",
308
- Variant: "ao.TN.1",
309
- Authority: this.operator,
310
- module: module ?? "ISShJH1ij-hPPt9St5UFFr_8Ys3Kj5cyg7zrMGt7H9s",
311
- device: "process@1.0",
312
- "execution-device": "stack@1.0",
313
- "push-device": "push@1.0",
314
- "device-stack": ["genesis-wasm@1.0", "patch@1.0"],
315
- "patch-from": "/results/outbox",
316
- })
308
+ let t = {}
309
+ if (this.format === "ans104") {
310
+ t = mergeLeft(tags, {
311
+ "Data-Protocol": "ao",
312
+ Variant: "ao.TN.1",
313
+ Authority: this.operator,
314
+ Scheduler: this.operator,
315
+ Module: module ?? "ISShJH1ij-hPPt9St5UFFr_8Ys3Kj5cyg7zrMGt7H9s",
316
+ device: "process@1.0",
317
+ "execution-device": "genesis-wasm@1.0",
318
+ })
319
+ } else {
320
+ t = mergeLeft(tags, {
321
+ "Data-Protocol": "ao",
322
+ Variant: "ao.TN.1",
323
+ Authority: this.operator,
324
+ Scheduler: this.operator,
325
+ Module: module ?? "ISShJH1ij-hPPt9St5UFFr_8Ys3Kj5cyg7zrMGt7H9s",
326
+ device: "process@1.0",
327
+ "execution-device": "genesis-wasm@1.0",
328
+ })
329
+ }
317
330
  if (data) t.data = data
318
331
  return await this.spawn(t)
319
332
  }
333
+
320
334
  async scheduleLegacy({ action = "Eval", tags = {}, ...rest } = {}) {
321
335
  if (action) tags.Action = action
322
336
  return await this.schedule({ tags, ...rest })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wao",
3
- "version": "0.37.8",
3
+ "version": "0.38.0",
4
4
  "bin": {
5
5
  "wao": "./cjs/cli.js",
6
6
  "wao-esm": "./esm/cli.js"