stacks 0.58.63 → 0.58.64

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 (138) hide show
  1. package/core/actions/dist/src/database/seed.js +0 -3
  2. package/core/actions/dist/src/deploy/index.js +1 -1
  3. package/core/actions/dist/src/index.js +3 -0
  4. package/core/actions/dist/src/release.js +5 -2
  5. package/core/actions/dist/src/upgrade.js +1 -1
  6. package/core/actions/package.json +1 -1
  7. package/core/actions/src/action.ts +4 -1
  8. package/core/actions/src/copy-types.ts +1 -1
  9. package/core/actions/src/database/seed.ts +3 -3
  10. package/core/actions/src/deploy/index.ts +1 -1
  11. package/core/actions/src/helpers/utils.ts +2 -2
  12. package/core/ai/package.json +1 -1
  13. package/core/alias/package.json +1 -1
  14. package/core/analytics/package.json +1 -1
  15. package/core/api/package.json +1 -1
  16. package/core/arrays/package.json +1 -1
  17. package/core/arrays/src/helpers.ts +3 -3
  18. package/core/auth/package.json +1 -1
  19. package/core/buddy/dist/cli.js +1 -1
  20. package/core/buddy/package.json +1 -1
  21. package/core/buddy/src/cli.ts +1 -1
  22. package/core/build/package.json +1 -1
  23. package/core/bun-create/bud/package.json +1 -1
  24. package/core/bun-create/buddy/package.json +1 -1
  25. package/core/bun-create/stack/package.json +1 -1
  26. package/core/bun-create/stacks/package.json +1 -1
  27. package/core/bun-create/stx/package.json +1 -1
  28. package/core/bun-plugin-yaml/package.json +1 -1
  29. package/core/cache/package.json +1 -1
  30. package/core/cache/tests/DynamoDB.test.ts +125 -125
  31. package/core/cache/tests/Memcached.test.ts +51 -51
  32. package/core/cache/tests/Redis.test.ts +84 -84
  33. package/core/chat/package.json +1 -1
  34. package/core/cli/dist/index.js +1 -1
  35. package/core/cli/package.json +1 -1
  36. package/core/cli/src/exec.ts +2 -2
  37. package/core/cloud/dist/index.js +7 -7
  38. package/core/cloud/package.json +1 -1
  39. package/core/cloud/src/cloud/ai.ts +3 -3
  40. package/core/cloud/src/cloud/aws-sdk-layer/nodejs/package.json +1 -1
  41. package/core/cloud/src/cloud/cli.ts +1 -1
  42. package/core/cloud/src/cloud/deployment.ts +3 -3
  43. package/core/cloud/src/cloud/router-layer/nodejs/package.json +2 -2
  44. package/core/collections/package.json +1 -1
  45. package/core/config/dist/index.js +4 -0
  46. package/core/config/package.json +1 -1
  47. package/core/database/package.json +1 -1
  48. package/core/database/src/kysely-bun-worker/driver.ts +1 -1
  49. package/core/datetime/package.json +1 -1
  50. package/core/desktop/package.json +1 -1
  51. package/core/development/package.json +1 -1
  52. package/core/dns/package.json +1 -1
  53. package/core/docs/package.json +1 -1
  54. package/core/email/package.json +2 -2
  55. package/core/enums/package.json +1 -1
  56. package/core/env/package.json +1 -1
  57. package/core/error-handling/package.json +1 -1
  58. package/core/error-handling/src/handler.ts +1 -1
  59. package/core/eslint-config/package.json +1 -1
  60. package/core/events/package.json +1 -1
  61. package/core/faker/package.json +1 -1
  62. package/core/git/package.json +1 -1
  63. package/core/health/package.json +1 -1
  64. package/core/http/package.json +1 -1
  65. package/core/lint/package.json +1 -1
  66. package/core/logging/package.json +1 -1
  67. package/core/notifications/package.json +1 -1
  68. package/core/objects/package.json +1 -1
  69. package/core/orm/package.json +1 -1
  70. package/core/path/dist/index.js +30 -0
  71. package/core/path/package.json +1 -1
  72. package/core/path/src/index.ts +30 -0
  73. package/core/payments/package.json +1 -1
  74. package/core/push/package.json +1 -1
  75. package/core/query-builder/package.json +1 -1
  76. package/core/queue/package.json +1 -1
  77. package/core/raycast/package.json +1 -1
  78. package/core/realtime/package.json +1 -1
  79. package/core/repl/package.json +1 -1
  80. package/core/router/dist/index.js +40 -2
  81. package/core/router/package.json +1 -1
  82. package/core/router/src/router.ts +21 -1
  83. package/core/router/src/server.ts +0 -2
  84. package/core/scheduler/dist/index.js +1 -2
  85. package/core/scheduler/package.json +2 -1
  86. package/core/scheduler/src/index.ts +1 -1
  87. package/core/scheduler/src/job.ts +2 -2
  88. package/core/scheduler/src/schedule.ts +2 -2
  89. package/core/scheduler/tests/cron.test.ts +1243 -1243
  90. package/core/scheduler/tests/crontime.test.ts +780 -778
  91. package/core/search-engine/dist/index.js +1 -3
  92. package/core/search-engine/package.json +1 -1
  93. package/core/search-engine/src/index.ts +5 -5
  94. package/core/security/package.json +1 -1
  95. package/core/server/package.json +1 -1
  96. package/core/signals/package.json +1 -1
  97. package/core/slug/package.json +1 -1
  98. package/core/sms/package.json +1 -1
  99. package/core/storage/dist/index.js +0 -1
  100. package/core/storage/package.json +1 -1
  101. package/core/storage/src/files.ts +2 -5
  102. package/core/storage/src/hash.ts +0 -2
  103. package/core/strings/package.json +1 -1
  104. package/core/tables/package.json +1 -1
  105. package/core/testing/dist/index.js +14978 -1
  106. package/core/testing/package.json +1 -1
  107. package/core/testing/src/index.ts +12 -2
  108. package/core/tinker/package.json +1 -1
  109. package/core/tunnel/package.json +1 -1
  110. package/core/types/package.json +1 -1
  111. package/core/types/src/cli.ts +1 -1
  112. package/core/types/src/cron-jobs.ts +0 -5
  113. package/core/types/src/errors.ts +1 -1
  114. package/core/types/src/router.ts +7 -5
  115. package/core/ui/package.json +1 -1
  116. package/core/utils/dist/index.js +4 -8
  117. package/core/utils/package.json +1 -1
  118. package/core/utils/scripts/export-size.ts +3 -3
  119. package/core/utils/src/base.ts +4 -4
  120. package/core/utils/src/helpers.ts +3 -3
  121. package/core/utils/src/retry.ts +2 -2
  122. package/core/validation/package.json +1 -1
  123. package/core/vite/dist/index.js +1 -1
  124. package/core/vite/package.json +1 -1
  125. package/core/vite/src/functions.ts +0 -1
  126. package/core/vite/src/index.ts +1 -1
  127. package/core/vite/src/plugin/docs.ts +2 -0
  128. package/core/vite/src/plugin/stacks.ts +3 -2
  129. package/core/vite/src/web-components.ts +2 -2
  130. package/core/whois/package.json +1 -1
  131. package/core/whois/src/index.ts +2 -2
  132. package/core/x-ray/package.json +1 -1
  133. package/core/zsh-buddy/package.json +1 -1
  134. package/ide/vscode/package.json +1 -1
  135. package/package.json +1 -1
  136. package/core/actions/src/database/mydb.sqlite +0 -0
  137. package/core/actions/src/database/stacks.sqlite +0 -0
  138. package/core/server/src/api.ts +0 -5
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/faker",
3
3
  "type": "module",
