shopify 3.94.1 → 3.94.2
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/{chunk-6OKIHCZG.js → chunk-2E6Y4J4T.js} +1 -1
- package/dist/{chunk-7FYGRWMW.js → chunk-KVWHPGOA.js} +114 -114
- package/dist/{chunk-D24XVLOA.js → chunk-LH4VO6EV.js} +1 -1
- package/dist/{chunk-3TG7H626.js → chunk-PRNHS74J.js} +4 -4
- package/dist/{chunk-3CRQIN6A.js → chunk-RXF32AET.js} +2 -2
- package/dist/{chunk-EU23C3Y3.js → chunk-YPE4BWWD.js} +2 -2
- package/dist/{error-handler-YQEGKTYS.js → error-handler-CRWXGODM.js} +1 -1
- package/dist/hooks/postrun.js +1 -1
- package/dist/hooks/prerun.js +1 -1
- package/dist/index.js +6 -6
- package/dist/{local-J5FE2ICC.js → local-7MUCLBBI.js} +1 -1
- package/dist/{node-package-manager-AKAMTDCS.js → node-package-manager-GFIGZZ24.js} +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/{ui-65JEOETJ.js → ui-AOFJCTTO.js} +1 -1
- package/dist/{workerd-2QD5AUPI.js → workerd-VBG5LYNX.js} +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +7 -7
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{A as n,a as d,i as g,w}from"./chunk-
|
|
1
|
+
import{A as n,a as d,i as g,w}from"./chunk-PRNHS74J.js";import{Q as p,m,n as l}from"./chunk-LH4VO6EV.js";import{Ed as a,Kc as x,Uc as C,a as f,sc as y,uc as N,vc as _}from"./chunk-KVWHPGOA.js";import{g as c}from"./chunk-VPRTJUIN.js";c();c();var h;function S(){return h??(h={currentCommandId:""}),h}function I(){return S().currentCommandId}function M(e){S().currentCommandId=e}var E="https://cdn.shopify.com/static/cli/notifications.json",D="Cache is empty",V=["notifications:list","notifications:generate","init","app:init","theme:init","hydrogen:init","cache:clear"];function u(){return process.env.SHOPIFY_CLI_NOTIFICATIONS_URL??E}var k=n.object({id:n.string(),message:n.string(),type:n.enum(["info","warning","error"]),frequency:n.enum(["always","once","once_a_day","once_a_week"]),ownerChannel:n.string(),cta:n.object({label:n.string(),url:n.string().url()}).optional(),title:n.string().optional(),minVersion:n.string().optional(),maxVersion:n.string().optional(),minDate:n.string().optional(),maxDate:n.string().optional(),commands:n.array(n.string()).optional(),surface:n.string().optional()}),b=n.object({notifications:n.array(k)});async function re(e,t=process.env){try{let r=I();if(T(r,t)||g(t))return;let o=await v(),s=F(o.notifications,r,e);a(`Notifications to show: ${s.length}`),await O(s)}catch(r){if(r.message===D){a("Notifications to show: 0 (Cache is empty)");return}if(r.message==="abort")throw new x;let o=`Error showing notifications: ${r.message}`;a(o);let{sendErrorToBugsnag:s}=await import("./error-handler-CRWXGODM.js");await s(o,"unexpected_error")}}function T(e,t=process.env){return f(t.CI)||f(t.SHOPIFY_UNIT_TEST)||V.includes(e)}async function O(e){e.slice(0,2).forEach(t=>{let r={headline:t.title,body:t.message.replace(/\\n/g,`
|
|
2
2
|
`),link:t.cta};switch(t.type){case"info":{y(r);break}case"warning":{N(r);break}case"error":throw _(r),new Error("abort")}m(`notification-${t.id}`,new Date().getTime().toString())})}async function v(){let e=`notifications-${u()}`,t=l(e)?.value;if(!t)throw new Error(D);let r=JSON.parse(t);return b.parse(r)}async function ne(){a("Fetching notifications...");let e=await w(u(),void 0,{useNetworkLevelRetry:!1,useAbortSignal:!0,timeoutMs:3*1e3});if(e.status!==200)throw new Error(`Failed to fetch notifications: ${e.statusText}`);let t=await e.text(),r=JSON.parse(t),o=b.parse(r);return await B(t),o}async function B(e){m(`notifications-${u()}`,e),a(`Notifications from ${u()} stored in the cache`)}function oe(e,t=process.argv,r=process.env){if(T(e,r)||!t[0]||!t[1])return;let o=t[0],i=[t[1],"notifications","list","--ignore-errors"];C(o,i,{background:!0,env:{...process.env,SHOPIFY_CLI_NO_ANALYTICS:"1"},externalErrorHandler:async $=>{a(`Failed to fetch notifications in background: ${$.message}`)}})}function F(e,t,r,o=new Date(new Date().setUTCHours(0,0,0,0)),s=d){return e.filter(i=>A(i,s)).filter(i=>j(i,o)).filter(i=>q(i,t)).filter(i=>L(i,t,r)).filter(i=>H(i))}function A(e,t){let r=!e.minVersion||p(t,`>=${e.minVersion}`),o=!e.maxVersion||p(t,`<=${e.maxVersion}`);return r&&o}function j(e,t){let r=!e.minDate||new Date(e.minDate)<=t,o=!e.maxDate||new Date(e.maxDate)>=t;return r&&o}function q(e,t){return t===""?!0:!e.commands||e.commands.includes(t)}function L(e,t,r){let o=t.split(":")[0]??"all",s=e.surface??"all";return r?r.includes(s):s===o||s==="all"}function H(e){if(!e.frequency)return!0;let t=`notification-${e.id}`,r=l(t)?.value;if(!r)return!0;switch(e.frequency){case"always":return!0;case"once":return!1;case"once_a_day":return new Date().getTime()-Number(r)>24*3600*1e3;case"once_a_week":return new Date().getTime()-Number(r)>168*3600*1e3}}function se(e){let t=[];return e.minDate&&t.push(`from ${e.minDate}`),e.maxDate&&t.push(`to ${e.maxDate}`),e.minVersion&&t.push(`from v${e.minVersion}`),e.maxVersion&&t.push(`to v${e.maxVersion}`),e.frequency==="once"&&t.push("show only once"),e.frequency==="once_a_day"&&t.push("show once a day"),e.frequency==="once_a_week"&&t.push("show once a week"),e.surface&&t.push(`surface = ${e.surface}`),e.commands&&t.push(`commands = ${e.commands.join(", ")}`),t.join(`
|
|
3
3
|
`)}export{M as a,re as b,v as c,ne as d,oe as e,se as f};
|