@instantdb/core
Advanced tools
Comparing version 0.10.7 to 0.10.8
@@ -0,3 +1,9 @@ | ||
declare type NonEmpty<T> = { | ||
[K in keyof T]-?: Required<Pick<T, K>>; | ||
}[keyof T]; | ||
declare type WhereArgs = { | ||
in?: (string | number | boolean)[]; | ||
}; | ||
declare type WhereClause = { | ||
[key: string]: string | number | boolean; | ||
[key: string]: string | number | boolean | NonEmpty<WhereArgs>; | ||
}; | ||
@@ -4,0 +10,0 @@ declare type $Option = { |
@@ -36,2 +36,5 @@ // Query | ||
const r7 = dummyQuery({ users: { $: { where: { "foo.bar.baz": 1 } } } }); | ||
const s1 = dummyQuery({ | ||
users: { $: { where: { foo: { in: [1, 2, 3] } } } }, | ||
}); | ||
// ------------------ | ||
@@ -45,2 +48,6 @@ // Bad $ clauses fail | ||
const r10 = dummyQuery({ users: { $: { where2: 1 } } }); | ||
const s2 = dummyQuery({ | ||
// @ts-expect-error | ||
users: { $: { where: { foo: { ini: [1, 2, 3] } } } }, | ||
}); | ||
// ---------------- | ||
@@ -47,0 +54,0 @@ // Good Nested queries succeed |
@@ -0,3 +1,9 @@ | ||
declare type NonEmpty<T> = { | ||
[K in keyof T]-?: Required<Pick<T, K>>; | ||
}[keyof T]; | ||
declare type WhereArgs = { | ||
in?: (string | number | boolean)[]; | ||
}; | ||
declare type WhereClause = { | ||
[key: string]: string | number | boolean; | ||
[key: string]: string | number | boolean | NonEmpty<WhereArgs>; | ||
}; | ||
@@ -4,0 +10,0 @@ declare type $Option = { |
@@ -38,2 +38,5 @@ "use strict"; | ||
const r7 = dummyQuery({ users: { $: { where: { "foo.bar.baz": 1 } } } }); | ||
const s1 = dummyQuery({ | ||
users: { $: { where: { foo: { in: [1, 2, 3] } } } }, | ||
}); | ||
// ------------------ | ||
@@ -47,2 +50,6 @@ // Bad $ clauses fail | ||
const r10 = dummyQuery({ users: { $: { where2: 1 } } }); | ||
const s2 = dummyQuery({ | ||
// @ts-expect-error | ||
users: { $: { where: { foo: { ini: [1, 2, 3] } } } }, | ||
}); | ||
// ---------------- | ||
@@ -49,0 +56,0 @@ // Good Nested queries succeed |
{ | ||
"name": "@instantdb/core", | ||
"version": "0.10.7", | ||
"version": "0.10.8", | ||
"description": "Instant's core local abstraction", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
// Query | ||
// ----- | ||
// NonEmpty disallows {}, so that you must provide at least one field | ||
type NonEmpty<T> = { | ||
[K in keyof T]-?: Required<Pick<T, K>>; | ||
}[keyof T]; | ||
type WhereArgs = { | ||
in?: (string | number | boolean)[]; | ||
}; | ||
type WhereClause = { | ||
[key: string]: string | number | boolean; | ||
[key: string]: string | number | boolean | NonEmpty<WhereArgs>; | ||
}; | ||
@@ -130,2 +139,5 @@ | ||
const r7 = dummyQuery({ users: { $: { where: { "foo.bar.baz": 1 } } } }); | ||
const s1 = dummyQuery({ | ||
users: { $: { where: { foo: { in: [1, 2, 3] } } } }, | ||
}); | ||
@@ -141,2 +153,6 @@ // ------------------ | ||
const r10 = dummyQuery({ users: { $: { where2: 1 } } }); | ||
const s2 = dummyQuery({ | ||
// @ts-expect-error | ||
users: { $: { where: { foo: { ini: [1, 2, 3] } } } }, | ||
}); | ||
@@ -143,0 +159,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
1566656
35208