moeralib 0.17.0 → 0.17.10

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.
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
36
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
37
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -35,7 +45,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
35
45
  return (mod && mod.__esModule) ? mod : { "default": mod };
36
46
  };
37
47
  Object.defineProperty(exports, "__esModule", { value: true });
38
- exports.verifyFingerprintSignature = exports.signFingerprint = exports.digestFingerprint = exports.fingerprintBytes = exports.rawToPrivateKey = exports.rawPrivateKey = exports.rawToPublicKey = exports.rawPublicKey = exports.mnemonicToPrivateKey = exports.generateMnemonicKey = exports.generateKey = void 0;
48
+ exports.generateKey = generateKey;
49
+ exports.generateMnemonicKey = generateMnemonicKey;
50
+ exports.mnemonicToPrivateKey = mnemonicToPrivateKey;
51
+ exports.rawPublicKey = rawPublicKey;
52
+ exports.rawToPublicKey = rawToPublicKey;
53
+ exports.rawPrivateKey = rawPrivateKey;
54
+ exports.rawToPrivateKey = rawToPrivateKey;
55
+ exports.fingerprintBytes = fingerprintBytes;
56
+ exports.digestFingerprint = digestFingerprint;
57
+ exports.signFingerprint = signFingerprint;
58
+ exports.verifyFingerprintSignature = verifyFingerprintSignature;
39
59
  const crypto_1 = __importDefault(require("crypto"));
40
60
  const util_1 = require("util");
41
61
  const bip39 = __importStar(require("@scure/bip39"));
@@ -53,7 +73,6 @@ function generateKey() {
53
73
  return (0, util_1.promisify)(crypto_1.default.generateKeyPair)("ec", { namedCurve: "secp256k1" });
54
74
  });
55
75
  }
