Skip to content

Commit 06f9893

Browse files
committed
Add bigint to the internal model manager types allowed for numeric filters
1 parent efc2063 commit 06f9893

File tree

3 files changed

+24
-17
lines changed

3 files changed

+24
-17
lines changed

packages/api-client-core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@gadgetinc/api-client-core",
3-
"version": "0.15.10",
3+
"version": "0.15.11",
44
"files": [
55
"Readme.md",
66
"dist/**/*"

packages/api-client-core/spec/InternalModelManager.spec.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ describe("InternalModelManager", () => {
2929
});
3030
});
3131

32+
// type tests
33+
const _TestCanFilterByScalars = async () => {
34+
await internalModelManager.findMany({ filter: [{ id: { equals: "foo" } }] });
35+
await internalModelManager.findMany({ filter: [{ id: { equals: BigInt(1) } }] });
36+
await internalModelManager.findMany({ filter: [{ createdAt: { equals: new Date() } }] });
37+
};
38+
3239
test("can unwrap params nested under api identifier", () => {
3340
const result = (internalModelManager as any).getRecordFromData({
3441
someModel: {

packages/api-client-core/src/types.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,10 @@ export interface IDFilter {
165165
**/
166166
export interface IntFilter {
167167
/** Filter to where the backend value is equal to this value */
168-
equals?: number | null;
168+
equals?: number | bigint | null;
169169

170170
/** Filter to where the backend value is not equal to this value */
171-
notEquals?: number | null;
171+
notEquals?: number | bigint | null;
172172

173173
/**
174174
* Filter to where the backend value is set to any value at all.
@@ -178,22 +178,22 @@ export interface IntFilter {
178178
isSet?: boolean | null;
179179

180180
/** Filter to where the backend value is within this set of numbers */
181-
in?: (number | null)[];
181+
in?: (number | bigint | null)[];
182182

183183
/** Filter to where the backend value is not within this set of numbers */
184-
notIn?: (number | null)[];
184+
notIn?: (number | bigint | null)[];
185185

186186
/** Filter to where the backend value is lower than this number */
187-
lessThan?: number | null;
187+
lessThan?: number | bigint | null;
188188

189189
/** Filter to where the backend value is lower than or equal to this number */
190-
lessThanOrEqual?: number | null;
190+
lessThanOrEqual?: number | bigint | null;
191191

192192
/** Filter to where the backend value is greater than to this number */
193-
greaterThan?: number | null;
193+
greaterThan?: number | bigint | null;
194194

195195
/** Filter to where the backend value is greater than or equal to this number */
196-
greaterThanOrEqual?: number | null;
196+
greaterThanOrEqual?: number | bigint | null;
197197
}
198198

199199
/**
@@ -210,10 +210,10 @@ export interface IntFilter {
210210
* */
211211
export interface FloatFilter {
212212
/** Filter to where the backend value is equal to this value */
213-
equals?: number | null;
213+
equals?: number | bigint | null;
214214

215215
/** Filter to where the backend value is not equal to this value */
216-
notEquals?: number | null;
216+
notEquals?: number | bigint | null;
217217

218218
/**
219219
* Filter to where the backend value is set to any value at all.
@@ -223,22 +223,22 @@ export interface FloatFilter {
223223
isSet?: boolean | null;
224224

225225
/** Filter to where the backend value is within this set of numbers */
226-
in?: (number | null)[];
226+
in?: (number | bigint | null)[];
227227

228228
/** Filter to where the backend value is not within this set of numbers */
229-
notIn?: (number | null)[];
229+
notIn?: (number | bigint | null)[];
230230

231231
/** Filter to where the backend value is lower than this number */
232-
lessThan?: number | null;
232+
lessThan?: number | bigint | null;
233233

234234
/** Filter to where the backend value is lower than or equal to this number */
235-
lessThanOrEqual?: number | null;
235+
lessThanOrEqual?: number | bigint | null;
236236

237237
/** Filter to where the backend value is greater than to this number */
238-
greaterThan?: number | null;
238+
greaterThan?: number | bigint | null;
239239

240240
/** Filter to where the backend value is greater than or equal to this number */
241-
greaterThanOrEqual?: number | null;
241+
greaterThanOrEqual?: number | bigint | null;
242242
}
243243

244244
/**

0 commit comments

Comments
 (0)