-
Couldn't load subscription status.
- Fork 63
Add time between queries #136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,13 @@ const result = await databases.createDocument({ | |
| databaseId: '<DATABASE_ID>', | ||
| collectionId: '<COLLECTION_ID>', | ||
| documentId: '<DOCUMENT_ID>', | ||
| data: {}, | ||
| data: { | ||
| "username": "walter.obrien", | ||
| "email": "[email protected]", | ||
| "fullName": "Walter O'Brien", | ||
| "age": 30, | ||
| "isAdmin": false | ||
| }, | ||
| permissions: ["read("any")"] // optional | ||
| }); | ||
abnegate marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,13 @@ const result = await tablesDB.createRow({ | |
| databaseId: '<DATABASE_ID>', | ||
| tableId: '<TABLE_ID>', | ||
| rowId: '<ROW_ID>', | ||
| data: {}, | ||
| data: { | ||
| "username": "walter.obrien", | ||
| "email": "[email protected]", | ||
| "fullName": "Walter O'Brien", | ||
| "age": 30, | ||
| "isAdmin": false | ||
| }, | ||
| permissions: ["read("any")"] // optional | ||
| }); | ||
abnegate marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,4 +5,5 @@ export enum ExecutionMethod { | |
| PATCH = 'PATCH', | ||
| DELETE = 'DELETE', | ||
| OPTIONS = 'OPTIONS', | ||
| HEAD = 'HEAD', | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,5 +1,5 @@ | ||||||||||||||||||||||||
| type QueryTypesSingle = string | number | boolean; | ||||||||||||||||||||||||
| export type QueryTypesList = string[] | number[] | boolean[] | Query[]; | ||||||||||||||||||||||||
| export type QueryTypesList = string[] | number[] | boolean[] | Query[] | any[]; | ||||||||||||||||||||||||
| export type QueryTypes = QueryTypesSingle | QueryTypesList; | ||||||||||||||||||||||||
| type AttributesTypes = string | string[]; | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
|
@@ -52,20 +52,20 @@ export class Query { | |||||||||||||||||||||||
| * Filter resources where attribute is equal to value. | ||||||||||||||||||||||||
| * | ||||||||||||||||||||||||
| * @param {string} attribute | ||||||||||||||||||||||||
| * @param {QueryTypes} value | ||||||||||||||||||||||||
| * @param {QueryTypes | any[]} value | ||||||||||||||||||||||||
| * @returns {string} | ||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||
| static equal = (attribute: string, value: QueryTypes): string => | ||||||||||||||||||||||||
| static equal = (attribute: string, value: QueryTypes | any[]): string => | ||||||||||||||||||||||||
| new Query("equal", attribute, value).toString(); | ||||||||||||||||||||||||
|
Comment on lines
+55
to
59
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion
This widens the surface and hides mistakes. Keep the stricter type. - static equal = (attribute: string, value: QueryTypes | any[]): string =>
+ static equal = (attribute: string, value: QueryTypes): string =>📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||
| * Filter resources where attribute is not equal to value. | ||||||||||||||||||||||||
| * | ||||||||||||||||||||||||
| * @param {string} attribute | ||||||||||||||||||||||||
| * @param {QueryTypes} value | ||||||||||||||||||||||||
| * @param {QueryTypes | any[]} value | ||||||||||||||||||||||||
| * @returns {string} | ||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||
| static notEqual = (attribute: string, value: QueryTypes): string => | ||||||||||||||||||||||||
| static notEqual = (attribute: string, value: QueryTypes | any[]): string => | ||||||||||||||||||||||||
| new Query("notEqual", attribute, value).toString(); | ||||||||||||||||||||||||
|
Comment on lines
+65
to
69
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Same here for - static notEqual = (attribute: string, value: QueryTypes | any[]): string =>
+ static notEqual = (attribute: string, value: QueryTypes): string =>📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||
|
|
@@ -238,17 +238,17 @@ export class Query { | |||||||||||||||||||||||
| * @param {string | string[]} value | ||||||||||||||||||||||||
| * @returns {string} | ||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||
| static contains = (attribute: string, value: string | string[]): string => | ||||||||||||||||||||||||
| static contains = (attribute: string, value: string | any[]): string => | ||||||||||||||||||||||||
| new Query("contains", attribute, value).toString(); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
Comment on lines
+241
to
243
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chain
Switching to - static contains = (attribute: string, value: string | any[]): string =>
+ static contains = (attribute: string, value: string | string[]): string =>🏁 Script executed: #!/bin/bash
file=$(find . -type f -name "query.ts" | head -n1)
echo "Inspecting $file"
grep -R "class Query" -n "$file"
grep -R "static contains" -n "$file"
sed -n '230,260p' "$file"Length of output: 1100 Change - static contains = (attribute: string, value: string | any[]): string =>
+ static contains = (attribute: string, value: string | string[]): string =>📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||
| * Filter resources where attribute does not contain the specified value. | ||||||||||||||||||||||||
| * | ||||||||||||||||||||||||
| * @param {string} attribute | ||||||||||||||||||||||||
| * @param {string | string[]} value | ||||||||||||||||||||||||
| * @param {string | any[]} value | ||||||||||||||||||||||||
| * @returns {string} | ||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||
| static notContains = (attribute: string, value: string | string[]): string => | ||||||||||||||||||||||||
| static notContains = (attribute: string, value: string | any[]): string => | ||||||||||||||||||||||||
| new Query("notContains", attribute, value).toString(); | ||||||||||||||||||||||||
|
Comment on lines
+248
to
252
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent ❓ Verification inconclusive
- static notContains = (attribute: string, value: string | any[]): string =>
+ static notContains = (attribute: string, value: string | string[]): string =>narrow - * @param {string | any[]} value
+ * @param {string | string[]} value
- static notContains = (attribute: string, value: string | any[]): string =>
+ static notContains = (attribute: string, value: string | string[]): string =>📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||
|
|
@@ -311,6 +311,16 @@ export class Query { | |||||||||||||||||||||||
| static createdAfter = (value: string): string => | ||||||||||||||||||||||||
| new Query("createdAfter", undefined, value).toString(); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||
| * Filter resources where document was created between dates. | ||||||||||||||||||||||||
| * | ||||||||||||||||||||||||
| * @param {string} start | ||||||||||||||||||||||||
| * @param {string} end | ||||||||||||||||||||||||
| * @returns {string} | ||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||
| static createdBetween = (start: string, end: string): string => | ||||||||||||||||||||||||
| new Query("createdBetween", undefined, [start, end] as QueryTypesList).toString(); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||
| * Filter resources where document was updated before date. | ||||||||||||||||||||||||
| * | ||||||||||||||||||||||||
|
|
@@ -329,6 +339,16 @@ export class Query { | |||||||||||||||||||||||
| static updatedAfter = (value: string): string => | ||||||||||||||||||||||||
| new Query("updatedAfter", undefined, value).toString(); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||
| * Filter resources where document was updated between dates. | ||||||||||||||||||||||||
| * | ||||||||||||||||||||||||
| * @param {string} start | ||||||||||||||||||||||||
| * @param {string} end | ||||||||||||||||||||||||
| * @returns {string} | ||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||
| static updatedBetween = (start: string, end: string): string => | ||||||||||||||||||||||||
| new Query("updatedBetween", undefined, [start, end] as QueryTypesList).toString(); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||
| * Combine multiple queries using logical OR operator. | ||||||||||||||||||||||||
| * | ||||||||||||||||||||||||
|
|
@@ -346,4 +366,132 @@ export class Query { | |||||||||||||||||||||||
| */ | ||||||||||||||||||||||||
| static and = (queries: string[]) => | ||||||||||||||||||||||||
| new Query("and", undefined, queries.map((query) => JSON.parse(query))).toString(); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||
| * Filter resources where attribute is at a specific distance from the given coordinates. | ||||||||||||||||||||||||
| * | ||||||||||||||||||||||||
| * @param {string} attribute | ||||||||||||||||||||||||
| * @param {any[]} values | ||||||||||||||||||||||||
| * @param {number} distance | ||||||||||||||||||||||||
| * @param {boolean} meters | ||||||||||||||||||||||||
| * @returns {string} | ||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||
| static distanceEqual = (attribute: string, values: any[], distance: number, meters: boolean = true): string => | ||||||||||||||||||||||||
| new Query("distanceEqual", attribute, [[values, distance, meters]] as QueryTypesList).toString(); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||
| * Filter resources where attribute is not at a specific distance from the given coordinates. | ||||||||||||||||||||||||
| * | ||||||||||||||||||||||||
| * @param {string} attribute | ||||||||||||||||||||||||
| * @param {any[]} values | ||||||||||||||||||||||||
| * @param {number} distance | ||||||||||||||||||||||||
| * @param {boolean} meters | ||||||||||||||||||||||||
| * @returns {string} | ||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||
| static distanceNotEqual = (attribute: string, values: any[], distance: number, meters: boolean = true): string => | ||||||||||||||||||||||||
| new Query("distanceNotEqual", attribute, [[values, distance, meters]] as QueryTypesList).toString(); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||
| * Filter resources where attribute is at a distance greater than the specified value from the given coordinates. | ||||||||||||||||||||||||
| * | ||||||||||||||||||||||||
| * @param {string} attribute | ||||||||||||||||||||||||
| * @param {any[]} values | ||||||||||||||||||||||||
| * @param {number} distance | ||||||||||||||||||||||||
| * @param {boolean} meters | ||||||||||||||||||||||||
| * @returns {string} | ||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||
| static distanceGreaterThan = (attribute: string, values: any[], distance: number, meters: boolean = true): string => | ||||||||||||||||||||||||
| new Query("distanceGreaterThan", attribute, [[values, distance, meters]] as QueryTypesList).toString(); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||
| * Filter resources where attribute is at a distance less than the specified value from the given coordinates. | ||||||||||||||||||||||||
| * | ||||||||||||||||||||||||
| * @param {string} attribute | ||||||||||||||||||||||||
| * @param {any[]} values | ||||||||||||||||||||||||
| * @param {number} distance | ||||||||||||||||||||||||
| * @param {boolean} meters | ||||||||||||||||||||||||
| * @returns {string} | ||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||
| static distanceLessThan = (attribute: string, values: any[], distance: number, meters: boolean = true): string => | ||||||||||||||||||||||||
| new Query("distanceLessThan", attribute, [[values, distance, meters]] as QueryTypesList).toString(); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||
| * Filter resources where attribute intersects with the given geometry. | ||||||||||||||||||||||||
| * | ||||||||||||||||||||||||
| * @param {string} attribute | ||||||||||||||||||||||||
| * @param {any[]} values | ||||||||||||||||||||||||
| * @returns {string} | ||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||
| static intersects = (attribute: string, values: any[]): string => | ||||||||||||||||||||||||
| new Query("intersects", attribute, [values]).toString(); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
Comment on lines
+425
to
+427
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: unnecessary wrapping causes nested arrays in geometry predicates. Passing - static intersects = (attribute: string, values: any[]): string =>
- new Query("intersects", attribute, [values]).toString();
+ static intersects = (attribute: string, geometry: any[]): string =>
+ new Query("intersects", attribute, geometry).toString();
- static notIntersects = (attribute: string, values: any[]): string =>
- new Query("notIntersects", attribute, [values]).toString();
+ static notIntersects = (attribute: string, geometry: any[]): string =>
+ new Query("notIntersects", attribute, geometry).toString();
- static crosses = (attribute: string, values: any[]): string =>
- new Query("crosses", attribute, [values]).toString();
+ static crosses = (attribute: string, geometry: any[]): string =>
+ new Query("crosses", attribute, geometry).toString();
- static notCrosses = (attribute: string, values: any[]): string =>
- new Query("notCrosses", attribute, [values]).toString();
+ static notCrosses = (attribute: string, geometry: any[]): string =>
+ new Query("notCrosses", attribute, geometry).toString();
- static overlaps = (attribute: string, values: any[]): string =>
- new Query("overlaps", attribute, [values]).toString();
+ static overlaps = (attribute: string, geometry: any[]): string =>
+ new Query("overlaps", attribute, geometry).toString();
- static notOverlaps = (attribute: string, values: any[]): string =>
- new Query("notOverlaps", attribute, [values]).toString();
+ static notOverlaps = (attribute: string, geometry: any[]): string =>
+ new Query("notOverlaps", attribute, geometry).toString();
- static touches = (attribute: string, values: any[]): string =>
- new Query("touches", attribute, [values]).toString();
+ static touches = (attribute: string, geometry: any[]): string =>
+ new Query("touches", attribute, geometry).toString();
- static notTouches = (attribute: string, values: any[]): string =>
- new Query("notTouches", attribute, [values]).toString();
+ static notTouches = (attribute: string, geometry: any[]): string =>
+ new Query("notTouches", attribute, geometry).toString();Optional: define a minimal GeoJSON type union and use it instead of Also applies to: 435-437, 445-447, 455-457, 465-467, 475-477, 485-487, 495-497 🤖 Prompt for AI Agents |
||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||
| * Filter resources where attribute does not intersect with the given geometry. | ||||||||||||||||||||||||
| * | ||||||||||||||||||||||||
| * @param {string} attribute | ||||||||||||||||||||||||
| * @param {any[]} values | ||||||||||||||||||||||||
| * @returns {string} | ||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||
| static notIntersects = (attribute: string, values: any[]): string => | ||||||||||||||||||||||||
| new Query("notIntersects", attribute, [values]).toString(); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||
| * Filter resources where attribute crosses the given geometry. | ||||||||||||||||||||||||
| * | ||||||||||||||||||||||||
| * @param {string} attribute | ||||||||||||||||||||||||
| * @param {any[]} values | ||||||||||||||||||||||||
| * @returns {string} | ||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||
| static crosses = (attribute: string, values: any[]): string => | ||||||||||||||||||||||||
| new Query("crosses", attribute, [values]).toString(); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||
| * Filter resources where attribute does not cross the given geometry. | ||||||||||||||||||||||||
| * | ||||||||||||||||||||||||
| * @param {string} attribute | ||||||||||||||||||||||||
| * @param {any[]} values | ||||||||||||||||||||||||
| * @returns {string} | ||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||
| static notCrosses = (attribute: string, values: any[]): string => | ||||||||||||||||||||||||
| new Query("notCrosses", attribute, [values]).toString(); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||
| * Filter resources where attribute overlaps with the given geometry. | ||||||||||||||||||||||||
| * | ||||||||||||||||||||||||
| * @param {string} attribute | ||||||||||||||||||||||||
| * @param {any[]} values | ||||||||||||||||||||||||
| * @returns {string} | ||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||
| static overlaps = (attribute: string, values: any[]): string => | ||||||||||||||||||||||||
| new Query("overlaps", attribute, [values]).toString(); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||
| * Filter resources where attribute does not overlap with the given geometry. | ||||||||||||||||||||||||
| * | ||||||||||||||||||||||||
| * @param {string} attribute | ||||||||||||||||||||||||
| * @param {any[]} values | ||||||||||||||||||||||||
| * @returns {string} | ||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||
| static notOverlaps = (attribute: string, values: any[]): string => | ||||||||||||||||||||||||
| new Query("notOverlaps", attribute, [values]).toString(); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||
| * Filter resources where attribute touches the given geometry. | ||||||||||||||||||||||||
| * | ||||||||||||||||||||||||
| * @param {string} attribute | ||||||||||||||||||||||||
| * @param {any[]} values | ||||||||||||||||||||||||
| * @returns {string} | ||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||
| static touches = (attribute: string, values: any[]): string => | ||||||||||||||||||||||||
| new Query("touches", attribute, [values]).toString(); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||
| * Filter resources where attribute does not touch the given geometry. | ||||||||||||||||||||||||
| * | ||||||||||||||||||||||||
| * @param {string} attribute | ||||||||||||||||||||||||
| * @param {any[]} values | ||||||||||||||||||||||||
| * @returns {string} | ||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||
| static notTouches = (attribute: string, values: any[]): string => | ||||||||||||||||||||||||
| new Query("notTouches", attribute, [values]).toString(); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.