sdk-for-node
sdk-for-node copied to clipboard
🐛 Bug Report: Query.contains, Query.or, and Query.and are missing from typescript types
👟 Reproduction steps
When I try to access the contains value on the Query
class like so: Query.contains('property', 123)
, I get the following typescript error: Property 'contains' does not exist on type 'typeof Query'.ts(2339)
When I go into the index.d.ts file for node-app write the contains
function is not present:
export class Query {
static equal(attribute: string, value: QueryTypes): string;
static notEqual(attribute: string, value: QueryTypes): string;
static lessThan(attribute: string, value: QueryTypes): string;
static lessThanEqual(attribute: string, value: QueryTypes): string;
static greaterThan(attribute: string, value: QueryTypes): string;
static greaterThanEqual(attribute: string, value: QueryTypes): string;
static isNull(attribute: string): string;
static isNotNull(attribute: string): string;
static between<T extends string | number>(attribute: string, start: T, end: T): string;
static startsWith(attribute: string, value: string): string;
static endsWith(attribute: string, value: string): string;
static select(attributes: string[]): string;
static search(attribute: string, value: string): string;
static orderDesc(attribute: string): string;
static orderAsc(attribute: string): string;
static cursorAfter(documentId: string): string;
static cursorBefore(documentId: string): string;
static limit(value: number): string;
static offset(value: number): string;
private static addQuery(attribute: string, method: string, value: QueryTypes): string;
private static parseValues(value: QueryTypes): string;
}
However, when I go to node-app write/lib/query.js the contains function is present:
class Query {
constructor(method, attribute, values) {
this.method = method
this.attribute = attribute
if (values !== undefined) {
if (Array.isArray(values)) {
this.values = values
} else {
this.values = [values]
}
}
}
...
static contains = (attribute, value) =>
new Query("contains", attribute, value).toString()
static or = (queries) =>
new Query("or", undefined, queries.map((query) => JSON.parse(query))).toString()
static and = (queries) =>
new Query("and", undefined, queries.map((query) => JSON.parse(query))).toString();
}
👍 Expected behavior
The contains
, or
and and
functions on the Query class should be present in the index.d.ts file
👎 Actual Behavior
The
contains,
orand
and` functions on the Query class is not present in the index.d.ts file
🎲 Appwrite version
Version 0.10.x
💻 Operating system
MacOS
🧱 Your Environment
No response
👀 Have you spent some time to check if this issue has been raised before?
- [X] I checked and didn't find similar issue
🏢 Have you read the Code of Conduct?
- [X] I have read the Code of Conduct
As a quickfix you should try
declare class Query {
static contains(attribute: string, value: QueryTypes): string
static or(queries: Query[]): string;
static and(queries: Query[]): string;
}
This should be fixed in https://www.npmjs.com/package/node-appwrite/v/12.1.0-rc.4