@guren/server 2.10.0 → 2.10.1

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.
Files changed (90) hide show
  1. package/dist/DocsViewerServiceProvider-qFCaeiUv.js +77 -0
  2. package/dist/Hash-CzrwKeDp.js +133 -0
  3. package/dist/HttpException-BkS3euNG.js +161 -0
  4. package/dist/Job-BVT813DO.js +441 -0
  5. package/dist/McpServiceProvider-BoAN-UcD.js +367 -0
  6. package/dist/MessageSigner-Bd25ZJAV.js +93 -0
  7. package/dist/Random-DbIJ22KQ.js +191 -0
  8. package/dist/address-D0Iq-XIH.js +20 -0
  9. package/dist/auth/index.js +2 -122
  10. package/dist/auth-C7sVmYgc.js +1954 -0
  11. package/dist/authorization/index.js +2 -38
  12. package/dist/authorization-Dbcuc5ZK.js +610 -0
  13. package/dist/broadcasting/index.js +2 -26
  14. package/dist/broadcasting-Dw-FhyjN.js +1055 -0
  15. package/dist/cache/index.js +2 -17
  16. package/dist/cache/types.d.ts +4 -4
  17. package/dist/cache-BYnZf2FR.js +812 -0
  18. package/dist/client-Dd7vLcqp.js +27 -0
  19. package/dist/console/Output.d.ts +18 -18
  20. package/dist/encryption/index.js +5 -96
  21. package/dist/encryption-fOWQaKqX.js +250 -0
  22. package/dist/endpoint-D-20PiHY.js +46 -0
  23. package/dist/endpoint-D6GIqOpe.js +31 -0
  24. package/dist/errors-quJOkkCn.js +81 -0
  25. package/dist/events/index.js +2 -28
  26. package/dist/events-aIH_bWRx.js +410 -0
  27. package/dist/health/index.js +2 -24
  28. package/dist/health-VWdWXRwh.js +345 -0
  29. package/dist/hot-disposables-WsTX2ySN.js +281 -0
  30. package/dist/hot-reload/testing.d.ts +1 -1
  31. package/dist/i18n/index.js +2 -30
  32. package/dist/i18n-mcWi7LCd.js +617 -0
  33. package/dist/index.js +7495 -7276
  34. package/dist/lambda/index.js +114 -71
  35. package/dist/logging/index.js +2 -24
  36. package/dist/logging-CPaRMuPP.js +518 -0
  37. package/dist/loopback-guard-D0Kc7-xc.js +224 -0
  38. package/dist/mail/index.js +2 -27
  39. package/dist/mail-DfEfSQEr.js +699 -0
  40. package/dist/mcp/index.js +2 -10
  41. package/dist/notifications/index.js +2 -33
  42. package/dist/notifications-BGqmUNZ8.js +759 -0
  43. package/dist/queue/index.js +3 -42
  44. package/dist/queue-CXrRK85G.js +948 -0
  45. package/dist/redis/index.js +672 -642
  46. package/dist/rolldown-runtime-8H4AJuhK.js +14 -0
  47. package/dist/runtime/index.js +472 -616
  48. package/dist/scheduling/index.js +2 -29
  49. package/dist/scheduling-CPiEdtQd.js +839 -0
  50. package/dist/storage/index.js +2 -15
  51. package/dist/storage-tWHMv2H_.js +841 -0
  52. package/dist/support/expiry.js +69 -12
  53. package/dist/trim-slashes-ZJ_VsY5s.js +25 -0
  54. package/dist/vite/index.js +118 -181
  55. package/dist/vite/plugin.d.ts +1 -1
  56. package/dist/vite-dev-server-CpCUqmiC.js +131 -0
  57. package/package.json +6 -5
  58. package/dist/DocsViewerServiceProvider-RUYDFBMW.js +0 -75
  59. package/dist/McpServiceProvider-SL7DUZ4G.js +0 -8
  60. package/dist/chunk-2SC566CD.js +0 -376
  61. package/dist/chunk-2V3YID4H.js +0 -20
  62. package/dist/chunk-3KV5X2FL.js +0 -31
  63. package/dist/chunk-63SKW5PS.js +0 -457
  64. package/dist/chunk-6J6B5KOB.js +0 -425
  65. package/dist/chunk-A5JJ7XTH.js +0 -24
  66. package/dist/chunk-AZOYI43J.js +0 -18
  67. package/dist/chunk-B5E5VBDI.js +0 -115
  68. package/dist/chunk-DAQKYKLH.js +0 -182
  69. package/dist/chunk-DRNPVBAA.js +0 -1002
  70. package/dist/chunk-EI5GYMAT.js +0 -853
  71. package/dist/chunk-H3B23O6T.js +0 -271
  72. package/dist/chunk-HPET6XY5.js +0 -853
  73. package/dist/chunk-HR2KZ3WL.js +0 -616
  74. package/dist/chunk-IOTWFHZU.js +0 -558
  75. package/dist/chunk-K6CUBJX6.js +0 -642
  76. package/dist/chunk-KTNJG7R7.js +0 -911
  77. package/dist/chunk-LAJQCSSF.js +0 -355
  78. package/dist/chunk-LHR6OHI7.js +0 -189
  79. package/dist/chunk-N7PLD7MB.js +0 -729
  80. package/dist/chunk-Q2P6YLRR.js +0 -24
  81. package/dist/chunk-QQKTH5KX.js +0 -114
  82. package/dist/chunk-SFQP6O52.js +0 -126
  83. package/dist/chunk-SQR7277M.js +0 -911
  84. package/dist/chunk-T2FFUU6J.js +0 -484
  85. package/dist/chunk-TVV5YNEC.js +0 -1842
  86. package/dist/chunk-UY3AZSYL.js +0 -14
  87. package/dist/chunk-V4DNC2ER.js +0 -114
  88. package/dist/chunk-VSA3QY5Q.js +0 -274
  89. package/dist/chunk-YSOJKAAU.js +0 -427
  90. package/dist/errors-PUNHAFL2.js +0 -34
