🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@betterdb/semantic-cache

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@betterdb/semantic-cache - npm Package Compare versions

Comparing version
0.11.1
to
0.12.0
+25
-3
dist/analytics.js

@@ -48,2 +48,3 @@ "use strict";

const EVENT_PREFIX = 'semantic_cache:';
const TELEMETRY_USER_AGENT = 'BetterDB-SemanticCache/node';
// Build-time placeholders — replaced by scripts/inject-telemetry-defaults.mjs

@@ -131,2 +132,9 @@ // When the placeholder is NOT replaced, the startsWith('__') guard treats it as unset.

}
function isFrozenServerless() {
const env = process.env;
return Boolean(env.AWS_LAMBDA_FUNCTION_NAME ||
env.K_SERVICE ||
env.FUNCTION_TARGET ||
env.FUNCTIONS_WORKER_RUNTIME);
}
class PostHogAnalytics {

@@ -192,2 +200,5 @@ posthog;

}
if (props.$raw_user_agent === undefined) {
props.$raw_user_agent = TELEMETRY_USER_AGENT;
}
this.posthog.capture({

@@ -231,7 +242,18 @@ distinctId: this.distinctId,

// waitUntil so the invocation stays alive until it completes. The setInterval
// that long-lived servers rely on is frozen between invocations.
// that long-lived servers rely on is frozen between invocations. On frozen
// serverless with no waitUntil (AWS Lambda, Cloud Functions, Azure) delivery
// is best-effort: the flush is fire-and-forget and the container freezes on
// return, so it only completes if a later invocation thaws this container.
// Events are lost if it is reaped while idle. No delivery guarantee exists
// on these runtimes without a waitUntil equivalent.
const waitUntil = getRequestWaitUntil();
if (!waitUntil)
if (waitUntil) {
this.emitSnapshotIfDue(waitUntil);
return;
this.emitSnapshotIfDue(waitUntil);
}
if (isFrozenServerless()) {
this.emitSnapshotIfDue((p) => {
void p;
});
}
}

@@ -238,0 +260,0 @@ snapshotTick() {

+1
-1
{
"name": "@betterdb/semantic-cache",
"version": "0.11.1",
"version": "0.12.0",
"description": "Valkey-native semantic cache for LLM applications with built-in OpenTelemetry and Prometheus instrumentation",

@@ -5,0 +5,0 @@ "keywords": [