@karmaniverous/jeeves-watcher 0.7.0 → 0.7.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.
@@ -2390,6 +2390,8 @@ function buildMergedDocument(options) {
2390
2390
  }));
2391
2391
  return {
2392
2392
  description: config['description'] ?? '',
2393
+ watch: config.watch,
2394
+ configWatch: config.configWatch ?? {},
2393
2395
  search: config.search ?? {},
2394
2396
  schemas: config.schemas ?? {},
2395
2397
  inferenceRules,
@@ -3212,9 +3214,11 @@ function hashObject(obj) {
3212
3214
  */
3213
3215
  function withCache(ttlMs, handler) {
3214
3216
  return async (req, reply) => {
3217
+ const fReq = req;
3218
+ const fReply = reply;
3215
3219
  // Generate deterministic cache key: METHOD:URL:BODY_HASH
3216
- const bodyHash = hashObject(req.body);
3217
- const key = `${req.method}:${req.url}:${bodyHash}`;
3220
+ const bodyHash = hashObject(fReq.body);
3221
+ const key = fReq.method + ':' + fReq.url + ':' + bodyHash;
3218
3222
  // Check cache
3219
3223
  const now = Date.now();
3220
3224
  const entry = cache.get(key);
@@ -3224,7 +3228,7 @@ function withCache(ttlMs, handler) {
3224
3228
  // Cache miss - call handler
3225
3229
  const result = await handler(req, reply);
3226
3230
  // Don't cache errors (Fastify reply properties might indicate error)
3227
- if (reply.statusCode >= 400) {
3231
+ if (fReply.statusCode >= 400) {
3228
3232
  return result;
3229
3233
  }
3230
3234
  // Store in cache
package/dist/index.js CHANGED
@@ -2081,6 +2081,8 @@ function buildMergedDocument(options) {
2081
2081
  }));
2082
2082
  return {
2083
2083
  description: config['description'] ?? '',
2084
+ watch: config.watch,
2085
+ configWatch: config.configWatch ?? {},
2084
2086
  search: config.search ?? {},
2085
2087
  schemas: config.schemas ?? {},
2086
2088
  inferenceRules,
@@ -2903,9 +2905,11 @@ function hashObject(obj) {
2903
2905
  */
2904
2906
  function withCache(ttlMs, handler) {
2905
2907
  return async (req, reply) => {
2908
+ const fReq = req;
2909
+ const fReply = reply;
2906
2910
  // Generate deterministic cache key: METHOD:URL:BODY_HASH
2907
- const bodyHash = hashObject(req.body);
2908
- const key = `${req.method}:${req.url}:${bodyHash}`;
2911
+ const bodyHash = hashObject(fReq.body);
2912
+ const key = fReq.method + ':' + fReq.url + ':' + bodyHash;
2909
2913
  // Check cache
2910
2914
  const now = Date.now();
2911
2915
  const entry = cache.get(key);
@@ -2915,7 +2919,7 @@ function withCache(ttlMs, handler) {
2915
2919
  // Cache miss - call handler
2916
2920
  const result = await handler(req, reply);
2917
2921
  // Don't cache errors (Fastify reply properties might indicate error)
2918
- if (reply.statusCode >= 400) {
2922
+ if (fReply.statusCode >= 400) {
2919
2923
  return result;
2920
2924
  }
2921
2925
  // Store in cache
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@karmaniverous/jeeves-watcher",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "author": "Jason Williscroft",
5
5
  "description": "Filesystem watcher that keeps a Qdrant vector store in sync with document changes",
6
6
  "license": "BSD-3-Clause",