@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 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 l(l){let a,i=l.trim();if(!i||i.length>4e4)return null;try{a=function(t){try{return JSON.parse(t)}catch{return JSON.parse(function(t){let n="",l=!1;for(let a=0;a<t.length;a++){let i=t[a];if(l)if("\\"===i){let r=t[a+1]??"";n+=e.has(r)?`\\${r}`:`\\\\${r}`,a++}else'"'===i?(l=!1,n+=i):i<" "?n+=r[i]??`\\u${i.charCodeAt(0).toString(16).padStart(4,"0")}`:n+=i;else l='"'===i,n+=i}return n}(t))}}(i)}catch{return null}if(!a||!t(a.asOf)||!Array.isArray(a.items))return null;let u=new Set,f=a.items.flatMap(e=>{let{id:r,title:l,summary:a,local:i,evidence:f}=e??{};return!t(r)||u.has(r)||!t(l)||!t(a)?[]:(u.add(r),[{id:r,title:l,summary:a,local:!0===i,evidence:function(e){if(!Array.isArray(e))return[];let r=new Set;return e.flatMap(e=>{let{outlet:l,headline:a,url:i}=e??{};return!t(l)||!t(a)||!function(e){if(!t(e))return!1;try{let{protocol:t}=new URL(e);return"http:"===t||"https:"===t}catch{return!1}}(i)||r.has(i)?[]:(r.add(i),[{outlet:n(l),headline:n(a),url:i}])})}(f)}])}),s=a.earlier;return{asOf:a.asOf,...t(a.note)?{note:a.note}:{},...s&&t(s.chatId)&&t(s.time)?{earlier:{chatId:s.chatId,time:s.time}}:{},items:f}}let a=/^[^\S\n]{0,3}```(\w*)[^\S\n]*\n([\s\S]*?)\n[^\S\n]{0,3}```/gm;function i(t){for(let[,e,r]of t.matchAll(a))if("newsbrief"===e.toLowerCase()||""===e&&/"asOf"/.test(r)){let t=l(r);if(t)return t}return null}export{i as findNewsBrief,l as parseNewsBrief};
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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@versini/sassysaint-common",
3
- "version": "4.66.0",
3
+ "version": "4.67.0",
4
4
  "license": "MIT",
5
5
  "author": "Arno Versini",
6
6
  "publishConfig": {