ldn-inbox-server 1.4.7 → 1.4.9
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/index.js +6 -2
- package/lib/util.js +11 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -8,7 +8,9 @@ const {
|
|
|
8
8
|
backOff_fetch,
|
|
9
9
|
sendNotification,
|
|
10
10
|
moveTo,
|
|
11
|
-
parseAsJSON
|
|
11
|
+
parseAsJSON,
|
|
12
|
+
generateId,
|
|
13
|
+
generatePublished
|
|
12
14
|
} = require('../lib/util');
|
|
13
15
|
const { handle_inbox } = require('../lib/handler');
|
|
14
16
|
const logger = getLogger();
|
|
@@ -283,5 +285,7 @@ module.exports = {
|
|
|
283
285
|
fetchOriginal ,
|
|
284
286
|
moveTo ,
|
|
285
287
|
sendNotification ,
|
|
286
|
-
handle_inbox
|
|
288
|
+
handle_inbox ,
|
|
289
|
+
generateId ,
|
|
290
|
+
generatePublished
|
|
287
291
|
};
|
package/lib/util.js
CHANGED
|
@@ -56,7 +56,7 @@ async function sendNotification(url,json,options) {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
if (!json['id']) {
|
|
59
|
-
json['id'] =
|
|
59
|
+
json['id'] = generateId();
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
let fetcher = (options && options['fetch']) ? options['fetch'] : backOff_fetch;
|
|
@@ -227,8 +227,18 @@ function parseLocalResource(url,options) {
|
|
|
227
227
|
return { filePath, metaPath, json };
|
|
228
228
|
}
|
|
229
229
|
|
|
230
|
+
function generateId() {
|
|
231
|
+
return 'urn:uuid:' + uuidv4();
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
function generatePublished() {
|
|
235
|
+
return (new Date()).toISOString();
|
|
236
|
+
}
|
|
237
|
+
|
|
230
238
|
module.exports = {
|
|
231
239
|
getLogger ,
|
|
240
|
+
generateId ,
|
|
241
|
+
generatePublished ,
|
|
232
242
|
backOff_fetch ,
|
|
233
243
|
fetchOriginal ,
|
|
234
244
|
moveTo ,
|