@yornaath/batshit
Advanced tools
Comparing version 0.0.3 to 0.2.0
@@ -25,3 +25,3 @@ /** | ||
*/ | ||
export type BatcherConfig<T, Q> = { | ||
export type BatcherConfig<T, Q, R = T> = { | ||
/** | ||
@@ -45,3 +45,7 @@ * The function that makes the batched request for the current batch queries | ||
*/ | ||
equality: keyof T | ((item: T, query: Q) => boolean); | ||
resolver: (items: T[], query: Q) => R; | ||
/** | ||
* Display name of the batcher. Used for debugging and devtools. | ||
*/ | ||
name?: string; | ||
}; | ||
@@ -70,3 +74,3 @@ /** | ||
*/ | ||
export declare const create: <T, Q>(config: BatcherConfig<T, Q>) => Batcher<T, Q>; | ||
export declare const create: <T, Q, R = T>(config: BatcherConfig<T, Q, R>) => Batcher<R, Q>; | ||
/** | ||
@@ -78,3 +82,3 @@ * Create a euquality check to check if the query matches a given key on the item data. | ||
*/ | ||
export declare const keyEquality: <T, Q>(key: keyof T) => (item: T, query: Q) => boolean; | ||
export declare const keyResolver: <T, Q>(key: keyof T) => (items: T[], query: Q) => T; | ||
/** | ||
@@ -81,0 +85,0 @@ * Give a window in ms where all queued fetched made within the window will be batched into |
{ | ||
"name": "@yornaath/batshit", | ||
"version": "0.0.3", | ||
"version": "0.2.0", | ||
"description": "A batch manager that will deduplicate and batch requests for a certain data type made within a window.", | ||
@@ -20,2 +20,6 @@ "author": { | ||
"import": "./dist/index.mjs" | ||
}, | ||
"./dist/devtools": { | ||
"require": "./dist/devtools.cjs", | ||
"import": "./dist/devtools.mjs" | ||
} | ||
@@ -35,12 +39,3 @@ }, | ||
"build": "rm -rf ./dist && rollup -c && tsc" | ||
}, | ||
"devDependencies": { | ||
"@rollup/plugin-commonjs": "^24.0.0", | ||
"@rollup/plugin-typescript": "^10.0.1", | ||
"@vitest/coverage-c8": "^0.26.2", | ||
"rollup": "^3.8.0", | ||
"rollup-plugin-typescript2": "^0.34.1", | ||
"typescript": "^4.9.4", | ||
"vitest": "^0.26.2" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
33894
0
15
412
1
0