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.
- package/core/actions/dist/src/database/seed.js +0 -3
- package/core/actions/dist/src/deploy/index.js +1 -1
- package/core/actions/dist/src/index.js +3 -0
- package/core/actions/dist/src/release.js +5 -2
- package/core/actions/dist/src/upgrade.js +1 -1
- package/core/actions/package.json +1 -1
- package/core/actions/src/action.ts +4 -1
- package/core/actions/src/copy-types.ts +1 -1
- package/core/actions/src/database/seed.ts +3 -3
- package/core/actions/src/deploy/index.ts +1 -1
- package/core/actions/src/helpers/utils.ts +2 -2
- package/core/ai/package.json +1 -1
- 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 +3 -3
- package/core/auth/package.json +1 -1
- package/core/buddy/dist/cli.js +1 -1
- package/core/buddy/package.json +1 -1
- package/core/buddy/src/cli.ts +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 +1 -1
- package/core/cache/tests/DynamoDB.test.ts +125 -125
- package/core/cache/tests/Memcached.test.ts +51 -51
- package/core/cache/tests/Redis.test.ts +84 -84
- package/core/chat/package.json +1 -1
- package/core/cli/dist/index.js +1 -1
- package/core/cli/package.json +1 -1
- package/core/cli/src/exec.ts +2 -2
- package/core/cloud/dist/index.js +7 -7
- package/core/cloud/package.json +1 -1
- package/core/cloud/src/cloud/ai.ts +3 -3
- package/core/cloud/src/cloud/aws-sdk-layer/nodejs/package.json +1 -1
- package/core/cloud/src/cloud/cli.ts +1 -1
- package/core/cloud/src/cloud/deployment.ts +3 -3
- 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 +4 -0
- package/core/config/package.json +1 -1
- package/core/database/package.json +1 -1
- package/core/database/src/kysely-bun-worker/driver.ts +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 +1 -1
- package/core/docs/package.json +1 -1
- package/core/email/package.json +2 -2
- package/core/enums/package.json +1 -1
- package/core/env/package.json +1 -1
- package/core/error-handling/package.json +1 -1
- package/core/error-handling/src/handler.ts +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/dist/index.js +30 -0
- package/core/path/package.json +1 -1
- package/core/path/src/index.ts +30 -0
- 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/dist/index.js +40 -2
- package/core/router/package.json +1 -1
- package/core/router/src/router.ts +21 -1
- package/core/router/src/server.ts +0 -2
- package/core/scheduler/dist/index.js +1 -2
- package/core/scheduler/package.json +2 -1
- package/core/scheduler/src/index.ts +1 -1
- package/core/scheduler/src/job.ts +2 -2
- package/core/scheduler/src/schedule.ts +2 -2
- package/core/scheduler/tests/cron.test.ts +1243 -1243
- package/core/scheduler/tests/crontime.test.ts +780 -778
- package/core/search-engine/dist/index.js +1 -3
- package/core/search-engine/package.json +1 -1
- package/core/search-engine/src/index.ts +5 -5
- 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/dist/index.js +0 -1
- package/core/storage/package.json +1 -1
- package/core/storage/src/files.ts +2 -5
- package/core/storage/src/hash.ts +0 -2
- package/core/strings/package.json +1 -1
- package/core/tables/package.json +1 -1
- package/core/testing/dist/index.js +14978 -1
- package/core/testing/package.json +1 -1
- package/core/testing/src/index.ts +12 -2
- 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/cli.ts +1 -1
- package/core/types/src/cron-jobs.ts +0 -5
- package/core/types/src/errors.ts +1 -1
- package/core/types/src/router.ts +7 -5
- package/core/ui/package.json +1 -1
- package/core/utils/dist/index.js +4 -8
- package/core/utils/package.json +1 -1
- package/core/utils/scripts/export-size.ts +3 -3
- package/core/utils/src/base.ts +4 -4
- package/core/utils/src/helpers.ts +3 -3
- package/core/utils/src/retry.ts +2 -2
- package/core/validation/package.json +1 -1
- package/core/vite/dist/index.js +1 -1
- package/core/vite/package.json +1 -1
- package/core/vite/src/functions.ts +0 -1
- package/core/vite/src/index.ts +1 -1
- package/core/vite/src/plugin/docs.ts +2 -0
- package/core/vite/src/plugin/stacks.ts +3 -2
- package/core/vite/src/web-components.ts +2 -2
- package/core/whois/package.json +1 -1
- package/core/whois/src/index.ts +2 -2
- 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
- package/core/actions/src/database/mydb.sqlite +0 -0
- package/core/actions/src/database/stacks.sqlite +0 -0
- package/core/server/src/api.ts +0 -5
package/core/faker/package.json
CHANGED
package/core/git/package.json
CHANGED
package/core/health/package.json
CHANGED
package/core/http/package.json
CHANGED
package/core/lint/package.json
CHANGED
package/core/orm/package.json
CHANGED
package/core/path/dist/index.js
CHANGED
|
@@ -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,
|
package/core/path/package.json
CHANGED
package/core/path/src/index.ts
CHANGED
|
@@ -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,
|
package/core/push/package.json
CHANGED
package/core/queue/package.json
CHANGED
package/core/repl/package.json
CHANGED
|
@@ -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 (
|
|
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;
|
package/core/router/package.json
CHANGED
|
@@ -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 (
|
|
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
|
|
@@ -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
|
|
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.
|
|
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
|
}
|
|
@@ -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
|
|
237
|
-
this._timeout
|
|
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
|