@stacksjs/actions 0.70.86 → 0.70.88
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/package.json +16 -16
- package/dist/action.d.ts +0 -149
- package/dist/action.js +0 -2
- package/dist/actions.d.ts +0 -2
- package/dist/actions.js +0 -2
- package/dist/add.d.ts +0 -6
- package/dist/add.js +0 -2
- package/dist/ai/request-model-access.d.ts +0 -1
- package/dist/ai/request-model-access.js +0 -2
- package/dist/auth/client.d.ts +0 -1
- package/dist/auth/client.js +0 -3
- package/dist/auth/prune.d.ts +0 -1
- package/dist/auth/prune.js +0 -2
- package/dist/auth/setup.d.ts +0 -1
- package/dist/auth/setup.js +0 -206
- package/dist/auth/token.d.ts +0 -1
- package/dist/auth/token.js +0 -2
- package/dist/blog.d.ts +0 -19
- package/dist/blog.js +0 -148
- package/dist/build/cli.d.ts +0 -1
- package/dist/build/cli.js +0 -2
- package/dist/build/component-libs.d.ts +0 -1
- package/dist/build/component-libs.js +0 -2
- package/dist/build/core.d.ts +0 -1
- package/dist/build/core.js +0 -2
- package/dist/build/desktop.d.ts +0 -1
- package/dist/build/desktop.js +0 -2
- package/dist/build/docs.d.ts +0 -1
- package/dist/build/docs.js +0 -2
- package/dist/build/frontend-static.d.ts +0 -16
- package/dist/build/frontend-static.js +0 -9
- package/dist/build/server.d.ts +0 -1
- package/dist/build/server.js +0 -2
- package/dist/build/stacks.d.ts +0 -1
- package/dist/build/stacks.js +0 -2
- package/dist/build/views.d.ts +0 -1
- package/dist/build/views.js +0 -2
- package/dist/build.d.ts +0 -9
- package/dist/build.js +0 -2
- package/dist/bump.d.ts +0 -1
- package/dist/bump.js +0 -8
- package/dist/cdn/invalidate-cache.d.ts +0 -1
- package/dist/cdn/invalidate-cache.js +0 -1
- package/dist/changelog.d.ts +0 -9
- package/dist/changelog.js +0 -3
- package/dist/check/ports.d.ts +0 -1
- package/dist/check/ports.js +0 -2
- package/dist/chunk-0c8sd1t6.js +0 -2
- package/dist/chunk-0g2nzhx9.js +0 -240
- package/dist/chunk-0gadhvn7.js +0 -3
- package/dist/chunk-0h27aa4r.js +0 -93
- package/dist/chunk-3peh8kqs.js +0 -851
- package/dist/chunk-62gdfav8.js +0 -3
- package/dist/chunk-6bk53y02.js +0 -3
- package/dist/chunk-78c5n3s2.js +0 -3
- package/dist/chunk-c74qv38e.js +0 -17
- package/dist/chunk-cdk2r2jd.js +0 -1
- package/dist/chunk-dbz9dp2h.js +0 -3
- package/dist/chunk-e142dheq.js +0 -3
- package/dist/chunk-ec4gky40.js +0 -3
- package/dist/chunk-h3d81wrg.js +0 -3
- package/dist/chunk-m3q0x4h0.js +0 -688
- package/dist/chunk-mqgbyhph.js +0 -5
- package/dist/chunk-n24m8prb.js +0 -3
- package/dist/chunk-n5eqwhck.js +0 -7
- package/dist/chunk-nsvnqv8y.js +0 -5
- package/dist/chunk-nty6mmx4.js +0 -283
- package/dist/chunk-s735m9mg.js +0 -1
- package/dist/chunk-tpb8jgsk.js +0 -7
- package/dist/chunk-tsbk5vne.js +0 -3
- package/dist/chunk-xg9xscqz.js +0 -1
- package/dist/chunk-y6e448he.js +0 -7
- package/dist/clean.d.ts +0 -1
- package/dist/clean.js +0 -2
- package/dist/commit.d.ts +0 -3
- package/dist/commit.js +0 -2
- package/dist/copy-types.d.ts +0 -1
- package/dist/copy-types.js +0 -3
- package/dist/database/seed.d.ts +0 -1
- package/dist/database/seed.js +0 -2
- package/dist/deploy/create-receipt-rule.d.ts +0 -1
- package/dist/deploy/create-receipt-rule.js +0 -2
- package/dist/deploy/index.d.ts +0 -1
- package/dist/deploy/index.js +0 -300
- package/dist/dev/api.d.ts +0 -1
- package/dist/dev/api.js +0 -6
- package/dist/dev/components.d.ts +0 -1
- package/dist/dev/components.js +0 -2
- package/dist/dev/dashboard-globals.d.ts +0 -4
- package/dist/dev/dashboard-globals.js +0 -3
- package/dist/dev/dashboard-utils.d.ts +0 -150
- package/dist/dev/dashboard-utils.js +0 -2
- package/dist/dev/dashboard.d.ts +0 -22
- package/dist/dev/dashboard.js +0 -8
- package/dist/dev/desktop.d.ts +0 -1
- package/dist/dev/desktop.js +0 -2
- package/dist/dev/docs.d.ts +0 -1
- package/dist/dev/docs.js +0 -2
- package/dist/dev/index.d.ts +0 -10
- package/dist/dev/index.js +0 -2
- package/dist/dev/migrate-watcher.d.ts +0 -1
- package/dist/dev/migrate-watcher.js +0 -2
- package/dist/dev/system-tray.d.ts +0 -1
- package/dist/dev/system-tray.js +0 -2
- package/dist/dev/views.d.ts +0 -1
- package/dist/dev/views.js +0 -2
- package/dist/discover-packages.d.ts +0 -18
- package/dist/discover-packages.js +0 -2
- package/dist/domains/add.d.ts +0 -1
- package/dist/domains/add.js +0 -2
- package/dist/domains/purchase.d.ts +0 -1
- package/dist/domains/purchase.js +0 -2
- package/dist/domains/remove.d.ts +0 -1
- package/dist/domains/remove.js +0 -2
- package/dist/examples.d.ts +0 -5
- package/dist/examples.js +0 -2
- package/dist/find-projects.d.ts +0 -1
- package/dist/find-projects.js +0 -2
- package/dist/fresh.d.ts +0 -1
- package/dist/fresh.js +0 -2
- package/dist/generate/action-types.d.ts +0 -1
- package/dist/generate/action-types.js +0 -8
- package/dist/generate/component-meta.d.ts +0 -1
- package/dist/generate/component-meta.js +0 -3
- package/dist/generate/custom-cli-file.d.ts +0 -1
- package/dist/generate/custom-cli-file.js +0 -4
- package/dist/generate/env-files.d.ts +0 -1
- package/dist/generate/env-files.js +0 -26
- package/dist/generate/ide-helpers.d.ts +0 -1
- package/dist/generate/ide-helpers.js +0 -3
- package/dist/generate/index.d.ts +0 -36
- package/dist/generate/index.js +0 -2
- package/dist/generate/lib-entries.d.ts +0 -1
- package/dist/generate/lib-entries.js +0 -3
- package/dist/generate/pantry-file.d.ts +0 -1
- package/dist/generate/pantry-file.js +0 -2
- package/dist/generate/symlink-core.d.ts +0 -1
- package/dist/generate/symlink-core.js +0 -2
- package/dist/generate/types.d.ts +0 -1
- package/dist/generate/types.js +0 -2
- package/dist/generate/vscode-custom-data.d.ts +0 -1
- package/dist/generate/vscode-custom-data.js +0 -3
- package/dist/generate/web-types.d.ts +0 -1
- package/dist/generate/web-types.js +0 -1
- package/dist/helpers/component-meta.d.ts +0 -26
- package/dist/helpers/component-meta.js +0 -2
- package/dist/helpers/index.d.ts +0 -4
- package/dist/helpers/index.js +0 -2
- package/dist/helpers/lib-entries.d.ts +0 -12
- package/dist/helpers/lib-entries.js +0 -2
- package/dist/helpers/package-json.d.ts +0 -2
- package/dist/helpers/package-json.js +0 -43
- package/dist/helpers/utils.d.ts +0 -23
- package/dist/helpers/utils.js +0 -2
- package/dist/helpers/vscode-custom-data.d.ts +0 -3
- package/dist/helpers/vscode-custom-data.js +0 -2
- package/dist/index.d.ts +0 -49
- package/dist/index.js +0 -2
- package/dist/key-generate.d.ts +0 -1
- package/dist/key-generate.js +0 -2
- package/dist/lint/fix.d.ts +0 -1
- package/dist/lint/fix.js +0 -3
- package/dist/lint/index.d.ts +0 -1
- package/dist/lint/index.js +0 -3
- package/dist/lint/lint.d.ts +0 -14
- package/dist/lint/lint.js +0 -2
- package/dist/make-command.d.ts +0 -10
- package/dist/make-command.js +0 -45
- package/dist/make-job.d.ts +0 -5
- package/dist/make-job.js +0 -129
- package/dist/make-policy.d.ts +0 -10
- package/dist/make-policy.js +0 -94
- package/dist/make-resource.d.ts +0 -10
- package/dist/make-resource.js +0 -113
- package/dist/make.d.ts +0 -52
- package/dist/make.js +0 -2
- package/dist/migrate/database.d.ts +0 -1
- package/dist/migrate/database.js +0 -2
- package/dist/migrate/fresh.d.ts +0 -1
- package/dist/migrate/fresh.js +0 -2
- package/dist/orm/base.d.ts +0 -1
- package/dist/orm/base.js +0 -2
- package/dist/orm/test.d.ts +0 -1
- package/dist/orm/test.js +0 -1
- package/dist/prepublish.d.ts +0 -1
- package/dist/prepublish.js +0 -2
- package/dist/queue/clear.d.ts +0 -1
- package/dist/queue/clear.js +0 -2
- package/dist/queue/dlq-purge.d.ts +0 -1
- package/dist/queue/dlq-purge.js +0 -2
- package/dist/queue/dlq-retry.d.ts +0 -1
- package/dist/queue/dlq-retry.js +0 -2
- package/dist/queue/dlq.d.ts +0 -1
- package/dist/queue/dlq.js +0 -5
- package/dist/queue/failed.d.ts +0 -1
- package/dist/queue/failed.js +0 -5
- package/dist/queue/flush.d.ts +0 -1
- package/dist/queue/flush.js +0 -3
- package/dist/queue/inspect.d.ts +0 -1
- package/dist/queue/inspect.js +0 -8
- package/dist/queue/list.d.ts +0 -1
- package/dist/queue/list.js +0 -5
- package/dist/queue/monitor.d.ts +0 -1
- package/dist/queue/monitor.js +0 -7
- package/dist/queue/pause.d.ts +0 -1
- package/dist/queue/pause.js +0 -2
- package/dist/queue/quarantine.d.ts +0 -1
- package/dist/queue/quarantine.js +0 -3
- package/dist/queue/resume.d.ts +0 -1
- package/dist/queue/resume.js +0 -2
- package/dist/queue/retry.d.ts +0 -1
- package/dist/queue/retry.js +0 -2
- package/dist/queue/schedule-list.d.ts +0 -1
- package/dist/queue/schedule-list.js +0 -5
- package/dist/queue/schedule.d.ts +0 -1
- package/dist/queue/schedule.js +0 -2
- package/dist/queue/status.d.ts +0 -1
- package/dist/queue/status.js +0 -5
- package/dist/queue/table.d.ts +0 -1
- package/dist/queue/table.js +0 -2
- package/dist/queue/unquarantine.d.ts +0 -1
- package/dist/queue/unquarantine.js +0 -2
- package/dist/queue/work.d.ts +0 -1
- package/dist/queue/work.js +0 -2
- package/dist/release.d.ts +0 -1
- package/dist/release.js +0 -3
- package/dist/route/list.d.ts +0 -1
- package/dist/route/list.js +0 -3
- package/dist/run-action.d.ts +0 -2
- package/dist/run-action.js +0 -2
- package/dist/saas/setup.d.ts +0 -1
- package/dist/saas/setup.js +0 -2
- package/dist/scaffold-crud.d.ts +0 -25
- package/dist/scaffold-crud.js +0 -87
- package/dist/schedule/run.d.ts +0 -1
- package/dist/schedule/run.js +0 -2
- package/dist/search/flush.d.ts +0 -1
- package/dist/search/flush.js +0 -2
- package/dist/search/import.d.ts +0 -1
- package/dist/search/import.js +0 -2
- package/dist/search/settings-list.d.ts +0 -1
- package/dist/search/settings-list.js +0 -2
- package/dist/search/settings.d.ts +0 -1
- package/dist/search/settings.js +0 -2
- package/dist/serve/api.d.ts +0 -1
- package/dist/serve/api.js +0 -2
- package/dist/setup/index.d.ts +0 -1
- package/dist/setup/index.js +0 -2
- package/dist/setup/ssl.d.ts +0 -38
- package/dist/setup/ssl.js +0 -2
- package/dist/stacks.d.ts +0 -4
- package/dist/stacks.js +0 -2
- package/dist/templates.d.ts +0 -28
- package/dist/templates.js +0 -2
- package/dist/test/feature.d.ts +0 -1
- package/dist/test/feature.js +0 -2
- package/dist/test/index.d.ts +0 -1
- package/dist/test/index.js +0 -2
- package/dist/test/ui.d.ts +0 -1
- package/dist/test/ui.js +0 -2
- package/dist/test/unit.d.ts +0 -1
- package/dist/test/unit.js +0 -2
- package/dist/typecheck.d.ts +0 -1
- package/dist/typecheck.js +0 -2
- package/dist/types.d.ts +0 -3
- package/dist/types.js +0 -2
- package/dist/upgrade/binary.d.ts +0 -1
- package/dist/upgrade/binary.js +0 -2
- package/dist/upgrade/bun.d.ts +0 -1
- package/dist/upgrade/bun.js +0 -1
- package/dist/upgrade/dependencies.d.ts +0 -1
- package/dist/upgrade/dependencies.js +0 -2
- package/dist/upgrade/framework-utils.d.ts +0 -150
- package/dist/upgrade/framework-utils.js +0 -2
- package/dist/upgrade/framework.d.ts +0 -1
- package/dist/upgrade/framework.js +0 -7
- package/dist/upgrade/index.d.ts +0 -1
- package/dist/upgrade/index.js +0 -2
- package/dist/upgrade/packages.d.ts +0 -14
- package/dist/upgrade/packages.js +0 -12
- package/dist/upgrade/shell.d.ts +0 -1
- package/dist/upgrade/shell.js +0 -5
- package/dist/upgrade.d.ts +0 -7
- package/dist/upgrade.js +0 -2
package/dist/make-command.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import"./chunk-h3d81wrg.js";import{log as B}from"@stacksjs/logging";import*as G from"@stacksjs/path";import{get as O,writeFile as H}from"@stacksjs/storage";async function V(y){let z=y.name;if(!z)return B.error("Command name is required"),!1;let q=S(z),A=Q(q,y),D=G.commandsPath(`${q}.ts`);try{if(await H(D,A),B.success(`Created command: ${D}`),y.register!==!1)await R(q,y.signature||I(z));return!0}catch(E){return B.error(`Failed to create command: ${E.message}`),!1}}function Q(y,z){let q=z.signature||I(y),A=z.description||`The ${q} command`;return`import type { CLI } from '@stacksjs/types'
|
|
3
|
-
import { log } from '@stacksjs/cli'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* ${y} Command
|
|
7
|
-
*
|
|
8
|
-
* ${A}
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
interface ${y}Options {
|
|
12
|
-
verbose: boolean
|
|
13
|
-
// Add your command options here
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export default function (cli: CLI) {
|
|
17
|
-
cli
|
|
18
|
-
.command('${q}', '${A}')
|
|
19
|
-
.option('--verbose', 'Enable verbose output', { default: false })
|
|
20
|
-
// Add more options here
|
|
21
|
-
// .option('-n, --name <name>', 'Your name')
|
|
22
|
-
.action(async (options: ${y}Options) => {
|
|
23
|
-
try {
|
|
24
|
-
if (options.verbose) {
|
|
25
|
-
log.info('Running ${q} command...')
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
log.info('No command logic implemented yet. Update this command action to add behavior.')
|
|
29
|
-
|
|
30
|
-
log.success('${q} completed successfully!')
|
|
31
|
-
}
|
|
32
|
-
catch (error) {
|
|
33
|
-
log.error('${q} failed:', error)
|
|
34
|
-
throw error
|
|
35
|
-
}
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
// Handle unknown subcommands
|
|
39
|
-
cli.on('${q}:*', () => {
|
|
40
|
-
log.error('Invalid command: %s\\nSee --help for a list of available commands.', cli.args.join(' '))
|
|
41
|
-
})
|
|
42
|
-
}
|
|
43
|
-
`}async function R(y,z){let q=G.appPath("Commands.ts");try{let A=await O(q),D=A.match(/export default \{([\s\S]*)\} satisfies/);if(D){let E=D[1]??"";if(E.includes(`'${z}'`)){B.info(`Command '${z}' already registered in Commands.ts`);return}let J=` '${z}': '${y}',
|
|
44
|
-
`,L=`${E.trimEnd()}
|
|
45
|
-
${J}`;A=A.replace(/export default \{[\s\S]*\} satisfies/,`export default {${L}} satisfies`),await H(q,A),B.success(`Registered command '${z}' in Commands.ts`)}}catch(A){B.warn(`Could not register command in Commands.ts: ${A.message}`),B.info("You may need to manually add it to app/Commands.ts")}}function S(y){return y.replace(/[-_](.)/g,(z,q)=>q.toUpperCase()).replace(/^(.)/,(z,q)=>q.toUpperCase())}function I(y){return y.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[_\s]+/g,"-").toLowerCase()}export{V as makeCommand};
|
package/dist/make-job.d.ts
DELETED
package/dist/make-job.js
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import"./chunk-h3d81wrg.js";import{log as A}from"@stacksjs/logging";import*as H from"@stacksjs/path";import{writeFile as L}from"@stacksjs/storage";async function T(v){let x=v,y=v.name;if(!y)return A.error("Job name is required"),!1;let z=y.endsWith("Job")?y:`${y}Job`,I=x.class??!1?Q(z,x):M(z,x),E=H.userJobsPath(`${z}.ts`);try{return await L(E,I),A.success(`Created job: ${E}`),!0}catch(K){return A.error(`Failed to create job: ${K.message}`),!1}}function M(v,x){let y=x.queue??"default",z=x.tries??3,D=x.backoff??3;return`import { Job } from '@stacksjs/queue'
|
|
3
|
-
|
|
4
|
-
export default new Job({
|
|
5
|
-
/**
|
|
6
|
-
* The job name (optional, defaults to filename)
|
|
7
|
-
*/
|
|
8
|
-
name: '${v}',
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* A description of what this job does (optional)
|
|
12
|
-
*/
|
|
13
|
-
description: '${v} job',
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* The queue this job should be dispatched to
|
|
17
|
-
*/
|
|
18
|
-
queue: '${y}',
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Number of times to retry if the job fails
|
|
22
|
-
*/
|
|
23
|
-
tries: ${z},
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Seconds to wait between retry attempts
|
|
27
|
-
*/
|
|
28
|
-
backoff: ${D},
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Cron expression for scheduled jobs (optional)
|
|
32
|
-
* Examples:
|
|
33
|
-
* - '* * * * *' - Every minute
|
|
34
|
-
* - '0 * * * *' - Every hour
|
|
35
|
-
* - '0 0 * * *' - Every day at midnight
|
|
36
|
-
*/
|
|
37
|
-
// rate: '* * * * *',
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Backoff configuration for advanced retry strategies (optional)
|
|
41
|
-
*/
|
|
42
|
-
// backoffConfig: {
|
|
43
|
-
// strategy: 'exponential', // 'fixed' | 'exponential' | 'linear'
|
|
44
|
-
// initialDelay: 1000,
|
|
45
|
-
// factor: 2,
|
|
46
|
-
// maxDelay: 60000,
|
|
47
|
-
// },
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Handle the job
|
|
51
|
-
* @param payload - The job payload data
|
|
52
|
-
* @returns The result of the job processing
|
|
53
|
-
*/
|
|
54
|
-
async handle(payload: Record<string, unknown>) {
|
|
55
|
-
// Add your job logic here.
|
|
56
|
-
console.log('Processing job with payload:', payload)
|
|
57
|
-
|
|
58
|
-
return { success: true }
|
|
59
|
-
},
|
|
60
|
-
})
|
|
61
|
-
`}function Q(v,x){let y=x.queue??"default",z=x.tries??3;return`import { log } from '@stacksjs/logging'
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* ${v}
|
|
65
|
-
*
|
|
66
|
-
* Generated job class.
|
|
67
|
-
*/
|
|
68
|
-
export default class ${v} {
|
|
69
|
-
/**
|
|
70
|
-
* Job configuration
|
|
71
|
-
*/
|
|
72
|
-
public static config = {
|
|
73
|
-
/**
|
|
74
|
-
* The queue this job should be dispatched to
|
|
75
|
-
*/
|
|
76
|
-
queue: '${y}',
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Cron expression for scheduled jobs (optional)
|
|
80
|
-
* Examples:
|
|
81
|
-
* - '* * * * *' - Every minute
|
|
82
|
-
* - '0 * * * *' - Every hour
|
|
83
|
-
* - '0 0 * * *' - Every day at midnight
|
|
84
|
-
*/
|
|
85
|
-
// schedule: '0 0 * * *',
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Prevent overlapping job executions
|
|
89
|
-
*/
|
|
90
|
-
withoutOverlapping: false,
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Timeout in seconds
|
|
94
|
-
*/
|
|
95
|
-
timeout: 60,
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Number of retry attempts
|
|
99
|
-
*/
|
|
100
|
-
retries: ${z},
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Delay between retries in seconds
|
|
104
|
-
*/
|
|
105
|
-
retryAfter: [60, 120, 300],
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Execute the job
|
|
110
|
-
* @param payload - The job payload data
|
|
111
|
-
*/
|
|
112
|
-
public static async handle(payload?: Record<string, unknown>): Promise<{ success: boolean }> {
|
|
113
|
-
try {
|
|
114
|
-
log.info('${v}: Starting job execution')
|
|
115
|
-
|
|
116
|
-
// Add your job logic here.
|
|
117
|
-
console.log('Processing with payload:', payload)
|
|
118
|
-
|
|
119
|
-
log.info('${v}: Job completed successfully')
|
|
120
|
-
|
|
121
|
-
return { success: true }
|
|
122
|
-
}
|
|
123
|
-
catch (error) {
|
|
124
|
-
log.error('${v}: Job failed:', error)
|
|
125
|
-
throw error
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
`}export{T as makeJob};
|
package/dist/make-policy.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Create a new policy file in app/Policies
|
|
3
|
-
*/
|
|
4
|
-
export declare function makePolicy(options: MakePolicyOptions): Promise<boolean>;
|
|
5
|
-
export declare interface MakePolicyOptions {
|
|
6
|
-
name?: string
|
|
7
|
-
model?: string
|
|
8
|
-
register?: boolean
|
|
9
|
-
[key: string]: any
|
|
10
|
-
}
|
package/dist/make-policy.js
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Lb as O}from"./chunk-h3d81wrg.js";import{log as B}from"@stacksjs/logging";import*as J from"@stacksjs/path";import{doesExist as Q,get as R,writeFile as L}from"@stacksjs/storage";async function X(q){let b=q.name;if(!b)return B.error("Policy name is required"),!1;let z=b.endsWith("Policy")?b:`${b}Policy`,v=q.model||z.replace("Policy",""),I=T(z,v),H=J.appPath(`Policies/${z}.ts`);try{let G=J.appPath("Policies");if(!Q(G)){let{mkdirSync:K}=await import("@stacksjs/storage");K(G,{recursive:!0})}if(await L(H,I),B.success(`Created policy: ${H}`),q.register!==!1)await U(v,z);return!0}catch(G){return B.error(`Failed to create policy: ${G.message}`),!1}}function T(q,b){return`import type _User from '../models/User'
|
|
3
|
-
import { BasePolicy } from '@stacksjs/auth'
|
|
4
|
-
|
|
5
|
-
type UserModel = _User
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* ${q}
|
|
9
|
-
*
|
|
10
|
-
* This policy controls authorization for ${b} model actions.
|
|
11
|
-
*
|
|
12
|
-
* Usage:
|
|
13
|
-
* 1. Register in app/Gates.ts:
|
|
14
|
-
* policies: { '${b}': '${q}' }
|
|
15
|
-
*
|
|
16
|
-
* 2. Use in your code:
|
|
17
|
-
* import { Gate } from '@stacksjs/auth'
|
|
18
|
-
* await Gate.authorize('view', user, ${b.toLowerCase()})
|
|
19
|
-
*
|
|
20
|
-
* 3. Or use the middleware:
|
|
21
|
-
* route.put('/${b.toLowerCase()}s/:${b.toLowerCase()}', 'Update${b}')
|
|
22
|
-
* .middleware('can:update,${b.toLowerCase()}')
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
// TODO: Import or define your ${b} type
|
|
26
|
-
interface ${b} {
|
|
27
|
-
id: number
|
|
28
|
-
user_id: number
|
|
29
|
-
// Add your model properties here
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export default class ${q} extends BasePolicy<${b}> {
|
|
33
|
-
/**
|
|
34
|
-
* Run before any other checks.
|
|
35
|
-
* Return true to allow, false to deny, null to continue.
|
|
36
|
-
*/
|
|
37
|
-
before(user: UserModel | null, ability: string): boolean | null {
|
|
38
|
-
// Example: Admins can do anything
|
|
39
|
-
// if (user?.role === 'admin') return true
|
|
40
|
-
return null
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Determine if the user can view any ${b.toLowerCase()}s.
|
|
45
|
-
*/
|
|
46
|
-
viewAny(user: UserModel | null): boolean {
|
|
47
|
-
return true
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Determine if the user can view the ${b.toLowerCase()}.
|
|
52
|
-
*/
|
|
53
|
-
view(user: UserModel | null, model: ${b}): boolean {
|
|
54
|
-
return true
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Determine if the user can create ${b.toLowerCase()}s.
|
|
59
|
-
*/
|
|
60
|
-
create(user: UserModel | null): boolean {
|
|
61
|
-
return user !== null
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Determine if the user can update the ${b.toLowerCase()}.
|
|
66
|
-
*/
|
|
67
|
-
update(user: UserModel | null, model: ${b}): boolean {
|
|
68
|
-
return user?.id === model.user_id
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Determine if the user can delete the ${b.toLowerCase()}.
|
|
73
|
-
*/
|
|
74
|
-
delete(user: UserModel | null, model: ${b}): boolean {
|
|
75
|
-
return user?.id === model.user_id
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Determine if the user can restore the ${b.toLowerCase()}.
|
|
80
|
-
*/
|
|
81
|
-
restore(user: UserModel | null, model: ${b}): boolean {
|
|
82
|
-
return user?.id === model.user_id
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Determine if the user can permanently delete the ${b.toLowerCase()}.
|
|
87
|
-
*/
|
|
88
|
-
forceDelete(user: UserModel | null, model: ${b}): boolean {
|
|
89
|
-
return user?.id === model.user_id
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
`}async function U(q,b){let z=J.appPath("Gates.ts");try{let v=await R(z),I=v.match(/export const policies[^{]*\{([^}]*)\}/);if(I){let H=I[1]??"";if(H.includes(`'${q}'`)){B.info(`Policy for '${q}' already registered in Gates.ts`);return}let G=` '${q}': '${b}',
|
|
93
|
-
`,K=`${H.trimEnd()}
|
|
94
|
-
${G}`;v=v.replace(/export const policies[^{]*\{([^}]*)\}/,`export const policies: Record<string, string | { policy: string, model?: string }> = {${K}}`),await L(z,v),B.success(`Registered policy '${b}' for '${q}' in Gates.ts`)}}catch(v){B.warn(`Could not register policy in Gates.ts: ${v.message}`),B.info("You may need to manually add it to app/Gates.ts")}}export{X as makePolicy};
|
package/dist/make-resource.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Create a new API resource file in app/Resources
|
|
3
|
-
*/
|
|
4
|
-
export declare function makeResource(options: MakeResourceOptions): Promise<boolean>;
|
|
5
|
-
export declare interface MakeResourceOptions {
|
|
6
|
-
name?: string
|
|
7
|
-
model?: string
|
|
8
|
-
collection?: boolean
|
|
9
|
-
[key: string]: any
|
|
10
|
-
}
|
package/dist/make-resource.js
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Lb as G}from"./chunk-h3d81wrg.js";import{log as x}from"@stacksjs/logging";import*as z from"@stacksjs/path";import{doesExist as H,writeFile as I}from"@stacksjs/storage";async function O(q){let j=q.name;if(!j)return x.error("Resource name is required"),!1;let v=j.endsWith("Resource")?j:`${j}Resource`,A=q.model||v.replace("Resource",""),F=q.collection?K(v,A):J(v,A),B=z.appPath("Resources");if(!H(B)){let{mkdirSync:w}=await import("@stacksjs/storage");w(B,{recursive:!0})}let E=z.appPath(`Resources/${v}.ts`);try{return await I(E,F),x.success(`Created resource: ${E}`),!0}catch(w){return x.error(`Failed to create resource: ${w.message}`),!1}}function J(q,j){return`import type { Request } from '@stacksjs/router'
|
|
3
|
-
import { JsonResource } from '@stacksjs/api'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* ${q}
|
|
7
|
-
*
|
|
8
|
-
* Transforms ${j} model data for API responses.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* // Single resource
|
|
12
|
-
* return new ${q}(${j.toLowerCase()}).toResponse()
|
|
13
|
-
*
|
|
14
|
-
* // Collection
|
|
15
|
-
* return ${q}.collection(${j.toLowerCase()}s).toResponse()
|
|
16
|
-
*
|
|
17
|
-
* // With additional data
|
|
18
|
-
* return new ${q}(${j.toLowerCase()})
|
|
19
|
-
* .withAdditional({ message: 'Success' })
|
|
20
|
-
* .toResponse()
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
// TODO: Import or define your ${j} type
|
|
24
|
-
interface ${j} {
|
|
25
|
-
id: number
|
|
26
|
-
name: string
|
|
27
|
-
created_at: Date
|
|
28
|
-
updated_at: Date
|
|
29
|
-
// Add your model properties here
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export default class ${q} extends JsonResource<${j}> {
|
|
33
|
-
/**
|
|
34
|
-
* Transform the resource into an array.
|
|
35
|
-
*/
|
|
36
|
-
toArray(request?: Request): Record<string, any> {
|
|
37
|
-
return {
|
|
38
|
-
id: this.resource.id,
|
|
39
|
-
name: this.resource.name,
|
|
40
|
-
|
|
41
|
-
// Conditional fields
|
|
42
|
-
// secret: this.when(request?.user?.isAdmin, this.resource.secret),
|
|
43
|
-
|
|
44
|
-
// Loaded relationships
|
|
45
|
-
// posts: this.whenLoaded('posts', () =>
|
|
46
|
-
// PostResource.collection(this.resource.posts)
|
|
47
|
-
// ),
|
|
48
|
-
|
|
49
|
-
// Relationship counts
|
|
50
|
-
// posts_count: this.whenCounted('posts'),
|
|
51
|
-
|
|
52
|
-
// Timestamps
|
|
53
|
-
created_at: this.resource.created_at,
|
|
54
|
-
updated_at: this.resource.updated_at,
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
`}function K(q,j){let v=q.replace("Collection","");return`import type { Request } from '@stacksjs/router'
|
|
59
|
-
import { JsonResource, ResourceCollection } from '@stacksjs/api'
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* ${q}
|
|
63
|
-
*
|
|
64
|
-
* Collection resource for ${j} with custom collection behavior.
|
|
65
|
-
*
|
|
66
|
-
* @example
|
|
67
|
-
* return new ${q}(${j.toLowerCase()}s).toResponse()
|
|
68
|
-
*/
|
|
69
|
-
|
|
70
|
-
// TODO: Import or define your ${j} type
|
|
71
|
-
interface ${j} {
|
|
72
|
-
id: number
|
|
73
|
-
name: string
|
|
74
|
-
created_at: Date
|
|
75
|
-
updated_at: Date
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Individual resource for the collection
|
|
80
|
-
*/
|
|
81
|
-
class ${v} extends JsonResource<${j}> {
|
|
82
|
-
toArray(request?: Request): Record<string, any> {
|
|
83
|
-
return {
|
|
84
|
-
id: this.resource.id,
|
|
85
|
-
name: this.resource.name,
|
|
86
|
-
created_at: this.resource.created_at,
|
|
87
|
-
updated_at: this.resource.updated_at,
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Collection resource with custom behavior
|
|
94
|
-
*/
|
|
95
|
-
export default class ${q} extends ResourceCollection<${j}, ${v}> {
|
|
96
|
-
constructor(resources: ${j}[]) {
|
|
97
|
-
super(resources, ${v})
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Add collection-level data to the response
|
|
102
|
-
*/
|
|
103
|
-
toResponse(request?: Request): Record<string, any> {
|
|
104
|
-
return {
|
|
105
|
-
...super.toResponse(request),
|
|
106
|
-
meta: {
|
|
107
|
-
total: this.count(),
|
|
108
|
-
// Add any collection-level metadata here
|
|
109
|
-
},
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
`}export{O as makeResource};
|
package/dist/make.d.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import type { MakeOptions } from '@stacksjs/types';
|
|
2
|
-
/**
|
|
3
|
-
* Toggle dry-run mode. The buddy CLI flips this on before invoking a
|
|
4
|
-
* scaffolder when the user passed `--dry-run`. Stays a module-level
|
|
5
|
-
* flag (rather than threading through every signature) so existing
|
|
6
|
-
* scaffolders can opt in just by switching their write call.
|
|
7
|
-
*/
|
|
8
|
-
export declare function setDryRun(enabled: boolean): void;
|
|
9
|
-
export declare function isDryRunActive(): boolean;
|
|
10
|
-
export declare function invoke(options: MakeOptions): Promise<void>;
|
|
11
|
-
export declare function make(options: MakeOptions): Promise<void>;
|
|
12
|
-
export declare function makeAction(options: MakeOptions): Promise<void>;
|
|
13
|
-
export declare function makeComponent(options: MakeOptions): Promise<void>;
|
|
14
|
-
export declare function createAction(options: MakeOptions): Promise<void>;
|
|
15
|
-
export declare function createComponent(options: MakeOptions): Promise<void>;
|
|
16
|
-
export declare function makeDatabase(options: MakeOptions): void;
|
|
17
|
-
export declare function createDatabase(options: MakeOptions): void;
|
|
18
|
-
export declare function factory(options: MakeOptions): void;
|
|
19
|
-
export declare function createFactory(options: MakeOptions): Promise<void>;
|
|
20
|
-
export declare function makeNotification(options: MakeOptions): Promise<void>;
|
|
21
|
-
/**
|
|
22
|
-
* Scaffold a Mailable + companion stx template
|
|
23
|
-
* (stacksjs/stacks#1899, A2 from #1904). Pairs:
|
|
24
|
-
*
|
|
25
|
-
* app/Mail/<PascalName>.ts ← Mailable subclass
|
|
26
|
-
* resources/emails/<kebab-name>.stx ← stx template the Mailable resolves
|
|
27
|
-
*
|
|
28
|
-
* The name flows through both files: PascalCase for the class, kebab-case
|
|
29
|
-
* for the template (matching the convention the framework's bundled
|
|
30
|
-
* emails use — `welcome.stx`, `password-reset.stx`, etc.).
|
|
31
|
-
*
|
|
32
|
-
* Idempotent — refuses to overwrite either file when it already exists
|
|
33
|
-
* unless `options.force` is true. The reason: an accidental
|
|
34
|
-
* `buddy make:mail Welcome` against a project that already has a
|
|
35
|
-
* customized `Welcome` mailable would silently nuke the customization
|
|
36
|
-
* otherwise.
|
|
37
|
-
*/
|
|
38
|
-
export declare function createMail(options: MakeOptions & { force?: boolean }): Promise<boolean>;
|
|
39
|
-
export declare function makeMail(options: MakeOptions & { force?: boolean }): Promise<void>;
|
|
40
|
-
export declare function makePage(options: MakeOptions): Promise<void>;
|
|
41
|
-
export declare function createPage(options: MakeOptions): Promise<void>;
|
|
42
|
-
export declare function makeFunction(options: MakeOptions): Promise<void>;
|
|
43
|
-
export declare function createFunction(options: MakeOptions): Promise<void>;
|
|
44
|
-
export declare function makeLanguage(options: MakeOptions): Promise<void>;
|
|
45
|
-
export declare function createLanguage(options: MakeOptions): Promise<void>;
|
|
46
|
-
export declare function makeStack(options: MakeOptions): Promise<void>;
|
|
47
|
-
export declare function createNotification(options: MakeOptions): Promise<boolean>;
|
|
48
|
-
export declare function createMigration(options: MakeOptions): Promise<void>;
|
|
49
|
-
export declare function makeQueueTable(): Promise<void>;
|
|
50
|
-
export declare function makeCertificate(): Promise<void>;
|
|
51
|
-
export declare function createModel(options: MakeOptions): Promise<void>;
|
|
52
|
-
export declare function createMiddleware(options: MakeOptions): Promise<void>;
|
package/dist/make.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{A as k,B as l,C as m,D as n,E as o,F as p,G as q,H as r,I as s,J as t,K as u,L as v,M as w,N as x,O as y,P as z,Q as A,R as B,q as a,r as b,s as c,t as d,u as e,v as f,w as g,x as h,y as i,z as j}from"./chunk-c74qv38e.js";import"./chunk-nty6mmx4.js";import"./chunk-s735m9mg.js";import"./chunk-0gadhvn7.js";import"./chunk-h3d81wrg.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 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/migrate/database.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import i from"process";import{generateMigrations as t,runDatabaseMigration as a}from"@stacksjs/database";import{log as e}from"@stacksjs/logging";var r=await t();if(r?.isErr)console.error(r.error),e.error("[stacks] generateMigrations failed",r.error),i.exit(1);var o=await a();if(o.isErr)e.error("runDatabaseMigration failed"),e.error(o.error),i.exit(1);i.exit(0);
|
package/dist/migrate/fresh.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/migrate/fresh.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
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/orm/base.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
package/dist/orm/base.js
DELETED
package/dist/orm/test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
package/dist/orm/test.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
// @bun
|
package/dist/prepublish.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/prepublish.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import z from"process";import{NpmScript as A}from"@stacksjs/enums";import{log as q}from"@stacksjs/logging";import{runtimePath as B}from"@stacksjs/path";import{ExitCode as D}from"@stacksjs/types";import{runNpmScript as F}from"@stacksjs/utils";q.info("Running prepublish command...");var v=await F(A.BuildStacks,{verbose:!0,cwd:B()});if(v.isErr)q.error(Error("There was an error while prepublishing your stack"),v.error),z.exit(D.FatalError);q.success("Prepublishing completed");
|
package/dist/queue/clear.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/queue/clear.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import s from"process";import{log as r}from"@stacksjs/logging";import{Job as a}from"@stacksjs/orm";var n=c(),i=n.queue,f=n.force==="true";try{if(!f)r.warn("This will delete all jobs from the queue. Use --force to confirm."),s.exit(1);let e=0;if(i){r.info(`Clearing all jobs from queue "${i}"...`);let o=await a.where("queue",i).get();e=o.length;for(let t of o)await t.delete()}else{r.info("Clearing all jobs from all queues...");let o=await a.all();e=o.length;for(let t of o)await t.delete()}r.success(`Cleared ${e} job(s)`),s.exit(0)}catch(e){r.error("Failed to clear jobs",e),s.exit(1)}function c(){let e={};return s.argv.forEach((o)=>{if(o.startsWith("--")){let[t,l]=o.slice(2).split("=");if(t&&l)e[t]=l;else if(t)e[t]="true"}}),e}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/queue/dlq-purge.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
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}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/queue/dlq-retry.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
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}
|
package/dist/queue/dlq.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/queue/dlq.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
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/queue/failed.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/queue/failed.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
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}
|
package/dist/queue/flush.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/queue/flush.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import s from"process";import{log as i}from"@stacksjs/logging";import{FailedJob as l}from"@stacksjs/orm";var n=f(),r=n.queue,u=n.force==="true";try{if(!u)i.warn("This will permanently delete all failed jobs. Use --force to confirm."),s.exit(1);let e=0;if(r){i.info(`Flushing all failed jobs from queue "${r}"...`);let t=await l.where("queue",r).get();e=t.length;for(let o of t)await o.delete()}else{i.info("Flushing all failed jobs from all queues...");let t=await l.all();e=t.length;for(let o of t)await o.delete()}i.success(`Flushed ${e} failed job(s)`),s.exit(0)}catch(e){let t=e instanceof Error?e.message:String(e);if(/no such table:\s*(?:jobs|failed_jobs)\b/i.test(t))s.stdout.write(`Queue tables are not set up yet.
|
|
3
|
-
`),s.stdout.write("Run `buddy queue:table` to create the migrations, then `buddy migrate` to apply them.\n"),s.exit(0);i.error("Failed to flush failed jobs",e),s.exit(1)}function f(){let e={};return s.argv.forEach((t)=>{if(t.startsWith("--")){let[o,a]=t.slice(2).split("=");if(o&&a)e[o]=a;else if(o)e[o]="true"}}),e}
|
package/dist/queue/inspect.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/queue/inspect.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import N from"process";import{log as M}from"@stacksjs/logging";import{Job as S,FailedJob as U}from"@stacksjs/orm";var P=W(),O=P.id,V=P.failed==="true";try{if(!O)M.error("Please provide a job ID"),M.info("Usage: buddy queue:inspect --id=<jobId> [--failed]"),N.exit(1);let z=Number.parseInt(O,10);if(Number.isNaN(z))M.error("Invalid job ID provided"),N.exit(1);if(V){let B=await U.find(z);if(!B)M.error(`Failed job with ID ${z} not found`),N.exit(1);let h=B;console.log(`
|
|
3
|
-
\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(h.id).padEnd(52)} \u2502`),console.log(`\u2502 Queue: ${(h.queue||"default").padEnd(52)} \u2502`),console.log(`\u2502 Connection: ${(h.connection||"database").padEnd(52)} \u2502`),console.log(`\u2502 Failed At: ${(h.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");let E=h.exception||"Unknown error",G=E.match(/.{1,62}/g)||[E];for(let q of G.slice(0,20))console.log(`\u2502 ${q.padEnd(62)} \u2502`);if(G.length>20)console.log(`\u2502 ... (${G.length-20} more lines)`.padEnd(64)+" \u2502");if(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"),h.payload)try{let q=JSON.parse(h.payload);console.log(`\u2502 Name: ${q.name.padEnd(52)} \u2502`),console.log(`\u2502 Path: ${q.path.padEnd(52)} \u2502`),console.log(`\u2502 Max Tries: ${String(q.maxTries).padEnd(52)} \u2502`),console.log("\u2502 Parameters: \u2502");let K=JSON.stringify(q.params,null,2).split(`
|
|
4
|
-
`);for(let H of K.slice(0,15))console.log(`\u2502 ${H.substring(0,60).padEnd(60)} \u2502`);if(K.length>15)console.log(`\u2502 ... (${K.length-15} more lines)`.padEnd(64)+" \u2502")}catch{console.log(`\u2502 Raw: ${h.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(`
|
|
5
|
-
Actions:`),console.log(` Retry this job: buddy queue:retry --id=${z}`),console.log(` Delete this job: buddy queue:flush --id=${z}`)}else{let B=await S.find(z);if(!B)M.error(`Job with ID ${z} not found`),M.info("Tip: Use --failed flag to inspect failed jobs"),N.exit(1);let h=B,E=Math.floor(Date.now()/1000),G="Pending";if(h.reserved_at)G="Processing";else if(h.available_at&&h.available_at>E)G="Delayed";if(console.log(`
|
|
6
|
-
\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(h.id).padEnd(50)} \u2502`),console.log(`\u2502 Queue: ${(h.queue||"default").padEnd(50)} \u2502`),console.log(`\u2502 Status: ${G.padEnd(50)} \u2502`),console.log(`\u2502 Attempts: ${String(h.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"),h.available_at){let q=new Date(h.available_at*1000);console.log(`\u2502 Available At: ${q.toISOString().padEnd(50)} \u2502`)}if(h.reserved_at){let q=new Date(h.reserved_at*1000);console.log(`\u2502 Reserved At: ${q.toISOString().padEnd(50)} \u2502`)}if(h.created_at)console.log(`\u2502 Created At: ${String(h.created_at).padEnd(50)} \u2502`);if(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"),h.payload)try{let q=JSON.parse(h.payload);console.log(`\u2502 Name: ${q.name.padEnd(52)} \u2502`),console.log(`\u2502 Path: ${q.path.padEnd(52)} \u2502`),console.log(`\u2502 Max Tries: ${String(q.maxTries).padEnd(52)} \u2502`),console.log(`\u2502 Timeout: ${String(q.timeOut||"N/A").padEnd(52)} \u2502`),console.log("\u2502 Parameters: \u2502");let K=JSON.stringify(q.params,null,2).split(`
|
|
7
|
-
`);for(let H of K.slice(0,15))console.log(`\u2502 ${H.substring(0,60).padEnd(60)} \u2502`);if(K.length>15)console.log(`\u2502 ... (${K.length-15} more lines)`.padEnd(64)+" \u2502");if(q.classPayload)try{let H=JSON.parse(q.classPayload);if(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(H.tries||3).padEnd(52)} \u2502`),console.log(`\u2502 Timeout: ${String(H.timeout||60).padEnd(52)} \u2502`),H.backoff)console.log(`\u2502 Backoff: ${String(JSON.stringify(H.backoff)).substring(0,52).padEnd(52)} \u2502`)}catch{}}catch{console.log(`\u2502 Raw: ${h.payload.substring(0,58).padEnd(58)} \u2502`)}else console.log("\u2502 (No payload) \u2502");if(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"),G==="Delayed"&&h.available_at){let q=h.available_at-E;console.log(`
|
|
8
|
-
This job will be available in ${q} second(s)`)}}N.exit(0)}catch(z){M.error("Failed to inspect job",z),N.exit(1)}function W(){let z={};return N.argv.forEach((B)=>{if(B.startsWith("--")){let[h,E]=B.slice(2).split("=");if(h&&E)z[h]=E;else if(h)z[h]="true"}}),z}
|
package/dist/queue/list.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/queue/list.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
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}
|
package/dist/queue/monitor.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|