@guren/server 2.10.0 → 2.11.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.
Files changed (91) 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/http/resources/Resource.d.ts +23 -3
  32. package/dist/i18n/index.js +2 -30
  33. package/dist/i18n-mcWi7LCd.js +617 -0
  34. package/dist/index.js +7515 -7276
  35. package/dist/lambda/index.js +114 -71
  36. package/dist/logging/index.js +2 -24
  37. package/dist/logging-CPaRMuPP.js +518 -0
  38. package/dist/loopback-guard-D0Kc7-xc.js +224 -0
  39. package/dist/mail/index.js +2 -27
  40. package/dist/mail-DfEfSQEr.js +699 -0
  41. package/dist/mcp/index.js +2 -10
  42. package/dist/notifications/index.js +2 -33
  43. package/dist/notifications-BGqmUNZ8.js +759 -0
  44. package/dist/queue/index.js +3 -42
  45. package/dist/queue-CXrRK85G.js +948 -0
  46. package/dist/redis/index.js +672 -642
  47. package/dist/rolldown-runtime-8H4AJuhK.js +14 -0
  48. package/dist/runtime/index.js +472 -616
  49. package/dist/scheduling/index.js +2 -29
  50. package/dist/scheduling-CPiEdtQd.js +839 -0
  51. package/dist/storage/index.js +2 -15
  52. package/dist/storage-tWHMv2H_.js +841 -0
  53. package/dist/support/expiry.js +69 -12
  54. package/dist/trim-slashes-ZJ_VsY5s.js +25 -0
  55. package/dist/vite/index.js +118 -181
  56. package/dist/vite/plugin.d.ts +1 -1
  57. package/dist/vite-dev-server-BSJkduhZ.js +131 -0
  58. package/package.json +6 -5
  59. package/dist/DocsViewerServiceProvider-RUYDFBMW.js +0 -75
  60. package/dist/McpServiceProvider-SL7DUZ4G.js +0 -8
  61. package/dist/chunk-2SC566CD.js +0 -376
  62. package/dist/chunk-2V3YID4H.js +0 -20
  63. package/dist/chunk-3KV5X2FL.js +0 -31
  64. package/dist/chunk-63SKW5PS.js +0 -457
  65. package/dist/chunk-6J6B5KOB.js +0 -425
  66. package/dist/chunk-A5JJ7XTH.js +0 -24
  67. package/dist/chunk-AZOYI43J.js +0 -18
  68. package/dist/chunk-B5E5VBDI.js +0 -115
  69. package/dist/chunk-DAQKYKLH.js +0 -182
  70. package/dist/chunk-DRNPVBAA.js +0 -1002
  71. package/dist/chunk-EI5GYMAT.js +0 -853
  72. package/dist/chunk-H3B23O6T.js +0 -271
  73. package/dist/chunk-HPET6XY5.js +0 -853
  74. package/dist/chunk-HR2KZ3WL.js +0 -616
  75. package/dist/chunk-IOTWFHZU.js +0 -558
  76. package/dist/chunk-K6CUBJX6.js +0 -642
  77. package/dist/chunk-KTNJG7R7.js +0 -911
  78. package/dist/chunk-LAJQCSSF.js +0 -355
  79. package/dist/chunk-LHR6OHI7.js +0 -189
  80. package/dist/chunk-N7PLD7MB.js +0 -729
  81. package/dist/chunk-Q2P6YLRR.js +0 -24
  82. package/dist/chunk-QQKTH5KX.js +0 -114
  83. package/dist/chunk-SFQP6O52.js +0 -126
  84. package/dist/chunk-SQR7277M.js +0 -911
  85. package/dist/chunk-T2FFUU6J.js +0 -484
  86. package/dist/chunk-TVV5YNEC.js +0 -1842
  87. package/dist/chunk-UY3AZSYL.js +0 -14
  88. package/dist/chunk-V4DNC2ER.js +0 -114
  89. package/dist/chunk-VSA3QY5Q.js +0 -274
  90. package/dist/chunk-YSOJKAAU.js +0 -427
  91. package/dist/errors-PUNHAFL2.js +0 -34
