wao 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/ao.js CHANGED
@@ -1386,7 +1386,7 @@ var AO = /*#__PURE__*/function () {
1386
1386
  var getParams = function getParams(tags, opts) {
1387
1387
  var _tags = tags;
1388
1388
  var _opts = opts;
1389
- if ((!(0, _ramda.isNil)(tags === null || tags === void 0 ? void 0 : tags.get) || !(0, _ramda.isNil)(tags === null || tags === void 0 ? void 0 : tags.check) || (0, _ramda.is)(Boolean, tags) || (0, _ramda.is)(String, tags)) && (0, _ramda.isNil)(opts)) {
1389
+ if ((!(0, _ramda.isNil)(tags === null || tags === void 0 ? void 0 : tags.get) || !(0, _ramda.isNil)(tags === null || tags === void 0 ? void 0 : tags.check) || !(0, _ramda.isNil)(tags === null || tags === void 0 ? void 0 : tags.data) || (0, _ramda.is)(Boolean, tags) || (0, _ramda.is)(String, tags)) && (0, _ramda.isNil)(opts)) {
1390
1390
  _opts = tags;
1391
1391
  _tags = null;
1392
1392
  }
package/cjs/aoconnect.js CHANGED
@@ -1919,6 +1919,31 @@ var connect = exports.connect = function connect() {
1919
1919
  }(),
1920
1920
  getProcesses: function getProcesses() {
1921
1921
  return env;
1922
- }
1922
+ },
1923
+ blueprint: function () {
1924
+ var _blueprint = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee31(pkg) {
1925
+ return _regeneratorRuntime().wrap(function _callee31$(_context31) {
1926
+ while (1) switch (_context31.prev = _context31.next) {
1927
+ case 0:
1928
+ _context31.t0 = _fs.readFileSync;
1929
+ _context31.t1 = _path.resolve;
1930
+ _context31.next = 4;
1931
+ return dirname();
1932
+ case 4:
1933
+ _context31.t2 = _context31.sent;
1934
+ _context31.t3 = "lua/".concat(pkg, ".lua");
1935
+ _context31.t4 = (0, _context31.t1)(_context31.t2, _context31.t3);
1936
+ return _context31.abrupt("return", (0, _context31.t0)(_context31.t4, "utf8"));
1937
+ case 8:
1938
+ case "end":
1939
+ return _context31.stop();
1940
+ }
1941
+ }, _callee31);
1942
+ }));
1943
+ function blueprint(_x17) {
1944
+ return _blueprint.apply(this, arguments);
1945
+ }
1946
+ return blueprint;
1947
+ }()
1923
1948
  };
1924
1949
  };
package/cjs/helpers.js CHANGED
@@ -198,11 +198,11 @@ var setup = exports.setup = /*#__PURE__*/function () {
198
198
  dir: dir
199
199
  });
200
200
  _context3.next = 25;
201
- return new AO(opt.ao).init(opt.jwk);
201
+ return new _index.AO(opt.ao).init(opt.jwk);
202
202
  case 25:
203
203
  _ao = _context3.sent;
204
204
  _context3.next = 28;
205
- return new AO(opt.ao2).init(opt.jwk);
205
+ return new _index.AO(opt.ao2).init(opt.jwk);
206
206
  case 28:
207
207
  _ao2 = _context3.sent;
208
208
  console.log("cache:\t", optPath);