56
- exports.generateKey = generateKey;
57
76
  /**
58
77
  * Generate a private cryptographic key with a mnemonic.
59
78
  *
@@ -66,7 +85,6 @@ function generateMnemonicKey() {
66
85
  return [mnemonic, privateKey];
67
86
  });
68
87
  }
69
- exports.generateMnemonicKey = generateMnemonicKey;
70
88
  /**
71
89
  * Restore a private key from the given mnemonic.
72
90
  *
@@ -95,7 +113,6 @@ function mnemonicToPrivateKey(mnemonic) {
95
113
  });
96
114
  });
97
115
  }
98
- exports.mnemonicToPrivateKey = mnemonicToPrivateKey;
99
116
  /**
100
117
  * Convert a public key to the raw format used by the naming server.
101
118
  *
@@ -110,7 +127,6 @@ function rawPublicKey(publicKey) {
110
127
  Buffer.from((_b = jwk.y) !== null && _b !== void 0 ? _b : EMPTY_KEY, "base64url")
111
128
  ]);
112
129
  }
113
- exports.rawPublicKey = rawPublicKey;
114
130
  /**
115
131
  * Restore a public key from the raw format.
116
132
  *
@@ -130,7 +146,6 @@ function rawToPublicKey(rawPublicKey) {
130
146
  }
131
147
  });
132
148
  }
133
- exports.rawToPublicKey = rawToPublicKey;
134
149
  /**
135
150
  * Convert a private key to the raw format to pass to the client.
136
151
  *
@@ -142,7 +157,6 @@ function rawPrivateKey(privateKey) {
142
157
  const jwk = privateKey.export({ format: "jwk" });
143
158
  return Buffer.from((_a = jwk.d) !== null && _a !== void 0 ? _a : EMPTY_KEY, "base64url");
144
159
  }
145
- exports.rawPrivateKey = rawPrivateKey;
146
160
  /**
147
161
  * Restore a private key from the raw format.
148
162
  *
@@ -163,7 +177,6 @@ function rawToPrivateKey(rawPrivateKey) {
163
177
  }
164
178
  });
165
179
  }
166
- exports.rawToPrivateKey = rawToPrivateKey;
167
180
  /**
168
181
  * Encode a fingerprint in the binary form, using the given fingerprint data and schema.
169
182
  *
@@ -176,7 +189,6 @@ function fingerprintBytes(fingerprint, schema) {
176
189
  fingerprintWriter.append(fingerprint, schema);
177
190
  return fingerprintWriter.toBytes();
178
191
  }
179
- exports.fingerprintBytes = fingerprintBytes;
180
192
  /**
181
193
  * Calculate a cryptographic digest of the fingerprint.
182
194
  *
@@ -188,7 +200,6 @@ function digestFingerprint(fingerprint) {
188
200
  digest.update(fingerprint);
189
201
  return digest.digest();
190
202
  }
191
- exports.digestFingerprint = digestFingerprint;
192
203
  /**
193
204
  * Sign a fingerprint with a private key.
194
205
  *
@@ -201,7 +212,6 @@ function signFingerprint(fingerprint, privateKey) {
201
212
  sign.update(fingerprint);
202
213
  return sign.sign(privateKey);
203
214
  }
204
- exports.signFingerprint = signFingerprint;
205
215
  /**
206
216
  * Verify a fingerprint signature with the given public key.
207
217
  *
@@ -215,4 +225,3 @@ function verifyFingerprintSignature(fingerprint, signature, publicKey) {
215
225
  verify.update(fingerprint);
216
226
  return verify.verify(publicKey, signature);
217
227
  }
218
- exports.verifyFingerprintSignature = verifyFingerprintSignature;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createPutCallFingerprint0 = void 0;
3
+ exports.createPutCallFingerprint0 = createPutCallFingerprint0;
4
4
  const crypto_1 = require("../crypto/crypto");
5
5
  const PUT_CALL_FINGERPRINT0_SCHEMA = [
6
6
  ["version", "number"],
@@ -15,4 +15,3 @@ const PUT_CALL_FINGERPRINT0_SCHEMA = [
15
15
  function createPutCallFingerprint0(name, generation, updatingKey, nodeUri, signingKey, validFrom, previousDigest) {
16
16
  return (0, crypto_1.fingerprintBytes)({ "version": 0, name, generation, updatingKey, nodeUri, signingKey, validFrom, previousDigest }, PUT_CALL_FINGERPRINT0_SCHEMA);
17
17
  }
18
- exports.createPutCallFingerprint0 = createPutCallFingerprint0;
@@ -9,7 +9,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.resolve = exports.expand = exports.shorten = exports.parseNodeName = exports.MoeraNaming = exports.MoeraNamingConnectionError = exports.MoeraNamingApiError = exports.MoeraNamingError = exports.DEV_NAMING_SERVER = exports.MAIN_NAMING_SERVER = void 0;
12
+ exports.MoeraNaming = exports.MoeraNamingConnectionError = exports.MoeraNamingApiError = exports.MoeraNamingError = exports.DEV_NAMING_SERVER = exports.MAIN_NAMING_SERVER = void 0;
13
+ exports.parseNodeName = parseNodeName;
14
+ exports.shorten = shorten;
15
+ exports.expand = expand;
16
+ exports.resolve = resolve;
13
17
  const json_rpc_2_0_1 = require("json-rpc-2.0");
14
18
  const schema_1 = require("../schema");
15
19
  const validate_1 = require("./validate");
@@ -290,7 +294,6 @@ function parseNodeName(nodeName) {
290
294
  }
291
295
  return [name, generation];
292
296
  }
293
- exports.parseNodeName = parseNodeName;
294
297
  function shorten(nodeName) {
295
298
  if (nodeName === null) {
296
299
  return null;
@@ -303,7 +306,6 @@ function shorten(nodeName) {
303
306
  return nodeName;
304
307
  }
305
308
  }
306
- exports.shorten = shorten;
307
309
  function expand(nodeName) {
308
310
  if (nodeName === null) {
309
311
  return null;
@@ -311,7 +313,6 @@ function expand(nodeName) {
311
313
  const [name, gen] = parseNodeName(nodeName);
312
314
  return `${name}_${gen}`;
313
315
  }
314
- exports.expand = expand;
315
316
  /**
316
317
  * Shortcut function to resolve a node name and get the node URI.
317
318
  *
@@ -327,4 +328,3 @@ function resolve(name_1) {
327
328
  return (_b = (_a = (yield naming.getCurrent(parsedName, gen))) === null || _a === void 0 ? void 0 : _a.nodeUri) !== null && _b !== void 0 ? _b : null;
328
329
  });
329
330
  }
330
- exports.resolve = resolve;
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateSchema = void 0;
3
+ exports.validateSchema = validateSchema;
4
4
  const schema_1 = require("../schema");
5
5
  const validators_1 = require("./validators");
6
6
  function validateSchema(schemaName, data) {
7
7
  return (0, schema_1.validateSchemaFromMap)(validators_1.NAMING_API_VALIDATORS, schemaName, data);
8
8
  }
9
- exports.validateSchema = validateSchema;
@@ -12,7 +12,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.Caller = exports.moeraRoot = exports.MoeraNodeCallError = exports.MoeraNodeConnectionError = exports.MoeraNodeApiError = exports.MoeraNodeError = void 0;
15
+ exports.Caller = exports.MoeraNodeCallError = exports.MoeraNodeConnectionError = exports.MoeraNodeApiError = exports.MoeraNodeError = void 0;
16
+ exports.moeraRoot = moeraRoot;
16
17
  const lodash_clonedeep_1 = __importDefault(require("lodash.clonedeep"));
17
18
  const validate_1 = require("./validate");
18
19
  const util_1 = require("../util");
@@ -163,7 +164,6 @@ function moeraRoot(url) {
163
164
  }
164
165
  return url;
165
166
  }
166
- exports.moeraRoot = moeraRoot;
167
167
  const FETCH_TIMEOUT = 10000; // ms
168
168
  const UPDATE_TIMEOUT = 60000; // ms
169
169
  const LARGE_BODY_MIN = 65536;
@@ -280,7 +280,7 @@ class Caller {
280
280
  */
