@stacksjs/actions 0.74.10 → 0.74.12
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/auth/client.js +1 -1
- package/dist/auth/prune.js +1 -1
- package/dist/build/android.js +1 -1
- package/dist/build/ios.js +1 -1
- package/dist/database/seed.js +1 -1
- package/dist/deploy/index.js +1 -1
- package/dist/domains/purchase.js +1 -1
- package/dist/examples.js +1 -1
- package/dist/find-projects.js +1 -1
- package/dist/queue/clear.js +1 -1
- package/dist/queue/dlq-purge.js +1 -1
- package/dist/queue/dlq-retry.js +1 -1
- package/dist/queue/flush.js +1 -1
- package/dist/queue/inspect.js +2 -2
- package/dist/queue/pause.js +1 -1
- package/dist/queue/quarantine.js +1 -1
- package/dist/queue/resume.js +1 -1
- package/dist/queue/retry.js +1 -1
- package/dist/queue/schedule-list.js +1 -1
- package/dist/queue/unquarantine.js +1 -1
- package/dist/upgrade/packages.d.ts +4 -0
- package/dist/upgrade/packages.js +3 -3
- package/package.json +40 -40
package/dist/auth/client.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import process from"node:process";import{randomBytes,scryptSync}from"node:crypto";import{db}from"@stacksjs/database";import{HttpError}from"@stacksjs/error-handling";import{log}from"@stacksjs/logging";const args=process.argv.slice(2),getArg=(name)=>{const idx=args.findIndex((a)=>a.startsWith(`--${name}=`)||a.startsWith(`-${name.charAt(0)}=`));if(idx!==-1){const arg=args[idx];if(!arg)return;const eqIdx=arg.indexOf("=");return eqIdx>=0?arg.slice(eqIdx+1):void 0}const flagIdx=args.findIndex((a)=>a===`--${name}`||a===`-${name.charAt(0)}`),value=flagIdx!==-1?args[flagIdx+1]:void 0;if(value&&!value.startsWith("-"))return value;return},hasFlag=(name)=>{return args.includes(`--${name}`)},name=getArg("name")||"OAuth Client",redirect=getArg("redirect")||"http://localhost",isPersonalAccess=hasFlag("personal"),isPasswordClient=hasFlag("password");log.info(`Creating OAuth client: ${name}`);const secret=randomBytes(40).toString("hex"),salt=randomBytes(16).toString("hex"),hashedSecret=`${salt}:${scryptSync(secret,salt,64).toString("hex")}`,result=await db.insertInto("oauth_clients").values({name,secret:hashedSecret,provider:"local",redirect,personal_access_client:isPersonalAccess,password_client:isPasswordClient,revoked:!1}).executeTakeFirst(),insertId=result?.insertId||Number(result?.numInsertedOrUpdatedRows);if(!insertId)throw new HttpError(500,"Failed to create OAuth client");log.success("OAuth client created successfully");log.info("");log.info("Client Details:");log.info(` Client ID: ${insertId}`);log.info(" Client Secret: [REDACTED]");process.stdout.write(`Client Secret (save now, shown once): ${secret}
|
|
2
|
-
`);log.info(` Redirect URI: ${redirect}`);log.info("");log.warn("Make sure to save the client secret. You will not be able to retrieve it again.");process.exit(0);
|
|
2
|
+
`);log.info(` Redirect URI: ${redirect}`);log.info("");log.warn("Make sure to save the client secret. You will not be able to retrieve it again.");await log.flush();process.exit(0);
|
package/dist/auth/prune.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import process from"node:process";import{db,sql}from"@stacksjs/database";import{log}from"@stacksjs/logging";const args=process.argv.slice(2),hasFlag=(name)=>{return args.includes(`--${name}`)},getArg=(name)=>{const idx=args.findIndex((a)=>a.startsWith(`--${name}=`)||a.startsWith(`-${name.charAt(0)}=`));if(idx!==-1){const arg=args[idx];if(!arg)return;const eqIdx=arg.indexOf("=");return eqIdx>=0?arg.slice(eqIdx+1):void 0}const flagIdx=args.findIndex((a)=>a===`--${name}`||a===`-${name.charAt(0)}`),value=flagIdx!==-1?args[flagIdx+1]:void 0;if(value&&!value.startsWith("-"))return value;return},pruneExpired=!hasFlag("no-expired"),pruneRevoked=!hasFlag("no-revoked"),daysOld=Number(getArg("days"))||7;log.info("Pruning authentication tokens...");let expiredCount=0,revokedCount=0;if(pruneExpired){log.info("Removing expired tokens...");expiredCount=await db.deleteFrom("personal_access_tokens").where("expires_at","<",sql.raw("NOW()")).execute();log.success(`Removed ${expiredCount} expired token(s)`)}if(pruneRevoked){log.info(`Removing tokens revoked more than ${daysOld} day(s) ago...`);const cutoffDate=new Date;cutoffDate.setDate(cutoffDate.getDate()-daysOld);revokedCount=await db.deleteFrom("personal_access_tokens").whereNotNull("revoked_at").where("revoked_at","<",cutoffDate.toISOString()).execute();log.success(`Removed ${revokedCount} revoked token(s)`)}log.success(`Token pruning complete. Total removed: ${expiredCount+revokedCount}`);process.exit(0);
|
|
1
|
+
import process from"node:process";import{db,sql}from"@stacksjs/database";import{log}from"@stacksjs/logging";const args=process.argv.slice(2),hasFlag=(name)=>{return args.includes(`--${name}`)},getArg=(name)=>{const idx=args.findIndex((a)=>a.startsWith(`--${name}=`)||a.startsWith(`-${name.charAt(0)}=`));if(idx!==-1){const arg=args[idx];if(!arg)return;const eqIdx=arg.indexOf("=");return eqIdx>=0?arg.slice(eqIdx+1):void 0}const flagIdx=args.findIndex((a)=>a===`--${name}`||a===`-${name.charAt(0)}`),value=flagIdx!==-1?args[flagIdx+1]:void 0;if(value&&!value.startsWith("-"))return value;return},pruneExpired=!hasFlag("no-expired"),pruneRevoked=!hasFlag("no-revoked"),daysOld=Number(getArg("days"))||7;log.info("Pruning authentication tokens...");let expiredCount=0,revokedCount=0;if(pruneExpired){log.info("Removing expired tokens...");expiredCount=await db.deleteFrom("personal_access_tokens").where("expires_at","<",sql.raw("NOW()")).execute();log.success(`Removed ${expiredCount} expired token(s)`)}if(pruneRevoked){log.info(`Removing tokens revoked more than ${daysOld} day(s) ago...`);const cutoffDate=new Date;cutoffDate.setDate(cutoffDate.getDate()-daysOld);revokedCount=await db.deleteFrom("personal_access_tokens").whereNotNull("revoked_at").where("revoked_at","<",cutoffDate.toISOString()).execute();log.success(`Removed ${revokedCount} revoked token(s)`)}log.success(`Token pruning complete. Total removed: ${expiredCount+revokedCount}`);await log.flush();process.exit(0);
|
package/dist/build/android.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import{existsSync,readFileSync,writeFileSync}from"node:fs";import{pathToFileURL}from"node:url";import process from"node:process";import{log}from"@stacksjs/cli";import{projectPath,storagePath}from"@stacksjs/path";import{resolveCraftBuilderProvenance}from"./craft-provenance";import{toCraftAndroidConfig,validateAndroidMobileConfig}from"./android-config";import{resolveMobilePath}from"./ios-config";process.exitCode=1;async function loadCraftAndroidBuilder(){const explicit=process.env.CRAFT_ANDROID_SRC;try{if(explicit)return await import(pathToFileURL(explicit).href);return await import("craft-native/android")}catch(error){throw Error("Craft Android builder is unavailable. Install the current craft-native package or set CRAFT_ANDROID_SRC to packages/android/src/index.ts in a Craft checkout.",{cause:error})}}const configPath=projectPath("config/mobile.ts");if(!existsSync(configPath))throw Error("Missing config/mobile.ts. Add an android section before running `buddy build:android`.");const configModule=await import(`${pathToFileURL(configPath).href}?t=${Date.now()}`),config=configModule.default.android;if(!config)throw Error("config/mobile.ts must define an android section");validateAndroidMobileConfig(config);const output=resolveMobilePath(projectPath(),config.output)??storagePath("framework/mobile/android"),webAssets=resolveMobilePath(projectPath(),config.webAssets),fallbackWebAssets=resolveMobilePath(projectPath(),config.fallbackWebAssets),craftConfig=toCraftAndroidConfig(config);craftConfig.appIconPath=resolveMobilePath(projectPath(),config.appIcon);craftConfig.googleServicesFile=resolveMobilePath(projectPath(),config.googleServicesFile);if(process.env.NODE_ENV==="production"&&config.capabilities?.pushNotifications&&!craftConfig.googleServicesFile)throw Error("Production Android push notifications require android.googleServicesFile in config/mobile.ts");const builder=await loadCraftAndroidBuilder();await builder.init({name:config.appName,packageName:config.packageName,output,config:craftConfig});await builder.build({output,htmlPath:webAssets??fallbackWebAssets,devServer:craftConfig.devServerURL,release:process.env.NODE_ENV==="production",compile:process.env.STACKS_ANDROID_SKIP_GRADLE!=="1"});const sourceRevision=Bun.spawnSync(["git","rev-parse","HEAD"],{cwd:projectPath()}).stdout.toString().trim(),generatedConfig=JSON.parse(readFileSync(`${output}/craft.config.json`,"utf8"));writeFileSync(`${output}/stacks-mobile.json`,`${JSON.stringify({schemaVersion:"1.0.0",platform:"android",sourceRevision,source:webAssets?{kind:"bundled",path:webAssets}:{kind:"remote",url:craftConfig.devServerURL,fallback:fallbackWebAssets?{kind:"bundled",path:fallbackWebAssets}:void 0},capabilities:config.capabilities??{},builder:resolveCraftBuilderProvenance(process.env.CRAFT_ANDROID_SRC),craft:generatedConfig},null,2)}
|
|
2
|
-
`);log.success(`Built the Craft Android project in ${output}`);process.exitCode=0;
|
|
2
|
+
`);log.success(`Built the Craft Android project in ${output}`);await log.flush();process.exitCode=0;
|
package/dist/build/ios.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import{existsSync,readFileSync,writeFileSync}from"node:fs";import{pathToFileURL}from"node:url";import process from"node:process";import{log}from"@stacksjs/cli";import{projectPath,storagePath}from"@stacksjs/path";import{resolveCraftBuilderProvenance}from"./craft-provenance";import{resolveMobilePath,toCraftIosConfig,validateIosMobileConfig}from"./ios-config";process.exitCode=1;async function loadCraftIosBuilder(){const explicit=process.env.CRAFT_IOS_SRC;try{if(explicit)return await import(pathToFileURL(explicit).href);return await import("craft-native/ios")}catch(error){throw Error("Craft iOS builder is unavailable. Install the current craft-native package or set CRAFT_IOS_SRC to packages/ios/src/index.ts in a Craft checkout.",{cause:error})}}const configPath=projectPath("config/mobile.ts");if(!existsSync(configPath))throw Error("Missing config/mobile.ts. Add an ios section before running `buddy build:ios`.");const configModule=await import(`${pathToFileURL(configPath).href}?t=${Date.now()}`),config=configModule.default.ios;validateIosMobileConfig(config);const output=resolveMobilePath(projectPath(),config.output)??storagePath("framework/mobile/ios"),webAssets=resolveMobilePath(projectPath(),config.webAssets),fallbackWebAssets=resolveMobilePath(projectPath(),config.fallbackWebAssets),craftConfig=toCraftIosConfig(config);craftConfig.appIconPath=resolveMobilePath(projectPath(),config.appIcon);const builder=await loadCraftIosBuilder();await builder.init({name:config.appName,bundleId:config.bundleId,teamId:config.teamId,output,config:craftConfig});await builder.build({output,htmlPath:webAssets??fallbackWebAssets,devServer:craftConfig.devServerURL,generateProject:process.env.STACKS_IOS_SKIP_XCODEGEN!=="1"});const sourceRevision=Bun.spawnSync(["git","rev-parse","HEAD"],{cwd:projectPath()}).stdout.toString().trim(),craftConfigPath=`${output}/craft.config.json`,generatedConfig=JSON.parse(readFileSync(craftConfigPath,"utf8"));writeFileSync(`${output}/stacks-mobile.json`,`${JSON.stringify({schemaVersion:"1.0.0",platform:"ios",sourceRevision,source:webAssets?{kind:"bundled",path:webAssets}:{kind:"remote",url:craftConfig.devServerURL,fallback:fallbackWebAssets?{kind:"bundled",path:fallbackWebAssets}:void 0},capabilities:config.capabilities??{},builder:resolveCraftBuilderProvenance(process.env.CRAFT_IOS_SRC),craft:generatedConfig},null,2)}
|
|
2
|
-
`);log.success(`Built the Craft iOS project in ${output}`);process.exitCode=0;
|
|
2
|
+
`);log.success(`Built the Craft iOS project in ${output}`);await log.flush();process.exitCode=0;
|
package/dist/database/seed.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import process from"node:process";import{log}from"@stacksjs/cli";import{seed}from"@stacksjs/database";const argv=process.argv.slice(2),allowProtected=argv.includes("--allow-protected")||argv.includes("--allowProtected"),fresh=argv.includes("--fresh"),startTime=Date.now();try{const result=await seed({verbose:!0,fresh,allowProtected}),duration=Date.now()-startTime;if(result.failed>0){log.warn("");log.warn(`Seeding completed with ${result.failed} failure(s):`);for(const r of result.results)if(!r.success)log.error(` - ${r.model}: ${r.error}`);log.info("");log.info("Note: Failed models may have schema mismatches or invalid factory functions.");log.info("Tip: Run `./buddy migrate:fresh` to ensure schema is up to date.")}log.info("");log.success(`Seeding completed in ${duration}ms`);log.info(` Total models: ${result.total}`);log.info(` Successful: ${result.successful}`);log.info(` Failed: ${result.failed}`);process.exit(0)}catch(err){await log.error("Seeding failed catastrophically:",err);process.exit(1)}
|
|
1
|
+
import process from"node:process";import{log}from"@stacksjs/cli";import{seed}from"@stacksjs/database";const argv=process.argv.slice(2),allowProtected=argv.includes("--allow-protected")||argv.includes("--allowProtected"),fresh=argv.includes("--fresh"),startTime=Date.now();try{const result=await seed({verbose:!0,fresh,allowProtected}),duration=Date.now()-startTime;if(result.failed>0){log.warn("");log.warn(`Seeding completed with ${result.failed} failure(s):`);for(const r of result.results)if(!r.success)log.error(` - ${r.model}: ${r.error}`);log.info("");log.info("Note: Failed models may have schema mismatches or invalid factory functions.");log.info("Tip: Run `./buddy migrate:fresh` to ensure schema is up to date.")}log.info("");log.success(`Seeding completed in ${duration}ms`);log.info(` Total models: ${result.total}`);log.info(` Successful: ${result.successful}`);log.info(` Failed: ${result.failed}`);await log.flush();process.exit(0)}catch(err){await log.error("Seeding failed catastrophically:",err);process.exit(1)}
|
package/dist/deploy/index.js
CHANGED
|
@@ -296,4 +296,4 @@ ${children}${indent}</${name}>
|
|
|
296
296
|
`}return""},xml=`<?xml version="1.0" encoding="UTF-8"?>
|
|
297
297
|
<DistributionConfig xmlns="http://cloudfront.amazonaws.com/doc/2020-05-31/">
|
|
298
298
|
${Object.entries(currentConfig).filter(([key])=>!key.startsWith("@_")).map(([key,val])=>buildXmlElement(key,val," ")).join("")}</DistributionConfig>
|
|
299
|
-
`;await awsClient.request({service:"cloudfront",region:"us-east-1",method:"PUT",path:`/2020-05-31/distribution/${distributionId}/config`,body:xml,headers:{"Content-Type":"application/xml","If-Match":etag}});if(isVerbose)log.debug(" CloudFront custom error responses configured")}else if(isVerbose)log.debug(" CloudFront custom error responses already configured")}}errorPageSpinner.succeed("404 error page configured")}catch(errorPageError){errorPageSpinner.stop();console.log(`\u26A0 404 page configuration skipped: ${errorPageError.message}`);if(isVerbose)log.debug(`Error page config error: ${errorPageError.stack}`)}try{const tunnelCloudConfig=await import(p.projectPath("config/cloud")),tunnelConfig=tunnelCloudConfig?.tsCloud?.infrastructure?.tunnel;if(tunnelConfig?.enabled){const tunnelDomain=tunnelConfig.domain||"";if(!tunnelDomain||tunnelDomain==="localtunnel.dev"||tunnelDomain==="api.localtunnel.dev")console.log("\u2139 Tunnel: Using shared localtunnel.dev (no custom tunnel deployment needed)");else{const tunnelSpinner=spinner(`Deploying tunnel server to ${tunnelDomain}...`);tunnelSpinner.start();try{const{deployTunnelServer}=await import("@stacksjs/tunnel");await deployTunnelServer({domain:tunnelDomain,region:tunnelConfig.region||tunnelCloudConfig?.tsCloud?.project?.region||"us-east-1",instanceType:tunnelConfig.instanceType,prefix:tunnelConfig.prefix,enableSsl:tunnelConfig.ssl?.enabled,porkbunApiKey:tunnelConfig.ssl?.porkbunApiKey,porkbunSecretKey:tunnelConfig.ssl?.porkbunSecretKey,verbose:isVerbose});tunnelSpinner.succeed(`Tunnel server deployed to ${tunnelDomain}`)}catch(tunnelError){tunnelSpinner.stop();console.log(`\u26A0 Tunnel deployment skipped: ${tunnelError.message}`);if(isVerbose)log.debug(`Tunnel deploy error: ${tunnelError.stack}`)}}}}catch{}const dnsSpinner=spinner("Reconciling DNS records...");dnsSpinner.start();try{const{Route53Client,CloudFormationClient:DnsCfClient}=await import("@stacksjs/ts-cloud"),dnsCf=new DnsCfClient(region),dnsStackName=`${projectName}-cloud`,dnsOutputs=await dnsCf.getStackOutputs(dnsStackName),dnsCloudConfig=await import(p.projectPath("config/cloud")),hostedZoneId=dnsCloudConfig?.tsCloud?.infrastructure?.dns?.hostedZoneId,siteDomain=dnsCloudConfig?.tsCloud?.infrastructure?.dns?.domain||"stacksjs.com";if(hostedZoneId){const route53=new Route53Client(region),cfHostedZoneId="Z2FDTNDATAQYW2",domainMappings=[{domain:siteDomain,cfDomain:dnsOutputs.publicCloudFrontDomain},{domain:`www.${siteDomain}`,cfDomain:dnsOutputs.publicCloudFrontDomain},{domain:`docs.${siteDomain}`,cfDomain:dnsOutputs.docsCloudFrontDomain},{domain:`blog.${siteDomain}`,cfDomain:dnsOutputs.blogCloudFrontDomain}];let recordsCreated=0;for(const{domain,cfDomain}of domainMappings){if(!cfDomain)continue;try{if(!((await route53.listResourceRecordSets({HostedZoneId:hostedZoneId,StartRecordName:domain,StartRecordType:"A",MaxItems:"1"}))?.ResourceRecordSets||[]).some((r)=>r.Name===`${domain}.`&&r.Type==="A")){await route53.changeResourceRecordSets({HostedZoneId:hostedZoneId,ChangeBatch:{Changes:[{Action:"UPSERT",ResourceRecordSet:{Name:domain,Type:"A",AliasTarget:{HostedZoneId:cfHostedZoneId,DNSName:cfDomain,EvaluateTargetHealth:!1}}},{Action:"UPSERT",ResourceRecordSet:{Name:domain,Type:"AAAA",AliasTarget:{HostedZoneId:cfHostedZoneId,DNSName:cfDomain,EvaluateTargetHealth:!1}}}]}});recordsCreated++;if(isVerbose)log.debug(` Created DNS records: ${domain} -> ${cfDomain}`)}else if(isVerbose)log.debug(` DNS record exists: ${domain}`)}catch(dnsErr){if(isVerbose)log.debug(` DNS check/create failed for ${domain}: ${dnsErr.message}`)}}if(recordsCreated>0)dnsSpinner.succeed(`DNS records reconciled (${recordsCreated} created)`);else dnsSpinner.succeed("DNS records verified")}else{dnsSpinner.stop();if(isVerbose)log.debug("No hosted zone ID configured, skipping DNS reconciliation")}}catch(dnsError){dnsSpinner.stop();console.log(`\u26A0 DNS reconciliation skipped: ${dnsError.message}`);if(isVerbose)log.debug(`DNS error: ${dnsError.stack}`)}console.log("");log.success("Deployment completed successfully!")}catch(error){
|
|
299
|
+
`;await awsClient.request({service:"cloudfront",region:"us-east-1",method:"PUT",path:`/2020-05-31/distribution/${distributionId}/config`,body:xml,headers:{"Content-Type":"application/xml","If-Match":etag}});if(isVerbose)log.debug(" CloudFront custom error responses configured")}else if(isVerbose)log.debug(" CloudFront custom error responses already configured")}}errorPageSpinner.succeed("404 error page configured")}catch(errorPageError){errorPageSpinner.stop();console.log(`\u26A0 404 page configuration skipped: ${errorPageError.message}`);if(isVerbose)log.debug(`Error page config error: ${errorPageError.stack}`)}try{const tunnelCloudConfig=await import(p.projectPath("config/cloud")),tunnelConfig=tunnelCloudConfig?.tsCloud?.infrastructure?.tunnel;if(tunnelConfig?.enabled){const tunnelDomain=tunnelConfig.domain||"";if(!tunnelDomain||tunnelDomain==="localtunnel.dev"||tunnelDomain==="api.localtunnel.dev")console.log("\u2139 Tunnel: Using shared localtunnel.dev (no custom tunnel deployment needed)");else{const tunnelSpinner=spinner(`Deploying tunnel server to ${tunnelDomain}...`);tunnelSpinner.start();try{const{deployTunnelServer}=await import("@stacksjs/tunnel");await deployTunnelServer({domain:tunnelDomain,region:tunnelConfig.region||tunnelCloudConfig?.tsCloud?.project?.region||"us-east-1",instanceType:tunnelConfig.instanceType,prefix:tunnelConfig.prefix,enableSsl:tunnelConfig.ssl?.enabled,porkbunApiKey:tunnelConfig.ssl?.porkbunApiKey,porkbunSecretKey:tunnelConfig.ssl?.porkbunSecretKey,verbose:isVerbose});tunnelSpinner.succeed(`Tunnel server deployed to ${tunnelDomain}`)}catch(tunnelError){tunnelSpinner.stop();console.log(`\u26A0 Tunnel deployment skipped: ${tunnelError.message}`);if(isVerbose)log.debug(`Tunnel deploy error: ${tunnelError.stack}`)}}}}catch{}const dnsSpinner=spinner("Reconciling DNS records...");dnsSpinner.start();try{const{Route53Client,CloudFormationClient:DnsCfClient}=await import("@stacksjs/ts-cloud"),dnsCf=new DnsCfClient(region),dnsStackName=`${projectName}-cloud`,dnsOutputs=await dnsCf.getStackOutputs(dnsStackName),dnsCloudConfig=await import(p.projectPath("config/cloud")),hostedZoneId=dnsCloudConfig?.tsCloud?.infrastructure?.dns?.hostedZoneId,siteDomain=dnsCloudConfig?.tsCloud?.infrastructure?.dns?.domain||"stacksjs.com";if(hostedZoneId){const route53=new Route53Client(region),cfHostedZoneId="Z2FDTNDATAQYW2",domainMappings=[{domain:siteDomain,cfDomain:dnsOutputs.publicCloudFrontDomain},{domain:`www.${siteDomain}`,cfDomain:dnsOutputs.publicCloudFrontDomain},{domain:`docs.${siteDomain}`,cfDomain:dnsOutputs.docsCloudFrontDomain},{domain:`blog.${siteDomain}`,cfDomain:dnsOutputs.blogCloudFrontDomain}];let recordsCreated=0;for(const{domain,cfDomain}of domainMappings){if(!cfDomain)continue;try{if(!((await route53.listResourceRecordSets({HostedZoneId:hostedZoneId,StartRecordName:domain,StartRecordType:"A",MaxItems:"1"}))?.ResourceRecordSets||[]).some((r)=>r.Name===`${domain}.`&&r.Type==="A")){await route53.changeResourceRecordSets({HostedZoneId:hostedZoneId,ChangeBatch:{Changes:[{Action:"UPSERT",ResourceRecordSet:{Name:domain,Type:"A",AliasTarget:{HostedZoneId:cfHostedZoneId,DNSName:cfDomain,EvaluateTargetHealth:!1}}},{Action:"UPSERT",ResourceRecordSet:{Name:domain,Type:"AAAA",AliasTarget:{HostedZoneId:cfHostedZoneId,DNSName:cfDomain,EvaluateTargetHealth:!1}}}]}});recordsCreated++;if(isVerbose)log.debug(` Created DNS records: ${domain} -> ${cfDomain}`)}else if(isVerbose)log.debug(` DNS record exists: ${domain}`)}catch(dnsErr){if(isVerbose)log.debug(` DNS check/create failed for ${domain}: ${dnsErr.message}`)}}if(recordsCreated>0)dnsSpinner.succeed(`DNS records reconciled (${recordsCreated} created)`);else dnsSpinner.succeed("DNS records verified")}else{dnsSpinner.stop();if(isVerbose)log.debug("No hosted zone ID configured, skipping DNS reconciliation")}}catch(dnsError){dnsSpinner.stop();console.log(`\u26A0 DNS reconciliation skipped: ${dnsError.message}`);if(isVerbose)log.debug(`DNS error: ${dnsError.stack}`)}console.log("");log.success("Deployment completed successfully!")}catch(error){log.error("Deployment failed:",error);process.exit(ExitCode.FatalError)}
|
package/dist/domains/purchase.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import process from"node:process";import{log,parseOptions}from"@stacksjs/cli";import{purchaseDomain}from"@stacksjs/cloud";import{config}from"@stacksjs/config";import{handleError}from"@stacksjs/error-handling";import{ExitCode}from"@stacksjs/types";const c=config.dns.contactInfo;if(!c){handleError("You must provide contact info in your config file.");process.exit(ExitCode.FatalError)}const defaultOptions={domain:"",years:1,privacy:!0,autoRenew:!0,registrantFirstName:c.firstName,registrantLastName:c.lastName,registrantOrganization:c.organizationName,registrantAddressLine1:c.addressLine1,registrantAddressLine2:c.addressLine2,registrantCity:c.city,registrantState:c.state,registrantCountry:c.countryCode,registrantZip:c.zip,registrantPhone:c.phoneNumber,registrantEmail:c.email,adminFirstName:c.admin?.firstName||c.firstName,adminLastName:c.admin?.lastName||c.lastName,adminOrganization:c.admin?.organizationName||c.organizationName,adminAddressLine1:c.admin?.addressLine1||c.addressLine1,adminAddressLine2:c.admin?.addressLine2||c.addressLine2,adminCity:c.admin?.city||c.city,adminState:c.admin?.state||c.state,adminCountry:c.admin?.countryCode||c.countryCode,adminZip:c.admin?.zip||c.zip,adminPhone:c.admin?.phoneNumber||c.phoneNumber,adminEmail:c.admin?.email||c.email,techFirstName:c.tech?.firstName||c.firstName,techLastName:c.tech?.lastName||c.lastName,techOrganization:c.tech?.organizationName||c.organizationName,techAddressLine1:c.tech?.addressLine1||c.addressLine1,techAddressLine2:c.tech?.addressLine2||c.addressLine2,techCity:c.tech?.city||c.city,techState:c.tech?.state||c.state,techCountry:c.tech?.countryCode||c.countryCode,techZip:c.tech?.zip||c.zip,techPhone:c.tech?.phoneNumber||c.phoneNumber,techEmail:c.tech?.email||c.email,privacyAdmin:c.privacyAdmin||c.privacy||!0,privacyTech:c.privacyTech||c.privacy||!0,privacyRegistrant:c.privacyRegistrant||c.privacy||!0,contactType:"PERSON",verbose:!1},options={...defaultOptions,...parseOptions()};if(!options.domain){handleError("You must provide a domain name to purchase.");process.exit(ExitCode.FatalError)}const result=purchaseDomain(options.domain,options);if(result.isErr){handleError(result.error);process.exit(ExitCode.FatalError)}log.info("Domain purchased successfully.");process.exit(ExitCode.Success);
|
|
1
|
+
import process from"node:process";import{log,parseOptions}from"@stacksjs/cli";import{purchaseDomain}from"@stacksjs/cloud";import{config}from"@stacksjs/config";import{handleError}from"@stacksjs/error-handling";import{ExitCode}from"@stacksjs/types";const c=config.dns.contactInfo;if(!c){handleError("You must provide contact info in your config file.");process.exit(ExitCode.FatalError)}const defaultOptions={domain:"",years:1,privacy:!0,autoRenew:!0,registrantFirstName:c.firstName,registrantLastName:c.lastName,registrantOrganization:c.organizationName,registrantAddressLine1:c.addressLine1,registrantAddressLine2:c.addressLine2,registrantCity:c.city,registrantState:c.state,registrantCountry:c.countryCode,registrantZip:c.zip,registrantPhone:c.phoneNumber,registrantEmail:c.email,adminFirstName:c.admin?.firstName||c.firstName,adminLastName:c.admin?.lastName||c.lastName,adminOrganization:c.admin?.organizationName||c.organizationName,adminAddressLine1:c.admin?.addressLine1||c.addressLine1,adminAddressLine2:c.admin?.addressLine2||c.addressLine2,adminCity:c.admin?.city||c.city,adminState:c.admin?.state||c.state,adminCountry:c.admin?.countryCode||c.countryCode,adminZip:c.admin?.zip||c.zip,adminPhone:c.admin?.phoneNumber||c.phoneNumber,adminEmail:c.admin?.email||c.email,techFirstName:c.tech?.firstName||c.firstName,techLastName:c.tech?.lastName||c.lastName,techOrganization:c.tech?.organizationName||c.organizationName,techAddressLine1:c.tech?.addressLine1||c.addressLine1,techAddressLine2:c.tech?.addressLine2||c.addressLine2,techCity:c.tech?.city||c.city,techState:c.tech?.state||c.state,techCountry:c.tech?.countryCode||c.countryCode,techZip:c.tech?.zip||c.zip,techPhone:c.tech?.phoneNumber||c.phoneNumber,techEmail:c.tech?.email||c.email,privacyAdmin:c.privacyAdmin||c.privacy||!0,privacyTech:c.privacyTech||c.privacy||!0,privacyRegistrant:c.privacyRegistrant||c.privacy||!0,contactType:"PERSON",verbose:!1},options={...defaultOptions,...parseOptions()};if(!options.domain){handleError("You must provide a domain name to purchase.");process.exit(ExitCode.FatalError)}const result=purchaseDomain(options.domain,options);if(result.isErr){handleError(result.error);process.exit(ExitCode.FatalError)}log.info("Domain purchased successfully.");await log.flush();process.exit(ExitCode.Success);
|
package/dist/examples.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import process from"node:process";import{NpmScript}from"@stacksjs/enums";import{log}from"@stacksjs/logging";import{hasComponents}from"@stacksjs/storage";import{ExitCode}from"@stacksjs/types";import{runNpmScript}from"@stacksjs/utils";export async function invoke(options){if(options.components)await componentExample(options);else if(options.webComponents||options.elements)await webComponentExample(options);else log.error("An unsupported option was used. Please try again, check the documentation & report the issue, if needed.")}export async function examples(options){return await invoke(options)}export async function componentExample(options){if(hasComponents()){await runNpmScript(NpmScript.Example,options);log.success("Your component library was built successfully")}else log.info("No components found.")}export async function webComponentExample(options){if(hasComponents()){log.info("Building your Web Component library...");await runNpmScript(NpmScript.BuildWebComponents,options);log.success("Your Web Component library was built successfully")}else{log.info("No components found.");process.exit(ExitCode.FatalError)}}
|
|
1
|
+
import process from"node:process";import{NpmScript}from"@stacksjs/enums";import{log}from"@stacksjs/logging";import{hasComponents}from"@stacksjs/storage";import{ExitCode}from"@stacksjs/types";import{runNpmScript}from"@stacksjs/utils";export async function invoke(options){if(options.components)await componentExample(options);else if(options.webComponents||options.elements)await webComponentExample(options);else log.error("An unsupported option was used. Please try again, check the documentation & report the issue, if needed.")}export async function examples(options){return await invoke(options)}export async function componentExample(options){if(hasComponents()){await runNpmScript(NpmScript.Example,options);log.success("Your component library was built successfully")}else log.info("No components found.")}export async function webComponentExample(options){if(hasComponents()){log.info("Building your Web Component library...");await runNpmScript(NpmScript.BuildWebComponents,options);log.success("Your Web Component library was built successfully")}else{log.info("No components found.");await log.flush();process.exit(ExitCode.FatalError)}}
|
package/dist/find-projects.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import process from"node:process";import{parseOptions}from"@stacksjs/cli";import{log}from"@stacksjs/logging";import{ExitCode}from"@stacksjs/types";import{findStacksProjects}from"@stacksjs/utils";try{const options=parseOptions(),projects=await findStacksProjects(void 0,options);if(projects.length>0){log.info("Found Projects:");projects.forEach((project)=>console.log(` - ${project}`));process.exit(ExitCode.Success)}log.info("No Stacks Projects found.")}catch(error){log.error("Error searching for Stacks projects:",error)}
|
|
1
|
+
import process from"node:process";import{parseOptions}from"@stacksjs/cli";import{log}from"@stacksjs/logging";import{ExitCode}from"@stacksjs/types";import{findStacksProjects}from"@stacksjs/utils";try{const options=parseOptions(),projects=await findStacksProjects(void 0,options);if(projects.length>0){log.info("Found Projects:");projects.forEach((project)=>console.log(` - ${project}`));await log.flush();process.exit(ExitCode.Success)}log.info("No Stacks Projects found.")}catch(error){log.error("Error searching for Stacks projects:",error)}
|
package/dist/queue/clear.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import process from"node:process";import{log}from"@stacksjs/logging";import{Job}from"@stacksjs/orm";const options=parseArgs(),queueName=options.queue,force=options.force==="true";try{if(!force){log.warn("This will delete all jobs from the queue. Use --force to confirm.");process.exit(1)}let deletedCount=0;if(queueName){log.info(`Clearing all jobs from queue "${queueName}"...`);const jobs=await Job.where("queue",queueName).get();deletedCount=jobs.length;for(const job of jobs)await job.delete()}else{log.info("Clearing all jobs from all queues...");const jobs=await Job.all();deletedCount=jobs.length;for(const job of jobs)await job.delete()}log.success(`Cleared ${deletedCount} job(s)`);process.exit(0)}catch(error){await log.error("Failed to clear jobs",error);process.exit(1)}function parseArgs(){const args={};process.argv.forEach((arg)=>{if(arg.startsWith("--")){const[key,value]=arg.slice(2).split("=");if(key&&value)args[key]=value;else if(key)args[key]="true"}});return args}
|
|
1
|
+
import process from"node:process";import{log}from"@stacksjs/logging";import{Job}from"@stacksjs/orm";const options=parseArgs(),queueName=options.queue,force=options.force==="true";try{if(!force){log.warn("This will delete all jobs from the queue. Use --force to confirm.");await log.flush();process.exit(1)}let deletedCount=0;if(queueName){log.info(`Clearing all jobs from queue "${queueName}"...`);const jobs=await Job.where("queue",queueName).get();deletedCount=jobs.length;for(const job of jobs)await job.delete()}else{log.info("Clearing all jobs from all queues...");const jobs=await Job.all();deletedCount=jobs.length;for(const job of jobs)await job.delete()}log.success(`Cleared ${deletedCount} job(s)`);await log.flush();process.exit(0)}catch(error){await log.error("Failed to clear jobs",error);process.exit(1)}function parseArgs(){const args={};process.argv.forEach((arg)=>{if(arg.startsWith("--")){const[key,value]=arg.slice(2).split("=");if(key&&value)args[key]=value;else if(key)args[key]="true"}});return args}
|
package/dist/queue/dlq-purge.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import process from"node:process";import{log}from"@stacksjs/logging";import{purgeDeadLetterJobs}from"@stacksjs/queue";const options=parseArgs(),days=options.olderThanDays?Number.parseInt(options.olderThanDays,10):options["older-than-days"]?Number.parseInt(options["older-than-days"],10):30;if(!Number.isFinite(days)||days<1){await log.error(`Invalid --older-than-days value '${options.olderThanDays??options["older-than-days"]}'`);process.exit(1)}try{log.info(`Pruning dead-letter rows older than ${days} day(s)...`);const deleted=await purgeDeadLetterJobs(days);log.success(`Deleted ${deleted} dead-letter row(s)`);process.exit(0)}catch(error){await log.error("Failed to purge dead-letter jobs",error);process.exit(1)}function parseArgs(){const args={};process.argv.forEach((arg)=>{if(arg.startsWith("--")){const[key,value]=arg.slice(2).split("=");if(key&&value)args[key]=value}});return args}
|
|
1
|
+
import process from"node:process";import{log}from"@stacksjs/logging";import{purgeDeadLetterJobs}from"@stacksjs/queue";const options=parseArgs(),days=options.olderThanDays?Number.parseInt(options.olderThanDays,10):options["older-than-days"]?Number.parseInt(options["older-than-days"],10):30;if(!Number.isFinite(days)||days<1){await log.error(`Invalid --older-than-days value '${options.olderThanDays??options["older-than-days"]}'`);process.exit(1)}try{log.info(`Pruning dead-letter rows older than ${days} day(s)...`);const deleted=await purgeDeadLetterJobs(days);log.success(`Deleted ${deleted} dead-letter row(s)`);await log.flush();process.exit(0)}catch(error){await log.error("Failed to purge dead-letter jobs",error);process.exit(1)}function parseArgs(){const args={};process.argv.forEach((arg)=>{if(arg.startsWith("--")){const[key,value]=arg.slice(2).split("=");if(key&&value)args[key]=value}});return args}
|
package/dist/queue/dlq-retry.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import process from"node:process";import{log}from"@stacksjs/logging";import{retryDeadLetterJob}from"@stacksjs/queue";const options=parseArgs(),idArg=options.id;if(!idArg){await log.error("Usage: buddy queue:dlq:retry --id=<id>");process.exit(1)}const id=Number.parseInt(idArg,10);if(Number.isNaN(id)){await log.error("Invalid id provided");process.exit(1)}try{if(!await retryDeadLetterJob(id)){await log.error(`Dead-letter job ${id} not found (or DLQ table missing)`);process.exit(1)}log.success(`Re-enqueued dead-letter job ${id}`);process.exit(0)}catch(error){await log.error("Failed to re-enqueue dead-letter job",error);process.exit(1)}function parseArgs(){const args={};process.argv.forEach((arg)=>{if(arg.startsWith("--")){const[key,value]=arg.slice(2).split("=");if(key&&value)args[key]=value}});return args}
|
|
1
|
+
import process from"node:process";import{log}from"@stacksjs/logging";import{retryDeadLetterJob}from"@stacksjs/queue";const options=parseArgs(),idArg=options.id;if(!idArg){await log.error("Usage: buddy queue:dlq:retry --id=<id>");process.exit(1)}const id=Number.parseInt(idArg,10);if(Number.isNaN(id)){await log.error("Invalid id provided");process.exit(1)}try{if(!await retryDeadLetterJob(id)){await log.error(`Dead-letter job ${id} not found (or DLQ table missing)`);process.exit(1)}log.success(`Re-enqueued dead-letter job ${id}`);await log.flush();process.exit(0)}catch(error){await log.error("Failed to re-enqueue dead-letter job",error);process.exit(1)}function parseArgs(){const args={};process.argv.forEach((arg)=>{if(arg.startsWith("--")){const[key,value]=arg.slice(2).split("=");if(key&&value)args[key]=value}});return args}
|
package/dist/queue/flush.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import process from"node:process";import{log}from"@stacksjs/logging";import{FailedJob}from"@stacksjs/orm";const options=parseArgs(),queueName=options.queue,force=options.force==="true";try{if(!force){log.warn("This will permanently delete all failed jobs. Use --force to confirm.");process.exit(1)}let deletedCount=0;if(queueName){log.info(`Flushing all failed jobs from queue "${queueName}"...`);const failedJobs=await FailedJob.where("queue",queueName).get();deletedCount=failedJobs.length;for(const job of failedJobs)await job.delete()}else{log.info("Flushing all failed jobs from all queues...");const failedJobs=await FailedJob.all();deletedCount=failedJobs.length;for(const job of failedJobs)await job.delete()}log.success(`Flushed ${deletedCount} failed job(s)`);process.exit(0)}catch(error){const message=error instanceof Error?error.message:String(error);if(/no such table:\s*(?:jobs|failed_jobs)\b/i.test(message)){process.stdout.write(`Queue tables are not set up yet.
|
|
1
|
+
import process from"node:process";import{log}from"@stacksjs/logging";import{FailedJob}from"@stacksjs/orm";const options=parseArgs(),queueName=options.queue,force=options.force==="true";try{if(!force){log.warn("This will permanently delete all failed jobs. Use --force to confirm.");await log.flush();process.exit(1)}let deletedCount=0;if(queueName){log.info(`Flushing all failed jobs from queue "${queueName}"...`);const failedJobs=await FailedJob.where("queue",queueName).get();deletedCount=failedJobs.length;for(const job of failedJobs)await job.delete()}else{log.info("Flushing all failed jobs from all queues...");const failedJobs=await FailedJob.all();deletedCount=failedJobs.length;for(const job of failedJobs)await job.delete()}log.success(`Flushed ${deletedCount} failed job(s)`);await log.flush();process.exit(0)}catch(error){const message=error instanceof Error?error.message:String(error);if(/no such table:\s*(?:jobs|failed_jobs)\b/i.test(message)){process.stdout.write(`Queue tables are not set up yet.
|
|
2
2
|
`);process.stdout.write("Run `buddy queue:table` to create the migrations, then `buddy migrate` to apply them.\n");process.exit(0)}await log.error("Failed to flush failed jobs",error);process.exit(1)}function parseArgs(){const args={};process.argv.forEach((arg)=>{if(arg.startsWith("--")){const[key,value]=arg.slice(2).split("=");if(key&&value)args[key]=value;else if(key)args[key]="true"}});return args}
|
package/dist/queue/inspect.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import process from"node:process";import{log}from"@stacksjs/logging";import{Job,FailedJob}from"@stacksjs/orm";const options=parseArgs(),jobId=options.id,failedFlag=options.failed==="true";try{if(!jobId){await log.error("Please provide a job ID");log.info("Usage: buddy queue:inspect --id=<jobId> [--failed]");process.exit(1)}const id=Number.parseInt(jobId,10);if(Number.isNaN(id)){await log.error("Invalid job ID provided");process.exit(1)}if(failedFlag){const failedResult=await FailedJob.find(id);if(!failedResult){await log.error(`Failed job with ID ${id} not found`);process.exit(1)}const job=failedResult;console.log(`
|
|
1
|
+
import process from"node:process";import{log}from"@stacksjs/logging";import{Job,FailedJob}from"@stacksjs/orm";const options=parseArgs(),jobId=options.id,failedFlag=options.failed==="true";try{if(!jobId){await log.error("Please provide a job ID");log.info("Usage: buddy queue:inspect --id=<jobId> [--failed]");await log.flush();process.exit(1)}const id=Number.parseInt(jobId,10);if(Number.isNaN(id)){await log.error("Invalid job ID provided");process.exit(1)}if(failedFlag){const failedResult=await FailedJob.find(id);if(!failedResult){await log.error(`Failed job with ID ${id} not found`);process.exit(1)}const job=failedResult;console.log(`
|
|
2
2
|
\u250C\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\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510`);console.log("\u2502 Failed Job Details \u2502");console.log("\u251C\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\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524");console.log(`\u2502 ID: ${String(job.id).padEnd(52)} \u2502`);console.log(`\u2502 Queue: ${(job.queue||"default").padEnd(52)} \u2502`);console.log(`\u2502 Connection: ${(job.connection||"database").padEnd(52)} \u2502`);console.log(`\u2502 Failed At: ${(job.failed_at||"N/A").padEnd(52)} \u2502`);console.log("\u251C\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\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524");console.log("\u2502 Exception: \u2502");console.log("\u251C\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\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524");const exception=job.exception||"Unknown error",lines=exception.match(/.{1,62}/g)||[exception];for(const line of lines.slice(0,20))console.log(`\u2502 ${line.padEnd(62)} \u2502`);if(lines.length>20)console.log(`\u2502 ... (${lines.length-20} more lines)`.padEnd(64)+" \u2502");console.log("\u251C\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\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524");console.log("\u2502 Payload: \u2502");console.log("\u251C\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\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524");if(job.payload)try{const payload=JSON.parse(job.payload);console.log(`\u2502 Name: ${payload.name.padEnd(52)} \u2502`);console.log(`\u2502 Path: ${payload.path.padEnd(52)} \u2502`);console.log(`\u2502 Max Tries: ${String(payload.maxTries).padEnd(52)} \u2502`);console.log("\u2502 Parameters: \u2502");const paramLines=JSON.stringify(payload.params,null,2).split(`
|
|
3
3
|
`);for(const line of paramLines.slice(0,15))console.log(`\u2502 ${line.substring(0,60).padEnd(60)} \u2502`);if(paramLines.length>15)console.log(`\u2502 ... (${paramLines.length-15} more lines)`.padEnd(64)+" \u2502")}catch{console.log(`\u2502 Raw: ${job.payload.substring(0,58).padEnd(58)} \u2502`)}else console.log("\u2502 (No payload) \u2502");console.log("\u2514\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\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518");console.log(`
|
|
4
|
-
Actions:`);console.log(` Retry this job: buddy queue:retry --id=${id}`);console.log(` Delete this job: buddy queue:flush --id=${id}`)}else{const jobResult=await Job.find(id);if(!jobResult){await log.error(`Job with ID ${id} not found`);log.info("Tip: Use --failed flag to inspect failed jobs");process.exit(1)}const job=jobResult,now=Math.floor(Date.now()/1000);let status="Pending";if(job.reserved_at)status="Processing";else if(job.available_at&&job.available_at>now)status="Delayed";console.log(`
|
|
4
|
+
Actions:`);console.log(` Retry this job: buddy queue:retry --id=${id}`);console.log(` Delete this job: buddy queue:flush --id=${id}`)}else{const jobResult=await Job.find(id);if(!jobResult){await log.error(`Job with ID ${id} not found`);log.info("Tip: Use --failed flag to inspect failed jobs");await log.flush();process.exit(1)}const job=jobResult,now=Math.floor(Date.now()/1000);let status="Pending";if(job.reserved_at)status="Processing";else if(job.available_at&&job.available_at>now)status="Delayed";console.log(`
|
|
5
5
|
\u250C\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\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510`);console.log("\u2502 Job Details \u2502");console.log("\u251C\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\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524");console.log(`\u2502 ID: ${String(job.id).padEnd(50)} \u2502`);console.log(`\u2502 Queue: ${(job.queue||"default").padEnd(50)} \u2502`);console.log(`\u2502 Status: ${status.padEnd(50)} \u2502`);console.log(`\u2502 Attempts: ${String(job.attempts||0).padEnd(50)} \u2502`);console.log("\u251C\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\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524");if(job.available_at){const availableDate=new Date(job.available_at*1000);console.log(`\u2502 Available At: ${availableDate.toISOString().padEnd(50)} \u2502`)}if(job.reserved_at){const reservedDate=new Date(job.reserved_at*1000);console.log(`\u2502 Reserved At: ${reservedDate.toISOString().padEnd(50)} \u2502`)}if(job.created_at)console.log(`\u2502 Created At: ${String(job.created_at).padEnd(50)} \u2502`);console.log("\u251C\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\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524");console.log("\u2502 Payload: \u2502");console.log("\u251C\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\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524");if(job.payload)try{const payload=JSON.parse(job.payload);console.log(`\u2502 Name: ${payload.name.padEnd(52)} \u2502`);console.log(`\u2502 Path: ${payload.path.padEnd(52)} \u2502`);console.log(`\u2502 Max Tries: ${String(payload.maxTries).padEnd(52)} \u2502`);console.log(`\u2502 Timeout: ${String(payload.timeOut||"N/A").padEnd(52)} \u2502`);console.log("\u2502 Parameters: \u2502");const paramLines=JSON.stringify(payload.params,null,2).split(`
|
|
6
6
|
`);for(const line of paramLines.slice(0,15))console.log(`\u2502 ${line.substring(0,60).padEnd(60)} \u2502`);if(paramLines.length>15)console.log(`\u2502 ... (${paramLines.length-15} more lines)`.padEnd(64)+" \u2502");if(payload.classPayload)try{const classConfig=JSON.parse(payload.classPayload);console.log("\u251C\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\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524");console.log("\u2502 Job Configuration: \u2502");console.log("\u251C\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\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524");console.log(`\u2502 Tries: ${String(classConfig.tries||3).padEnd(52)} \u2502`);console.log(`\u2502 Timeout: ${String(classConfig.timeout||60).padEnd(52)} \u2502`);if(classConfig.backoff)console.log(`\u2502 Backoff: ${String(JSON.stringify(classConfig.backoff)).substring(0,52).padEnd(52)} \u2502`)}catch{}}catch{console.log(`\u2502 Raw: ${job.payload.substring(0,58).padEnd(58)} \u2502`)}else console.log("\u2502 (No payload) \u2502");console.log("\u2514\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\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518");if(status==="Delayed"&&job.available_at){const waitTime=job.available_at-now;console.log(`
|
|
7
7
|
This job will be available in ${waitTime} second(s)`)}}process.exit(0)}catch(error){await log.error("Failed to inspect job",error);process.exit(1)}function parseArgs(){const args={};process.argv.forEach((arg)=>{if(arg.startsWith("--")){const[key,value]=arg.slice(2).split("=");if(key&&value)args[key]=value;else if(key)args[key]="true"}});return args}
|
package/dist/queue/pause.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import process from"node:process";import{log}from"@stacksjs/logging";import{pauseQueue}from"@stacksjs/queue";const options=parseArgs(),queue=options.queue;if(!queue){await log.error("Usage: buddy queue:pause --queue=<name> [--for=300]");process.exit(1)}const pauseSeconds=options.for?Number.parseInt(options.for,10):300;try{await pauseQueue(queue,pauseSeconds);log.success(`Paused queue '${queue}' for ${pauseSeconds}s`);process.exit(0)}catch(error){await log.error("Failed to pause queue",error);process.exit(1)}function parseArgs(){const args={};process.argv.forEach((arg)=>{if(arg.startsWith("--")){const[key,value]=arg.slice(2).split("=");if(key&&value)args[key]=value}});return args}
|
|
1
|
+
import process from"node:process";import{log}from"@stacksjs/logging";import{pauseQueue}from"@stacksjs/queue";const options=parseArgs(),queue=options.queue;if(!queue){await log.error("Usage: buddy queue:pause --queue=<name> [--for=300]");process.exit(1)}const pauseSeconds=options.for?Number.parseInt(options.for,10):300;try{await pauseQueue(queue,pauseSeconds);log.success(`Paused queue '${queue}' for ${pauseSeconds}s`);await log.flush();process.exit(0)}catch(error){await log.error("Failed to pause queue",error);process.exit(1)}function parseArgs(){const args={};process.argv.forEach((arg)=>{if(arg.startsWith("--")){const[key,value]=arg.slice(2).split("=");if(key&&value)args[key]=value}});return args}
|
package/dist/queue/quarantine.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import process from"node:process";import{log}from"@stacksjs/logging";import{listQuarantined,quarantineJob}from"@stacksjs/queue";const options=parseArgs();try{if(options.add){const jobName=options.add;await quarantineJob(jobName);log.success(`Quarantined ${jobName}`);process.exit(0)}const rows=await listQuarantined();if(rows.length===0){console.log("\u2713 No jobs currently quarantined");process.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(const row of rows){const id=String(row.id).padEnd(3),jn=(row.job_name||"?").substring(0,32).padEnd(32),ph=(row.payload_hash||"?").substring(0,16).padEnd(16),fc=String(row.failure_count??0).padEnd(8),qa=(row.quarantined_at||"N/A").substring(0,24).padEnd(24);console.log(`\u2502 ${id} \u2502 ${jn} \u2502 ${ph} \u2502 ${fc} \u2502 ${qa} \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(`
|
|
1
|
+
import process from"node:process";import{log}from"@stacksjs/logging";import{listQuarantined,quarantineJob}from"@stacksjs/queue";const options=parseArgs();try{if(options.add){const jobName=options.add;await quarantineJob(jobName);log.success(`Quarantined ${jobName}`);await log.flush();process.exit(0)}const rows=await listQuarantined();if(rows.length===0){console.log("\u2713 No jobs currently quarantined");process.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(const row of rows){const id=String(row.id).padEnd(3),jn=(row.job_name||"?").substring(0,32).padEnd(32),ph=(row.payload_hash||"?").substring(0,16).padEnd(16),fc=String(row.failure_count??0).padEnd(8),qa=(row.quarantined_at||"N/A").substring(0,24).padEnd(24);console.log(`\u2502 ${id} \u2502 ${jn} \u2502 ${ph} \u2502 ${fc} \u2502 ${qa} \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(`
|
|
2
2
|
${rows.length} quarantined entrie(s). Use \`queue:unquarantine <JobName>\` to lift.`);process.exit(0)}catch(error){await log.error("Failed to handle queue:quarantine",error);process.exit(1)}function parseArgs(){const args={};process.argv.forEach((arg)=>{if(arg.startsWith("--")){const[key,value]=arg.slice(2).split("=");if(key&&value)args[key]=value}});return args}
|
package/dist/queue/resume.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import process from"node:process";import{log}from"@stacksjs/logging";import{resumeQueue}from"@stacksjs/queue";const options=parseArgs(),queue=options.queue;if(!queue){await log.error("Usage: buddy queue:resume --queue=<name>");process.exit(1)}try{await resumeQueue(queue);log.success(`Resumed queue '${queue}'`);process.exit(0)}catch(error){await log.error("Failed to resume queue",error);process.exit(1)}function parseArgs(){const args={};process.argv.forEach((arg)=>{if(arg.startsWith("--")){const[key,value]=arg.slice(2).split("=");if(key&&value)args[key]=value}});return args}
|
|
1
|
+
import process from"node:process";import{log}from"@stacksjs/logging";import{resumeQueue}from"@stacksjs/queue";const options=parseArgs(),queue=options.queue;if(!queue){await log.error("Usage: buddy queue:resume --queue=<name>");process.exit(1)}try{await resumeQueue(queue);log.success(`Resumed queue '${queue}'`);await log.flush();process.exit(0)}catch(error){await log.error("Failed to resume queue",error);process.exit(1)}function parseArgs(){const args={};process.argv.forEach((arg)=>{if(arg.startsWith("--")){const[key,value]=arg.slice(2).split("=");if(key&&value)args[key]=value}});return args}
|
package/dist/queue/retry.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import process from"node:process";import{log}from"@stacksjs/logging";import{executeFailedJobs,retryFailedJob}from"@stacksjs/queue";const options=parseArgs(),jobId=options.id,all=options.all==="true";try{if(all){log.info("Retrying all failed jobs...");await executeFailedJobs();log.success("All failed jobs have been queued for retry")}else if(jobId){const id=Number.parseInt(jobId,10);if(Number.isNaN(id)){await log.error("Invalid job ID provided");process.exit(1)}log.info(`Retrying failed job ${id}...`);await retryFailedJob(id);log.success(`Failed job ${id} has been queued for retry`)}else{log.warn("Please provide a job ID or use --all to retry all failed jobs");log.info("Usage: buddy queue:retry <id> or buddy queue:retry --all");process.exit(1)}process.exit(0)}catch(error){await log.error("Failed to retry job(s)",error);process.exit(1)}function parseArgs(){const args={};process.argv.forEach((arg)=>{if(arg.startsWith("--")){const[key,value]=arg.slice(2).split("=");if(key&&value)args[key]=value;else if(key)args[key]="true"}});return args}
|
|
1
|
+
import process from"node:process";import{log}from"@stacksjs/logging";import{executeFailedJobs,retryFailedJob}from"@stacksjs/queue";const options=parseArgs(),jobId=options.id,all=options.all==="true";try{if(all){log.info("Retrying all failed jobs...");await executeFailedJobs();log.success("All failed jobs have been queued for retry")}else if(jobId){const id=Number.parseInt(jobId,10);if(Number.isNaN(id)){await log.error("Invalid job ID provided");process.exit(1)}log.info(`Retrying failed job ${id}...`);await retryFailedJob(id);log.success(`Failed job ${id} has been queued for retry`)}else{log.warn("Please provide a job ID or use --all to retry all failed jobs");log.info("Usage: buddy queue:retry <id> or buddy queue:retry --all");await log.flush();process.exit(1)}process.exit(0)}catch(error){await log.error("Failed to retry job(s)",error);process.exit(1)}function parseArgs(){const args={};process.argv.forEach((arg)=>{if(arg.startsWith("--")){const[key,value]=arg.slice(2).split("=");if(key&&value)args[key]=value;else if(key)args[key]="true"}});return args}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import process from"node:process";import{log}from"@stacksjs/logging";import{discoverJobs,getScheduledJobs}from"@stacksjs/queue";try{log.info(`Discovering scheduled jobs...
|
|
2
|
-
`);await discoverJobs();const scheduledJobs=getScheduledJobs();if(scheduledJobs.length===0){log.info("No scheduled jobs found.");log.info('Tip: Add a "rate" or "schedule" property to your job configuration.');process.exit(0)}console.log("\u250C\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\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510");console.log("\u2502 Job Name \u2502 Schedule \u2502 Queue \u2502 Tries \u2502");console.log("\u251C\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\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524");for(const job of scheduledJobs){const name=job.name.substring(0,48).padEnd(48),schedule=(job.config.rate||job.config.schedule||"N/A").substring(0,21).padEnd(21),queue=(job.config.queue||"default").substring(0,9).padEnd(9),tries=String(job.config.tries||3).padStart(7);console.log(`\u2502 ${name} \u2502 ${schedule} \u2502 ${queue} \u2502${tries} \u2502`)}console.log("\u2514\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\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518");console.log(`
|
|
2
|
+
`);await discoverJobs();const scheduledJobs=getScheduledJobs();if(scheduledJobs.length===0){log.info("No scheduled jobs found.");log.info('Tip: Add a "rate" or "schedule" property to your job configuration.');await log.flush();process.exit(0)}console.log("\u250C\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\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510");console.log("\u2502 Job Name \u2502 Schedule \u2502 Queue \u2502 Tries \u2502");console.log("\u251C\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\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524");for(const job of scheduledJobs){const name=job.name.substring(0,48).padEnd(48),schedule=(job.config.rate||job.config.schedule||"N/A").substring(0,21).padEnd(21),queue=(job.config.queue||"default").substring(0,9).padEnd(9),tries=String(job.config.tries||3).padStart(7);console.log(`\u2502 ${name} \u2502 ${schedule} \u2502 ${queue} \u2502${tries} \u2502`)}console.log("\u2514\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\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518");console.log(`
|
|
3
3
|
Total: ${scheduledJobs.length} scheduled job(s)`);console.log(`
|
|
4
4
|
Schedule Formats:`);console.log(' \u2022 Cron: "* * * * *" (minute hour day month dayOfWeek)');console.log(" \u2022 Presets: @hourly, @daily, @weekly, @monthly");console.log(" \u2022 Every: Every.Minute, Every.Hour, Every.Day");process.exit(0)}catch(error){await log.error("Failed to list scheduled jobs:",error);process.exit(1)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import process from"node:process";import{log}from"@stacksjs/logging";import{unquarantineJob}from"@stacksjs/queue";const options=parseArgs(),jobName=options.name;if(!jobName){await log.error("Usage: buddy queue:unquarantine --name=<JobName>");process.exit(1)}try{await unquarantineJob(jobName);log.success(`Lifted quarantine for ${jobName}`);process.exit(0)}catch(error){await log.error("Failed to unquarantine",error);process.exit(1)}function parseArgs(){const args={};process.argv.forEach((arg)=>{if(arg.startsWith("--")){const[key,value]=arg.slice(2).split("=");if(key&&value)args[key]=value}});return args}
|
|
1
|
+
import process from"node:process";import{log}from"@stacksjs/logging";import{unquarantineJob}from"@stacksjs/queue";const options=parseArgs(),jobName=options.name;if(!jobName){await log.error("Usage: buddy queue:unquarantine --name=<JobName>");process.exit(1)}try{await unquarantineJob(jobName);log.success(`Lifted quarantine for ${jobName}`);await log.flush();process.exit(0)}catch(error){await log.error("Failed to unquarantine",error);process.exit(1)}function parseArgs(){const args={};process.argv.forEach((arg)=>{if(arg.startsWith("--")){const[key,value]=arg.slice(2).split("=");if(key&&value)args[key]=value}});return args}
|
|
@@ -6,6 +6,10 @@ export declare function standalonePackageUpdateCommand(): string;
|
|
|
6
6
|
* rewriting the application's ownership boundary.
|
|
7
7
|
*/
|
|
8
8
|
export declare function frameworkPackageUpdateCommand(): string;
|
|
9
|
+
/** The installed meta-package version, or null when dependencies are absent/incomplete. */
|
|
10
|
+
export declare function installedStacksVersion(projectRoot: string): string | null;
|
|
11
|
+
/** Whether the declared target still needs to be installed locally. */
|
|
12
|
+
export declare function needsFrameworkInstall(projectRoot: string, target: string): boolean;
|
|
9
13
|
/** Strip a range operator (`^`, `~`, `>=`, …) so a declared range compares to a bare version. */
|
|
10
14
|
export declare function baseVersion(range: string): string;
|
|
11
15
|
/*` tooling
|
package/dist/upgrade/packages.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{existsSync,readdirSync,readFileSync,statSync,writeFileSync}from"node:fs";import{join,relative}from"node:path";import process from"node:process";import{runCommand}from"@stacksjs/cli";import{installedDefaultsVersion}from"@stacksjs/path";import{detectProjectAiProviders,measureDefaultsDrift,migratePackageProjectManifest,migratePackageProjectTsconfig,summarizeStructureChanges,syncPackageProjectFiles}from"./package-project";export function hasStacksDependency(pkg){return Boolean(pkg.dependencies?.stacks||pkg.devDependencies?.stacks)}export function standalonePackageUpdateCommand(){return"bun update"}export function frameworkPackageUpdateCommand(){return"bun update stacks"}async function updateStandalonePackage(projectRoot,options){console.log(`
|
|
1
|
+
import{existsSync,readdirSync,readFileSync,statSync,writeFileSync}from"node:fs";import{join,relative}from"node:path";import process from"node:process";import{runCommand}from"@stacksjs/cli";import{installedDefaultsVersion}from"@stacksjs/path";import{detectProjectAiProviders,measureDefaultsDrift,migratePackageProjectManifest,migratePackageProjectTsconfig,summarizeStructureChanges,syncPackageProjectFiles}from"./package-project";export function hasStacksDependency(pkg){return Boolean(pkg.dependencies?.stacks||pkg.devDependencies?.stacks)}export function standalonePackageUpdateCommand(){return"bun update"}export function frameworkPackageUpdateCommand(){return"bun update stacks"}export function installedStacksVersion(projectRoot){try{const manifest=JSON.parse(readFileSync(join(projectRoot,"node_modules/stacks/package.json"),"utf-8"));return typeof manifest.version==="string"?manifest.version:null}catch{return null}}export function needsFrameworkInstall(projectRoot,target){return installedStacksVersion(projectRoot)!==target}async function updateStandalonePackage(projectRoot,options){console.log(`
|
|
2
2
|
Standalone package detected. No Stacks framework source is installed.`);if(options.dryRun){console.log(" --dry-run: would refresh the package dependencies with `bun update`. No files were changed.\n");process.exit(0)}if(options.noPostinstall){console.log(" --no-postinstall: skipping the dependency refresh. Run `bun update` when ready.\n");process.exit(0)}console.log(` Refreshing declared dependencies...
|
|
3
3
|
`);if((await runCommand(standalonePackageUpdateCommand(),{cwd:projectRoot})).isErr){console.error("\n\u2717 The dependency refresh failed. Resolve the reported error and re-run `buddy update`.\n");process.exit(1)}console.log(`
|
|
4
4
|
\u2714 Standalone package dependencies are up to date.
|
|
@@ -10,10 +10,10 @@ import{existsSync,readdirSync,readFileSync,statSync,writeFileSync}from"node:fs";
|
|
|
10
10
|
`);process.exit(0)}if(changes.length>0||projectManifestChanges.length>0){const trailing=raw.endsWith(`
|
|
11
11
|
`)?`
|
|
12
12
|
`:"";writeFileSync(pkgPath,`${JSON.stringify(pkg,null,2)}${trailing}`);console.log("\u2714 Updated package.json")}if(options.noPostinstall){console.log(" --no-postinstall: skipping install. Run this to pull the new versions:");console.log(` ${frameworkPackageUpdateCommand()}
|
|
13
|
-
`);process.exit(0)}if(changes.length>0||manifestChanges.length>0||projectManifestChanges.length>0||options.force){console.log(` Installing\u2026
|
|
13
|
+
`);process.exit(0)}const dependenciesNeedInstall=needsFrameworkInstall(projectRoot,target);if(changes.length>0||manifestChanges.length>0||projectManifestChanges.length>0||dependenciesNeedInstall||options.force){console.log(` Installing\u2026
|
|
14
14
|
`);if((await runCommand(frameworkPackageUpdateCommand(),{cwd:projectRoot})).isErr){console.error("\n\u2717 The install step failed. Your package.json was updated - resolve the error and re-run `bun update`.\n");process.exit(1)}}const defaultsPackageRoot=join(projectRoot,"node_modules/@stacksjs/defaults"),structureChanges=existsSync(join(defaultsPackageRoot,"package.json"))?syncPackageProjectFiles(projectRoot,defaultsPackageRoot):[],tsconfigChanges=migratePackageProjectTsconfig(projectRoot);if(structureChanges.length>0||tsconfigChanges.length>0){const added=structureChanges.filter((change)=>change.action==="add").length,updated=structureChanges.filter((change)=>change.action==="update").length+tsconfigChanges.length,removed=structureChanges.filter((change)=>change.action==="remove").length;console.log(` Project structure: +${added} ~${updated} -${removed}`)}for(const provider of detectProjectAiProviders(projectRoot))if((await runCommand(`./buddy setup:ai ${provider} --force`,{cwd:projectRoot})).isErr){console.error(`
|
|
15
15
|
\u2717 AI setup refresh failed for ${provider}. Re-run \`buddy setup:ai ${provider} --force\`.
|
|
16
|
-
`);process.exit(1)}if(!(changes.length>0||manifestChanges.length>0||projectManifestChanges.length>0||structureChanges.length>0||tsconfigChanges.length>0)&&!options.force)console.log(`
|
|
16
|
+
`);process.exit(1)}if(!(changes.length>0||manifestChanges.length>0||projectManifestChanges.length>0||dependenciesNeedInstall||structureChanges.length>0||tsconfigChanges.length>0)&&!options.force)console.log(`
|
|
17
17
|
\u2714 Already up to date - dependencies and managed project files match the target.
|
|
18
18
|
`);else console.log(`
|
|
19
19
|
\u2714 Upgraded to stacks@${target}. Review the changelog: https://github.com/stacksjs/stacks/releases/tag/v${target}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/actions",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.74.
|
|
5
|
+
"version": "0.74.12",
|
|
6
6
|
"description": "The Stacks actions.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -60,52 +60,52 @@
|
|
|
60
60
|
"prepublishOnly": "bun run build"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@stacksjs/action-runner": "0.74.
|
|
64
|
-
"@stacksjs/ai": "0.74.
|
|
65
|
-
"@stacksjs/analytics": "0.74.
|
|
66
|
-
"@stacksjs/api": "0.74.
|
|
67
|
-
"@stacksjs/auth": "0.74.
|
|
68
|
-
"@stacksjs/build": "0.74.
|
|
63
|
+
"@stacksjs/action-runner": "0.74.12",
|
|
64
|
+
"@stacksjs/ai": "0.74.12",
|
|
65
|
+
"@stacksjs/analytics": "0.74.12",
|
|
66
|
+
"@stacksjs/api": "0.74.12",
|
|
67
|
+
"@stacksjs/auth": "0.74.12",
|
|
68
|
+
"@stacksjs/build": "0.74.12",
|
|
69
69
|
"@stacksjs/bumpx": "^0.2.6",
|
|
70
70
|
"@stacksjs/bunpress": "^0.2.8",
|
|
71
|
-
"@stacksjs/cli": "0.74.
|
|
72
|
-
"@stacksjs/cloud": "0.74.
|
|
73
|
-
"@stacksjs/cms": "0.74.
|
|
74
|
-
"@stacksjs/config": "0.74.
|
|
75
|
-
"@stacksjs/database": "0.74.
|
|
76
|
-
"@stacksjs/desktop-build": "0.74.
|
|
77
|
-
"@stacksjs/dns": "0.74.
|
|
78
|
-
"@stacksjs/enums": "0.74.
|
|
79
|
-
"@stacksjs/env": "0.74.
|
|
80
|
-
"@stacksjs/error-handling": "0.74.
|
|
71
|
+
"@stacksjs/cli": "0.74.12",
|
|
72
|
+
"@stacksjs/cloud": "0.74.12",
|
|
73
|
+
"@stacksjs/cms": "0.74.12",
|
|
74
|
+
"@stacksjs/config": "0.74.12",
|
|
75
|
+
"@stacksjs/database": "0.74.12",
|
|
76
|
+
"@stacksjs/desktop-build": "0.74.12",
|
|
77
|
+
"@stacksjs/dns": "0.74.12",
|
|
78
|
+
"@stacksjs/enums": "0.74.12",
|
|
79
|
+
"@stacksjs/env": "0.74.12",
|
|
80
|
+
"@stacksjs/error-handling": "0.74.12",
|
|
81
81
|
"@stacksjs/gitit": "^0.2.5",
|
|
82
|
-
"@stacksjs/i18n": "0.74.
|
|
83
|
-
"@stacksjs/image": "0.74.
|
|
84
|
-
"@stacksjs/logging": "0.74.
|
|
82
|
+
"@stacksjs/i18n": "0.74.12",
|
|
83
|
+
"@stacksjs/image": "0.74.12",
|
|
84
|
+
"@stacksjs/logging": "0.74.12",
|
|
85
85
|
"@stacksjs/logsmith": "^0.2.3",
|
|
86
|
-
"@stacksjs/orm": "0.74.
|
|
87
|
-
"@stacksjs/path": "0.74.
|
|
88
|
-
"@stacksjs/payments": "0.74.
|
|
89
|
-
"@stacksjs/queue": "0.74.
|
|
90
|
-
"@stacksjs/registry": "0.74.
|
|
91
|
-
"@stacksjs/router": "0.74.
|
|
86
|
+
"@stacksjs/orm": "0.74.12",
|
|
87
|
+
"@stacksjs/path": "0.74.12",
|
|
88
|
+
"@stacksjs/payments": "0.74.12",
|
|
89
|
+
"@stacksjs/queue": "0.74.12",
|
|
90
|
+
"@stacksjs/registry": "0.74.12",
|
|
91
|
+
"@stacksjs/router": "0.74.12",
|
|
92
92
|
"@stacksjs/rpx": "^0.11.42",
|
|
93
|
-
"@stacksjs/scheduler": "0.74.
|
|
94
|
-
"@stacksjs/search-engine": "0.74.
|
|
95
|
-
"@stacksjs/security": "0.74.
|
|
96
|
-
"@stacksjs/server": "0.74.
|
|
97
|
-
"@stacksjs/sites": "0.74.
|
|
98
|
-
"@stacksjs/storage": "0.74.
|
|
99
|
-
"@stacksjs/strings": "0.74.
|
|
100
|
-
"@stacksjs/stx": "^0.2.
|
|
93
|
+
"@stacksjs/scheduler": "0.74.12",
|
|
94
|
+
"@stacksjs/search-engine": "0.74.12",
|
|
95
|
+
"@stacksjs/security": "0.74.12",
|
|
96
|
+
"@stacksjs/server": "0.74.12",
|
|
97
|
+
"@stacksjs/sites": "0.74.12",
|
|
98
|
+
"@stacksjs/storage": "0.74.12",
|
|
99
|
+
"@stacksjs/strings": "0.74.12",
|
|
100
|
+
"@stacksjs/stx": "^0.2.269",
|
|
101
101
|
"@stacksjs/tlsx": "^0.13.19",
|
|
102
102
|
"@stacksjs/ts-cloud": "^0.12.10",
|
|
103
103
|
"@stacksjs/ts-md": "^0.1.1",
|
|
104
|
-
"@stacksjs/tunnel": "0.74.
|
|
105
|
-
"@stacksjs/types": "0.74.
|
|
106
|
-
"@stacksjs/utils": "0.74.
|
|
107
|
-
"@stacksjs/whois": "0.74.
|
|
108
|
-
"bun-plugin-stx": "^0.2.
|
|
104
|
+
"@stacksjs/tunnel": "0.74.12",
|
|
105
|
+
"@stacksjs/types": "0.74.12",
|
|
106
|
+
"@stacksjs/utils": "0.74.12",
|
|
107
|
+
"@stacksjs/whois": "0.74.12",
|
|
108
|
+
"bun-plugin-stx": "^0.2.269"
|
|
109
109
|
},
|
|
110
110
|
"peerDependencies": {
|
|
111
111
|
"craft-native": ">=0.0.72",
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
}
|
|
121
121
|
},
|
|
122
122
|
"devDependencies": {
|
|
123
|
-
"@stacksjs/validation": "0.74.
|
|
123
|
+
"@stacksjs/validation": "0.74.12",
|
|
124
124
|
"better-dx": "^0.2.24"
|
|
125
125
|
}
|
|
126
126
|
}
|