Skip to content
This repository was archived by the owner on Jun 3, 2020. It is now read-only.

Commit 9ed1c82

Browse files
committed
WIP - move to the new hyperdrive-daemon
1 parent 53e039a commit 9ed1c82

26 files changed

Lines changed: 318 additions & 5280 deletions

crawler/bookmarks.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const JSON_PATH_REGEX = /^\/data\/bookmarks\/([^/]+)\.json$/i
2222
// =
2323

2424
/**
25-
* @typedef {import('../dat/library').InternalDatArchive} InternalDatArchive
25+
* @typedef {import('../dat/daemon').DaemonDatArchive} DaemonDatArchive
2626
* @typedef {import('./util').CrawlSourceRecord} CrawlSourceRecord
2727
* @typedef { import("./site-descriptions").SiteDescription } SiteDescription
2828
*
@@ -56,7 +56,7 @@ exports.removeListener = events.removeListener.bind(events)
5656
* @description
5757
* Crawl the given site for bookmarks.
5858
*
59-
* @param {InternalDatArchive} archive - site to crawl.
59+
* @param {DaemonDatArchive} archive - site to crawl.
6060
* @param {CrawlSourceRecord} crawlSource - internal metadata about the crawl target.
6161
* @returns {Promise}
6262
*/
@@ -258,7 +258,7 @@ const getBookmark = exports.getBookmark = async function (url) {
258258
* @description
259259
* Create a new bookmark.
260260
*
261-
* @param {InternalDatArchive} archive - where to write the bookmark to.
261+
* @param {DaemonDatArchive} archive - where to write the bookmark to.
262262
* @param {Object} bookmark
263263
* @param {string} bookmark.href
264264
* @param {string} bookmark.title
@@ -294,7 +294,7 @@ exports.addBookmark = async function (archive, bookmark) {
294294
* @description
295295
* Update the content of an existing bookmark.
296296
*
297-
* @param {InternalDatArchive} archive - where to write the bookmark to.
297+
* @param {DaemonDatArchive} archive - where to write the bookmark to.
298298
* @param {string} pathname - the pathname of the bookmark.
299299
* @param {Object} bookmark
300300
* @param {string} bookmark.href
@@ -328,7 +328,7 @@ exports.editBookmark = async function (archive, pathname, bookmark) {
328328
* @description
329329
* Delete an existing bookmark
330330
*
331-
* @param {InternalDatArchive} archive - where to write the bookmark to.
331+
* @param {DaemonDatArchive} archive - where to write the bookmark to.
332332
* @param {string} pathname - the pathname of the bookmark.
333333
* @returns {Promise<void>}
334334
*/

crawler/comments.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const JSON_PATH_REGEX = /^\/data\/comments\/([^/]+)\.json$/i
2323
// =
2424

2525
/**
26-
* @typedef {import('../dat/library').InternalDatArchive} InternalDatArchive
26+
* @typedef {import('../dat/daemon').DaemonDatArchive} DaemonDatArchive
2727
* @typedef {import('./util').CrawlSourceRecord} CrawlSourceRecord
2828
* @typedef { import("./site-descriptions").SiteDescription } SiteDescription
2929
*
@@ -68,7 +68,7 @@ exports.removeListener = events.removeListener.bind(events)
6868
* @description
6969
* Crawl the given site for comments.
7070
*
71-
* @param {InternalDatArchive} archive - site to crawl.
71+
* @param {DaemonDatArchive} archive - site to crawl.
7272
* @param {CrawlSourceRecord} crawlSource - internal metadata about the crawl target.
7373
* @returns {Promise}
7474
*/
@@ -369,7 +369,7 @@ const get = exports.get = async function (url) {
369369
* @description
370370
* Create a new comment.
371371
*
372-
* @param {InternalDatArchive} archive - where to write the comment to.
372+
* @param {DaemonDatArchive} archive - where to write the comment to.
373373
* @param {string} topic
374374
* @param {Object} comment
375375
* @param {string} comment.replyTo
@@ -403,7 +403,7 @@ exports.add = async function (archive, topic, comment) {
403403
* @description
404404
* Update the content of an existing comment.
405405
*
406-
* @param {InternalDatArchive} archive - where to write the comment to.
406+
* @param {DaemonDatArchive} archive - where to write the comment to.
407407
* @param {string} pathname - the pathname of the comment.
408408
* @param {Object} comment
409409
* @param {string} [comment.replyTo]
@@ -446,7 +446,7 @@ exports.edit = async function (archive, pathname, comment) {
446446
* @description
447447
* Delete an existing comment
448448
*
449-
* @param {InternalDatArchive} archive - where to write the comment to.
449+
* @param {DaemonDatArchive} archive - where to write the comment to.
450450
* @param {string} pathname - the pathname of the comment.
451451
* @returns {Promise<void>}
452452
*/

crawler/discussions.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const JSON_PATH_REGEX = /^\/data\/discussions\/([^/]+)\.json$/i
2323
// =
2424

2525
/**
26-
* @typedef {import('../dat/library').InternalDatArchive} InternalDatArchive
26+
* @typedef {import('../dat/daemon').DaemonDatArchive} DaemonDatArchive
2727
* @typedef {import('./util').CrawlSourceRecord} CrawlSourceRecord
2828
* @typedef { import("./site-descriptions").SiteDescription } SiteDescription
2929
*
@@ -57,7 +57,7 @@ exports.removeListener = events.removeListener.bind(events)
5757
* @description
5858
* Crawl the given site for discussions.
5959
*
60-
* @param {InternalDatArchive} archive - site to crawl.
60+
* @param {DaemonDatArchive} archive - site to crawl.
6161
* @param {CrawlSourceRecord} crawlSource - internal metadata about the crawl target.
6262
* @returns {Promise}
6363
*/
@@ -292,7 +292,7 @@ const get = exports.get = async function (url) {
292292
* @description
293293
* Create a new discussion.
294294
*
295-
* @param {InternalDatArchive} archive - where to write the discussion to.
295+
* @param {DaemonDatArchive} archive - where to write the discussion to.
296296
* @param {Object} discussion
297297
* @param {string} discussion.title
298298
* @param {string} discussion.body
@@ -328,7 +328,7 @@ exports.add = async function (archive, discussion) {
328328
* @description
329329
* Update the content of an existing discussion.
330330
*
331-
* @param {InternalDatArchive} archive - where to write the discussion to.
331+
* @param {DaemonDatArchive} archive - where to write the discussion to.
332332
* @param {string} pathname - the pathname of the discussion.
333333
* @param {Object} discussion
334334
* @param {string} [discussion.title]
@@ -374,7 +374,7 @@ exports.edit = async function (archive, pathname, discussion) {
374374
* @description
375375
* Delete an existing discussion
376376
*
377-
* @param {InternalDatArchive} archive - where to write the discussion to.
377+
* @param {DaemonDatArchive} archive - where to write the discussion to.
378378
* @param {string} pathname - the pathname of the discussion.
379379
* @returns {Promise<void>}
380380
*/

crawler/follows.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const JSON_PATH = '/data/follows.json'
2424
// =
2525

2626
/**
27-
* @typedef {import('../dat/library').InternalDatArchive} InternalDatArchive
27+
* @typedef {import('../dat/daemon').DaemonDatArchive} DaemonDatArchive
2828
* @typedef {import('./util').CrawlSourceRecord} CrawlSourceRecord
2929
* @typedef {import('./site-descriptions').SiteDescription} SiteDescription
3030
*
@@ -52,7 +52,7 @@ exports.removeListener = events.removeListener.bind(events)
5252
* @description
5353
* Crawl the given site for follows.
5454
*
55-
* @param {InternalDatArchive} archive - site to crawl.
55+
* @param {DaemonDatArchive} archive - site to crawl.
5656
* @param {CrawlSourceRecord} crawlSource - internal metadata about the crawl target.
5757
* @returns {Promise<void>}
5858
*/
@@ -245,7 +245,7 @@ const get = exports.get = async function (author, topic) {
245245
* @description
246246
* Add a follow to the given archive.
247247
*
248-
* @param {InternalDatArchive} archive
248+
* @param {DaemonDatArchive} archive
249249
* @param {string} topic
250250
* @param {Object} [opts]
251251
* @param {string} [opts.visibility]
@@ -273,7 +273,7 @@ exports.add = async function (archive, topic, opts) {
273273
* @description
274274
* Edit a follow for the given archive.
275275
*
276-
* @param {InternalDatArchive} archive
276+
* @param {DaemonDatArchive} archive
277277
* @param {string} topic
278278
* @param {Object} [opts]
279279
* @param {string} [opts.visibility]
@@ -298,7 +298,7 @@ exports.edit = async function (archive, topic, opts) {
298298
* @description
299299
* Remove a follow from the given archive.
300300
*
301-
* @param {InternalDatArchive} archive
301+
* @param {DaemonDatArchive} archive
302302
* @param {string} topic
303303
* @returns {Promise<void>}
304304
*/
@@ -335,7 +335,7 @@ function toOrigin (url) {
335335
}
336336

337337
/**
338-
* @param {InternalDatArchive} archive
338+
* @param {DaemonDatArchive} archive
339339
* @returns {Promise<Object>}
340340
*/
341341
async function readFollowsFile (archive) {
@@ -352,7 +352,7 @@ async function readFollowsFile (archive) {
352352
}
353353

354354
/**
355-
* @param {InternalDatArchive} archive
355+
* @param {DaemonDatArchive} archive
356356
* @param {function(Object): void} updateFn
357357
* @returns {Promise<void>}
358358
*/

crawler/media.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const JSON_PATH_REGEX = /^\/data\/media\/([^/]+)\.json$/i
2222
// =
2323

2424
/**
25-
* @typedef {import('../dat/library').InternalDatArchive} InternalDatArchive
25+
* @typedef {import('../dat/daemon').DaemonDatArchive} DaemonDatArchive
2626
* @typedef {import('./util').CrawlSourceRecord} CrawlSourceRecord
2727
* @typedef { import("./site-descriptions").SiteDescription } SiteDescription
2828
*
@@ -57,7 +57,7 @@ exports.removeListener = events.removeListener.bind(events)
5757
* @description
5858
* Crawl the given site for media.
5959
*
60-
* @param {InternalDatArchive} archive - site to crawl.
60+
* @param {DaemonDatArchive} archive - site to crawl.
6161
* @param {CrawlSourceRecord} crawlSource - internal metadata about the crawl target.
6262
* @returns {Promise}
6363
*/
@@ -319,7 +319,7 @@ const get = exports.get = async function (url) {
319319
* @description
320320
* Create a new media.
321321
*
322-
* @param {InternalDatArchive} archive - where to write the media to.
322+
* @param {DaemonDatArchive} archive - where to write the media to.
323323
* @param {Object} media
324324
* @param {string} media.subtype
325325
* @param {string} media.href
@@ -357,7 +357,7 @@ exports.add = async function (archive, media) {
357357
* @description
358358
* Update the content of an existing media.
359359
*
360-
* @param {InternalDatArchive} archive - where to write the media to.
360+
* @param {DaemonDatArchive} archive - where to write the media to.
361361
* @param {string} pathname - the pathname of the media.
362362
* @param {Object} media
363363
* @param {string} [media.subtype]
@@ -405,7 +405,7 @@ exports.edit = async function (archive, pathname, media) {
405405
* @description
406406
* Delete an existing media
407407
*
408-
* @param {InternalDatArchive} archive - where to write the media to.
408+
* @param {DaemonDatArchive} archive - where to write the media to.
409409
* @param {string} pathname - the pathname of the media.
410410
* @returns {Promise<void>}
411411
*/

crawler/posts.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const JSON_PATH_REGEX = /^\/data\/posts\/([^/]+)\.json$/i
2323
// =
2424

2525
/**
26-
* @typedef {import('../dat/library').InternalDatArchive} InternalDatArchive
26+
* @typedef {import('../dat/daemon').DaemonDatArchive} DaemonDatArchive
2727
* @typedef {import('./util').CrawlSourceRecord} CrawlSourceRecord
2828
* @typedef { import("./site-descriptions").SiteDescription } SiteDescription
2929
*
@@ -54,7 +54,7 @@ exports.removeListener = events.removeListener.bind(events)
5454
* @description
5555
* Crawl the given site for posts.
5656
*
57-
* @param {InternalDatArchive} archive - site to crawl.
57+
* @param {DaemonDatArchive} archive - site to crawl.
5858
* @param {CrawlSourceRecord} crawlSource - internal metadata about the crawl target.
5959
* @returns {Promise}
6060
*/
@@ -231,7 +231,7 @@ const get = exports.get = async function (url) {
231231
* @description
232232
* Create a new post.
233233
*
234-
* @param {InternalDatArchive} archive - where to write the post to.
234+
* @param {DaemonDatArchive} archive - where to write the post to.
235235
* @param {Object} post
236236
* @param {string} post.body
237237
* @param {string} post.visibility
@@ -261,7 +261,7 @@ exports.add = async function (archive, post) {
261261
* @description
262262
* Update the content of an existing post.
263263
*
264-
* @param {InternalDatArchive} archive - where to write the post to.
264+
* @param {DaemonDatArchive} archive - where to write the post to.
265265
* @param {string} pathname - the pathname of the post.
266266
* @param {Object} post
267267
* @param {string} [post.body]
@@ -301,7 +301,7 @@ exports.edit = async function (archive, pathname, post) {
301301
* @description
302302
* Delete an existing post
303303
*
304-
* @param {InternalDatArchive} archive - where to write the post to.
304+
* @param {DaemonDatArchive} archive - where to write the post to.
305305
* @param {string} pathname - the pathname of the post.
306306
* @returns {Promise<void>}
307307
*/

crawler/reactions.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const JSON_PATH_REGEX = /^\/data\/reactions\/([^/]+)\.json$/i
2222
// =
2323

2424
/**
25-
* @typedef {import('../dat/library').InternalDatArchive} InternalDatArchive
25+
* @typedef {import('../dat/daemon').DaemonDatArchive} DaemonDatArchive
2626
* @typedef {import('./util').CrawlSourceRecord} CrawlSourceRecord
2727
*
2828
* @typedef {Object} Reaction
@@ -55,7 +55,7 @@ exports.removeListener = events.removeListener.bind(events)
5555
* @description
5656
* Crawl the given site for reactions.
5757
*
58-
* @param {InternalDatArchive} archive - site to crawl.
58+
* @param {DaemonDatArchive} archive - site to crawl.
5959
* @param {CrawlSourceRecord} crawlSource - internal metadata about the crawl target.
6060
* @returns {Promise}
6161
*/
@@ -269,7 +269,7 @@ exports.tabulate = async function (topic, opts) {
269269
* @description
270270
* Create a new reaction.
271271
*
272-
* @param {InternalDatArchive} archive - where to write the reaction to.
272+
* @param {DaemonDatArchive} archive - where to write the reaction to.
273273
* @param {string} topic
274274
* @param {string} emoji
275275
* @returns {Promise<void>}
@@ -293,7 +293,7 @@ exports.add = async function (archive, topic, emoji) {
293293
* @description
294294
* Delete an existing reaction
295295
*
296-
* @param {InternalDatArchive} archive - where to write the reaction to.
296+
* @param {DaemonDatArchive} archive - where to write the reaction to.
297297
* @param {string} topic
298298
* @param {string} emoji
299299
* @returns {Promise<void>}
@@ -315,7 +315,7 @@ exports.remove = async function (archive, topic, emoji) {
315315
// =
316316

317317
/**
318-
* @param {InternalDatArchive} archive
318+
* @param {DaemonDatArchive} archive
319319
* @param {string} pathname
320320
* @returns {Promise<Object>}
321321
*/
@@ -337,7 +337,7 @@ async function readReactionFile (archive, pathname) {
337337
}
338338

339339
/**
340-
* @param {InternalDatArchive} archive
340+
* @param {DaemonDatArchive} archive
341341
* @param {string} pathname
342342
* @param {string} topic
343343
* @param {string|boolean} addEmoji

0 commit comments

Comments
 (0)