@@ -1,14 +0,0 @@
1
- // src/redis/client.ts
2
- import Redis from "ioredis";
3
- function createRedisClient(options = {}) {
4
- const { url, ...redisOptions } = options;
5
- if (url) {
6
- return new Redis(url, redisOptions);
7
- }
8
- return new Redis(redisOptions);
9
- }
10
-
11
- export {
12
- Redis,
13
- createRedisClient
14
- };
@@ -1,114 +0,0 @@
1
- // src/encryption/Random.ts
2
- import { randomBytes, randomUUID, randomInt as cryptoRandomInt } from "crypto";
3
- var CHARSETS = {
4
- alphanumeric: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
5
- alphabetic: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
6
- numeric: "0123456789",
7
- hex: "0123456789abcdef",
8
- "base64": "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
9
- "url-safe": "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"
10
- };
11
- function unbiasedRandomChars(length, chars) {
12
- if (!Number.isInteger(length) || length < 0) {
13
- throw new RangeError(`Random string length must be a non-negative integer, received ${length}.`);
14
- }
15
- const limit = 256 - 256 % chars.length;
16
- let result = "";
17
- while (result.length < length) {
18
- const remaining = length - result.length;
19
- const bytes = randomBytes(Math.ceil(remaining * 256 / limit) + 8);
20
- for (const byte of bytes) {
21
- if (byte < limit) {
22
- result += chars[byte % chars.length];
23
- if (result.length === length) break;
24
- }
25
- }
26
- }
27
- return result;
28
- }
29
- function randomString(length, options = {}) {
30
- const { charset = "alphanumeric" } = options;
31
- return unbiasedRandomChars(length, CHARSETS[charset]);
32
- }
33
- function random(length) {
34
- return randomBytes(length);
35
- }
36
- function randomHex(length) {
37
- return randomBytes(length).toString("hex");
38
- }
39
- function randomBase64(length) {
40
- return randomBytes(length).toString("base64");
41
- }
42
- function randomBase64Url(length) {
43
- return randomBytes(length).toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
44
- }
45
- function uuid() {
46
- return randomUUID();
47
- }
48
- function randomInt(min, max) {
49
- return cryptoRandomInt(min, max + 1);
50
- }
51
- function urlSafeToken(length = 32) {
52
- return randomBase64Url(Math.ceil(length * 0.75)).slice(0, length);
53
- }
54
- function generatePassword(length = 16, options = {}) {
55
- const {
56
- uppercase = true,
57
- lowercase = true,
58
- numbers = true,
59
- symbols = true
60
- } = options;
61
- let chars = "";
62
- if (uppercase) chars += "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
63
- if (lowercase) chars += "abcdefghijklmnopqrstuvwxyz";
64
- if (numbers) chars += "0123456789";
65
- if (symbols) chars += "!@#$%^&*()-_=+[]{}|;:,.<>?";
66
- if (chars.length === 0) {
67
- chars = CHARSETS.alphanumeric;
68
- }
69
- return unbiasedRandomChars(length, chars);
70
- }
71
- function generateOtp(length = 6) {
72
- return randomString(length, { charset: "numeric" });
73
- }
74
- function generateSlug(length = 10) {
75
- return randomString(length, { charset: "hex" });
76
- }
77
- function shuffle(array) {
78
- const result = [...array];
79
- for (let i = result.length - 1; i > 0; i--) {
80
- const j = randomInt(0, i);
81
- [result[i], result[j]] = [result[j], result[i]];
82
- }
83
- return result;
84
- }
85
- function pick(array) {
86
- if (array.length === 0) {
87
- throw new Error("Cannot pick from empty array.");
88
- }
89
- return array[randomInt(0, array.length - 1)];
90
- }
91
- function sample(array, count) {
92
- if (count > array.length) {
93
- throw new Error("Sample count exceeds array length.");
94
- }
95
- const shuffled = shuffle(array);
96
- return shuffled.slice(0, count);
97
- }
98
-
99
- export {
100
- randomString,
101
- random,
102
- randomHex,
103
- randomBase64,
104
- randomBase64Url,
105
- uuid,
106
- randomInt,
107
- urlSafeToken,
108
- generatePassword,
109
- generateOtp,
110
- generateSlug,
111
- shuffle,
112
- pick,
113
- sample
114
- };
@@ -1,274 +0,0 @@
1
- // src/http/dev-banner.ts
2
- import chalk from "chalk";
3
- import figlet from "figlet";
4
- import standard from "figlet/importable-fonts/Standard.js";
5
-
6
- // package.json
7
- var package_default = {
8
- name: "@guren/server",
9
- version: "2.10.0",
10
- type: "module",
11
- license: "MIT",
12
- repository: {
13
- type: "git",
14
- url: "https://github.com/gurenjs/guren",
15
- directory: "packages/server"
16
- },
17
- homepage: "https://github.com/gurenjs/guren#readme",
18
- bugs: {
19
- url: "https://github.com/gurenjs/guren/issues"
20
- },
21
- publishConfig: {
22
- access: "public"
23
- },
24
- files: [
25
- "dist"
26
- ],
27
- main: "dist/index.js",
28
- types: "dist/index.d.ts",
29
- exports: {
30
- ".": {
31
- types: "./dist/index.d.ts",
32
- default: "./dist/index.js"
33
- },
34
- "./auth": {
35
- types: "./dist/auth/index.d.ts",
36
- default: "./dist/auth/index.js"
37
- },
38
- "./authorization": {
39
- types: "./dist/authorization/index.d.ts",
40
- default: "./dist/authorization/index.js"
41
- },
42
- "./broadcasting": {
43
- types: "./dist/broadcasting/index.d.ts",
44
- default: "./dist/broadcasting/index.js"
45
- },
46
- "./cache": {
47
- types: "./dist/cache/index.d.ts",
48
- default: "./dist/cache/index.js"
49
- },
50
- "./encryption": {
51
- types: "./dist/encryption/index.d.ts",
52
- default: "./dist/encryption/index.js"
53
- },
54
- "./events": {
55
- types: "./dist/events/index.d.ts",
56
- default: "./dist/events/index.js"
57
- },
58
- "./health": {
59
- types: "./dist/health/index.d.ts",
60
- default: "./dist/health/index.js"
61
- },
62
- "./i18n": {
63
- types: "./dist/i18n/index.d.ts",
64
- default: "./dist/i18n/index.js"
65
- },
66
- "./logging": {
67
- types: "./dist/logging/index.d.ts",
68
- default: "./dist/logging/index.js"
69
- },
70
- "./mail": {
71
- types: "./dist/mail/index.d.ts",
72
- default: "./dist/mail/index.js"
73
- },
74
- "./notifications": {
75
- types: "./dist/notifications/index.d.ts",
76
- default: "./dist/notifications/index.js"
77
- },
78
- "./queue": {
79
- types: "./dist/queue/index.d.ts",
80
- default: "./dist/queue/index.js"
81
- },
82
- "./runtime": {
83
- types: "./dist/runtime/index.d.ts",
84
- default: "./dist/runtime/index.js"
85
- },
86
- "./scheduling": {
87
- types: "./dist/scheduling/index.d.ts",
88
- default: "./dist/scheduling/index.js"
89
- },
90
- "./storage": {
91
- types: "./dist/storage/index.d.ts",
92
- default: "./dist/storage/index.js"
93
- },
94
- "./vite": {
95
- types: "./dist/vite/index.d.ts",
96
- default: "./dist/vite/index.js"
97
- },
98
- "./mcp": {
99
- types: "./dist/mcp/index.d.ts",
100
- default: "./dist/mcp/index.js"
101
- },
102
- "./lambda": {
103
- types: "./dist/lambda/index.d.ts",
104
- default: "./dist/lambda/index.js"
105
- },
106
- "./redis": {
107
- types: "./dist/redis/index.d.ts",
108
- default: "./dist/redis/index.js"
109
- },
110
- "./support/expiry": {
111
- types: "./dist/support/expiry.d.ts",
112
- default: "./dist/support/expiry.js"
113
- }
114
- },
115
- scripts: {
116
- build: "tsup && tsc -p tsconfig.build.json && bun ../../scripts/fix-dts-extensions.ts dist",
117
- dev: "bun --watch src/index.ts",
118
- typecheck: "tsc --noEmit",
119
- test: "bun test"
120
- },
121
- dependencies: {
122
- "@guren/orm": "^2.6.0",
123
- "@modelcontextprotocol/sdk": "^1.30.0",
124
- chalk: "^5.3.0",
125
- consola: "^3.4.2",
126
- figlet: "^1.7.0",
127
- hono: "^4.12.29",
128
- ioredis: "^5.11.1",
129
- nodemailer: "^9.0.1"
130
- },
131
- peerDependencies: {
132
- "@aws-sdk/client-s3": "^3.0.0",
133
- "@aws-sdk/client-sqs": "^3.0.0",
134
- "@aws-sdk/s3-request-presigner": "^3.0.0",
135
- vite: ">=7.0.0",
136
- "@guren/inertia-client": "^1.0.0"
137
- },
138
- peerDependenciesMeta: {
139
- "@aws-sdk/client-s3": {
140
- optional: true
141
- },
142
- "@aws-sdk/client-sqs": {
143
- optional: true
144
- },
145
- "@aws-sdk/s3-request-presigner": {
146
- optional: true
147
- },
148
- "@guren/inertia-client": {
149
- optional: true
150
- }
151
- },
152
- devDependencies: {
153
- "@types/ioredis": "^5.0.0",
154
- "@types/node": "^20.14.10",
155
- "@types/nodemailer": "^8.0.1",
156
- tsup: "^8.5.0",
157
- typescript: "^5.4.0",
158
- vite: "^8.0.0"
159
- }
160
- };
161
-
162
- // src/http/dev-banner.ts
163
- figlet.parseFont("Standard", standard);
164
- function generateAsciiArt(text) {
165
- try {
166
- const rendered = figlet.textSync(text, {
167
- font: "Standard",
168
- horizontalLayout: "default",
169
- verticalLayout: "default"
170
- });
171
- return rendered;
172
- } catch (error) {
173
- console.error("Failed to generate FIGlet banner, falling back to plain text:", error);
174
- return text.toUpperCase();
175
- }
176
- }
177
- var GUREN_ASCII_ART = chalk.redBright.bold(generateAsciiArt("GUREN"));
178
- var GUREN_VERSION = package_default.version;
179
- function isWildcardHost(hostname) {
180
- return hostname === "0.0.0.0" || hostname === "::";
181
- }
182
- function formatHostPort(hostname, port) {
183
- return `${hostname.includes(":") ? `[${hostname}]` : hostname}:${port}`;
184
- }
185
- function logDevServerBanner({
186
- hostname,
187
- port,
188
- assetsUrl = "http://localhost:5173"
189
- }) {
190
- const localUrl = `http://localhost:${port}`;
191
- const boundUrl = `http://${formatHostPort(hostname, port)}`;
192
- const boundLabel = isWildcardHost(hostname) ? " (all interfaces)" : "";
193
- const header = [
194
- GUREN_ASCII_ART,
195
- chalk.magentaBright.bold(
196
- `Guren v${GUREN_VERSION} ignites \u2014 burning bright like a crimson lotus.`
197
- ),
198
- ""
199
- ];
200
- const detail = (label, value) => `${chalk.magentaBright(" \u2022")} ${chalk.bold(label.padEnd(14))}: ${chalk.cyanBright(value)}`;
201
- const banner = [
202
- ...header,
203
- detail("App URL", localUrl),
204
- detail("Bound address", `${boundUrl}${boundLabel}`),
205
- detail("Asset server", `${assetsUrl} (Vite)`),
206
- "",
207
- chalk.yellowBright("Press Ctrl+C to douse the flames."),
208
- ""
209
- ].join("\n");
210
- console.log(banner);
211
- }
212
-
213
- // src/http/vite-dev-server.ts
214
- function resolveViteDevServerConfig(options = {}) {
215
- const { root = process.cwd(), config = {}, host, port } = options;
216
- return {
217
- clearScreen: false,
218
- ...config,
219
- root: config.root ?? root,
220
- server: {
221
- host,
222
- port,
223
- ...config.server ?? {}
224
- }
225
- };
226
- }
227
- async function startViteDevServer(options = {}) {
228
- const { host, port } = options;
229
- const { createServer } = await import("vite");
230
- const server = await createServer(resolveViteDevServerConfig(options));
231
- await server.listen();
232
- const resolved = server.resolvedUrls;
233
- const localUrls = resolved?.local?.length ? resolved.local : [`http://${typeof host === "string" ? host : "localhost"}:${server.config.server.port ?? port ?? 5173}`];
234
- const networkUrls = resolved?.network ?? [];
235
- return {
236
- server,
237
- localUrl: localUrls[0],
238
- networkUrls
239
- };
240
- }
241
-
242
- // src/support/import-map.ts
243
- function parseImportMap(value, options = {}) {
244
- if (!value) {
245
- return {};
246
- }
247
- try {
248
- const parsed = JSON.parse(value);
249
- const result = {};
250
- for (const [key, entry] of Object.entries(parsed)) {
251
- if (typeof entry === "string" && entry.length > 0) {
252
- result[key] = entry;
253
- }
254
- }
255
- return result;
256
- } catch (error) {
257
- const label = options.context ?? "import map";
258
- console.warn(`Failed to parse ${label}. Expected JSON object.`, error);
259
- return {};
260
- }
261
- }
262
-
263
- // src/support/inertia-defaults.ts
264
- var DEFAULT_DEV_STYLES_ENTRY = "/resources/css/app.css";
265
-
266
- export {
267
- parseImportMap,
268
- DEFAULT_DEV_STYLES_ENTRY,
269
- GUREN_ASCII_ART,
270
- isWildcardHost,
271
- formatHostPort,
272
- logDevServerBanner,
273
- startViteDevServer
274
- };