weavedb-node-client 0.9.3 → 0.9.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.
Files changed (2) hide show
  1. package/index.js +17 -3
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -43,6 +43,8 @@ class SDK extends Base {
43
43
  arweave_wallet,
44
44
  network,
45
45
  port = 1820,
46
+ secure,
47
+ cert = null,
46
48
  }) {
47
49
  super()
48
50
  this.contractTxId = contractTxId
@@ -69,7 +71,14 @@ class SDK extends Base {
69
71
  ? "localhost"
70
72
  : "mainnet")
71
73
 
72
- this.client = new weavedb_proto.DB(rpc, grpc.credentials.createInsecure())
74
+ const [rpc_host, rpc_port] = rpc.split(":")
75
+ this.secure = +rpc_port === 443 && isNil(secure) ? true : secure || false
76
+ this.client = new weavedb_proto.DB(
77
+ rpc,
78
+ this.secure
79
+ ? grpc.ChannelCredentials.createSsl()
80
+ : grpc.credentials.createInsecure()
81
+ )
73
82
  if (typeof window === "object") {
74
83
  require("@metamask/legacy-web3")
75
84
  this.web3 = window.web3
@@ -93,8 +102,13 @@ class SDK extends Base {
93
102
  return { nocache, query }
94
103
  }
95
104
 
96
- async _request(func, query, nocache = false) {
97
- if (!includes(func)(reads)) nocache = false
105
+ async _request(func, query, nocache, bundle, relay = false) {
106
+ if (!includes(func)(reads)) {
107
+ nocache = false
108
+ if (relay) {
109
+ return query
110
+ }
111
+ }
98
112
  const request = {
99
113
  method: `${func}@${this.contractTxId}`,
100
114
  query: JSON.stringify(query),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "weavedb-node-client",
3
- "version": "0.9.3",
3
+ "version": "0.9.5",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "engines": {