281
281
  call(name_1, location_1, _a) {
282
282
  return __awaiter(this, arguments, void 0, function* (name, location, { params = null, method = "GET", body = null, contentType = null, auth = true, schema, bodies = false, srcBodies = false }) {
283
- let bodyEncoded = null;
283
+ let bodyEncoded;
284
284
  if (body != null && !Buffer.isBuffer(body)) {
285
285
  if (srcBodies) {
286
286
  body = encodeBodies(body);
@@ -12,7 +12,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.generateCarte = exports.MoeraCarteSource = exports.MoeraCartesError = void 0;
15
+ exports.MoeraCarteSource = exports.MoeraCartesError = void 0;
16
+ exports.generateCarte = generateCarte;
16
17
  const crypto_1 = __importDefault(require("crypto"));
17
18
  const util_1 = require("util");
18
19
  const types_1 = require("./types");
@@ -121,4 +122,3 @@ function generateCarte(ownerName_1, signingKey_1, beginning_1) {
121
122
  return Buffer.concat([fingerprint, signature]).toString("base64url");
122
123
  });
123
124
  }
124
- exports.generateCarte = generateCarte;
@@ -1,7 +1,19 @@
1
1
  "use strict";
2
2
  // This file is generated
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.createSheriffOrderFingerprint0 = exports.createReactionFingerprint0 = exports.createPushRelayRegisterFingerprint0 = exports.createPushRelayMessageFingerprint0 = exports.createPostingFingerprint0 = exports.createPostingFingerprint1 = exports.createNotificationPacketFingerprint0 = exports.createNotificationPacketFingerprint1 = exports.createCommentFingerprint0 = exports.createCarteFingerprint0 = exports.createCarteFingerprint1 = exports.createCarteFingerprint2 = exports.createAttachmentFingerprint0 = void 0;
4
+ exports.createAttachmentFingerprint0 = createAttachmentFingerprint0;
5
+ exports.createCarteFingerprint2 = createCarteFingerprint2;
6
+ exports.createCarteFingerprint1 = createCarteFingerprint1;
7
+ exports.createCarteFingerprint0 = createCarteFingerprint0;
8
+ exports.createCommentFingerprint0 = createCommentFingerprint0;
9
+ exports.createNotificationPacketFingerprint1 = createNotificationPacketFingerprint1;
10
+ exports.createNotificationPacketFingerprint0 = createNotificationPacketFingerprint0;
11
+ exports.createPostingFingerprint1 = createPostingFingerprint1;
12
+ exports.createPostingFingerprint0 = createPostingFingerprint0;
13
+ exports.createPushRelayMessageFingerprint0 = createPushRelayMessageFingerprint0;
14
+ exports.createPushRelayRegisterFingerprint0 = createPushRelayRegisterFingerprint0;
15
+ exports.createReactionFingerprint0 = createReactionFingerprint0;
16
+ exports.createSheriffOrderFingerprint0 = createSheriffOrderFingerprint0;
5
17
  const crypto_1 = require("../crypto/crypto");
6
18
  const ATTACHMENT_FINGERPRINT0_SCHEMA = [
7
19
  ["version", "number"],
@@ -11,7 +23,6 @@ const ATTACHMENT_FINGERPRINT0_SCHEMA = [
11
23
  function createAttachmentFingerprint0(digest) {
12
24
  return (0, crypto_1.fingerprintBytes)({ "version": 0, "objectType": "ATTACHMENT", digest }, ATTACHMENT_FINGERPRINT0_SCHEMA);
13
25
  }
14
- exports.createAttachmentFingerprint0 = createAttachmentFingerprint0;
15
26
  const CARTE_FINGERPRINT2_SCHEMA = [
16
27
  ["version", "number"],
17
28
  ["objectType", "string"],
@@ -28,7 +39,6 @@ function createCarteFingerprint2(ownerName, address, beginning, deadline, nodeNa
28
39
  return (0, crypto_1.fingerprintBytes)({ "version": 2, "objectType": "CARTE", ownerName, address, beginning, deadline, nodeName, clientScope, adminScope,
29
40
  salt }, CARTE_FINGERPRINT2_SCHEMA);
30
41
  }
31
- exports.createCarteFingerprint2 = createCarteFingerprint2;
32
42
  const CARTE_FINGERPRINT1_SCHEMA = [
33
43
  ["version", "number"],
34
44
  ["objectType", "string"],
@@ -43,7 +53,6 @@ const CARTE_FINGERPRINT1_SCHEMA = [
43
53
  function createCarteFingerprint1(ownerName, address, beginning, deadline, nodeName, authCategory, salt) {
44
54
  return (0, crypto_1.fingerprintBytes)({ "version": 1, "objectType": "CARTE", ownerName, address, beginning, deadline, nodeName, authCategory, salt }, CARTE_FINGERPRINT1_SCHEMA);
45
55
  }
46
- exports.createCarteFingerprint1 = createCarteFingerprint1;
47
56
  const CARTE_FINGERPRINT0_SCHEMA = [
48
57
  ["version", "number"],
49
58
  ["objectType", "string"],
@@ -57,7 +66,6 @@ const CARTE_FINGERPRINT0_SCHEMA = [
57
66
  function createCarteFingerprint0(ownerName, address, beginning, deadline, permissions, salt) {
58
67
  return (0, crypto_1.fingerprintBytes)({ "version": 0, "objectType": "CARTE", ownerName, address, beginning, deadline, permissions, salt }, CARTE_FINGERPRINT0_SCHEMA);
59
68
  }
60
- exports.createCarteFingerprint0 = createCarteFingerprint0;
61
69
  const COMMENT_FINGERPRINT0_SCHEMA = [
62
70
  ["version", "number"],
63
71
  ["objectType", "string"],
@@ -76,7 +84,6 @@ function createCommentFingerprint0(ownerName, postingFingerprint, repliedToFinge
76
84
  return (0, crypto_1.fingerprintBytes)({ "version": 0, "objectType": "COMMENT", ownerName, postingFingerprint, repliedToFingerprint, bodySrcHash,
77
85
  bodySrcFormat, body, bodyFormat, createdAt, permissions, attachments }, COMMENT_FINGERPRINT0_SCHEMA);
78
86
  }
79
- exports.createCommentFingerprint0 = createCommentFingerprint0;
80
87
  const NOTIFICATION_PACKET_FINGERPRINT1_SCHEMA = [
81
88
  ["version", "number"],
82
89
  ["objectType", "string"],
@@ -90,7 +97,6 @@ const NOTIFICATION_PACKET_FINGERPRINT1_SCHEMA = [
90
97
  function createNotificationPacketFingerprint1(id, nodeName, fullName, createdAt, type, notification) {
91
98
  return (0, crypto_1.fingerprintBytes)({ "version": 1, "objectType": "NOTIFICATION_PACKET", id, nodeName, fullName, createdAt, type, notification }, NOTIFICATION_PACKET_FINGERPRINT1_SCHEMA);
92
99
  }
93
- exports.createNotificationPacketFingerprint1 = createNotificationPacketFingerprint1;
94
100
  const NOTIFICATION_PACKET_FINGERPRINT0_SCHEMA = [
95
101
  ["version", "number"],
96
102
  ["objectType", "string"],
@@ -103,7 +109,6 @@ const NOTIFICATION_PACKET_FINGERPRINT0_SCHEMA = [
103
109
  function createNotificationPacketFingerprint0(id, nodeName, createdAt, type, notification) {
104
110
  return (0, crypto_1.fingerprintBytes)({ "version": 0, "objectType": "NOTIFICATION_PACKET", id, nodeName, createdAt, type, notification }, NOTIFICATION_PACKET_FINGERPRINT0_SCHEMA);
105
111
  }
106
- exports.createNotificationPacketFingerprint0 = createNotificationPacketFingerprint0;
107
112
  const POSTING_FINGERPRINT1_SCHEMA = [
108
113
  ["version", "number"],
109
114
  ["objectType", "string"],
@@ -121,7 +126,6 @@ function createPostingFingerprint1(receiverName, ownerName, bodySrcHash, bodySrc
121
126
  return (0, crypto_1.fingerprintBytes)({ "version": 1, "objectType": "POSTING", receiverName, ownerName, bodySrcHash, bodySrcFormat, body, bodyFormat,
122
127
  createdAt, permissions, attachments }, POSTING_FINGERPRINT1_SCHEMA);
123
128
  }
124
- exports.createPostingFingerprint1 = createPostingFingerprint1;
125
129
  const POSTING_FINGERPRINT0_SCHEMA = [
126
130
  ["version", "number"],
127
131
  ["objectType", "string"],
@@ -139,7 +143,6 @@ function createPostingFingerprint0(receiverName, ownerName, bodySrcHash, bodySrc
139
143
  return (0, crypto_1.fingerprintBytes)({ "version": 0, "objectType": "POSTING", receiverName, ownerName, bodySrcHash, bodySrcFormat, body, bodyFormat,
140
144
  createdAt, permissions, attachments }, POSTING_FINGERPRINT0_SCHEMA);
141
145
  }
142
- exports.createPostingFingerprint0 = createPostingFingerprint0;
143
146
  const PUSH_RELAY_MESSAGE_FINGERPRINT0_SCHEMA = [
144
147
  ["version", "number"],
145
148
  ["objectType", "string"],
@@ -148,7 +151,6 @@ const PUSH_RELAY_MESSAGE_FINGERPRINT0_SCHEMA = [
148
151
  function createPushRelayMessageFingerprint0(signedAt) {
149
152
  return (0, crypto_1.fingerprintBytes)({ "version": 0, "objectType": "PUSH_RELAY_MESSAGE", signedAt }, PUSH_RELAY_MESSAGE_FINGERPRINT0_SCHEMA);
150
153
  }
151
- exports.createPushRelayMessageFingerprint0 = createPushRelayMessageFingerprint0;
152
154
  const PUSH_RELAY_REGISTER_FINGERPRINT0_SCHEMA = [
153
155
  ["version", "number"],
154
156
  ["objectType", "string"],
@@ -159,7 +161,6 @@ const PUSH_RELAY_REGISTER_FINGERPRINT0_SCHEMA = [
159
161
  function createPushRelayRegisterFingerprint0(clientId, lang, signedAt) {
160
162
  return (0, crypto_1.fingerprintBytes)({ "version": 0, "objectType": "PUSH_RELAY_REGISTER", clientId, lang, signedAt }, PUSH_RELAY_REGISTER_FINGERPRINT0_SCHEMA);
161
163
  }
162
- exports.createPushRelayRegisterFingerprint0 = createPushRelayRegisterFingerprint0;
163
164
  const REACTION_FINGERPRINT0_SCHEMA = [
164
165
  ["version", "number"],
165
166
  ["objectType", "string"],
@@ -171,7 +172,6 @@ const REACTION_FINGERPRINT0_SCHEMA = [
171
172
  function createReactionFingerprint0(ownerName, entryFingerprint, negative, emoji) {
172
173
  return (0, crypto_1.fingerprintBytes)({ "version": 0, "objectType": "REACTION", ownerName, entryFingerprint, negative, emoji }, REACTION_FINGERPRINT0_SCHEMA);
173
174
  }
174
- exports.createReactionFingerprint0 = createReactionFingerprint0;
175
175
  const SHERIFF_ORDER_FINGERPRINT0_SCHEMA = [
176
176
  ["version", "number"],
177
177
  ["objectType", "string"],
@@ -188,4 +188,3 @@ function createSheriffOrderFingerprint0(sheriffName, nodeName, feedName, entryFi
188
188
  return (0, crypto_1.fingerprintBytes)({ "version": 0, "objectType": "SHERIFF_ORDER", sheriffName, nodeName, feedName, entryFingerprint, category,
189
189
  reasonCode, reasonDetails, createdAt }, SHERIFF_ORDER_FINGERPRINT0_SCHEMA);
190
190
  }
191
- exports.createSheriffOrderFingerprint0 = createSheriffOrderFingerprint0;
package/lib/node/node.js CHANGED
@@ -686,6 +686,20 @@ class MoeraNode extends caller_1.Caller {
686
686
  });
687
687
  });
688
688
  }
689
+ /**
690
+ * Fetch the detailed information, including relationships, about the contacts matching the filter.
691
+ *
692
+ * @param {API.ContactFilter} filter
693
+ * @return {Promise<API.ContactWithRelationships[]>}
694
+ */
695
+ fetchContacts(filter) {
696
+ return __awaiter(this, void 0, void 0, function* () {
697
+ const location = "/people/contacts/fetch";
698
+ return yield this.call("fetchContacts", location, {
699
+ method: "POST", body: filter, schema: "ContactWithRelationshipsArray"
700
+ });
701
+ });
702
+ }
689
703
  /**
690
704
  * Check whether the credentials are initialized already.
691
705
  *
@@ -759,6 +773,21 @@ class MoeraNode extends caller_1.Caller {
759
773
  });
760
774
  });
761
775
  }
776
+ /**
777
+ * Verify the credentials reset token. If the token is valid, it may be used later to change the credentials
778
+ * without knowing the password.
779
+ *
780
+ * @param {API.CredentialsResetToken} resetToken
781
+ * @return {Promise<API.VerificationInfo>}
782
+ */
783
+ verifyCredentialsResetToken(resetToken) {
784
+ return __awaiter(this, void 0, void 0, function* () {
785
+ const location = "/credentials/reset/verify";
786
+ return yield this.call("verifyCredentialsResetToken", location, {
787
+ method: "POST", body: resetToken, schema: "VerificationInfo"
788
+ });
789
+ });
790
+ }
762
791
  /**
763
792
  * Get the list of deleted postings, page by page. The node may decide to use a smaller page size than the given
764
793
  * ``limit``. The postings are always sorted by the deletion timestamp, descending.
@@ -2033,14 +2062,16 @@ class MoeraNode extends caller_1.Caller {
2033
2062
  * \
2034
2063
  * The service may decide to return fewer recommendations than the given ``limit``.
2035
2064
  *
2065
+ * @param {string | null} feed - name of the feed to get recommendations for ("news" by default); recommendations
2066
+ * for every feed are tracked separately
2036
2067
  * @param {string | null} sheriff - filter out entries prohibited by the given sheriff
2037
2068
  * @param {number | null} limit - maximum number of recommendations returned
2038
2069
  * @return {Promise<API.RecommendedPostingInfo[]>}
2039
2070
  */
2040
2071
  getRecommendedPostings() {
2041
- return __awaiter(this, arguments, void 0, function* (sheriff = null, limit = null) {
2072
+ return __awaiter(this, arguments, void 0, function* (feed = null, sheriff = null, limit = null) {
2042
2073
  const location = (0, util_1.ut) `/recommendations/postings`;
2043
- const params = { sheriff, limit };
2074
+ const params = { feed, sheriff, limit };
2044
2075
  return yield this.call("getRecommendedPostings", location, {
2045
2076
  method: "GET", params, schema: "RecommendedPostingInfoArray"
2046
2077
  });
@@ -2089,13 +2120,16 @@ class MoeraNode extends caller_1.Caller {
2089
2120
  *
2090
2121
  * @param {string} remoteNodeName - name of the remote node
2091
2122
  * @param {string} postingId - ID of the posting on the remote node
2123
+ * @param {string | null} feed - name of the feed the recommendation is accepted to ("news" by default);
2124
+ * recommendations for every feed are tracked separately
2092
2125
  * @return {Promise<API.Result>}
2093
2126
  */
2094
- acceptRecommendedPosting(remoteNodeName, postingId) {
2095
- return __awaiter(this, void 0, void 0, function* () {
2127
+ acceptRecommendedPosting(remoteNodeName_1, postingId_1) {
2128
+ return __awaiter(this, arguments, void 0, function* (remoteNodeName, postingId, feed = null) {
2096
2129
  const location = (0, util_1.ut) `/recommendations/postings/accepted/${remoteNodeName}/${postingId}`;
2130
+ const params = { feed };
2097
2131
  return yield this.call("acceptRecommendedPosting", location, {
2098
- method: "POST", schema: "Result"
2132
+ method: "POST", params, schema: "Result"
2099
2133
  });
2100
2134
  });
2101
2135
  }
@@ -2104,13 +2138,34 @@ class MoeraNode extends caller_1.Caller {
2104
2138
  *
2105
2139
  * @param {string} remoteNodeName - name of the remote node
2106
2140
  * @param {string} postingId - ID of the posting on the remote node
2141
+ * @param {string | null} feed - name of the feed the recommendation is rejected for ("news" by default);
2142
+ * recommendations for every feed are tracked separately
2107
2143
  * @return {Promise<API.Result>}
2108
2144
  */
2109
- rejectRecommendedPosting(remoteNodeName, postingId) {
2110
- return __awaiter(this, void 0, void 0, function* () {
2145
+ rejectRecommendedPosting(remoteNodeName_1, postingId_1) {
2146
+ return __awaiter(this, arguments, void 0, function* (remoteNodeName, postingId, feed = null) {
2111
2147
  const location = (0, util_1.ut) `/recommendations/postings/rejected/${remoteNodeName}/${postingId}`;
2148
+ const params = { feed };
2112
2149
  return yield this.call("rejectRecommendedPosting", location, {
2113
- method: "POST", schema: "Result"
2150
+ method: "POST", params, schema: "Result"
2151
+ });
2152
+ });
2153
+ }
2154
+ /**
2155
+ * Find the most active nodes known to the recommendation service. \
2156
+ * \
2157
+ * The service may decide to return fewer recommendations than the given ``limit``.
2158
+ *
2159
+ * @param {string | null} sheriff - filter out nodes prohibited by the given sheriff
2160
+ * @param {number | null} limit - maximum number of recommendations returned
2161
+ * @return {Promise<API.RecommendedNodeInfo[]>}
2162
+ */
2163
+ getRecommendedNodesByActivity() {
2164
+ return __awaiter(this, arguments, void 0, function* (sheriff = null, limit = null) {
2165
+ const location = (0, util_1.ut) `/recommendations/nodes/active`;
2166
+ const params = { sheriff, limit };
2167
+ return yield this.call("getRecommendedNodesByActivity", location, {
2168
+ method: "GET", params, schema: "RecommendedNodeInfoArray"
2114
2169
  });
2115
2170
  });
2116
2171
  }
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateSchema = void 0;
3
+ exports.validateSchema = validateSchema;
4
4
  const schema_1 = require("../schema");
5
5
  const validators_1 = require("./validators");
6
6
  function validateSchema(schemaName, data) {
7
7
  return (0, schema_1.validateSchemaFromMap)(validators_1.NODE_API_VALIDATORS, schemaName, data);
8
8
  }
9
- exports.validateSchema = validateSchema;