@@ -1,86 +1,129 @@
1
- import {
2
- getJob
3
- } from "../chunk-6J6B5KOB.js";
4
-
5
- // src/lambda/index.ts
1
+ import { r as getJob } from "../Job-BVT813DO.js";
6
2
  import { handle } from "hono/aws-lambda";
3
+ //#region src/lambda/index.ts
4
+ /**
5
+ * Create an AWS Lambda handler from a booted Guren application.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * import app from './src/app'
10
+ * import { createLambdaHandler } from '@guren/server/lambda'
11
+ *
12
+ * await app.boot()
13
+ * export const handler = createLambdaHandler(app)
14
+ * ```
15
+ */
7
16
  function createLambdaHandler(app) {
8
- return handle(app.hono);
17
+ return handle(app.hono);
9
18
  }
19
+ /**
20
+ * Create an AWS Lambda handler for processing SQS queue jobs.
21
+ *
22
+ * Supports partial batch failure reporting — only failed messages
23
+ * are returned to SQS for retry, while successful ones are deleted.
24
+ *
25
+ * @example
26
+ * ```typescript
27
+ * import app from './src/app'
28
+ * import { createSqsHandler } from '@guren/server/lambda'
29
+ *
30
+ * await app.boot()
31
+ * export const queue = createSqsHandler()
32
+ * ```
33
+ */
10
34
  function createSqsHandler() {
11
- return async (event) => {
12
- const failures = [];
13
- const results = await Promise.allSettled(
14
- event.Records.map(async (record) => {
15
- const job = deserializeSqsJob(record.body);
16
- const JobClass = getJob(job.name);
17
- if (!JobClass) {
18
- throw new Error(`Job class not found: ${job.name}`);
19
- }
20
- const instance = new JobClass();
21
- job.attempts++;
22
- try {
23
- await instance.handle(job.payload);
24
- } catch (error) {
25
- if (job.attempts >= job.maxAttempts && instance.failed) {
26
- try {
27
- await instance.failed(job.payload, error);
28
- } catch {
29
- }
30
- }
31
- throw error;
32
- }
33
- })
34
- );
35
- for (let i = 0; i < results.length; i++) {
36
- if (results[i].status === "rejected") {
37
- failures.push({ itemIdentifier: event.Records[i].messageId });
38
- }
39
- }
40
- return { batchItemFailures: failures };
41
- };
35
+ return async (event) => {
36
+ const failures = [];
37
+ const results = await Promise.allSettled(event.Records.map(async (record) => {
38
+ const job = deserializeSqsJob(record.body);
39
+ const JobClass = getJob(job.name);
40
+ if (!JobClass) throw new Error(`Job class not found: ${job.name}`);
41
+ const instance = new JobClass();
42
+ job.attempts++;
43
+ try {
44
+ await instance.handle(job.payload);
45
+ } catch (error) {
46
+ if (job.attempts >= job.maxAttempts && instance.failed) try {
47
+ await instance.failed(job.payload, error);
48
+ } catch {}
49
+ throw error;
50
+ }
51
+ }));
52
+ for (let i = 0; i < results.length; i++) if (results[i].status === "rejected") failures.push({ itemIdentifier: event.Records[i].messageId });
53
+ return { batchItemFailures: failures };
54
+ };
42
55
  }
56
+ /**
57
+ * Create an AWS Lambda handler for running scheduled tasks via EventBridge.
58
+ *
59
+ * @example
60
+ * ```typescript
61
+ * import { createScheduleHandler } from '@guren/server/lambda'
62
+ * import { scheduler } from './src/scheduler'
63
+ *
64
+ * export const schedule = createScheduleHandler(scheduler)
65
+ * ```
66
+ */
43
67
  function createScheduleHandler(scheduler) {
44
- return async () => {
45
- await scheduler.runDueTasks();
46
- };
68
+ return async () => {
69
+ await scheduler.runDueTasks();
70
+ };
47
71
  }
