moeralib 0.18.6 → 0.19.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/lib/node/node.js +140 -38
- package/lib/node/validators.js +3980 -3051
- package/package.json +2 -1
- package/typings/node/node.d.ts +78 -19
- package/typings/node/node.d.ts.map +1 -1
- package/typings/node/types.d.ts +158 -45
- package/typings/node/types.d.ts.map +1 -1
- package/typings/node/validators.d.ts +8 -3
- package/typings/node/validators.d.ts.map +1 -1
package/lib/node/node.js
CHANGED
|
@@ -1360,17 +1360,41 @@ class MoeraNode extends caller_1.Caller {
|
|
|
1360
1360
|
});
|
|
1361
1361
|
}
|
|
1362
1362
|
/**
|
|
1363
|
-
*
|
|
1363
|
+
* Parse the page located at the URL and return the title, the description and the picture that may be used to
|
|
1364
|
+
* build a preview of the page.
|
|
1364
1365
|
*
|
|
1365
|
-
* @param {
|
|
1366
|
-
* @
|
|
1367
|
-
* @return {Promise<API.PrivateMediaFileInfo>}
|
|
1366
|
+
* @param {string} url
|
|
1367
|
+
* @return {Promise<API.LinkPreviewInfo>}
|
|
1368
1368
|
*/
|
|
1369
|
-
|
|
1369
|
+
createLinkPreview(url) {
|
|
1370
1370
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1371
|
-
const location =
|
|
1371
|
+
const location = (0, util_1.ut) `/link-preview`;
|
|
1372
|
+
const params = { url };
|
|
1373
|
+
return yield this.call("createLinkPreview", location, {
|
|
1374
|
+
method: "GET", params, schema: "LinkPreviewInfo"
|
|
1375
|
+
});
|
|
1376
|
+
});
|
|
1377
|
+
}
|
|
1378
|
+
/**
|
|
1379
|
+
* Upload a new private media file. The content of the file is passed in the request body. Alternatively, the file
|
|
1380
|
+
* can be uploaded using Media upload API and its ID passed in the `upload` query parameter. The second alternative
|
|
1381
|
+
* is to pass the URL of the media in the `url` query parameter, the media will be downloaded to the node.
|
|
1382
|
+
*
|
|
1383
|
+
* @param {string | null} upload - ID of the media upload to be used instead of the request body
|
|
1384
|
+
* @param {string | null} url - URL of the media to be used instead of the request body
|
|
1385
|
+
* @param {boolean | null} downsize - `true` to scale the uploaded image down to the size recommended by the node
|
|
1386
|
+
* or asynchronously compress an uploaded video to the recommended playback format and size, if possible; the
|
|
1387
|
+
* default is `false`
|
|
1388
|
+
* @param {Buffer | null} body - optional
|
|
1389
|
+
* @param {string | null} contentType - optional content-type of ``body``
|
|
1390
|
+
* @return {Promise<API.PrivateMediaFileInfo>}
|
|
1391
|
+
*/
|
|
1392
|
+
uploadPrivateMedia() {
|
|
1393
|
+
return __awaiter(this, arguments, void 0, function* (body = null, contentType = null, upload = null, url = null, downsize = null) {
|
|
1394
|
+
const location = (0, util_1.ut) `/media/private`;
|
|
1395
|
+
const params = { upload, url, downsize };
|
|
1372
1396
|
return yield this.call("uploadPrivateMedia", location, {
|
|
1373
|
-
method: "POST", body, contentType, schema: "PrivateMediaFileInfo"
|
|
1397
|
+
method: "POST", params, body, contentType, schema: "PrivateMediaFileInfo"
|
|
1374
1398
|
});
|
|
1375
1399
|
});
|
|
1376
1400
|
}
|
|
@@ -1503,6 +1527,65 @@ class MoeraNode extends caller_1.Caller {
|
|
|
1503
1527
|
});
|
|
1504
1528
|
});
|
|
1505
1529
|
}
|
|
1530
|
+
/**
|
|
1531
|
+
* Create a new chunked upload of a private media source file.
|
|
1532
|
+
*
|
|
1533
|
+
* @param {API.MediaUploadAttributes} attributes
|
|
1534
|
+
* @return {Promise<API.MediaUploadInfo>}
|
|
1535
|
+
*/
|
|
1536
|
+
createMediaUpload(attributes) {
|
|
1537
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1538
|
+
const location = "/media/upload";
|
|
1539
|
+
return yield this.call("createMediaUpload", location, {
|
|
1540
|
+
method: "POST", body: attributes, schema: "MediaUploadInfo"
|
|
1541
|
+
});
|
|
1542
|
+
});
|
|
1543
|
+
}
|
|
1544
|
+
/**
|
|
1545
|
+
* Get chunked upload details.
|
|
1546
|
+
*
|
|
1547
|
+
* @param {string} id - upload ID
|
|
1548
|
+
* @return {Promise<API.MediaUploadInfo>}
|
|
1549
|
+
*/
|
|
1550
|
+
getMediaUpload(id) {
|
|
1551
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1552
|
+
const location = (0, util_1.ut) `/media/upload/${id}`;
|
|
1553
|
+
return yield this.call("getMediaUpload", location, {
|
|
1554
|
+
method: "GET", schema: "MediaUploadInfo"
|
|
1555
|
+
});
|
|
1556
|
+
});
|
|
1557
|
+
}
|
|
1558
|
+
/**
|
|
1559
|
+
* Upload one chunk of a private media source file.
|
|
1560
|
+
*
|
|
1561
|
+
* @param {string} id - upload ID
|
|
1562
|
+
* @param {number} chunk - zero-based chunk number
|
|
1563
|
+
* @param {Buffer} body
|
|
1564
|
+
* @param {string} contentType - content-type of ``body``
|
|
1565
|
+
* @return {Promise<API.MediaUploadInfo>}
|
|
1566
|
+
*/
|
|
1567
|
+
uploadMediaChunk(id, chunk, body, contentType) {
|
|
1568
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1569
|
+
const location = (0, util_1.ut) `/media/upload/${id}/${chunk}`;
|
|
1570
|
+
return yield this.call("uploadMediaChunk", location, {
|
|
1571
|
+
method: "PUT", body, contentType, schema: "MediaUploadInfo"
|
|
1572
|
+
});
|
|
1573
|
+
});
|
|
1574
|
+
}
|
|
1575
|
+
/**
|
|
1576
|
+
* Delete a chunked media upload and the corresponding source file.
|
|
1577
|
+
*
|
|
1578
|
+
* @param {string} id - upload ID
|
|
1579
|
+
* @return {Promise<API.Result>}
|
|
1580
|
+
*/
|
|
1581
|
+
deleteMediaUpload(id) {
|
|
1582
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1583
|
+
const location = (0, util_1.ut) `/media/upload/${id}`;
|
|
1584
|
+
return yield this.call("deleteMediaUpload", location, {
|
|
1585
|
+
method: "DELETE", schema: "Result"
|
|
1586
|
+
});
|
|
1587
|
+
});
|
|
1588
|
+
}
|
|
1506
1589
|
/**
|
|
1507
1590
|
* Get the name of the node. Admin user receives the current status of the latest operation with the node name.
|
|
1508
1591
|
*
|
|
@@ -2057,37 +2140,6 @@ class MoeraNode extends caller_1.Caller {
|
|
|
2057
2140
|
});
|
|
2058
2141
|
});
|
|
2059
2142
|
}
|
|
2060
|
-
/**
|
|
2061
|
-
* Open the URL passed in the parameters and pass to the client the media file returned by the server.
|
|
2062
|
-
*
|
|
2063
|
-
* @param {string} url
|
|
2064
|
-
* @return {Promise<Blob>}
|
|
2065
|
-
*/
|
|
2066
|
-
proxyMedia(url) {
|
|
2067
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2068
|
-
const location = (0, util_1.ut) `/proxy/media`;
|
|
2069
|
-
const params = { url };
|
|
2070
|
-
return yield this.call("proxyMedia", location, {
|
|
2071
|
-
method: "GET", params, schema: "blob"
|
|
2072
|
-
});
|
|
2073
|
-
});
|
|
2074
|
-
}
|
|
2075
|
-
/**
|
|
2076
|
-
* Parse the page located at the URL and return the title, the description and the picture that may be used to
|
|
2077
|
-
* build a preview of the page.
|
|
2078
|
-
*
|
|
2079
|
-
* @param {string} url
|
|
2080
|
-
* @return {Promise<API.LinkPreviewInfo>}
|
|
2081
|
-
*/
|
|
2082
|
-
proxyLinkPreview(url) {
|
|
2083
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2084
|
-
const location = (0, util_1.ut) `/proxy/link-preview`;
|
|
2085
|
-
const params = { url };
|
|
2086
|
-
return yield this.call("proxyLinkPreview", location, {
|
|
2087
|
-
method: "GET", params, schema: "LinkPreviewInfo"
|
|
2088
|
-
});
|
|
2089
|
-
});
|
|
2090
|
-
}
|
|
2091
2143
|
/**
|
|
2092
2144
|
* Register a client at the push relay server to receive messages from this node. The operation is synchronous.
|
|
2093
2145
|
*
|
|
@@ -3139,6 +3191,56 @@ class MoeraNode extends caller_1.Caller {
|
|
|
3139
3191
|
});
|
|
3140
3192
|
});
|
|
3141
3193
|
}
|
|
3194
|
+
/**
|
|
3195
|
+
* Search for visited nodes matching the search ``query``. Every space-delimited word in the query must match
|
|
3196
|
+
* case-insensitively a beginning of the node's name or a beginning of any space-delimited word in the node's full
|
|
3197
|
+
* name. The order of words is not significant. \
|
|
3198
|
+
* \
|
|
3199
|
+
* The node may decide to return fewer nodes than the given ``limit``. \
|
|
3200
|
+
* \
|
|
3201
|
+
* The nodes are sorted by *social distance* from the node.
|
|
3202
|
+
*
|
|
3203
|
+
* @param {string | null} query - the search query
|
|
3204
|
+
* @param {number | null} limit - maximum number of nodes returned
|
|
3205
|
+
* @return {Promise<API.SearchNodeInfo[]>}
|
|
3206
|
+
*/
|
|
3207
|
+
getVisitedNodes() {
|
|
3208
|
+
return __awaiter(this, arguments, void 0, function* (query = null, limit = null) {
|
|
3209
|
+
const location = (0, util_1.ut) `/people/visited`;
|
|
3210
|
+
const params = { query, limit };
|
|
3211
|
+
return yield this.call("getVisitedNodes", location, {
|
|
3212
|
+
method: "GET", params, schema: "SearchNodeInfoArray"
|
|
3213
|
+
});
|
|
3214
|
+
});
|
|
3215
|
+
}
|
|
3216
|
+
/**
|
|
3217
|
+
* Record a visit to the node.
|
|
3218
|
+
*
|
|
3219
|
+
* @param {API.VisitedNodeAttributes} node
|
|
3220
|
+
* @return {Promise<API.Result>}
|
|
3221
|
+
*/
|
|
3222
|
+
recordVisitedNode(node) {
|
|
3223
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3224
|
+
const location = "/people/visited";
|
|
3225
|
+
return yield this.call("recordVisitedNode", location, {
|
|
3226
|
+
method: "POST", body: node, schema: "Result"
|
|
3227
|
+
});
|
|
3228
|
+
});
|
|
3229
|
+
}
|
|
3230
|
+
/**
|
|
3231
|
+
* Delete all visits to the node.
|
|
3232
|
+
*
|
|
3233
|
+
* @param {string} remoteNodeName - name of the visited node
|
|
3234
|
+
* @return {Promise<API.Result>}
|
|
3235
|
+
*/
|
|
3236
|
+
deleteVisitedNode(remoteNodeName) {
|
|
3237
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3238
|
+
const location = (0, util_1.ut) `/people/visited/${remoteNodeName}`;
|
|
3239
|
+
return yield this.call("deleteVisitedNode", location, {
|
|
3240
|
+
method: "DELETE", schema: "Result"
|
|
3241
|
+
});
|
|
3242
|
+
});
|
|
3243
|
+
}
|
|
3142
3244
|
/**
|
|
3143
3245
|
* Record a visit to a posting, comment or media.
|
|
3144
3246
|
*
|