@peerbit/rpc 5.3.29 → 5.4.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/dist/src/controller.js +318 -277
- package/dist/src/controller.js.map +1 -1
- package/dist/src/encoding.js +121 -54
- package/dist/src/encoding.js.map +1 -1
- package/dist/src/io.d.ts +1 -2
- package/dist/src/io.d.ts.map +1 -1
- package/dist/src/io.js +1 -1
- package/dist/src/io.js.map +1 -1
- package/dist/src/utils.d.ts +1 -1
- package/dist/src/utils.d.ts.map +1 -1
- package/package.json +10 -10
- package/src/controller.ts +3 -3
- package/src/io.ts +1 -1
- package/src/utils.ts +1 -1
package/dist/src/controller.js
CHANGED
|
@@ -1,8 +1,36 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
2
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
3
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
4
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
5
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
6
|
+
var _, done = false;
|
|
7
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8
|
+
var context = {};
|
|
9
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
10
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
11
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
12
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
13
|
+
if (kind === "accessor") {
|
|
14
|
+
if (result === void 0) continue;
|
|
15
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
16
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
17
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
18
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
19
|
+
}
|
|
20
|
+
else if (_ = accept(result)) {
|
|
21
|
+
if (kind === "field") initializers.unshift(_);
|
|
22
|
+
else descriptor[key] = _;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
26
|
+
done = true;
|
|
27
|
+
};
|
|
28
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
29
|
+
var useValue = arguments.length > 2;
|
|
30
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
31
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
32
|
+
}
|
|
33
|
+
return useValue ? value : void 0;
|
|
6
34
|
};
|
|
7
35
|
import { BorshError, deserialize, serialize, variant, } from "@dao-xyz/borsh";
|
|
8
36
|
import { AccessError, DecryptedThing, MaybeEncrypted, PublicSignKey, X25519Keypair, X25519PublicKey, randomBytes, toBase64, } from "@peerbit/crypto";
|
|
@@ -21,306 +49,319 @@ const createValueResolver = (type) => {
|
|
|
21
49
|
return (decrypted) => decrypted.getValue(type);
|
|
22
50
|
}
|
|
23
51
|
};
|
|
24
|
-
let RPC =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
this._responseHandler = args.responseHandler;
|
|
39
|
-
this._requestType = args.queryType;
|
|
40
|
-
this._requestTypeIsUint8Array = this._requestType === Uint8Array;
|
|
41
|
-
this._responseType = args.responseType;
|
|
42
|
-
this._responseResolver = new Map();
|
|
43
|
-
this._getResponseValueFn = createValueResolver(this._responseType);
|
|
44
|
-
this._getRequestValueFn = createValueResolver(this._requestType);
|
|
45
|
-
this._keypair = await X25519Keypair.create();
|
|
46
|
-
await this.subscribe();
|
|
47
|
-
}
|
|
48
|
-
async _close(from) {
|
|
49
|
-
if (this._subscribed) {
|
|
50
|
-
await this.node.services.pubsub.unsubscribe(this.topic);
|
|
51
|
-
await this.node.services.pubsub.removeEventListener("data", this._onMessageBinded);
|
|
52
|
+
let RPC = (() => {
|
|
53
|
+
let _classDecorators = [variant("rpc")];
|
|
54
|
+
let _classDescriptor;
|
|
55
|
+
let _classExtraInitializers = [];
|
|
56
|
+
let _classThis;
|
|
57
|
+
let _classSuper = Program;
|
|
58
|
+
var RPC = class extends _classSuper {
|
|
59
|
+
static { _classThis = this; }
|
|
60
|
+
static {
|
|
61
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
62
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
63
|
+
RPC = _classThis = _classDescriptor.value;
|
|
64
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
65
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
52
66
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
67
|
+
_subscribed = false;
|
|
68
|
+
_responseHandler;
|
|
69
|
+
_responseResolver;
|
|
70
|
+
_requestType;
|
|
71
|
+
_requestTypeIsUint8Array;
|
|
72
|
+
_responseType;
|
|
73
|
+
_rpcTopic;
|
|
74
|
+
_onMessageBinded = undefined;
|
|
75
|
+
_keypair;
|
|
76
|
+
_getResponseValueFn;
|
|
77
|
+
_getRequestValueFn;
|
|
78
|
+
async open(args) {
|
|
79
|
+
this._rpcTopic = args.topic ?? this._rpcTopic;
|
|
80
|
+
this._responseHandler = args.responseHandler;
|
|
81
|
+
this._requestType = args.queryType;
|
|
82
|
+
this._requestTypeIsUint8Array = this._requestType === Uint8Array;
|
|
83
|
+
this._responseType = args.responseType;
|
|
84
|
+
this._responseResolver = new Map();
|
|
85
|
+
this._getResponseValueFn = createValueResolver(this._responseType);
|
|
86
|
+
this._getRequestValueFn = createValueResolver(this._requestType);
|
|
87
|
+
this._keypair = await X25519Keypair.create();
|
|
88
|
+
await this.subscribe();
|
|
68
89
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
90
|
+
async _close(from) {
|
|
91
|
+
if (this._subscribed) {
|
|
92
|
+
await this.node.services.pubsub.unsubscribe(this.topic);
|
|
93
|
+
await this.node.services.pubsub.removeEventListener("data", this._onMessageBinded);
|
|
94
|
+
}
|
|
95
|
+
this._subscribed = false;
|
|
96
|
+
}
|
|
97
|
+
async close(from) {
|
|
98
|
+
await this._close(from);
|
|
99
|
+
return super.close(from);
|
|
100
|
+
}
|
|
101
|
+
async drop(from) {
|
|
102
|
+
await this._close(from);
|
|
103
|
+
return super.drop(from);
|
|
104
|
+
}
|
|
105
|
+
_subscribing;
|
|
106
|
+
async subscribe() {
|
|
107
|
+
await this._subscribing;
|
|
108
|
+
if (this._subscribed) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
this._subscribed = true;
|
|
112
|
+
this._onMessageBinded = this._onMessageBinded || this._onMessage.bind(this);
|
|
113
|
+
this.node.services.pubsub.addEventListener("data", this._onMessageBinded);
|
|
114
|
+
this._subscribing = this.node.services.pubsub.subscribe(this.topic);
|
|
115
|
+
await this._subscribing;
|
|
116
|
+
logger.trace("subscribing to query topic (responses): " + this.topic);
|
|
117
|
+
}
|
|
118
|
+
async _onMessage(evt) {
|
|
119
|
+
const { data, message } = evt.detail;
|
|
120
|
+
if (data?.topics.find((x) => x === this.topic) != null) {
|
|
121
|
+
try {
|
|
122
|
+
const rpcMessage = deserialize(data.data, RPCMessage);
|
|
123
|
+
if (rpcMessage instanceof RequestV0) {
|
|
124
|
+
if (this._responseHandler) {
|
|
125
|
+
const maybeEncrypted = rpcMessage.request;
|
|
126
|
+
const decrypted = await maybeEncrypted.decrypt(this.node.services.keychain);
|
|
127
|
+
const request = this._getRequestValueFn(decrypted);
|
|
128
|
+
let from = message.header.signatures.publicKeys[0];
|
|
129
|
+
this.events.dispatchEvent(new CustomEvent("request", {
|
|
130
|
+
// TODO should this event also be emitted if the responseHandler is omitted?
|
|
131
|
+
detail: {
|
|
132
|
+
request,
|
|
133
|
+
message: message,
|
|
134
|
+
from: from,
|
|
135
|
+
},
|
|
136
|
+
}));
|
|
137
|
+
const response = await this._responseHandler(request, {
|
|
138
|
+
from,
|
|
91
139
|
message: message,
|
|
92
|
-
from: from,
|
|
93
|
-
},
|
|
94
|
-
}));
|
|
95
|
-
const response = await this._responseHandler(request, {
|
|
96
|
-
from,
|
|
97
|
-
message: message,
|
|
98
|
-
});
|
|
99
|
-
if (response && rpcMessage.respondTo) {
|
|
100
|
-
// send query and wait for replies in a generator like behaviour
|
|
101
|
-
const serializedResponse = serialize(response);
|
|
102
|
-
// we use the peerId/libp2p identity for signatures, since we want to be able to send a message
|
|
103
|
-
// with pubsub with a certain receiver. If we use (this.identity) we are going to use an identity
|
|
104
|
-
// that is now known in the .pubsub network, hence the message might not be delivired if we
|
|
105
|
-
// send with { to: [RECIEVER] } param
|
|
106
|
-
const decryptedMessage = new DecryptedThing({
|
|
107
|
-
data: serializedResponse,
|
|
108
|
-
});
|
|
109
|
-
let maybeEncryptedMessage = decryptedMessage;
|
|
110
|
-
maybeEncryptedMessage = await decryptedMessage.encrypt(this._keypair, [rpcMessage.respondTo]);
|
|
111
|
-
await this.node.services.pubsub.publish(serialize(new ResponseV0({
|
|
112
|
-
response: maybeEncryptedMessage,
|
|
113
|
-
requestId: message.id,
|
|
114
|
-
})), {
|
|
115
|
-
topics: [this.topic],
|
|
116
|
-
priority: message.header.priority, // send back with same priority. TODO, make this better in the future
|
|
117
|
-
/// TODO make redundancy parameter configurable?
|
|
118
|
-
mode: new SilentDelivery({
|
|
119
|
-
to: [message.header.signatures.publicKeys[0]],
|
|
120
|
-
redundancy: 1,
|
|
121
|
-
}),
|
|
122
140
|
});
|
|
141
|
+
if (response && rpcMessage.respondTo) {
|
|
142
|
+
// send query and wait for replies in a generator like behaviour
|
|
143
|
+
const serializedResponse = serialize(response);
|
|
144
|
+
// we use the peerId/libp2p identity for signatures, since we want to be able to send a message
|
|
145
|
+
// with pubsub with a certain receiver. If we use (this.identity) we are going to use an identity
|
|
146
|
+
// that is now known in the .pubsub network, hence the message might not be delivired if we
|
|
147
|
+
// send with { to: [RECIEVER] } param
|
|
148
|
+
const decryptedMessage = new DecryptedThing({
|
|
149
|
+
data: serializedResponse,
|
|
150
|
+
});
|
|
151
|
+
let maybeEncryptedMessage = decryptedMessage;
|
|
152
|
+
maybeEncryptedMessage = await decryptedMessage.encrypt(this._keypair, [rpcMessage.respondTo]);
|
|
153
|
+
await this.node.services.pubsub.publish(serialize(new ResponseV0({
|
|
154
|
+
response: maybeEncryptedMessage,
|
|
155
|
+
requestId: message.id,
|
|
156
|
+
})), {
|
|
157
|
+
topics: [this.topic],
|
|
158
|
+
priority: message.header.priority, // send back with same priority. TODO, make this better in the future
|
|
159
|
+
/// TODO make redundancy parameter configurable?
|
|
160
|
+
mode: new SilentDelivery({
|
|
161
|
+
to: [message.header.signatures.publicKeys[0]],
|
|
162
|
+
redundancy: 1,
|
|
163
|
+
}),
|
|
164
|
+
});
|
|
165
|
+
}
|
|
123
166
|
}
|
|
124
167
|
}
|
|
168
|
+
else if (rpcMessage instanceof ResponseV0) {
|
|
169
|
+
const id = toBase64(rpcMessage.requestId);
|
|
170
|
+
const handler = this._responseResolver.get(id);
|
|
171
|
+
// TODO evaluate when and how handler can be missing
|
|
172
|
+
handler?.({
|
|
173
|
+
message,
|
|
174
|
+
response: rpcMessage,
|
|
175
|
+
});
|
|
176
|
+
}
|
|
125
177
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
178
|
+
catch (error) {
|
|
179
|
+
if (error instanceof AccessError) {
|
|
180
|
+
logger.trace("Got message I could not decrypt");
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
if (error instanceof BorshError) {
|
|
184
|
+
logger.error("Got message for a different namespace");
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
logger.error("Error handling query: " +
|
|
188
|
+
(error?.message ? error?.message?.toString() : error));
|
|
134
189
|
}
|
|
135
190
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
191
|
+
}
|
|
192
|
+
async seal(request, respondTo, options) {
|
|
193
|
+
const requestData = this._requestTypeIsUint8Array
|
|
194
|
+
? request
|
|
195
|
+
: serialize(request);
|
|
196
|
+
const decryptedMessage = new DecryptedThing({
|
|
197
|
+
data: requestData,
|
|
198
|
+
});
|
|
199
|
+
let maybeEncryptedMessage = decryptedMessage;
|
|
200
|
+
if (options?.encryption?.responders &&
|
|
201
|
+
options?.encryption?.responders.length > 0) {
|
|
202
|
+
maybeEncryptedMessage = await decryptedMessage.encrypt(options.encryption.key, options.encryption.responders);
|
|
147
203
|
}
|
|
204
|
+
const requestMessage = new RequestV0({
|
|
205
|
+
request: maybeEncryptedMessage,
|
|
206
|
+
respondTo,
|
|
207
|
+
});
|
|
208
|
+
return requestMessage;
|
|
148
209
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
if (options?.encryption?.responders &&
|
|
159
|
-
options?.encryption?.responders.length > 0) {
|
|
160
|
-
maybeEncryptedMessage = await decryptedMessage.encrypt(options.encryption.key, options.encryption.responders);
|
|
210
|
+
getPublishOptions(id, options, signal) {
|
|
211
|
+
return {
|
|
212
|
+
id,
|
|
213
|
+
priority: options?.priority,
|
|
214
|
+
mode: options?.mode,
|
|
215
|
+
topics: [this.topic],
|
|
216
|
+
extraSigners: options?.extraSigners,
|
|
217
|
+
signal,
|
|
218
|
+
};
|
|
161
219
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
handleDecodedResponse(response, promise, allResults, responders, expectedResponders, options) {
|
|
187
|
-
this.events.dispatchEvent(new CustomEvent("response", {
|
|
188
|
-
detail: response,
|
|
189
|
-
}));
|
|
190
|
-
if (expectedResponders) {
|
|
191
|
-
if (response.from && expectedResponders?.has(response.from.hashcode())) {
|
|
220
|
+
/**
|
|
221
|
+
* Send message and don't expect any response
|
|
222
|
+
* @param message
|
|
223
|
+
* @param options
|
|
224
|
+
*/
|
|
225
|
+
async send(message, options) {
|
|
226
|
+
await this.node.services.pubsub.publish(serialize(await this.seal(message, undefined, options)), this.getPublishOptions(undefined, options));
|
|
227
|
+
}
|
|
228
|
+
handleDecodedResponse(response, promise, allResults, responders, expectedResponders, options) {
|
|
229
|
+
this.events.dispatchEvent(new CustomEvent("response", {
|
|
230
|
+
detail: response,
|
|
231
|
+
}));
|
|
232
|
+
if (expectedResponders) {
|
|
233
|
+
if (response.from && expectedResponders?.has(response.from.hashcode())) {
|
|
234
|
+
options?.onResponse &&
|
|
235
|
+
options?.onResponse(response.response, response.from);
|
|
236
|
+
allResults.push(response);
|
|
237
|
+
responders.add(response.from.hashcode());
|
|
238
|
+
if (responders.size === expectedResponders.size) {
|
|
239
|
+
promise.resolve();
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
192
244
|
options?.onResponse &&
|
|
193
245
|
options?.onResponse(response.response, response.from);
|
|
194
246
|
allResults.push(response);
|
|
195
|
-
|
|
196
|
-
|
|
247
|
+
if (options?.amount != null &&
|
|
248
|
+
allResults.length >= options?.amount) {
|
|
197
249
|
promise.resolve();
|
|
198
250
|
}
|
|
199
251
|
}
|
|
200
252
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
253
|
+
createResponseHandler(promise, keypair, allResults, responders, expectedResponders, options) {
|
|
254
|
+
return async (properties) => {
|
|
255
|
+
try {
|
|
256
|
+
const { response, message } = properties;
|
|
257
|
+
const from = message.header.signatures.publicKeys[0];
|
|
258
|
+
if (options?.isTrusted && !(await options?.isTrusted(from))) {
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
const maybeEncrypted = response.response;
|
|
262
|
+
const decrypted = await maybeEncrypted.decrypt(keypair);
|
|
263
|
+
const resultData = this._getResponseValueFn(decrypted);
|
|
264
|
+
this.handleDecodedResponse({
|
|
265
|
+
response: resultData,
|
|
266
|
+
message: message,
|
|
267
|
+
from: from,
|
|
268
|
+
}, promise, allResults, responders, expectedResponders, options);
|
|
269
|
+
}
|
|
270
|
+
catch (error) {
|
|
271
|
+
if (error instanceof AccessError) {
|
|
272
|
+
return; // Ignore things we can not open
|
|
273
|
+
}
|
|
274
|
+
if (error instanceof BorshError) {
|
|
275
|
+
logger.trace("Namespace error");
|
|
276
|
+
return; // Name space conflict most likely
|
|
277
|
+
}
|
|
278
|
+
logger.error("failed ot deserialize query response: " + error?.message);
|
|
279
|
+
promise.reject(error);
|
|
280
|
+
}
|
|
281
|
+
};
|
|
209
282
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
283
|
+
/**
|
|
284
|
+
* Send a request and expect a response
|
|
285
|
+
* @param request
|
|
286
|
+
* @param options
|
|
287
|
+
* @returns
|
|
288
|
+
*/
|
|
289
|
+
async request(request, options) {
|
|
290
|
+
// We are generatinga new encryption keypair for each send, so we now that when we get the responses, they are encrypted specifcally for me, and for this request
|
|
291
|
+
// this allows us to easily disregard a bunch of message just beacuse they are for a different receiver!
|
|
292
|
+
const keypair = await X25519Keypair.create();
|
|
293
|
+
const requestMessage = await this.seal(request, keypair.publicKey, options);
|
|
294
|
+
const requestBytes = serialize(requestMessage);
|
|
295
|
+
const allResults = [];
|
|
296
|
+
const deferredPromise = pDefer();
|
|
297
|
+
if (this.closed) {
|
|
298
|
+
throw new AbortError("Closed");
|
|
299
|
+
}
|
|
300
|
+
const timeoutFn = setTimeout(() => {
|
|
301
|
+
deferredPromise.resolve();
|
|
302
|
+
}, options?.timeout || 10 * 1000);
|
|
303
|
+
const abortListener = (err) => {
|
|
304
|
+
deferredPromise.reject(err.target?.["reason"] || new AbortError());
|
|
305
|
+
};
|
|
306
|
+
options?.signal?.addEventListener("abort", abortListener);
|
|
307
|
+
const closeListener = () => {
|
|
308
|
+
deferredPromise.reject(new AbortError("Closed"));
|
|
309
|
+
};
|
|
310
|
+
const dropListener = () => {
|
|
311
|
+
deferredPromise.reject(new AbortError("Dropped"));
|
|
312
|
+
};
|
|
313
|
+
this.events.addEventListener("close", closeListener);
|
|
314
|
+
this.events.addEventListener("drop", dropListener);
|
|
315
|
+
const expectedResponders = options?.mode && deliveryModeHasReceiver(options.mode)
|
|
316
|
+
? new Set(options.mode.to)
|
|
317
|
+
: undefined;
|
|
318
|
+
const responders = new Set();
|
|
319
|
+
const messageId = randomBytes(32);
|
|
320
|
+
const id = toBase64(messageId);
|
|
321
|
+
const responseHandler = this.createResponseHandler(deferredPromise, keypair, allResults, responders, expectedResponders, options);
|
|
322
|
+
this._responseResolver.set(id, responseHandler);
|
|
323
|
+
let signal = undefined;
|
|
324
|
+
if (options?.responseInterceptor) {
|
|
325
|
+
const abortController = new AbortController();
|
|
326
|
+
deferredPromise.promise.finally(() => {
|
|
327
|
+
abortController.abort(new AbortError("Resolved early"));
|
|
328
|
+
});
|
|
329
|
+
signal = abortController.signal;
|
|
330
|
+
options.responseInterceptor((response) => {
|
|
331
|
+
return this.handleDecodedResponse(response, deferredPromise, allResults, responders, expectedResponders, options);
|
|
332
|
+
});
|
|
333
|
+
}
|
|
213
334
|
try {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
if (options?.isTrusted && !(await options?.isTrusted(from))) {
|
|
217
|
-
return;
|
|
218
|
-
}
|
|
219
|
-
const maybeEncrypted = response.response;
|
|
220
|
-
const decrypted = await maybeEncrypted.decrypt(keypair);
|
|
221
|
-
const resultData = this._getResponseValueFn(decrypted);
|
|
222
|
-
this.handleDecodedResponse({
|
|
223
|
-
response: resultData,
|
|
224
|
-
message: message,
|
|
225
|
-
from: from,
|
|
226
|
-
}, promise, allResults, responders, expectedResponders, options);
|
|
335
|
+
await this.node.services.pubsub.publish(requestBytes, this.getPublishOptions(messageId, options, signal));
|
|
336
|
+
await deferredPromise.promise;
|
|
227
337
|
}
|
|
228
338
|
catch (error) {
|
|
229
|
-
if (error instanceof
|
|
230
|
-
|
|
339
|
+
if (error instanceof TimeoutError === false &&
|
|
340
|
+
error instanceof AbortError === false) {
|
|
341
|
+
throw error;
|
|
231
342
|
}
|
|
232
|
-
|
|
233
|
-
logger.debug("Namespace error");
|
|
234
|
-
return; // Name space conflict most likely
|
|
235
|
-
}
|
|
236
|
-
logger.error("failed ot deserialize query response: " + error?.message);
|
|
237
|
-
promise.reject(error);
|
|
343
|
+
// Ignore timeout errors only
|
|
238
344
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
* @returns
|
|
246
|
-
*/
|
|
247
|
-
async request(request, options) {
|
|
248
|
-
// We are generatinga new encryption keypair for each send, so we now that when we get the responses, they are encrypted specifcally for me, and for this request
|
|
249
|
-
// this allows us to easily disregard a bunch of message just beacuse they are for a different receiver!
|
|
250
|
-
const keypair = await X25519Keypair.create();
|
|
251
|
-
const requestMessage = await this.seal(request, keypair.publicKey, options);
|
|
252
|
-
const requestBytes = serialize(requestMessage);
|
|
253
|
-
const allResults = [];
|
|
254
|
-
const deferredPromise = pDefer();
|
|
255
|
-
if (this.closed) {
|
|
256
|
-
throw new AbortError("Closed");
|
|
257
|
-
}
|
|
258
|
-
const timeoutFn = setTimeout(() => {
|
|
259
|
-
deferredPromise.resolve();
|
|
260
|
-
}, options?.timeout || 10 * 1000);
|
|
261
|
-
const abortListener = (err) => {
|
|
262
|
-
deferredPromise.reject(err.target?.["reason"] || new AbortError());
|
|
263
|
-
};
|
|
264
|
-
options?.signal?.addEventListener("abort", abortListener);
|
|
265
|
-
const closeListener = () => {
|
|
266
|
-
deferredPromise.reject(new AbortError("Closed"));
|
|
267
|
-
};
|
|
268
|
-
const dropListener = () => {
|
|
269
|
-
deferredPromise.reject(new AbortError("Dropped"));
|
|
270
|
-
};
|
|
271
|
-
this.events.addEventListener("close", closeListener);
|
|
272
|
-
this.events.addEventListener("drop", dropListener);
|
|
273
|
-
const expectedResponders = options?.mode && deliveryModeHasReceiver(options.mode)
|
|
274
|
-
? new Set(options.mode.to)
|
|
275
|
-
: undefined;
|
|
276
|
-
const responders = new Set();
|
|
277
|
-
const messageId = randomBytes(32);
|
|
278
|
-
const id = toBase64(messageId);
|
|
279
|
-
const responseHandler = this.createResponseHandler(deferredPromise, keypair, allResults, responders, expectedResponders, options);
|
|
280
|
-
this._responseResolver.set(id, responseHandler);
|
|
281
|
-
let signal = undefined;
|
|
282
|
-
if (options?.responseInterceptor) {
|
|
283
|
-
const abortController = new AbortController();
|
|
284
|
-
deferredPromise.promise.finally(() => {
|
|
285
|
-
abortController.abort(new AbortError("Resolved early"));
|
|
286
|
-
});
|
|
287
|
-
signal = abortController.signal;
|
|
288
|
-
options.responseInterceptor((response) => {
|
|
289
|
-
return this.handleDecodedResponse(response, deferredPromise, allResults, responders, expectedResponders, options);
|
|
290
|
-
});
|
|
291
|
-
}
|
|
292
|
-
try {
|
|
293
|
-
await this.node.services.pubsub.publish(requestBytes, this.getPublishOptions(messageId, options, signal));
|
|
294
|
-
await deferredPromise.promise;
|
|
295
|
-
}
|
|
296
|
-
catch (error) {
|
|
297
|
-
if (error instanceof TimeoutError === false &&
|
|
298
|
-
error instanceof AbortError === false) {
|
|
299
|
-
throw error;
|
|
345
|
+
finally {
|
|
346
|
+
clearTimeout(timeoutFn);
|
|
347
|
+
this.events.removeEventListener("close", closeListener);
|
|
348
|
+
this.events.removeEventListener("drop", dropListener);
|
|
349
|
+
options?.signal?.removeEventListener("abort", abortListener);
|
|
350
|
+
this._responseResolver.delete(id);
|
|
300
351
|
}
|
|
301
|
-
|
|
352
|
+
return deferredPromise.promise.then(() => allResults);
|
|
302
353
|
}
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
this._responseResolver.delete(id);
|
|
354
|
+
get topic() {
|
|
355
|
+
if (!this._rpcTopic) {
|
|
356
|
+
throw new Error("Not initialized");
|
|
357
|
+
}
|
|
358
|
+
return this._rpcTopic;
|
|
309
359
|
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
get topic() {
|
|
313
|
-
if (!this._rpcTopic) {
|
|
314
|
-
throw new Error("Not initialized");
|
|
360
|
+
getTopics() {
|
|
361
|
+
return [this.topic];
|
|
315
362
|
}
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
return [this.topic];
|
|
320
|
-
}
|
|
321
|
-
};
|
|
322
|
-
RPC = __decorate([
|
|
323
|
-
variant("rpc")
|
|
324
|
-
], RPC);
|
|
363
|
+
};
|
|
364
|
+
return RPC = _classThis;
|
|
365
|
+
})();
|
|
325
366
|
export { RPC };
|
|
326
367
|
//# sourceMappingURL=controller.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.js","sourceRoot":"","sources":["../../src/controller.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAEN,UAAU,EACV,WAAW,EACX,SAAS,EACT,OAAO,GACP,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACN,WAAW,EACX,cAAc,EACd,cAAc,EACd,aAAa,EACb,aAAa,EACb,eAAe,EACf,WAAW,EACX,QAAQ,GACR,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,OAAO,EAAsB,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EACN,SAAS,GAET,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACN,WAAW,EAEX,cAAc,EAGd,uBAAuB,GACvB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,MAAM,EAAE,EAAwB,MAAM,SAAS,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,EAIN,MAAM,GACN,MAAM,SAAS,CAAC;AAiBjB,MAAM,mBAAmB,GAAG,CAC3B,IAAkC,EACY,EAAE;IAChD,IAAK,IAAY,KAAK,UAAU,EAAE,CAAC;QAClC,OAAO,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CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;gBACrB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;YACpC,CAAC;YACD,OAAO,IAAI,CAAC,SAAS,CAAC;QACvB,CAAC;QAED,SAAS;YACR,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;;;;SA5bW,GAAG"}
|
package/dist/src/encoding.js
CHANGED
|
@@ -1,62 +1,129 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
2
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
3
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
4
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
5
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
6
|
+
var _, done = false;
|
|
7
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8
|
+
var context = {};
|
|
9
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
10
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
11
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
12
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
13
|
+
if (kind === "accessor") {
|
|
14
|
+
if (result === void 0) continue;
|
|
15
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
16
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
17
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
18
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
19
|
+
}
|
|
20
|
+
else if (_ = accept(result)) {
|
|
21
|
+
if (kind === "field") initializers.unshift(_);
|
|
22
|
+
else descriptor[key] = _;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
26
|
+
done = true;
|
|
6
27
|
};
|
|
7
|
-
var
|
|
8
|
-
|
|
28
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
29
|
+
var useValue = arguments.length > 2;
|
|
30
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
31
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
32
|
+
}
|
|
33
|
+
return useValue ? value : void 0;
|
|
9
34
|
};
|
|
10
35
|
import { field, fixedArray, option, variant } from "@dao-xyz/borsh";
|
|
11
36
|
import { MaybeEncrypted, X25519PublicKey } from "@peerbit/crypto";
|
|
12
|
-
let RPCMessage =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
37
|
+
let RPCMessage = (() => {
|
|
38
|
+
let _classDecorators = [variant(0)];
|
|
39
|
+
let _classDescriptor;
|
|
40
|
+
let _classExtraInitializers = [];
|
|
41
|
+
let _classThis;
|
|
42
|
+
var RPCMessage = class {
|
|
43
|
+
static { _classThis = this; }
|
|
44
|
+
static {
|
|
45
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
46
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
47
|
+
RPCMessage = _classThis = _classDescriptor.value;
|
|
48
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
49
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
return RPCMessage = _classThis;
|
|
53
|
+
})();
|
|
17
54
|
export { RPCMessage };
|
|
18
|
-
let RequestV0 =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
55
|
+
let RequestV0 = (() => {
|
|
56
|
+
let _classDecorators = [variant(0)];
|
|
57
|
+
let _classDescriptor;
|
|
58
|
+
let _classExtraInitializers = [];
|
|
59
|
+
let _classThis;
|
|
60
|
+
let _classSuper = RPCMessage;
|
|
61
|
+
let _respondTo_decorators;
|
|
62
|
+
let _respondTo_initializers = [];
|
|
63
|
+
let _respondTo_extraInitializers = [];
|
|
64
|
+
let _request_decorators;
|
|
65
|
+
let _request_initializers = [];
|
|
66
|
+
let _request_extraInitializers = [];
|
|
67
|
+
var RequestV0 = class extends _classSuper {
|
|
68
|
+
static { _classThis = this; }
|
|
69
|
+
static {
|
|
70
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
71
|
+
_respondTo_decorators = [field({ type: option(X25519PublicKey) })];
|
|
72
|
+
_request_decorators = [field({ type: MaybeEncrypted })];
|
|
73
|
+
__esDecorate(null, null, _respondTo_decorators, { kind: "field", name: "respondTo", static: false, private: false, access: { has: obj => "respondTo" in obj, get: obj => obj.respondTo, set: (obj, value) => { obj.respondTo = value; } }, metadata: _metadata }, _respondTo_initializers, _respondTo_extraInitializers);
|
|
74
|
+
__esDecorate(null, null, _request_decorators, { kind: "field", name: "request", static: false, private: false, access: { has: obj => "request" in obj, get: obj => obj.request, set: (obj, value) => { obj.request = value; } }, metadata: _metadata }, _request_initializers, _request_extraInitializers);
|
|
75
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
76
|
+
RequestV0 = _classThis = _classDescriptor.value;
|
|
77
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
78
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
79
|
+
}
|
|
80
|
+
respondTo = __runInitializers(this, _respondTo_initializers, void 0);
|
|
81
|
+
request = (__runInitializers(this, _respondTo_extraInitializers), __runInitializers(this, _request_initializers, void 0));
|
|
82
|
+
constructor(properties) {
|
|
83
|
+
super();
|
|
84
|
+
__runInitializers(this, _request_extraInitializers);
|
|
85
|
+
this.respondTo = properties.respondTo;
|
|
86
|
+
this.request = properties.request;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
return RequestV0 = _classThis;
|
|
90
|
+
})();
|
|
39
91
|
export { RequestV0 };
|
|
40
|
-
let ResponseV0 =
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
92
|
+
let ResponseV0 = (() => {
|
|
93
|
+
let _classDecorators = [variant(1)];
|
|
94
|
+
let _classDescriptor;
|
|
95
|
+
let _classExtraInitializers = [];
|
|
96
|
+
let _classThis;
|
|
97
|
+
let _classSuper = RPCMessage;
|
|
98
|
+
let _requestId_decorators;
|
|
99
|
+
let _requestId_initializers = [];
|
|
100
|
+
let _requestId_extraInitializers = [];
|
|
101
|
+
let _response_decorators;
|
|
102
|
+
let _response_initializers = [];
|
|
103
|
+
let _response_extraInitializers = [];
|
|
104
|
+
var ResponseV0 = class extends _classSuper {
|
|
105
|
+
static { _classThis = this; }
|
|
106
|
+
static {
|
|
107
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
108
|
+
_requestId_decorators = [field({ type: fixedArray("u8", 32) })];
|
|
109
|
+
_response_decorators = [field({ type: MaybeEncrypted })];
|
|
110
|
+
__esDecorate(null, null, _requestId_decorators, { kind: "field", name: "requestId", static: false, private: false, access: { has: obj => "requestId" in obj, get: obj => obj.requestId, set: (obj, value) => { obj.requestId = value; } }, metadata: _metadata }, _requestId_initializers, _requestId_extraInitializers);
|
|
111
|
+
__esDecorate(null, null, _response_decorators, { kind: "field", name: "response", static: false, private: false, access: { has: obj => "response" in obj, get: obj => obj.response, set: (obj, value) => { obj.response = value; } }, metadata: _metadata }, _response_initializers, _response_extraInitializers);
|
|
112
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
113
|
+
ResponseV0 = _classThis = _classDescriptor.value;
|
|
114
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
115
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
116
|
+
}
|
|
117
|
+
requestId = __runInitializers(this, _requestId_initializers, void 0);
|
|
118
|
+
response = (__runInitializers(this, _requestId_extraInitializers), __runInitializers(this, _response_initializers, void 0));
|
|
119
|
+
constructor(properties) {
|
|
120
|
+
super();
|
|
121
|
+
__runInitializers(this, _response_extraInitializers);
|
|
122
|
+
this.response = properties.response;
|
|
123
|
+
this.requestId = properties.requestId;
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
return ResponseV0 = _classThis;
|
|
127
|
+
})();
|
|
61
128
|
export { ResponseV0 };
|
|
62
129
|
//# sourceMappingURL=encoding.js.map
|
package/dist/src/encoding.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encoding.js","sourceRoot":"","sources":["../../src/encoding.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"encoding.js","sourceRoot":"","sources":["../../src/encoding.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;IAG5C,UAAU;4BAD/B,OAAO,CAAC,CAAC,CAAC;;;;;;;;YACX,6KAAmC;;;YAAb,uDAAU;;;;;SAAV,UAAU;IAGnB,SAAS;4BADrB,OAAO,CAAC,CAAC,CAAC;;;;sBACoB,UAAU;;;;;;;yBAAlB,SAAQ,WAAU;;;;qCACvC,KAAK,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,eAAe,CAAC,EAAE,CAAC;mCAGxC,KAAK,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;YAFhC,6KAAA,SAAS,6BAAT,SAAS,6FAAmB;YAG5B,uKAAA,OAAO,6BAAP,OAAO,yFAAsB;YAL9B,6KAeC;;;YAfY,uDAAS;;QAErB,SAAS,4DAAmB;QAG5B,OAAO,mHAAsB;QAE7B,YAAY,UAGX;YACA,KAAK,EAAE,CAAC;;YACR,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;YACtC,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC;SAClC;;;;SAdW,SAAS;IAkBT,UAAU;4BADtB,OAAO,CAAC,CAAC,CAAC;;;;sBACqB,UAAU;;;;;;;0BAAlB,SAAQ,WAAU;;;;qCACxC,KAAK,CAAC,EAAE,IAAI,EAAE,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC;oCAGrC,KAAK,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;YAFhC,6KAAA,SAAS,6BAAT,SAAS,6FAAa;YAGtB,0KAAA,QAAQ,6BAAR,QAAQ,2FAAsB;YAL/B,6KAeC;;;YAfY,uDAAU;;QAEtB,SAAS,4DAAa;QAGtB,QAAQ,oHAAsB;QAE9B,YAAY,UAGX;YACA,KAAK,EAAE,CAAC;;YACR,IAAI,CAAC,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC;YACpC,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;SACtC;;;;SAdW,UAAU"}
|
package/dist/src/io.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { Ed25519PublicKey, PublicSignKey, X25519Keypair, X25519PublicKey } from "@peerbit/crypto";
|
|
2
|
-
import { logger as loggerFn } from "@peerbit/logger";
|
|
3
2
|
import type { DataMessage, PriorityOptions, WithExtraSigners, WithMode } from "@peerbit/stream-interface";
|
|
4
|
-
export declare const logger:
|
|
3
|
+
export declare const logger: import("@libp2p/interface").Logger;
|
|
5
4
|
export type RPCRequestResponseOptions<R> = {
|
|
6
5
|
amount?: number;
|
|
7
6
|
timeout?: number;
|
package/dist/src/io.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"io.d.ts","sourceRoot":"","sources":["../../src/io.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,eAAe,EACf,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"io.d.ts","sourceRoot":"","sources":["../../src/io.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,eAAe,EACf,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EACX,WAAW,EACX,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACR,MAAM,2BAA2B,CAAC;AAEnC,eAAO,MAAM,MAAM,oCAA0B,CAAC;AAC9C,MAAM,MAAM,yBAAyB,CAAC,CAAC,IAAI;IAC1C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,CAAC,SAAS,EAAE,aAAa,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3D,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,aAAa,KAAK,IAAI,CAAC;IACzD,MAAM,CAAC,EAAE,WAAW,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,0BAA0B,CAAC,CAAC,IAAI;IAC3C,mBAAmB,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI,KAAK,IAAI,CAAC;CACvE,CAAC;AAEF,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI,yBAAyB,CAAC,CAAC,CAAC,GAC9D,iBAAiB,GACjB,QAAQ,GACR,eAAe,GACf,gBAAgB,GAChB,0BAA0B,CAAC,CAAC,CAAC,CAAC;AAE/B,MAAM,MAAM,iBAAiB,GAAG;IAC/B,UAAU,CAAC,EAAE;QACZ,GAAG,EAAE,aAAa,CAAC;QACnB,UAAU,CAAC,EAAE,CAAC,eAAe,GAAG,gBAAgB,CAAC,EAAE,CAAC;KACpD,CAAC;CACF,CAAC;AAEF,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI;IAC5B,QAAQ,EAAE,CAAC,CAAC;IACZ,OAAO,EAAE,WAAW,CAAC;IACrB,IAAI,CAAC,EAAE,aAAa,CAAC;CACrB,CAAC"}
|
package/dist/src/io.js
CHANGED
package/dist/src/io.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"io.js","sourceRoot":"","sources":["../../src/io.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,MAAM,IAAI,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAQrD,MAAM,CAAC,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"io.js","sourceRoot":"","sources":["../../src/io.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,MAAM,IAAI,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAQrD,MAAM,CAAC,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC"}
|
package/dist/src/utils.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { EncryptionOptions, RPCRequestResponseOptions, RPCResponse, Request
|
|
|
5
5
|
export declare class MissingResponsesError extends Error {
|
|
6
6
|
constructor(message: string);
|
|
7
7
|
}
|
|
8
|
-
export type RPCRequestAllOptions<
|
|
8
|
+
export type RPCRequestAllOptions<_Q, R> = RPCRequestResponseOptions<R> & EncryptionOptions & {
|
|
9
9
|
mode?: Constructor<DeliveryMode>;
|
|
10
10
|
} & PriorityOptions & RequestResponseInterceptor<R>;
|
|
11
11
|
export declare const queryAll: <Q, R>(rpc: RPC<Q, R>, groups: string[][], request: Q, responseHandler: (response: RPCResponse<R>[]) => Promise<void> | void, options?: RPCRequestAllOptions<Q, R> | undefined) => Promise<void>;
|
package/dist/src/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,eAAe,EAEpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,KAAK,EACX,iBAAiB,EACjB,yBAAyB,EACzB,WAAW,EACX,0BAA0B,EAC1B,MAAM,SAAS,CAAC;AAEjB,qBAAa,qBAAsB,SAAQ,KAAK;gBACnC,OAAO,EAAE,MAAM;CAG3B;AACD,MAAM,MAAM,oBAAoB,CAAC,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,eAAe,EAEpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,KAAK,EACX,iBAAiB,EACjB,yBAAyB,EACzB,WAAW,EACX,0BAA0B,EAC1B,MAAM,SAAS,CAAC;AAEjB,qBAAa,qBAAsB,SAAQ,KAAK;gBACnC,OAAO,EAAE,MAAM;CAG3B;AACD,MAAM,MAAM,oBAAoB,CAAC,EAAE,EAAE,CAAC,IAAI,yBAAyB,CAAC,CAAC,CAAC,GACrE,iBAAiB,GAAG;IAAE,IAAI,CAAC,EAAE,WAAW,CAAC,YAAY,CAAC,CAAA;CAAE,GAAG,eAAe,GAC1E,0BAA0B,CAAC,CAAC,CAAC,CAAC;AAE/B,eAAO,MAAM,QAAQ,GAAU,CAAC,EAAE,CAAC,EAClC,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EACd,QAAQ,MAAM,EAAE,EAAE,EAClB,SAAS,CAAC,EACV,iBAAiB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,EACrE,UAAU,oBAAoB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,SAAS,kBA4DhD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@peerbit/rpc",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.4.1",
|
|
4
4
|
"description": "RPC calls for peers",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"type": "module",
|
|
@@ -52,18 +52,18 @@
|
|
|
52
52
|
"author": "dao.xyz",
|
|
53
53
|
"license": "MIT",
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@dao-xyz/borsh": "^
|
|
55
|
+
"@dao-xyz/borsh": "^6.0.0",
|
|
56
56
|
"p-defer": "^4.0.0",
|
|
57
|
-
"@peerbit/crypto": "2.
|
|
58
|
-
"@peerbit/logger": "
|
|
59
|
-
"@peerbit/program": "
|
|
60
|
-
"@peerbit/time": "2.
|
|
61
|
-
"@peerbit/pubsub": "4.0
|
|
62
|
-
"@peerbit/pubsub-interface": "4.0
|
|
63
|
-
"@peerbit/stream-interface": "5.
|
|
57
|
+
"@peerbit/crypto": "2.4.0",
|
|
58
|
+
"@peerbit/logger": "2.0.0",
|
|
59
|
+
"@peerbit/program": "1.1.0",
|
|
60
|
+
"@peerbit/time": "2.3.0",
|
|
61
|
+
"@peerbit/pubsub": "4.1.0",
|
|
62
|
+
"@peerbit/pubsub-interface": "4.1.0",
|
|
63
|
+
"@peerbit/stream-interface": "5.3.0"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@peerbit/test-utils": "2.
|
|
66
|
+
"@peerbit/test-utils": "2.3.1"
|
|
67
67
|
},
|
|
68
68
|
"scripts": {
|
|
69
69
|
"clean": "aegir clean",
|
package/src/controller.ts
CHANGED
|
@@ -147,7 +147,7 @@ export class RPC<Q, R> extends Program<RPCSetupOptions<Q, R>, RPCEvents<Q, R>> {
|
|
|
147
147
|
this._subscribing = this.node.services.pubsub.subscribe(this.topic);
|
|
148
148
|
|
|
149
149
|
await this._subscribing;
|
|
150
|
-
logger.
|
|
150
|
+
logger.trace("subscribing to query topic (responses): " + this.topic);
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
private async _onMessage(evt: CustomEvent<DataEvent>): Promise<void> {
|
|
@@ -232,7 +232,7 @@ export class RPC<Q, R> extends Program<RPCSetupOptions<Q, R>, RPCEvents<Q, R>> {
|
|
|
232
232
|
}
|
|
233
233
|
} catch (error: any) {
|
|
234
234
|
if (error instanceof AccessError) {
|
|
235
|
-
logger.
|
|
235
|
+
logger.trace("Got message I could not decrypt");
|
|
236
236
|
return;
|
|
237
237
|
}
|
|
238
238
|
|
|
@@ -395,7 +395,7 @@ export class RPC<Q, R> extends Program<RPCSetupOptions<Q, R>, RPCEvents<Q, R>> {
|
|
|
395
395
|
}
|
|
396
396
|
|
|
397
397
|
if (error instanceof BorshError) {
|
|
398
|
-
logger.
|
|
398
|
+
logger.trace("Namespace error");
|
|
399
399
|
return; // Name space conflict most likely
|
|
400
400
|
}
|
|
401
401
|
|
package/src/io.ts
CHANGED
|
@@ -12,7 +12,7 @@ import type {
|
|
|
12
12
|
WithMode,
|
|
13
13
|
} from "@peerbit/stream-interface";
|
|
14
14
|
|
|
15
|
-
export const logger
|
|
15
|
+
export const logger = loggerFn("peerbit:rpc");
|
|
16
16
|
export type RPCRequestResponseOptions<R> = {
|
|
17
17
|
amount?: number;
|
|
18
18
|
timeout?: number;
|
package/src/utils.ts
CHANGED
|
@@ -17,7 +17,7 @@ export class MissingResponsesError extends Error {
|
|
|
17
17
|
super(message);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
export type RPCRequestAllOptions<
|
|
20
|
+
export type RPCRequestAllOptions<_Q, R> = RPCRequestResponseOptions<R> &
|
|
21
21
|
EncryptionOptions & { mode?: Constructor<DeliveryMode> } & PriorityOptions &
|
|
22
22
|
RequestResponseInterceptor<R>;
|
|
23
23
|
|