@seedprotocol/feed 0.7.12 → 0.7.13-next.1527.g318ec68
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/dist/getFeedItems.d.ts.map +1 -1
- package/dist/index.js +171 -170
- package/dist/index.js.map +1 -1
- package/package.json +7 -4
package/dist/index.js
CHANGED
|
@@ -104,10 +104,10 @@ var D = (e) => {
|
|
|
104
104
|
} catch (e) {
|
|
105
105
|
console.error("[feed] [setFeedItemDefaults] Error generating Arweave URL:", e);
|
|
106
106
|
}
|
|
107
|
-
let d = e.link || e.Link;
|
|
108
|
-
|
|
109
|
-
let
|
|
110
|
-
if (!
|
|
107
|
+
let d = e.link || e.Link, f = !d || d === "undefined" || typeof d == "string" && d.trim() === "";
|
|
108
|
+
f ? (e.link = u, e.Link = u) : ((!e.link || e.link === "undefined") && (e.link = d), (!e.Link || e.Link === "undefined") && (e.Link = d));
|
|
109
|
+
let p = e.guid || e.Guid;
|
|
110
|
+
if (!p || p === "undefined" || typeof p == "string" && p.trim() === "" ? (e.guid = c && f ? `ar://${c}` : e.link || u, e.Guid = e.guid) : ((!e.guid || e.guid === "undefined") && (e.guid = p), (!e.Guid || e.Guid === "undefined") && (e.Guid = p)), e.timeCreated && !e.pubDate && !e.PubDate) {
|
|
111
111
|
let t = D(e.timeCreated);
|
|
112
112
|
e.pubDate = t, e.PubDate = t;
|
|
113
113
|
} else e.pubDate && !e.PubDate ? e.PubDate = e.pubDate : e.PubDate && !e.pubDate && (e.pubDate = e.PubDate);
|
|
@@ -150,13 +150,14 @@ function je(e, t) {
|
|
|
150
150
|
}, i = te();
|
|
151
151
|
return t.map((t) => k(Ae(t.data, e, r), i));
|
|
152
152
|
}
|
|
153
|
+
var Me = /* @__PURE__ */ new Set(["guid", "Guid"]);
|
|
153
154
|
function k(e, t) {
|
|
154
155
|
if (typeof e == "string") {
|
|
155
156
|
if (e.includes("<")) return se(e, { publicBaseUrl: t });
|
|
156
157
|
let n = oe(e);
|
|
157
158
|
return n ? p(n, t) : e;
|
|
158
159
|
}
|
|
159
|
-
return Array.isArray(e) ? e.map((e) => k(e, t)) : e && typeof e == "object" && Object.getPrototypeOf(e) === Object.prototype ? Object.fromEntries(Object.entries(e).map(([e, n]) => [e, k(n, t)])) : e;
|
|
160
|
+
return Array.isArray(e) ? e.map((e) => k(e, t)) : e && typeof e == "object" && Object.getPrototypeOf(e) === Object.prototype ? Object.fromEntries(Object.entries(e).map(([e, n]) => [e, Me.has(e) ? n : k(n, t)])) : e;
|
|
160
161
|
}
|
|
161
162
|
var A = async (e, t) => {
|
|
162
163
|
await x();
|
|
@@ -170,41 +171,41 @@ var A = async (e, t) => {
|
|
|
170
171
|
items: je(e, i),
|
|
171
172
|
etag: a
|
|
172
173
|
};
|
|
173
|
-
},
|
|
174
|
+
}, Ne = async (e, t) => (await A(e, t)).items, Pe = async (e, t, n) => (await x(), je(e, await s(e, t, n, {
|
|
174
175
|
relations: "expand",
|
|
175
176
|
hydrateStorage: !0
|
|
176
177
|
})));
|
|
177
178
|
//#endregion
|
|
178
179
|
//#region src/consume/parseRss.ts
|
|
179
|
-
function
|
|
180
|
+
function Fe(e) {
|
|
180
181
|
try {
|
|
181
182
|
return JSON.parse(JSON.stringify(e));
|
|
182
183
|
} catch {
|
|
183
184
|
return { ...e };
|
|
184
185
|
}
|
|
185
186
|
}
|
|
186
|
-
var
|
|
187
|
+
var Ie = new ge({ customFields: { item: [
|
|
187
188
|
"featureImage",
|
|
188
189
|
"feature_image",
|
|
189
190
|
"content:encoded",
|
|
190
191
|
"seedUid",
|
|
191
192
|
"SeedUid"
|
|
192
193
|
] } });
|
|
193
|
-
async function
|
|
194
|
-
let t = await
|
|
194
|
+
async function Le(e) {
|
|
195
|
+
let t = await Ie.parseString(e);
|
|
195
196
|
return {
|
|
196
197
|
title: t.title,
|
|
197
198
|
link: t.link,
|
|
198
199
|
description: t.description,
|
|
199
|
-
items: (t.items ?? []).map(
|
|
200
|
+
items: (t.items ?? []).map(Fe)
|
|
200
201
|
};
|
|
201
202
|
}
|
|
202
203
|
//#endregion
|
|
203
204
|
//#region src/rss/generateRssXml.ts
|
|
204
|
-
var j = "http://purl.org/dc/elements/1.1/", M = "http://purl.org/rss/1.0/modules/content/", N = "http://search.yahoo.com/mrss/",
|
|
205
|
+
var j = "http://purl.org/dc/elements/1.1/", M = "http://purl.org/rss/1.0/modules/content/", N = "http://search.yahoo.com/mrss/", Re = { publication: {
|
|
205
206
|
prefix: "publication",
|
|
206
207
|
uri: "https://seedprotocol.io/ns/publication/1.0"
|
|
207
|
-
} },
|
|
208
|
+
} }, ze = "https://seedprotocol.io/ns/relations", Be = /* @__PURE__ */ new Set([
|
|
208
209
|
"xml",
|
|
209
210
|
"xmlns",
|
|
210
211
|
"dc",
|
|
@@ -212,15 +213,15 @@ var j = "http://purl.org/dc/elements/1.1/", M = "http://purl.org/rss/1.0/modules
|
|
|
212
213
|
"content",
|
|
213
214
|
"atom",
|
|
214
215
|
"fh"
|
|
215
|
-
]),
|
|
216
|
+
]), Ve = /* @__PURE__ */ new Set([
|
|
216
217
|
"Title",
|
|
217
218
|
"Link",
|
|
218
219
|
"Guid",
|
|
219
220
|
"PubDate",
|
|
220
221
|
"SeedUid"
|
|
221
222
|
]);
|
|
222
|
-
function
|
|
223
|
-
return
|
|
223
|
+
function He(e, t) {
|
|
224
|
+
return Ve.has(e) ? e.charAt(0).toLowerCase() + e.slice(1) in t : !1;
|
|
224
225
|
}
|
|
225
226
|
var P = [
|
|
226
227
|
"title",
|
|
@@ -254,13 +255,13 @@ function F(e) {
|
|
|
254
255
|
}
|
|
255
256
|
return String(e);
|
|
256
257
|
}
|
|
257
|
-
function
|
|
258
|
+
function Ue(e) {
|
|
258
259
|
return /[<>&]|]]>/.test(e);
|
|
259
260
|
}
|
|
260
261
|
function I(e, t) {
|
|
261
262
|
let n = String(t);
|
|
262
263
|
if (n !== "") {
|
|
263
|
-
if (
|
|
264
|
+
if (Ue(n)) {
|
|
264
265
|
if (n.includes("]]>")) {
|
|
265
266
|
let t = n.split("]]>");
|
|
266
267
|
for (let n = 0; n < t.length; n++) e.dat(t[n]), n < t.length - 1 && e.txt("]]>");
|
|
@@ -271,7 +272,7 @@ function I(e, t) {
|
|
|
271
272
|
function L(e) {
|
|
272
273
|
return typeof e == "object" && !!e && !Array.isArray(e) && !(e instanceof Date);
|
|
273
274
|
}
|
|
274
|
-
var
|
|
275
|
+
var We = 4, Ge = /* @__PURE__ */ new Set([
|
|
275
276
|
...P,
|
|
276
277
|
"guid",
|
|
277
278
|
"source",
|
|
@@ -280,64 +281,64 @@ var Ue = 4, We = /* @__PURE__ */ new Set([
|
|
|
280
281
|
"content:encoded",
|
|
281
282
|
"items"
|
|
282
283
|
]);
|
|
283
|
-
function
|
|
284
|
+
function Ke(e) {
|
|
284
285
|
return e.endsWith("s") && e.length > 1 ? e.slice(0, -1) : e;
|
|
285
286
|
}
|
|
286
|
-
function
|
|
287
|
+
function qe(e) {
|
|
287
288
|
return e.trim().replace(/[^A-Za-z0-9_.-]+/g, "_").replace(/^[^A-Za-z_]+/, "").replace(/^$/, "rel").toLowerCase();
|
|
288
289
|
}
|
|
289
|
-
function
|
|
290
|
-
if (!t.has(e) && !
|
|
290
|
+
function Je(e, t) {
|
|
291
|
+
if (!t.has(e) && !Be.has(e)) return t.add(e), e;
|
|
291
292
|
let n = 2;
|
|
292
293
|
for (;;) {
|
|
293
294
|
let r = `${e}${n}`;
|
|
294
|
-
if (!t.has(r) && !
|
|
295
|
+
if (!t.has(r) && !Be.has(r)) return t.add(r), r;
|
|
295
296
|
n += 1;
|
|
296
297
|
}
|
|
297
298
|
}
|
|
298
|
-
function
|
|
299
|
+
function Ye(e) {
|
|
299
300
|
return Array.isArray(e) && e.length > 0 && e.every((e) => L(e));
|
|
300
301
|
}
|
|
301
|
-
function
|
|
302
|
-
let t = { ...
|
|
302
|
+
function Xe(e) {
|
|
303
|
+
let t = { ...Re }, n = new Set(Object.values(t).map((e) => e.prefix)), r = /* @__PURE__ */ new Set();
|
|
303
304
|
for (let t of e) for (let [e, n] of Object.entries(t)) {
|
|
304
|
-
let t = e === "author" && L(n) || e === "authors" &&
|
|
305
|
-
e.startsWith("_") || (!
|
|
305
|
+
let t = e === "author" && L(n) || e === "authors" && Ye(n);
|
|
306
|
+
e.startsWith("_") || (!Ge.has(e) || t) && (L(n) || Ye(n)) && r.add(Ke(e));
|
|
306
307
|
}
|
|
307
308
|
let i = [...r].sort();
|
|
308
309
|
for (let e of i) t[e] || (t[e] = {
|
|
309
|
-
prefix: qe(
|
|
310
|
-
uri: `${
|
|
310
|
+
prefix: Je(qe(e), n),
|
|
311
|
+
uri: `${ze}/${e}/1.0`
|
|
311
312
|
});
|
|
312
313
|
return t;
|
|
313
314
|
}
|
|
314
|
-
function
|
|
315
|
+
function R(e, t) {
|
|
315
316
|
if (e in t) return t[e];
|
|
316
317
|
if (e.endsWith("s") && e.length > 1) {
|
|
317
318
|
let n = e.slice(0, -1);
|
|
318
319
|
if (n in t) return t[n];
|
|
319
320
|
}
|
|
320
321
|
}
|
|
321
|
-
function
|
|
322
|
+
function Ze(e, t) {
|
|
322
323
|
return t ? `${t.prefix}:${e}` : e;
|
|
323
324
|
}
|
|
324
|
-
function
|
|
325
|
+
function z(e, t, n, r, i = 0, a) {
|
|
325
326
|
let o = e.ele(n);
|
|
326
327
|
for (let [e, n] of Object.entries(t)) {
|
|
327
328
|
if (n == null || e.startsWith("_") || e === "items") continue;
|
|
328
|
-
let t =
|
|
329
|
-
if (i >=
|
|
329
|
+
let t = Ze(e, a);
|
|
330
|
+
if (i >= We) I(o.ele(t), typeof n == "object" ? JSON.stringify(n) : String(n));
|
|
330
331
|
else if (Array.isArray(n)) {
|
|
331
|
-
let t =
|
|
332
|
-
for (let e of n) e != null && (L(e) ?
|
|
333
|
-
} else L(n) ?
|
|
332
|
+
let t = Ze(e.endsWith("s") && e.length > 1 ? e.slice(0, -1) : e, a);
|
|
333
|
+
for (let e of n) e != null && (L(e) ? z(o, e, t, !1, i + 1, a) : I(o.ele(t), String(e)));
|
|
334
|
+
} else L(n) ? z(o, n, t, !1, i + 1, a) : I(o.ele(t), String(n));
|
|
334
335
|
}
|
|
335
336
|
if (r) {
|
|
336
337
|
let n = t.name ?? t.seedUid;
|
|
337
338
|
n && e.ele(j, "creator").txt(String(n));
|
|
338
339
|
}
|
|
339
340
|
}
|
|
340
|
-
function
|
|
341
|
+
function Qe(e, t, n, r, i) {
|
|
341
342
|
if (!(n == null || t.startsWith("_")) && t !== "items") {
|
|
342
343
|
if (t === "guid") {
|
|
343
344
|
let t = n, r = t?.value ?? String(n);
|
|
@@ -399,10 +400,10 @@ function Xe(e, t, n, r, i) {
|
|
|
399
400
|
let r = t.slice(6);
|
|
400
401
|
I(e.ele(N, r), n);
|
|
401
402
|
} else if (n instanceof Date) e.ele(t).txt(F(n));
|
|
402
|
-
else if (t === "author" && L(n))
|
|
403
|
+
else if (t === "author" && L(n)) z(e, n, "author", !0, 0, R(t, i));
|
|
403
404
|
else if (t === "authors" && Array.isArray(n)) {
|
|
404
|
-
let r =
|
|
405
|
-
for (let t of n) if (t && L(t))
|
|
405
|
+
let r = R(t, i);
|
|
406
|
+
for (let t of n) if (t && L(t)) z(e, t, "author", !0, 0, r);
|
|
406
407
|
else {
|
|
407
408
|
let n = typeof t == "string" ? t : t && typeof t == "object" && "name" in t ? `${t.email ?? ""} (${t.name ?? ""})`.trim() || t.name : String(t);
|
|
408
409
|
n && e.ele("author").txt(n);
|
|
@@ -415,28 +416,28 @@ function Xe(e, t, n, r, i) {
|
|
|
415
416
|
}
|
|
416
417
|
}
|
|
417
418
|
else if (Array.isArray(n) && n.length > 0 && n.every((e) => L(e))) {
|
|
418
|
-
let r = t.endsWith("s") ? t.slice(0, -1) : t, a =
|
|
419
|
-
for (let t of n) t &&
|
|
419
|
+
let r = t.endsWith("s") ? t.slice(0, -1) : t, a = R(t, i);
|
|
420
|
+
for (let t of n) t && z(e, t, r, !1, 0, a);
|
|
420
421
|
} else if (Array.isArray(n) && n.every((e) => typeof e == "string")) {
|
|
421
422
|
let r = t.endsWith("s") ? t.slice(0, -1) : t;
|
|
422
423
|
for (let t of n) t && I(e.ele(r), t);
|
|
423
|
-
} else L(n) ?
|
|
424
|
+
} else L(n) ? z(e, n, t, !1, 0, R(t, i)) : I(e.ele(t), String(n));
|
|
424
425
|
}
|
|
425
426
|
}
|
|
426
427
|
}
|
|
427
|
-
var
|
|
428
|
-
function
|
|
428
|
+
var $e = "http://www.w3.org/2005/Atom", et = "http://purl.org/syndication/history/1.0";
|
|
429
|
+
function tt(e) {
|
|
429
430
|
let t = ye({
|
|
430
431
|
version: "1.0",
|
|
431
432
|
encoding: "UTF-8"
|
|
432
|
-
}), n =
|
|
433
|
+
}), n = Xe(e.items), r = {
|
|
433
434
|
"xmlns:dc": j,
|
|
434
435
|
"xmlns:content": M,
|
|
435
436
|
"xmlns:media": N,
|
|
436
|
-
"xmlns:atom":
|
|
437
|
+
"xmlns:atom": $e,
|
|
437
438
|
...Object.values(n).reduce((e, t) => (e[`xmlns:${t.prefix}`] = t.uri, e), {})
|
|
438
439
|
};
|
|
439
|
-
e.isArchive && (r["xmlns:fh"] =
|
|
440
|
+
e.isArchive && (r["xmlns:fh"] = et);
|
|
440
441
|
let i = t.ele("rss", {
|
|
441
442
|
version: "2.0",
|
|
442
443
|
...r
|
|
@@ -450,26 +451,26 @@ function $e(e) {
|
|
|
450
451
|
rel: t.rel,
|
|
451
452
|
href: t.href
|
|
452
453
|
};
|
|
453
|
-
t.type && (e.type = t.type), i.ele(
|
|
454
|
+
t.type && (e.type = t.type), i.ele($e, "link", e);
|
|
454
455
|
}
|
|
455
|
-
e.isArchive && i.ele(
|
|
456
|
+
e.isArchive && i.ele(et, "archive");
|
|
456
457
|
let a = new Set(P);
|
|
457
458
|
for (let t of e.items) {
|
|
458
459
|
let e = i.ele("item"), r = /* @__PURE__ */ new Set();
|
|
459
|
-
for (let i of P) i in t && (
|
|
460
|
-
let o = Object.keys(t).filter((e) => !r.has(e) && !a.has(e) && !e.startsWith("_") && !
|
|
461
|
-
for (let r of o)
|
|
460
|
+
for (let i of P) i in t && (Qe(e, i, t[i], t, n), r.add(i));
|
|
461
|
+
let o = Object.keys(t).filter((e) => !r.has(e) && !a.has(e) && !e.startsWith("_") && !He(e, t)).sort();
|
|
462
|
+
for (let r of o) Qe(e, r, t[r], t, n);
|
|
462
463
|
}
|
|
463
464
|
return t.end({ prettyPrint: !0 });
|
|
464
465
|
}
|
|
465
466
|
//#endregion
|
|
466
467
|
//#region src/cache/types.ts
|
|
467
|
-
function
|
|
468
|
+
function B(e, t, n) {
|
|
468
469
|
return n?.archive ? `${e}:${t}:archive-${n.archive.year}-${n.archive.month}` : n?.page != null && n.page > 1 ? `${e}:${t}:page-${n.page}` : `${e}:${t}`;
|
|
469
470
|
}
|
|
470
471
|
//#endregion
|
|
471
472
|
//#region src/cache/MemoryCache.ts
|
|
472
|
-
var
|
|
473
|
+
var nt = class {
|
|
473
474
|
feedContentCache = /* @__PURE__ */ new Map();
|
|
474
475
|
imageMetadataCache = /* @__PURE__ */ new Map();
|
|
475
476
|
config;
|
|
@@ -477,11 +478,11 @@ var et = class {
|
|
|
477
478
|
this.config = e;
|
|
478
479
|
}
|
|
479
480
|
getFeedContent(e, t, n) {
|
|
480
|
-
let r =
|
|
481
|
+
let r = B(e, t, n), i = this.feedContentCache.get(r);
|
|
481
482
|
return i ? Math.floor(Date.now() / 1e3) > i.expiresAt ? (this.feedContentCache.delete(r), null) : i : null;
|
|
482
483
|
}
|
|
483
484
|
putFeedContent(e, t, n, r) {
|
|
484
|
-
this.feedContentCache.set(
|
|
485
|
+
this.feedContentCache.set(B(e, t, r), n);
|
|
485
486
|
}
|
|
486
487
|
getImageMetadata(e) {
|
|
487
488
|
let t = this.imageMetadataCache.get(e);
|
|
@@ -495,7 +496,7 @@ var et = class {
|
|
|
495
496
|
};
|
|
496
497
|
this.imageMetadataCache.set(e, r);
|
|
497
498
|
}
|
|
498
|
-
},
|
|
499
|
+
}, rt = class {
|
|
499
500
|
cacheDir;
|
|
500
501
|
config;
|
|
501
502
|
constructor(e) {
|
|
@@ -511,7 +512,7 @@ var et = class {
|
|
|
511
512
|
}
|
|
512
513
|
}
|
|
513
514
|
getFeedContentPath(e, t, n) {
|
|
514
|
-
let r =
|
|
515
|
+
let r = B(e, t, n).replace(/:/g, "-");
|
|
515
516
|
return b(this.cacheDir, `${r}.json`);
|
|
516
517
|
}
|
|
517
518
|
getImageMetadataPath(e) {
|
|
@@ -580,12 +581,12 @@ var et = class {
|
|
|
580
581
|
t.code !== "ENOENT" && console.error(`Error clearing image metadata cache for ${e}:`, t);
|
|
581
582
|
}
|
|
582
583
|
}
|
|
583
|
-
},
|
|
584
|
+
}, it = class {
|
|
584
585
|
memoryCache;
|
|
585
586
|
fileCache;
|
|
586
587
|
config;
|
|
587
588
|
constructor(e) {
|
|
588
|
-
this.config = e, this.memoryCache = new
|
|
589
|
+
this.config = e, this.memoryCache = new nt(e), this.fileCache = new rt(e);
|
|
589
590
|
}
|
|
590
591
|
getConfig() {
|
|
591
592
|
return this.config;
|
|
@@ -633,7 +634,7 @@ var et = class {
|
|
|
633
634
|
};
|
|
634
635
|
//#endregion
|
|
635
636
|
//#region src/cache/config.ts
|
|
636
|
-
function
|
|
637
|
+
function at() {
|
|
637
638
|
let e = parseInt(process.env.CACHE_TTL || "3600", 10), t = process.env.CACHE_DIR || "./cache", n = process.env.CACHE_ENABLED === "false" || process.env.CACHE_ENABLED === "0" || process.env.CACHE_ENABLED === "no" || process.env.CACHE_ENABLED === "off", r = process.env.CACHE_ENABLED === "true" || process.env.CACHE_ENABLED === "1" || process.env.CACHE_ENABLED === "yes", i = process.env.NODE_ENV === "development", a;
|
|
638
639
|
a = n ? !1 : r ? !0 : !i, a || console.log(`⚠️ Cache is DISABLED (${n ? "CACHE_ENABLED=false" : i ? "NODE_ENV=development" : "CACHE_ENABLED=false"})`);
|
|
639
640
|
let o = {
|
|
@@ -653,23 +654,23 @@ function rt() {
|
|
|
653
654
|
}
|
|
654
655
|
//#endregion
|
|
655
656
|
//#region src/utils/etag.ts
|
|
656
|
-
function
|
|
657
|
+
function V(e) {
|
|
657
658
|
return `"${be("md5").update(e).digest("hex").substring(0, 16)}"`;
|
|
658
659
|
}
|
|
659
|
-
function
|
|
660
|
+
function ot(e, t) {
|
|
660
661
|
let n = (e) => e.replace(/^W\//, "").replace(/^"|"$/g, "");
|
|
661
662
|
return n(e) === n(t);
|
|
662
663
|
}
|
|
663
|
-
function
|
|
664
|
+
function st(e) {
|
|
664
665
|
return e ? e.split(",").map((e) => e.trim()).filter((e) => e.length > 0) : [];
|
|
665
666
|
}
|
|
666
|
-
function
|
|
667
|
-
let n =
|
|
668
|
-
return n.length === 0 ? !1 : n.includes("*") ? !0 : n.some((e) =>
|
|
667
|
+
function ct(e, t) {
|
|
668
|
+
let n = st(e);
|
|
669
|
+
return n.length === 0 ? !1 : n.includes("*") ? !0 : n.some((e) => ot(e, t));
|
|
669
670
|
}
|
|
670
671
|
//#endregion
|
|
671
672
|
//#region src/services/arweaveImageService.ts
|
|
672
|
-
var
|
|
673
|
+
var lt = class {
|
|
673
674
|
config;
|
|
674
675
|
constructor(e) {
|
|
675
676
|
this.config = e;
|
|
@@ -792,31 +793,31 @@ var st = class {
|
|
|
792
793
|
throw clearTimeout(r), e instanceof Error && e.name === "AbortError" ? Error(`Request timeout after ${this.config.timeout}ms`) : e;
|
|
793
794
|
}
|
|
794
795
|
}
|
|
795
|
-
},
|
|
796
|
+
}, H = Se("seedFeed");
|
|
796
797
|
//#endregion
|
|
797
798
|
//#region src/pickFeedItemRichText.ts
|
|
798
|
-
function
|
|
799
|
+
function U(e, t) {
|
|
799
800
|
for (let n of t) {
|
|
800
801
|
let t = e[n];
|
|
801
802
|
if (typeof t == "string" && t.trim() !== "") return t;
|
|
802
803
|
}
|
|
803
804
|
return "";
|
|
804
805
|
}
|
|
805
|
-
var
|
|
806
|
+
var ut = [
|
|
806
807
|
"summary",
|
|
807
808
|
"Summary",
|
|
808
809
|
"description",
|
|
809
810
|
"Description",
|
|
810
811
|
"text",
|
|
811
812
|
"Text"
|
|
812
|
-
],
|
|
813
|
+
], dt = [
|
|
813
814
|
"html",
|
|
814
815
|
"Html",
|
|
815
816
|
"body",
|
|
816
817
|
"Body",
|
|
817
818
|
"content",
|
|
818
819
|
"Content"
|
|
819
|
-
],
|
|
820
|
+
], ft = [
|
|
820
821
|
"summary",
|
|
821
822
|
"Summary",
|
|
822
823
|
"description",
|
|
@@ -824,13 +825,13 @@ var ct = [
|
|
|
824
825
|
"text",
|
|
825
826
|
"Text"
|
|
826
827
|
];
|
|
827
|
-
function
|
|
828
|
+
function pt(e, t) {
|
|
828
829
|
let n = c(e.model) - c(t.model);
|
|
829
830
|
if (n !== 0) return n;
|
|
830
831
|
let r = e.key.localeCompare(t.key);
|
|
831
832
|
return r === 0 ? e.index - t.index : r;
|
|
832
833
|
}
|
|
833
|
-
function
|
|
834
|
+
function mt(n) {
|
|
834
835
|
let r = e(n), i = t(n), o = null;
|
|
835
836
|
if (r) for (let [e, t] of Object.entries(r)) {
|
|
836
837
|
if (!a(t)) continue;
|
|
@@ -842,7 +843,7 @@ function ft(n) {
|
|
|
842
843
|
index: 0,
|
|
843
844
|
value: r
|
|
844
845
|
};
|
|
845
|
-
(!o ||
|
|
846
|
+
(!o || pt(i, o) < 0) && (o = i);
|
|
846
847
|
}
|
|
847
848
|
if (i) for (let [e, t] of Object.entries(i)) {
|
|
848
849
|
let r = n[e];
|
|
@@ -859,83 +860,83 @@ function ft(n) {
|
|
|
859
860
|
index: n,
|
|
860
861
|
value: s
|
|
861
862
|
};
|
|
862
|
-
(!o ||
|
|
863
|
+
(!o || pt(c, o) < 0) && (o = c);
|
|
863
864
|
}
|
|
864
865
|
}
|
|
865
866
|
return o?.value ?? "";
|
|
866
867
|
}
|
|
867
|
-
function
|
|
868
|
-
return
|
|
868
|
+
function ht(e) {
|
|
869
|
+
return U(e, ut);
|
|
869
870
|
}
|
|
870
|
-
function
|
|
871
|
-
let t =
|
|
871
|
+
function gt(e) {
|
|
872
|
+
let t = mt(e);
|
|
872
873
|
if (t !== "") return t;
|
|
873
|
-
let n =
|
|
874
|
-
return n === "" ?
|
|
874
|
+
let n = U(e, dt);
|
|
875
|
+
return n === "" ? U(e, ft) : n;
|
|
875
876
|
}
|
|
876
|
-
function
|
|
877
|
+
function W(e) {
|
|
877
878
|
return typeof e == "string" && e.includes("data:image/") && e.includes(";base64,");
|
|
878
879
|
}
|
|
879
|
-
function
|
|
880
|
+
function _t(n) {
|
|
880
881
|
let r = e(n);
|
|
881
882
|
if (r) {
|
|
882
|
-
for (let [e, t] of Object.entries(r)) if (a(t) &&
|
|
883
|
+
for (let [e, t] of Object.entries(r)) if (a(t) && W(n[e])) return !0;
|
|
883
884
|
}
|
|
884
885
|
let i = t(n);
|
|
885
886
|
if (i) for (let [e, t] of Object.entries(i)) {
|
|
886
887
|
let r = n[e];
|
|
887
888
|
if (!Array.isArray(r)) continue;
|
|
888
889
|
let i = Math.min(t.length, r.length);
|
|
889
|
-
for (let e = 0; e < i; e++) if (a(t[e]) &&
|
|
890
|
+
for (let e = 0; e < i; e++) if (a(t[e]) && W(r[e])) return !0;
|
|
890
891
|
}
|
|
891
892
|
return !1;
|
|
892
893
|
}
|
|
893
|
-
function
|
|
894
|
-
if (
|
|
895
|
-
for (let t of
|
|
896
|
-
for (let t of
|
|
894
|
+
function vt(e) {
|
|
895
|
+
if (_t(e)) return !0;
|
|
896
|
+
for (let t of dt) if (W(e[t])) return !0;
|
|
897
|
+
for (let t of ut) if (W(e[t])) return !0;
|
|
897
898
|
return !1;
|
|
898
899
|
}
|
|
899
|
-
function
|
|
900
|
-
return t === "include_items" ? [...e] : e.filter((e) => !
|
|
900
|
+
function yt(e, t = "omit_items") {
|
|
901
|
+
return t === "include_items" ? [...e] : e.filter((e) => !vt(e));
|
|
901
902
|
}
|
|
902
903
|
//#endregion
|
|
903
904
|
//#region src/index.ts
|
|
904
|
-
function
|
|
905
|
+
function bt(e) {
|
|
905
906
|
return pe(e)?.mediaUrl;
|
|
906
907
|
}
|
|
907
|
-
function
|
|
908
|
+
function G(e) {
|
|
908
909
|
if (typeof e == "number" && Number.isFinite(e) && e > 0) return e;
|
|
909
910
|
if (typeof e == "string") {
|
|
910
911
|
let t = Number(e);
|
|
911
912
|
if (Number.isFinite(t) && t > 0) return t;
|
|
912
913
|
}
|
|
913
914
|
}
|
|
914
|
-
function
|
|
915
|
+
function xt(e) {
|
|
915
916
|
if (Array.isArray(e)) {
|
|
916
917
|
for (let t of e) {
|
|
917
|
-
let e =
|
|
918
|
+
let e = xt(t);
|
|
918
919
|
if (e) return e;
|
|
919
920
|
}
|
|
920
921
|
return;
|
|
921
922
|
}
|
|
922
|
-
let t =
|
|
923
|
+
let t = bt(e);
|
|
923
924
|
if (t) {
|
|
924
925
|
if (e && typeof e == "object" && !Array.isArray(e)) {
|
|
925
926
|
let n = e;
|
|
926
927
|
return {
|
|
927
928
|
url: t,
|
|
928
929
|
mimeType: typeof n.mimeType == "string" && n.mimeType || typeof n.type == "string" && n.type || typeof n.contentType == "string" && n.contentType || void 0,
|
|
929
|
-
width:
|
|
930
|
-
height:
|
|
931
|
-
size:
|
|
930
|
+
width: G(n.width),
|
|
931
|
+
height: G(n.height),
|
|
932
|
+
size: G(n.size ?? n.fileSize),
|
|
932
933
|
format: typeof n.format == "string" ? n.format : void 0
|
|
933
934
|
};
|
|
934
935
|
}
|
|
935
936
|
return { url: t };
|
|
936
937
|
}
|
|
937
938
|
}
|
|
938
|
-
function
|
|
939
|
+
function K(e) {
|
|
939
940
|
if (e._hasImage && e._imageMetadata && typeof e._imageMetadata == "object") {
|
|
940
941
|
let t = e._imageMetadata;
|
|
941
942
|
if (t.url) return {
|
|
@@ -959,11 +960,11 @@ function q(e) {
|
|
|
959
960
|
"thumbnailImage"
|
|
960
961
|
]) {
|
|
961
962
|
if (!(t in e)) continue;
|
|
962
|
-
let n =
|
|
963
|
+
let n = xt(e[t]);
|
|
963
964
|
if (n) return n;
|
|
964
965
|
}
|
|
965
966
|
}
|
|
966
|
-
function
|
|
967
|
+
function St(e, t, n, r, i, a) {
|
|
967
968
|
let o = n.mimeType || "image/jpeg";
|
|
968
969
|
e.enclosures = [{
|
|
969
970
|
url: n.url,
|
|
@@ -999,15 +1000,15 @@ function bt(e, t, n, r, i, a) {
|
|
|
999
1000
|
"media:description": l
|
|
1000
1001
|
}], n.url && typeof t.content == "string" && t.content.trim() !== "" && !t.content.includes(n.url) && (e["content:encoded"] = `${`<img src="${n.url}" alt="${t.title || ""}"${n.width ? ` width="${n.width}"` : ""}${n.height ? ` height="${n.height}"` : ""} />`}\n${t.content}`);
|
|
1001
1002
|
}
|
|
1002
|
-
var
|
|
1003
|
-
function
|
|
1004
|
-
return
|
|
1003
|
+
var q = null;
|
|
1004
|
+
function J() {
|
|
1005
|
+
return q ||= new it(at()), q;
|
|
1005
1006
|
}
|
|
1006
|
-
function
|
|
1007
|
-
|
|
1007
|
+
function Ct() {
|
|
1008
|
+
q = null;
|
|
1008
1009
|
}
|
|
1009
|
-
var
|
|
1010
|
-
async function
|
|
1010
|
+
var wt = 8;
|
|
1011
|
+
async function Tt(e, t) {
|
|
1011
1012
|
let n = 0;
|
|
1012
1013
|
await Promise.all(Array.from({ length: Math.min(t, e.length) }, async () => {
|
|
1013
1014
|
for (; n < e.length;) {
|
|
@@ -1016,28 +1017,28 @@ async function Ct(e, t) {
|
|
|
1016
1017
|
}
|
|
1017
1018
|
}));
|
|
1018
1019
|
}
|
|
1019
|
-
async function
|
|
1020
|
+
async function Et(e, t, n) {
|
|
1020
1021
|
let r = await n.getImageMetadata(e);
|
|
1021
1022
|
if (r) return r;
|
|
1022
|
-
|
|
1023
|
+
H("detecting image for transaction %s", e);
|
|
1023
1024
|
let i = await t.detectImage(e);
|
|
1024
1025
|
return i && await n.setImageMetadata(e, i), i;
|
|
1025
1026
|
}
|
|
1026
|
-
function
|
|
1027
|
+
function Dt(e) {
|
|
1027
1028
|
if (i(e)) return new URL(e).pathname.replace(/^\//, "");
|
|
1028
1029
|
}
|
|
1029
|
-
function
|
|
1030
|
+
function Ot(e, t) {
|
|
1030
1031
|
let n = e;
|
|
1031
1032
|
if (t === "image") return n.storageTransactionId || n.storage_transaction_id;
|
|
1032
|
-
let r =
|
|
1033
|
-
if (!(!r || r.width && r.height && r.mimeType)) return
|
|
1033
|
+
let r = K(n);
|
|
1034
|
+
if (!(!r || r.width && r.height && r.mimeType)) return Dt(r.url);
|
|
1034
1035
|
}
|
|
1035
|
-
async function
|
|
1036
|
-
let i = e, a =
|
|
1036
|
+
async function kt(e, t, n, r) {
|
|
1037
|
+
let i = e, a = Ot(e, t);
|
|
1037
1038
|
if (a) try {
|
|
1038
|
-
let e = await
|
|
1039
|
+
let e = await Et(a, n, r);
|
|
1039
1040
|
if (!e?.isImage) return;
|
|
1040
|
-
let o = t === "image" ? void 0 :
|
|
1041
|
+
let o = t === "image" ? void 0 : K(i);
|
|
1041
1042
|
i._imageMetadata = o ? {
|
|
1042
1043
|
...e,
|
|
1043
1044
|
url: o.url
|
|
@@ -1046,20 +1047,20 @@ async function Dt(e, t, n, r) {
|
|
|
1046
1047
|
console.warn(`Error enriching item with transaction ${a}:`, e);
|
|
1047
1048
|
}
|
|
1048
1049
|
}
|
|
1049
|
-
async function
|
|
1050
|
-
let i = e.filter((e) =>
|
|
1051
|
-
return
|
|
1050
|
+
async function At(e, t, n, r) {
|
|
1051
|
+
let i = e.filter((e) => Ot(e, t));
|
|
1052
|
+
return H("enriching %d items with image metadata", i.length), await Tt(i.map((e) => () => kt(e, t, n, r)), wt), e;
|
|
1052
1053
|
}
|
|
1053
|
-
async function
|
|
1054
|
+
async function Y(e, t, n) {
|
|
1054
1055
|
let r = n.getConfig().imageMetadata;
|
|
1055
|
-
return r?.enabled ?
|
|
1056
|
+
return r?.enabled ? At(e, t, new lt({
|
|
1056
1057
|
gateways: r.gateways,
|
|
1057
1058
|
timeout: r.timeout
|
|
1058
1059
|
}), n) : e;
|
|
1059
1060
|
}
|
|
1060
|
-
function
|
|
1061
|
+
function jt(e, t) {
|
|
1061
1062
|
let { itemUrlBase: n, itemUrlPath: r, richTextDataUriImages: i = "omit_items" } = t;
|
|
1062
|
-
return
|
|
1063
|
+
return yt(e, i).map((e) => {
|
|
1063
1064
|
let t = e.id || e.seedUid || e.SeedUid || e.storageTransactionId || e.storage_transaction_id, i = `${n.replace(/\/$/, "")}/${r.replace(/^\//, "")}/${t}`, a = e.link || e.Link || e.import_url || e.importUrl || i, o;
|
|
1064
1065
|
if (e.pubDate || e.PubDate) {
|
|
1065
1066
|
let t = e.pubDate || e.PubDate;
|
|
@@ -1069,7 +1070,7 @@ function At(e, t) {
|
|
|
1069
1070
|
let t = e.publishedAt || e.createdAt || e.updatedAt;
|
|
1070
1071
|
o = t && typeof t == "object" && t.constructor === Date ? t : new Date(t);
|
|
1071
1072
|
} else o = /* @__PURE__ */ new Date();
|
|
1072
|
-
let s =
|
|
1073
|
+
let s = ht(e), c = gt(e), l = {
|
|
1073
1074
|
...e,
|
|
1074
1075
|
id: t,
|
|
1075
1076
|
title: e.title || e.Title || "Untitled",
|
|
@@ -1090,7 +1091,7 @@ function At(e, t) {
|
|
|
1090
1091
|
});
|
|
1091
1092
|
}
|
|
1092
1093
|
var X = (e, t, n, r, i, a, o, s, c) => {
|
|
1093
|
-
let l = T(c), u = v(t), d = `${l.feedUrl}/${u}/${n}`, f = r ? `${d}?v=${r}` : d, p = `${l.title} - ${
|
|
1094
|
+
let l = T(c), u = v(t), d = `${l.feedUrl}/${u}/${n}`, f = r ? `${d}?v=${r}` : d, p = `${l.title} - ${Pt(u)}`, m = /* @__PURE__ */ new Date(), h = E(), g = [];
|
|
1094
1095
|
if (i) {
|
|
1095
1096
|
let e = i.baseUrl.replace(/\?.*$/, ""), t = e.includes("?") ? "&" : "?";
|
|
1096
1097
|
i.hasNext && g.push({
|
|
@@ -1108,7 +1109,7 @@ var X = (e, t, n, r, i, a, o, s, c) => {
|
|
|
1108
1109
|
rel: e.rel,
|
|
1109
1110
|
href: e.href
|
|
1110
1111
|
});
|
|
1111
|
-
let _ =
|
|
1112
|
+
let _ = jt(e, {
|
|
1112
1113
|
schemaName: t,
|
|
1113
1114
|
itemUrlBase: h.itemUrlBase,
|
|
1114
1115
|
itemUrlPath: h.itemUrlPath,
|
|
@@ -1139,11 +1140,11 @@ var X = (e, t, n, r, i, a, o, s, c) => {
|
|
|
1139
1140
|
} : void 0,
|
|
1140
1141
|
entries: _.map((e) => {
|
|
1141
1142
|
let t = {
|
|
1142
|
-
...e,
|
|
1143
|
-
id: e.guid || e.id || e.link,
|
|
1144
1143
|
title: e.title || "Untitled",
|
|
1145
1144
|
updated: e.date || e.pubDate || m,
|
|
1146
|
-
links: e.link ? [{ href: e.link }] : []
|
|
1145
|
+
links: e.link ? [{ href: e.link }] : [],
|
|
1146
|
+
...e,
|
|
1147
|
+
id: e.guid || e.id || e.link
|
|
1147
1148
|
};
|
|
1148
1149
|
if (e.content && (t.content = e.content), e.description && (t.summary = e.description), e._imageMetadata && e._hasImage) {
|
|
1149
1150
|
let n = e._imageMetadata;
|
|
@@ -1220,26 +1221,26 @@ var X = (e, t, n, r, i, a, o, s, c) => {
|
|
|
1220
1221
|
value: e.id,
|
|
1221
1222
|
isPermaLink: typeof e.id == "string" && (e.id.startsWith("http://") || e.id.startsWith("https://"))
|
|
1222
1223
|
});
|
|
1223
|
-
let r =
|
|
1224
|
-
if (r &&
|
|
1224
|
+
let r = K(e);
|
|
1225
|
+
if (r && St(n, e, r, t, l.author, l.copyright), typeof e.content == "string" && e.content.trim() !== "" && n["content:encoded"] === void 0 && (n["content:encoded"] = e.content), n.dc = {}, (e.date || e.pubDate) && (n.dc.date = e.date || e.pubDate), e.timeCreated) {
|
|
1225
1226
|
let t = /* @__PURE__ */ new Date(e.timeCreated * 1e3);
|
|
1226
1227
|
n.dc.dates || (n.dc.dates = []), n.dc.dates.push(t);
|
|
1227
1228
|
}
|
|
1228
1229
|
return (e.seedUid || e.SeedUid) && (n.dc.identifier || (n.dc.identifier = []), n.dc.identifier.push(e.seedUid || e.SeedUid)), (e.storageTransactionId || e.storage_transaction_id) && (n.dc.identifier || (n.dc.identifier = []), n.dc.identifier.push(e.storageTransactionId || e.storage_transaction_id)), (e.import_url || e.importUrl) && (n.dc.source = e.import_url || e.importUrl), (e.seedUid || e.SeedUid) && (n.seedUid = e.seedUid || e.SeedUid), (e.storageTransactionId || e.storage_transaction_id) && (n.storageTransactionId = e.storageTransactionId || e.storage_transaction_id), e.timeCreated && (n.timeCreated = e.timeCreated), n;
|
|
1229
1230
|
})
|
|
1230
1231
|
};
|
|
1231
|
-
return Promise.resolve(
|
|
1232
|
+
return Promise.resolve(tt(e));
|
|
1232
1233
|
}
|
|
1233
1234
|
}
|
|
1234
1235
|
};
|
|
1235
|
-
function
|
|
1236
|
+
function Mt(e) {
|
|
1236
1237
|
switch (e) {
|
|
1237
1238
|
case "atom": return "application/atom+xml; charset=utf-8";
|
|
1238
1239
|
case "json": return "application/feed+json; charset=utf-8";
|
|
1239
1240
|
default: return "application/rss+xml; charset=utf-8";
|
|
1240
1241
|
}
|
|
1241
1242
|
}
|
|
1242
|
-
function
|
|
1243
|
+
function Nt(e) {
|
|
1243
1244
|
let t = e.toLowerCase();
|
|
1244
1245
|
return [
|
|
1245
1246
|
"rss",
|
|
@@ -1247,14 +1248,14 @@ function Mt(e) {
|
|
|
1247
1248
|
"json"
|
|
1248
1249
|
].includes(t) ? t : null;
|
|
1249
1250
|
}
|
|
1250
|
-
function Nt(e) {
|
|
1251
|
-
return e.charAt(0).toUpperCase() + e.slice(1);
|
|
1252
|
-
}
|
|
1253
1251
|
function Pt(e) {
|
|
1254
|
-
return
|
|
1252
|
+
return e.charAt(0).toUpperCase() + e.slice(1);
|
|
1255
1253
|
}
|
|
1256
1254
|
function Ft(e) {
|
|
1257
|
-
return
|
|
1255
|
+
return V(JSON.stringify(e));
|
|
1256
|
+
}
|
|
1257
|
+
function It(e) {
|
|
1258
|
+
return V(JSON.stringify([
|
|
1258
1259
|
e.sourceEtag ?? null,
|
|
1259
1260
|
e.siteConfig,
|
|
1260
1261
|
e.cacheBust ?? null
|
|
@@ -1267,26 +1268,26 @@ function Z(e, t, n, r = {}) {
|
|
|
1267
1268
|
"Cache-Control": `public, max-age=${e.maxAge}, s-maxage=${e.maxAge}, must-revalidate`,
|
|
1268
1269
|
...r
|
|
1269
1270
|
};
|
|
1270
|
-
return n !== 304 && (i["Content-Type"] = t.contentType ??
|
|
1271
|
+
return n !== 304 && (i["Content-Type"] = t.contentType ?? Mt(e.format), i["X-Feed-Schema"] = e.schemaName, i["X-Feed-Format"] = e.format), new Response(n === 304 ? null : t.content, {
|
|
1271
1272
|
status: n,
|
|
1272
1273
|
headers: i
|
|
1273
1274
|
});
|
|
1274
1275
|
}
|
|
1275
1276
|
function Q(e, t, n, r) {
|
|
1276
|
-
return e.ifNoneMatch &&
|
|
1277
|
+
return e.ifNoneMatch && ct(e.ifNoneMatch, t.etag) ? (H("%s for %s:%s, 304", n, e.schemaName, e.format), Z(e, {
|
|
1277
1278
|
...t,
|
|
1278
1279
|
content: null
|
|
1279
|
-
}, 304)) : (
|
|
1280
|
+
}, 304)) : (H("%s for %s:%s", n, e.schemaName, e.format), Z(e, t, 200, {
|
|
1280
1281
|
"X-Cache": n,
|
|
1281
1282
|
...r
|
|
1282
1283
|
}));
|
|
1283
1284
|
}
|
|
1284
|
-
async function
|
|
1285
|
-
let { schemaName: t, format: n, contentKeyOptions: r } = e, i =
|
|
1285
|
+
async function Lt(e) {
|
|
1286
|
+
let { schemaName: t, format: n, contentKeyOptions: r } = e, i = J(), a = i.getConfig().enabled;
|
|
1286
1287
|
try {
|
|
1287
1288
|
let o;
|
|
1288
1289
|
e.revalidate && (o = await e.fetchItems());
|
|
1289
|
-
let s =
|
|
1290
|
+
let s = It({
|
|
1290
1291
|
sourceEtag: o?.sourceEtag,
|
|
1291
1292
|
siteConfig: e.siteConfig,
|
|
1292
1293
|
cacheBust: e.cacheBust
|
|
@@ -1295,13 +1296,13 @@ async function It(e) {
|
|
|
1295
1296
|
let a = await i.getFeedContent(t, n, r, { fingerprint: s });
|
|
1296
1297
|
if (a) return Q(e, a, "HIT");
|
|
1297
1298
|
}
|
|
1298
|
-
o ??= await e.fetchItems(),
|
|
1299
|
-
let c = await e.render(o.items), l =
|
|
1299
|
+
o ??= await e.fetchItems(), H("building %s:%s from %d items", t, n, o.items.length);
|
|
1300
|
+
let c = await e.render(o.items), l = Mt(n), u = o.sourceEtag ? V(`${s}:${B(t, n, r)}`) : V(c), d = a ? await i.setFeedContent(t, n, {
|
|
1300
1301
|
content: c,
|
|
1301
1302
|
contentType: l,
|
|
1302
1303
|
etag: u,
|
|
1303
1304
|
fingerprint: s,
|
|
1304
|
-
siteFingerprint:
|
|
1305
|
+
siteFingerprint: Ft(e.siteConfig)
|
|
1305
1306
|
}, r) : null;
|
|
1306
1307
|
return d ? Q(e, d, "MISS") : Z(e, {
|
|
1307
1308
|
content: c,
|
|
@@ -1311,7 +1312,7 @@ async function It(e) {
|
|
|
1311
1312
|
}, 200);
|
|
1312
1313
|
} catch (o) {
|
|
1313
1314
|
if (console.error(`Feed generation error for ${t}:${n}:`, o), a) {
|
|
1314
|
-
let a = await i.getFeedContent(t, n, r, { siteFingerprint:
|
|
1315
|
+
let a = await i.getFeedContent(t, n, r, { siteFingerprint: Ft(e.siteConfig) });
|
|
1315
1316
|
if (a) return Q(e, a, "STALE", { Warning: "110 - \"Response is stale\"" });
|
|
1316
1317
|
}
|
|
1317
1318
|
return new Response(JSON.stringify({
|
|
@@ -1329,11 +1330,11 @@ function $(e) {
|
|
|
1329
1330
|
headers: { "Content-Type": "application/json" }
|
|
1330
1331
|
});
|
|
1331
1332
|
}
|
|
1332
|
-
async function
|
|
1333
|
-
let s =
|
|
1333
|
+
async function Rt(e, t, r, i, a, o) {
|
|
1334
|
+
let s = Nt(t);
|
|
1334
1335
|
if (!s) return $(t);
|
|
1335
|
-
let c = v.singular(e.toLowerCase()), l = v(c), u = T(o), d = Math.max(1, a ?? 1), f = E().pageSize, p =
|
|
1336
|
-
return
|
|
1336
|
+
let c = v.singular(e.toLowerCase()), l = v(c), u = T(o), d = Math.max(1, a ?? 1), f = E().pageSize, p = J(), m = !1;
|
|
1337
|
+
return Lt({
|
|
1337
1338
|
schemaName: c,
|
|
1338
1339
|
format: s,
|
|
1339
1340
|
contentKeyOptions: d > 1 ? { page: d } : void 0,
|
|
@@ -1361,7 +1362,7 @@ async function Lt(e, t, r, i, a, o) {
|
|
|
1361
1362
|
href: `${u.feedUrl}/${l}/archive/${n.getUTCFullYear()}/${n.getUTCMonth() + 1}/${s}`
|
|
1362
1363
|
});
|
|
1363
1364
|
}
|
|
1364
|
-
return X(await
|
|
1365
|
+
return X(await Y(e, c, p), c, s, i, {
|
|
1365
1366
|
page: d,
|
|
1366
1367
|
pageSize: f,
|
|
1367
1368
|
hasNext: m,
|
|
@@ -1370,7 +1371,7 @@ async function Lt(e, t, r, i, a, o) {
|
|
|
1370
1371
|
}
|
|
1371
1372
|
});
|
|
1372
1373
|
}
|
|
1373
|
-
async function
|
|
1374
|
+
async function zt(e, t, n, r, i, a, o) {
|
|
1374
1375
|
if (!Number.isInteger(t) || t < 1970 || t > 2100) return new Response(JSON.stringify({ error: `Invalid year: ${t}` }), {
|
|
1375
1376
|
status: 400,
|
|
1376
1377
|
headers: { "Content-Type": "application/json" }
|
|
@@ -1379,10 +1380,10 @@ async function Rt(e, t, n, r, i, a, o) {
|
|
|
1379
1380
|
status: 400,
|
|
1380
1381
|
headers: { "Content-Type": "application/json" }
|
|
1381
1382
|
});
|
|
1382
|
-
let s =
|
|
1383
|
+
let s = Nt(r);
|
|
1383
1384
|
if (!s) return $(r);
|
|
1384
|
-
let c = v.singular(e.toLowerCase()), l = v(c), u = T(o), d =
|
|
1385
|
-
return
|
|
1385
|
+
let c = v.singular(e.toLowerCase()), l = v(c), u = T(o), d = J();
|
|
1386
|
+
return Lt({
|
|
1386
1387
|
schemaName: c,
|
|
1387
1388
|
format: s,
|
|
1388
1389
|
contentKeyOptions: { archive: {
|
|
@@ -1394,7 +1395,7 @@ async function Rt(e, t, n, r, i, a, o) {
|
|
|
1394
1395
|
cacheBust: a,
|
|
1395
1396
|
maxAge: 86400,
|
|
1396
1397
|
revalidate: !1,
|
|
1397
|
-
fetchItems: async () => ({ items: await
|
|
1398
|
+
fetchItems: async () => ({ items: await Pe(c, t, n) }),
|
|
1398
1399
|
render: async (e) => {
|
|
1399
1400
|
let r = `${u.feedUrl}/${l}/${s}`, i = `${u.feedUrl}/${l}/archive`, f = [{
|
|
1400
1401
|
rel: "prev-archive",
|
|
@@ -1406,11 +1407,11 @@ async function Rt(e, t, n, r, i, a, o) {
|
|
|
1406
1407
|
return (p < h.getUTCFullYear() || p === h.getUTCFullYear() && m <= h.getUTCMonth() + 1) && f.push({
|
|
1407
1408
|
rel: "next-archive",
|
|
1408
1409
|
href: `${i}/${p}/${m}/${s}`
|
|
1409
|
-
}), X(await
|
|
1410
|
+
}), X(await Y(e, c, d), c, s, a, void 0, f, !0, void 0, o);
|
|
1410
1411
|
}
|
|
1411
1412
|
});
|
|
1412
1413
|
}
|
|
1413
1414
|
//#endregion
|
|
1414
|
-
export { d as DEFAULT_ARWEAVE_HOST, S as DEFAULT_SITE_CONFIG, f as SEED_RSS_IMAGE_RELATION_FIELD_KEYS, m as classifyMediaRef, X as createFeed,
|
|
1415
|
+
export { d as DEFAULT_ARWEAVE_HOST, S as DEFAULT_SITE_CONFIG, f as SEED_RSS_IMAGE_RELATION_FIELD_KEYS, m as classifyMediaRef, X as createFeed, vt as feedItemRichTextContainsDataUriImage, A as fetchFeedItemsBySchemaName, yt as filterItemsByRichTextDataUriImagePolicy, ee as getFeedItemStringField, Ne as getFeedItemsBySchemaName, Pe as getFeedItemsBySchemaNameForMonth, we as getSiteConfig, zt as handleArchiveFeedRequest, Rt as handleFeedRequest, x as initializeFeedPlatform, re as isEasAttestationExplorerUrl, E as loadFeedConfig, ae as normalizeFeedItemFields, Le as parseRssString, gt as pickFeedItemContent, ht as pickFeedItemDescription, Ct as resetCacheManager, Ee as resetSiteConfig, de as resolveSeedRssImageRelationFromItem, fe as resolveSeedRssImageRelationRef, T as resolveSiteConfig, Te as setSiteConfig, Ce as teardownFeedPlatform };
|
|
1415
1416
|
|
|
1416
1417
|
//# sourceMappingURL=index.js.map
|