stacks 0.58.64 → 0.58.66

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.
Files changed (100) hide show
  1. package/core/actions/dist/src/index.js +3 -4
  2. package/core/actions/dist/src/release.js +5 -6
  3. package/core/actions/dist/src/upgrade/index.js +3 -4
  4. package/core/actions/dist/src/upgrade.js +1 -1
  5. package/core/actions/package.json +3 -1
  6. package/core/actions/src/action.ts +24 -6
  7. package/core/actions/src/generate/action-types.ts +89 -0
  8. package/core/actions/src/upgrade/index.ts +6 -5
  9. package/core/ai/dist/index.js +3898 -3539
  10. package/core/ai/package.json +3 -3
  11. package/core/alias/package.json +1 -1
  12. package/core/analytics/package.json +1 -1
  13. package/core/api/package.json +1 -1
  14. package/core/arrays/package.json +1 -1
  15. package/core/arrays/src/helpers.ts +1 -1
  16. package/core/auth/package.json +1 -1
  17. package/core/buddy/package.json +1 -1
  18. package/core/build/package.json +1 -1
  19. package/core/bun-create/bud/package.json +1 -1
  20. package/core/bun-create/buddy/package.json +1 -1
  21. package/core/bun-create/stack/package.json +1 -1
  22. package/core/bun-create/stacks/package.json +1 -1
  23. package/core/bun-create/stx/package.json +1 -1
  24. package/core/bun-plugin-yaml/package.json +1 -1
  25. package/core/cache/package.json +2 -2
  26. package/core/chat/package.json +1 -1
  27. package/core/cli/dist/index.js +1 -1
  28. package/core/cli/package.json +1 -1
  29. package/core/cloud/dist/index.js +1 -1
  30. package/core/cloud/package.json +28 -28
  31. package/core/cloud/src/cloud/aws-sdk-layer/nodejs/package-lock.json +6 -6
  32. package/core/cloud/src/cloud/aws-sdk-layer/nodejs/package.json +2 -2
  33. package/core/cloud/src/cloud/compute.ts +1 -1
  34. package/core/cloud/src/cloud/router-layer/nodejs/package.json +2 -2
  35. package/core/collections/package.json +1 -1
  36. package/core/config/dist/index.js +2 -0
  37. package/core/config/package.json +1 -1
  38. package/core/config/src/defaults.ts +2 -0
  39. package/core/database/package.json +1 -1
  40. package/core/datetime/package.json +1 -1
  41. package/core/desktop/package.json +3 -3
  42. package/core/development/package.json +1 -1
  43. package/core/dns/package.json +4 -4
  44. package/core/docs/package.json +1 -1
  45. package/core/email/package.json +2 -2
  46. package/core/enums/dist/index.js +1 -0
  47. package/core/enums/package.json +1 -1
  48. package/core/enums/src/index.ts +1 -0
  49. package/core/env/package.json +1 -1
  50. package/core/error-handling/package.json +1 -1
  51. package/core/eslint-config/package.json +2 -2
  52. package/core/events/package.json +1 -1
  53. package/core/faker/package.json +1 -1
  54. package/core/git/package.json +1 -1
  55. package/core/health/package.json +1 -1
  56. package/core/http/package.json +1 -1
  57. package/core/lint/package.json +1 -1
  58. package/core/logging/package.json +1 -1
  59. package/core/notifications/package.json +1 -1
  60. package/core/objects/package.json +1 -1
  61. package/core/orm/package.json +1 -1
  62. package/core/path/package.json +1 -1
  63. package/core/path/src/index.ts +1 -0
  64. package/core/payments/package.json +1 -1
  65. package/core/push/package.json +1 -1
  66. package/core/query-builder/package.json +1 -1
  67. package/core/queue/package.json +1 -1
  68. package/core/raycast/package.json +1 -1
  69. package/core/realtime/package.json +1 -1
  70. package/core/repl/package.json +1 -1
  71. package/core/router/package.json +1 -1
  72. package/core/scheduler/package.json +1 -1
  73. package/core/search-engine/package.json +1 -1
  74. package/core/security/package.json +1 -1
  75. package/core/server/package.json +1 -1
  76. package/core/signals/package.json +1 -1
  77. package/core/slug/package.json +1 -1
  78. package/core/sms/package.json +1 -1
  79. package/core/storage/package.json +1 -1
  80. package/core/strings/package.json +1 -1
  81. package/core/tables/package.json +1 -1
  82. package/core/testing/package.json +1 -1
  83. package/core/tinker/package.json +1 -1
  84. package/core/tunnel/package.json +1 -1
  85. package/core/types/package.json +2 -2
  86. package/core/types/src/cloud.ts +16 -0
  87. package/core/types/src/index.ts +1 -0
  88. package/core/types/src/request.ts +3 -0
  89. package/core/ui/package.json +3 -3
  90. package/core/utils/dist/index.js +1 -1
  91. package/core/utils/package.json +1 -1
  92. package/core/validation/build.ts +1 -1
  93. package/core/validation/package.json +1 -1
  94. package/core/vite/dist/index.js +1 -1
  95. package/core/vite/package.json +1 -1
  96. package/core/whois/package.json +1 -1
  97. package/core/x-ray/package.json +1 -1
  98. package/core/zsh-buddy/package.json +1 -1
  99. package/ide/vscode/package.json +1 -1
  100. package/package.json +1 -1
