UNPKG

@shopify/cli

Version:

A CLI tool to build for the Shopify platform

2 lines (1 loc) 2.53 kB
import{b as h}from"./chunk-MHWV5RQV.js";import{Ib as a,Qb as u}from"./chunk-N5PQPIBF.js";import{f as I}from"./chunk-YTNDFQJT.js";import{c as D}from"./chunk-ULQG3XQS.js";import{g as f}from"./chunk-VPRTJUIN.js";f();f();var p;(function(e){e.Local="local",e.Production="production"})(p||(p={}));function L(e=process.env){return e[D.serviceEnv]==="local"?p.Local:p.Production}function v(e=process.env){return L(e)===p.Local}var S;function n(){return S??(S=new h({projectName:`shopify-cli-kit${I()?"-test":""}`})),S}function g(){return v()?"devSessionStore":"sessionStore"}function x(){return v()?"currentDevSessionId":"currentSessionId"}function M(e=n()){return u(a`Getting session store...`),e.get(g())}function N(e,t=n()){u(a`Setting session store...`),t.set(g(),e)}function O(e=n()){u(a`Removing session store...`),e.delete(g())}function F(e=n()){return u(a`Getting current session ID...`),e.get(x())}function T(e,t=n()){u(a`Setting current session ID...`),t.set(x(),e)}function V(e=n()){u(a`Removing current session ID...`),e.delete(x())}async function W(e,t,r,o=n()){let c=b(e,o);if(c?.value!==void 0&&(r===void 0||Date.now()-c.timestamp<r))return c.value;let i=await t();return P(e,i,o),i}function P(e,t,r=n()){let o=r.get("cache")??{};o[e]={value:t,timestamp:Date.now()},r.set("cache",o)}function b(e,t=n()){return(t.get("cache")??{})[e]}function _(e=n()){e.delete("cache")}function y({days:e=0,hours:t=0,minutes:r=0,seconds:o=0}){return(e*24*60*60+t*60*60+r*60+o)*1e3}async function q(e,t,r,o=n()){let c=o.get("cache")??{},i=`most-recent-occurrence-${e}`,s=c[i];return s?.value!==void 0&&Date.now()-s.timestamp<y(t)?!1:(await r(),c[i]={value:!0,timestamp:Date.now()},o.set("cache",c),!0)}async function z(e,t=n()){let{key:r,limit:o,timeout:c,task:i}=e,s=t.get("cache")??{},m=`rate-limited-occurrences-${r}`,w=s[m],l=Date.now();if(w?.value){let C=l-y(c),d=w.value.filter(E=>E>=C);if(d.length>=o)return s[m]={value:d,timestamp:Date.now()},t.set("cache",s),!1;await i(),s[m]={value:[...d,l],timestamp:l}}else await i(),s[m]={value:[l],timestamp:l};return t.set("cache",s),!0}function B(e=n()){return e.get("autoUpgradeEnabled")??!0}function H(e,t=n()){t.set("autoUpgradeEnabled",e)}function A(){return new h({projectName:"shopify-cli-kit-partner-status"})}function J(e){return e&&A().get(e)?!0:null}function Q(e){A().set(e,{status:!0,checkedAt:new Date().toISOString()})}export{p as a,L as b,v as c,M as d,N as e,O as f,F as g,T as h,V as i,W as j,P as k,b as l,_ as m,y as n,q as o,z as p,B as q,H as r,A as s,J as t,Q as u};