typed-gridify-builder 1.0.0
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 +24 -0
- package/src/index.ts +51 -0
- package/tsconfig.json +12 -0
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "typed-gridify-builder",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"author": "uldahlalex",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc"
|
|
16
|
+
},
|
|
17
|
+
"peerDependencies": {
|
|
18
|
+
"gridify-client": ">=2"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"gridify-client": "^2.2.0",
|
|
22
|
+
"typescript": "^5"
|
|
23
|
+
}
|
|
24
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { GridifyQueryBuilder, ConditionalOperator } from "gridify-client";
|
|
2
|
+
import type { IGridifyQuery } from "gridify-client";
|
|
3
|
+
|
|
4
|
+
export type { IGridifyQuery };
|
|
5
|
+
export type GridifyQueryBuilderOptions = ConstructorParameters<typeof GridifyQueryBuilder>[0];
|
|
6
|
+
export { ConditionalOperator } from "gridify-client";
|
|
7
|
+
export { LogicalOperator } from "gridify-client";
|
|
8
|
+
|
|
9
|
+
type Key<T> = keyof T & string;
|
|
10
|
+
|
|
11
|
+
export class TypedGridifyQueryBuilder<T> extends GridifyQueryBuilder {
|
|
12
|
+
constructor(options?: GridifyQueryBuilderOptions) {
|
|
13
|
+
super(options);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
override setPage(page: number): this {
|
|
17
|
+
return super.setPage(page) as this;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
override setPageSize(pageSize: number): this {
|
|
21
|
+
return super.setPageSize(pageSize) as this;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
override addOrderBy(field: Key<T>, descending?: boolean): this {
|
|
25
|
+
return super.addOrderBy(field, descending) as this;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
override addCondition(field: Key<T>, operator: ConditionalOperator | string, value: string | number | boolean, caseSensitive?: boolean, escapeValue?: boolean): this {
|
|
29
|
+
return super.addCondition(field, operator, value, caseSensitive, escapeValue) as this;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
override startGroup(): this {
|
|
33
|
+
return super.startGroup() as this;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
override endGroup(): this {
|
|
37
|
+
return super.endGroup() as this;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
override and(optional?: boolean): this {
|
|
41
|
+
return super.and(optional) as this;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
override or(optional?: boolean): this {
|
|
45
|
+
return super.or(optional) as this;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
override build(): IGridifyQuery {
|
|
49
|
+
return super.build();
|
|
50
|
+
}
|
|
51
|
+
}
|