@stacksjs/actions 0.70.45 → 0.70.54
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/LICENSE.md +21 -0
- package/dist/action.d.ts +104 -17
- package/dist/blog.d.ts +12 -0
- package/dist/build/frontend-static.d.ts +16 -0
- package/dist/chunk-17srgdca.js +5 -0
- package/dist/{chunk-jd1yzkq5.js → chunk-23thftnv.js} +1 -1
- package/dist/{chunk-jbvvb45k.js → chunk-4qzb8g3z.js} +1 -1
- package/dist/{chunk-s03z9zn3.js → chunk-5dfz9en9.js} +2 -2
- package/dist/{chunk-3beht8ja.js → chunk-5hwp0frq.js} +1 -1
- package/dist/{chunk-cqedfbaf.js → chunk-5pwpk005.js} +2 -2
- package/dist/{chunk-yh15ydty.js → chunk-63swek9d.js} +2 -2
- package/dist/chunk-67am4dae.js +688 -0
- package/dist/{chunk-gt77jmb5.js → chunk-8gbewxns.js} +1 -1
- package/dist/chunk-8r76qydb.js +240 -0
- package/dist/{chunk-zbhjh5sz.js → chunk-9x17v4x2.js} +2 -2
- package/dist/chunk-aazd6qpv.js +3 -0
- package/dist/{chunk-n2fd1d0m.js → chunk-ag4fy7cx.js} +1 -1
- package/dist/{chunk-2qchdrf9.js → chunk-badehrwa.js} +1 -1
- package/dist/chunk-dbz9dp2h.js +3 -0
- package/dist/{chunk-v0wnrnaa.js → chunk-e8505qz8.js} +2 -2
- package/dist/chunk-jv7ry09n.js +3 -0
- package/dist/{chunk-w418anbq.js → chunk-jve1p4dz.js} +2 -2
- package/dist/chunk-mcwfmqzb.js +283 -0
- package/dist/chunk-n24m8prb.js +3 -0
- package/dist/{chunk-d5yxdz7e.js → chunk-nm9h5rye.js} +2 -2
- package/dist/{chunk-h0hfqr1p.js → chunk-ny1racy0.js} +2 -2
- package/dist/{chunk-2gh7kgpc.js → chunk-p601xr03.js} +1 -1
- package/dist/{chunk-yvva7qsg.js → chunk-pqnzp7x8.js} +2 -2
- package/dist/chunk-qg9crz2r.js +93 -0
- package/dist/chunk-rj1cbghx.js +17 -0
- package/dist/chunk-rzhs51h1.js +3 -0
- package/dist/{chunk-tzx3h4r8.js → chunk-sp5cjdhd.js} +213 -76
- package/dist/chunk-tqax3gbq.js +16 -0
- package/dist/{chunk-c8qt2xst.js → chunk-vsj8ns4p.js} +1 -1
- package/dist/{chunk-zaw01rqz.js → chunk-x8nrbsk1.js} +2 -2
- package/dist/dev/dashboard-utils.d.ts +19 -1
- package/dist/dev/migrate-watcher.d.ts +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/make.d.ts +19 -0
- package/dist/queue/dlq-purge.d.ts +1 -0
- package/dist/queue/dlq-retry.d.ts +1 -0
- package/dist/queue/dlq.d.ts +1 -0
- package/dist/queue/list.d.ts +1 -0
- package/dist/queue/pause.d.ts +1 -0
- package/dist/queue/quarantine.d.ts +1 -0
- package/dist/queue/resume.d.ts +1 -0
- package/dist/queue/unquarantine.d.ts +1 -0
- package/dist/src/action.js +1 -1
- package/dist/src/actions.js +1 -1
- package/dist/src/add.js +1 -1
- package/dist/src/ai/request-model-access.js +1 -1
- package/dist/src/auth/setup.js +82 -24
- package/dist/src/blog.js +102 -0
- package/dist/src/build/core.js +1 -1
- package/dist/src/build/frontend-static.js +9 -0
- package/dist/src/build/views.js +1 -1
- package/dist/src/build.js +1 -1
- package/dist/src/commit.js +1 -1
- package/dist/src/database/seed.js +1 -1
- package/dist/src/deploy/index.js +38 -45
- package/dist/src/dev/api.js +4 -4
- package/dist/src/dev/dashboard-globals.js +1 -1
- package/dist/src/dev/dashboard-utils.js +1 -1
- package/dist/src/dev/dashboard.js +6 -6
- package/dist/src/dev/docs.js +1 -1
- package/dist/src/dev/index.js +1 -1
- package/dist/src/dev/migrate-watcher.js +2 -0
- package/dist/src/dev/views.js +1 -1
- package/dist/src/discover-packages.js +1 -1
- package/dist/src/examples.js +1 -1
- package/dist/src/generate/component-meta.js +1 -1
- package/dist/src/generate/env-files.js +1 -1
- package/dist/src/generate/ide-helpers.js +1 -1
- package/dist/src/generate/index.js +1 -1
- package/dist/src/generate/lib-entries.js +1 -1
- package/dist/src/generate/vscode-custom-data.js +1 -1
- package/dist/src/helpers/component-meta.js +1 -1
- package/dist/src/helpers/index.js +1 -1
- package/dist/src/helpers/lib-entries.js +1 -1
- package/dist/src/helpers/package-json.js +1 -1
- package/dist/src/helpers/utils.js +1 -1
- package/dist/src/helpers/vscode-custom-data.js +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/key-generate.js +1 -1
- package/dist/src/make-command.js +1 -1
- package/dist/src/make-job.js +1 -1
- package/dist/src/make-policy.js +1 -1
- package/dist/src/make-resource.js +1 -1
- package/dist/src/make.js +1 -1
- package/dist/src/migrate/fresh.js +1 -1
- package/dist/src/orm/base.js +1 -1
- package/dist/src/queue/dlq-purge.js +2 -0
- package/dist/src/queue/dlq-retry.js +2 -0
- package/dist/src/queue/dlq.js +5 -0
- package/dist/src/queue/failed.js +4 -4
- package/dist/src/queue/list.js +5 -0
- package/dist/src/queue/pause.js +2 -0
- package/dist/src/queue/quarantine.js +3 -0
- package/dist/src/queue/resume.js +2 -0
- package/dist/src/queue/unquarantine.js +2 -0
- package/dist/src/release.js +1 -1
- package/dist/src/run-action.js +1 -1
- package/dist/src/scaffold-crud.js +1 -1
- package/dist/src/serve/api.js +1 -1
- package/dist/src/setup/index.js +1 -1
- package/dist/src/setup/ssl.js +1 -1
- package/dist/src/stacks.js +1 -1
- package/dist/src/templates.js +1 -1
- package/dist/src/types.js +1 -1
- package/dist/src/upgrade/dependencies.js +1 -1
- package/dist/src/upgrade/framework-utils.js +1 -1
- package/dist/src/upgrade/framework.js +5 -5
- package/dist/src/upgrade/index.js +1 -1
- package/dist/src/upgrade.js +1 -1
- package/dist/upgrade/framework-utils.d.ts +48 -0
- package/package.json +18 -18
- package/dist/chunk-2kaj93p5.js +0 -3
- package/dist/chunk-3086k7zk.js +0 -184
- package/dist/chunk-4fz2qb8b.js +0 -17
- package/dist/chunk-4p0rjazd.js +0 -101
- package/dist/chunk-77pta9ww.js +0 -93
- package/dist/chunk-d4srk6ma.js +0 -3
- package/dist/chunk-h5rff0v9.js +0 -658
- package/dist/chunk-kr2k0h74.js +0 -16
- package/dist/chunk-kzhgexj4.js +0 -3
- package/dist/chunk-sxp97zys.js +0 -3
- package/dist/chunk-vek18p55.js +0 -5
package/dist/src/dev/views.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{pb as O}from"../../chunk-4qzb8g3z.js";import{AsyncLocalStorage as g}from"async_hooks";import{existsSync as I}from"fs";import{config as G,overridesReady as h}from"@stacksjs/config";import{projectPath as Y}from"@stacksjs/path";var B=new g;function Z(){return B.getStore()??globalThis.__stxServeContext}globalThis.requestContext={cookie(z){return Z()?.cookies?.[z]??null},url(){return Z()?.url??""},locale(){return Z()?.locale??"de"}};var T=Y("serve.ts");try{if(await Bun.file(T).exists())await import(T);else await A()}catch{await A()}function p(z){let H={},J=z.headers.get("cookie")||"";if(!J)return H;for(let M of J.split(";")){let U=M.trim(),Q=U.indexOf("=");if(Q===-1)continue;let N=U.slice(0,Q).trim(),X=U.slice(Q+1).trim();if(!N)continue;try{H[N]=decodeURIComponent(X)}catch{H[N]=X}}return H}async function A(){await h;let{injectGlobalAutoImports:z,isApiBoundRequest:H,proxyToBackend:J}=await import("@stacksjs/server"),{applyRequestLocale:M}=await import("@stacksjs/i18n");await z();let{serve:U}=await import("../../chunk-8r76qydb.js"),{site:Q,i18n:N}=await q(),X="resources/views",$="storage/framework/defaults/resources/views",L=await V(["resources/views/layouts","resources/layouts"])??"resources/views/layouts",w="storage/framework/defaults/resources/layouts",b=await V(["resources/views/components","resources/components"])??"resources/views/components",R=Number(process.env.PORT)||3000,y=Number(process.env.PORT_API)||3008,m=Number(process.env.PORT_DOCS)||G.ports?.docs||3006,C=`http://127.0.0.1:${y}`,j=`http://127.0.0.1:${m}`,v=G?.auth?.defaultTokenName??"auth-token";await U({patterns:[X,$],port:R,componentsDir:"storage/framework/defaults/resources/components",layoutsDir:L,partialsDir:b,fallbackLayoutsDir:w,fallbackPartialsDir:$,quiet:!0,...N&&{i18n:N},...Q?.url&&{site:Q},auth:{cookieName:v,redirectTo:"/login"},onRequest:async(K)=>{let W=new URL(K.url),{maintenanceGate:x}=await import("@stacksjs/server"),F=await x(K);if(F)return F;let{renderBlog:S}=await import("../blog.js"),_=await S(K);if(_)return _;if(W.pathname==="/docs"||W.pathname.startsWith("/docs/"))return J(K,j,"/docs");if(H(K,W.pathname))return J(K,C);if(N&&K.method==="GET"){let E=W.pathname.match(/^\/locale\/([a-z]{2}(?:-[a-z]{2})?)\/?$/i);if(E){let{createLocaleSwitchResponse:k}=await import("@stacksjs/i18n");return k(K,E[1],N)}}let P=await M(K),D={cookies:p(K),url:K.url,locale:P};return globalThis.__stxServeSearch=W.search,globalThis.__stxServeContext=D,B.enterWith(D),null}})}async function V(z){for(let H of z)if(I(Y(H)))return H;return null}function f(z){let H=z.i18n.locales,J=z.i18n.defaultLocale??H[0];return{locales:H,defaultLocale:J,labels:z.i18n.labels??Object.fromEntries(H.map((M)=>[M,M.toUpperCase()])),translations:{},pickerSelector:z.i18n.pickerSelector??"#lang-picker"}}async function d(z){try{let{resolveI18n:H}=await import("@stacksjs/stx");if(typeof H==="function"){let J=H(z,Y());if(J)return J}}catch{}return f(z)}async function q(){let z=Y("site.config.ts");if(!I(z))return{};try{let J=(await import(z)).default;if(!J)return{};if(!J.i18n)return{site:J};let M=await d(J);return{site:J,i18n:M}}catch{}return{}}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{pa as a}from"../chunk-vsj8ns4p.js";import"../chunk-4qzb8g3z.js";export{a as discoverPackages};
|
package/dist/src/examples.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"../chunk-
|
|
2
|
+
import"../chunk-4qzb8g3z.js";import D from"process";import{NpmScript as z}from"@stacksjs/enums";import{log as q}from"@stacksjs/logging";import{hasComponents as A}from"@stacksjs/storage";import{ExitCode as F}from"@stacksjs/types";import{runNpmScript as B}from"@stacksjs/utils";async function G(f){if(f.components||f.vue)await H(f);else if(f.webComponents||f.elements)await I(f);else q.error("An unsupported option was used. Please try again, check the documentation & report the issue, if needed.")}async function Q(f){return await G(f)}async function H(f){if(A())await B(z.ExampleVue,f),q.success("Your component library was built successfully");else q.info("No components found.")}async function I(f){if(A())q.info("Building your Web Component library..."),await B(z.BuildWebComponents,f),q.success("Your Web Component library was built successfully");else q.info("No components found."),D.exit(F.FatalError)}export{I as webComponentExample,G as invoke,Q as examples,H as componentExample};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
-
import{
|
|
3
|
+
import{ia as d}from"../../chunk-5pwpk005.js";import"../../chunk-4qzb8g3z.js";import{log as b}from"@stacksjs/logging";import{hasComponents as f}from"@stacksjs/storage";b.info("Generating component meta...");if(f())d();else b.info("No components found. Skipping component meta generation.");b.success("Generated component meta.");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"../../chunk-
|
|
2
|
+
import"../../chunk-4qzb8g3z.js";import{env as P,envEnum as R}from"@stacksjs/env";import{log as T}from"@stacksjs/logging";import{path as I}from"@stacksjs/path";import{storage as D}from"@stacksjs/storage";var O=["APP_NAME","APP_ENV","APP_KEY","APP_URL","APP_DOMAIN","APP_MAINTENANCE","APP_MAINTENANCE_SECRET","APP_COMING_SOON","APP_COMING_SOON_SECRET","APP_ROOT","DEBUG","PORT","PORT_BACKEND","PORT_ADMIN","PORT_LIBRARY","PORT_DESKTOP","PORT_EMAIL","PORT_DOCS","PORT_INSPECT","PORT_API","PORT_SYSTEM_TRAY","API_PREFIX","DOCS_PREFIX","DB_CONNECTION","DB_HOST","DB_PORT","DB_DATABASE","DB_DATABASE_PATH","DB_USERNAME","DB_PASSWORD","DB_PREFIX","DB_SCHEMA","DB_QUERY_LOGGING_ENABLED","DB_QUERY_LOGGING_SLOW_THRESHOLD","DB_QUERY_LOGGING_RETENTION_DAYS","DB_QUERY_LOGGING_PRUNE_FREQUENCY","DB_QUERY_LOGGING_ANALYSIS_ENABLED","DB_QUERY_LOGGING_ANALYZE_ALL","DB_QUERY_LOGGING_EXPLAIN_PLAN","DB_QUERY_LOGGING_SUGGESTIONS","DATABASE_URL","AWS_ACCOUNT_ID","AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY","AWS_DEFAULT_REGION","AWS_DEFAULT_PASSWORD","AWS_REGION","AWS_HOSTED_ZONE_ID","AWS_S3_BUCKET","AWS_S3_PREFIX","AWS_SES_REGION","MAIL_MAILER","MAIL_HOST","MAIL_PORT","MAIL_USERNAME","MAIL_PASSWORD","MAIL_ENCRYPTION","MAIL_FROM_NAME","MAIL_FROM_ADDRESS","MAIL_DOMAIN","MAIL_DRIVER","MAIL_SERVER_MODE","MAIL_SERVER_PATH","SEARCH_ENGINE_DRIVER","MEILISEARCH_HOST","MEILISEARCH_KEY","STRIPE_SECRET_KEY","STRIPE_PUBLISHABLE_KEY","FRONTEND_APP_ENV","FRONTEND_APP_URL","REALTIME_MODE","BROADCAST_DRIVER","BROADCAST_HOST","BROADCAST_PORT","BROADCAST_SCHEME","BROADCAST_APP_ID","BROADCAST_APP_KEY","BROADCAST_APP_SECRET","BROADCAST_CORS_ORIGIN","BROADCAST_DEBUG","BROADCAST_REDIS_ENABLED","BROADCAST_REDIS_PREFIX","BROADCAST_RATE_LIMIT_ENABLED","BROADCAST_METRICS_ENABLED","REDIS_HOST","REDIS_PORT","REDIS_PASSWORD","PUSHER_APP_ID","PUSHER_APP_KEY","PUSHER_APP_SECRET","PUSHER_APP_CLUSTER","PUSHER_APP_USE_TLS","SSL_DOMAINS","LETSENCRYPT_EMAIL","CONNECT_INSTANCE_ALIAS","PHONE_NOTIFY_EMAIL","PHONE_FORWARD_NUMBER","STORAGE_DRIVER","STORAGE_ROOT","STORAGE_PUBLIC_URL","QUEUE_DRIVER","AUTH_USERNAME_FIELD","AUTH_PASSWORD_FIELD","AUTH_TOKEN_EXPIRY","AUTH_TOKEN_ROTATION","AUTH_PASSWORD_RESET_EXPIRE","AUTH_PASSWORD_RESET_THROTTLE"];T.info("Generating type env files...");var N=`
|
|
3
3
|
// This file is auto-generated by Stacks. Do not edit this file manually.
|
|
4
4
|
// If you want to change the environment variables, please edit the .env file.
|
|
5
5
|
//
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
-
import{
|
|
3
|
+
import{$a as q,ab as x}from"../../chunk-e8505qz8.js";import"../../chunk-ag4fy7cx.js";import"../../chunk-4qzb8g3z.js";import{log as z}from"@stacksjs/logging";import{hasComponents as A}from"@stacksjs/storage";if(A())await x(),await q();else z.info("No components found. Skipping IDE helper generation.");
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Oa as a,Pa as b,Qa as c,Ra as d,Sa as e,Ta as f,Ua as g,Va as h,Wa as i,Xa as j,Ya as k,Za as l,_a as m}from"../../chunk-9x17v4x2.js";import"../../chunk-e8505qz8.js";import"../../chunk-ag4fy7cx.js";import"../../chunk-s735m9mg.js";import"../../chunk-rzhs51h1.js";import"../../chunk-4qzb8g3z.js";export{i as watchTypes,a as invoke,d as generateWebTypes,e as generateVsCodeCustomData,h as generateTypes,k as generateSeeder,j as generatePantryConfig,m as generateOpenApiSpec,c as generateLibEntries,f as generateIdeHelpers,l as generateCoreSymlink,g as generateComponentMeta,b as generate};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
-
import{
|
|
3
|
+
import{ka as i}from"../../chunk-jve1p4dz.js";import"../../chunk-ag4fy7cx.js";import"../../chunk-4qzb8g3z.js";import{library as o}from"@stacksjs/config";import{log as n}from"@stacksjs/logging";import{hasComponents as e,hasFunctions as t}from"@stacksjs/storage";async function r(){if(n.info("Generating library entry points..."),o.releaseable&&e())await i("web-components");else n.info("No components found. Skipping building component entry points.");if(o.releaseable&&t())await i("functions");else n.info("No functions found. Skipping building function entry point.")}await r();export{r as generateLibEntries};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
-
import{
|
|
3
|
+
import{$a as x}from"../../chunk-e8505qz8.js";import"../../chunk-ag4fy7cx.js";import"../../chunk-4qzb8g3z.js";import{log as q}from"@stacksjs/logging";import{hasComponents as z}from"@stacksjs/storage";q.info("Generating VS Code custom data...");if(z())await x();else q.info("No components found. Skipping VS Code custom data generation.");q.success("Generated VS Code custom data.");
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{ia as a,ja as b}from"../../chunk-5pwpk005.js";import"../../chunk-4qzb8g3z.js";export{b as parseStxComponentMeta,a as generateComponentMeta};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"../../chunk-s735m9mg.js";import{
|
|
2
|
+
import"../../chunk-s735m9mg.js";import{db as a,eb as b,fb as c}from"../../chunk-rzhs51h1.js";import"../../chunk-4qzb8g3z.js";export{b as runActions,a as runAction,c as hasAction};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{ka as a,la as b,ma as c,na as d,oa as e}from"../../chunk-jve1p4dz.js";import"../../chunk-ag4fy7cx.js";import"../../chunk-4qzb8g3z.js";export{a as generateLibEntry,e as generateEntryPointData,c as createWebComponentLibraryEntryPoint,b as createLibraryEntryPoint,d as createFunctionLibraryEntryPoint};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{bb as q}from"../../chunk-ag4fy7cx.js";import"../../chunk-4qzb8g3z.js";import{log as G}from"@stacksjs/logging";import{packageJsonPath as I}from"@stacksjs/path";import{writeTextFile as K}from"@stacksjs/storage";async function R(v){let B,C,z,D,E,A;if(v==="web-components")B=q.webComponents?.name,C=q.webComponents?.description,z="components",D=q.webComponents?.keywords,E="web-components";else if(v==="functions")B=q.functions?.name,C=q.functions?.description,z="functions",D=q.functions?.keywords,E="functions";try{if(await K({path:I(v),data:`{
|
|
3
3
|
"name": "${B}",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"version": "",
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{db as a,eb as b,fb as c}from"../../chunk-rzhs51h1.js";import"../../chunk-4qzb8g3z.js";export{b as runActions,a as runAction,c as hasAction};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{$a as a,ab as b}from"../../chunk-e8505qz8.js";import"../../chunk-ag4fy7cx.js";import"../../chunk-4qzb8g3z.js";export{b as generateWebTypes,a as generateVsCodeCustomData};
|
package/dist/src/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"../chunk-e9tcbk71.js";import"../chunk-cdk2r2jd.js";import{
|
|
2
|
+
import"../chunk-e9tcbk71.js";import"../chunk-cdk2r2jd.js";import{q as D,r as E,s as F,t as G,u as H,v as I,w as J,x as K}from"../chunk-pqnzp7x8.js";import{A as ma,y as ka,z as la}from"../chunk-badehrwa.js";import{B as ia,C as ja}from"../chunk-x8nrbsk1.js";import{D as qa}from"../chunk-63swek9d.js";import{$ as da,E as L,F as M,H as N,I as O,J as P,L as Q,M as R,N as S,P as T,Q as U,R as V,S as W,T as X,U as Y,V as Z,W as _,X as $,Y as aa,Z as ba,_ as ca,aa as ea,ba as fa,ca as ga,da as ha}from"../chunk-rj1cbghx.js";import"../chunk-mcwfmqzb.js";import{fa as oa}from"../chunk-8gbewxns.js";import{ga as na}from"../chunk-5hwp0frq.js";import{ha as pa}from"../chunk-nm9h5rye.js";import{pa as C}from"../chunk-vsj8ns4p.js";import{Da as t,Ea as u,Fa as v,Ga as w,Ha as x,Ia as y,Ja as z,Ka as A,La as B}from"../chunk-ny1racy0.js";import{Na as s}from"../chunk-p601xr03.js";import{Oa as f,Pa as g,Qa as h,Ra as i,Sa as j,Ta as k,Ua as l,Va as m,Wa as n,Xa as o,Ya as p,Za as q,_a as r}from"../chunk-9x17v4x2.js";import"../chunk-e8505qz8.js";import"../chunk-ag4fy7cx.js";import"../chunk-s735m9mg.js";import{cb as a}from"../chunk-aazd6qpv.js";import{db as b,eb as c,fb as d}from"../chunk-rzhs51h1.js";import{ib as e}from"../chunk-23thftnv.js";import"../chunk-4qzb8g3z.js";export{n as watchTypes,la as uninstallStack,H as trustCertificate,F as sslCertificatesExist,J as setupSSL,L as setDryRun,ja as scaffoldCrud,z as runSystemTrayDevServer,N as runMake,u as runFrontendDevServer,B as runDocsDevServer,t as runDevServer,A as runDesktopDevServer,y as runDashboardDevServer,x as runComponentsDevServer,s as runCommit,v as runBackendDevServer,w as runApiDevServer,e as runAdd,c as runActions,b as runAction,ia as parseFields,ba as makeStack,qa as makeResource,ea as makeQueueTable,pa as makePolicy,X as makePage,U as makeNotification,W as makeMail,$ as makeLanguage,na as makeJob,Z as makeFunction,R as makeDatabase,P as makeComponent,oa as makeCommand,fa as makeCertificate,O as makeAction,ma as listStacks,K as isSSLSetupComplete,M as isDryRunActive,D as isDomainInHosts,G as isCertificateTrusted,f as invoke,ka as installStack,d as hasAction,i as generateWebTypes,j as generateVsCodeCustomData,m as generateTypes,p as generateSeeder,o as generatePantryConfig,r as generateOpenApiSpec,h as generateLibEntries,k as generateIdeHelpers,q as generateCoreSymlink,l as generateComponentMeta,I as generateCertificates,g as generate,C as discoverPackages,Y as createPage,ca as createNotification,ga as createModel,da as createMigration,ha as createMiddleware,V as createMail,aa as createLanguage,_ as createFunction,T as createFactory,S as createDatabase,Q as createComponent,E as addDomainToHosts,a as Action};
|
package/dist/src/key-generate.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{runCommand as
|
|
2
|
+
import{readFileSync as J}from"fs";import{runCommand as L}from"@stacksjs/cli";import{generateKeypair as M}from"@stacksjs/env";import{projectPath as D}from"@stacksjs/path";import{generateAppKey as N}from"@stacksjs/security";import{existsSync as O}from"@stacksjs/storage";import{setEnvValue as q}from"@stacksjs/utils";if(!O(".env"))await L("cp .env.example .env",{cwd:D()});await q("APP_KEY",N());var G=(()=>{try{return J(D(".env"),"utf-8")}catch{return""}})(),z=/^DOTENV_PUBLIC_KEY=.+$/m.test(G),B=/^DOTENV_PRIVATE_KEY=.+$/m.test(G);if(!z||!B){let{publicKey:H,privateKey:I}=M();if(!z)await q("DOTENV_PUBLIC_KEY",H);if(!B)await q("DOTENV_PRIVATE_KEY",I)}
|
package/dist/src/make-command.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{fa as a}from"../chunk-8gbewxns.js";import"../chunk-4qzb8g3z.js";export{a as makeCommand};
|
package/dist/src/make-job.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{ga as a}from"../chunk-5hwp0frq.js";import"../chunk-4qzb8g3z.js";export{a as makeJob};
|
package/dist/src/make-policy.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{ha as a}from"../chunk-nm9h5rye.js";import"../chunk-4qzb8g3z.js";export{a as makePolicy};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{D as a}from"../chunk-63swek9d.js";import"../chunk-4qzb8g3z.js";export{a as makeResource};
|
package/dist/src/make.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$ as
|
|
2
|
+
import{$ as x,E as a,F as b,G as c,H as d,I as e,J as f,K as g,L as h,M as i,N as j,O as k,P as l,Q as m,R as n,S as o,T as p,U as q,V as r,W as s,X as t,Y as u,Z as v,_ as w,aa as y,ba as z,ca as A,da as B}from"../chunk-rj1cbghx.js";import"../chunk-mcwfmqzb.js";import"../chunk-s735m9mg.js";import"../chunk-rzhs51h1.js";import"../chunk-4qzb8g3z.js";export{a as setDryRun,v as makeStack,y as makeQueueTable,p as makePage,m as makeNotification,o as makeMail,t as makeLanguage,r as makeFunction,i as makeDatabase,f as makeComponent,z as makeCertificate,e as makeAction,d as make,b as isDryRunActive,c as invoke,k as factory,q as createPage,w as createNotification,A as createModel,x as createMigration,B as createMiddleware,n as createMail,u as createLanguage,s as createFunction,l as createFactory,j as createDatabase,h as createComponent,g as createAction};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import
|
|
2
|
+
import v from"process";import{generateMigrations as G,migrateAuthTables as H,migrateNotificationTables as I,migrateRbacTables as J,resetDatabase as K,runDatabaseMigration as L}from"@stacksjs/database";import{log as q}from"@stacksjs/logging";var w=await K();if(w?.isErr)console.error(w.error),q.error("resetDatabase failed",w.error),v.exit(1);var x=await G();if(x?.isErr)console.error(x.error),q.error("generateMigrations failed",x.error),v.exit(1);var z=await H();if(!z.success)q.error(`Failed to migrate auth tables: ${z.error}`);var B=await I();if(!B.success)q.error(`Failed to migrate notification tables: ${B.error}`);var C=await J();if(!C.success)q.error(`Failed to migrate RBAC tables: ${C.error}`);var E=await L();if(E.isErr)q.error("runDatabaseMigration failed"),q.error(E.error),v.exit(1);v.exit(0);
|
package/dist/src/orm/base.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"../../chunk-
|
|
2
|
+
import"../../chunk-4qzb8g3z.js";var c=void 0;export{c as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import s from"process";import{log as t}from"@stacksjs/logging";import{purgeDeadLetterJobs as i}from"@stacksjs/queue";var e=l(),o=e.olderThanDays?Number.parseInt(e.olderThanDays,10):e["older-than-days"]?Number.parseInt(e["older-than-days"],10):30;if(!Number.isFinite(o)||o<1)t.error(`Invalid --older-than-days value '${e.olderThanDays??e["older-than-days"]}'`),s.exit(1);try{t.info(`Pruning dead-letter rows older than ${o} day(s)...`);let r=await i(o);t.success(`Deleted ${r} dead-letter row(s)`),s.exit(0)}catch(r){t.error("Failed to purge dead-letter jobs",r),s.exit(1)}function l(){let r={};return s.argv.forEach((a)=>{if(a.startsWith("--")){let[d,n]=a.slice(2).split("=");if(d&&n)r[d]=n}}),r}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import r from"process";import{log as t}from"@stacksjs/logging";import{retryDeadLetterJob as a}from"@stacksjs/queue";var c=u(),n=c.id;if(!n)t.error("Usage: buddy queue:dlq:retry --id=<id>"),r.exit(1);var o=Number.parseInt(n,10);if(Number.isNaN(o))t.error("Invalid id provided"),r.exit(1);try{if(!await a(o))t.error(`Dead-letter job ${o} not found (or DLQ table missing)`),r.exit(1);t.success(`Re-enqueued dead-letter job ${o}`),r.exit(0)}catch(e){t.error("Failed to re-enqueue dead-letter job",e),r.exit(1)}function u(){let e={};return r.argv.forEach((i)=>{if(i.startsWith("--")){let[s,d]=i.slice(2).split("=");if(s&&d)e[s]=d}}),e}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import E from"process";import{log as H}from"@stacksjs/logging";import{listDeadLetterJobs as R}from"@stacksjs/queue";var G=W(),T=G.queue||void 0,U=G.reason||void 0,I=G.since,V=G.limit?Number.parseInt(G.limit,10):100;try{H.info(`Fetching dead-letter jobs...
|
|
3
|
+
`);let B=I?X(I)??void 0:void 0,x=await R({queue:T,reason:U,sinceCutoffMs:B,limit:V});if(x.length===0)console.log("\u2713 No dead-letter jobs found"),E.exit(0);console.log("\u250C\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510"),console.log("\u2502 ID \u2502 Queue \u2502 Reason \u2502 Failures \u2502 Dead-Lettered At \u2502"),console.log("\u251C\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524");for(let z of x){let F=String(z.id).padEnd(3),K=(z.queue||"default").substring(0,32).padEnd(32),O=(z.reason||"unknown").substring(0,16).padEnd(16),P=String(z.total_failures??1).padEnd(8),Q=(z.dead_lettered_at||"N/A").substring(0,24).padEnd(24);console.log(`\u2502 ${F} \u2502 ${K} \u2502 ${O} \u2502 ${P} \u2502 ${Q} \u2502`)}console.log("\u2514\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518"),console.log(`
|
|
4
|
+
Showing ${x.length} dead-letter job(s)`),E.exit(0)}catch(B){let x=B instanceof Error?B.message:String(B);if(/no such table:\s*dead_letter_jobs\b/i.test(x))E.stdout.write(`Dead-letter queue table is not set up yet.
|
|
5
|
+
`),E.stdout.write("Run `buddy queue:table` to create the migrations, then `buddy migrate` to apply them.\n"),E.exit(0);H.error("Failed to fetch dead-letter jobs",B),E.exit(1)}function W(){let B={};return E.argv.forEach((x)=>{if(x.startsWith("--")){let[z,F]=x.slice(2).split("=");if(z&&F)B[z]=F}}),B}function X(B){let x=/^(\d+)([smhd])$/.exec(B.trim());if(!x)return null;let z=Number(x[1]);if(!Number.isFinite(z)||z<=0)return null;let F=x[2]==="s"?1000:x[2]==="m"?60000:x[2]==="h"?3600000:86400000;return Date.now()-z*F}
|
package/dist/src/queue/failed.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import
|
|
3
|
-
`);let
|
|
4
|
-
Total: ${
|
|
5
|
-
`),
|
|
2
|
+
import G from"process";import{log as L}from"@stacksjs/logging";import{FailedJob as M}from"@stacksjs/orm";var T=W(),O=T.queue,K=T.since,I=K?X(K):null;try{L.info(`Fetching failed jobs...
|
|
3
|
+
`);let B;if(O)B=await M.where("queue",O).get();else B=await M.all();if(I)B=B.filter((z)=>{if(!z.failed_at)return!1;let E=Date.parse(z.failed_at);return Number.isFinite(E)&&E>=I});if(B.length===0){if(I)console.log(`\u2713 No failed jobs found since ${K}`);else console.log("\u2713 No failed jobs found");G.exit(0)}console.log("\u250C\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510"),console.log("\u2502 ID \u2502 Queue \u2502 Failed At \u2502 Exception \u2502"),console.log("\u251C\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524");for(let z of B){let E=String(z.id).padEnd(3),H=(z.queue||"default").substring(0,48).padEnd(48),U=(z.failed_at||"N/A").substring(0,21).padEnd(21),V=(z.exception||"Unknown error").substring(0,31).padEnd(31);console.log(`\u2502 ${E} \u2502 ${H} \u2502 ${U} \u2502 ${V} \u2502`)}console.log("\u2514\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518"),console.log(`
|
|
4
|
+
Total: ${B.length} failed job(s)`),G.exit(0)}catch(B){let z=B instanceof Error?B.message:String(B);if(/no such table:\s*(?:jobs|failed_jobs)\b/i.test(z))G.stdout.write(`Queue tables are not set up yet.
|
|
5
|
+
`),G.stdout.write("Run `buddy queue:table` to create the migrations, then `buddy migrate` to apply them.\n"),G.exit(0);L.error("Failed to fetch failed jobs",B),G.exit(1)}function W(){let B={};return G.argv.forEach((z)=>{if(z.startsWith("--")){let[E,H]=z.slice(2).split("=");if(E&&H)B[E]=H}}),B}function X(B){let z=/^(\d+)([smhd])$/.exec(B.trim());if(!z)return null;let E=Number(z[1]);if(!Number.isFinite(E)||E<=0)return null;let H=z[2]==="s"?1000:z[2]==="m"?60000:z[2]==="h"?3600000:86400000;return Date.now()-E*H}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import E from"process";import{log as L}from"@stacksjs/logging";import{Job as M}from"@stacksjs/orm";var I=Z(),H=I.queue,G=I.status,K=I.limit?Number.parseInt(I.limit,10):50;try{L.info(`Fetching queued jobs...
|
|
3
|
+
`);let z=H?await M.where("queue",H).get():await M.all(),C=Math.floor(Date.now()/1000);if(G==="pending")z=z.filter((B)=>!B.reserved_at&&(B.available_at??0)<=C);else if(G==="reserved")z=z.filter((B)=>Boolean(B.reserved_at));else if(G==="delayed")z=z.filter((B)=>!B.reserved_at&&(B.available_at??0)>C);if(Number.isFinite(K)&&K>0)z=z.slice(0,K);if(z.length===0)console.log("\u2713 No queued jobs found"),E.exit(0);console.log("\u250C\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510"),console.log("\u2502 ID \u2502 Queue \u2502 Job \u2502 Attempts \u2502 Status \u2502 Available At \u2502"),console.log("\u251C\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524");for(let B of z){let D=B,O=String(D.id??"").padEnd(3),P=String(D.queue??"default").substring(0,18).padEnd(18),Q=X(D.payload).substring(0,32).padEnd(32),R=String(D.attempts??0).padEnd(8),V=(D.reserved_at?"reserved":(D.available_at??0)>C?"delayed":"pending").padEnd(8),W=Y(D.available_at).padEnd(19);console.log(`\u2502 ${O} \u2502 ${P} \u2502 ${Q} \u2502 ${R} \u2502 ${V} \u2502 ${W} \u2502`)}console.log("\u2514\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518"),console.log(`
|
|
4
|
+
Showing ${z.length} job(s)${H?` on queue '${H}'`:""}${G?` (status=${G})`:""}`),E.exit(0)}catch(z){let C=z instanceof Error?z.message:String(z);if(/no such table:\s*jobs\b/i.test(C))E.stdout.write(`Queue tables are not set up yet.
|
|
5
|
+
`),E.stdout.write("Run `buddy queue:table` to create the migrations, then `buddy migrate` to apply them.\n"),E.exit(0);L.error("Failed to list queued jobs",z),E.exit(1)}function X(z){if(typeof z!=="string")return"unknown";try{let C=JSON.parse(z);return C.jobName??C.name??"unknown"}catch{return"unknown"}}function Y(z){if(typeof z!=="number"||!Number.isFinite(z))return"N/A";return new Date(z*1000).toISOString().slice(0,19).replace("T"," ")}function Z(){let z={};return E.argv.forEach((C)=>{if(C.startsWith("--")){let[B,D]=C.slice(2).split("=");if(B&&D)z[B]=D}}),z}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import r from"process";import{log as s}from"@stacksjs/logging";import{pauseQueue as n}from"@stacksjs/queue";var o=f(),t=o.queue;if(!t)s.error("Usage: buddy queue:pause --queue=<name> [--for=300]"),r.exit(1);var c=o.for?Number.parseInt(o.for,10):300;try{await n(t,c),s.success(`Paused queue '${t}' for ${c}s`),r.exit(0)}catch(e){s.error("Failed to pause queue",e),r.exit(1)}function f(){let e={};return r.argv.forEach((u)=>{if(u.startsWith("--")){let[i,a]=u.slice(2).split("=");if(i&&a)e[i]=a}}),e}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import B from"process";import{log as F}from"@stacksjs/logging";import{listQuarantined as L,quarantineJob as M}from"@stacksjs/queue";var G=O();try{if(G.add){let x=G.add;await M(x),F.success(`Quarantined ${x}`),B.exit(0)}let z=await L();if(z.length===0)console.log("\u2713 No jobs currently quarantined"),B.exit(0);console.log("\u250C\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510"),console.log("\u2502 ID \u2502 Job Name \u2502 Payload Hash \u2502 Failures \u2502 Quarantined At \u2502"),console.log("\u251C\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524");for(let x of z){let C=String(x.id).padEnd(3),E=(x.job_name||"?").substring(0,32).padEnd(32),H=(x.payload_hash||"?").substring(0,16).padEnd(16),I=String(x.failure_count??0).padEnd(8),K=(x.quarantined_at||"N/A").substring(0,24).padEnd(24);console.log(`\u2502 ${C} \u2502 ${E} \u2502 ${H} \u2502 ${I} \u2502 ${K} \u2502`)}console.log("\u2514\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518"),console.log(`
|
|
3
|
+
${z.length} quarantined entrie(s). Use \`queue:unquarantine <JobName>\` to lift.`),B.exit(0)}catch(z){F.error("Failed to handle queue:quarantine",z),B.exit(1)}function O(){let z={};return B.argv.forEach((x)=>{if(x.startsWith("--")){let[C,E]=x.slice(2).split("=");if(C&&E)z[C]=E}}),z}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import r from"process";import{log as s}from"@stacksjs/logging";import{resumeQueue as c}from"@stacksjs/queue";var n=a(),t=n.queue;if(!t)s.error("Usage: buddy queue:resume --queue=<name>"),r.exit(1);try{await c(t),s.success(`Resumed queue '${t}'`),r.exit(0)}catch(e){s.error("Failed to resume queue",e),r.exit(1)}function a(){let e={};return r.argv.forEach((u)=>{if(u.startsWith("--")){let[o,i]=u.slice(2).split("=");if(o&&i)e[o]=i}}),e}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import t from"process";import{log as e}from"@stacksjs/logging";import{unquarantineJob as s}from"@stacksjs/queue";var c=u(),o=c.name;if(!o)e.error("Usage: buddy queue:unquarantine --name=<JobName>"),t.exit(1);try{await s(o),e.success(`Lifted quarantine for ${o}`),t.exit(0)}catch(r){e.error("Failed to unquarantine",r),t.exit(1)}function u(){let r={};return t.argv.forEach((i)=>{if(i.startsWith("--")){let[n,a]=i.slice(2).split("=");if(n&&a)r[n]=a}}),r}
|
package/dist/src/release.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
-
import"../chunk-e9tcbk71.js";import"../chunk-cdk2r2jd.js";import"../chunk-
|
|
3
|
+
import"../chunk-e9tcbk71.js";import"../chunk-cdk2r2jd.js";import"../chunk-pqnzp7x8.js";import"../chunk-badehrwa.js";import"../chunk-x8nrbsk1.js";import"../chunk-63swek9d.js";import"../chunk-rj1cbghx.js";import"../chunk-mcwfmqzb.js";import"../chunk-8gbewxns.js";import"../chunk-5hwp0frq.js";import"../chunk-nm9h5rye.js";import"../chunk-vsj8ns4p.js";import"../chunk-ny1racy0.js";import"../chunk-p601xr03.js";import"../chunk-9x17v4x2.js";import"../chunk-e8505qz8.js";import"../chunk-ag4fy7cx.js";import"../chunk-s735m9mg.js";import"../chunk-aazd6qpv.js";import{eb as C}from"../chunk-rzhs51h1.js";import"../chunk-23thftnv.js";import"../chunk-4qzb8g3z.js";import{parseOptions as G}from"@stacksjs/cli";import{app as H}from"@stacksjs/config";import{Action as q}from"@stacksjs/enums";import{log as E}from"@stacksjs/logging";import{projectPath as I}from"@stacksjs/path";var J=G()??{},z={};for(let[B,F]of Object.entries(J)){if(B==="--"||B==="_")continue;z[B]=F}var K=z.dryRun===!0||z.dryRun==="true",L=K?[q.GenerateLibraryEntries,q.Bump]:[q.GenerateLibraryEntries,q.LintFix,q.Bump],x=await C(L,{cwd:I(),...z});if(x&&x.isErr)E.error(`Release failed: ${x.error?.message??String(x.error)}`),process.exit(1);E.success(`Successfully released ${H.name}`);
|
package/dist/src/run-action.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{db as o}from"../chunk-rzhs51h1.js";import"../chunk-4qzb8g3z.js";export{o as runAction};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{B as a,C as b}from"../chunk-x8nrbsk1.js";import"../chunk-rj1cbghx.js";import"../chunk-mcwfmqzb.js";import"../chunk-s735m9mg.js";import"../chunk-rzhs51h1.js";import"../chunk-4qzb8g3z.js";export{b as scaffoldCrud,a as parseFields};
|
package/dist/src/serve/api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import
|
|
2
|
+
import b from"process";import{config as E}from"@stacksjs/config";import{log as x}from"@stacksjs/logging";import{frameworkPath as F}from"@stacksjs/path";import{route as z}from"@stacksjs/router";var H=b.env.APP_ENV==="production"||b.env.NODE_ENV==="production",A=Number(b.env.PORT)||E.ports?.api||3008,B=b.env.HOST||(H?"0.0.0.0":"127.0.0.1");x.info("[Stacks API] Starting server...");x.info(`[Stacks API] Environment: ${b.env.APP_ENV||"development"}`);var J=await import(F("defaults/app/Middleware/Cors.ts")),N=J.default;z.use(N.toRouterHandler());await z.importRoutes();var O=["production","staging","development"].includes((b.env.APP_ENV||"").toLowerCase()),Q=await z.serve({port:A,hostname:B,reusePort:O});b.on("SIGTERM",()=>{let C=Number(b.env.SHUTDOWN_GRACE_MS)||15000;setTimeout(()=>b.exit(0),C).unref(),Promise.resolve(Q?.stop()).then(()=>b.exit(0))});x.info(`[Stacks API] Server running at http://${B}:${A}`);
|
package/dist/src/setup/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"../../chunk-cdk2r2jd.js";import{
|
|
2
|
+
import"../../chunk-cdk2r2jd.js";import{q as a,r as b,s as c,t as d,u as e,v as f,w as g,x as h}from"../../chunk-pqnzp7x8.js";import"../../chunk-4qzb8g3z.js";export{e as trustCertificate,c as sslCertificatesExist,g as setupSSL,h as isSSLSetupComplete,a as isDomainInHosts,d as isCertificateTrusted,f as generateCertificates,b as addDomainToHosts};
|
package/dist/src/setup/ssl.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{q as a,r as b,s as c,t as d,u as e,v as f,w as g,x as h}from"../../chunk-pqnzp7x8.js";import"../../chunk-4qzb8g3z.js";export{e as trustCertificate,c as sslCertificatesExist,g as setupSSL,h as isSSLSetupComplete,a as isDomainInHosts,d as isCertificateTrusted,f as generateCertificates,b as addDomainToHosts};
|
package/dist/src/stacks.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{A as c,y as a,z as b}from"../chunk-badehrwa.js";import"../chunk-4qzb8g3z.js";export{b as uninstallStack,c as listStacks,a as installStack};
|
package/dist/src/templates.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{ea as a}from"../chunk-mcwfmqzb.js";import"../chunk-4qzb8g3z.js";export{a as CODE_TEMPLATES};
|
package/dist/src/types.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"../chunk-
|
|
2
|
+
import"../chunk-4qzb8g3z.js";import t from"process";import{NpmScript as e}from"@stacksjs/enums";import{log as s}from"@stacksjs/logging";import{ExitCode as i}from"@stacksjs/types";import{runNpmScript as p}from"@stacksjs/utils";async function m(r){let o=await p(e.TypesFix,r);if(o.isErr)s.error("There was an error fixing your types.",o.error),t.exit(i.FatalError);s.success("Types are set")}async function u(r){return await m(r)}export{u as types,m as invoke};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"../../chunk-
|
|
2
|
+
import"../../chunk-4qzb8g3z.js";var c=void 0;export{c as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{a,b,c,d,e,f,g,h,i,j,k}from"../../chunk-
|
|
2
|
+
import{c as a,d as b,e as c,f as d,g as e,h as f,i as g,j as h,k as i,l as j,m as k,n as l,o as m,p as n}from"../../chunk-n24m8prb.js";import"../../chunk-4qzb8g3z.js";export{g as writeSyncedVersion,e as writeChannel,m as snapshotTree,h as shouldShortCircuit,i as resolveUpgradeMessage,a as resolveUpgradeContext,j as resolveSuccessMessage,c as readVersion,f as readSyncedVersion,d as readChannel,n as diffSnapshots,l as detectLocalStacks,b as buildTemplateString,k as MANAGED_PATHS};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
\u26A0 The following framework-managed paths have uncommitted changes:`);for(let
|
|
2
|
+
import{c as T,d as R,e as w,f as x,g as S,h as u,i as y,j as h,k as p,l as g,m as D,n as d,o as H,p as l}from"../../chunk-n24m8prb.js";import{pb as o}from"../../chunk-4qzb8g3z.js";import{copyFileSync as m,cpSync as a,existsSync as B,mkdirSync as k,readFileSync as e,rmSync as qq}from"fs";import{dirname as zq,join as U}from"path";import I from"process";import{parseOptions as Kq}from"@stacksjs/cli";import{downloadTemplate as i}from"@stacksjs/gitit";import{path as O}from"@stacksjs/path";import{ExitCode as C}from"@stacksjs/types";var J=Kq(),G=O.projectPath(),n=U(G,".stacks-channel"),c=U(G,".stacks-version"),A=x(n),Y=T(J,A),s=O.projectPath("storage/framework/core/buddy/package.json"),Qq=w(s),Wq=J.from?O.projectPath(J.from):null,_=Wq??d(G),E=!!_;console.log(p(Y,A,!!J.stable));console.log(E?` source: local checkout at ${_}`:` source: github:stacksjs/stacks#${Y.ref}`);if(!J.force){let q=await Jq(G);if(q.length>0){console.warn(`
|
|
3
|
+
\u26A0 The following framework-managed paths have uncommitted changes:`);for(let z of q)console.warn(` - ${z}`);console.warn(`
|
|
4
4
|
Aborting to avoid clobbering your edits.`),console.warn(` Re-run with --force to overwrite, or commit / stash the changes first.
|
|
5
|
-
`)
|
|
6
|
-
`);let
|
|
7
|
-
`).filter((W)=>W.length>0).map((W)=>W.slice(3))}catch{return[]}}async function
|
|
5
|
+
`),I.exit(C.FatalError)}}var N=null;if(!J.force&&!Y.targetVersion){N=await r(Y,E,_);let q=u(c);if(h({force:!!J.force,targetVersion:Y.targetVersion,remoteSha:N,synced:q,channel:Y.channel}))console.log(`\u2714 Already on the latest ${Y.channel} (${N.slice(0,7)}).`),I.exit(C.Success)}var b=O.frameworkPath("core/actions/src/upgrade/framework.ts"),f=await t(b),V={added:0,changed:0,removed:0,unchanged:0},v=[];try{for(let q of D){let z=U(G,q.localPath),K=q.isFile?await j(z):await H(z,q.skip);if(E&&_)await Bq(_,q,z);else{if(q.isFile)continue;await Iq(Y.ref,q,z,!!J.force)}let Q=q.isFile?await j(z):await H(z,q.skip),W=l(K,Q);V.added+=W.added,V.changed+=W.changed,V.removed+=W.removed,V.unchanged+=W.unchanged,v.push({managed:q,summary:W})}if(!E)await Uq(Y.ref)}catch(q){console.error("\u2718 Failed to upgrade Stacks framework:",q?.message||q),I.exit(C.FatalError)}var Xq=w(s),P=await t(b),Yq=I.argv.includes("--__restarted");if(f!==0n&&P!==0n&&f!==P&&!Yq){console.log(`Upgrade pulled a newer version of the upgrade action \u2014 re-running once to pick up new sync paths and hooks.
|
|
6
|
+
`);let q=I.argv.slice(2).filter((Q)=>Q!=="--__restarted"),K=await Bun.spawn({cmd:[I.argv[0]||"bun",b,...q,"--__restarted"],cwd:G,stdout:"inherit",stderr:"inherit"}).exited;I.exit(K??0)}if(!Y.targetVersion){if(S(n,Y.channel),!N)N=await r(Y,E,_);if(N)y(c,Y.channel,N)}console.log(`\u2714 ${g(Y,Qq,Xq,A,!!J.force)}`);console.log("Sync summary:");for(let{managed:q,summary:z}of v)if(q.isFile){let K=z.added+z.changed>0;console.log(` ${q.label.padEnd(10)} ${K?"updated":"unchanged"}`)}else if(z.added+z.changed+z.removed===0)console.log(` ${q.label.padEnd(10)} unchanged (${z.unchanged} files)`);else console.log(` ${q.label.padEnd(10)} +${z.added} ~${z.changed} -${z.removed} (${z.unchanged} unchanged)`);var $q=!J.noPostinstall&&J.postinstall!==!1;if($q)await Zq({aggregate:V,perPath:v,projectRoot:G});if(Y.channel==="canary"&&!Y.targetVersion)console.warn("\u26A0 Canary builds may contain bugs or breaking changes. Not recommended for production.");I.exit(C.Success);async function Jq(q){let z=U(q,".git");if(!B(z))return[];try{let K=Bun.spawn({cmd:["git","-C",q,"status","--porcelain","--",...D.map((W)=>W.localPath)],stdout:"pipe",stderr:"pipe"}),Q=await new Response(K.stdout).text();return await K.exited,Q.split(`
|
|
7
|
+
`).filter((W)=>W.length>0).map((W)=>W.slice(3))}catch{return[]}}async function r(q,z,K){let Q=/^[0-9a-f]{40}$/i;try{if(z&&K){let $=Bun.spawn({cmd:["git","-C",K,"rev-parse",q.ref],stdout:"pipe",stderr:"pipe"}),Z=(await new Response($.stdout).text()).trim();if(await $.exited===0&&Q.test(Z))return Z.toLowerCase();let F=Bun.spawn({cmd:["git","-C",K,"rev-parse","HEAD"],stdout:"pipe",stderr:"pipe"}),L=(await new Response(F.stdout).text()).trim();return await F.exited===0&&Q.test(L)?L.toLowerCase():null}let W=Bun.spawn({cmd:["git","ls-remote","https://github.com/stacksjs/stacks.git",`refs/heads/${q.ref}`],stdout:"pipe",stderr:"pipe"}),M=await new Response(W.stdout).text();if(await W.exited!==0)return null;let X=M.match(/^([0-9a-f]{40})\s/i);return X?.[1]?X[1].toLowerCase():null}catch{return null}}async function t(q){try{if(!B(q))return 0n;let z=await Bun.file(q).arrayBuffer();return Bun.hash(z)}catch{return 0n}}async function j(q){let z=new Map;if(!B(q))return z;try{let K=Bun.file(q);if(K.size>0){let Q=await K.arrayBuffer();z.set("self",{size:K.size,hash:Bun.hash(Q)})}}catch{}return z}async function Bq(q,z,K){let Q=U(q,z.subPath);if(!B(Q)){console.warn(` skip ${z.label}: source missing at ${Q}`);return}if(z.isFile){k(zq(K),{recursive:!0}),m(Q,K);return}k(K,{recursive:!0}),a(Q,K,{recursive:!0,force:!0,filter:(W)=>{if(!z.skip)return!0;let M=W.split("/").pop()||"";return!z.skip.includes(M)}})}async function Iq(q,z,K,Q){let W=R(q,z.subPath);await i(W,{dir:K,force:!0,forceClean:!1,preferOffline:!Q})}async function Uq(q){let z=O.projectPath(".tmp-upgrade");try{await i(`github:stacksjs/stacks#${q}`,{dir:z,force:!0,forceClean:!0,preferOffline:!0,silent:!0});for(let K of D){if(!K.isFile)continue;let Q=U(z,K.subPath),W=O.projectPath(K.localPath);try{if(B(Q)&&B(W))m(Q,W)}catch{}}}catch{}finally{if(B(z))qq(z,{recursive:!0,force:!0})}}async function Zq(q){let{aggregate:z,perPath:K,projectRoot:Q}=q;if(z.added+z.changed+z.removed===0){console.log("Nothing changed \u2014 skipping post-sync hooks.");return}console.log("Regenerating auto-import manifest...");try{let{generateAutoImportFiles:X}=await import("@stacksjs/server");await X()}catch(X){console.warn(` auto-imports failed (non-fatal): ${X?.message||X}`)}if(K.some((X)=>{let{managed:$,summary:Z}=X;if($.isFile)return!1;if($.label!=="core"&&$.label!=="defaults")return!1;if(Z.added+Z.changed===0)return!1;return Nq(U(Q,$.localPath))})){console.log("Running `bun install` to refresh dependencies...");try{let $=await Bun.spawn({cmd:[I.argv[0]||"bun","install"],cwd:Q,stdout:"inherit",stderr:"inherit"}).exited;if($!==0)console.warn(` bun install exited with code ${$} (non-fatal)`)}catch(X){console.warn(` bun install failed (non-fatal): ${X?.message||X}`)}}let M=U(Q,"database","migrations");if(B(M)){console.log("Running pending migrations...");try{let X=O.frameworkPath("core/buddy/src/cli.ts"),Z=await Bun.spawn({cmd:[I.argv[0]||"bun",X,"migrate"],cwd:Q,stdout:"inherit",stderr:"inherit"}).exited;if(Z!==0)console.warn(` migrate exited with code ${Z} (non-fatal \u2014 DB may not be set up yet)`)}catch(X){console.warn(` migrate failed (non-fatal): ${X?.message||X}`)}}}function Nq(q){try{if(!B(q))return!1;return e(U(q,"package.json"),"utf-8").length>0}catch{return B(q)}}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"../../chunk-s735m9mg.js";import{
|
|
2
|
+
import"../../chunk-s735m9mg.js";import{db as r}from"../../chunk-rzhs51h1.js";import"../../chunk-4qzb8g3z.js";import e from"process";import{parseArgs as o}from"@stacksjs/cli";import{Action as i}from"@stacksjs/enums";import{ExitCode as t}from"@stacksjs/types";var a=o();if(a?.framework||a?.all)await r(i.UpgradeFramework,a);if(a?.dependencies||a?.all)await r(i.UpgradeDeps,a);if(a?.bun||a?.all)await r(i.UpgradeBun,a);if(a?.shell||a?.all)await r(i.UpgradeShell,a);if(a?.binary||a?.all)await r(i.UpgradeBinary,a);e.exit(t.Success);
|
package/dist/src/upgrade.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"../chunk-
|
|
2
|
+
import"../chunk-4qzb8g3z.js";import{readFileSync as K}from"fs";import A from"process";import{intro as L,outro as B,runCommand as I}from"@stacksjs/cli";import{NpmScript as M}from"@stacksjs/enums";import{log as G}from"@stacksjs/logging";import{projectPath as J}from"@stacksjs/path";import*as w from"@stacksjs/storage";import{ExitCode as H}from"@stacksjs/types";var{version:Q}=JSON.parse(K(new URL("../package.json",import.meta.url),"utf8"));function _(b){try{console.log("checkForUncommittedChanges",b)}catch(q){console.error(q)}}async function $(b){let z=J("updates");if(w.doesFolderExist(z))await w.deleteFolder(z);G.info("Downloading framework updates..."),await I("giget stacks updates",b),G.success(`Your framework updated correctly to version: v${Q}`)}async function v(){let b=await L("buddy upgrade:dependencies"),q=await I(M.UpgradeDependencies,{cwd:J()});if(q.isErr)await B("While running the upgrade:dependencies command, there was an issue",{startTime:b,useSeconds:!0},q.error),A.exit(H.FatalError);await B("Freshly updated your dependencies.",{startTime:b,useSeconds:!0}),A.exit(H.Success)}export{v as updateDependencies,$ as downloadFrameworkUpdate,_ as checkForUncommittedChanges};
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Resolve the target channel and git ref from CLI options and persisted channel.
|
|
3
3
|
* Priority: --version > --canary > --stable > persisted channel
|
|
4
|
+
*
|
|
5
|
+
* Branch model: `main` is the bleeding-edge "dump everything" branch; `stable`
|
|
6
|
+
* is the vetted branch that PRs are merged into from `main` once main is proven.
|
|
7
|
+
* So the `stable` channel tracks the `stable` branch (vetted) and the `canary`
|
|
8
|
+
* channel tracks the `main` branch (bleeding edge). A pinned `--version` still
|
|
9
|
+
* resolves to the matching `vX` tag.
|
|
4
10
|
*/
|
|
5
11
|
export declare function resolveUpgradeContext(options: {
|
|
6
12
|
version?: string
|
|
@@ -24,6 +30,39 @@ export declare function readChannel(channelFilePath: string): 'stable' | 'canary
|
|
|
24
30
|
* Persist the channel to the channel file.
|
|
25
31
|
*/
|
|
26
32
|
export declare function writeChannel(channelFilePath: string, ch: 'stable' | 'canary'): void;
|
|
33
|
+
/**
|
|
34
|
+
* Read the last-synced `{ channel, sha }` from `.stacks-version`.
|
|
35
|
+
*
|
|
36
|
+
* Returns null on absence or any malformed content — callers treat null as
|
|
37
|
+
* "no prior sync", which always falls through to a sync (first-run safe). The
|
|
38
|
+
* stored format is a single line: `"<channel> <40-hex-sha>"`. A bare sha
|
|
39
|
+
* (legacy) or unknown channel parses to null so it never wrongly short-circuits.
|
|
40
|
+
*/
|
|
41
|
+
export declare function readSyncedVersion(versionFilePath: string): SyncedVersion | null;
|
|
42
|
+
/**
|
|
43
|
+
* Persist the last-synced channel + sha to `.stacks-version`.
|
|
44
|
+
*/
|
|
45
|
+
export declare function writeSyncedVersion(versionFilePath: string, ch: 'stable' | 'canary', sha: string): void;
|
|
46
|
+
/**
|
|
47
|
+
* Pure decision for the "already up to date" short-circuit. Returns true only
|
|
48
|
+
* when a sync can be safely skipped: no override flags, not a pinned version,
|
|
49
|
+
* a resolved remote sha, a prior sync on the SAME channel, and the synced sha
|
|
50
|
+
* equals the remote sha. Any of:
|
|
51
|
+
* - `force` (explicit re-sync)
|
|
52
|
+
* - `targetVersion` (pinned tag — always install)
|
|
53
|
+
* - `remoteSha === null` (network/git failure → fail open to sync)
|
|
54
|
+
* - `synced === null` (first run → always sync)
|
|
55
|
+
* - channel mismatch (channel switch never short-circuits)
|
|
56
|
+
* - sha mismatch (a newer commit is available)
|
|
57
|
+
* yields false (proceed with the sync).
|
|
58
|
+
*/
|
|
59
|
+
export declare function shouldShortCircuit(args: {
|
|
60
|
+
force: boolean
|
|
61
|
+
targetVersion?: string
|
|
62
|
+
remoteSha: string | null
|
|
63
|
+
synced: SyncedVersion | null
|
|
64
|
+
channel: 'stable' | 'canary'
|
|
65
|
+
}): boolean;
|
|
27
66
|
/**
|
|
28
67
|
* Determine the user-facing log message for the upgrade action.
|
|
29
68
|
*/
|
|
@@ -67,6 +106,15 @@ export declare interface UpgradeContext {
|
|
|
67
106
|
ref: string
|
|
68
107
|
targetVersion?: string
|
|
69
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* The last-synced channel + commit sha, persisted to `.stacks-version` so
|
|
111
|
+
* `buddy update` can short-circuit when the project is already on the latest
|
|
112
|
+
* commit of its channel.
|
|
113
|
+
*/
|
|
114
|
+
export declare interface SyncedVersion {
|
|
115
|
+
channel: 'stable' | 'canary'
|
|
116
|
+
sha: string
|
|
117
|
+
}
|
|
70
118
|
/**
|
|
71
119
|
* Framework-managed paths, relative to the project root, that `buddy update`
|
|
72
120
|
* keeps in sync with the upstream stacks repo. Each entry can be a directory
|