@guren/server 1.5.0 → 2.1.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/{AuthManager-C84xF5ks.d.ts → AuthManager-DBP4KYsx.d.ts} +1 -1
- package/dist/{ConsoleKernel-D0dkFt6u.d.ts → ConsoleKernel-CJg975mp.d.ts} +1 -1
- package/dist/DocsViewerServiceProvider-D7RGJPGM.js +75 -0
- package/dist/{I18nManager-CmUqj6bU.d.ts → I18nManager-BiSoczfV.d.ts} +1 -1
- package/dist/McpServiceProvider-7BB5FPF3.js +8 -0
- package/dist/auth/index.d.ts +39 -29
- package/dist/auth/index.js +2 -2
- package/dist/broadcasting/index.js +2 -2
- package/dist/cache/index.js +2 -2
- package/dist/chunk-2V3YID4H.js +20 -0
- package/dist/chunk-AZOYI43J.js +18 -0
- package/dist/{chunk-DCYKSYAT.js → chunk-B5E5VBDI.js} +54 -2
- package/dist/{chunk-NYQGAWDN.js → chunk-BZMZEFRG.js} +7 -11
- package/dist/{chunk-4SBGSJNT.js → chunk-CWI4AJ47.js} +2 -1
- package/dist/{chunk-NQCZQAJL.js → chunk-DSDX3ASM.js} +21 -2
- package/dist/{chunk-SHYRVOMJ.js → chunk-EARA7JM4.js} +3 -3
- package/dist/{chunk-MC752CQT.js → chunk-EI5GYMAT.js} +2 -1
- package/dist/{chunk-AUXQISW5.js → chunk-HONCNQXZ.js} +38 -5
- package/dist/{chunk-CSRQTEQA.js → chunk-HWEWL6TE.js} +6 -1
- package/dist/chunk-JBG4AR24.js +18 -0
- package/dist/{chunk-RNXTRWKL.js → chunk-K6CUBJX6.js} +9 -15
- package/dist/{chunk-Z3HXKWI6.js → chunk-KTNJG7R7.js} +4 -0
- package/dist/{chunk-74HTZG3V.js → chunk-LAJQCSSF.js} +24 -0
- package/dist/{chunk-H32L2NE3.js → chunk-LVJCZCAV.js} +20 -13
- package/dist/{chunk-5AD7LYWO.js → chunk-N7PLD7MB.js} +9 -8
- package/dist/{chunk-ONSDE37A.js → chunk-SFQP6O52.js} +1 -0
- package/dist/{chunk-XMQZENBP.js → chunk-TVY72CLV.js} +3 -1
- package/dist/chunk-WIXGT4TN.js +18 -0
- package/dist/{email-verification-H_WlpsVH.d.ts → email-verification-D60YF2ZO.d.ts} +5 -3
- package/dist/encryption/index.js +2 -2
- package/dist/events/index.js +1 -1
- package/dist/i18n/index.d.ts +2 -2
- package/dist/index.d.ts +333 -333
- package/dist/index.js +242 -88
- package/dist/lambda/index.d.ts +5 -5
- package/dist/mail/index.js +3 -2
- package/dist/mcp/index.d.ts +14 -4
- package/dist/mcp/index.js +3 -2
- package/dist/notifications/index.d.ts +5 -5
- package/dist/notifications/index.js +3 -2
- package/dist/queue/index.d.ts +5 -5
- package/dist/queue/index.js +1 -1
- package/dist/redis/index.d.ts +4 -4
- package/dist/redis/index.js +7 -0
- package/dist/runtime/index.d.ts +5 -5
- package/dist/runtime/index.js +24 -9
- package/dist/scheduling/index.js +2 -2
- package/dist/storage/index.js +2 -1
- package/dist/{Application-Bi-olFMF.d.ts → validation-yAL53e1S.d.ts} +776 -721
- package/package.json +3 -3
- package/dist/McpServiceProvider-TZWQWXCT.js +0 -7
- package/dist/{api-token-COQHXyM_.d.ts → api-token-D24VPr_E.d.ts} +101 -101
- package/dist/{client-BQwF2b9Y.d.ts → rate-limit-D9J2b4S1.d.ts} +36 -36
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createLoopbackGuard
|
|
3
|
+
} from "./chunk-BZMZEFRG.js";
|
|
4
|
+
|
|
5
|
+
// src/mcp/endpoint.ts
|
|
6
|
+
var MCP_ENDPOINT_PATH = "/_guren/mcp";
|
|
7
|
+
function isMcpEndpointEnabled() {
|
|
8
|
+
return typeof process !== "undefined" && process.env?.NODE_ENV !== "production" && process.env?.GUREN_MCP === "1";
|
|
9
|
+
}
|
|
10
|
+
function createMcpAccessGuard() {
|
|
11
|
+
return createLoopbackGuard("the MCP endpoint");
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export {
|
|
15
|
+
MCP_ENDPOINT_PATH,
|
|
16
|
+
isMcpEndpointEnabled,
|
|
17
|
+
createMcpAccessGuard
|
|
18
|
+
};
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
parseMailAddress
|
|
3
|
+
} from "./chunk-2V3YID4H.js";
|
|
1
4
|
import {
|
|
2
5
|
Job,
|
|
3
6
|
getQueueDriver,
|
|
@@ -417,16 +420,6 @@ function createMailManager(config) {
|
|
|
417
420
|
}
|
|
418
421
|
|
|
419
422
|
// src/mail/Mail.ts
|
|
420
|
-
function parseAddress(input) {
|
|
421
|
-
if (typeof input === "string") {
|
|
422
|
-
const match = input.match(/^(.+)\s*<(.+)>$/);
|
|
423
|
-
if (match) {
|
|
424
|
-
return { name: match[1].trim(), email: match[2].trim() };
|
|
425
|
-
}
|
|
426
|
-
return { email: input };
|
|
427
|
-
}
|
|
428
|
-
return input;
|
|
429
|
-
}
|
|
430
423
|
var Mail = class {
|
|
431
424
|
constructor(manager) {
|
|
432
425
|
this.manager = manager;
|
|
@@ -435,6 +428,7 @@ var Mail = class {
|
|
|
435
428
|
this.message.from = defaultFrom;
|
|
436
429
|
}
|
|
437
430
|
}
|
|
431
|
+
manager;
|
|
438
432
|
message = {
|
|
439
433
|
to: [],
|
|
440
434
|
cc: [],
|
|
@@ -446,14 +440,14 @@ var Mail = class {
|
|
|
446
440
|
* Set the sender address.
|
|
447
441
|
*/
|
|
448
442
|
from(address) {
|
|
449
|
-
this.message.from =
|
|
443
|
+
this.message.from = parseMailAddress(address);
|
|
450
444
|
return this;
|
|
451
445
|
}
|
|
452
446
|
/**
|
|
453
447
|
* Add a recipient.
|
|
454
448
|
*/
|
|
455
449
|
to(address) {
|
|
456
|
-
this.message.to.push(
|
|
450
|
+
this.message.to.push(parseMailAddress(address));
|
|
457
451
|
return this;
|
|
458
452
|
}
|
|
459
453
|
/**
|
|
@@ -469,21 +463,21 @@ var Mail = class {
|
|
|
469
463
|
* Add a CC recipient.
|
|
470
464
|
*/
|
|
471
465
|
cc(address) {
|
|
472
|
-
this.message.cc.push(
|
|
466
|
+
this.message.cc.push(parseMailAddress(address));
|
|
473
467
|
return this;
|
|
474
468
|
}
|
|
475
469
|
/**
|
|
476
470
|
* Add a BCC recipient.
|
|
477
471
|
*/
|
|
478
472
|
bcc(address) {
|
|
479
|
-
this.message.bcc.push(
|
|
473
|
+
this.message.bcc.push(parseMailAddress(address));
|
|
480
474
|
return this;
|
|
481
475
|
}
|
|
482
476
|
/**
|
|
483
477
|
* Set the reply-to address.
|
|
484
478
|
*/
|
|
485
479
|
replyTo(address) {
|
|
486
|
-
this.message.replyTo =
|
|
480
|
+
this.message.replyTo = parseMailAddress(address);
|
|
487
481
|
return this;
|
|
488
482
|
}
|
|
489
483
|
/**
|
|
@@ -198,6 +198,7 @@ var RedisDriver = class {
|
|
|
198
198
|
this.prefix = options.prefix ?? "queue:";
|
|
199
199
|
this.visibilityTimeout = options.visibilityTimeout ?? 6e4;
|
|
200
200
|
}
|
|
201
|
+
redis;
|
|
201
202
|
prefix;
|
|
202
203
|
visibilityTimeout;
|
|
203
204
|
pendingKey(queue) {
|
|
@@ -623,6 +624,9 @@ var Worker = class {
|
|
|
623
624
|
this.timeout = options.timeout ?? 6e4;
|
|
624
625
|
this.stopWhenEmpty = options.stopWhenEmpty ?? false;
|
|
625
626
|
}
|
|
627
|
+
driver;
|
|
628
|
+
options;
|
|
629
|
+
events;
|
|
626
630
|
running = false;
|
|
627
631
|
shouldStop = false;
|
|
628
632
|
processedJobs = 0;
|
|
@@ -257,6 +257,9 @@ var RequestReceived = class extends Event {
|
|
|
257
257
|
this.path = path;
|
|
258
258
|
this.requestId = requestId;
|
|
259
259
|
}
|
|
260
|
+
method;
|
|
261
|
+
path;
|
|
262
|
+
requestId;
|
|
260
263
|
};
|
|
261
264
|
var RequestFinished = class extends Event {
|
|
262
265
|
constructor(method, path, status, durationMs, requestId) {
|
|
@@ -267,6 +270,11 @@ var RequestFinished = class extends Event {
|
|
|
267
270
|
this.durationMs = durationMs;
|
|
268
271
|
this.requestId = requestId;
|
|
269
272
|
}
|
|
273
|
+
method;
|
|
274
|
+
path;
|
|
275
|
+
status;
|
|
276
|
+
durationMs;
|
|
277
|
+
requestId;
|
|
270
278
|
};
|
|
271
279
|
var UserAuthenticated = class extends Event {
|
|
272
280
|
constructor(userId, guard = "default") {
|
|
@@ -274,6 +282,8 @@ var UserAuthenticated = class extends Event {
|
|
|
274
282
|
this.userId = userId;
|
|
275
283
|
this.guard = guard;
|
|
276
284
|
}
|
|
285
|
+
userId;
|
|
286
|
+
guard;
|
|
277
287
|
};
|
|
278
288
|
var UserLoggedOut = class extends Event {
|
|
279
289
|
constructor(userId, guard = "default") {
|
|
@@ -281,6 +291,8 @@ var UserLoggedOut = class extends Event {
|
|
|
281
291
|
this.userId = userId;
|
|
282
292
|
this.guard = guard;
|
|
283
293
|
}
|
|
294
|
+
userId;
|
|
295
|
+
guard;
|
|
284
296
|
};
|
|
285
297
|
var JobProcessed = class extends Event {
|
|
286
298
|
constructor(jobId, jobName, queue, durationMs) {
|
|
@@ -290,6 +302,10 @@ var JobProcessed = class extends Event {
|
|
|
290
302
|
this.queue = queue;
|
|
291
303
|
this.durationMs = durationMs;
|
|
292
304
|
}
|
|
305
|
+
jobId;
|
|
306
|
+
jobName;
|
|
307
|
+
queue;
|
|
308
|
+
durationMs;
|
|
293
309
|
};
|
|
294
310
|
var JobFailed = class extends Event {
|
|
295
311
|
constructor(jobId, jobName, queue, error, attempts) {
|
|
@@ -300,6 +316,11 @@ var JobFailed = class extends Event {
|
|
|
300
316
|
this.error = error;
|
|
301
317
|
this.attempts = attempts;
|
|
302
318
|
}
|
|
319
|
+
jobId;
|
|
320
|
+
jobName;
|
|
321
|
+
queue;
|
|
322
|
+
error;
|
|
323
|
+
attempts;
|
|
303
324
|
};
|
|
304
325
|
var ApplicationStarted = class extends Event {
|
|
305
326
|
constructor(port, host) {
|
|
@@ -307,12 +328,15 @@ var ApplicationStarted = class extends Event {
|
|
|
307
328
|
this.port = port;
|
|
308
329
|
this.host = host;
|
|
309
330
|
}
|
|
331
|
+
port;
|
|
332
|
+
host;
|
|
310
333
|
};
|
|
311
334
|
var ApplicationShutdown = class extends Event {
|
|
312
335
|
constructor(reason) {
|
|
313
336
|
super();
|
|
314
337
|
this.reason = reason;
|
|
315
338
|
}
|
|
339
|
+
reason;
|
|
316
340
|
};
|
|
317
341
|
|
|
318
342
|
export {
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
MessageSigner,
|
|
3
3
|
generateAppKey,
|
|
4
4
|
normalizeAppKey
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-SFQP6O52.js";
|
|
6
6
|
|
|
7
7
|
// src/encryption/Encrypter.ts
|
|
8
8
|
import { createCipheriv, createDecipheriv, randomBytes, createHmac } from "crypto";
|
|
@@ -264,16 +264,28 @@ var CHARSETS = {
|
|
|
264
264
|
"base64": "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
|
|
265
265
|
"url-safe": "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"
|
|
266
266
|
};
|
|
267
|
-
function
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
267
|
+
function unbiasedRandomChars(length, chars) {
|
|
268
|
+
if (!Number.isInteger(length) || length < 0) {
|
|
269
|
+
throw new RangeError(`Random string length must be a non-negative integer, received ${length}.`);
|
|
270
|
+
}
|
|
271
|
+
const limit = 256 - 256 % chars.length;
|
|
271
272
|
let result = "";
|
|
272
|
-
|
|
273
|
-
|
|
273
|
+
while (result.length < length) {
|
|
274
|
+
const remaining = length - result.length;
|
|
275
|
+
const bytes = randomBytes2(Math.ceil(remaining * 256 / limit) + 8);
|
|
276
|
+
for (const byte of bytes) {
|
|
277
|
+
if (byte < limit) {
|
|
278
|
+
result += chars[byte % chars.length];
|
|
279
|
+
if (result.length === length) break;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
274
282
|
}
|
|
275
283
|
return result;
|
|
276
284
|
}
|
|
285
|
+
function randomString(length, options = {}) {
|
|
286
|
+
const { charset = "alphanumeric" } = options;
|
|
287
|
+
return unbiasedRandomChars(length, CHARSETS[charset]);
|
|
288
|
+
}
|
|
277
289
|
function random(length) {
|
|
278
290
|
return randomBytes2(length);
|
|
279
291
|
}
|
|
@@ -310,12 +322,7 @@ function generatePassword(length = 16, options = {}) {
|
|
|
310
322
|
if (chars.length === 0) {
|
|
311
323
|
chars = CHARSETS.alphanumeric;
|
|
312
324
|
}
|
|
313
|
-
|
|
314
|
-
let result = "";
|
|
315
|
-
for (let i = 0; i < length; i++) {
|
|
316
|
-
result += chars[bytes[i] % chars.length];
|
|
317
|
-
}
|
|
318
|
-
return result;
|
|
325
|
+
return unbiasedRandomChars(length, chars);
|
|
319
326
|
}
|
|
320
327
|
function generateOtp(length = 6) {
|
|
321
328
|
return randomString(length, { charset: "numeric" });
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
parseMailAddress
|
|
3
|
+
} from "./chunk-2V3YID4H.js";
|
|
1
4
|
import {
|
|
2
5
|
Job,
|
|
3
6
|
registerJob
|
|
@@ -365,14 +368,7 @@ function parseAddress(input) {
|
|
|
365
368
|
if (!input) {
|
|
366
369
|
return void 0;
|
|
367
370
|
}
|
|
368
|
-
|
|
369
|
-
return input;
|
|
370
|
-
}
|
|
371
|
-
const match = input.match(/^(.+)\s*<(.+)>$/);
|
|
372
|
-
if (match) {
|
|
373
|
-
return { name: match[1].trim(), email: match[2].trim() };
|
|
374
|
-
}
|
|
375
|
-
return { email: input };
|
|
371
|
+
return parseMailAddress(input);
|
|
376
372
|
}
|
|
377
373
|
function parseAddressList(input) {
|
|
378
374
|
if (!input) {
|
|
@@ -387,6 +383,8 @@ var MailChannel = class {
|
|
|
387
383
|
this.mailManager = mailManager;
|
|
388
384
|
this.options = options;
|
|
389
385
|
}
|
|
386
|
+
mailManager;
|
|
387
|
+
options;
|
|
390
388
|
name = "mail";
|
|
391
389
|
/**
|
|
392
390
|
* Send the notification via mail.
|
|
@@ -429,6 +427,7 @@ var DatabaseChannel = class {
|
|
|
429
427
|
constructor(options = {}) {
|
|
430
428
|
this.options = options;
|
|
431
429
|
}
|
|
430
|
+
options;
|
|
432
431
|
name = "database";
|
|
433
432
|
stored = [];
|
|
434
433
|
/**
|
|
@@ -503,6 +502,8 @@ var SlackChannel = class {
|
|
|
503
502
|
this.webhookUrl = webhookUrl;
|
|
504
503
|
this.options = options;
|
|
505
504
|
}
|
|
505
|
+
webhookUrl;
|
|
506
|
+
options;
|
|
506
507
|
name = "slack";
|
|
507
508
|
/**
|
|
508
509
|
* Send the notification to Slack.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
claimHotDisposable,
|
|
3
3
|
isHotReloadRuntime
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-B5E5VBDI.js";
|
|
5
5
|
|
|
6
6
|
// src/broadcasting/channels/Channel.ts
|
|
7
7
|
var Channel = class {
|
|
@@ -9,6 +9,8 @@ var Channel = class {
|
|
|
9
9
|
this.name = name;
|
|
10
10
|
this.driver = driver;
|
|
11
11
|
}
|
|
12
|
+
name;
|
|
13
|
+
driver;
|
|
12
14
|
/**
|
|
13
15
|
* Broadcast an event to this channel.
|
|
14
16
|
*/
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createLoopbackGuard
|
|
3
|
+
} from "./chunk-BZMZEFRG.js";
|
|
4
|
+
|
|
5
|
+
// src/docs-viewer/endpoint.ts
|
|
6
|
+
var DOCS_VIEWER_PATH = "/_guren/docs";
|
|
7
|
+
function isDocsViewerEnabled() {
|
|
8
|
+
return typeof process !== "undefined" && process.env?.NODE_ENV !== "production" && process.env?.GUREN_DOCS === "1";
|
|
9
|
+
}
|
|
10
|
+
function createDocsViewerAccessGuard() {
|
|
11
|
+
return createLoopbackGuard("the docs viewer");
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export {
|
|
15
|
+
DOCS_VIEWER_PATH,
|
|
16
|
+
isDocsViewerEnabled,
|
|
17
|
+
createDocsViewerAccessGuard
|
|
18
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as Authenticatable, U as UserProvider } from './api-token-
|
|
1
|
+
import { A as Authenticatable, U as UserProvider } from './api-token-D24VPr_E.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Hash a token using SHA-256 or SHA-512.
|
|
@@ -316,11 +316,13 @@ declare function isEmailVerified(user: {
|
|
|
316
316
|
*/
|
|
317
317
|
declare function requireVerifiedEmail(options?: {
|
|
318
318
|
redirectTo?: string;
|
|
319
|
-
getUser?: (ctx:
|
|
319
|
+
getUser?: (ctx: {
|
|
320
|
+
get: <T = unknown>(key: string) => T;
|
|
321
|
+
}) => Promise<{
|
|
320
322
|
emailVerifiedAt?: Date | null;
|
|
321
323
|
} | null>;
|
|
322
324
|
}): (ctx: {
|
|
323
|
-
get: (key: string) =>
|
|
325
|
+
get: <T = unknown>(key: string) => T;
|
|
324
326
|
redirect: (url: string) => Response;
|
|
325
327
|
}, next: () => Promise<void>) => Promise<Response | undefined>;
|
|
326
328
|
|
package/dist/encryption/index.js
CHANGED
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
urlSafeToken,
|
|
23
23
|
uuid,
|
|
24
24
|
verifySignedUrl
|
|
25
|
-
} from "../chunk-
|
|
25
|
+
} from "../chunk-LVJCZCAV.js";
|
|
26
26
|
import {
|
|
27
27
|
MessageSigner,
|
|
28
28
|
deriveAppKey,
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
normalizeAppKey,
|
|
34
34
|
parseAppKey,
|
|
35
35
|
parsePreviousAppKeys
|
|
36
|
-
} from "../chunk-
|
|
36
|
+
} from "../chunk-SFQP6O52.js";
|
|
37
37
|
import {
|
|
38
38
|
check,
|
|
39
39
|
hash,
|
package/dist/events/index.js
CHANGED
package/dist/i18n/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as PluralizationRule,
|
|
2
|
-
export { a as I18nConfig, I as I18nManager, R as ReplacementValues,
|
|
1
|
+
import { P as PluralizationRule, T as TranslationLoader, c as TranslationMessages } from '../I18nManager-BiSoczfV.js';
|
|
2
|
+
export { a as I18nConfig, I as I18nManager, R as ReplacementValues, b as TranslationLoaderFactory, d as Translator, e as TranslatorOptions, f as createI18n, g as getI18n, s as setI18n, t, h as tc } from '../I18nManager-BiSoczfV.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Default pluralization rules for common languages.
|