4
- "version": "0.58.63",
4
+ "version": "0.58.64",
5
5
  "description": "Faker functions.",
6
6
  "author": "Chris Breuer",
7
7
  "license": "MIT",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/git",
3
3
  "type": "module",
4
- "version": "0.58.63",
4
+ "version": "0.58.64",
5
5
  "description": "The Stacks git utilities & conventions.",
6
6
  "author": "Chris Breuer",
7
7
  "license": "MIT",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/health",
3
3
  "type": "module",
4
- "version": "0.58.63",
4
+ "version": "0.58.64",
5
5
  "description": "The Stacks Health services.",
6
6
  "author": "Chris Breuer",
7
7
  "license": "MIT",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/http",
3
3
  "type": "module",
4
- "version": "0.58.63",
4
+ "version": "0.58.64",
5
5
  "description": "Stacks HTTP methods.",
6
6
  "author": "Chris Breuer",
7
7
  "license": "MIT",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/lint",
3
3
  "type": "module",
4
- "version": "0.58.63",
4
+ "version": "0.58.64",
5
5
  "description": "The Stacks way to lint.",
6
6
  "author": "Chris Breuer",
7
7
  "license": "MIT",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/logging",
3
3
  "type": "module",
4
- "version": "0.58.63",
4
+ "version": "0.58.64",
5
5
  "description": "The Stacks logging system.",
