@versini/sassysaint-common 4.66.0 → 4.67.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/dist/index.d.ts +17 -0
- package/dist/utilities/newsBrief.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -845,6 +845,8 @@ export declare interface NewsBrief {
|
|
|
845
845
|
time: string;
|
|
846
846
|
};
|
|
847
847
|
items: NewsBriefItem[];
|
|
848
|
+
otherCommentary?: NewsCommentary[];
|
|
849
|
+
onThisDay?: NewsOnThisDay;
|
|
848
850
|
}
|
|
849
851
|
|
|
850
852
|
export declare interface NewsBriefItem {
|
|
@@ -853,6 +855,15 @@ export declare interface NewsBriefItem {
|
|
|
853
855
|
summary: string;
|
|
854
856
|
local: boolean;
|
|
855
857
|
evidence: NewsEvidence[];
|
|
858
|
+
commentary?: NewsCommentary[];
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
export declare interface NewsCommentary {
|
|
862
|
+
author: string;
|
|
863
|
+
newsletter: string;
|
|
864
|
+
title: string;
|
|
865
|
+
url: string;
|
|
866
|
+
summary: string;
|
|
856
867
|
}
|
|
857
868
|
|
|
858
869
|
export declare interface NewsEvidence {
|
|
@@ -861,6 +872,12 @@ export declare interface NewsEvidence {
|
|
|
861
872
|
url: string;
|
|
862
873
|
}
|
|
863
874
|
|
|
875
|
+
export declare interface NewsOnThisDay {
|
|
876
|
+
title: string;
|
|
877
|
+
url: string;
|
|
878
|
+
line: string;
|
|
879
|
+
}
|
|
880
|
+
|
|
864
881
|
/**
|
|
865
882
|
* Color class mappings and CSS variables for the theme. Covers both color
|
|
866
883
|
* schemes at once, via Tailwind `dark:` prefixes inside the class strings.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function t(t){return"string"==typeof t&&""!==t.trim()}let e=new Set(['"',"\\","/","b","f","n","r","t","u"]),r={"\n":"\\n","\r":"\\r"," ":"\\t"};function n(t){return t.replace(/\\([\\|[\]])/g,"$1")}function
|
|
1
|
+
function t(t){return"string"==typeof t&&""!==t.trim()}let e=new Set(['"',"\\","/","b","f","n","r","t","u"]),r={"\n":"\\n","\r":"\\r"," ":"\\t"};function n(t){return t.replace(/\\([\\|[\]])/g,"$1")}function a(e){if(!t(e))return!1;try{let{protocol:t}=new URL(e);return"http:"===t||"https:"===t}catch{return!1}}function l(e,r){return Array.isArray(e)?e.flatMap(e=>{let{author:l,newsletter:i,title:u,url:f,summary:o}=e??{};return!t(l)||!t(i)||!t(u)||!t(o)||!a(f)||r.has(f)?[]:(r.add(f),[{author:n(l),newsletter:i,title:n(u),url:f,summary:o}])}):[]}function i(i){let u,f=i.trim();if(!f||f.length>4e4)return null;try{u=function(t){try{return JSON.parse(t)}catch{return JSON.parse(function(t){let n="",a=!1;for(let l=0;l<t.length;l++){let i=t[l];if(a)if("\\"===i){let r=t[l+1]??"";n+=e.has(r)?`\\${r}`:`\\\\${r}`,l++}else'"'===i?(a=!1,n+=i):i<" "?n+=r[i]??`\\u${i.charCodeAt(0).toString(16).padStart(4,"0")}`:n+=i;else a='"'===i,n+=i}return n}(t))}}(f)}catch{return null}if(!u||!t(u.asOf)||!Array.isArray(u.items))return null;let o=new Set,s=function(e){let{title:r,url:l,line:i}=e??{};return t(r)&&a(l)&&t(i)?{title:n(r),url:l,line:i}:void 0}(u.onThisDay),c=new Set(s?[s.url]:[]),h=u.items.flatMap(e=>{let{id:r,title:i,summary:u,local:f,evidence:s,commentary:h}=e??{};if(!t(r)||o.has(r)||!t(i)||!t(u))return[];o.add(r);let d=l(h,c);return[{id:r,title:i,summary:u,local:!0===f,evidence:function(e){if(!Array.isArray(e))return[];let r=new Set;return e.flatMap(e=>{let{outlet:l,headline:i,url:u}=e??{};return!t(l)||!t(i)||!a(u)||r.has(u)?[]:(r.add(u),[{outlet:n(l),headline:n(i),url:u}])})}(s),...d.length>0?{commentary:d}:{}}]}),d=l(u.otherCommentary,c),m=u.earlier;return{asOf:u.asOf,...t(u.note)?{note:u.note}:{},...m&&t(m.chatId)&&t(m.time)?{earlier:{chatId:m.chatId,time:m.time}}:{},items:h,...d.length>0?{otherCommentary:d}:{},...s?{onThisDay:s}:{}}}let u=/^[^\S\n]{0,3}```(\w*)[^\S\n]*\n([\s\S]*?)\n[^\S\n]{0,3}```/gm;function f(t){for(let[,e,r]of t.matchAll(u))if("newsbrief"===e.toLowerCase()||""===e&&/"asOf"/.test(r)){let t=i(r);if(t)return t}return null}export{f as findNewsBrief,i as parseNewsBrief};
|