wao 0.2.4 → 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/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
@@ -0,0 +1,53 @@
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
package/esm/ao.js CHANGED
@@ -2,6 +2,7 @@ import * as WarpArBundles from "warp-arbundles"
2
2
  const pkg = WarpArBundles.default ? WarpArBundles.default : WarpArBundles
3
3
  const { createData, ArweaveSigner } = pkg
4
4
  import AR from "./ar.js"
5
+
5
6
  import {
6
7
  createDataItemSigner,
7
8
  connect,
@@ -688,6 +689,7 @@ const getParams = (tags, opts) => {
688
689
  if (
689
690
  (!isNil(tags?.get) ||
690
691
  !isNil(tags?.check) ||
692
+ !isNil(tags?.data) ||
691
693
  is(Boolean, tags) ||
692
694
  is(String, tags)) &&
693
695
  isNil(opts)