@taruvi/sdk 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -27,11 +27,13 @@ export class Database<T = Record<string, unknown>> {
|
|
|
27
27
|
return new Database<U>(this.client, { ...this.urlParams, dataTables }, undefined, undefined)
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
filter(field: string, operator: FilterOperator, value: string | number | boolean): Database<T> {
|
|
30
|
+
filter(field: string, operator: FilterOperator, value: string | number | boolean | (string | number)[]): Database<T> {
|
|
31
31
|
const filterKey = operator === 'eq' ? field : `${field}__${operator}`
|
|
32
|
+
// For 'in' and 'nin' operators, join array values with comma
|
|
33
|
+
const filterValue = Array.isArray(value) ? value.join(',') : value
|
|
32
34
|
return new Database<T>(this.client, { ...this.urlParams }, undefined, undefined, {
|
|
33
35
|
...this.queryParams,
|
|
34
|
-
[filterKey]:
|
|
36
|
+
[filterKey]: filterValue
|
|
35
37
|
})
|
|
36
38
|
}
|
|
37
39
|
|
|
@@ -46,7 +48,7 @@ export class Database<T = Record<string, unknown>> {
|
|
|
46
48
|
pageSize(size: number): Database<T> {
|
|
47
49
|
return new Database<T>(this.client, { ...this.urlParams }, undefined, undefined, {
|
|
48
50
|
...this.queryParams,
|
|
49
|
-
|
|
51
|
+
page_size: size
|
|
50
52
|
})
|
|
51
53
|
}
|
|
52
54
|
|
package/src/types.ts
CHANGED
|
@@ -11,7 +11,7 @@ export interface TaruviConfig {
|
|
|
11
11
|
export interface StorageFilters {
|
|
12
12
|
// Pagination (DRF style)
|
|
13
13
|
page?: number
|
|
14
|
-
|
|
14
|
+
page_size?: number
|
|
15
15
|
|
|
16
16
|
// Range Filters - Size (in bytes)
|
|
17
17
|
size__gte?: number
|
|
@@ -58,11 +58,14 @@ export interface StorageFilters {
|
|
|
58
58
|
export interface DatabaseFilters {
|
|
59
59
|
// Pagination (DRF style)
|
|
60
60
|
page?: number
|
|
61
|
-
|
|
61
|
+
page_size?: number
|
|
62
62
|
|
|
63
63
|
// Sorting (DRF style: "-field" for desc, "field" for asc)
|
|
64
64
|
ordering?: string
|
|
65
65
|
|
|
66
|
+
// Populate relations
|
|
67
|
+
populate?: string
|
|
68
|
+
|
|
66
69
|
// Dynamic filters - allows any field with operators
|
|
67
70
|
[key: string]: string | number | boolean | undefined
|
|
68
71
|
}
|