@guren/server 1.4.0 → 1.5.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/{Application-BvBqgc2k.d.ts → Application-Bi-olFMF.d.ts} +198 -9
- package/dist/ConsoleKernel-D0dkFt6u.d.ts +101 -0
- package/dist/{chunk-CSDKWLFD.js → chunk-5AD7LYWO.js} +111 -35
- package/dist/{chunk-R2TCP7D7.js → chunk-6J6B5KOB.js} +18 -2
- package/dist/{chunk-EDRGAM6G.js → chunk-RNXTRWKL.js} +2 -1
- package/dist/{chunk-JIT7QVMJ.js → chunk-SHYRVOMJ.js} +2 -2
- package/dist/{chunk-WJJ5CTNI.js → chunk-Z3HXKWI6.js} +2 -2
- package/dist/index.d.ts +23 -5
- package/dist/index.js +150 -49
- package/dist/lambda/index.d.ts +2 -2
- package/dist/lambda/index.js +1 -1
- package/dist/mail/index.js +3 -3
- package/dist/mcp/index.d.ts +1 -1
- package/dist/notifications/index.d.ts +52 -3
- package/dist/notifications/index.js +11 -3
- package/dist/queue/index.d.ts +2 -2
- package/dist/queue/index.js +4 -2
- package/dist/runtime/index.d.ts +2 -2
- package/dist/runtime/index.js +1 -1
- package/package.json +2 -2
- package/dist/ConsoleKernel-Dw9X9qZY.d.ts +0 -207
|
@@ -307,6 +307,17 @@ function generateJobId() {
|
|
|
307
307
|
return randomBytes(16).toString("hex");
|
|
308
308
|
}
|
|
309
309
|
var Job = class {
|
|
310
|
+
/**
|
|
311
|
+
* Stable wire name for this job.
|
|
312
|
+
*
|
|
313
|
+
* Queued messages record this name, and the worker resolves the class back
|
|
314
|
+
* from it. When omitted the class name is used, which breaks if a bundler
|
|
315
|
+
* mangles identifiers or if the class is later renamed while messages are
|
|
316
|
+
* still in flight. Set it to pin the name across both.
|
|
317
|
+
*
|
|
318
|
+
* @default the class name
|
|
319
|
+
*/
|
|
320
|
+
static jobName;
|
|
310
321
|
/**
|
|
311
322
|
* The queue this job should be dispatched to.
|
|
312
323
|
* @default 'default'
|
|
@@ -344,7 +355,7 @@ var Job = class {
|
|
|
344
355
|
const delay = options.delay ?? 0;
|
|
345
356
|
const job = {
|
|
346
357
|
id: jobId,
|
|
347
|
-
name: this
|
|
358
|
+
name: resolveJobName(this),
|
|
348
359
|
payload,
|
|
349
360
|
queue: options.queue ?? this.queue,
|
|
350
361
|
attempts: 0,
|
|
@@ -379,9 +390,13 @@ var Job = class {
|
|
|
379
390
|
return Math.pow(2, attempts) * 1e3;
|
|
380
391
|
}
|
|
381
392
|
};
|
|
393
|
+
function resolveJobName(jobClass) {
|
|
394
|
+
const own = Object.prototype.hasOwnProperty.call(jobClass, "jobName") ? jobClass.jobName : void 0;
|
|
395
|
+
return own ?? jobClass.name;
|
|
396
|
+
}
|
|
382
397
|
var jobRegistry = /* @__PURE__ */ new Map();
|
|
383
398
|
function registerJob(jobClass) {
|
|
384
|
-
jobRegistry.set(jobClass
|
|
399
|
+
jobRegistry.set(resolveJobName(jobClass), jobClass);
|
|
385
400
|
}
|
|
386
401
|
function getJob(name) {
|
|
387
402
|
return jobRegistry.get(name);
|
|
@@ -402,6 +417,7 @@ export {
|
|
|
402
417
|
setQueueDriver,
|
|
403
418
|
getQueueDriver,
|
|
404
419
|
Job,
|
|
420
|
+
resolveJobName,
|
|
405
421
|
registerJob,
|
|
406
422
|
getJob,
|
|
407
423
|
getRegisteredJobs,
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
Job,
|
|
3
3
|
getQueueDriver,
|
|
4
4
|
registerJob
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-6J6B5KOB.js";
|
|
6
6
|
|
|
7
7
|
// src/mail/transports/SmtpTransport.ts
|
|
8
8
|
import nodemailer from "nodemailer";
|
|
@@ -614,6 +614,7 @@ function getMailManager() {
|
|
|
614
614
|
return globalMailManager;
|
|
615
615
|
}
|
|
616
616
|
var SendMailJob = class extends Job {
|
|
617
|
+
static jobName = "SendMailJob";
|
|
617
618
|
static queue = "default";
|
|
618
619
|
static maxAttempts = 3;
|
|
619
620
|
static backoff = "exponential";
|
|
@@ -6,7 +6,7 @@ import standard from "figlet/importable-fonts/Standard.js";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@guren/server",
|
|
9
|
-
version: "1.
|
|
9
|
+
version: "1.5.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
license: "MIT",
|
|
12
12
|
repository: {
|
|
@@ -115,7 +115,7 @@ var package_default = {
|
|
|
115
115
|
test: "bun test"
|
|
116
116
|
},
|
|
117
117
|
dependencies: {
|
|
118
|
-
"@guren/orm": "^1.
|
|
118
|
+
"@guren/orm": "^1.3.0",
|
|
119
119
|
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
120
120
|
chalk: "^5.3.0",
|
|
121
121
|
consola: "^3.4.2",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getJob,
|
|
3
3
|
setQueueDriver
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-6J6B5KOB.js";
|
|
5
5
|
|
|
6
6
|
// src/queue/drivers/MemoryDriver.ts
|
|
7
7
|
var MemoryDriver = class {
|
|
@@ -139,7 +139,7 @@ var SyncDriver = class {
|
|
|
139
139
|
const JobClass = getJob(job.name);
|
|
140
140
|
if (!JobClass) {
|
|
141
141
|
throw new Error(
|
|
142
|
-
`SyncDriver: job class "${job.name}" is not registered. Call registerJob(${job.name}
|
|
142
|
+
`SyncDriver: job class "${job.name}" is not registered. Call registerJob() with the class whose jobName (or class name) is "${job.name}".`
|
|
143
143
|
);
|
|
144
144
|
}
|
|
145
145
|
job.attempts += 1;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as ErrorResponse,
|
|
2
|
-
export { A as Application,
|
|
1
|
+
import { E as ErrorResponse, a as Container, e as ServiceProviderConstructor, S as ServiceProvider, I as InputInterface, P as ParsedSignature, f as OptionDefinition, g as CommandInstance, O as OutputInterface, h as ServiceBindings, Q as QueueManager, N as NotificationManager } from './Application-Bi-olFMF.js';
|
|
2
|
+
export { A as Application, i as ApplicationListenOptions, j as ApplicationOptions, k as ArgumentDefinition, m as AuthPayload, n as AuthPluginOptions, o as CSRF_FORM_FIELD, p as CSRF_HEADER_NAME, q as CSRF_TOKEN_KEY, C as CommandClass, b as ConsoleKernelOptions, r as ContainerProvider, t as ContextualBinding, u as ContextualBindingBuilder, v as ContextualNeedsBuilder, w as Controller, x as ControllerInertiaProps, y as CsrfOptions, z as DatabaseChannelOptions, B as DatabaseNotification, F as ExceptionClass, H as ExceptionHandler, J as ExceptionHandlerOptions, K as ExceptionRenderer, L as ExceptionReporter, M as FailedJob, R as GurenModule, T as HostAuthorizationOptions, U as HstsOptions, V as InertiaDocumentContext, W as InertiaDocumentOptions, X as InertiaOptions, Y as InertiaPagePayload, Z as InertiaResponse, _ as InertiaSharedProps, $ as InertiaSsrContext, a0 as InertiaSsrOptions, a1 as InertiaSsrRenderer, a2 as InertiaSsrResult, a3 as InferInertiaProps, a4 as Job, a5 as JobClass, a6 as JobFailureHandler, a7 as JobHandler, a8 as JobOptions, a9 as ModuleDefinition, aa as Notifiable, ab as Notification, ac as NotificationAttachment, ad as NotificationChannel, ae as NotificationChannelFactory, af as NotificationClass, ag as NotificationMailMessage, ah as NotificationManagerOptions, ai as ProgressInterface, aj as PromptInterface, ak as ProviderManager, al as QueueConfig, am as QueueDriver, an as QueueDriverFactory, ao as QueuedJob, ap as RendererRegistration, aq as ResolvedSharedInertiaProps, ar as ResourceRouteOptions, as as RouteBuilder, at as RouteContractOptions, au as RouteDefinition, av as RouteOpenApiMetadata, aw as RouteResourceAction, ax as Router, ay as ScheduledCommand, az as SecurityHeadersOptions, aA as SentNotification, aB as ServiceBinding, aC as ServiceClass, aD as ServiceFactory, aE as ServiceProviderClass, aF as ServiceProviderOptions, aG as SharedInertiaPropsResolver, aH as SlackAttachment, aI as SlackBlock, aJ as SlackMessage, aK as VALIDATED_DATA_KEY, aL as ValidateRequestOptions, aM as ValidationSchema, aN as WorkerOptions, aO as abort, aP as abortIf, aQ as abortUnless, aR as clearJobRegistry, aS as createApp, aT as createContainer, aU as createCsrfMiddleware, aV as createExceptionHandler, aW as createHostAuthorizationMiddleware, aX as createNotificationManager, aY as createQueueManager, aZ as createSecurityHeaders, a_ as csrfField, a$ as defineModule, b0 as formatValidationErrors, b1 as getContainer, b2 as getCsrfToken, b3 as getExceptionHandler, b4 as getInertiaSharedPropsResolver, b5 as getJob, b6 as getNotificationManager, b7 as getQueueDriver, b8 as getRegisteredJobs, b9 as getValidatedData, ba as inertia, bb as mountModuleRoutes, bc as parseRequestPayload, bd as registerJob, be as resolve, bf as resolveJobName, bg as setContainer, bh as setExceptionHandler, bi as setInertiaDocument, bj as setInertiaSharedProps, bk as setInertiaSsrRenderer, bl as setNotificationManager, bm as setQueueDriver, bn as shareInertiaProps, bo as validate, bp as validateRequest, bq as validateRequestWith, br as validateSafe, bs as verifyCsrfToken } from './Application-Bi-olFMF.js';
|
|
3
3
|
import * as hono from 'hono';
|
|
4
4
|
import { Context, MiddlewareHandler } from 'hono';
|
|
5
5
|
export { Context } from 'hono';
|
|
@@ -34,13 +34,12 @@ export { a as I18nConfig, P as PluralizationRule, R as ReplacementValues, b as T
|
|
|
34
34
|
export { JsonLoader, MemoryLoader, getPluralizationRule, pluralizationRules, selectPluralForm } from './i18n/index.js';
|
|
35
35
|
export { C as CheckResult, a as HealthCheck, b as HealthCheckOptions, H as HealthManager, c as HealthMiddlewareOptions, d as HealthReport, e as HealthStatus, f as createHealthManager } from './HealthManager-DUyMIzsZ.js';
|
|
36
36
|
export { CacheCheck, CacheCheckOptions, CacheStoreInterface, CustomCheck, CustomCheckCallback, DatabaseCheck, DatabaseCheckOptions, DatabaseConnection, MemoryCheck, MemoryCheckOptions, RedisCheck, RedisCheckOptions, RedisClient, StorageCheck, StorageCheckOptions, StorageDriverInterface, customCheck } from './health/index.js';
|
|
37
|
-
export { DatabaseChannel, MailChannel, MailChannelOptions, MemoryChannel, SlackChannel, SlackChannelOptions } from './notifications/index.js';
|
|
37
|
+
export { DatabaseChannel, MailChannel, MailChannelOptions, MemoryChannel, NotificationConstructor, SlackChannel, SlackChannelOptions, clearNotificationRegistry, getNotification, registerNotification, resolveNotifiableType } from './notifications/index.js';
|
|
38
38
|
import { B as BroadcastManager } from './BroadcastManager-D8KoJxiV.js';
|
|
39
39
|
export { A as AuthMiddlewareOptions, a as BroadcastDriver, b as BroadcastDriverFactory, c as BroadcastEvent, d as BroadcastManagerOptions, e as BroadcastableEvent, C as Channel, f as ChannelAuthorizer, g as ChannelRegistration, P as PresenceBroadcastDriver, h as PresenceChannel, i as PresenceChannelAuthorizer, j as PresenceMember, k as PrivateChannel, S as SSEClient, l as SSEMiddlewareOptions, W as WebSocketClient, m as createBroadcastManager, n as getBroadcastManager, s as setBroadcastManager } from './BroadcastManager-D8KoJxiV.js';
|
|
40
40
|
export { RedisClient as BroadcastRedisClient, RedisDriverOptions as BroadcastRedisDriverOptions, MemoryDriver as MemoryBroadcastDriver, RedisDriver as RedisBroadcastDriver, createTypedBroadcaster } from './broadcasting/index.js';
|
|
41
|
-
import { I as InputInterface, P as ParsedSignature, O as OptionDefinition, a as CommandInstance, b as OutputInterface } from './ConsoleKernel-Dw9X9qZY.js';
|
|
42
|
-
export { A as ArgumentDefinition, c as CommandClass, C as ConsoleKernel, d as ConsoleKernelOptions, e as ProgressInterface, f as PromptInterface, S as ScheduledCommand, g as createConsoleKernel } from './ConsoleKernel-Dw9X9qZY.js';
|
|
43
41
|
import * as readline from 'readline';
|
|
42
|
+
export { C as ConsoleKernel, c as createConsoleKernel } from './ConsoleKernel-D0dkFt6u.js';
|
|
44
43
|
export { R as AuthResponse, A as AuthUser, a as AuthorizationResponse, b as AuthorizeOptions, G as Gate, c as GateCallback, d as GateDefinition, e as GateOptions, P as PolicyClass, f as PolicyInterface, g as PolicyMethod, h as PolicyRegistration, i as ResourceAction, j as ResponseBuilder, k as authorizeAbility, l as can, m as cannot, n as createGate, o as defineGate, p as getGate, s as setGate } from './Gate-CynjZCtS.js';
|
|
45
44
|
export { AuthorizedContext, Policy, authorizeAllMiddleware, authorizeMiddleware, authorizeResourceMiddleware, definePolicy, withAuthorization } from './authorization/index.js';
|
|
46
45
|
export { A as AppKeyring, D as DecryptOptions, a as EncryptOptions, b as EncryptedPayload, E as Encrypter, c as EncrypterConfig, H as HashAlgorithm, d as HmacOptions, P as PasswordHashOptions, R as RandomStringOptions, e as createEncrypter, f as decrypt, g as deriveAppKey, h as deriveAppKeyring, i as encrypt, j as generateAppKey, k as generateKey, l as getAppKeyringFromEnv, m as getEncrypter, n as normalizeAppKey, p as parseAppKey, o as parsePreviousAppKeys, s as setEncrypter } from './app-key-CsBfRC_Q.js';
|
|
@@ -758,6 +757,7 @@ declare class I18nServiceProvider extends ServiceProvider {
|
|
|
758
757
|
*/
|
|
759
758
|
declare class NotificationServiceProvider extends ServiceProvider {
|
|
760
759
|
register(): void;
|
|
760
|
+
boot(): void;
|
|
761
761
|
}
|
|
762
762
|
|
|
763
763
|
/**
|
|
@@ -1974,6 +1974,18 @@ declare function cursorPaginate<T>(items: T[], perPage: number, hasMore: boolean
|
|
|
1974
1974
|
* - `{--option=default}` - Option with default value
|
|
1975
1975
|
* - `{-o|--option}` - Option with shortcut
|
|
1976
1976
|
* - `{--option=*}` - Array option
|
|
1977
|
+
* - `{argument : Description}` - Argument with a description
|
|
1978
|
+
* - `{--option= : Description}` - Option with a description
|
|
1979
|
+
*
|
|
1980
|
+
* A description is separated from the token by a colon with whitespace on at
|
|
1981
|
+
* least one side, so it may contain spaces and colons freely. Requiring that
|
|
1982
|
+
* whitespace keeps colons inside default values (`{--url=https://example.com}`)
|
|
1983
|
+
* out of descriptions.
|
|
1984
|
+
*
|
|
1985
|
+
* A colon with no whitespace at all (`{argument:Description}`) is accepted for
|
|
1986
|
+
* a single-word description, but only on a token carrying no other marker:
|
|
1987
|
+
* `{argument?}`, `{argument*}` and `{--option=default}` must use the spaced
|
|
1988
|
+
* form, since their markers are stripped before that fallback runs.
|
|
1977
1989
|
*
|
|
1978
1990
|
* @example
|
|
1979
1991
|
* ```typescript
|
|
@@ -1986,6 +1998,10 @@ declare function cursorPaginate<T>(items: T[], perPage: number, hasMore: boolean
|
|
|
1986
1998
|
* // { name: 'role', requiresValue: true, defaultValue: 'user' }
|
|
1987
1999
|
* // ]
|
|
1988
2000
|
* // }
|
|
2001
|
+
*
|
|
2002
|
+
* parseSignature('users:create {name : The full name} {--admin : Grant admin rights}')
|
|
2003
|
+
* // => arguments[0].description === 'The full name'
|
|
2004
|
+
* // options[0].description === 'Grant admin rights'
|
|
1989
2005
|
* ```
|
|
1990
2006
|
*/
|
|
1991
2007
|
declare function parseSignature(signature: string): ParsedSignature;
|
|
@@ -2103,6 +2119,8 @@ declare abstract class Command implements CommandInstance {
|
|
|
2103
2119
|
/**
|
|
2104
2120
|
* The command signature.
|
|
2105
2121
|
* Format: 'command:name {arg} {--option}'
|
|
2122
|
+
* Tokens may carry a description: 'command:name {arg : What it is}'
|
|
2123
|
+
* See `parseSignature` for the full grammar.
|
|
2106
2124
|
*/
|
|
2107
2125
|
static signature: string;
|
|
2108
2126
|
/**
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
logDevServerBanner,
|
|
3
3
|
parseImportMap,
|
|
4
4
|
startViteDevServer
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-SHYRVOMJ.js";
|
|
6
6
|
import {
|
|
7
7
|
PendingSchedule,
|
|
8
8
|
Schedule,
|
|
@@ -61,7 +61,7 @@ import {
|
|
|
61
61
|
getMailManager,
|
|
62
62
|
mail,
|
|
63
63
|
setMailManager
|
|
64
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-RNXTRWKL.js";
|
|
65
65
|
import {
|
|
66
66
|
MCP_ENDPOINT_PATH,
|
|
67
67
|
ProviderManager,
|
|
@@ -75,10 +75,14 @@ import {
|
|
|
75
75
|
Notification,
|
|
76
76
|
NotificationManager,
|
|
77
77
|
SlackChannel,
|
|
78
|
+
clearNotificationRegistry,
|
|
78
79
|
createNotificationManager,
|
|
80
|
+
getNotification,
|
|
79
81
|
getNotificationManager,
|
|
82
|
+
registerNotification,
|
|
83
|
+
resolveNotifiableType,
|
|
80
84
|
setNotificationManager
|
|
81
|
-
} from "./chunk-
|
|
85
|
+
} from "./chunk-5AD7LYWO.js";
|
|
82
86
|
import {
|
|
83
87
|
FailedJobReporter,
|
|
84
88
|
MemoryDriver,
|
|
@@ -90,7 +94,7 @@ import {
|
|
|
90
94
|
createQueueManager,
|
|
91
95
|
createSqsAdapter,
|
|
92
96
|
processJob
|
|
93
|
-
} from "./chunk-
|
|
97
|
+
} from "./chunk-Z3HXKWI6.js";
|
|
94
98
|
import {
|
|
95
99
|
Container,
|
|
96
100
|
Job,
|
|
@@ -102,9 +106,10 @@ import {
|
|
|
102
106
|
getRegisteredJobs,
|
|
103
107
|
registerJob,
|
|
104
108
|
resolve,
|
|
109
|
+
resolveJobName,
|
|
105
110
|
setContainer,
|
|
106
111
|
setQueueDriver
|
|
107
|
-
} from "./chunk-
|
|
112
|
+
} from "./chunk-6J6B5KOB.js";
|
|
108
113
|
import {
|
|
109
114
|
createRedisClient
|
|
110
115
|
} from "./chunk-UY3AZSYL.js";
|
|
@@ -883,7 +888,8 @@ function defineModule(definition) {
|
|
|
883
888
|
name: definition.name,
|
|
884
889
|
prefix: definition.prefix,
|
|
885
890
|
routes: definition.routes,
|
|
886
|
-
providers: definition.providers ?? []
|
|
891
|
+
providers: definition.providers ?? [],
|
|
892
|
+
commands: definition.commands ?? []
|
|
887
893
|
};
|
|
888
894
|
}
|
|
889
895
|
async function mountModuleRoutes(router, gurenModule) {
|
|
@@ -1991,6 +1997,7 @@ async function renderDocument(page, options) {
|
|
|
1991
1997
|
options,
|
|
1992
1998
|
page.component
|
|
1993
1999
|
);
|
|
2000
|
+
const headMarkup = resolveDocumentValue("head", options, page.component);
|
|
1994
2001
|
const ssrResult = await tryRenderSsr(page, options);
|
|
1995
2002
|
const headElements = (ssrResult?.head ?? []).map(normalizeHeadElement);
|
|
1996
2003
|
const hasCustomTitle = headElements.some(
|
|
@@ -2000,6 +2007,7 @@ async function renderDocument(page, options) {
|
|
|
2000
2007
|
'<meta charset="utf-8" />',
|
|
2001
2008
|
'<meta name="viewport" content="width=device-width, initial-scale=1" />',
|
|
2002
2009
|
hasCustomTitle ? "" : `<title>${title}</title>`,
|
|
2010
|
+
headMarkup ?? "",
|
|
2003
2011
|
// Both must precede the stylesheet links: they exist to settle the first
|
|
2004
2012
|
// paint before the app's own CSS arrives.
|
|
2005
2013
|
criticalCss ? `<style id="guren-critical">${criticalCss}</style>` : "",
|
|
@@ -3118,6 +3126,9 @@ var NotificationServiceProvider = class extends ServiceProvider {
|
|
|
3118
3126
|
register() {
|
|
3119
3127
|
this.container.singleton("notifications", () => createNotificationManager());
|
|
3120
3128
|
}
|
|
3129
|
+
boot() {
|
|
3130
|
+
this.container.make("notifications").registerQueueJob();
|
|
3131
|
+
}
|
|
3121
3132
|
};
|
|
3122
3133
|
|
|
3123
3134
|
// src/providers/BroadcastServiceProvider.ts
|
|
@@ -4932,26 +4943,84 @@ function cursorPaginate(items, perPage, hasMore, options) {
|
|
|
4932
4943
|
|
|
4933
4944
|
// src/console/Input.ts
|
|
4934
4945
|
function parseSignature(signature) {
|
|
4935
|
-
const
|
|
4936
|
-
const name = parts[0];
|
|
4946
|
+
const { name, tokens } = tokenizeSignature(signature);
|
|
4937
4947
|
const args = [];
|
|
4938
4948
|
const options = [];
|
|
4939
|
-
for (
|
|
4940
|
-
const
|
|
4941
|
-
if (!
|
|
4942
|
-
if (
|
|
4943
|
-
|
|
4944
|
-
}
|
|
4945
|
-
const content = part.slice(1, -1).trim();
|
|
4946
|
-
if (content.startsWith("--") || content.startsWith("-")) {
|
|
4947
|
-
options.push(parseOption(content));
|
|
4949
|
+
for (const token of tokens) {
|
|
4950
|
+
const [content, description] = splitSpacedDescription(token);
|
|
4951
|
+
if (!content) continue;
|
|
4952
|
+
if (content.startsWith("-")) {
|
|
4953
|
+
options.push(parseOption(content, description));
|
|
4948
4954
|
} else {
|
|
4949
|
-
args.push(parseArgument(content));
|
|
4955
|
+
args.push(parseArgument(content, description));
|
|
4950
4956
|
}
|
|
4951
4957
|
}
|
|
4952
4958
|
return { name, arguments: args, options };
|
|
4953
4959
|
}
|
|
4954
|
-
function
|
|
4960
|
+
function tokenizeSignature(signature) {
|
|
4961
|
+
const firstBrace = signature.indexOf("{");
|
|
4962
|
+
const head = firstBrace === -1 ? signature : signature.slice(0, firstBrace);
|
|
4963
|
+
const name = head.trim().split(/\s+/)[0];
|
|
4964
|
+
if (firstBrace === -1) {
|
|
4965
|
+
return { name, tokens: [] };
|
|
4966
|
+
}
|
|
4967
|
+
const tokens = [];
|
|
4968
|
+
let depth = 0;
|
|
4969
|
+
let start = -1;
|
|
4970
|
+
for (let i = firstBrace; i < signature.length; i++) {
|
|
4971
|
+
const char = signature[i];
|
|
4972
|
+
if (char === "{") {
|
|
4973
|
+
if (depth === 0) start = i;
|
|
4974
|
+
depth++;
|
|
4975
|
+
} else if (char === "}" && depth > 0) {
|
|
4976
|
+
depth--;
|
|
4977
|
+
if (depth === 0) {
|
|
4978
|
+
tokens.push(signature.slice(start + 1, i));
|
|
4979
|
+
}
|
|
4980
|
+
}
|
|
4981
|
+
}
|
|
4982
|
+
return { name, tokens };
|
|
4983
|
+
}
|
|
4984
|
+
var DESCRIPTION_SEPARATOR = /\s+:\s*|:\s+/;
|
|
4985
|
+
function splitSpacedDescription(token) {
|
|
4986
|
+
const match = DESCRIPTION_SEPARATOR.exec(token);
|
|
4987
|
+
if (!match) {
|
|
4988
|
+
return [token.trim(), void 0];
|
|
4989
|
+
}
|
|
4990
|
+
const content = token.slice(0, match.index).trim();
|
|
4991
|
+
const description = token.slice(match.index + match[0].length).trim();
|
|
4992
|
+
return [content, description || void 0];
|
|
4993
|
+
}
|
|
4994
|
+
function resolveNameAndDescription(name, description) {
|
|
4995
|
+
if (description === void 0) {
|
|
4996
|
+
const colonIndex = name.indexOf(":");
|
|
4997
|
+
if (colonIndex !== -1) {
|
|
4998
|
+
description = name.slice(colonIndex + 1).trim() || void 0;
|
|
4999
|
+
name = name.slice(0, colonIndex);
|
|
5000
|
+
}
|
|
5001
|
+
}
|
|
5002
|
+
return { name: name.trim(), description };
|
|
5003
|
+
}
|
|
5004
|
+
function argumentLabel(arg) {
|
|
5005
|
+
return arg.array ? `${arg.name}...` : arg.name;
|
|
5006
|
+
}
|
|
5007
|
+
function optionLabel(opt) {
|
|
5008
|
+
if (opt.array) return `--${opt.name}=<value>...`;
|
|
5009
|
+
if (opt.requiresValue) return `--${opt.name}=<value>`;
|
|
5010
|
+
return `--${opt.name}`;
|
|
5011
|
+
}
|
|
5012
|
+
function formatUsage(parsed) {
|
|
5013
|
+
const parts = [parsed.name];
|
|
5014
|
+
if (parsed.options.length > 0) {
|
|
5015
|
+
parts.push("[options]");
|
|
5016
|
+
}
|
|
5017
|
+
for (const arg of parsed.arguments) {
|
|
5018
|
+
const label = argumentLabel(arg);
|
|
5019
|
+
parts.push(arg.required ? `<${label}>` : `[${label}]`);
|
|
5020
|
+
}
|
|
5021
|
+
return parts.join(" ");
|
|
5022
|
+
}
|
|
5023
|
+
function parseArgument(content, description) {
|
|
4955
5024
|
let name = content;
|
|
4956
5025
|
let required2 = true;
|
|
4957
5026
|
let array2 = false;
|
|
@@ -4970,15 +5039,14 @@ function parseArgument(content) {
|
|
|
4970
5039
|
name = name.slice(0, eqIndex);
|
|
4971
5040
|
required2 = false;
|
|
4972
5041
|
}
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
}
|
|
4979
|
-
return { name, description, required: required2, array: array2, defaultValue };
|
|
5042
|
+
return {
|
|
5043
|
+
...resolveNameAndDescription(name, description),
|
|
5044
|
+
required: required2,
|
|
5045
|
+
array: array2,
|
|
5046
|
+
defaultValue
|
|
5047
|
+
};
|
|
4980
5048
|
}
|
|
4981
|
-
function parseOption(content) {
|
|
5049
|
+
function parseOption(content, description) {
|
|
4982
5050
|
let name = content;
|
|
4983
5051
|
let shortcut;
|
|
4984
5052
|
let requiresValue = false;
|
|
@@ -5005,16 +5073,16 @@ function parseOption(content) {
|
|
|
5005
5073
|
requiresValue = true;
|
|
5006
5074
|
}
|
|
5007
5075
|
}
|
|
5008
|
-
let description;
|
|
5009
|
-
const colonIndex = name.indexOf(":");
|
|
5010
|
-
if (colonIndex !== -1) {
|
|
5011
|
-
description = name.slice(colonIndex + 1);
|
|
5012
|
-
name = name.slice(0, colonIndex);
|
|
5013
|
-
}
|
|
5014
5076
|
if (!requiresValue && defaultValue === void 0) {
|
|
5015
5077
|
defaultValue = false;
|
|
5016
5078
|
}
|
|
5017
|
-
return {
|
|
5079
|
+
return {
|
|
5080
|
+
...resolveNameAndDescription(name, description),
|
|
5081
|
+
shortcut,
|
|
5082
|
+
requiresValue,
|
|
5083
|
+
defaultValue,
|
|
5084
|
+
array: array2
|
|
5085
|
+
};
|
|
5018
5086
|
}
|
|
5019
5087
|
var Input = class {
|
|
5020
5088
|
/**
|
|
@@ -5218,6 +5286,8 @@ var Command = class {
|
|
|
5218
5286
|
/**
|
|
5219
5287
|
* The command signature.
|
|
5220
5288
|
* Format: 'command:name {arg} {--option}'
|
|
5289
|
+
* Tokens may carry a description: 'command:name {arg : What it is}'
|
|
5290
|
+
* See `parseSignature` for the full grammar.
|
|
5221
5291
|
*/
|
|
5222
5292
|
static signature;
|
|
5223
5293
|
/**
|
|
@@ -5746,6 +5816,13 @@ var BufferedOutput = class extends Output {
|
|
|
5746
5816
|
};
|
|
5747
5817
|
|
|
5748
5818
|
// src/console/ConsoleKernel.ts
|
|
5819
|
+
function helpColumn(labels, min2) {
|
|
5820
|
+
return Math.max(min2, ...labels.map((label) => label.length + 2));
|
|
5821
|
+
}
|
|
5822
|
+
function helpRow(output, indent, label, column, annotations) {
|
|
5823
|
+
const padding = " ".repeat(Math.max(2, column - label.length));
|
|
5824
|
+
output.line(`${indent}${label}${padding}${annotations.filter(Boolean).join(" ")}`);
|
|
5825
|
+
}
|
|
5749
5826
|
var ConsoleKernel = class {
|
|
5750
5827
|
/**
|
|
5751
5828
|
* Registered commands.
|
|
@@ -5858,15 +5935,23 @@ var ConsoleKernel = class {
|
|
|
5858
5935
|
this.output.line("");
|
|
5859
5936
|
this.output.info("Available Commands:");
|
|
5860
5937
|
this.output.line("");
|
|
5861
|
-
const
|
|
5862
|
-
|
|
5863
|
-
|
|
5864
|
-
|
|
5938
|
+
const groups = Array.from(this.groupCommands(), ([namespace, commands]) => ({
|
|
5939
|
+
namespace,
|
|
5940
|
+
entries: Array.from(commands, ([name, cmd]) => ({
|
|
5941
|
+
label: namespace ? name.slice(namespace.length + 1) : name,
|
|
5942
|
+
description: cmd.description
|
|
5943
|
+
}))
|
|
5944
|
+
}));
|
|
5945
|
+
const column = helpColumn(
|
|
5946
|
+
groups.flatMap((group) => group.entries.map((entry) => entry.label)),
|
|
5947
|
+
20
|
|
5948
|
+
);
|
|
5949
|
+
for (const group of groups) {
|
|
5950
|
+
if (group.namespace) {
|
|
5951
|
+
this.output.line(` ${group.namespace}`);
|
|
5865
5952
|
}
|
|
5866
|
-
for (const
|
|
5867
|
-
|
|
5868
|
-
const padding = " ".repeat(Math.max(2, 20 - displayName.length));
|
|
5869
|
-
this.output.line(` ${displayName}${padding}${cmd.description}`);
|
|
5953
|
+
for (const entry of group.entries) {
|
|
5954
|
+
helpRow(this.output, " ", entry.label, column, [entry.description]);
|
|
5870
5955
|
}
|
|
5871
5956
|
this.output.line("");
|
|
5872
5957
|
}
|
|
@@ -5886,23 +5971,34 @@ var ConsoleKernel = class {
|
|
|
5886
5971
|
this.output.line("");
|
|
5887
5972
|
this.output.line(` ${CommandClass.description || "No description"}`);
|
|
5888
5973
|
this.output.line("");
|
|
5889
|
-
this.output.line(`Usage: ${
|
|
5974
|
+
this.output.line(`Usage: ${formatUsage(parsed)}`);
|
|
5975
|
+
const optionShortcut = (opt) => opt.shortcut ? `-${opt.shortcut}, ` : " ";
|
|
5976
|
+
const column = helpColumn(
|
|
5977
|
+
[
|
|
5978
|
+
...parsed.arguments.map(argumentLabel),
|
|
5979
|
+
...parsed.options.map((opt) => optionShortcut(opt) + optionLabel(opt))
|
|
5980
|
+
],
|
|
5981
|
+
24
|
|
5982
|
+
);
|
|
5890
5983
|
if (parsed.arguments.length > 0) {
|
|
5891
5984
|
this.output.line("");
|
|
5892
5985
|
this.output.line("Arguments:");
|
|
5893
5986
|
for (const arg of parsed.arguments) {
|
|
5894
|
-
|
|
5895
|
-
|
|
5896
|
-
|
|
5987
|
+
helpRow(this.output, " ", argumentLabel(arg), column, [
|
|
5988
|
+
arg.description,
|
|
5989
|
+
arg.required ? "(required)" : "(optional)",
|
|
5990
|
+
arg.defaultValue ? `[default: ${arg.defaultValue}]` : void 0
|
|
5991
|
+
]);
|
|
5897
5992
|
}
|
|
5898
5993
|
}
|
|
5899
5994
|
if (parsed.options.length > 0) {
|
|
5900
5995
|
this.output.line("");
|
|
5901
5996
|
this.output.line("Options:");
|
|
5902
5997
|
for (const opt of parsed.options) {
|
|
5903
|
-
|
|
5904
|
-
|
|
5905
|
-
|
|
5998
|
+
helpRow(this.output, " ", optionShortcut(opt) + optionLabel(opt), column, [
|
|
5999
|
+
opt.description,
|
|
6000
|
+
opt.defaultValue !== void 0 && opt.defaultValue !== false ? `[default: ${opt.defaultValue}]` : void 0
|
|
6001
|
+
]);
|
|
5906
6002
|
}
|
|
5907
6003
|
}
|
|
5908
6004
|
this.output.line("");
|
|
@@ -6659,6 +6755,7 @@ export {
|
|
|
6659
6755
|
cannot,
|
|
6660
6756
|
check as checkHash,
|
|
6661
6757
|
clearJobRegistry,
|
|
6758
|
+
clearNotificationRegistry,
|
|
6662
6759
|
collect,
|
|
6663
6760
|
completeEmailVerification,
|
|
6664
6761
|
completePasswordReset,
|
|
@@ -6756,6 +6853,7 @@ export {
|
|
|
6756
6853
|
getMailManager,
|
|
6757
6854
|
getNextOccurrence,
|
|
6758
6855
|
getNextOccurrences,
|
|
6856
|
+
getNotification,
|
|
6759
6857
|
getNotificationManager,
|
|
6760
6858
|
getPluralizationRule,
|
|
6761
6859
|
getQueueDriver,
|
|
@@ -6818,6 +6916,7 @@ export {
|
|
|
6818
6916
|
randomString,
|
|
6819
6917
|
regex,
|
|
6820
6918
|
registerJob,
|
|
6919
|
+
registerNotification,
|
|
6821
6920
|
renderDebugPage,
|
|
6822
6921
|
renderErrorPage,
|
|
6823
6922
|
requestIdMiddleware,
|
|
@@ -6833,6 +6932,8 @@ export {
|
|
|
6833
6932
|
resetCalledSeeders,
|
|
6834
6933
|
resetRateLimit,
|
|
6835
6934
|
resolve,
|
|
6935
|
+
resolveJobName,
|
|
6936
|
+
resolveNotifiableType,
|
|
6836
6937
|
revokeAllApiTokens,
|
|
6837
6938
|
revokeApiToken,
|
|
6838
6939
|
same,
|
package/dist/lambda/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as hono_aws_lambda from 'hono/aws-lambda';
|
|
2
2
|
export { APIGatewayProxyResult, LambdaEvent } from 'hono/aws-lambda';
|
|
3
|
-
import { A as Application } from '../Application-
|
|
3
|
+
import { A as Application } from '../Application-Bi-olFMF.js';
|
|
4
4
|
import { S as Scheduler } from '../Scheduler-pZiT8i57.js';
|
|
5
|
-
import { C as ConsoleKernel } from '../ConsoleKernel-
|
|
5
|
+
import { C as ConsoleKernel } from '../ConsoleKernel-D0dkFt6u.js';
|
|
6
6
|
import 'hono';
|
|
7
7
|
import '../api-token-COQHXyM_.js';
|
|
8
8
|
import '../AuthManager-C84xF5ks.js';
|
package/dist/lambda/index.js
CHANGED
package/dist/mail/index.js
CHANGED
|
@@ -9,9 +9,9 @@ import {
|
|
|
9
9
|
getMailManager,
|
|
10
10
|
mail,
|
|
11
11
|
setMailManager
|
|
12
|
-
} from "../chunk-
|
|
13
|
-
import "../chunk-
|
|
14
|
-
import "../chunk-
|
|
12
|
+
} from "../chunk-RNXTRWKL.js";
|
|
13
|
+
import "../chunk-Z3HXKWI6.js";
|
|
14
|
+
import "../chunk-6J6B5KOB.js";
|
|
15
15
|
export {
|
|
16
16
|
LogTransport,
|
|
17
17
|
Mail,
|
package/dist/mcp/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
-
import { S as ServiceProvider } from '../Application-
|
|
2
|
+
import { S as ServiceProvider } from '../Application-Bi-olFMF.js';
|
|
3
3
|
import 'hono';
|
|
4
4
|
import '../api-token-COQHXyM_.js';
|
|
5
5
|
import '../AuthManager-C84xF5ks.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { ab as Notification, aa as Notifiable, ad as NotificationChannel, B as DatabaseNotification, z as DatabaseChannelOptions, aJ as SlackMessage, aA as SentNotification } from '../Application-Bi-olFMF.js';
|
|
2
|
+
export { ac as NotificationAttachment, ae as NotificationChannelFactory, af as NotificationClass, ag as NotificationMailMessage, N as NotificationManager, ah as NotificationManagerOptions, aH as SlackAttachment, aI as SlackBlock, aX as createNotificationManager, b6 as getNotificationManager, bl as setNotificationManager } from '../Application-Bi-olFMF.js';
|
|
3
3
|
import { M as MailManager } from '../MailManager-DpMvYiP9.js';
|
|
4
4
|
import 'hono';
|
|
5
5
|
import '../api-token-COQHXyM_.js';
|
|
@@ -18,6 +18,55 @@ import '../HealthManager-DUyMIzsZ.js';
|
|
|
18
18
|
import '../Scheduler-pZiT8i57.js';
|
|
19
19
|
import '../Gate-CynjZCtS.js';
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* A notification class usable for queue reconstruction.
|
|
23
|
+
*
|
|
24
|
+
* Only the prototype and name are required: queued notifications are rebuilt
|
|
25
|
+
* with `Object.create(prototype)` and never constructed, so classes with
|
|
26
|
+
* required constructor arguments are supported.
|
|
27
|
+
*/
|
|
28
|
+
interface NotificationConstructor {
|
|
29
|
+
readonly name: string;
|
|
30
|
+
readonly prototype: Notification;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Register a notification class so queued instances can be rebuilt.
|
|
34
|
+
*
|
|
35
|
+
* Notifications are registered automatically when they are queued, which
|
|
36
|
+
* covers delivery by a worker running in the same process. A worker running
|
|
37
|
+
* in a separate process must register them explicitly at boot.
|
|
38
|
+
*
|
|
39
|
+
* Type names must be unique within an application: as with the job registry,
|
|
40
|
+
* registering a second class under an existing type replaces the first.
|
|
41
|
+
*
|
|
42
|
+
* @param notificationClass - The notification class to register
|
|
43
|
+
* @param type - Registry key, defaulting to the class's own `type` value
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```typescript
|
|
47
|
+
* registerNotification(OrderShipped)
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
declare function registerNotification(notificationClass: NotificationConstructor, type?: string): void;
|
|
51
|
+
/**
|
|
52
|
+
* Get a registered notification class by type.
|
|
53
|
+
*/
|
|
54
|
+
declare function getNotification(type: string): NotificationConstructor | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Clear all registered notifications (for testing).
|
|
57
|
+
*/
|
|
58
|
+
declare function clearNotificationRegistry(): void;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Resolve the stable type name of a notifiable.
|
|
62
|
+
*
|
|
63
|
+
* Channels that record which entity a notification belongs to should use this
|
|
64
|
+
* rather than reading `constructor.name` directly: a notifiable rebuilt from a
|
|
65
|
+
* queue payload carries its original name in `notifiableType`, and its
|
|
66
|
+
* constructor is a plain object.
|
|
67
|
+
*/
|
|
68
|
+
declare function resolveNotifiableType(notifiable: Notifiable): string;
|
|
69
|
+
|
|
21
70
|
/**
|
|
22
71
|
* Mail notification channel.
|
|
23
72
|
*
|
|
@@ -270,4 +319,4 @@ declare class MemoryChannel implements NotificationChannel {
|
|
|
270
319
|
clear(): void;
|
|
271
320
|
}
|
|
272
321
|
|
|
273
|
-
export { DatabaseChannel, DatabaseChannelOptions, DatabaseNotification, MailChannel, type MailChannelOptions, MemoryChannel, Notifiable, Notification, NotificationChannel, SentNotification, SlackChannel, type SlackChannelOptions, SlackMessage };
|
|
322
|
+
export { DatabaseChannel, DatabaseChannelOptions, DatabaseNotification, MailChannel, type MailChannelOptions, MemoryChannel, Notifiable, Notification, NotificationChannel, type NotificationConstructor, SentNotification, SlackChannel, type SlackChannelOptions, SlackMessage, clearNotificationRegistry, getNotification, registerNotification, resolveNotifiableType };
|