feat: add ratelimit model support in API and data model definitions, enhancing rate limiting functionality

This commit is contained in:
2025-12-14 20:56:27 -03:00
parent 67b2091d96
commit b76c308aab
2 changed files with 115 additions and 3 deletions

View File

@@ -352,6 +352,10 @@ export declare const components: {
lastRequest?: null | number; lastRequest?: null | number;
}; };
model: "rateLimit"; model: "rateLimit";
}
| {
data: { count: number; key: string; lastRequest: number };
model: "ratelimit";
}; };
onCreateHandle?: string; onCreateHandle?: string;
select?: Array<string>; select?: Array<string>;
@@ -729,6 +733,32 @@ export declare const components: {
| Array<number> | Array<number>
| null; | null;
}>; }>;
}
| {
model: "ratelimit";
where?: Array<{
connector?: "AND" | "OR";
field: "key" | "count" | "lastRequest" | "_id";
operator?:
| "lt"
| "lte"
| "gt"
| "gte"
| "eq"
| "in"
| "not_in"
| "ne"
| "contains"
| "starts_with"
| "ends_with";
value:
| string
| number
| boolean
| Array<string>
| Array<number>
| null;
}>;
}; };
onDeleteHandle?: string; onDeleteHandle?: string;
paginationOpts: { paginationOpts: {
@@ -1113,6 +1143,32 @@ export declare const components: {
| Array<number> | Array<number>
| null; | null;
}>; }>;
}
| {
model: "ratelimit";
where?: Array<{
connector?: "AND" | "OR";
field: "key" | "count" | "lastRequest" | "_id";
operator?:
| "lt"
| "lte"
| "gt"
| "gte"
| "eq"
| "in"
| "not_in"
| "ne"
| "contains"
| "starts_with"
| "ends_with";
value:
| string
| number
| boolean
| Array<string>
| Array<number>
| null;
}>;
}; };
onDeleteHandle?: string; onDeleteHandle?: string;
}, },
@@ -1134,7 +1190,8 @@ export declare const components: {
| "oauthAccessToken" | "oauthAccessToken"
| "oauthConsent" | "oauthConsent"
| "jwks" | "jwks"
| "rateLimit"; | "rateLimit"
| "ratelimit";
offset?: number; offset?: number;
paginationOpts: { paginationOpts: {
cursor: string | null; cursor: string | null;
@@ -1186,7 +1243,8 @@ export declare const components: {
| "oauthAccessToken" | "oauthAccessToken"
| "oauthConsent" | "oauthConsent"
| "jwks" | "jwks"
| "rateLimit"; | "rateLimit"
| "ratelimit";
select?: Array<string>; select?: Array<string>;
where?: Array<{ where?: Array<{
connector?: "AND" | "OR"; connector?: "AND" | "OR";
@@ -1695,6 +1753,33 @@ export declare const components: {
| Array<number> | Array<number>
| null; | null;
}>; }>;
}
| {
model: "ratelimit";
update: { count?: number; key?: string; lastRequest?: number };
where?: Array<{
connector?: "AND" | "OR";
field: "key" | "count" | "lastRequest" | "_id";
operator?:
| "lt"
| "lte"
| "gt"
| "gte"
| "eq"
| "in"
| "not_in"
| "ne"
| "contains"
| "starts_with"
| "ends_with";
value:
| string
| number
| boolean
| Array<string>
| Array<number>
| null;
}>;
}; };
onUpdateHandle?: string; onUpdateHandle?: string;
paginationOpts: { paginationOpts: {
@@ -2183,6 +2268,33 @@ export declare const components: {
| Array<number> | Array<number>
| null; | null;
}>; }>;
}
| {
model: "ratelimit";
update: { count?: number; key?: string; lastRequest?: number };
where?: Array<{
connector?: "AND" | "OR";
field: "key" | "count" | "lastRequest" | "_id";
operator?:
| "lt"
| "lte"
| "gt"
| "gte"
| "eq"
| "in"
| "not_in"
| "ne"
| "contains"
| "starts_with"
| "ends_with";
value:
| string
| number
| boolean
| Array<string>
| Array<number>
| null;
}>;
}; };
onUpdateHandle?: string; onUpdateHandle?: string;
}, },

View File

@@ -38,7 +38,7 @@ export type Doc<TableName extends TableNames> = DocumentByName<
* Convex documents are uniquely identified by their `Id`, which is accessible * Convex documents are uniquely identified by their `Id`, which is accessible
* on the `_id` field. To learn more, see [Document IDs](https://docs.convex.dev/using/document-ids). * on the `_id` field. To learn more, see [Document IDs](https://docs.convex.dev/using/document-ids).
* *
* Documents can be loaded using `db.get(tableName, id)` in query and mutation functions. * Documents can be loaded using `db.get(id)` in query and mutation functions.
* *
* IDs are just strings at runtime, but this type can be used to distinguish them from other * IDs are just strings at runtime, but this type can be used to distinguish them from other
* strings when type checking. * strings when type checking.