@codemem/server 0.36.0 → 0.37.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.
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +98 -106
- package/dist/index.js.map +1 -1
- package/dist/routes/config.d.ts.map +1 -1
- package/dist/routes/memory.d.ts.map +1 -1
- package/dist/routes/stats.d.ts +29 -0
- package/dist/routes/stats.d.ts.map +1 -1
- package/dist/routes/sync.d.ts.map +1 -1
- package/package.json +4 -4
- package/static/app.js +112 -22500
- package/static/app.js.br +0 -0
- package/static/app.js.gz +0 -0
- package/static/index.html +0 -1
- package/static/themes.css.br +0 -0
- package/static/themes.css.gz +0 -0
- package/static/tokens.css.br +0 -0
- package/static/tokens.css.gz +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/routes/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/routes/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAKN,KAAK,eAAe,EAGpB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAuF5B,MAAM,WAAW,kBAAkB;IAClC,UAAU,CAAC,EAAE,MAAM,eAAe,GAAG,IAAI,CAAC;CAC1C;AA+OD,wBAAgB,YAAY,CAAC,IAAI,GAAE,kBAAuB,8EAiHzD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../src/routes/memory.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAiB,WAAW,EAAE,MAAM,eAAe,CAAC;AAWhE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAG5B,KAAK,YAAY,GAAG,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../src/routes/memory.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAiB,WAAW,EAAE,MAAM,eAAe,CAAC;AAWhE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAG5B,KAAK,YAAY,GAAG,MAAM,WAAW,CAAC;AAgQtC,wBAAgB,YAAY,CAAC,QAAQ,EAAE,YAAY,8EAoYlD"}
|
package/dist/routes/stats.d.ts
CHANGED
|
@@ -5,9 +5,38 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { type MemoryStore } from "@codemem/core";
|
|
7
7
|
import { Hono } from "hono";
|
|
8
|
+
type UsagePayload = Record<string, unknown>;
|
|
9
|
+
interface UsageCacheEntry {
|
|
10
|
+
payload: UsagePayload;
|
|
11
|
+
expiresAtMs: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Sweep expired entries and enforce the size cap before inserting a new one.
|
|
15
|
+
*
|
|
16
|
+
* Mirrors the lazy-sweep approach in request-rate-limit.ts: eviction is
|
|
17
|
+
* piggybacked on writes rather than run on a timer, so an idle viewer does no
|
|
18
|
+
* background work. Expired entries (those past `expiresAtMs`) are always
|
|
19
|
+
* dropped; if the map is still at capacity afterward — e.g. a burst of
|
|
20
|
+
* distinct, still-live bypass keys — the oldest-expiring entries are evicted
|
|
21
|
+
* to make room. This never changes hit/miss semantics for a live entry: the
|
|
22
|
+
* caller still re-checks `expiresAtMs` on read, and only already-expired or
|
|
23
|
+
* over-cap entries are removed here.
|
|
24
|
+
*/
|
|
25
|
+
declare function sweepUsagePayloadCache(cache: Map<string, UsageCacheEntry>, nowMs: number): void;
|
|
8
26
|
/**
|
|
9
27
|
* Create stats routes. The store factory is called per-request to get a
|
|
10
28
|
* fresh connection (matching the Python viewer pattern).
|
|
11
29
|
*/
|
|
12
30
|
export declare function statsRoutes(getStore: () => MemoryStore): Hono<import("hono/types").BlankEnv, import("hono/types").BlankSchema, "/">;
|
|
31
|
+
/**
|
|
32
|
+
* Internals exposed for unit tests of the usage-cache eviction. Not part of the
|
|
33
|
+
* route's public surface; consumers should go through the HTTP handlers.
|
|
34
|
+
*/
|
|
35
|
+
export declare const __usageCacheTestHooks: {
|
|
36
|
+
cache: Map<string, UsageCacheEntry>;
|
|
37
|
+
sweep: typeof sweepUsagePayloadCache;
|
|
38
|
+
maxEntries: number;
|
|
39
|
+
ttlMs: number;
|
|
40
|
+
};
|
|
41
|
+
export {};
|
|
13
42
|
//# sourceMappingURL=stats.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../src/routes/stats.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAGN,KAAK,WAAW,EAEhB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../src/routes/stats.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAGN,KAAK,WAAW,EAEhB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAwN5B,KAAK,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE5C,UAAU,eAAe;IACxB,OAAO,EAAE,YAAY,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;CACpB;AA0BD;;;;;;;;;;;GAWG;AACH,iBAAS,sBAAsB,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAcxF;AAgDD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,WAAW,8EAkJtD;AAED;;;GAGG;AACH,eAAO,MAAM,qBAAqB;;;;;CAKjC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/routes/sync.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,KAAK,EAKX,WAAW,EAIX,MAAM,eAAe,CAAC;AAyFvB,OAAO,EAAgB,IAAI,EAAE,MAAM,MAAM,CAAC;AAE1C,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAE3E,KAAK,YAAY,GAAG,MAAM,WAAW,CAAC;AACtC,KAAK,iBAAiB,GAAG;IACxB,KAAK,EACF,UAAU,GACV,SAAS,GACT,UAAU,GACV,OAAO,GACP,UAAU,GACV,iBAAiB,GACjB,iBAAiB,GACjB,IAAI,CAAC;IACR,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB,CAAC;AAoBF,UAAU,wBAAwB;IACjC,cAAc,CAAC,EAAE;QAChB,OAAO,EAAE,0BAA0B,CAAC;QACpC,SAAS,EAAE,MAAM,CAAC;QAClB,aAAa,EAAE,MAAM,CAAC;QACtB,wBAAwB,EAAE,MAAM,CAAC;QACjC,4BAA4B,EAAE,MAAM,CAAC;KACrC,CAAC;CACF;AA6+DD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,YAAY,EAAE,IAAI,GAAE,wBAA6B,8EAiZ7F;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CACzB,QAAQ,EAAE,YAAY,EACtB,oBAAoB,CAAC,EAAE,MAAM,iBAAiB,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/routes/sync.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,KAAK,EAKX,WAAW,EAIX,MAAM,eAAe,CAAC;AAyFvB,OAAO,EAAgB,IAAI,EAAE,MAAM,MAAM,CAAC;AAE1C,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAE3E,KAAK,YAAY,GAAG,MAAM,WAAW,CAAC;AACtC,KAAK,iBAAiB,GAAG;IACxB,KAAK,EACF,UAAU,GACV,SAAS,GACT,UAAU,GACV,OAAO,GACP,UAAU,GACV,iBAAiB,GACjB,iBAAiB,GACjB,IAAI,CAAC;IACR,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB,CAAC;AAoBF,UAAU,wBAAwB;IACjC,cAAc,CAAC,EAAE;QAChB,OAAO,EAAE,0BAA0B,CAAC;QACpC,SAAS,EAAE,MAAM,CAAC;QAClB,aAAa,EAAE,MAAM,CAAC;QACtB,wBAAwB,EAAE,MAAM,CAAC;QACjC,4BAA4B,EAAE,MAAM,CAAC;KACrC,CAAC;CACF;AA6+DD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,YAAY,EAAE,IAAI,GAAE,wBAA6B,8EAiZ7F;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CACzB,QAAQ,EAAE,YAAY,EACtB,oBAAoB,CAAC,EAAE,MAAM,iBAAiB,GAAG,IAAI,8EAurErD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codemem/server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.37.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@hono/node-server": "^2.0.4",
|
|
19
19
|
"drizzle-orm": "^0.45.2",
|
|
20
|
-
"hono": "^4.12.
|
|
20
|
+
"hono": "^4.12.25",
|
|
21
21
|
"limiter": "^3.0.0",
|
|
22
|
-
"@codemem/core": "^0.
|
|
22
|
+
"@codemem/core": "^0.37.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/better-sqlite3": "^7.6.13",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"better-sqlite3": "12.8.0",
|
|
28
28
|
"sqlite-vec": "0.1.9",
|
|
29
29
|
"typescript": "^6.0.3",
|
|
30
|
-
"vite": "^8.0.
|
|
30
|
+
"vite": "^8.0.16",
|
|
31
31
|
"vitest": "^4.1.7"
|
|
32
32
|
},
|
|
33
33
|
"repository": {
|