@invertase/private-notification-parser
Advanced tools
Comparing version 0.0.6 to 0.0.7
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var x=["uid","extras","actions","stats","mAdjustments","mGlobalSortKey","audioAttributes"],b={"pri":"priority","effectiveNotificationChannel":"channel","seen":"hasSeen","opPkg":"packageName","template":"style","groupKey":"group","fgServiceShown":"foregroundServiceShown"};function S(t){var e=t;return e.startsWith("(")&&e.endsWith(")")&&(e=e.substr(1,e.length-2)),e.startsWith("'")&&e.endsWith("'")&&(e=e.substr(1,e.length-2)),"true"===e||"false"!==e&&("null"===e?null:"=true"===e||"=false"!==e&&(e.match(/^[0-9.-]+$/gm)?e.includes(".")?parseFloat(e):parseInt(e,10):e))}function N(t){var e=t.split("|");if(!e.length)return{group:null};var r=e[e.length-1];return r.includes("g:")?{group:S(r.replace(/^g:/,""))}:{group:null}}function W(t){if(null==t||!t.length)return null;for(var e={},r=t.replace("NotificationChannel{","").replace(/}$/,"").split(", "),n=0;n<r.length;n++){var s=r[n].split(/=(.+)?/),i=s[0],a=s[1];i=y(i),e[i=b[i]||i]=S(a||"null")}return e}function y(t){return t.replace(/^m([A-Z])/g,function(t){return t.substr(1).toLowerCase()})}function n(t){for(var e,r={},n=/^\s\s\s\s\s\s([a-zA-Z]*)=(.*)$/gm;null!==(e=n.exec(t));){e.index===n.lastIndex&&n.lastIndex++;var s=e[1],i=e[2];x.includes(s)||(r[b[s]||s]=S(i.trim()))}var a=function(t){var e=t.match(/^\s\s\s\s\s\sextras={\n(.|\n)*\s\s\s\s\s\s}/gm);if(!e)return{};for(var r={},n={},s=e[0].split("\n").filter(function(t){return t.startsWith(" ".repeat(8))}).map(function(t){return t.trim()}),i=0;i<s.length;i++){var a=s[i],o=/^(.*)=([^\n]+)$/g.exec(a);if(o&&o.length){var l=o[1],u=o[2].split(/\s(.+)/),c=u[0],f=u[1],g=S(void 0===f?c:f);if(l.startsWith("android."))r[l.replace("android.","")]=g;else n[l]=g}else console.log("Failed to parse extras line: "+a)}return{android:r,custom:n}}(t);Object.assign(r,a.android),r.data=a.custom,r.actions=function(t){var e=t.match(/^\s\s\s\s\s\sactions={\n(.|\n)*?\s\s\s\s\s}/gm);if(!e)return[];for(var r=[],n=e[0].split("\n").filter(function(t){return t.startsWith(" ".repeat(8))&&!t.endsWith("}")}).map(function(t){return t.trim()}),s=0;s<n.length;s++){var i=n[s],a=/^\[\d+]\s"(.*)"/g.exec(i);a&&a.length?r.push(a[1]):console.log('Failed to parse actions line: "'+i+'"')}return r}(t);for(var o,l,u,c,f,g,p={},d=Object.entries(r),h=0;h<d.length;h++){s=d[h][0],i=d[h][1];if("icon"===(s=b[s]||s)&&(f=i.trim(),void 0,i=(g=/^.*\s\/\s(.*)$/g.exec(f))&&g.length&&g[1]||f),"style"===s&&(i=i.replace("android.app.Notification$","")),"channel"===s&&(i=W(i)),"key"!==s)if("group"!==s)p[s=y(s)]=i;else{var m=N(i.trim());Object.assign(p,m)}else{var v=(o=i.trim(),void 0,l=o.split("|"),u=l[2],c=l[3],{id:S(u||null),tag:S(c||null)});Object.assign(p,v)}}return p}exports.parseValue=S,exports.default=function(t){return function(t){var e=t.match(/Notification List:\n([\s\S]*?)(?=\n\n\s\s\S)/g);if(!e||!e.length)return[];var r=e[0].match(/NotificationRecord(\s|\S)*?(?=NotificationRecord|$)/g);return r&&r.length?r.map(function(t){return n(t)}).filter(Boolean).sort(function(t,e){return Number(t.creationTimeMs<e.creationTimeMs)}):[]}(t)},exports.stringToHashCode=function(t){var e,r=0,n=t.length;if(0===n)return r;for(e=0;e<n;e++)r=(r<<5)-r+t.charCodeAt(e),r|=0;return r}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var x=["uid","extras","actions","stats","mAdjustments","mGlobalSortKey","audioAttributes"],b={"pri":"priority","effectiveNotificationChannel":"channel","seen":"hasSeen","opPkg":"packageName","template":"style","groupKey":"group","fgServiceShown":"foregroundServiceShown"};function S(t){var e=t;return e.startsWith("(")&&e.endsWith(")")&&(e=e.substr(1,e.length-2)),e.startsWith("'")&&e.endsWith("'")&&(e=e.substr(1,e.length-2)),"true"===e||"false"!==e&&("null"===e?null:"=true"===e||"=false"!==e&&(e.match(/^[0-9.-]+$/gm)?e.includes(".")?parseFloat(e):parseInt(e,10):e))}function y(t){var e=t.split("|");if(!e.length)return{group:null};var r=e[e.length-1];return r.includes("g:")?{group:S(r.replace(/^g:/,""))}:{group:null}}function N(t){if(null==t||!t.length)return null;for(var e={},r=t.replace("NotificationChannel{","").replace(/}$/,"").split(", "),n=0;n<r.length;n++){var s=r[n].split(/=(.+)?/),i=s[0],a=s[1];i=W(i),e[i=b[i]||i]=S(a||"null")}return e}function W(t){return t.replace(/^m([A-Z])/g,function(t){return t.substr(1).toLowerCase()})}function n(t){for(var e,r={},n=/^\s\s\s\s\s\s([a-zA-Z]*)=(.*)$/gm;null!==(e=n.exec(t));){e.index===n.lastIndex&&n.lastIndex++;var s=e[1],i=e[2];x.includes(s)||(r[b[s]||s]=S(i.trim()))}var a=function(t){var e=t.match(/^\s\s\s\s\s\sextras={\n(.|\n)*\s\s\s\s\s\s}/gm);if(!e)return{};for(var r={},n={},s=e[0].split("\n").filter(function(t){return t.startsWith(" ".repeat(8))}).map(function(t){return t.trim()}),i=0;i<s.length;i++){var a=s[i],o=/^(.*)=([^\n]+)$/g.exec(a);if(o&&o.length){var l=o[1],u=o[2].split(/\s(.+)/),c=u[0],f=u[1],p=S(void 0===f?c:f);if(l.startsWith("android.")){var g=l.replace("android.","");if(r[g]=p,"remoteInputHistory"===g&&null!==p){var h=i,d=[];i+=p;for(var v=0;v<p;v++){var m=s[h+v+1];d.push(m.trim().replace(/\[[0-9]{1,2}]\s/,""))}r[g]=d}}else n[l]=p}else console.log("Failed to parse extras line: "+a)}return{android:r,custom:n}}(t);Object.assign(r,a.android),r.data=a.custom,r.actions=function(t){var e=t.match(/^\s\s\s\s\s\sactions={\n(.|\n)*?\s\s\s\s\s}/gm);if(!e)return[];for(var r=[],n=e[0].split("\n").filter(function(t){return t.startsWith(" ".repeat(8))&&!t.endsWith("}")}).map(function(t){return t.trim()}),s=0;s<n.length;s++){var i=n[s],a=/^\[\d+]\s"(.*)"/g.exec(i);a&&a.length?r.push(a[1]):console.log('Failed to parse actions line: "'+i+'"')}return r}(t);for(var o,l,u,c,f,p,g={},h=Object.entries(r),d=0;d<h.length;d++){s=h[d][0],i=h[d][1];if("icon"===(s=b[s]||s)&&(f=i.trim(),void 0,i=(p=/^.*\s\/\s(.*)$/g.exec(f))&&p.length&&p[1]||f),"style"===s&&(i=i.replace("android.app.Notification$","")),"channel"===s&&(i=N(i)),"key"!==s)if("group"!==s)g[s=W(s)]=i;else{var v=y(i.trim());Object.assign(g,v)}else{var m=(o=i.trim(),void 0,l=o.split("|"),u=l[2],c=l[3],{id:S(u||null),tag:S(c||null)});Object.assign(g,m)}}return g}exports.parseValue=S,exports.default=function(t){return function(t){var e=t.match(/Notification List:\n([\s\S]*?)(?=\n\n\s\s\S)/g);if(!e||!e.length)return[];var r=e[0].match(/NotificationRecord(\s|\S)*?(?=NotificationRecord|$)/g);return r&&r.length?r.map(function(t){return n(t)}).filter(Boolean).sort(function(t,e){return Number(t.creationTimeMs<e.creationTimeMs)}):[]}(t)},exports.stringToHashCode=function(t){var e,r=0,n=t.length;if(0===n)return r;for(e=0;e<n;e++)r=(r<<5)-r+t.charCodeAt(e),r|=0;return r}; |
{ | ||
"name": "@invertase/private-notification-parser", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "private-notification-parser", | ||
@@ -5,0 +5,0 @@ "engines": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9085