tricache 0.8.0 → 0.9.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 (44) hide show
  1. package/README.md +4 -2
  2. package/dashboards/prometheus-scrape.yml +18 -0
  3. package/dist/{cache-service-CyLdpo77.d.ts → cache-service-DVvroyqA.d.ts} +16 -1
  4. package/dist/{cache-service-5MZXFIGK.js → cache-service-KI5ACF3F.js} +1 -1
  5. package/dist/chunk-BQRURGGD.js +60 -0
  6. package/dist/chunk-IITRFWHY.js +196 -0
  7. package/dist/{chunk-6PQ5MOWR.js → chunk-PL5J3ZNT.js} +370 -81
  8. package/dist/cli.cjs +392 -84
  9. package/dist/cli.js +22 -4
  10. package/dist/dashboard/index.d.ts +2 -2
  11. package/dist/drizzle/index.cjs +350 -81
  12. package/dist/drizzle/index.d.ts +2 -2
  13. package/dist/drizzle/index.js +1 -1
  14. package/dist/edge/index.cjs +99 -38
  15. package/dist/edge/index.d.ts +3 -3
  16. package/dist/edge/index.js +5 -5
  17. package/dist/hono/index.cjs +7760 -0
  18. package/dist/hono/index.d.ts +91 -0
  19. package/dist/hono/index.js +185 -0
  20. package/dist/{hono-DQRS1Xd7.d.ts → hono-VA9A1m0I.d.ts} +3 -2
  21. package/dist/http/index.cjs +449 -119
  22. package/dist/http/index.d.ts +6 -30
  23. package/dist/http/index.js +9 -59
  24. package/dist/index.cjs +370 -81
  25. package/dist/index.d.ts +3 -3
  26. package/dist/index.js +1 -1
  27. package/dist/nestjs/index.cjs +350 -81
  28. package/dist/nestjs/index.d.ts +2 -2
  29. package/dist/nestjs/index.js +1 -1
  30. package/dist/next/index.cjs +350 -81
  31. package/dist/next/index.d.ts +2 -2
  32. package/dist/next/index.js +1 -1
  33. package/dist/prisma/index.d.ts +2 -2
  34. package/dist/{types-B6krw64X.d.ts → types-B_QkVwJ7.d.ts} +23 -0
  35. package/dist/utils-CEsU_Z0s.d.ts +27 -0
  36. package/package.json +16 -6
  37. package/src/cache-service.ts +302 -35
  38. package/src/cli.ts +21 -4
  39. package/src/edge/hono.ts +123 -42
  40. package/src/hono/index.ts +316 -0
  41. package/src/http/index.ts +5 -0
  42. package/src/ipc-telemetry.ts +29 -1
  43. package/src/types.ts +25 -0
  44. package/dist/chunk-ZTSWCFYO.js +0 -135
package/dist/cli.js CHANGED
@@ -4,11 +4,12 @@ import {
4
4
  findActiveSockets,
5
5
  renderTopDashboard,
6
6
  resolveIpcSocketPath
7
- } from "./chunk-6PQ5MOWR.js";
7
+ } from "./chunk-PL5J3ZNT.js";
8
8
  import "./chunk-LJ5QJB5O.js";
9
9
  import "./chunk-XZL45ABR.js";
10
10
 
11
11
  // src/cli.ts
12
+ import { readFileSync } from "fs";
12
13
  import { parseArgs } from "util";
13
14
  async function runCli(args = process.argv.slice(2)) {
14
15
  const options = {
@@ -46,7 +47,13 @@ async function runCli(args = process.argv.slice(2)) {
46
47
  return;
47
48
  }
48
49
  if (values.version || command === "version") {
49
- console.log("tricache v0.8.0");
50
+ let version = "0.9.0";
51
+ try {
52
+ const pkg = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
53
+ if (pkg?.version) version = pkg.version;
54
+ } catch {
55
+ }
56
+ console.log(`tricache v${version}`);
50
57
  return;
51
58
  }
52
59
  if (command === "top") {
@@ -58,10 +65,18 @@ async function runCli(args = process.argv.slice(2)) {
58
65
  const active = await findActiveSockets();
59
66
  if (active.length > 0) {
60
67
  targetSocket = active[0];
61
- } else {
62
- targetSocket = resolveIpcSocketPath(process.pid);
63
68
  }
64
69
  }
70
+ if (!targetSocket) {
71
+ console.error("No active TriCache instances found to monitor.\n");
72
+ console.error("To use `tricache top`:");
73
+ console.error(" 1. Ensure your running application enables IPC telemetry:");
74
+ console.error(" const cache = new CacheService({ namespace: 'my-app', enableIpc: true, ... });\n");
75
+ console.error(" 2. If the application is already running, specify its PID or socket:");
76
+ console.error(" npx tricache top --pid <pid>");
77
+ console.error(" npx tricache top --socket <path>\n");
78
+ process.exit(1);
79
+ }
65
80
  const client = new IpcTelemetryClient(targetSocket);
66
81
  const intervalMs = typeof values.interval === "string" ? Math.max(200, parseInt(values.interval, 10)) : 1e3;
67
82
  const isOnce = Boolean(values.once || !process.stdout.isTTY);
@@ -122,6 +137,9 @@ async function runCli(args = process.argv.slice(2)) {
122
137
  } catch (err) {
123
138
  process.stdout.write(`\x1B[HConnecting to ${targetSocket}...
124
139
  Error: ${err.message}
140
+
141
+ Waiting for TriCache IPC server. Ensure the target process is running with enableIpc: true.
142
+ Press "q" or Ctrl+C to exit
125
143
  `);
126
144
  }
127
145
  };
@@ -1,6 +1,6 @@
1
1
  import http, { IncomingMessage, ServerResponse } from 'node:http';
2
- import { C as CacheService } from '../cache-service-CyLdpo77.js';
3
- import '../types-B6krw64X.js';
2
+ import { C as CacheService } from '../cache-service-DVvroyqA.js';
3
+ import '../types-B_QkVwJ7.js';
4
4
  import 'crypto';
5
5
 
6
6
  interface DashboardPeerInstance {