Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@forwardimpact/libindex

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

@forwardimpact/libindex - npm Package Compare versions

Comparing version
0.1.40
to
0.1.41
+3
-2
package.json
{
"name": "@forwardimpact/libindex",
"version": "0.1.40",
"version": "0.1.41",
"description": "JSONL-backed indexes with filtering and buffered writes — fast context lookup without an external search engine.",

@@ -42,3 +42,4 @@ "keywords": [

"dependencies": {
"@forwardimpact/libtype": "^0.1.63"
"@forwardimpact/libtype": "^0.1.63",
"@forwardimpact/libutil": "^0.1.84"
},

@@ -45,0 +46,0 @@ "devDependencies": {

+16
-3
import { IndexBase } from "./base.js";
import { createDefaultRuntime } from "@forwardimpact/libutil/runtime";

@@ -13,2 +14,3 @@ /**

#maxBufferSize;
#clock;

@@ -22,7 +24,15 @@ /**

* @param {number} [config.max_buffer_size] - Max items before forced flush (default: 1000)
* @param {object} [deps] - Injected collaborators
* @param {import("@forwardimpact/libutil/runtime").Runtime} [deps.runtime]
*/
constructor(storage, indexKey, config = {}) {
constructor(
storage,
indexKey,
config = {},
{ runtime = createDefaultRuntime() } = {},
) {
super(storage, indexKey);
this.#flushInterval = config.flush_interval || 5000;
this.#maxBufferSize = config.max_buffer_size || 1000;
this.#clock = runtime.clock;
}

@@ -52,3 +62,6 @@

if (!this.#flushTimer) {
this.#flushTimer = setTimeout(() => this.flush(), this.#flushInterval);
this.#flushTimer = this.#clock.setTimeout(
() => this.flush(),
this.#flushInterval,
);
}

@@ -63,3 +76,3 @@ }

if (this.#flushTimer) {
clearTimeout(this.#flushTimer);
this.#clock.clearTimeout(this.#flushTimer);
this.#flushTimer = null;

@@ -66,0 +79,0 @@ }