@@ -260,7 +260,7 @@ var setup = exports.setup = /*#__PURE__*/function () {
260
260
  return src.upload("aos2_0_1", "wasm");
261
261
  case 51:
262
262
  wasm_aos2 = _context3.sent;
263
- ao = new AO({
263
+ ao = new _index.AO({
264
264
  aoconnect: aoconnect,
265
265
  ar: ar,
266
266
  authority: auth
@@ -324,7 +324,7 @@ var setup = exports.setup = /*#__PURE__*/function () {
324
324
 
325
325
  // ao2
326
326
  _context3.next = 87;
327
- return new AO({
327
+ return new _index.AO({
328
328
  aoconnect: aoconnect,
329
329
  ar: ar,
330
330
  authority: auth,
@@ -0,0 +1,61 @@
1
+ local drive = { _version = "0.0.1" }
2
+
3
+ function drive.getBlock(height)
4
+ local block = io.open("/block/" .. height)
5
+ if not block then
6
+ return nil, "Block Header not found!"
7
+ end
8
+ local headers = require('json').decode(
9
+ block:read(
10
+ block:seek('end')
11
+ )
12
+ )
13
+ block:close()
14
+ return headers
15
+ end
16
+
17
+ function drive.getTx(txId)
18
+ local file = io.open('/tx/' .. txId)
19
+ if not file then
20
+ return nil, "File not found!"
21
+ end
22
+ local contents = require('json').decode(
23
+ file:read(
24
+ file:seek('end')
25
+ )
26
+ )
27
+ file:close()
28
+ return contents
29
+ end
30
+
31
+ function drive.getData(txId)
32
+ local file = io.open('/data/' .. txId)
33
+ if not file then
34
+ return nil, "File not found!"
35
+ end
36
+ local contents = file:read(
37
+ file:seek('end')
38
+ )
39
+ file:close()
40
+ return contents
41
+ end
42
+
43
+ function drive.getDataItem(txId)
44
+ local file = io.open('/tx2/' .. txId)
45
+ if not file then
46
+ return nil, "File not found!"
47
+ end
48
+ local contents = file:read(
49
+ file:seek('end')
50
+ )
51
+ file:close()
52
+ return contents
53
+ end
54
+
55
+ apm = {}
56
+
57
+ function apm.install (pkg)
58
+ if pkg == "@rakis/WeaveDrive" then
59
+ _G.package.loaded[pkg] = drive
60
+ end
61
+ end
package/esm/ao.js CHANGED
@@ -689,6 +689,7 @@ const getParams = (tags, opts) => {
689
689
  if (
690
690
  (!isNil(tags?.get) ||
691
691
  !isNil(tags?.check) ||
692
+ !isNil(tags?.data) ||
692
693
  is(Boolean, tags) ||
693
694
  is(String, tags)) &&
694
695
  isNil(opts)
package/esm/aoconnect.js CHANGED
@@ -1129,5 +1129,8 @@ export const connect = () => {
1129
1129
  return null
1130
1130
  },
1131
1131
  getProcesses: () => env,
1132
+ blueprint: async pkg => {
1133
+ return readFileSync(resolve(await dirname(), `lua/${pkg}.lua`), "utf8")
1134
+ },
1132
1135
  }
1133
1136
  }
package/esm/helpers.js CHANGED
@@ -1,4 +1,4 @@
1
- import { AR } from "./index.js"
1
+ import { AR, AO } from "./index.js"
2
2
  import assert from "assert"
3
3
  import { createDataItemSigner, connect } from "@permaweb/aoconnect"
4
4
  import { dirname as _dirname, resolve } from "path"
@@ -0,0 +1,61 @@
1
+ local drive = { _version = "0.0.1" }
2
+
3
+ function drive.getBlock(height)
4
+ local block = io.open("/block/" .. height)
5
+ if not block then
6
+ return nil, "Block Header not found!"
7
+ end
8
+ local headers = require('json').decode(
9
+ block:read(
10
+ block:seek('end')
11
+ )
12
+ )
13
+ block:close()
14
+ return headers
15
+ end
16
+
17
+ function drive.getTx(txId)
18
+ local file = io.open('/tx/' .. txId)
19
+ if not file then
20
+ return nil, "File not found!"
21
+ end
22
+ local contents = require('json').decode(
23
+ file:read(
24
+ file:seek('end')
25
+ )
26
+ )
27
+ file:close()
28
+ return contents
29
+ end
30
+
31
+ function drive.getData(txId)
32
+ local file = io.open('/data/' .. txId)
33
+ if not file then
34
+ return nil, "File not found!"
35
+ end
36
+ local contents = file:read(
37
+ file:seek('end')
38
+ )
39
+ file:close()
40
+ return contents
41
+ end
42
+
43
+ function drive.getDataItem(txId)
44
+ local file = io.open('/tx2/' .. txId)
45
+ if not file then
46
+ return nil, "File not found!"
47
+ end
48
+ local contents = file:read(
49
+ file:seek('end')
50
+ )
51
+ file:close()
52
+ return contents
53
+ end
54
+
55
+ apm = {}
56
+
57
+ function apm.install (pkg)
58
+ if pkg == "@rakis/WeaveDrive" then
59
+ _G.package.loaded[pkg] = drive
60
+ end
61
+ end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wao",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",