@peerbit/rpc 5.3.29-48ac6de → 5.4.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/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2022 dao.xyz
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -1,8 +1,36 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
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 = class RPC extends Program {
25
- _subscribed = false;
26
- _responseHandler;
27
- _responseResolver;
28
- _requestType;
29
- _requestTypeIsUint8Array;
30
- _responseType;
31
- _rpcTopic;
32
- _onMessageBinded = undefined;
33
- _keypair;
34
- _getResponseValueFn;
35
- _getRequestValueFn;
36
- async open(args) {
37
- this._rpcTopic = args.topic ?? this._rpcTopic;
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
- this._subscribed = false;
54
- }
55
- async close(from) {
56
- await this._close(from);
57
- return super.close(from);
58
- }
59
- async drop(from) {
60
- await this._close(from);
61
- return super.drop(from);
62
- }
63
- _subscribing;
64
- async subscribe() {
65
- await this._subscribing;
66
- if (this._subscribed) {
67
- return;
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
- this._subscribed = true;
70
- this._onMessageBinded = this._onMessageBinded || this._onMessage.bind(this);
71
- this.node.services.pubsub.addEventListener("data", this._onMessageBinded);
72
- this._subscribing = this.node.services.pubsub.subscribe(this.topic);
73
- await this._subscribing;
74
- logger.debug("subscribing to query topic (responses): " + this.topic);
75
- }
76
- async _onMessage(evt) {
77
- const { data, message } = evt.detail;
78
- if (data?.topics.find((x) => x === this.topic) != null) {
79
- try {
80
- const rpcMessage = deserialize(data.data, RPCMessage);
81
- if (rpcMessage instanceof RequestV0) {
82
- if (this._responseHandler) {
83
- const maybeEncrypted = rpcMessage.request;
84
- const decrypted = await maybeEncrypted.decrypt(this.node.services.keychain);
85
- const request = this._getRequestValueFn(decrypted);
86
- let from = message.header.signatures.publicKeys[0];
87
- this.events.dispatchEvent(new CustomEvent("request", {
88
- // TODO should this event also be emitted if the responseHandler is omitted?
89
- detail: {
90
- request,
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
- else if (rpcMessage instanceof ResponseV0) {
127
- const id = toBase64(rpcMessage.requestId);
128
- const handler = this._responseResolver.get(id);
129
- // TODO evaluate when and how handler can be missing
130
- handler?.({
131
- message,
132
- response: rpcMessage,
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
- catch (error) {
137
- if (error instanceof AccessError) {
138
- logger.debug("Got message I could not decrypt");
139
- return;
140
- }
141
- if (error instanceof BorshError) {
142
- logger.error("Got message for a different namespace");
143
- return;
144
- }
145
- logger.error("Error handling query: " +
146
- (error?.message ? error?.message?.toString() : error));
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
- async seal(request, respondTo, options) {
151
- const requestData = this._requestTypeIsUint8Array
152
- ? request
153
- : serialize(request);
154
- const decryptedMessage = new DecryptedThing({
155
- data: requestData,
156
- });
157
- let maybeEncryptedMessage = decryptedMessage;
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
- const requestMessage = new RequestV0({
163
- request: maybeEncryptedMessage,
164
- respondTo,
165
- });
166
- return requestMessage;
167
- }
168
- getPublishOptions(id, options, signal) {
169
- return {
170
- id,
171
- priority: options?.priority,
172
- mode: options?.mode,
173
- topics: [this.topic],
174
- extraSigners: options?.extraSigners,
175
- signal,
176
- };
177
- }
178
- /**
179
- * Send message and don't expect any response
180
- * @param message
181
- * @param options
182
- */
183
- async send(message, options) {
184
- await this.node.services.pubsub.publish(serialize(await this.seal(message, undefined, options)), this.getPublishOptions(undefined, options));
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
- responders.add(response.from.hashcode());
196
- if (responders.size === expectedResponders.size) {
247
+ if (options?.amount != null &&
248
+ allResults.length >= options?.amount) {
197
249
  promise.resolve();
198
250
  }
199
251
  }
200
252
  }
201
- else {
202
- options?.onResponse &&
203
- options?.onResponse(response.response, response.from);
204
- allResults.push(response);
205
- if (options?.amount != null &&
206
- allResults.length >= options?.amount) {
207
- promise.resolve();
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
- createResponseHandler(promise, keypair, allResults, responders, expectedResponders, options) {
212
- return async (properties) => {
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
- const { response, message } = properties;
215
- const from = message.header.signatures.publicKeys[0];
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 AccessError) {
230
- return; // Ignore things we can not open
339
+ if (error instanceof TimeoutError === false &&
340
+ error instanceof AbortError === false) {
341
+ throw error;
231
342
  }
232
- if (error instanceof BorshError) {
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
- * Send a request and expect a response
243
- * @param request
244
- * @param options
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
- // Ignore timeout errors only
352
+ return deferredPromise.promise.then(() => allResults);
302
353
  }
303
- finally {
304
- clearTimeout(timeoutFn);
305
- this.events.removeEventListener("close", closeListener);
306
- this.events.removeEventListener("drop", dropListener);
307
- options?.signal?.removeEventListener("abort", abortListener);
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
- return deferredPromise.promise.then(() => allResults);
311
- }
312
- get topic() {
313
- if (!this._rpcTopic) {
314
- throw new Error("Not initialized");
360
+ getTopics() {
361
+ return [this.topic];
315
362
  }
316
- return this._rpcTopic;
317
- }
318
- getTopics() {
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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MAAM,CAAC,CAClD,CAAC;gBACF,MAAM,eAAe,CAAC,OAAO,CAAC;YAC/B,CAAC;YAAC,OAAO,KAAU,EAAE,CAAC;gBACrB,IACC,KAAK,YAAY,YAAY,KAAK,KAAK;oBACvC,KAAK,YAAY,UAAU,KAAK,KAAK,EACpC,CAAC;oBACF,MAAM,KAAK,CAAC;gBACb,CAAC;gBACD,6BAA6B;YAC9B,CAAC;oBAAS,CAAC;gBACV,YAAY,CAAC,SAAS,CAAC,CAAC;gBACxB,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;gBACxD,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;gBACtD,OAAO,EAAE,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;gBAC7D,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YACnC,CAAC;YAED,OAAO,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,CAAC;QACvD,CAAC;QAED,IAAW,KAAK;YACf,IAAI,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"}
@@ -1,62 +1,129 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
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 __metadata = (this && this.__metadata) || function (k, v) {
8
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
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 = class RPCMessage {
13
- };
14
- RPCMessage = __decorate([
15
- variant(0)
16
- ], RPCMessage);
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 = class RequestV0 extends RPCMessage {
19
- respondTo;
20
- request;
21
- constructor(properties) {
22
- super();
23
- this.respondTo = properties.respondTo;
24
- this.request = properties.request;
25
- }
26
- };
27
- __decorate([
28
- field({ type: option(X25519PublicKey) }),
29
- __metadata("design:type", X25519PublicKey)
30
- ], RequestV0.prototype, "respondTo", void 0);
31
- __decorate([
32
- field({ type: MaybeEncrypted }),
33
- __metadata("design:type", MaybeEncrypted)
34
- ], RequestV0.prototype, "request", void 0);
35
- RequestV0 = __decorate([
36
- variant(0),
37
- __metadata("design:paramtypes", [Object])
38
- ], RequestV0);
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 = class ResponseV0 extends RPCMessage {
41
- requestId;
42
- response;
43
- constructor(properties) {
44
- super();
45
- this.response = properties.response;
46
- this.requestId = properties.requestId;
47
- }
48
- };
49
- __decorate([
50
- field({ type: fixedArray("u8", 32) }),
51
- __metadata("design:type", Uint8Array)
52
- ], ResponseV0.prototype, "requestId", void 0);
53
- __decorate([
54
- field({ type: MaybeEncrypted }),
55
- __metadata("design:type", MaybeEncrypted)
56
- ], ResponseV0.prototype, "response", void 0);
57
- ResponseV0 = __decorate([
58
- variant(1),
59
- __metadata("design:paramtypes", [Object])
60
- ], ResponseV0);
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
@@ -1 +1 @@
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;AAG3D,IAAe,UAAU,GAAzB,MAAe,UAAU;CAAG,CAAA;AAAb,UAAU;IAD/B,OAAO,CAAC,CAAC,CAAC;GACW,UAAU,CAAG;;AAG5B,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,UAAU;IAExC,SAAS,CAAmB;IAG5B,OAAO,CAAsB;IAE7B,YAAY,UAGX;QACA,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QACtC,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC;IACnC,CAAC;CACD,CAAA;AAbA;IADC,KAAK,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,eAAe,CAAC,EAAE,CAAC;8BAC7B,eAAe;4CAAC;AAG5B;IADC,KAAK,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;8BACvB,cAAc;0CAAM;AALjB,SAAS;IADrB,OAAO,CAAC,CAAC,CAAC;;GACE,SAAS,CAerB;;AAGM,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,UAAU;IAEzC,SAAS,CAAa;IAGtB,QAAQ,CAAsB;IAE9B,YAAY,UAGX;QACA,KAAK,EAAE,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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: ReturnType<typeof loggerFn>;
3
+ export declare const logger: import("@libp2p/interface").Logger;
5
4
  export type RPCRequestResponseOptions<R> = {
6
5
  amount?: number;
7
6
  timeout?: number;
@@ -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;AACzB,OAAO,EAAE,MAAM,IAAI,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EACX,WAAW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AC"}
package/dist/src/io.js CHANGED
@@ -1,3 +1,3 @@
1
1
  import { logger as loggerFn } from "@peerbit/logger";
2
- export const logger = loggerFn({ module: "rpc" });
2
+ export const logger = loggerFn("peerbit:rpc");
3
3
  //# sourceMappingURL=io.js.map
@@ -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,GAAgC,QAAQ,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC"}
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"}
@@ -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<Q, R> = RPCRequestResponseOptions<R> & EncryptionOptions & {
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>;
@@ -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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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.29-48ac6de",
3
+ "version": "5.4.0",
4
4
  "description": "RPC calls for peers",
5
5
  "sideEffects": false,
6
6
  "type": "module",
@@ -49,26 +49,26 @@
49
49
  "publishConfig": {
50
50
  "access": "public"
51
51
  },
52
- "scripts": {
53
- "clean": "aegir clean",
54
- "build": "aegir build --no-bundle",
55
- "test": "aegir test --target=node",
56
- "lint": "aegir lint"
57
- },
58
52
  "author": "dao.xyz",
59
53
  "license": "MIT",
60
54
  "dependencies": {
61
- "@dao-xyz/borsh": "^5.2.3",
62
- "@peerbit/crypto": "2.3.13-48ac6de",
63
- "@peerbit/logger": "1.0.4-48ac6de",
64
- "@peerbit/program": "5.3.6-48ac6de",
65
- "@peerbit/time": "2.2.0-48ac6de",
66
- "@peerbit/pubsub": "4.0.18-48ac6de",
67
- "@peerbit/pubsub-interface": "4.0.9-48ac6de",
68
- "@peerbit/stream-interface": "5.2.10-48ac6de",
69
- "p-defer": "^4.0.0"
55
+ "@dao-xyz/borsh": "^6.0.0",
56
+ "p-defer": "^4.0.0",
57
+ "@peerbit/crypto": "2.4.0",
58
+ "@peerbit/logger": "2.0.0",
59
+ "@peerbit/program": "1.0.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"
70
64
  },
71
65
  "devDependencies": {
72
- "@peerbit/test-utils": "2.2.11-48ac6de"
66
+ "@peerbit/test-utils": "2.3.0"
67
+ },
68
+ "scripts": {
69
+ "clean": "aegir clean",
70
+ "build": "aegir build --no-bundle",
71
+ "test": "aegir test --target=node",
72
+ "lint": "aegir lint"
73
73
  }
74
- }
74
+ }
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.debug("subscribing to query topic (responses): " + this.topic);
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.debug("Got message I could not decrypt");
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.debug("Namespace error");
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: ReturnType<typeof loggerFn> = loggerFn({ module: "rpc" });
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<Q, R> = RPCRequestResponseOptions<R> &
20
+ export type RPCRequestAllOptions<_Q, R> = RPCRequestResponseOptions<R> &
21
21
  EncryptionOptions & { mode?: Constructor<DeliveryMode> } & PriorityOptions &
22
22
  RequestResponseInterceptor<R>;
23
23