@@ -515,20 +515,19 @@ export default <Model> {
515
515
  }
516
516
 
517
517
  // src/action.ts
518
- import {log as log7} from "@stacksjs/logging";
519
-
520
518
  class Action3 {
521
519
  name;
522
520
  description;
521
+ fields;
523
522
  rate;
524
523
  tries;
525
524
  backoff;
526
525
  enabled;
527
526
  handle;
528
- constructor({ name, description, handle, rate, tries, backoff, enabled }) {
529
- log7.info(`Action ${name} created`);
527
+ constructor({ name, description, fields, handle, rate, tries, backoff, enabled }) {
530
528
  this.name = name;
531
529
  this.description = description;
530
+ this.fields = fields;
532
531
  this.rate = rate;
533
532
  this.tries = tries;
534
533
  this.backoff = backoff;
@@ -517,20 +517,19 @@ export default <Model> {
517
517
  }
518
518
 
519
519
  // src/action.ts
520
- import {log as log7} from "@stacksjs/logging";
521
-
522
520
  class Action3 {
523
521
  name;
524
522
  description;
523
+ fields;
525
524
  rate;
526
525
  tries;
527
526
  backoff;
528
527
  enabled;
529
528
  handle;
530
- constructor({ name, description, handle, rate, tries, backoff, enabled }) {
531
- log7.info(`Action ${name} created`);
529
+ constructor({ name, description, fields, handle, rate, tries, backoff, enabled }) {
532
530
  this.name = name;
533
531
  this.description = description;
532
+ this.fields = fields;
534
533
  this.rate = rate;
535
534
  this.tries = tries;
536
535
  this.backoff = backoff;
@@ -541,7 +540,7 @@ class Action3 {
541
540
  // src/release.ts
542
541
  import {projectPath as projectPath4} from "@stacksjs/path";
543
542
  import {Action as Action4} from "@stacksjs/enums";
544
- import {log as log8} from "@stacksjs/logging";
543
+ import {log as log7} from "@stacksjs/logging";
545
544
  import {app} from "@stacksjs/config";
546
545
  await runActions([
547
546
  Action4.GenerateLibraryEntries,
@@ -551,4 +550,4 @@ await runActions([
551
550
  cwd: projectPath4(),
552
551
  stdin: "inherit"
553
552
  });
554
- log8.success(`Successfully released ${app.name}`);
553
+ log7.success(`Successfully released ${app.name}`);
@@ -43,13 +43,12 @@ function hasAction(action) {
43
43
  }
44
44
  // src/upgrade/index.ts
45
45
  import process from "process";
46
- import {ExitCode, parseArgs} from "@stacksjs/cli";
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 updateDependencies(options);
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.64";
10
+ var version = "0.58.66";
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.64",
4
+ "version": "0.58.66",
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,30 +1,48 @@
1
- import type { JobOptions } from '@stacksjs/types'
2
- import { log } from '@stacksjs/logging'
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
+ }
3
17
 
4
18
  interface ActionOptions {
5
19
  name?: string
6
20
  description?: string
7
- handle: () => Promise<any> | any
21
+ fields?: Record<FieldKey, FieldValue>
22
+ path?: string
8
23
  rate?: JobOptions['rate']
9
24
  tries?: JobOptions['tries']
10
25
  backoff?: JobOptions['backoff']
11
26
  enabled?: JobOptions['enabled']
27
+ handle: (request?: Request) => Promise<any> | object | string
12
28
  }
13
29
 
14
30
  export class Action {
15
31
  name?: string
16
32
  description?: string
33
+ fields?: Record<FieldKey, FieldValue>
17
34
  rate?: JobOptions['rate']
18
35
  tries?: JobOptions['tries']
19
36
  backoff?: JobOptions['backoff']
20
37
  enabled?: boolean
21
- handle: () => Promise<any>
38
+ handle: (request?: Request) => Promise<any> | object | string
22
39
 
23
- constructor({ name, description, handle, rate, tries, backoff, enabled }: ActionOptions) {
24
- log.info(`Action ${name} created`)
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
25
42
 
26
43
  this.name = name
27
44
  this.description = description
45
+ this.fields = fields
28
46
  this.rate = rate
29
47
  this.tries = tries
30
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 { ExitCode, parseArgs } from '@stacksjs/cli'
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
- await updateFramework(options)
10
+ // if (options?.framework || options?.all)
11
+ // await updateFramework(options)
11
12
 
12
13
  if (options?.dependencies || options?.all)
13
- await updateDependencies(options)
14
+ await runAction(Action.UpgradeDeps, options)
14
15
 
15
16
  if (options?.bun || options?.all)
16
17
  await runAction(Action.UpgradeBun, options)