stacks 0.58.65 → 0.58.67
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/core/actions/dist/src/index.js +3 -1
- package/core/actions/dist/src/release.js +3 -1
- package/core/actions/dist/src/upgrade/index.js +3 -4
- package/core/actions/dist/src/upgrade.js +1 -1
- package/core/actions/package.json +3 -1
- package/core/actions/src/action.ts +24 -5
- package/core/actions/src/generate/action-types.ts +89 -0
- package/core/actions/src/upgrade/index.ts +6 -5
- package/core/ai/dist/index.js +3898 -3539
- package/core/ai/package.json +3 -3
- package/core/alias/package.json +1 -1
- package/core/analytics/package.json +1 -1
- package/core/api/package.json +1 -1
- package/core/arrays/package.json +1 -1
- package/core/arrays/src/helpers.ts +1 -1
- package/core/auth/package.json +1 -1
- package/core/buddy/package.json +1 -1
- package/core/build/package.json +1 -1
- package/core/bun-create/bud/package.json +1 -1
- package/core/bun-create/buddy/package.json +1 -1
- package/core/bun-create/stack/package.json +1 -1
- package/core/bun-create/stacks/package.json +1 -1
- package/core/bun-create/stx/package.json +1 -1
- package/core/bun-plugin-yaml/package.json +1 -1
- package/core/cache/package.json +2 -2
- package/core/chat/package.json +1 -1
- package/core/cli/dist/index.js +1 -1
- package/core/cli/package.json +1 -1
- package/core/cloud/dist/index.js +1 -1
- package/core/cloud/package.json +28 -28
- package/core/cloud/src/cloud/aws-sdk-layer/nodejs/package-lock.json +6 -6
- package/core/cloud/src/cloud/aws-sdk-layer/nodejs/package.json +2 -2
- package/core/cloud/src/cloud/compute.ts +1 -1
- package/core/cloud/src/cloud/router-layer/nodejs/package.json +2 -2
- package/core/collections/package.json +1 -1
- package/core/config/dist/index.js +2 -0
- package/core/config/package.json +1 -1
- package/core/config/src/defaults.ts +2 -0
- package/core/database/package.json +1 -1
- package/core/datetime/package.json +1 -1
- package/core/desktop/package.json +1 -1
- package/core/development/package.json +1 -1
- package/core/dns/package.json +4 -4
- package/core/docs/package.json +1 -1
- package/core/email/package.json +2 -2
- package/core/enums/dist/index.js +1 -0
- package/core/enums/package.json +1 -1
- package/core/enums/src/index.ts +1 -0
- package/core/env/package.json +1 -1
- package/core/error-handling/package.json +1 -1
- package/core/eslint-config/package.json +1 -1
- package/core/events/package.json +1 -1
- package/core/faker/package.json +1 -1
- package/core/git/package.json +1 -1
- package/core/health/package.json +1 -1
- package/core/http/package.json +1 -1
- package/core/lint/package.json +1 -1
- package/core/logging/package.json +1 -1
- package/core/notifications/package.json +1 -1
- package/core/objects/package.json +1 -1
- package/core/orm/package.json +1 -1
- package/core/path/package.json +1 -1
- package/core/payments/package.json +1 -1
- package/core/push/package.json +1 -1
- package/core/query-builder/package.json +1 -1
- package/core/queue/package.json +1 -1
- package/core/raycast/package.json +1 -1
- package/core/realtime/package.json +1 -1
- package/core/repl/package.json +1 -1
- package/core/router/package.json +1 -1
- package/core/scheduler/package.json +1 -1
- package/core/search-engine/package.json +1 -1
- package/core/security/package.json +1 -1
- package/core/server/package.json +1 -1
- package/core/signals/package.json +1 -1
- package/core/slug/package.json +1 -1
- package/core/sms/package.json +1 -1
- package/core/storage/package.json +1 -1
- package/core/strings/package.json +1 -1
- package/core/tables/package.json +1 -1
- package/core/testing/package.json +1 -1
- package/core/tinker/package.json +1 -1
- package/core/tunnel/package.json +1 -1
- package/core/types/package.json +1 -1
- package/core/types/src/cloud.ts +16 -0
- package/core/types/src/index.ts +1 -0
- package/core/types/src/request.ts +3 -0
- package/core/ui/package.json +1 -1
- package/core/utils/dist/index.js +1 -1
- package/core/utils/package.json +1 -1
- package/core/validation/build.ts +1 -1
- package/core/validation/package.json +1 -1
- package/core/vite/dist/index.js +1 -1
- package/core/vite/package.json +1 -1
- package/core/whois/package.json +1 -1
- package/core/x-ray/package.json +1 -1
- package/core/zsh-buddy/package.json +1 -1
- package/ide/vscode/package.json +1 -1
- package/package.json +1 -1
|
@@ -518,14 +518,16 @@ export default <Model> {
|
|
|
518
518
|
class Action3 {
|
|
519
519
|
name;
|
|
520
520
|
description;
|
|
521
|
+
fields;
|
|
521
522
|
rate;
|
|
522
523
|
tries;
|
|
523
524
|
backoff;
|
|
524
525
|
enabled;
|
|
525
526
|
handle;
|
|
526
|
-
constructor({ name, description, handle, rate, tries, backoff, enabled }) {
|
|
527
|
+
constructor({ name, description, fields, handle, rate, tries, backoff, enabled }) {
|
|
527
528
|
this.name = name;
|
|
528
529
|
this.description = description;
|
|
530
|
+
this.fields = fields;
|
|
529
531
|
this.rate = rate;
|
|
530
532
|
this.tries = tries;
|
|
531
533
|
this.backoff = backoff;
|
|
@@ -520,14 +520,16 @@ export default <Model> {
|
|
|
520
520
|
class Action3 {
|
|
521
521
|
name;
|
|
522
522
|
description;
|
|
523
|
+
fields;
|
|
523
524
|
rate;
|
|
524
525
|
tries;
|
|
525
526
|
backoff;
|
|
526
527
|
enabled;
|
|
527
528
|
handle;
|
|
528
|
-
constructor({ name, description, handle, rate, tries, backoff, enabled }) {
|
|
529
|
+
constructor({ name, description, fields, handle, rate, tries, backoff, enabled }) {
|
|
529
530
|
this.name = name;
|
|
530
531
|
this.description = description;
|
|
532
|
+
this.fields = fields;
|
|
531
533
|
this.rate = rate;
|
|
532
534
|
this.tries = tries;
|
|
533
535
|
this.backoff = backoff;
|
|
@@ -43,13 +43,12 @@ function hasAction(action) {
|
|
|
43
43
|
}
|
|
44
44
|
// src/upgrade/index.ts
|
|
45
45
|
import process from "process";
|
|
46
|
-
import {
|
|
46
|
+
import {parseArgs} from "@stacksjs/cli";
|
|
47
47
|
import {Action} from "@stacksjs/enums";
|
|
48
|
+
import {ExitCode} from "@stacksjs/types";
|
|
48
49
|
var options = parseArgs();
|
|
49
|
-
if (options?.framework || options?.all)
|
|
50
|
-
await updateFramework(options);
|
|
51
50
|
if (options?.dependencies || options?.all)
|
|
52
|
-
await
|
|
51
|
+
await runAction(Action.UpgradeDeps, options);
|
|
53
52
|
if (options?.bun || options?.all)
|
|
54
53
|
await runAction(Action.UpgradeBun, options);
|
|
55
54
|
process.exit(ExitCode.InvalidArgument);
|
|
@@ -7,7 +7,7 @@ import {projectPath} from "@stacksjs/path";
|
|
|
7
7
|
import * as storage from "@stacksjs/storage";
|
|
8
8
|
import {NpmScript} from "@stacksjs/enums";
|
|
9
9
|
// package.json
|
|
10
|
-
var version = "0.58.
|
|
10
|
+
var version = "0.58.67";
|
|
11
11
|
|
|
12
12
|
// src/upgrade.ts
|
|
13
13
|
function checkForUncommittedChanges(options) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/actions",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.58.
|
|
4
|
+
"version": "0.58.67",
|
|
5
5
|
"description": "The Stacks actions.",
|
|
6
6
|
"author": "Chris Breuer",
|
|
7
7
|
"license": "MIT",
|
|
@@ -64,6 +64,7 @@
|
|
|
64
64
|
"@stacksjs/storage": "workspace:*",
|
|
65
65
|
"@stacksjs/types": "workspace:*",
|
|
66
66
|
"@stacksjs/utils": "workspace:*",
|
|
67
|
+
"@stacksjs/validation": "workspace:*",
|
|
67
68
|
"markdown-it": "^14.0.0",
|
|
68
69
|
"vue-component-meta": "^1.8.27"
|
|
69
70
|
},
|
|
@@ -81,6 +82,7 @@
|
|
|
81
82
|
"@stacksjs/storage": "workspace:*",
|
|
82
83
|
"@stacksjs/strings": "workspace:*",
|
|
83
84
|
"@stacksjs/utils": "workspace:*",
|
|
85
|
+
"@stacksjs/validation": "workspace:*",
|
|
84
86
|
"markdown-it": "^14.0.0",
|
|
85
87
|
"vue-component-meta": "^1.8.27"
|
|
86
88
|
},
|
|
@@ -1,29 +1,48 @@
|
|
|
1
|
-
import type { JobOptions } from '@stacksjs/types'
|
|
1
|
+
import type { JobOptions, Nullable } from '@stacksjs/types'
|
|
2
|
+
import type { ValidationBoolean, ValidationNumber, ValidationString } from '@stacksjs/validation'
|
|
3
|
+
|
|
4
|
+
type FieldKey = string
|
|
5
|
+
interface FieldValue {
|
|
6
|
+
rule: ValidationString | ValidationNumber | ValidationBoolean | Date | Nullable<any>
|
|
7
|
+
message: string
|
|
8
|
+
factory?: any
|
|
9
|
+
unique?: boolean
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// TODO: this is temporary and will get auto generated based on ./app/Actions/*
|
|
13
|
+
interface Request {
|
|
14
|
+
message: string
|
|
15
|
+
level: 'info' | 'warn' | 'error'
|
|
16
|
+
}
|
|
2
17
|
|
|
3
18
|
interface ActionOptions {
|
|
4
19
|
name?: string
|
|
5
20
|
description?: string
|
|
6
|
-
|
|
21
|
+
fields?: Record<FieldKey, FieldValue>
|
|
22
|
+
path?: string
|
|
7
23
|
rate?: JobOptions['rate']
|
|
8
24
|
tries?: JobOptions['tries']
|
|
9
25
|
backoff?: JobOptions['backoff']
|
|
10
26
|
enabled?: JobOptions['enabled']
|
|
27
|
+
handle: (request?: Request) => Promise<any> | object | string
|
|
11
28
|
}
|
|
12
29
|
|
|
13
30
|
export class Action {
|
|
14
31
|
name?: string
|
|
15
32
|
description?: string
|
|
33
|
+
fields?: Record<FieldKey, FieldValue>
|
|
16
34
|
rate?: JobOptions['rate']
|
|
17
35
|
tries?: JobOptions['tries']
|
|
18
36
|
backoff?: JobOptions['backoff']
|
|
19
37
|
enabled?: boolean
|
|
20
|
-
handle: () => Promise<any>
|
|
38
|
+
handle: (request?: Request) => Promise<any> | object | string
|
|
21
39
|
|
|
22
|
-
constructor({ name, description, handle, rate, tries, backoff, enabled }: ActionOptions) {
|
|
23
|
-
// log.debug(`Action ${name} created`) // TODO
|
|
40
|
+
constructor({ name, description, fields, handle, rate, tries, backoff, enabled }: ActionOptions) {
|
|
41
|
+
// log.debug(`Action ${name} created`) // TODO: this does not yet work because the cloud does not yet have proper file system (efs) access
|
|
24
42
|
|
|
25
43
|
this.name = name
|
|
26
44
|
this.description = description
|
|
45
|
+
this.fields = fields
|
|
27
46
|
this.rate = rate
|
|
28
47
|
this.tries = tries
|
|
29
48
|
this.backoff = backoff
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { path as p } from '@stacksjs/path'
|
|
2
|
+
import { storage } from '@stacksjs/storage'
|
|
3
|
+
import { env as e, enums } from '@stacksjs/env'
|
|
4
|
+
import { logger } from '@stacksjs/logging'
|
|
5
|
+
import { envKeys } from '../../../../env'
|
|
6
|
+
|
|
7
|
+
log.debug('Generating type Action types...')
|
|
8
|
+
|
|
9
|
+
// generate ./storage/framework/types/env.d.ts file from .env
|
|
10
|
+
const envTypes = `
|
|
11
|
+
// This file is auto-generated by Stacks. Do not edit this file manually.
|
|
12
|
+
// If you want to edit Action types, please edit the app/Actions/* validations
|
|
13
|
+
//
|
|
14
|
+
// For more information, please visit: https://stacksjs.org/docs
|
|
15
|
+
|
|
16
|
+
declare module 'bun' {
|
|
17
|
+
namespace env {
|
|
18
|
+
${envKeys.map((key) => {
|
|
19
|
+
let type: string | undefined = typeof e[key]
|
|
20
|
+
let value: string | boolean | number | undefined = e[key]
|
|
21
|
+
|
|
22
|
+
if (!value) {
|
|
23
|
+
if (enums[key]) {
|
|
24
|
+
type = enums[key]?.map(item => `'${item}'`).join(' | ')
|
|
25
|
+
value = enums[key]?.[0] // default to the first enum value
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
switch (type) {
|
|
29
|
+
case 'number':
|
|
30
|
+
value = '0'
|
|
31
|
+
break
|
|
32
|
+
case 'boolean':
|
|
33
|
+
value = false
|
|
34
|
+
break
|
|
35
|
+
default:
|
|
36
|
+
value = ''
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
type = 'string'
|
|
42
|
+
if (typeof value === 'string') {
|
|
43
|
+
if (value.toLowerCase() === 'true' || value.toLowerCase() === 'false') {
|
|
44
|
+
type = 'boolean'
|
|
45
|
+
}
|
|
46
|
+
else if (!Number.isNaN(Number.parseFloat(value)) && Number.isFinite(Number(value))) {
|
|
47
|
+
type = 'number'
|
|
48
|
+
}
|
|
49
|
+
else if (enums[key]) {
|
|
50
|
+
// @ts-expect-error enums[key] is defined
|
|
51
|
+
type = enums[key].map(item => `'${item}'`).join(' | ')
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
else if (typeof value === 'number') {
|
|
56
|
+
type = 'number'
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
else if (typeof value === 'boolean') {
|
|
60
|
+
type = 'boolean'
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return `const ${key}: ${type}`
|
|
64
|
+
}).join('\n ')}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
`
|
|
68
|
+
|
|
69
|
+
await storage.writeFile(p.frameworkPath('types/env.d.ts'), envTypes)
|
|
70
|
+
|
|
71
|
+
logger.log(' - ./storage/framework/env.ts')
|
|
72
|
+
|
|
73
|
+
// generate ./storage/framework/env.ts file based on Bun.env
|
|
74
|
+
const env = `
|
|
75
|
+
// This file is auto-generated by Stacks. Do not edit this file manually.
|
|
76
|
+
// If you want to change the environment variables, please edit the .env file.
|
|
77
|
+
//
|
|
78
|
+
// For more information, please visit: https://stacksjs.org/docs
|
|
79
|
+
|
|
80
|
+
export const envKeys = [
|
|
81
|
+
${envKeys.map(key => `'${key}'`).join(',\n ')}
|
|
82
|
+
] as const
|
|
83
|
+
|
|
84
|
+
export type EnvKey = typeof envKeys[number]
|
|
85
|
+
`
|
|
86
|
+
|
|
87
|
+
await storage.writeFile(p.frameworkPath('env.ts'), env)
|
|
88
|
+
|
|
89
|
+
logger.log(' - ./storage/framework/env.d.ts')
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import process from 'node:process'
|
|
2
|
-
import {
|
|
2
|
+
import { parseArgs } from '@stacksjs/cli'
|
|
3
3
|
import { Action } from '@stacksjs/enums'
|
|
4
|
+
import { ExitCode } from '@stacksjs/types'
|
|
4
5
|
import { runAction } from '../helpers'
|
|
5
6
|
|
|
6
|
-
const options = parseArgs()
|
|
7
|
+
const options: any = parseArgs()
|
|
7
8
|
|
|
8
9
|
// run all the upgrade actions
|
|
9
|
-
if (options?.framework || options?.all)
|
|
10
|
-
|
|
10
|
+
// if (options?.framework || options?.all)
|
|
11
|
+
// await updateFramework(options)
|
|
11
12
|
|
|
12
13
|
if (options?.dependencies || options?.all)
|
|
13
|
-
await
|
|
14
|
+
await runAction(Action.UpgradeDeps, options)
|
|
14
15
|
|
|
15
16
|
if (options?.bun || options?.all)
|
|
16
17
|
await runAction(Action.UpgradeBun, options)
|