@litepos/autoquery 5.0.2 → 5.0.5
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/dist/index.d.ts +29 -30
- package/dist/index.js +8 -9
- package/package.json +34 -31
package/dist/index.d.ts
CHANGED
|
@@ -90,20 +90,20 @@ declare enum NumericOperators {
|
|
|
90
90
|
'NotEqualTo' = 10,
|
|
91
91
|
}
|
|
92
92
|
declare enum StringOperators {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
93
|
+
Contains = 0,
|
|
94
|
+
NotContains = 1,
|
|
95
|
+
StartsWith = 2,
|
|
96
|
+
EndsWith = 3,
|
|
97
|
+
Like = 4,
|
|
98
98
|
}
|
|
99
99
|
declare enum ArrayOperators {
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
In = 0,
|
|
101
|
+
NotIn = 1,
|
|
102
102
|
}
|
|
103
103
|
declare enum NullOperators {
|
|
104
|
-
|
|
104
|
+
IsNull = 0,
|
|
105
105
|
// Check if field IS NULL
|
|
106
|
-
|
|
106
|
+
IsNotNull = 1,
|
|
107
107
|
}
|
|
108
108
|
declare enum MonthOperator {
|
|
109
109
|
WithinAMonth = "Contains",
|
|
@@ -112,25 +112,25 @@ declare enum DayOperator {
|
|
|
112
112
|
At = "StartsWith",
|
|
113
113
|
}
|
|
114
114
|
declare enum DateOperators {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
115
|
+
GreaterThan = 0,
|
|
116
|
+
GreaterThanOrEqualTo = 1,
|
|
117
|
+
LessThan = 2,
|
|
118
|
+
LessThanOrEqualTo = 3,
|
|
119
|
+
Between = 4,
|
|
120
120
|
// BETWEEN value1 AND value2
|
|
121
|
-
|
|
121
|
+
StartsWith = 5,
|
|
122
122
|
// For exact date matching (e.g., "2019-01-01")
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
123
|
+
Contains = 6,
|
|
124
|
+
}
|
|
125
|
+
interface DateOperatorValueMap {
|
|
126
|
+
GreaterThan: string;
|
|
127
|
+
GreaterThanOrEqualTo: string;
|
|
128
|
+
LessThan: string;
|
|
129
|
+
LessThanOrEqualTo: string;
|
|
130
|
+
Between: [string, string];
|
|
131
|
+
StartsWith: string;
|
|
132
|
+
Contains: MonthValues;
|
|
133
|
+
}
|
|
134
134
|
declare enum MonthValues {
|
|
135
135
|
Jan = "-01-",
|
|
136
136
|
Feb = "-02-",
|
|
@@ -154,11 +154,10 @@ declare class QueryBuilder<T> {
|
|
|
154
154
|
take(take: number): this;
|
|
155
155
|
sortBy<K extends keyof T>(property: K, orderBy: SortOrder): this;
|
|
156
156
|
jsconfig(param: string): this;
|
|
157
|
-
|
|
158
|
-
_build(): Record<string, string>;
|
|
157
|
+
build(): Record<string, string>;
|
|
159
158
|
}
|
|
160
|
-
|
|
159
|
+
interface QueryEtcParams {
|
|
161
160
|
search_keywords?: string;
|
|
162
|
-
}
|
|
161
|
+
}
|
|
163
162
|
//#endregion
|
|
164
163
|
export { ArrayOperators, DateOperatorValueMap, DateOperators, DayOperator, EnumToString, IBaseParams, IInvoiceParams, IInvoicesQuery, IQueryResponse, InvoicesQuery, MonthOperator, MonthValues, NullOperators, NumericOperators, Operator, OperatorValueMap, QueryBuilder, QueryEtcParams, QueryResponse, QueryableType, ResponseStatus, SortOrder, StringOperators, ValidationError };
|
package/dist/index.js
CHANGED
|
@@ -102,29 +102,28 @@ var QueryBuilder = class {
|
|
|
102
102
|
return this;
|
|
103
103
|
}
|
|
104
104
|
includeTotal(flag) {
|
|
105
|
-
if (flag) this.params
|
|
105
|
+
if (flag) this.params.include = "total";
|
|
106
106
|
return this;
|
|
107
107
|
}
|
|
108
108
|
skip(skip) {
|
|
109
|
-
this.params
|
|
109
|
+
this.params.skip = `${skip}`;
|
|
110
110
|
return this;
|
|
111
111
|
}
|
|
112
112
|
take(take) {
|
|
113
|
-
this.params
|
|
113
|
+
this.params.take = `${take}`;
|
|
114
114
|
return this;
|
|
115
115
|
}
|
|
116
116
|
sortBy(property, orderBy) {
|
|
117
|
-
if (orderBy === SortOrder.Asc) this.params
|
|
118
|
-
else this.params
|
|
117
|
+
if (orderBy === SortOrder.Asc) this.params.OrderBy = `${property.toString()}`;
|
|
118
|
+
else this.params.OrderByDesc = `${property.toString()}`;
|
|
119
119
|
return this;
|
|
120
120
|
}
|
|
121
121
|
jsconfig(param) {
|
|
122
|
-
this.params
|
|
122
|
+
this.params.jsconfig = param;
|
|
123
123
|
return this;
|
|
124
124
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
this.params["jsconfig"] = "dh:iso8601dt";
|
|
125
|
+
build() {
|
|
126
|
+
this.params.jsconfig = "dh:iso8601dt";
|
|
128
127
|
return this.params;
|
|
129
128
|
}
|
|
130
129
|
};
|
package/package.json
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@litepos/autoquery",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.0.
|
|
5
|
-
"packageManager": "pnpm@10.17.1",
|
|
4
|
+
"version": "5.0.5",
|
|
6
5
|
"description": "AutoQuery is a library for building queries for LitePOS.",
|
|
7
6
|
"author": "LitePOS <info@litepos.ai>",
|
|
8
7
|
"license": "MIT",
|
|
9
|
-
"keywords": [
|
|
8
|
+
"keywords": [
|
|
9
|
+
"litepos",
|
|
10
|
+
"autoquery",
|
|
11
|
+
"query",
|
|
12
|
+
"database",
|
|
13
|
+
"sql"
|
|
14
|
+
],
|
|
10
15
|
"sideEffects": false,
|
|
11
16
|
"exports": {
|
|
12
17
|
".": "./dist/index.js",
|
|
@@ -18,39 +23,37 @@
|
|
|
18
23
|
"files": [
|
|
19
24
|
"dist"
|
|
20
25
|
],
|
|
21
|
-
"scripts": {
|
|
22
|
-
"build": "tsdown",
|
|
23
|
-
"dev": "tsdown --watch",
|
|
24
|
-
"lint": "eslint",
|
|
25
|
-
"prepublishOnly": "nr build",
|
|
26
|
-
"release": "bumpp",
|
|
27
|
-
"start": "tsx src/index.ts",
|
|
28
|
-
"test": "vitest",
|
|
29
|
-
"typecheck": "tsc --noEmit",
|
|
30
|
-
"prepare": "simple-git-hooks"
|
|
31
|
-
},
|
|
32
26
|
"devDependencies": {
|
|
33
|
-
"@antfu/eslint-config": "
|
|
34
|
-
"@antfu/ni": "
|
|
35
|
-
"@antfu/utils": "
|
|
36
|
-
"@types/node": "
|
|
37
|
-
"bumpp": "
|
|
38
|
-
"eslint": "
|
|
39
|
-
"lint-staged": "
|
|
40
|
-
"simple-git-hooks": "
|
|
41
|
-
"tinyexec": "
|
|
42
|
-
"tsdown": "
|
|
43
|
-
"tsx": "
|
|
44
|
-
"typescript": "
|
|
45
|
-
"vite": "
|
|
46
|
-
"vitest": "
|
|
47
|
-
"vitest-package-exports": "
|
|
48
|
-
"yaml": "
|
|
27
|
+
"@antfu/eslint-config": "^5.4.1",
|
|
28
|
+
"@antfu/ni": "^26.0.1",
|
|
29
|
+
"@antfu/utils": "^9.2.1",
|
|
30
|
+
"@types/node": "^24.5.2",
|
|
31
|
+
"bumpp": "^10.2.3",
|
|
32
|
+
"eslint": "^9.36.0",
|
|
33
|
+
"lint-staged": "^16.2.0",
|
|
34
|
+
"simple-git-hooks": "^2.13.1",
|
|
35
|
+
"tinyexec": "^1.0.1",
|
|
36
|
+
"tsdown": "^0.15.4",
|
|
37
|
+
"tsx": "^4.20.5",
|
|
38
|
+
"typescript": "^5.9.2",
|
|
39
|
+
"vite": "^7.1.7",
|
|
40
|
+
"vitest": "^3.2.4",
|
|
41
|
+
"vitest-package-exports": "^0.1.1",
|
|
42
|
+
"yaml": "^2.8.1"
|
|
49
43
|
},
|
|
50
44
|
"simple-git-hooks": {
|
|
51
45
|
"pre-commit": "pnpm i --frozen-lockfile --ignore-scripts --offline && npx lint-staged"
|
|
52
46
|
},
|
|
53
47
|
"lint-staged": {
|
|
54
48
|
"*": "eslint --fix"
|
|
49
|
+
},
|
|
50
|
+
"scripts": {
|
|
51
|
+
"build": "tsdown",
|
|
52
|
+
"dev": "tsdown --watch",
|
|
53
|
+
"lint": "eslint",
|
|
54
|
+
"release": "bumpp",
|
|
55
|
+
"start": "tsx src/index.ts",
|
|
56
|
+
"test": "vitest",
|
|
57
|
+
"typecheck": "tsc --noEmit"
|
|
55
58
|
}
|
|
56
|
-
}
|
|
59
|
+
}
|