cresc-server 2026.3.12-aa664e34 → 2026.3.12-e63df15b

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/lib/checkTier.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- import{ha as b,ka as P,la as m,ma as l,na as n,oa as x}from"./chunk-kns3wk1c.js";import{sa as y,ta as N}from"./chunk-s8q7phqg.js";import{xa as h}from"./chunk-zt2ghb1c.js";import{Da as d}from"./chunk-7h00rvvb.js";var o=d(N(),1);var u="https://pushy.reactnative.cn/pricing.html";var r=d(h(),1);function E({email:i,plan:s,expiredOn:a,pricingUrl:p}){return r.createElement(x,{preview:`Your Cresc subscription (${s}) has expired.`},r.createElement(n,{className:"text-sm text-gray-800"},"Dear ",i,","),r.createElement(n,{className:"text-sm text-gray-800"},"Your Cresc subscription has expired:"),r.createElement(n,{className:"text-sm text-gray-800 ml-4"},"\u2022 Plan: ",s,r.createElement("br",null),"\u2022 Expired on: ",a),r.createElement(n,{className:"text-sm text-gray-800"},"To restore full service, please"," ",r.createElement(l,{href:p,className:"text-blue-600 underline"},"renew your subscription"),"."))}E.PreviewProps={email:"user@example.com",plan:"Cresc Standard",expiredOn:"2026-02-14",pricingUrl:"https://pushy.reactnative.cn/pricing.html"};function S(i){return m(r.createElement(E,{...i}))}var e=d(h(),1);function f({email:i,plan:s,expiresOn:a,remainingDays:p,pricingUrl:t}){return e.createElement(x,{preview:`Your Cresc subscription expires in ${p} days.`},e.createElement(n,{className:"text-sm text-gray-800"},"Dear ",i,","),e.createElement(n,{className:"text-sm text-gray-800"},"Your Cresc subscription will expire soon:"),e.createElement(n,{className:"text-sm text-gray-800 ml-4"},"\u2022 Plan: ",s,e.createElement("br",null),"\u2022 Expires on: ",a),e.createElement(n,{className:"text-sm text-gray-800"},"To ensure uninterrupted service, please"," ",e.createElement(l,{href:t,className:"text-blue-600 underline"},"renew your subscription"),"."))}f.PreviewProps={email:"user@example.com",plan:"Cresc Premium",expiresOn:"2026-02-21",remainingDays:7,pricingUrl:"https://pushy.reactnative.cn/pricing.html"};function w(i){return m(e.createElement(f,{...i}))}var g=o.default();async function D(){let i=await y.users.findMany({select:{id:!0,name:!0,email:!0,tier:!0,tierExpiresAt:!0},where:{status:"normal",tier:{not:"free"}}})||[];console.log(`Paid users: ${i.length}`);let s=0,a=0,p=0;for(let t of i){if(!t.tierExpiresAt)continue;let c=o.default(t.tierExpiresAt),T=c.subtract(7,"day"),C=c.subtract(30,"day");if(g.isAfter(c,"day"))s+=1,console.log(`Expired: ${t.email}`),await k(t),await y.users.update({where:{id:t.id},data:{tier:"free",tierExpiresAt:null}});else if(g.isSame(T,"day"))a+=1,console.log(`Expiring in 7d: ${t.email}`),await Y(t,7);else if(g.isSame(C,"day"))p+=1,console.log(`Expiring in 30d: ${t.email}`),await Y(t,30)}console.log(`Finished tier checking.
3
+ import{ha as b,ka as P,la as m,ma as l,na as n,oa as x}from"./chunk-wb1tvrnt.js";import{sa as y,ta as N}from"./chunk-es7rc7xz.js";import{xa as h}from"./chunk-zt2ghb1c.js";import{Da as d}from"./chunk-7h00rvvb.js";var o=d(N(),1);var u="https://pushy.reactnative.cn/pricing.html";var r=d(h(),1);function E({email:i,plan:s,expiredOn:a,pricingUrl:p}){return r.createElement(x,{preview:`Your Cresc subscription (${s}) has expired.`},r.createElement(n,{className:"text-sm text-gray-800"},"Dear ",i,","),r.createElement(n,{className:"text-sm text-gray-800"},"Your Cresc subscription has expired:"),r.createElement(n,{className:"text-sm text-gray-800 ml-4"},"\u2022 Plan: ",s,r.createElement("br",null),"\u2022 Expired on: ",a),r.createElement(n,{className:"text-sm text-gray-800"},"To restore full service, please"," ",r.createElement(l,{href:p,className:"text-blue-600 underline"},"renew your subscription"),"."))}E.PreviewProps={email:"user@example.com",plan:"Cresc Standard",expiredOn:"2026-02-14",pricingUrl:"https://pushy.reactnative.cn/pricing.html"};function S(i){return m(r.createElement(E,{...i}))}var e=d(h(),1);function f({email:i,plan:s,expiresOn:a,remainingDays:p,pricingUrl:t}){return e.createElement(x,{preview:`Your Cresc subscription expires in ${p} days.`},e.createElement(n,{className:"text-sm text-gray-800"},"Dear ",i,","),e.createElement(n,{className:"text-sm text-gray-800"},"Your Cresc subscription will expire soon:"),e.createElement(n,{className:"text-sm text-gray-800 ml-4"},"\u2022 Plan: ",s,e.createElement("br",null),"\u2022 Expires on: ",a),e.createElement(n,{className:"text-sm text-gray-800"},"To ensure uninterrupted service, please"," ",e.createElement(l,{href:t,className:"text-blue-600 underline"},"renew your subscription"),"."))}f.PreviewProps={email:"user@example.com",plan:"Cresc Premium",expiresOn:"2026-02-21",remainingDays:7,pricingUrl:"https://pushy.reactnative.cn/pricing.html"};function w(i){return m(e.createElement(f,{...i}))}var g=o.default();async function D(){let i=await y.users.findMany({select:{id:!0,name:!0,email:!0,tier:!0,tierExpiresAt:!0},where:{status:"normal",tier:{not:"free"}}})||[];console.log(`Paid users: ${i.length}`);let s=0,a=0,p=0;for(let t of i){if(!t.tierExpiresAt)continue;let c=o.default(t.tierExpiresAt),T=c.subtract(7,"day"),C=c.subtract(30,"day");if(g.isAfter(c,"day"))s+=1,console.log(`Expired: ${t.email}`),await k(t),await y.users.update({where:{id:t.id},data:{tier:"free",tierExpiresAt:null}});else if(g.isSame(T,"day"))a+=1,console.log(`Expiring in 7d: ${t.email}`),await Y(t,7);else if(g.isSame(C,"day"))p+=1,console.log(`Expiring in 30d: ${t.email}`),await Y(t,30)}console.log(`Finished tier checking.
4
4
  Expired: ${s}
5
5
  Expiring in 7d: ${a}
6
6
  Expiring in 30d: ${p}`),process.exit(0)}async function k(i){await P({to:i.email,subject:"Cresc: Your Subscription Has Expired",html:S({email:i.email,plan:b[i.tier].title,expiredOn:o.default(i.tierExpiresAt).format("YYYY-MM-DD"),pricingUrl:u})})}async function Y(i,s){await P({to:i.email,subject:`Cresc: Your Subscription Expires in ${s} Days`,html:w({email:i.email,plan:b[i.tier].title,expiresOn:o.default(i.tierExpiresAt).format("YYYY-MM-DD"),remainingDays:s,pricingUrl:u})})}D();