72
+ /**
73
+ * Create an AWS Lambda handler for running console commands.
74
+ *
75
+ * Invoke via AWS CLI, SDK, or EventBridge with a JSON payload:
76
+ * `{ "command": "db:migrate" }`
77
+ *
78
+ * @example
79
+ * ```typescript
80
+ * import { createConsoleHandler } from '@guren/server/lambda'
81
+ * import { kernel } from './src/console'
82
+ *
83
+ * export const console = createConsoleHandler(kernel)
84
+ * ```
85
+ */
48
86
  function createConsoleHandler(kernel) {
49
- return async (event) => {
50
- const argv = event.command.split(/\s+/).filter(Boolean);
51
- const exitCode = await kernel.handle(argv);
52
- return { exitCode };
53
- };
87
+ return async (event) => {
88
+ const argv = event.command.split(/\s+/).filter(Boolean);
89
+ return { exitCode: await kernel.handle(argv) };
90
+ };
54
91
  }
92
+ /**
93
+ * Detect if the current process is running inside AWS Lambda.
94
+ *
95
+ * Checks for the `AWS_LAMBDA_FUNCTION_NAME` environment variable,
96
+ * which AWS sets automatically in all Lambda runtimes.
97
+ */
55
98
  function isLambda() {
56
- return typeof process !== "undefined" && !!process.env?.AWS_LAMBDA_FUNCTION_NAME;
99
+ return typeof process !== "undefined" && !!process.env?.AWS_LAMBDA_FUNCTION_NAME;
57
100
  }
101
+ /**
102
+ * Get Lambda environment metadata, or null if not running on Lambda.
103
+ */
58
104
  function getLambdaContext() {
59
- if (!isLambda()) return null;
60
- return {
61
- functionName: process.env.AWS_LAMBDA_FUNCTION_NAME,
62
- functionVersion: process.env.AWS_LAMBDA_FUNCTION_VERSION ?? "$LATEST",
63
- memorySize: parseInt(process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE ?? "128", 10),
64
- region: process.env.AWS_REGION ?? process.env.AWS_DEFAULT_REGION ?? "us-east-1",
65
- logGroup: process.env.AWS_LAMBDA_LOG_GROUP_NAME,
66
- logStream: process.env.AWS_LAMBDA_LOG_STREAM_NAME,
67
- tmpDir: "/tmp"
68
- };
105
+ if (!isLambda()) return null;
106
+ return {
107
+ functionName: process.env.AWS_LAMBDA_FUNCTION_NAME,
108
+ functionVersion: process.env.AWS_LAMBDA_FUNCTION_VERSION ?? "$LATEST",
109
+ memorySize: parseInt(process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE ?? "128", 10),
110
+ region: process.env.AWS_REGION ?? process.env.AWS_DEFAULT_REGION ?? "us-east-1",
111
+ logGroup: process.env.AWS_LAMBDA_LOG_GROUP_NAME,
112
+ logStream: process.env.AWS_LAMBDA_LOG_STREAM_NAME,
113
+ tmpDir: "/tmp"
114
+ };
69
115
  }
116
+ /**
117
+ * Deserialize a JSON SQS message body into a QueuedJob-like object.
118
+ */
70
119
  function deserializeSqsJob(body) {
71
- const raw = JSON.parse(body);
72
- return {
73
- ...raw,
74
- availableAt: new Date(raw.availableAt),
75
- createdAt: new Date(raw.createdAt),
76
- reservedAt: raw.reservedAt ? new Date(raw.reservedAt) : null
77
- };
120
+ const raw = JSON.parse(body);
121
+ return {
122
+ ...raw,
123
+ availableAt: new Date(raw.availableAt),
124
+ createdAt: new Date(raw.createdAt),
125
+ reservedAt: raw.reservedAt ? new Date(raw.reservedAt) : null
126
+ };
78
127
  }
79
- export {
80
- createConsoleHandler,
81
- createLambdaHandler,
82
- createScheduleHandler,
83
- createSqsHandler,
84
- getLambdaContext,
85
- isLambda
86
- };
128
+ //#endregion
129
+ export { createConsoleHandler, createLambdaHandler, createScheduleHandler, createSqsHandler, getLambdaContext, isLambda };
@@ -1,24 +1,2 @@
1
- import {
2
- ConsoleChannel,
3
- DailyFileChannel,
4
- FileChannel,
5
- LOG_LEVEL_PRIORITY,
6
- LogManager,
7
- Logger,
8
- createLogManager,
9
- filterSensitiveData,
10
- getLogManager,
11
- setLogManager
12
- } from "../chunk-IOTWFHZU.js";
13
- export {
14
- ConsoleChannel,
15
- DailyFileChannel,
16
- FileChannel,
17
- LOG_LEVEL_PRIORITY,
18
- LogManager,
19
- Logger,
20
- createLogManager,
21
- filterSensitiveData,
22
- getLogManager,
23
- setLogManager
24
- };
1
+ import { a as DailyFileChannel, c as Logger, i as setLogManager, l as filterSensitiveData, n as createLogManager, o as FileChannel, r as getLogManager, s as ConsoleChannel, t as LogManager, u as LOG_LEVEL_PRIORITY } from "../logging-CPaRMuPP.js";
2
+ export { ConsoleChannel, DailyFileChannel, FileChannel, LOG_LEVEL_PRIORITY, LogManager, Logger, createLogManager, filterSensitiveData, getLogManager, setLogManager };