stacks 0.58.62 → 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 +35 -0
- package/core/path/package.json +1 -1
- package/core/path/src/index.ts +35 -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 +45 -3
- package/core/router/package.json +1 -1
- package/core/router/src/router.ts +22 -2
- 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
|
@@ -8,6 +8,27 @@ function actionsPath(path) {
|
|
|
8
8
|
function relativeActionsPath(path) {
|
|
9
9
|
return relative(projectPath(), actionsPath(path));
|
|
10
10
|
}
|
|
11
|
+
function userActionsPath(path) {
|
|
12
|
+
return appPath(`Actions/${path || ""}`);
|
|
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
|
+
}
|
|
11
32
|
function aiPath(path) {
|
|
12
33
|
return corePath(`ai/${path || ""}`);
|
|
13
34
|
}
|
|
@@ -311,6 +332,7 @@ function xRayPath(path) {
|
|
|
311
332
|
}
|
|
312
333
|
var path = {
|
|
313
334
|
actionsPath,
|
|
335
|
+
userActionsPath,
|
|
314
336
|
aiPath,
|
|
315
337
|
assetsPath,
|
|
316
338
|
relativeActionsPath,
|
|
@@ -400,6 +422,12 @@ var path = {
|
|
|
400
422
|
tinkerPath,
|
|
401
423
|
typesPath,
|
|
402
424
|
uiPath,
|
|
425
|
+
userEventsPath,
|
|
426
|
+
userJobsPath,
|
|
427
|
+
userListenersPath,
|
|
428
|
+
userMiddlewarePath,
|
|
429
|
+
userModelsPath,
|
|
430
|
+
userNotificationsPath,
|
|
403
431
|
utilsPath,
|
|
404
432
|
validationPath,
|
|
405
433
|
vitePath,
|
|
@@ -425,6 +453,13 @@ export {
|
|
|
425
453
|
viewsPath,
|
|
426
454
|
validationPath,
|
|
427
455
|
utilsPath,
|
|
456
|
+
userNotificationsPath,
|
|
457
|
+
userModelsPath,
|
|
458
|
+
userMiddlewarePath,
|
|
459
|
+
userListenersPath,
|
|
460
|
+
userJobsPath,
|
|
461
|
+
userEventsPath,
|
|
462
|
+
userActionsPath,
|
|
428
463
|
uiPath,
|
|
429
464
|
typesPath,
|
|
430
465
|
toNamespacedPath,
|
package/core/path/package.json
CHANGED
package/core/path/src/index.ts
CHANGED
|
@@ -23,6 +23,34 @@ export function relativeActionsPath(path?: string) {
|
|
|
23
23
|
return relative(projectPath(), actionsPath(path))
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
export function userActionsPath(path?: string) {
|
|
27
|
+
return appPath(`Actions/${path || ''}`)
|
|
28
|
+
}
|
|
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
|
+
|
|
26
54
|
/**
|
|
27
55
|
* Returns the path to the `ai` directory. The AI directory
|
|
28
56
|
* contains the core Stacks' AI logic which currently
|
|
@@ -460,6 +488,7 @@ export function xRayPath(path?: string) {
|
|
|
460
488
|
|
|
461
489
|
export const path = {
|
|
462
490
|
actionsPath,
|
|
491
|
+
userActionsPath,
|
|
463
492
|
aiPath,
|
|
464
493
|
assetsPath,
|
|
465
494
|
relativeActionsPath,
|
|
@@ -549,6 +578,12 @@ export const path = {
|
|
|
549
578
|
tinkerPath,
|
|
550
579
|
typesPath,
|
|
551
580
|
uiPath,
|
|
581
|
+
userEventsPath,
|
|
582
|
+
userJobsPath,
|
|
583
|
+
userListenersPath,
|
|
584
|
+
userMiddlewarePath,
|
|
585
|
+
userModelsPath,
|
|
586
|
+
userNotificationsPath,
|
|
552
587
|
utilsPath,
|
|
553
588
|
validationPath,
|
|
554
589
|
vitePath,
|
package/core/push/package.json
CHANGED
package/core/queue/package.json
CHANGED
package/core/repl/package.json
CHANGED
|
@@ -210,6 +210,27 @@ function actionsPath(path2) {
|
|
|
210
210
|
function relativeActionsPath(path2) {
|
|
211
211
|
return relative(projectPath(), actionsPath(path2));
|
|
212
212
|
}
|
|
213
|
+
function userActionsPath(path2) {
|
|
214
|
+
return appPath(`Actions/${path2 || ""}`);
|
|
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
|
+
}
|
|
213
234
|
function aiPath(path2) {
|
|
214
235
|
return corePath(`ai/${path2 || ""}`);
|
|
215
236
|
}
|
|
@@ -504,6 +525,7 @@ function xRayPath(path2) {
|
|
|
504
525
|
}
|
|
505
526
|
var path2 = {
|
|
506
527
|
actionsPath,
|
|
528
|
+
userActionsPath,
|
|
507
529
|
aiPath,
|
|
508
530
|
assetsPath,
|
|
509
531
|
relativeActionsPath,
|
|
@@ -593,6 +615,12 @@ var path2 = {
|
|
|
593
615
|
tinkerPath,
|
|
594
616
|
typesPath,
|
|
595
617
|
uiPath,
|
|
618
|
+
userEventsPath,
|
|
619
|
+
userJobsPath,
|
|
620
|
+
userListenersPath,
|
|
621
|
+
userMiddlewarePath,
|
|
622
|
+
userModelsPath,
|
|
623
|
+
userNotificationsPath,
|
|
596
624
|
utilsPath,
|
|
597
625
|
validationPath,
|
|
598
626
|
vitePath,
|
|
@@ -669,7 +697,6 @@ async function serve(options = {}) {
|
|
|
669
697
|
hostname,
|
|
670
698
|
port,
|
|
671
699
|
fetch(req) {
|
|
672
|
-
console.log(req);
|
|
673
700
|
return serverResponse(req);
|
|
674
701
|
}
|
|
675
702
|
});
|
|
@@ -785,13 +812,28 @@ class Router {
|
|
|
785
812
|
});
|
|
786
813
|
}
|
|
787
814
|
async get(path5, callback) {
|
|
788
|
-
if (
|
|
789
|
-
const actionModule = await
|
|
815
|
+
if (callback instanceof Promise) {
|
|
816
|
+
const actionModule = await callback;
|
|
817
|
+
callback = actionModule.default;
|
|
818
|
+
} else if (typeof callback === "string") {
|
|
819
|
+
const actionModule = await import(path2.userActionsPath(`${callback}.ts`));
|
|
790
820
|
callback = actionModule.default.handle;
|
|
791
821
|
}
|
|
792
822
|
this.addRoute("GET", path5, callback, 200);
|
|
793
823
|
return this;
|
|
794
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
|
+
}
|
|
795
837
|
post(path5, callback) {
|
|
796
838
|
this.addRoute("POST", path5, callback, 201);
|
|
797
839
|
return this;
|
package/core/router/package.json
CHANGED
|
@@ -48,9 +48,13 @@ 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
|
-
const actionModule = await import(p.
|
|
57
|
+
const actionModule = await import(p.userActionsPath(`${callback}.ts`))
|
|
54
58
|
callback = actionModule.default.handle
|
|
55
59
|
}
|
|
56
60
|
|
|
@@ -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
|