Skip to content

Commit e46c400

Browse files
committed
chore: wip
1 parent b3037cb commit e46c400

File tree

4 files changed

+19
-8
lines changed

4 files changed

+19
-8
lines changed

app/Actions/LogAction.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ import { Action } from '@stacksjs/actions'
22
import { validator } from '@stacksjs/validation'
33
import { log } from '@stacksjs/logging'
44

5+
interface Request {
6+
message: string
7+
level: 'info' | 'warn' | 'error'
8+
}
9+
510
export default new Action({
611
name: 'Dummy Logger',
712
description: 'This action is used to demo how to POST to a server and upon success, log a message.',
@@ -19,7 +24,11 @@ export default new Action({
1924
},
2025

2126
// handle(request: { message: string, level: 'info' | 'warn' | 'error' }) {
22-
handle(request: Request) {
27+
handle(request?: Request) {
28+
if (!request)
29+
return 'No request was provided.'
30+
31+
// TODO: need to vine validate
2332
log[request.level](request.message)
2433

2534
return `Logged "${request.message}" at "${request.level}" level`

storage/framework/core/actions/src/action.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ interface ActionOptions {
2424
tries?: JobOptions['tries']
2525
backoff?: JobOptions['backoff']
2626
enabled?: JobOptions['enabled']
27-
handle: (request?: Request) => Promise<any> | string
27+
handle: (request?: Request) => Promise<any> | object | string
2828
}
2929

3030
export class Action {
@@ -35,7 +35,7 @@ export class Action {
3535
tries?: JobOptions['tries']
3636
backoff?: JobOptions['backoff']
3737
enabled?: boolean
38-
handle: (request?: Request) => Promise<any> | string
38+
handle: (request?: Request) => Promise<any> | object | string
3939

4040
constructor({ name, description, fields, handle, rate, tries, backoff, enabled }: ActionOptions) {
4141
// log.debug(`Action ${name} created`) // TODO: this does not yet work because the cloud does not yet have proper file system (efs) access

storage/framework/core/actions/src/upgrade/index.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
import process from 'node:process'
2-
import { ExitCode, parseArgs } from '@stacksjs/cli'
2+
import { parseArgs } from '@stacksjs/cli'
33
import { Action } from '@stacksjs/enums'
4+
import { ExitCode } from '@stacksjs/types'
45
import { runAction } from '../helpers'
56

6-
const options = parseArgs()
7+
const options: any = parseArgs()
78

89
// run all the upgrade actions
9-
if (options?.framework || options?.all)
10-
await updateFramework(options)
10+
// if (options?.framework || options?.all)
11+
// await updateFramework(options)
1112

1213
if (options?.dependencies || options?.all)
13-
await updateDependencies(options)
14+
await runAction(Action.UpgradeDeps, options)
1415

1516
if (options?.bun || options?.all)
1617
await runAction(Action.UpgradeBun, options)

storage/framework/core/enums/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,5 @@ export enum Action {
9494
Typecheck = 'typecheck',
9595
Upgrade = 'upgrade/index',
9696
UpgradeBun = 'upgrade/bun',
97+
UpgradeDeps = 'upgrade/dependencies',
9798
}

0 commit comments

Comments
 (0)