@convex-dev/aggregate
Advanced tools
Comparing version
@@ -66,2 +66,10 @@ import { DocumentByName, GenericDataModel, GenericMutationCtx, GenericQueryCtx, TableNamesInDataModel } from "convex/server"; | ||
/** | ||
* @deprecated Use `indexOf` instead. | ||
*/ | ||
offsetOf(ctx: RunQueryCtx, key: K, id?: ID, bounds?: Bounds<K, ID>): Promise<number>; | ||
/** | ||
* @deprecated Use `indexOf` instead. | ||
*/ | ||
offsetUntil(ctx: RunQueryCtx, key: K, id?: ID, bounds?: Bounds<K, ID>): Promise<number>; | ||
/** | ||
* Gets the minimum item within the given bounds. | ||
@@ -68,0 +76,0 @@ */ |
@@ -78,2 +78,14 @@ import { positionToKey, boundToPosition, keyToPosition, boundsToPositions, } from "./positions.js"; | ||
/** | ||
* @deprecated Use `indexOf` instead. | ||
*/ | ||
async offsetOf(ctx, key, id, bounds) { | ||
return this.indexOf(ctx, key, { id, bounds }); | ||
} | ||
/** | ||
* @deprecated Use `indexOf` instead. | ||
*/ | ||
async offsetUntil(ctx, key, id, bounds) { | ||
return this.indexOf(ctx, key, { id, bounds, order: "desc" }); | ||
} | ||
/** | ||
* Gets the minimum item within the given bounds. | ||
@@ -80,0 +92,0 @@ */ |
@@ -66,2 +66,10 @@ import { DocumentByName, GenericDataModel, GenericMutationCtx, GenericQueryCtx, TableNamesInDataModel } from "convex/server"; | ||
/** | ||
* @deprecated Use `indexOf` instead. | ||
*/ | ||
offsetOf(ctx: RunQueryCtx, key: K, id?: ID, bounds?: Bounds<K, ID>): Promise<number>; | ||
/** | ||
* @deprecated Use `indexOf` instead. | ||
*/ | ||
offsetUntil(ctx: RunQueryCtx, key: K, id?: ID, bounds?: Bounds<K, ID>): Promise<number>; | ||
/** | ||
* Gets the minimum item within the given bounds. | ||
@@ -68,0 +76,0 @@ */ |
@@ -78,2 +78,14 @@ import { positionToKey, boundToPosition, keyToPosition, boundsToPositions, } from "./positions.js"; | ||
/** | ||
* @deprecated Use `indexOf` instead. | ||
*/ | ||
async offsetOf(ctx, key, id, bounds) { | ||
return this.indexOf(ctx, key, { id, bounds }); | ||
} | ||
/** | ||
* @deprecated Use `indexOf` instead. | ||
*/ | ||
async offsetUntil(ctx, key, id, bounds) { | ||
return this.indexOf(ctx, key, { id, bounds, order: "desc" }); | ||
} | ||
/** | ||
* Gets the minimum item within the given bounds. | ||
@@ -80,0 +92,0 @@ */ |
{ | ||
"name": "@convex-dev/aggregate", | ||
"description": "Convex component to calculate counts and sums of values for efficient aggregation.", | ||
"version": "0.1.16-alpha.0", | ||
"version": "0.1.16-alpha.1", | ||
"keywords": [ | ||
@@ -6,0 +6,0 @@ "convex", |
@@ -19,3 +19,3 @@ # Convex Component: Aggregate | ||
4. Find the overall average score: `aggregate.sum(ctx) / aggregate.count(ctx)` | ||
5. Find the ranking for a score of 65 in the leaderboard: `aggregate.offsetOf(ctx, 65)` | ||
5. Find the ranking for a score of 65 in the leaderboard: `aggregate.indexOf(ctx, 65)` | ||
6. Find the average score for an individual user. You can define another aggregate | ||
@@ -22,0 +22,0 @@ partitioned by user and aggregate within each: |
@@ -131,2 +131,25 @@ import { | ||
/** | ||
* @deprecated Use `indexOf` instead. | ||
*/ | ||
async offsetOf( | ||
ctx: RunQueryCtx, | ||
key: K, | ||
id?: ID, | ||
bounds?: Bounds<K, ID> | ||
): Promise<number> { | ||
return this.indexOf(ctx, key, { id, bounds }); | ||
} | ||
/** | ||
* @deprecated Use `indexOf` instead. | ||
*/ | ||
async offsetUntil( | ||
ctx: RunQueryCtx, | ||
key: K, | ||
id?: ID, | ||
bounds?: Bounds<K, ID> | ||
): Promise<number> { | ||
return this.indexOf(ctx, key, { id, bounds, order: "desc" }); | ||
} | ||
/** | ||
* Gets the minimum item within the given bounds. | ||
@@ -133,0 +156,0 @@ */ |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
462616
0.68%7816
0.8%0
-100%