6
6
  "author": "Chris Breuer",
7
7
  "license": "MIT",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/notifications",
3
3
  "type": "module",
4
- "version": "0.58.63",
4
+ "version": "0.58.64",
5
5
  "description": "The Stacks notifications integration.",
6
6
  "author": "Chris Breuer",
7
7
  "license": "MIT",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/objects",
3
3
  "type": "module",
4
- "version": "0.58.63",
4
+ "version": "0.58.64",
5
5
  "description": "The Stacks objects.",
6
6
  "author": "Chris Breuer",
7
7
  "license": "MIT",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/orm",
3
3
  "type": "module",
4
- "version": "0.58.63",
4
+ "version": "0.58.64",
5
5
  "description": "The Stacks ORM integration",
6
6
  "author": "Chris Breuer",
7
7
  "license": "MIT",
@@ -11,6 +11,24 @@ function relativeActionsPath(path) {
11
11
  function userActionsPath(path) {
12
12
  return appPath(`Actions/${path || ""}`);
13
13
  }
14
+ function userJobsPath(path) {
15
+ return appPath(`Jobs/${path || ""}`);
16
+ }
17
+ function userListenersPath(path) {
18
+ return appPath(`Listeners/${path || ""}`);
19
+ }
20
+ function userMiddlewarePath(path) {
21
+ return appPath(`Middleware/${path || ""}`);
22
+ }
23
+ function userModelsPath(path) {
24
+ return appPath(`Models/${path || ""}`);
25
+ }
26
+ function userNotificationsPath(path) {
27
+ return appPath(`Notifications/${path || ""}`);
28
+ }
29
+ function userEventsPath() {
30
+ return appPath(`Events.ts`);
31
+ }
14
32
  function aiPath(path) {
15
33
  return corePath(`ai/${path || ""}`);
16
34
  }
@@ -404,6 +422,12 @@ var path = {
404
422
  tinkerPath,
405
423
  typesPath,
406
424
  uiPath,
425
+ userEventsPath,
426
+ userJobsPath,
427
+ userListenersPath,
428
+ userMiddlewarePath,
429
+ userModelsPath,
430
+ userNotificationsPath,
407
431
  utilsPath,
408
432
  validationPath,
409
433
  vitePath,
@@ -429,6 +453,12 @@ export {
429
453
  viewsPath,
430
454
  validationPath,
431
455
  utilsPath,
456
+ userNotificationsPath,
457
+ userModelsPath,
458
+ userMiddlewarePath,
459
+ userListenersPath,
460
+ userJobsPath,
461
+ userEventsPath,
432
462
  userActionsPath,
433
463
  uiPath,
434
464
  typesPath,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/path",
3
3
  "type": "module",
4
- "version": "0.58.63",
4
+ "version": "0.58.64",
5
5
  "description": "The Stacks path.",
6
6
  "author": "Chris Breuer",
7
7
  "license": "MIT",
@@ -27,6 +27,30 @@ export function userActionsPath(path?: string) {
27
27
  return appPath(`Actions/${path || ''}`)
28
28
  }
29
29
 
30
+ export function userJobsPath(path?: string) {
31
+ return appPath(`Jobs/${path || ''}`)
32
+ }
33
+
34
+ export function userListenersPath(path?: string) {
35
+ return appPath(`Listeners/${path || ''}`)
36
+ }
37
+
38
+ export function userMiddlewarePath(path?: string) {
39
+ return appPath(`Middleware/${path || ''}`)
40
+ }
41
+
42
+ export function userModelsPath(path?: string) {
43
+ return appPath(`Models/${path || ''}`)
44
+ }
45
+
46
+ export function userNotificationsPath(path?: string) {
47
+ return appPath(`Notifications/${path || ''}`)
48
+ }
49
+
50
+ export function userEventsPath() {
51
+ return appPath(`Events.ts`)
52
+ }
53
+
30
54
  /**
31
55
  * Returns the path to the `ai` directory. The AI directory
32
56
  * contains the core Stacks' AI logic which currently
@@ -554,6 +578,12 @@ export const path = {
554
578
  tinkerPath,
555
579
  typesPath,
556
580
  uiPath,
581
+ userEventsPath,
582
+ userJobsPath,
583
+ userListenersPath,
584
+ userMiddlewarePath,
585
+ userModelsPath,
586
+ userNotificationsPath,
557
587
  utilsPath,
558
588
  validationPath,
559
589
  vitePath,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/payments",
3
3
  "type": "module",
4
- "version": "0.58.63",
4
+ "version": "0.58.64",
5
5
  "description": "The Stacks payments package. Currently supporting Stripe.",
6
6
  "author": "Chris Breuer",
7
7
  "license": "MIT",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/push",
3
3
  "type": "module",
4
- "version": "0.58.63",
4
+ "version": "0.58.64",
5
5
  "description": "The Stacks Push integration",
6
6
  "author": "Chris Breuer",
7
7
  "license": "MIT",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/query-builder",
3
3
  "type": "module",
4
- "version": "0.58.63",
4
+ "version": "0.58.64",
5
5
  "description": "The Stacks Query Builder integration",
6
6
  "author": "Chris Breuer",
7
7
  "license": "MIT",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/queue",
3
3
  "type": "module",
4
- "version": "0.58.63",
4
+ "version": "0.58.64",
5
5
  "description": "The Stacks Queue system.",
6
6
  "author": "Chris Breuer",
7
7
  "license": "MIT",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "stacks-raycast",
3
3
  "type": "module",
4
- "version": "0.58.63",
4
+ "version": "0.58.64",
5
5
  "description": "The Stacks Raycast plugin.",
6
6
  "scripts": {
7
7
  "build": "echo 'No build step required yet.'"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/realtime",
3
3
  "type": "module",
4
- "version": "0.58.63",
4
+ "version": "0.58.64",
5
5
  "description": "The Stacks realtime integration.",
6
6
  "author": "Chris Breuer",
7
7
  "license": "MIT",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/repl",
3
3
  "type": "module",
4
- "version": "0.58.63",
4
+ "version": "0.58.64",
5
5
  "description": "A Stacks optimized TS & Vue REPL.",
6
6
  "author": "Chris Breuer",
7
7
  "license": "MIT",
@@ -213,6 +213,24 @@ function relativeActionsPath(path2) {
213
213
  function userActionsPath(path2) {
214
214
  return appPath(`Actions/${path2 || ""}`);
215
215
  }
216
+ function userJobsPath(path2) {
217
+ return appPath(`Jobs/${path2 || ""}`);
218
+ }
219
+ function userListenersPath(path2) {
220
+ return appPath(`Listeners/${path2 || ""}`);
221
+ }
222
+ function userMiddlewarePath(path2) {
223
+ return appPath(`Middleware/${path2 || ""}`);
224
+ }
225
+ function userModelsPath(path2) {
226
+ return appPath(`Models/${path2 || ""}`);
227
+ }
228
+ function userNotificationsPath(path2) {
229
+ return appPath(`Notifications/${path2 || ""}`);
230
+ }
231
+ function userEventsPath() {
232
+ return appPath(`Events.ts`);
233
+ }
216
234
  function aiPath(path2) {
217
235
  return corePath(`ai/${path2 || ""}`);
218
236
  }
@@ -597,6 +615,12 @@ var path2 = {
597
615
  tinkerPath,
598
616
  typesPath,
599
617
  uiPath,
618
+ userEventsPath,
619
+ userJobsPath,
620
+ userListenersPath,
621
+ userMiddlewarePath,
622
+ userModelsPath,
623
+ userNotificationsPath,
600
624
  utilsPath,
601
625
  validationPath,
602
626
  vitePath,
@@ -673,7 +697,6 @@ async function serve(options = {}) {
673
697
  hostname,
674
698
  port,
675
699
  fetch(req) {
676
- console.log(req);
677
700
  return serverResponse(req);
678
701
  }
679
702
  });
@@ -789,13 +812,28 @@ class Router {
789
812
  });
790
813
  }
791
814
  async get(path5, callback) {
792
- if (typeof callback === "string") {
815
+ if (callback instanceof Promise) {
816
+ const actionModule = await callback;
817
+ callback = actionModule.default;
818
+ } else if (typeof callback === "string") {
793
819
  const actionModule = await import(path2.userActionsPath(`${callback}.ts`));
794
820
  callback = actionModule.default.handle;
795
821
  }
796
822
  this.addRoute("GET", path5, callback, 200);
797
823
  return this;
798
824
  }
825
+ async health() {
826
+ const healthModule = await import(path2.userActionsPath("HealthAction.ts"));
827
+ const callback = healthModule.default.handle;
828
+ this.addRoute("GET", "/api/healthy", callback, 200);
829
+ return this;
830
+ }
831
+ async job(path5) {
832
+ const jobModule = await import(path2.userJobsPath("ExampleJob.ts"));
833
+ const callback = jobModule.default.handle;
834
+ this.addRoute("GET", path5, callback, 200);
835
+ return this;
836
+ }
799
837
  post(path5, callback) {
800
838
  this.addRoute("POST", path5, callback, 201);
801
839
  return this;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/router",
3
3
  "type": "module",
4
- "version": "0.58.63",
4
+ "version": "0.58.64",
5
5
  "description": "The Stacks framework router.",
6
6
  "author": "Chris Breuer",
7
7
  "license": "MIT",
@@ -48,7 +48,11 @@ export class Router implements RouterInterface {
48
48
 
49
49
  public async get(path: Route['url'], callback: Route['callback']): Promise<this> {
50
50
  // check if callback is a string and if it is, then import that module path and use the default.handle function as the callback
51
- if (typeof callback === 'string') {
51
+ if (callback instanceof Promise) {
52
+ const actionModule = await callback
53
+ callback = actionModule.default
54
+ }
55
+ else if (typeof callback === 'string') {
52
56
  // import the module and use the default.handle function as the callback
53
57
  const actionModule = await import(p.userActionsPath(`${callback}.ts`))
54
58
  callback = actionModule.default.handle
@@ -58,6 +62,22 @@ export class Router implements RouterInterface {
58
62
  return this
59
63
  }
60
64
 
65
+ public async health(): Promise<this> {
66
+ const healthModule = await import(p.userActionsPath('HealthAction.ts'))
67
+ const callback = healthModule.default.handle
68
+
69
+ this.addRoute('GET', '/api/healthy', callback, 200)
70
+ return this
71
+ }
72
+
73
+ public async job(path: Route['url']): Promise<this> {
74
+ const jobModule = await import(p.userJobsPath('ExampleJob.ts'))
75
+ const callback = jobModule.default.handle
76
+
77
+ this.addRoute('GET', path, callback, 200)
78
+ return this
79
+ }
80
+
61
81
  public post(path: Route['url'], callback: Route['callback']): this {
62
82
  this.addRoute('POST', path, callback, 201)
63
83
  return this
@@ -21,8 +21,6 @@ export async function serve(options: ServeOptions = {}) {
21
21
  port,
22
22
 
23
23
  fetch(req: Request) {
24
- // eslint-disable-next-line no-console
25
- console.log(req)
26
24
  return serverResponse(req)
27
25
  },
28
26
  })
@@ -508,7 +508,6 @@ class Schedule {
508
508
  cronPattern = "";
509
509
  timezone = "America/Los_Angeles";
510
510
  task;
511
- cmd;
512
511
  constructor(task) {
513
512
  this.task = task;
514
513
  }
@@ -739,5 +738,5 @@ export {
739
738
  src_default as default,
740
739
  Schedule,
741
740
  CronTime,
742
- CronJob2 as CronJob
741
+ CronJob2 as BunCronJob
743
742
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/scheduler",
3
3
  "type": "module",
4
- "version": "0.58.63",
4
+ "version": "0.58.64",
5
5
  "description": "The Stacks scheduler.",
6
6
  "author": "Chris Breuer",
7
7
  "license": "MIT",
@@ -56,6 +56,7 @@
56
56
  "devDependencies": {
57
57
  "@fast-check/jest": "^1.8.0",
58
58
  "@stacksjs/development": "workspace:*",
59
+ "@types/sinon": "^17.0.3",
59
60
  "sinon": "^17.0.1"
60
61
  }
61
62
  }
@@ -1,6 +1,6 @@
1
1
  import { Schedule } from './schedule'
2
2
 
3
- export { CronJob } from './job'
3
+ export { CronJob as BunCronJob } from './job'
4
4
  export { CronTime } from './time'
5
5
 
6
6
  export type {
@@ -233,8 +233,8 @@ export class CronJob<OC extends CronOnCompleteCommand | null = null, C = null> {
233
233
  startTime = Date.now()
234
234
  // eslint-disable-next-line ts/no-use-before-define
235
235
  this._timeout = setTimeout(callbackWrapper, t)
236
- if (this.unrefTimeout && typeof this._timeout.unref === 'function')
237
- this._timeout.unref()
236
+ if (this.unrefTimeout && typeof this._timeout!.unref === 'function')
237
+ this._timeout!.unref()
238
238
  }
239
239
 
240
240
  // The callback wrapper checks if it needs to sleep another period or not
@@ -6,8 +6,8 @@ import { CronTime } from './time'
6
6
  export class Schedule {
7
7
  private cronPattern: string = ''
8
8
  private timezone: string = 'America/Los_Angeles'
9
- private task: () => void
10
- private cmd?: string
9
+ private readonly task: () => void
10
+ // private cmd?: string
11
11
 
12
12
  constructor(task: () => void) {
13
13
  this.task = task