@guren/server 1.0.0-rc.9 → 1.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.
Files changed (70) hide show
  1. package/dist/{Application-DtWDHXr1.d.ts → Application-BnsyCKXY.d.ts} +79 -8
  2. package/dist/AuthManager-SfhCNkAU.d.ts +79 -0
  3. package/dist/{BroadcastManager-AkIWUGJo.d.ts → BroadcastManager-CGWl9rUO.d.ts} +5 -0
  4. package/dist/{ConsoleKernel-CqCVrdZs.d.ts → ConsoleKernel-BDtBETjm.d.ts} +1 -1
  5. package/dist/{Gate-CNkBYf8m.d.ts → Gate-CynjZCtS.d.ts} +5 -0
  6. package/dist/{I18nManager-Dtgzsf5n.d.ts → I18nManager-BiSoczfV.d.ts} +6 -1
  7. package/dist/McpServiceProvider-JW6PDVMD.js +7 -0
  8. package/dist/api-token-BSSCLlFW.d.ts +541 -0
  9. package/dist/auth/index.d.ts +9 -327
  10. package/dist/auth/index.js +59 -6684
  11. package/dist/authorization/index.d.ts +2 -2
  12. package/dist/authorization/index.js +19 -604
  13. package/dist/broadcasting/index.d.ts +2 -2
  14. package/dist/broadcasting/index.js +12 -895
  15. package/dist/cache/index.js +8 -809
  16. package/dist/chunk-2T6JN4VR.js +1563 -0
  17. package/dist/chunk-44F7JQ7I.js +950 -0
  18. package/dist/chunk-74HTZG3V.js +331 -0
  19. package/dist/chunk-A3ISJVEV.js +598 -0
  20. package/dist/chunk-CSDKWLFD.js +652 -0
  21. package/dist/chunk-CSRQTEQA.js +839 -0
  22. package/dist/chunk-DAQKYKLH.js +182 -0
  23. package/dist/chunk-EDRGAM6G.js +647 -0
  24. package/dist/chunk-EGU5KB7V.js +818 -0
  25. package/dist/chunk-H32L2NE3.js +372 -0
  26. package/dist/chunk-HKQSAFSN.js +837 -0
  27. package/dist/chunk-IOTWFHZU.js +558 -0
  28. package/dist/chunk-ONSDE37A.js +125 -0
  29. package/dist/chunk-QH4NUKSV.js +255 -0
  30. package/dist/chunk-QQKTH5KX.js +114 -0
  31. package/dist/chunk-R2TCP7D7.js +409 -0
  32. package/dist/chunk-SIP34GBE.js +380 -0
  33. package/dist/chunk-THSX7OOR.js +454 -0
  34. package/dist/chunk-UY3AZSYL.js +14 -0
  35. package/dist/chunk-VT5KRDPH.js +134 -0
  36. package/dist/chunk-WJJ5CTNI.js +907 -0
  37. package/dist/chunk-WVY45EIW.js +359 -0
  38. package/dist/chunk-ZRBLZY3M.js +462 -0
  39. package/dist/client-CKXJLsTe.d.ts +232 -0
  40. package/dist/email-verification-CAeArjui.d.ts +327 -0
  41. package/dist/encryption/index.js +48 -556
  42. package/dist/errors-JOOPDDQ6.js +34 -0
  43. package/dist/events/index.js +14 -316
  44. package/dist/health/index.js +12 -367
  45. package/dist/i18n/index.d.ts +2 -2
  46. package/dist/i18n/index.js +14 -583
  47. package/dist/index.d.ts +37 -239
  48. package/dist/index.js +2931 -19222
  49. package/dist/lambda/index.d.ts +9 -7
  50. package/dist/lambda/index.js +4 -9
  51. package/dist/logging/index.js +12 -545
  52. package/dist/mail/index.d.ts +29 -1
  53. package/dist/mail/index.js +15 -684
  54. package/dist/mcp/index.d.ts +7 -5
  55. package/dist/mcp/index.js +5 -378
  56. package/dist/notifications/index.d.ts +8 -6
  57. package/dist/notifications/index.js +13 -730
  58. package/dist/queue/index.d.ts +37 -7
  59. package/dist/queue/index.js +22 -940
  60. package/dist/redis/index.d.ts +366 -0
  61. package/dist/redis/index.js +597 -0
  62. package/dist/runtime/index.d.ts +8 -6
  63. package/dist/runtime/index.js +26 -244
  64. package/dist/scheduling/index.js +14 -822
  65. package/dist/storage/index.d.ts +1 -0
  66. package/dist/storage/index.js +6 -824
  67. package/dist/vite/index.d.ts +2 -2
  68. package/dist/vite/index.js +5 -1
  69. package/package.json +15 -7
  70. package/dist/api-token-JOif2CtG.d.ts +0 -1792
