@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.
- package/dist/DocsViewerServiceProvider-qFCaeiUv.js +77 -0
- package/dist/Hash-CzrwKeDp.js +133 -0
- package/dist/HttpException-BkS3euNG.js +161 -0
- package/dist/Job-BVT813DO.js +441 -0
- package/dist/McpServiceProvider-BoAN-UcD.js +367 -0
- package/dist/MessageSigner-Bd25ZJAV.js +93 -0
- package/dist/Random-DbIJ22KQ.js +191 -0
- package/dist/address-D0Iq-XIH.js +20 -0
- package/dist/auth/index.js +2 -122
- package/dist/auth-C7sVmYgc.js +1954 -0
- package/dist/authorization/index.js +2 -38
- package/dist/authorization-Dbcuc5ZK.js +610 -0
- package/dist/broadcasting/index.js +2 -26
- package/dist/broadcasting-Dw-FhyjN.js +1055 -0
- package/dist/cache/index.js +2 -17
- package/dist/cache/types.d.ts +4 -4
- package/dist/cache-BYnZf2FR.js +812 -0
- package/dist/client-Dd7vLcqp.js +27 -0
- package/dist/console/Output.d.ts +18 -18
- package/dist/encryption/index.js +5 -96
- package/dist/encryption-fOWQaKqX.js +250 -0
- package/dist/endpoint-D-20PiHY.js +46 -0
- package/dist/endpoint-D6GIqOpe.js +31 -0
- package/dist/errors-quJOkkCn.js +81 -0
- package/dist/events/index.js +2 -28
- package/dist/events-aIH_bWRx.js +410 -0
- package/dist/health/index.js +2 -24
- package/dist/health-VWdWXRwh.js +345 -0
- package/dist/hot-disposables-WsTX2ySN.js +281 -0
- package/dist/hot-reload/testing.d.ts +1 -1
- package/dist/i18n/index.js +2 -30
- package/dist/i18n-mcWi7LCd.js +617 -0
- package/dist/index.js +7495 -7276
- package/dist/lambda/index.js +114 -71
- package/dist/logging/index.js +2 -24
- package/dist/logging-CPaRMuPP.js +518 -0
- package/dist/loopback-guard-D0Kc7-xc.js +224 -0
- package/dist/mail/index.js +2 -27
- package/dist/mail-DfEfSQEr.js +699 -0
- package/dist/mcp/index.js +2 -10
- package/dist/notifications/index.js +2 -33
- package/dist/notifications-BGqmUNZ8.js +759 -0
- package/dist/queue/index.js +3 -42
- package/dist/queue-CXrRK85G.js +948 -0
- package/dist/redis/index.js +672 -642
- package/dist/rolldown-runtime-8H4AJuhK.js +14 -0
- package/dist/runtime/index.js +472 -616
- package/dist/scheduling/index.js +2 -29
- package/dist/scheduling-CPiEdtQd.js +839 -0
- package/dist/storage/index.js +2 -15
- package/dist/storage-tWHMv2H_.js +841 -0
- package/dist/support/expiry.js +69 -12
- package/dist/trim-slashes-ZJ_VsY5s.js +25 -0
- package/dist/vite/index.js +118 -181
- package/dist/vite/plugin.d.ts +1 -1
- package/dist/vite-dev-server-CpCUqmiC.js +131 -0
- package/package.json +6 -5
- package/dist/DocsViewerServiceProvider-RUYDFBMW.js +0 -75
- package/dist/McpServiceProvider-SL7DUZ4G.js +0 -8
- package/dist/chunk-2SC566CD.js +0 -376
- package/dist/chunk-2V3YID4H.js +0 -20
- package/dist/chunk-3KV5X2FL.js +0 -31
- package/dist/chunk-63SKW5PS.js +0 -457
- package/dist/chunk-6J6B5KOB.js +0 -425
- package/dist/chunk-A5JJ7XTH.js +0 -24
- package/dist/chunk-AZOYI43J.js +0 -18
- package/dist/chunk-B5E5VBDI.js +0 -115
- package/dist/chunk-DAQKYKLH.js +0 -182
- package/dist/chunk-DRNPVBAA.js +0 -1002
- package/dist/chunk-EI5GYMAT.js +0 -853
- package/dist/chunk-H3B23O6T.js +0 -271
- package/dist/chunk-HPET6XY5.js +0 -853
- package/dist/chunk-HR2KZ3WL.js +0 -616
- package/dist/chunk-IOTWFHZU.js +0 -558
- package/dist/chunk-K6CUBJX6.js +0 -642
- package/dist/chunk-KTNJG7R7.js +0 -911
- package/dist/chunk-LAJQCSSF.js +0 -355
- package/dist/chunk-LHR6OHI7.js +0 -189
- package/dist/chunk-N7PLD7MB.js +0 -729
- package/dist/chunk-Q2P6YLRR.js +0 -24
- package/dist/chunk-QQKTH5KX.js +0 -114
- package/dist/chunk-SFQP6O52.js +0 -126
- package/dist/chunk-SQR7277M.js +0 -911
- package/dist/chunk-T2FFUU6J.js +0 -484
- package/dist/chunk-TVV5YNEC.js +0 -1842
- package/dist/chunk-UY3AZSYL.js +0 -14
- package/dist/chunk-V4DNC2ER.js +0 -114
- package/dist/chunk-VSA3QY5Q.js +0 -274
- package/dist/chunk-YSOJKAAU.js +0 -427
- package/dist/errors-PUNHAFL2.js +0 -34
package/dist/lambda/index.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
|
|
45
|
-
|
|
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
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
-
|
|
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
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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
|
-
|
|
80
|
-
|
|
81
|
-
createLambdaHandler,
|
|
82
|
-
createScheduleHandler,
|
|
83
|
-
createSqsHandler,
|
|
84
|
-
getLambdaContext,
|
|
85
|
-
isLambda
|
|
86
|
-
};
|
|
128
|
+
//#endregion
|
|
129
|
+
export { createConsoleHandler, createLambdaHandler, createScheduleHandler, createSqsHandler, getLambdaContext, isLambda };
|
package/dist/logging/index.js
CHANGED
|
@@ -1,24 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
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 };
|