@versini/sassysaint-common 4.69.0 → 4.70.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
@@ -857,8 +857,6 @@ export declare interface NewsBrief {
857
857
  time: string;
858
858
  };
859
859
  items: NewsBriefItem[];
860
- otherCommentary?: NewsCommentary[];
861
- onThisDay?: NewsOnThisDay;
862
860
  }
863
861
 
864
862
  export declare interface NewsBriefItem {
@@ -868,15 +866,6 @@ export declare interface NewsBriefItem {
868
866
  local: boolean;
869
867
  image?: string;
870
868
  evidence: NewsEvidence[];
871
- commentary?: NewsCommentary[];
872
- }
873
-
874
- export declare interface NewsCommentary {
875
- author: string;
876
- newsletter: string;
877
- title: string;
878
- url: string;
879
- summary: string;
880
869
  }
881
870
 
882
871
  export declare interface NewsEvidence {
@@ -897,12 +886,6 @@ export declare function newsLinkParts(newsLinks: unknown): {
897
886
  };
898
887
  }[];
899
888
 
900
- export declare interface NewsOnThisDay {
901
- title: string;
902
- url: string;
903
- line: string;
904
- }
905
-
906
889
  /**
907
890
  * Color class mappings and CSS variables for the theme. Covers both color
908
891
  * schemes at once, via Tailwind `dark:` prefixes inside the class strings.
@@ -930,13 +913,6 @@ export declare const PLAN_PLUS = "sassy:plus";
930
913
 
931
914
  export declare const PLAN_PREMIUM = "sassy:advanced";
932
915
 
933
- /**
934
- * The accessible name of a post's "Read the post" link, on the chat card and
935
- * the shared page alike: the visible text first, then the title and newsletter,
936
- * so two posts with the same title still read as different links.
937
- */
938
- export declare function postLinkName(post: NewsCommentary): string;
939
-
940
916
  export declare const PROVIDER_ANTHROPIC = "Anthropic";
941
917
 
942
918
  export declare const PROVIDER_GOOGLE = "Google";
@@ -1 +1 @@
1
- function t(t){return`Read the post: ${t.title}, ${t.newsletter}`}let e=/^https:\/\/encrypted-tbn\d\.gstatic\.com\/images\?q=tbn:[\w-]+$/;function r(t){return"string"==typeof t&&e.test(t)}function n(t){return"string"==typeof t&&""!==t.trim()}let a=new Set(['"',"\\","/","b","f","n","r","t","u"]),l={"\n":"\\n","\r":"\\r"," ":"\\t"};function i(t){return t.replace(/\\([\\|[\]])/g,"$1")}function u(t){if(!n(t))return!1;try{let{protocol:e}=new URL(t);return"http:"===e||"https:"===e}catch{return!1}}function f(t,e){return Array.isArray(t)?t.flatMap(t=>{let{author:r,newsletter:a,title:l,url:f,summary:s}=t??{};return!n(r)||!n(a)||!n(l)||!n(s)||!u(f)||e.has(f)?[]:(e.add(f),[{author:i(r),newsletter:a,title:i(l),url:f,summary:s}])}):[]}function s(t){let e,s=t.trim();if(!s||s.length>4e4)return null;try{e=function(t){try{return JSON.parse(t)}catch{return JSON.parse(function(t){let e="",r=!1;for(let n=0;n<t.length;n++){let i=t[n];if(r)if("\\"===i){let r=t[n+1]??"";e+=a.has(r)?`\\${r}`:`\\\\${r}`,n++}else'"'===i?(r=!1,e+=i):i<" "?e+=l[i]??`\\u${i.charCodeAt(0).toString(16).padStart(4,"0")}`:e+=i;else r='"'===i,e+=i}return e}(t))}}(s)}catch{return null}if(!e||!n(e.asOf)||!Array.isArray(e.items))return null;let o=new Set,c=function(t){let{title:e,url:r,line:a}=t??{};return n(e)&&u(r)&&n(a)?{title:i(e),url:r,line:a}:void 0}(e.onThisDay),h=new Set(c?[c.url]:[]),p=e.items.flatMap(t=>{let{id:e,title:a,summary:l,local:s,image:c,evidence:p,commentary:d}=t??{};if(!n(e)||o.has(e)||!n(a)||!n(l))return[];o.add(e);let m=f(d,h);return[{id:e,title:a,summary:l,local:!0===s,...r(c)?{image:c}:{},evidence:function(t){if(!Array.isArray(t))return[];let e=new Set;return t.flatMap(t=>{let{outlet:r,headline:a,url:l}=t??{};return!n(r)||!n(a)||!u(l)||e.has(l)?[]:(e.add(l),[{outlet:i(r),headline:i(a),url:l}])})}(p),...m.length>0?{commentary:m}:{}}]}),d=f(e.otherCommentary,h),m=e.earlier;return{asOf:e.asOf,...n(e.note)?{note:e.note}:{},...n(e.place)?{place:e.place}:{},...m&&n(m.chatId)&&n(m.time)?{earlier:{chatId:m.chatId,time:m.time}}:{},items:p,...d.length>0?{otherCommentary:d}:{},...c?{onThisDay:c}:{}}}let o=/^[^\S\n]{0,3}```(\w*)[^\S\n]*\n([\s\S]*?)\n[^\S\n]{0,3}```/gm;function c(t){for(let[,e,r]of t.matchAll(o))if("newsbrief"===e.toLowerCase()||""===e&&/"asOf"/.test(r)){let t=s(r);if(t)return t}return null}export{c as findNewsBrief,r as isNewsImageUrl,s as parseNewsBrief,t as postLinkName};
1
+ let t=/^https:\/\/encrypted-tbn\d\.gstatic\.com\/images\?q=tbn:[\w-]+$/;function e(e){return"string"==typeof e&&t.test(e)}function r(t){return"string"==typeof t&&""!==t.trim()}let n=new Set(['"',"\\","/","b","f","n","r","t","u"]),a={"\n":"\\n","\r":"\\r"," ":"\\t"};function l(t){return t.replace(/\\([\\|[\]])/g,"$1")}function i(t){let i,u=t.trim();if(!u||u.length>4e4)return null;try{i=function(t){try{return JSON.parse(t)}catch{return JSON.parse(function(t){let e="",r=!1;for(let l=0;l<t.length;l++){let i=t[l];if(r)if("\\"===i){let r=t[l+1]??"";e+=n.has(r)?`\\${r}`:`\\\\${r}`,l++}else'"'===i?(r=!1,e+=i):i<" "?e+=a[i]??`\\u${i.charCodeAt(0).toString(16).padStart(4,"0")}`:e+=i;else r='"'===i,e+=i}return e}(t))}}(u)}catch{return null}if(!i||!r(i.asOf)||!Array.isArray(i.items))return null;let f=new Set,s=i.items.flatMap(t=>{let{id:n,title:a,summary:i,local:u,image:s,evidence:c}=t??{};return!r(n)||f.has(n)||!r(a)||!r(i)?[]:(f.add(n),[{id:n,title:a,summary:i,local:!0===u,...e(s)?{image:s}:{},evidence:function(t){if(!Array.isArray(t))return[];let e=new Set;return t.flatMap(t=>{let{outlet:n,headline:a,url:i}=t??{};return!r(n)||!r(a)||!function(t){if(!r(t))return!1;try{let{protocol:e}=new URL(t);return"http:"===e||"https:"===e}catch{return!1}}(i)||e.has(i)?[]:(e.add(i),[{outlet:l(n),headline:l(a),url:i}])})}(c)}])}),c=i.earlier;return{asOf:i.asOf,...r(i.note)?{note:i.note}:{},...r(i.place)?{place:i.place}:{},...c&&r(c.chatId)&&r(c.time)?{earlier:{chatId:c.chatId,time:c.time}}:{},items: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,e as isNewsImageUrl,i as parseNewsBrief};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@versini/sassysaint-common",
3
- "version": "4.69.0",
3
+ "version": "4.70.0",
4
4
  "license": "MIT",
5
5
  "author": "Arno Versini",
6
6
  "publishConfig": {