@@ -1,3 +1,13 @@
1
+ import {
2
+ GUREN_ASCII_ART,
3
+ logDevServerBanner,
4
+ parseImportMap,
5
+ startViteDevServer
6
+ } from "../chunk-QH4NUKSV.js";
7
+ import {
8
+ hash
9
+ } from "../chunk-QQKTH5KX.js";
10
+
1
11
  // src/http/dev-assets.ts
2
12
  import { serveStatic } from "hono/bun";
3
13
  import { dirname, extname as extname2, resolve as resolve2 } from "path";
@@ -100,7 +110,9 @@ var DEFAULT_PREFIX = "/resources/js";
100
110
  var DEFAULT_VENDOR_PATH = "/vendor/inertia-client.tsx";
101
111
  var DEFAULT_JSX_RUNTIME = "https://esm.sh/react@19.0.0/jsx-dev-runtime?dev";
102
112
  var require2 = createRequire(import.meta.url);
103
- var gurenInertiaClient = require2.resolve("@guren/inertia-client/app");
113
+ function resolveGurenInertiaClient() {
114
+ return require2.resolve("@guren/inertia-client/app");
115
+ }
104
116
  function registerDevAssets(app, options) {
105
117
  if (typeof Bun === "undefined") {
106
118
  throw new Error("Bun runtime is required for dev asset serving.");
@@ -114,7 +126,7 @@ function registerDevAssets(app, options) {
114
126
  const cssDir = options.cssDir ?? resolve2(resourcesDir, "css");
115
127
  const cssRoute = options.cssRoute ?? deriveCssRoute(prefix);
116
128
  const inertiaClientPath = options.inertiaClientPath ?? DEFAULT_VENDOR_PATH;
117
- const inertiaClientSource = options.inertiaClientSource ?? gurenInertiaClient;
129
+ const inertiaClientSource = options.inertiaClientSource ?? resolveGurenInertiaClient();
118
130
  const jsxRuntimeUrl = options.jsxRuntimeUrl ?? DEFAULT_JSX_RUNTIME;
119
131
  const resourcesJsDir = resolve2(resourcesDir, "js");
120
132
  const reactImportPattern = /from\s+['"]react['"]/u;
@@ -293,29 +305,6 @@ import { serveStatic as serveStatic2 } from "hono/bun";
293
305
  import { dirname as dirname2, resolve as resolve3, join } from "path";
294
306
  import { fileURLToPath as fileURLToPath2 } from "url";
295
307
  import { readFileSync } from "fs";
296
-
297
- // src/support/import-map.ts
298
- function parseImportMap(value, options = {}) {
299
- if (!value) {
300
- return {};
301
- }
302
- try {
303
- const parsed = JSON.parse(value);
304
- const result = {};
305
- for (const [key, entry] of Object.entries(parsed)) {
306
- if (typeof entry === "string" && entry.length > 0) {
307
- result[key] = entry;
308
- }
309
- }
310
- return result;
311
- } catch (error) {
312
- const label = options.context ?? "import map";
313
- console.warn(`Failed to parse ${label}. Expected JSON object.`, error);
314
- return {};
315
- }
316
- }
317
-
318
- // src/http/inertia-assets.ts
319
308
  var DEFAULT_STYLES_ENTRY = "/public/assets/app.css";
320
309
  var DEFAULT_DEV_STYLES_ENTRY = "/resources/css/app.css";
321
310
  var DEFAULT_SCRIPT_ENTRY = "/assets/app.js";
@@ -460,6 +449,12 @@ function autoConfigureInertiaAssets(app, options) {
460
449
  const clientEntry = clientManifest?.["resources/js/app.tsx"];
461
450
  const clientEntryFile = getManifestFile(clientEntry);
462
451
  const clientCssFiles = getManifestCss(clientEntry);
452
+ if (clientManifest?.__raw__) {
453
+ setEnvIfUserDidNotProvide(
454
+ "GUREN_INERTIA_VERSION",
455
+ hash(clientManifest.__raw__, "sha1").slice(0, 12)
456
+ );
457
+ }
463
458
  if (clientEntryFile) {
464
459
  setEnvIfUserDidNotProvide("GUREN_INERTIA_ENTRY", `/public/assets/${clientEntryFile.replace(/^\//u, "")}`);
465
460
  }
@@ -513,7 +508,8 @@ function captureInertiaEnvFlags() {
513
508
  GUREN_INERTIA_ENTRY: process.env.GUREN_INERTIA_ENTRY !== void 0,
514
509
  GUREN_INERTIA_STYLES: process.env.GUREN_INERTIA_STYLES !== void 0,
515
510
  GUREN_INERTIA_SSR_ENTRY: process.env.GUREN_INERTIA_SSR_ENTRY !== void 0,
516
- GUREN_INERTIA_SSR_MANIFEST: process.env.GUREN_INERTIA_SSR_MANIFEST !== void 0
511
+ GUREN_INERTIA_SSR_MANIFEST: process.env.GUREN_INERTIA_SSR_MANIFEST !== void 0,
512
+ GUREN_INERTIA_VERSION: process.env.GUREN_INERTIA_VERSION !== void 0
517
513
  };
518
514
  }
519
515
  function resolveDevSsrEntry(options) {
@@ -552,6 +548,10 @@ function loadViteManifest(candidatePaths, label) {
552
548
  value: manifestPath,
553
549
  enumerable: false
554
550
  });
551
+ Object.defineProperty(manifest, "__raw__", {
552
+ value: raw,
553
+ enumerable: false
554
+ });
555
555
  return manifest;
556
556
  } catch (error) {
557
557
  if (error.code !== "ENOENT") {
@@ -606,224 +606,6 @@ function resolveResourcesDir(options, moduleDir) {
606
606
  const resourcesPath = options.resourcesPath ?? "../resources";
607
607
  return resolve3(moduleDir, resourcesPath);
608
608
  }
609
-
610
- // src/http/dev-banner.ts
611
- import chalk from "chalk";
612
- import figlet from "figlet";
613
-
614
- // package.json
615
- var package_default = {
616
- name: "@guren/server",
617
- version: "1.0.0-rc.9",
618
- type: "module",
619
- license: "MIT",
620
- repository: {
621
- type: "git",
622
- url: "https://github.com/gurenjs/guren",
623
- directory: "packages/server"
624
- },
625
- homepage: "https://github.com/gurenjs/guren#readme",
626
- bugs: {
627
- url: "https://github.com/gurenjs/guren/issues"
628
- },
629
- publishConfig: {
630
- access: "public"
631
- },
632
- files: [
633
- "dist"
634
- ],
635
- main: "dist/index.js",
636
- types: "dist/index.d.ts",
637
- exports: {
638
- ".": {
639
- types: "./dist/index.d.ts",
640
- default: "./dist/index.js"
641
- },
642
- "./auth": {
643
- types: "./dist/auth/index.d.ts",
644
- default: "./dist/auth/index.js"
645
- },
646
- "./authorization": {
647
- types: "./dist/authorization/index.d.ts",
648
- default: "./dist/authorization/index.js"
649
- },
650
- "./broadcasting": {
651
- types: "./dist/broadcasting/index.d.ts",
652
- default: "./dist/broadcasting/index.js"
653
- },
654
- "./cache": {
655
- types: "./dist/cache/index.d.ts",
656
- default: "./dist/cache/index.js"
657
- },
658
- "./encryption": {
659
- types: "./dist/encryption/index.d.ts",
660
- default: "./dist/encryption/index.js"
661
- },
662
- "./events": {
663
- types: "./dist/events/index.d.ts",
664
- default: "./dist/events/index.js"
665
- },
666
- "./health": {
667
- types: "./dist/health/index.d.ts",
668
- default: "./dist/health/index.js"
669
- },
670
- "./i18n": {
671
- types: "./dist/i18n/index.d.ts",
672
- default: "./dist/i18n/index.js"
673
- },
674
- "./logging": {
675
- types: "./dist/logging/index.d.ts",
676
- default: "./dist/logging/index.js"
677
- },
678
- "./mail": {
679
- types: "./dist/mail/index.d.ts",
680
- default: "./dist/mail/index.js"
681
- },
682
- "./notifications": {
683
- types: "./dist/notifications/index.d.ts",
684
- default: "./dist/notifications/index.js"
685
- },
686
- "./queue": {
687
- types: "./dist/queue/index.d.ts",
688
- default: "./dist/queue/index.js"
689
- },
690
- "./runtime": {
691
- types: "./dist/runtime/index.d.ts",
692
- default: "./dist/runtime/index.js"
693
- },
694
- "./scheduling": {
695
- types: "./dist/scheduling/index.d.ts",
696
- default: "./dist/scheduling/index.js"
697
- },
698
- "./storage": {
699
- types: "./dist/storage/index.d.ts",
700
- default: "./dist/storage/index.js"
701
- },
702
- "./vite": {
703
- types: "./dist/vite/index.d.ts",
704
- default: "./dist/vite/index.js"
705
- },
706
- "./mcp": {
707
- types: "./dist/mcp/index.d.ts",
708
- default: "./dist/mcp/index.js"
709
- },
710
- "./lambda": {
711
- types: "./dist/lambda/index.d.ts",
712
- default: "./dist/lambda/index.js"
713
- }
714
- },
715
- scripts: {
716
- build: "NODE_OPTIONS='--max-old-space-size=8192' tsup",
717
- dev: "bun --watch src/index.ts",
718
- typecheck: "tsc --noEmit",
719
- test: "bun test"
720
- },
721
- dependencies: {
722
- "@guren/inertia-client": "^1.0.0-rc.9",
723
- "@modelcontextprotocol/sdk": "^1.27.1",
724
- chalk: "^5.3.0",
725
- consola: "^3.4.2",
726
- figlet: "^1.7.0",
727
- hono: "^4.12.8",
728
- ioredis: "^5.9.1",
729
- nodemailer: "^7.0.12"
730
- },
731
- peerDependencies: {
732
- "@aws-sdk/client-s3": "^3.0.0",
733
- "@aws-sdk/client-sqs": "^3.0.0",
734
- "@aws-sdk/s3-request-presigner": "^3.0.0",
735
- vite: ">=7.0.0"
736
- },
737
- peerDependenciesMeta: {
738
- "@aws-sdk/client-s3": {
739
- optional: true
740
- },
741
- "@aws-sdk/client-sqs": {
742
- optional: true
743
- },
744
- "@aws-sdk/s3-request-presigner": {
745
- optional: true
746
- }
747
- },
748
- devDependencies: {
749
- "@types/ioredis": "^5.0.0",
750
- "@types/node": "^20.14.10",
751
- "@types/nodemailer": "^7.0.5",
752
- tsup: "^8.5.0",
753
- typescript: "^5.4.0",
754
- vite: "^8.0.0"
755
- }
756
- };
757
-
758
- // src/http/dev-banner.ts
759
- function generateAsciiArt(text) {
760
- try {
761
- const rendered = figlet.textSync(text, {
762
- font: "Standard",
763
- horizontalLayout: "default",
764
- verticalLayout: "default"
765
- });
766
- return rendered;
767
- } catch (error) {
768
- console.error("Failed to generate FIGlet banner, falling back to plain text:", error);
769
- return text.toUpperCase();
770
- }
771
- }
772
- var GUREN_ASCII_ART = chalk.redBright.bold(generateAsciiArt("GUREN"));
773
- var GUREN_VERSION = package_default.version;
774
- function logDevServerBanner({
775
- hostname,
776
- port,
777
- assetsUrl = "http://localhost:5173"
778
- }) {
779
- const localUrl = `http://localhost:${port}`;
780
- const boundUrl = `http://${hostname}:${port}`;
781
- const boundLabel = hostname === "0.0.0.0" || hostname === "::" ? " (all interfaces)" : "";
782
- const header = [
783
- GUREN_ASCII_ART,
784
- chalk.magentaBright.bold(
785
- `Guren v${GUREN_VERSION} ignites \u2014 burning bright like a crimson lotus.`
786
- ),
787
- ""
788
- ];
789
- const detail = (label, value) => `${chalk.magentaBright(" \u2022")} ${chalk.bold(label.padEnd(14))}: ${chalk.cyanBright(value)}`;
790
- const banner = [
791
- ...header,
792
- detail("App URL", localUrl),
793
- detail("Bound address", `${boundUrl}${boundLabel}`),
794
- detail("Asset server", `${assetsUrl} (Vite)`),
795
- "",
796
- chalk.yellowBright("Press Ctrl+C to douse the flames."),
797
- ""
798
- ].join("\n");
799
- console.log(banner);
800
- }
801
-
802
- // src/http/vite-dev-server.ts
803
- async function startViteDevServer(options = {}) {
804
- const { root = process.cwd(), config = {}, host = true, port } = options;
805
- const { createServer } = await import("vite");
806
- const mergedConfig = {
807
- clearScreen: false,
808
- ...config,
809
- root: config.root ?? root,
810
- server: {
811
- host,
812
- port,
813
- ...config.server ?? {}
814
- }
815
- };
816
- const server = await createServer(mergedConfig);
817
- await server.listen();
818
- const resolved = server.resolvedUrls;
819
- const localUrls = resolved?.local?.length ? resolved.local : [`http://${typeof host === "string" ? host : "localhost"}:${server.config.server.port ?? port ?? 5173}`];
820
- const networkUrls = resolved?.network ?? [];
821
- return {
822
- server,
823
- localUrl: localUrls[0],
824
- networkUrls
825
- };
826
- }
827
609
  export {
828
610
  GUREN_ASCII_ART,
829
611
  autoConfigureInertiaAssets,