@guren/server 2.14.0 → 2.16.0
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/dist/{DocsViewerServiceProvider-qFCaeiUv.js → DocsViewerServiceProvider-D2cuVgtN.js} +7 -12
- package/dist/{Hash-CzrwKeDp.js → Hash-D2DFd8xX.js} +12 -57
- package/dist/{HttpException-BkS3euNG.js → HttpException-BlQ2yEmT.js} +2 -79
- package/dist/{Job-BVT813DO.js → Job-DxQK8h3P.js} +24 -179
- package/dist/{McpServiceProvider-BawsYjgN.js → McpServiceProvider-nNcbCIQX.js} +11 -20
- package/dist/{Random-DbIJ22KQ.js → Random-S0OvCuR8.js} +9 -106
- package/dist/agent/AgentApprovalRequested.d.ts +31 -0
- package/dist/agent/approval.d.ts +184 -0
- package/dist/agent/audit-emitter.d.ts +36 -0
- package/dist/agent/audit.d.ts +67 -0
- package/dist/agent/derive.d.ts +32 -66
- package/dist/agent/dispatch.d.ts +53 -63
- package/dist/agent/events.d.ts +11 -19
- package/dist/agent/meta-tools.d.ts +34 -0
- package/dist/agent/public.d.ts +14 -0
- package/dist/agent/public.js +2 -0
- package/dist/agent/redact.d.ts +16 -38
- package/dist/agent/scopes.d.ts +23 -69
- package/dist/auth/AuthManager.d.ts +19 -40
- package/dist/auth/AuthenticatableModel.d.ts +2 -2
- package/dist/auth/SessionGuard.d.ts +0 -1
- package/dist/auth/TokenGuard.d.ts +6 -26
- package/dist/auth/api-token.d.ts +16 -148
- package/dist/auth/context.d.ts +5 -10
- package/dist/auth/email-verification.d.ts +29 -127
- package/dist/auth/index.js +1 -1
- package/dist/auth/oauth/index.d.ts +35 -57
- package/dist/auth/password/DefaultHasher.d.ts +9 -5
- package/dist/auth/password/PasswordHasher.d.ts +7 -0
- package/dist/auth/password/hash-format.d.ts +11 -0
- package/dist/auth/password-reset.d.ts +16 -42
- package/dist/auth/providers/ModelUserProvider.d.ts +3 -4
- package/dist/auth/providers/UserProvider.d.ts +4 -4
- package/dist/auth/signed-token.d.ts +18 -0
- package/dist/auth/types.d.ts +9 -32
- package/dist/auth/utils.d.ts +6 -27
- package/dist/{auth-BSUc14CD.js → auth-CbdPH4Cd.js} +252 -496
- package/dist/authorization/Gate.d.ts +9 -145
- package/dist/authorization/Policy.d.ts +6 -53
- package/dist/authorization/index.js +1 -1
- package/dist/authorization/middleware.d.ts +16 -62
- package/dist/authorization/types.d.ts +8 -64
- package/dist/{authorization-CdfbCj8J.js → authorization-CdEWZZw3.js} +44 -309
- package/dist/broadcasting/BroadcastManager.d.ts +29 -149
- package/dist/broadcasting/channels/Channel.d.ts +1 -19
- package/dist/broadcasting/channels/PresenceChannel.d.ts +1 -55
- package/dist/broadcasting/channels/PrivateChannel.d.ts +1 -23
- package/dist/broadcasting/drivers/MemoryDriver.d.ts +18 -70
- package/dist/broadcasting/drivers/RedisDriver.d.ts +3 -80
- package/dist/broadcasting/drivers/index.d.ts +1 -1
- package/dist/broadcasting/index.d.ts +1 -1
- package/dist/broadcasting/index.js +1 -1
- package/dist/broadcasting/types.d.ts +7 -88
- package/dist/{broadcasting-BxU-LIfF.js → broadcasting-B5RzB0A2.js} +87 -414
- package/dist/cache/CacheManager.d.ts +8 -62
- package/dist/cache/TaggedCache.d.ts +2 -35
- package/dist/cache/index.js +1 -1
- package/dist/cache/stores/FileStore.d.ts +2 -36
- package/dist/cache/stores/MemoryStore.d.ts +2 -26
- package/dist/cache/stores/RedisStore.d.ts +1 -29
- package/dist/cache/types.d.ts +21 -128
- package/dist/{cache-BYnZf2FR.js → cache-BOOIr324.js} +19 -198
- package/dist/client-C4TEr_Dd.js +9 -0
- package/dist/console/Command.d.ts +17 -126
- package/dist/console/ConsoleKernel.d.ts +2 -74
- package/dist/console/Input.d.ts +5 -113
- package/dist/console/Output.d.ts +3 -99
- package/dist/console/types.d.ts +3 -33
- package/dist/container/Container.d.ts +12 -103
- package/dist/container/ServiceProvider.d.ts +17 -61
- package/dist/container/bindings.d.ts +10 -12
- package/dist/container/defineModule.d.ts +16 -54
- package/dist/container/definePlugin.d.ts +12 -45
- package/dist/container/types.d.ts +2 -34
- package/dist/context-CXk_umpT.js +21 -0
- package/dist/database/Factory.d.ts +4 -57
- package/dist/database/Seeder.d.ts +8 -46
- package/dist/database/SeederRunner.d.ts +3 -33
- package/dist/database/types.d.ts +3 -24
- package/dist/discovery/AutoDiscovery.d.ts +10 -82
- package/dist/dispatch-BAwzftws.js +238 -0
- package/dist/docs-viewer/DocsViewerServiceProvider.d.ts +2 -5
- package/dist/docs-viewer/endpoint.d.ts +5 -11
- package/dist/encryption/Encrypter.d.ts +5 -71
- package/dist/encryption/Hash.d.ts +7 -57
- package/dist/encryption/Random.d.ts +6 -99
- package/dist/encryption/index.js +3 -3
- package/dist/encryption/types.d.ts +10 -72
- package/dist/{encryption-DJtkkhiw.js → encryption-uwP3Di4D.js} +13 -79
- package/dist/{endpoint-D6GIqOpe.js → endpoint-BXipU2Jj.js} +6 -12
- package/dist/endpoint-Dsw3Acvq.js +26 -0
- package/dist/errors/ExceptionHandler.d.ts +3 -90
- package/dist/errors/HttpException.d.ts +2 -79
- package/dist/errors/debug-page.d.ts +3 -17
- package/dist/errors/error-page.d.ts +1 -0
- package/dist/errors/exceptions/AuthenticationException.d.ts +2 -24
- package/dist/errors/exceptions/AuthorizationException.d.ts +1 -24
- package/dist/errors/exceptions/MethodNotAllowedException.d.ts +1 -23
- package/dist/errors/exceptions/NotFoundHttpException.d.ts +1 -27
- package/dist/errors/exceptions/ValidationException.d.ts +2 -43
- package/dist/errors/types.d.ts +1 -25
- package/dist/{errors-BgeOl_DC.js → errors-JpkcCjjn.js} +3 -41
- package/dist/events/Event.d.ts +1 -28
- package/dist/events/EventManager.d.ts +5 -107
- package/dist/events/Listener.d.ts +7 -55
- package/dist/events/builtin.d.ts +0 -24
- package/dist/events/index.js +1 -1
- package/dist/events/types.d.ts +4 -22
- package/dist/{events-aIH_bWRx.js → events-DOmAHDeP.js} +11 -191
- package/dist/facades/index.d.ts +2 -14
- package/dist/health/HealthCheck.d.ts +0 -24
- package/dist/health/HealthManager.d.ts +0 -36
- package/dist/health/checks/CacheCheck.d.ts +2 -17
- package/dist/health/checks/CustomCheck.d.ts +0 -9
- package/dist/health/checks/DatabaseCheck.d.ts +2 -17
- package/dist/health/checks/MemoryCheck.d.ts +3 -12
- package/dist/health/checks/RedisCheck.d.ts +1 -13
- package/dist/health/checks/StorageCheck.d.ts +2 -17
- package/dist/health/index.js +1 -1
- package/dist/health/types.d.ts +4 -24
- package/dist/{health-VWdWXRwh.js → health-DQSvUplL.js} +1 -76
- package/dist/hot-disposables-B5BXqaIH.js +167 -0
- package/dist/hot-reload/hot-disposables.d.ts +22 -74
- package/dist/hot-reload/testing.d.ts +4 -9
- package/dist/http/Application.d.ts +62 -208
- package/dist/http/FormRequest.d.ts +4 -55
- package/dist/http/dev-assets.d.ts +16 -18
- package/dist/http/dev-banner.d.ts +2 -5
- package/dist/http/inertia-assets.d.ts +3 -6
- package/dist/http/middleware/capabilities.d.ts +27 -50
- package/dist/http/middleware/cors.d.ts +4 -29
- package/dist/http/middleware/csp.d.ts +2 -25
- package/dist/http/middleware/csrf.d.ts +20 -95
- package/dist/http/middleware/detect-locale.d.ts +7 -27
- package/dist/http/middleware/force-https.d.ts +6 -24
- package/dist/http/middleware/host-authorization.d.ts +2 -12
- package/dist/http/middleware/loopback-guard.d.ts +15 -33
- package/dist/http/middleware/rate-limit.d.ts +29 -126
- package/dist/http/middleware/redirect-safety.d.ts +2 -20
- package/dist/http/middleware/request-id.d.ts +1 -14
- package/dist/http/middleware/request-logging.d.ts +2 -13
- package/dist/http/middleware/response-headers.d.ts +5 -13
- package/dist/http/middleware/security-headers.d.ts +2 -16
- package/dist/http/middleware/session.d.ts +15 -34
- package/dist/http/middleware/validation-errors-cookie.d.ts +7 -18
- package/dist/http/middleware/validation.d.ts +8 -63
- package/dist/http/public-assets.d.ts +14 -0
- package/dist/http/request.d.ts +49 -48
- package/dist/http/resources/CursorPaginator.d.ts +5 -64
- package/dist/http/resources/Paginator.d.ts +7 -84
- package/dist/http/resources/Resource.d.ts +9 -65
- package/dist/http/resources/ResourceCollection.d.ts +5 -39
- package/dist/http/resources/types.d.ts +10 -30
- package/dist/http/static-documents.d.ts +21 -0
- package/dist/http/validation/Validator.d.ts +25 -85
- package/dist/http/validation/rules.d.ts +48 -147
- package/dist/http/validation/types.d.ts +16 -61
- package/dist/http/vite-assets.d.ts +5 -28
- package/dist/http/vite-dev-server.d.ts +6 -9
- package/dist/http/vite-manifest.d.ts +19 -33
- package/dist/i18n/I18nManager.d.ts +12 -78
- package/dist/i18n/Translator.d.ts +3 -54
- package/dist/i18n/index.js +1 -1
- package/dist/i18n/loaders/JsonLoader.d.ts +4 -31
- package/dist/i18n/loaders/MemoryLoader.d.ts +1 -21
- package/dist/i18n/pluralization.d.ts +4 -13
- package/dist/i18n/types.d.ts +17 -69
- package/dist/{i18n-mcWi7LCd.js → i18n-Cg1aajRP.js} +31 -225
- package/dist/index.d.ts +13 -4
- package/dist/index.js +1036 -3080
- package/dist/internal/agent-preflight.d.ts +9 -21
- package/dist/internal/request.d.ts +10 -17
- package/dist/internal/request.js +2 -2
- package/dist/internal/route-path.d.ts +9 -21
- package/dist/internal/route-path.js +9 -21
- package/dist/internal/zod-compat.d.ts +55 -122
- package/dist/internal/zod-compat.js +39 -70
- package/dist/internal/zod-json-schema.d.ts +18 -54
- package/dist/internal/zod-json-schema.js +46 -123
- package/dist/jsx-runtime.d.ts +3 -8
- package/dist/lambda/index.d.ts +17 -79
- package/dist/lambda/index.js +11 -59
- package/dist/logging/LogManager.d.ts +1 -51
- package/dist/logging/Logger.d.ts +8 -47
- package/dist/logging/channels/ConsoleChannel.d.ts +1 -3
- package/dist/logging/channels/DailyFileChannel.d.ts +1 -5
- package/dist/logging/channels/FileChannel.d.ts +1 -3
- package/dist/logging/daily-file-path.d.ts +15 -0
- package/dist/logging/index.d.ts +1 -0
- package/dist/logging/index.js +2 -2
- package/dist/logging/types.d.ts +13 -45
- package/dist/{logging-CPaRMuPP.js → logging-zOY1XCtq.js} +83 -129
- package/dist/{loopback-guard-D0Kc7-xc.js → loopback-guard-DT9gHF0F.js} +41 -92
- package/dist/mail/Mail.d.ts +10 -106
- package/dist/mail/MailManager.d.ts +2 -60
- package/dist/mail/index.js +1 -1
- package/dist/mail/transports/LogTransport.d.ts +1 -4
- package/dist/mail/transports/MemoryTransport.d.ts +1 -63
- package/dist/mail/transports/ResendTransport.d.ts +1 -23
- package/dist/mail/transports/SmtpTransport.d.ts +1 -31
- package/dist/mail/types.d.ts +28 -150
- package/dist/{mail-DfEfSQEr.js → mail-76DWy9lj.js} +31 -289
- package/dist/mcp/McpServiceProvider.d.ts +4 -10
- package/dist/mcp/create-mcp-server.d.ts +25 -57
- package/dist/mcp/endpoint.d.ts +12 -36
- package/dist/mcp/index.js +1 -1
- package/dist/mvc/Controller.d.ts +46 -253
- package/dist/mvc/Router.d.ts +50 -129
- package/dist/mvc/inertia/InertiaEngine.d.ts +18 -48
- package/dist/mvc/inertia/shared.d.ts +6 -19
- package/dist/mvc/mount-route.d.ts +2 -6
- package/dist/mvc/view.d.ts +1 -2
- package/dist/notifications/Notification.d.ts +8 -75
- package/dist/notifications/NotificationManager.d.ts +15 -88
- package/dist/notifications/channels/DatabaseChannel.d.ts +1 -41
- package/dist/notifications/channels/MailChannel.d.ts +2 -31
- package/dist/notifications/channels/MemoryChannel.d.ts +2 -62
- package/dist/notifications/channels/SlackChannel.d.ts +3 -48
- package/dist/notifications/index.js +1 -1
- package/dist/notifications/notifiable-type.d.ts +3 -6
- package/dist/notifications/registry.d.ts +8 -27
- package/dist/notifications/types.d.ts +16 -53
- package/dist/{notifications-BGqmUNZ8.js → notifications-okWFs9ly.js} +37 -335
- package/dist/providers/AuthServiceProvider.d.ts +1 -3
- package/dist/providers/AuthorizationServiceProvider.d.ts +2 -3
- package/dist/providers/BroadcastServiceProvider.d.ts +1 -3
- package/dist/providers/CacheServiceProvider.d.ts +1 -3
- package/dist/providers/EncryptionServiceProvider.d.ts +1 -3
- package/dist/providers/ErrorServiceProvider.d.ts +1 -4
- package/dist/providers/EventServiceProvider.d.ts +1 -3
- package/dist/providers/HealthServiceProvider.d.ts +1 -3
- package/dist/providers/I18nServiceProvider.d.ts +6 -10
- package/dist/providers/InertiaServiceProvider.d.ts +1 -4
- package/dist/providers/LogServiceProvider.d.ts +1 -3
- package/dist/providers/MailServiceProvider.d.ts +1 -3
- package/dist/providers/NotificationServiceProvider.d.ts +1 -3
- package/dist/providers/OAuthServiceProvider.d.ts +1 -3
- package/dist/providers/QueueServiceProvider.d.ts +1 -3
- package/dist/providers/SchedulingServiceProvider.d.ts +1 -3
- package/dist/providers/StorageServiceProvider.d.ts +1 -3
- package/dist/queue/FailedJobReporter.d.ts +1 -24
- package/dist/queue/Job.d.ts +12 -99
- package/dist/queue/QueueManager.d.ts +6 -57
- package/dist/queue/Worker.d.ts +4 -65
- package/dist/queue/drivers/MemoryDriver.d.ts +3 -44
- package/dist/queue/drivers/RedisDriver.d.ts +7 -65
- package/dist/queue/drivers/SqsDriver.d.ts +6 -57
- package/dist/queue/drivers/SyncDriver.d.ts +10 -13
- package/dist/queue/index.js +2 -2
- package/dist/queue/types.d.ts +10 -92
- package/dist/{queue-CXrRK85G.js → queue-CcXCjuJI.js} +32 -260
- package/dist/redis/RedisApiTokenStore.d.ts +4 -56
- package/dist/redis/RedisEmailVerificationStore.d.ts +4 -37
- package/dist/redis/RedisOAuthStateStore.d.ts +2 -10
- package/dist/redis/RedisPasswordResetStore.d.ts +4 -37
- package/dist/redis/RedisRateLimitStore.d.ts +16 -49
- package/dist/redis/RedisSessionStore.d.ts +3 -44
- package/dist/redis/client.d.ts +2 -32
- package/dist/redis/index.js +47 -232
- package/dist/redis/redis-values.d.ts +6 -12
- package/dist/redis/scan-keys.d.ts +1 -4
- package/dist/request-CLOYytGP.js +68 -0
- package/dist/runtime/index.d.ts +2 -0
- package/dist/runtime/index.js +108 -74
- package/dist/scheduling/CronParser.d.ts +0 -29
- package/dist/scheduling/Schedule.d.ts +1 -153
- package/dist/scheduling/ScheduledTask.d.ts +0 -31
- package/dist/scheduling/Scheduler.d.ts +0 -70
- package/dist/scheduling/index.js +1 -1
- package/dist/scheduling/types.d.ts +4 -65
- package/dist/{scheduling-CPiEdtQd.js → scheduling-C6tcOtUl.js} +2 -287
- package/dist/storage/StorageManager.d.ts +0 -48
- package/dist/storage/drivers/LocalDriver.d.ts +1 -25
- package/dist/storage/drivers/MemoryDriver.d.ts +5 -35
- package/dist/storage/drivers/S3Driver.d.ts +6 -36
- package/dist/storage/drivers/s3-acl.d.ts +5 -10
- package/dist/storage/index.js +1 -1
- package/dist/storage/types.d.ts +27 -265
- package/dist/{storage-TLD9t0Q2.js → storage-BB59f07j.js} +17 -157
- package/dist/support/contained-path.d.ts +10 -20
- package/dist/support/error-polyfill.d.ts +4 -6
- package/dist/support/expiry.d.ts +17 -33
- package/dist/support/expiry.js +17 -33
- package/dist/support/import-map.d.ts +3 -7
- package/dist/support/inertia-defaults.d.ts +5 -10
- package/dist/support/redirect-target.d.ts +4 -6
- package/dist/support/stack-frames.d.ts +11 -50
- package/dist/support/trim-slashes.d.ts +4 -7
- package/dist/support/warn-once.d.ts +2 -6
- package/dist/{trim-slashes-ZJ_VsY5s.js → trim-slashes-BLY9hKAa.js} +4 -7
- package/dist/{vite-manifest-BGfWbPYp.js → vite-manifest-CTQp-SOo.js} +34 -58
- package/package.json +6 -2
- package/dist/client-Dd7vLcqp.js +0 -27
- package/dist/context-DoD0c7J_.js +0 -26
- package/dist/endpoint-D-20PiHY.js +0 -46
- package/dist/hot-disposables-WsTX2ySN.js +0 -281
- package/dist/request-CRVuIiQr.js +0 -78
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { n as isHotReloadRuntime, t as claimHotDisposable } from "./hot-disposables-
|
|
1
|
+
import { n as isHotReloadRuntime, t as claimHotDisposable } from "./hot-disposables-B5BXqaIH.js";
|
|
2
2
|
//#region src/scheduling/CronParser.ts
|
|
3
|
-
/**
|
|
4
|
-
* Parse a cron field value.
|
|
5
|
-
*/
|
|
6
3
|
function parseField(field, min, max) {
|
|
7
4
|
const values = /* @__PURE__ */ new Set();
|
|
8
5
|
const parts = field.split(",");
|
|
@@ -30,17 +27,6 @@ function parseField(field, min, max) {
|
|
|
30
27
|
}
|
|
31
28
|
return Array.from(values).sort((a, b) => a - b);
|
|
32
29
|
}
|
|
33
|
-
/**
|
|
34
|
-
* Parse a cron expression.
|
|
35
|
-
*
|
|
36
|
-
* Cron format: minute hour dayOfMonth month dayOfWeek
|
|
37
|
-
*
|
|
38
|
-
* Examples:
|
|
39
|
-
* - Every minute: "* * * * *"
|
|
40
|
-
* - Every 5 minutes: "*/5 * * * *" (step value)
|
|
41
|
-
* - At 3:00 AM daily: "0 3 * * *"
|
|
42
|
-
* - Every Monday at 9:00 AM: "0 9 * * 1"
|
|
43
|
-
*/
|
|
44
30
|
function parseCron(expression) {
|
|
45
31
|
const parts = expression.trim().split(/\s+/);
|
|
46
32
|
if (parts.length !== 5) throw new Error(`Invalid cron expression: ${expression}. Expected 5 fields.`);
|
|
@@ -52,9 +38,6 @@ function parseCron(expression) {
|
|
|
52
38
|
dayOfWeek: parseField(parts[4], 0, 6)
|
|
53
39
|
};
|
|
54
40
|
}
|
|
55
|
-
/**
|
|
56
|
-
* Check if a date matches a parsed cron expression.
|
|
57
|
-
*/
|
|
58
41
|
function matchesCron(date, cron) {
|
|
59
42
|
const minute = date.getMinutes();
|
|
60
43
|
const hour = date.getHours();
|
|
@@ -63,9 +46,6 @@ function matchesCron(date, cron) {
|
|
|
63
46
|
const dayOfWeek = date.getDay();
|
|
64
47
|
return cron.minute.includes(minute) && cron.hour.includes(hour) && cron.dayOfMonth.includes(dayOfMonth) && cron.month.includes(month) && cron.dayOfWeek.includes(dayOfWeek);
|
|
65
48
|
}
|
|
66
|
-
/**
|
|
67
|
-
* Get the next occurrence of a cron expression.
|
|
68
|
-
*/
|
|
69
49
|
function getNextOccurrence(expression, from = /* @__PURE__ */ new Date()) {
|
|
70
50
|
const cron = parseCron(expression);
|
|
71
51
|
const next = new Date(from);
|
|
@@ -81,15 +61,9 @@ function getNextOccurrence(expression, from = /* @__PURE__ */ new Date()) {
|
|
|
81
61
|
}
|
|
82
62
|
throw new Error(`Could not find next occurrence for: ${expression}`);
|
|
83
63
|
}
|
|
84
|
-
/**
|
|
85
|
-
* Check if a cron expression is due at the given date.
|
|
86
|
-
*/
|
|
87
64
|
function isDue(expression, date = /* @__PURE__ */ new Date()) {
|
|
88
65
|
return matchesCron(date, parseCron(expression));
|
|
89
66
|
}
|
|
90
|
-
/**
|
|
91
|
-
* Get multiple next occurrences.
|
|
92
|
-
*/
|
|
93
67
|
function getNextOccurrences(expression, count, from = /* @__PURE__ */ new Date()) {
|
|
94
68
|
const occurrences = [];
|
|
95
69
|
let current = from;
|
|
@@ -100,9 +74,6 @@ function getNextOccurrences(expression, count, from = /* @__PURE__ */ new Date()
|
|
|
100
74
|
}
|
|
101
75
|
return occurrences;
|
|
102
76
|
}
|
|
103
|
-
/**
|
|
104
|
-
* Convert a Date to a specific timezone.
|
|
105
|
-
*/
|
|
106
77
|
function toTimezone(date, timezone) {
|
|
107
78
|
const options = {
|
|
108
79
|
timeZone: timezone,
|
|
@@ -124,17 +95,11 @@ function toTimezone(date, timezone) {
|
|
|
124
95
|
const second = parseInt(get("second"), 10);
|
|
125
96
|
return new Date(year, month, day, hour, minute, second);
|
|
126
97
|
}
|
|
127
|
-
/**
|
|
128
|
-
* Check if a cron expression is due in a specific timezone.
|
|
129
|
-
*/
|
|
130
98
|
function isDueInTimezone(expression, timezone, date = /* @__PURE__ */ new Date()) {
|
|
131
99
|
return isDue(expression, toTimezone(date, timezone));
|
|
132
100
|
}
|
|
133
101
|
//#endregion
|
|
134
102
|
//#region src/scheduling/ScheduledTask.ts
|
|
135
|
-
/**
|
|
136
|
-
* Represents a scheduled task.
|
|
137
|
-
*/
|
|
138
103
|
var ScheduledTask = class {
|
|
139
104
|
definition;
|
|
140
105
|
lastRun = null;
|
|
@@ -142,35 +107,19 @@ var ScheduledTask = class {
|
|
|
142
107
|
constructor(definition) {
|
|
143
108
|
this.definition = definition;
|
|
144
109
|
}
|
|
145
|
-
/**
|
|
146
|
-
* Get the task name.
|
|
147
|
-
*/
|
|
148
110
|
getName() {
|
|
149
111
|
return this.definition.name ?? "anonymous";
|
|
150
112
|
}
|
|
151
|
-
/**
|
|
152
|
-
* Get the cron expression.
|
|
153
|
-
*/
|
|
154
113
|
getExpression() {
|
|
155
114
|
return this.definition.expression;
|
|
156
115
|
}
|
|
157
|
-
/**
|
|
158
|
-
* Get the timezone.
|
|
159
|
-
*/
|
|
160
116
|
getTimezone() {
|
|
161
117
|
return this.definition.timezone;
|
|
162
118
|
}
|
|
163
|
-
/**
|
|
164
|
-
* Check if the task is due.
|
|
165
|
-
*/
|
|
166
119
|
isDue(date = /* @__PURE__ */ new Date()) {
|
|
167
120
|
if (this.definition.timezone) return isDueInTimezone(this.definition.expression, this.definition.timezone, date);
|
|
168
121
|
return isDue(this.definition.expression, date);
|
|
169
122
|
}
|
|
170
|
-
/**
|
|
171
|
-
* Check if the task should run based on conditions.
|
|
172
|
-
* Note: Overlap checking is handled separately in run() to prevent race conditions.
|
|
173
|
-
*/
|
|
174
123
|
async shouldRun() {
|
|
175
124
|
if (this.definition.when) {
|
|
176
125
|
if (!await this.definition.when()) return false;
|
|
@@ -180,9 +129,6 @@ var ScheduledTask = class {
|
|
|
180
129
|
}
|
|
181
130
|
return true;
|
|
182
131
|
}
|
|
183
|
-
/**
|
|
184
|
-
* Run the task.
|
|
185
|
-
*/
|
|
186
132
|
async run() {
|
|
187
133
|
if (this.definition.withoutOverlapping) {
|
|
188
134
|
if (this.isRunning) return;
|
|
@@ -208,30 +154,18 @@ var ScheduledTask = class {
|
|
|
208
154
|
}
|
|
209
155
|
if (error) throw error;
|
|
210
156
|
}
|
|
211
|
-
/**
|
|
212
|
-
* Get the last run time.
|
|
213
|
-
*/
|
|
214
157
|
getLastRun() {
|
|
215
158
|
return this.lastRun;
|
|
216
159
|
}
|
|
217
|
-
/**
|
|
218
|
-
* Check if the task is currently running.
|
|
219
|
-
*/
|
|
220
160
|
isCurrentlyRunning() {
|
|
221
161
|
return this.isRunning;
|
|
222
162
|
}
|
|
223
|
-
/**
|
|
224
|
-
* Get the task definition.
|
|
225
|
-
*/
|
|
226
163
|
getDefinition() {
|
|
227
164
|
return { ...this.definition };
|
|
228
165
|
}
|
|
229
166
|
};
|
|
230
167
|
//#endregion
|
|
231
168
|
//#region src/scheduling/Schedule.ts
|
|
232
|
-
/**
|
|
233
|
-
* Pending schedule builder for fluent API.
|
|
234
|
-
*/
|
|
235
169
|
var PendingSchedule = class {
|
|
236
170
|
callback;
|
|
237
171
|
expression = "* * * * *";
|
|
@@ -249,145 +183,83 @@ var PendingSchedule = class {
|
|
|
249
183
|
constructor(callback) {
|
|
250
184
|
this.callback = callback;
|
|
251
185
|
}
|
|
252
|
-
/**
|
|
253
|
-
* Run every minute.
|
|
254
|
-
*/
|
|
255
186
|
everyMinute() {
|
|
256
187
|
this.expression = "* * * * *";
|
|
257
188
|
return this;
|
|
258
189
|
}
|
|
259
|
-
/**
|
|
260
|
-
* Run every two minutes.
|
|
261
|
-
*/
|
|
262
190
|
everyTwoMinutes() {
|
|
263
191
|
this.expression = "*/2 * * * *";
|
|
264
192
|
return this;
|
|
265
193
|
}
|
|
266
|
-
/**
|
|
267
|
-
* Run every three minutes.
|
|
268
|
-
*/
|
|
269
194
|
everyThreeMinutes() {
|
|
270
195
|
this.expression = "*/3 * * * *";
|
|
271
196
|
return this;
|
|
272
197
|
}
|
|
273
|
-
/**
|
|
274
|
-
* Run every four minutes.
|
|
275
|
-
*/
|
|
276
198
|
everyFourMinutes() {
|
|
277
199
|
this.expression = "*/4 * * * *";
|
|
278
200
|
return this;
|
|
279
201
|
}
|
|
280
|
-
/**
|
|
281
|
-
* Run every five minutes.
|
|
282
|
-
*/
|
|
283
202
|
everyFiveMinutes() {
|
|
284
203
|
this.expression = "*/5 * * * *";
|
|
285
204
|
return this;
|
|
286
205
|
}
|
|
287
|
-
/**
|
|
288
|
-
* Run every ten minutes.
|
|
289
|
-
*/
|
|
290
206
|
everyTenMinutes() {
|
|
291
207
|
this.expression = "*/10 * * * *";
|
|
292
208
|
return this;
|
|
293
209
|
}
|
|
294
|
-
/**
|
|
295
|
-
* Run every fifteen minutes.
|
|
296
|
-
*/
|
|
297
210
|
everyFifteenMinutes() {
|
|
298
211
|
this.expression = "*/15 * * * *";
|
|
299
212
|
return this;
|
|
300
213
|
}
|
|
301
|
-
/**
|
|
302
|
-
* Run every thirty minutes.
|
|
303
|
-
*/
|
|
304
214
|
everyThirtyMinutes() {
|
|
305
215
|
this.expression = "*/30 * * * *";
|
|
306
216
|
return this;
|
|
307
217
|
}
|
|
308
|
-
/**
|
|
309
|
-
* Run hourly.
|
|
310
|
-
*/
|
|
311
218
|
hourly() {
|
|
312
219
|
this.expression = "0 * * * *";
|
|
313
220
|
return this;
|
|
314
221
|
}
|
|
315
|
-
/**
|
|
316
|
-
* Run hourly at a specific minute.
|
|
317
|
-
*/
|
|
318
222
|
hourlyAt(minute) {
|
|
319
223
|
this.expression = `${minute} * * * *`;
|
|
320
224
|
return this;
|
|
321
225
|
}
|
|
322
|
-
/**
|
|
323
|
-
* Run every two hours.
|
|
324
|
-
*/
|
|
325
226
|
everyTwoHours() {
|
|
326
227
|
this.expression = "0 */2 * * *";
|
|
327
228
|
return this;
|
|
328
229
|
}
|
|
329
|
-
/**
|
|
330
|
-
* Run every three hours.
|
|
331
|
-
*/
|
|
332
230
|
everyThreeHours() {
|
|
333
231
|
this.expression = "0 */3 * * *";
|
|
334
232
|
return this;
|
|
335
233
|
}
|
|
336
|
-
/**
|
|
337
|
-
* Run every four hours.
|
|
338
|
-
*/
|
|
339
234
|
everyFourHours() {
|
|
340
235
|
this.expression = "0 */4 * * *";
|
|
341
236
|
return this;
|
|
342
237
|
}
|
|
343
|
-
/**
|
|
344
|
-
* Run every six hours.
|
|
345
|
-
*/
|
|
346
238
|
everySixHours() {
|
|
347
239
|
this.expression = "0 */6 * * *";
|
|
348
240
|
return this;
|
|
349
241
|
}
|
|
350
|
-
/**
|
|
351
|
-
* Run daily at midnight.
|
|
352
|
-
*/
|
|
353
242
|
daily() {
|
|
354
243
|
this.expression = "0 0 * * *";
|
|
355
244
|
return this;
|
|
356
245
|
}
|
|
357
|
-
/**
|
|
358
|
-
* Run daily at a specific time.
|
|
359
|
-
* @param time Time in HH:MM format
|
|
360
|
-
*/
|
|
361
246
|
dailyAt(time) {
|
|
362
247
|
const [hour, minute] = time.split(":").map((n) => parseInt(n, 10));
|
|
363
248
|
this.expression = `${minute ?? 0} ${hour ?? 0} * * *`;
|
|
364
249
|
return this;
|
|
365
250
|
}
|
|
366
|
-
/**
|
|
367
|
-
* Alias for dailyAt.
|
|
368
|
-
*/
|
|
369
251
|
at(time) {
|
|
370
252
|
return this.dailyAt(time);
|
|
371
253
|
}
|
|
372
|
-
/**
|
|
373
|
-
* Run twice daily.
|
|
374
|
-
*/
|
|
375
254
|
twiceDaily(firstHour = 1, secondHour = 13) {
|
|
376
255
|
this.expression = `0 ${firstHour},${secondHour} * * *`;
|
|
377
256
|
return this;
|
|
378
257
|
}
|
|
379
|
-
/**
|
|
380
|
-
* Run weekly on Sunday at midnight.
|
|
381
|
-
*/
|
|
382
258
|
weekly() {
|
|
383
259
|
this.expression = "0 0 * * 0";
|
|
384
260
|
return this;
|
|
385
261
|
}
|
|
386
|
-
/**
|
|
387
|
-
* Run weekly on a specific day at a specific time.
|
|
388
|
-
* @param day Day of week (0 = Sunday, 6 = Saturday)
|
|
389
|
-
* @param time Time in HH:MM format
|
|
390
|
-
*/
|
|
262
|
+
/** `day`: cron day-of-week, 0 = Sunday. */
|
|
391
263
|
weeklyOn(day, time = "00:00") {
|
|
392
264
|
const [hour, minute] = time.split(":").map((n) => parseInt(n, 10));
|
|
393
265
|
this.expression = `${minute ?? 0} ${hour ?? 0} * * ${day}`;
|
|
@@ -435,162 +307,96 @@ var PendingSchedule = class {
|
|
|
435
307
|
this.expression = parts.join(" ");
|
|
436
308
|
return this;
|
|
437
309
|
}
|
|
438
|
-
/**
|
|
439
|
-
* Run on weekdays (Monday-Friday).
|
|
440
|
-
*/
|
|
441
310
|
weekdays() {
|
|
442
311
|
const parts = this.expression.split(" ");
|
|
443
312
|
parts[4] = "1-5";
|
|
444
313
|
this.expression = parts.join(" ");
|
|
445
314
|
return this;
|
|
446
315
|
}
|
|
447
|
-
/**
|
|
448
|
-
* Run on weekends (Saturday-Sunday).
|
|
449
|
-
*/
|
|
450
316
|
weekends() {
|
|
451
317
|
const parts = this.expression.split(" ");
|
|
452
318
|
parts[4] = "0,6";
|
|
453
319
|
this.expression = parts.join(" ");
|
|
454
320
|
return this;
|
|
455
321
|
}
|
|
456
|
-
/**
|
|
457
|
-
* Run monthly on the first day at midnight.
|
|
458
|
-
*/
|
|
459
322
|
monthly() {
|
|
460
323
|
this.expression = "0 0 1 * *";
|
|
461
324
|
return this;
|
|
462
325
|
}
|
|
463
|
-
/**
|
|
464
|
-
* Run monthly on a specific day at a specific time.
|
|
465
|
-
*/
|
|
466
326
|
monthlyOn(day, time = "00:00") {
|
|
467
327
|
const [hour, minute] = time.split(":").map((n) => parseInt(n, 10));
|
|
468
328
|
this.expression = `${minute ?? 0} ${hour ?? 0} ${day} * *`;
|
|
469
329
|
return this;
|
|
470
330
|
}
|
|
471
|
-
/**
|
|
472
|
-
* Run on the last day of the month.
|
|
473
|
-
*/
|
|
474
331
|
lastDayOfMonth(time = "00:00") {
|
|
475
332
|
const [hour, minute] = time.split(":").map((n) => parseInt(n, 10));
|
|
476
333
|
this.expression = `${minute ?? 0} ${hour ?? 0} 28-31 * *`;
|
|
477
334
|
return this;
|
|
478
335
|
}
|
|
479
|
-
/**
|
|
480
|
-
* Run quarterly.
|
|
481
|
-
*/
|
|
482
336
|
quarterly() {
|
|
483
337
|
this.expression = "0 0 1 1,4,7,10 *";
|
|
484
338
|
return this;
|
|
485
339
|
}
|
|
486
|
-
/**
|
|
487
|
-
* Run yearly on January 1st at midnight.
|
|
488
|
-
*/
|
|
489
340
|
yearly() {
|
|
490
341
|
this.expression = "0 0 1 1 *";
|
|
491
342
|
return this;
|
|
492
343
|
}
|
|
493
|
-
/**
|
|
494
|
-
* Run yearly on a specific date.
|
|
495
|
-
*/
|
|
496
344
|
yearlyOn(month, day, time = "00:00") {
|
|
497
345
|
const [hour, minute] = time.split(":").map((n) => parseInt(n, 10));
|
|
498
346
|
this.expression = `${minute ?? 0} ${hour ?? 0} ${day} ${month} *`;
|
|
499
347
|
return this;
|
|
500
348
|
}
|
|
501
|
-
/**
|
|
502
|
-
* Set a custom cron expression.
|
|
503
|
-
*/
|
|
504
349
|
cron(expression) {
|
|
505
350
|
this.expression = expression;
|
|
506
351
|
return this;
|
|
507
352
|
}
|
|
508
|
-
/**
|
|
509
|
-
* Set the task name.
|
|
510
|
-
*/
|
|
511
353
|
name(name) {
|
|
512
354
|
this.taskName = name;
|
|
513
355
|
return this;
|
|
514
356
|
}
|
|
515
|
-
/**
|
|
516
|
-
* Set the timezone.
|
|
517
|
-
*/
|
|
518
357
|
tz(timezone) {
|
|
519
358
|
this.timezone = timezone;
|
|
520
359
|
return this;
|
|
521
360
|
}
|
|
522
|
-
/**
|
|
523
|
-
* Alias for tz().
|
|
524
|
-
*/
|
|
525
361
|
setTimezone(timezone) {
|
|
526
362
|
return this.tz(timezone);
|
|
527
363
|
}
|
|
528
|
-
/**
|
|
529
|
-
* Prevent overlapping executions.
|
|
530
|
-
*/
|
|
531
364
|
preventOverlapping(expiresAt) {
|
|
532
365
|
this.withoutOverlapping = true;
|
|
533
366
|
this.overlapExpiresAt = expiresAt;
|
|
534
367
|
return this;
|
|
535
368
|
}
|
|
536
|
-
/**
|
|
537
|
-
* Alias for preventOverlapping().
|
|
538
|
-
*/
|
|
539
369
|
withoutOverlaps(expiresAt) {
|
|
540
370
|
return this.preventOverlapping(expiresAt);
|
|
541
371
|
}
|
|
542
|
-
/**
|
|
543
|
-
* Only run on one server.
|
|
544
|
-
*/
|
|
545
372
|
runOnOneServer() {
|
|
546
373
|
this.onOneServer = true;
|
|
547
374
|
return this;
|
|
548
375
|
}
|
|
549
|
-
/**
|
|
550
|
-
* Set a condition for running.
|
|
551
|
-
*/
|
|
552
376
|
when(callback) {
|
|
553
377
|
this.whenCallback = callback;
|
|
554
378
|
return this;
|
|
555
379
|
}
|
|
556
|
-
/**
|
|
557
|
-
* Set a condition to skip execution.
|
|
558
|
-
*/
|
|
559
380
|
skip(callback) {
|
|
560
381
|
this.skipCallback = callback;
|
|
561
382
|
return this;
|
|
562
383
|
}
|
|
563
|
-
/**
|
|
564
|
-
* Set a before callback.
|
|
565
|
-
*/
|
|
566
384
|
before(callback) {
|
|
567
385
|
this.beforeCallback = callback;
|
|
568
386
|
return this;
|
|
569
387
|
}
|
|
570
|
-
/**
|
|
571
|
-
* Set an after callback.
|
|
572
|
-
*/
|
|
573
388
|
after(callback) {
|
|
574
389
|
this.afterCallback = callback;
|
|
575
390
|
return this;
|
|
576
391
|
}
|
|
577
|
-
/**
|
|
578
|
-
* Set a success callback.
|
|
579
|
-
*/
|
|
580
392
|
onSuccess(callback) {
|
|
581
393
|
this.successCallback = callback;
|
|
582
394
|
return this;
|
|
583
395
|
}
|
|
584
|
-
/**
|
|
585
|
-
* Set a failure callback.
|
|
586
|
-
*/
|
|
587
396
|
onFailure(callback) {
|
|
588
397
|
this.failureCallback = callback;
|
|
589
398
|
return this;
|
|
590
399
|
}
|
|
591
|
-
/**
|
|
592
|
-
* Build the task definition.
|
|
593
|
-
*/
|
|
594
400
|
build() {
|
|
595
401
|
return {
|
|
596
402
|
name: this.taskName,
|
|
@@ -608,37 +414,22 @@ var PendingSchedule = class {
|
|
|
608
414
|
onFailure: this.failureCallback
|
|
609
415
|
};
|
|
610
416
|
}
|
|
611
|
-
/**
|
|
612
|
-
* Build as a ScheduledTask.
|
|
613
|
-
*/
|
|
614
417
|
toTask() {
|
|
615
418
|
return new ScheduledTask(this.build());
|
|
616
419
|
}
|
|
617
420
|
};
|
|
618
|
-
/**
|
|
619
|
-
* Schedule builder for defining multiple tasks.
|
|
620
|
-
*/
|
|
621
421
|
var Schedule = class {
|
|
622
422
|
tasks = [];
|
|
623
|
-
/**
|
|
624
|
-
* Schedule a callback.
|
|
625
|
-
*/
|
|
626
423
|
call(callback) {
|
|
627
424
|
const pending = new PendingSchedule(callback);
|
|
628
425
|
this.tasks.push(pending);
|
|
629
426
|
return pending;
|
|
630
427
|
}
|
|
631
|
-
/**
|
|
632
|
-
* Schedule a job.
|
|
633
|
-
*/
|
|
634
428
|
job(jobClass, payload) {
|
|
635
429
|
return this.call(async () => {
|
|
636
430
|
await jobClass.dispatch(payload);
|
|
637
431
|
});
|
|
638
432
|
}
|
|
639
|
-
/**
|
|
640
|
-
* Schedule a shell command.
|
|
641
|
-
*/
|
|
642
433
|
command(cmd) {
|
|
643
434
|
return this.call(async () => {
|
|
644
435
|
const { exec } = await import("node:child_process");
|
|
@@ -646,43 +437,15 @@ var Schedule = class {
|
|
|
646
437
|
await promisify(exec)(cmd);
|
|
647
438
|
});
|
|
648
439
|
}
|
|
649
|
-
/**
|
|
650
|
-
* Get all pending schedules.
|
|
651
|
-
*/
|
|
652
440
|
getPendingSchedules() {
|
|
653
441
|
return [...this.tasks];
|
|
654
442
|
}
|
|
655
|
-
/**
|
|
656
|
-
* Build all tasks.
|
|
657
|
-
*/
|
|
658
443
|
buildTasks() {
|
|
659
444
|
return this.tasks.map((pending) => pending.toTask());
|
|
660
445
|
}
|
|
661
446
|
};
|
|
662
447
|
//#endregion
|
|
663
448
|
//#region src/scheduling/Scheduler.ts
|
|
664
|
-
/**
|
|
665
|
-
* Task scheduler for running periodic tasks.
|
|
666
|
-
*
|
|
667
|
-
* @example
|
|
668
|
-
* ```ts
|
|
669
|
-
* const scheduler = new Scheduler()
|
|
670
|
-
*
|
|
671
|
-
* scheduler.schedule((schedule) => {
|
|
672
|
-
* schedule.call(async () => {
|
|
673
|
-
* await cleanupOldSessions()
|
|
674
|
-
* }).daily().at('03:00').name('cleanup-sessions')
|
|
675
|
-
*
|
|
676
|
-
* schedule.job(SendWeeklyDigestJob, {})
|
|
677
|
-
* .weekly()
|
|
678
|
-
* .sundays()
|
|
679
|
-
* .at('09:00')
|
|
680
|
-
* .tz('Asia/Tokyo')
|
|
681
|
-
* })
|
|
682
|
-
*
|
|
683
|
-
* scheduler.start()
|
|
684
|
-
* ```
|
|
685
|
-
*/
|
|
686
449
|
var Scheduler = class {
|
|
687
450
|
tasks = [];
|
|
688
451
|
options;
|
|
@@ -698,35 +461,20 @@ var Scheduler = class {
|
|
|
698
461
|
logger: options.logger ?? (() => {})
|
|
699
462
|
};
|
|
700
463
|
}
|
|
701
|
-
/**
|
|
702
|
-
* Define schedules using a callback.
|
|
703
|
-
*/
|
|
704
464
|
schedule(definer) {
|
|
705
465
|
const schedule = new Schedule();
|
|
706
466
|
definer(schedule);
|
|
707
467
|
this.tasks.push(...schedule.buildTasks());
|
|
708
468
|
}
|
|
709
|
-
/**
|
|
710
|
-
* Add a pre-built task.
|
|
711
|
-
*/
|
|
712
469
|
addTask(task) {
|
|
713
470
|
this.tasks.push(task);
|
|
714
471
|
}
|
|
715
|
-
/**
|
|
716
|
-
* Get all scheduled tasks.
|
|
717
|
-
*/
|
|
718
472
|
getTasks() {
|
|
719
473
|
return [...this.tasks];
|
|
720
474
|
}
|
|
721
|
-
/**
|
|
722
|
-
* Get tasks that are due now.
|
|
723
|
-
*/
|
|
724
475
|
getDueTasks(date = /* @__PURE__ */ new Date()) {
|
|
725
476
|
return this.tasks.filter((task) => task.isDue(date));
|
|
726
477
|
}
|
|
727
|
-
/**
|
|
728
|
-
* Run all due tasks.
|
|
729
|
-
*/
|
|
730
478
|
async runDueTasks(date = /* @__PURE__ */ new Date()) {
|
|
731
479
|
const dueTasks = this.getDueTasks(date);
|
|
732
480
|
for (const task of dueTasks) {
|
|
@@ -740,9 +488,6 @@ var Scheduler = class {
|
|
|
740
488
|
}
|
|
741
489
|
}
|
|
742
490
|
}
|
|
743
|
-
/**
|
|
744
|
-
* Start the scheduler.
|
|
745
|
-
*/
|
|
746
491
|
start() {
|
|
747
492
|
if (this.isRunning) return;
|
|
748
493
|
this.isRunning = true;
|
|
@@ -754,9 +499,6 @@ var Scheduler = class {
|
|
|
754
499
|
}, this.options.checkInterval);
|
|
755
500
|
if (this.interval.unref) this.interval.unref();
|
|
756
501
|
}
|
|
757
|
-
/**
|
|
758
|
-
* Stop the scheduler.
|
|
759
|
-
*/
|
|
760
502
|
stop() {
|
|
761
503
|
if (!this.isRunning) return;
|
|
762
504
|
if (this.interval) {
|
|
@@ -768,9 +510,6 @@ var Scheduler = class {
|
|
|
768
510
|
this.isRunning = false;
|
|
769
511
|
this.options.logger("Scheduler stopped");
|
|
770
512
|
}
|
|
771
|
-
/**
|
|
772
|
-
* Check and run due tasks.
|
|
773
|
-
*/
|
|
774
513
|
tick() {
|
|
775
514
|
const now = /* @__PURE__ */ new Date();
|
|
776
515
|
if (this.lastCheck) {
|
|
@@ -781,45 +520,24 @@ var Scheduler = class {
|
|
|
781
520
|
this.options.logger(`Scheduler error: ${error}`);
|
|
782
521
|
});
|
|
783
522
|
}
|
|
784
|
-
/**
|
|
785
|
-
* Check if the scheduler is running.
|
|
786
|
-
*/
|
|
787
523
|
getIsRunning() {
|
|
788
524
|
return this.isRunning;
|
|
789
525
|
}
|
|
790
|
-
/**
|
|
791
|
-
* Get the check interval.
|
|
792
|
-
*/
|
|
793
526
|
getCheckInterval() {
|
|
794
527
|
return this.options.checkInterval;
|
|
795
528
|
}
|
|
796
|
-
/**
|
|
797
|
-
* Get the default timezone.
|
|
798
|
-
*/
|
|
799
529
|
getTimezone() {
|
|
800
530
|
return this.options.timezone;
|
|
801
531
|
}
|
|
802
|
-
/**
|
|
803
|
-
* Clear all tasks.
|
|
804
|
-
*/
|
|
805
532
|
clear() {
|
|
806
533
|
this.tasks = [];
|
|
807
534
|
}
|
|
808
|
-
/**
|
|
809
|
-
* Get the number of tasks.
|
|
810
|
-
*/
|
|
811
535
|
count() {
|
|
812
536
|
return this.tasks.length;
|
|
813
537
|
}
|
|
814
|
-
/**
|
|
815
|
-
* Get task by name.
|
|
816
|
-
*/
|
|
817
538
|
getTask(name) {
|
|
818
539
|
return this.tasks.find((task) => task.getName() === name);
|
|
819
540
|
}
|
|
820
|
-
/**
|
|
821
|
-
* Remove a task by name.
|
|
822
|
-
*/
|
|
823
541
|
removeTask(name) {
|
|
824
542
|
const index = this.tasks.findIndex((task) => task.getName() === name);
|
|
825
543
|
if (index !== -1) {
|
|
@@ -829,9 +547,6 @@ var Scheduler = class {
|
|
|
829
547
|
return false;
|
|
830
548
|
}
|
|
831
549
|
};
|
|
832
|
-
/**
|
|
833
|
-
* Create a scheduler instance.
|
|
834
|
-
*/
|
|
835
550
|
function createScheduler(options) {
|
|
836
551
|
return new Scheduler(options);
|
|
837
552
|
}
|