@leyyo/query 1.0.1
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/LICENSE +24 -0
- package/README.md +25 -0
- package/dist/assets/.gitkeep +0 -0
- package/dist/assets/icon.svg +7 -0
- package/dist/condition/condition-type.d.ts +3 -0
- package/dist/condition/condition-type.js +139 -0
- package/dist/condition/index.d.ts +1 -0
- package/dist/condition/index.js +17 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +18 -0
- package/dist/index.types.d.ts +37 -0
- package/dist/index.types.js +2 -0
- package/package.json +71 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Samet Global
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
Web: https://sametglobal.com
|
|
24
|
+
Responsible: Mustafa Yelmer (mustafay@samet.com.tr)
|
package/README.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Leyyo Query
|
|
2
|
+
Query library for Leyyo framework
|
|
3
|
+
|
|
4
|
+
## Import
|
|
5
|
+
- `npm i @leyyo/query`
|
|
6
|
+
|
|
7
|
+
## Standards
|
|
8
|
+
- Language: `TS`
|
|
9
|
+
- Eslint: `Yes`
|
|
10
|
+
- Static Code Analysis: `Yes` *IntelliJ Code Inspections*
|
|
11
|
+
- DDD - Document Driven: `Yes`
|
|
12
|
+
- DDD - Domain Driven: `Yes`
|
|
13
|
+
- EDD - Exception Driven: `Yes`
|
|
14
|
+
- TDD - Test Driven: `Yes`
|
|
15
|
+
- LDD - Log Driven: `Yes`
|
|
16
|
+
- 12FA - 12 Factor-App: `50%` *Partially*
|
|
17
|
+
|
|
18
|
+
## Dependencies
|
|
19
|
+
### NO
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
### Prepared by
|
|
23
|
+
- Mustafa Yelmer
|
|
24
|
+
- mustafayelmer(at)gmail.com
|
|
25
|
+
- `2021-03-10`
|
|
File without changes
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
2
|
+
<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
+
<rect width="24" height="24" rx="4" fill="#03a56f" />
|
|
4
|
+
<g transform="scale(0.9)" transform-origin="12 12" stroke-width="1">
|
|
5
|
+
<path d="M21 6H19M21 12H16M21 18H16M7 20V13.5612C7 13.3532 7 13.2492 6.97958 13.1497C6.96147 13.0615 6.93151 12.9761 6.89052 12.8958C6.84431 12.8054 6.77934 12.7242 6.64939 12.5617L3.35061 8.43826C3.22066 8.27583 3.15569 8.19461 3.10948 8.10417C3.06849 8.02393 3.03853 7.93852 3.02042 7.85026C3 7.75078 3 7.64677 3 7.43875V5.6C3 5.03995 3 4.75992 3.10899 4.54601C3.20487 4.35785 3.35785 4.20487 3.54601 4.10899C3.75992 4 4.03995 4 4.6 4H13.4C13.9601 4 14.2401 4 14.454 4.10899C14.6422 4.20487 14.7951 4.35785 14.891 4.54601C15 4.75992 15 5.03995 15 5.6V7.43875C15 7.64677 15 7.75078 14.9796 7.85026C14.9615 7.93852 14.9315 8.02393 14.8905 8.10417C14.8443 8.19461 14.7793 8.27583 14.6494 8.43826L11.3506 12.5617C11.2207 12.7242 11.1557 12.8054 11.1095 12.8958C11.0685 12.9761 11.0385 13.0615 11.0204 13.1497C11 13.2492 11 13.3532 11 13.5612V17L7 20Z" stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
6
|
+
</g>
|
|
7
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const ConditionTypeItems: readonly ["==", "!=", "null", "!null", ">", ">=", "<", "<=", "between", "!between", "in", "!in", "^", "!^", "$", "!$", "matches", "!matches", "contains", "!contains", "contained", "!contained", "true", "false", "includes", "!includes", "intersects", "!intersects", "exists", "!exists"];
|
|
2
|
+
export type ConditionType = typeof ConditionTypeItems[number];
|
|
3
|
+
export declare const ConditionTypeMap: Record<string, ConditionType>;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConditionTypeMap = exports.ConditionTypeItems = void 0;
|
|
4
|
+
exports.ConditionTypeItems = [
|
|
5
|
+
// all
|
|
6
|
+
'==',
|
|
7
|
+
'!=',
|
|
8
|
+
'null',
|
|
9
|
+
'!null',
|
|
10
|
+
// string, number
|
|
11
|
+
'>',
|
|
12
|
+
'>=',
|
|
13
|
+
'<',
|
|
14
|
+
'<=',
|
|
15
|
+
'between',
|
|
16
|
+
'!between',
|
|
17
|
+
'in',
|
|
18
|
+
'!in',
|
|
19
|
+
// string
|
|
20
|
+
'^',
|
|
21
|
+
'!^',
|
|
22
|
+
'$',
|
|
23
|
+
'!$',
|
|
24
|
+
'matches',
|
|
25
|
+
'!matches',
|
|
26
|
+
'contains', // left includes right
|
|
27
|
+
'!contains', // left does not include right
|
|
28
|
+
'contained', // right includes left
|
|
29
|
+
'!contained', // right does not include left
|
|
30
|
+
// boolean
|
|
31
|
+
'true',
|
|
32
|
+
'false',
|
|
33
|
+
// array object
|
|
34
|
+
'includes',
|
|
35
|
+
'!includes',
|
|
36
|
+
'intersects',
|
|
37
|
+
'!intersects',
|
|
38
|
+
// json object
|
|
39
|
+
'exists',
|
|
40
|
+
'!exists',
|
|
41
|
+
];
|
|
42
|
+
// noinspection JSUnusedGlobalSymbols
|
|
43
|
+
exports.ConditionTypeMap = {
|
|
44
|
+
// all
|
|
45
|
+
'eq': '==',
|
|
46
|
+
'=': '==',
|
|
47
|
+
'equals': '==',
|
|
48
|
+
'equal': '==',
|
|
49
|
+
'ne': '!=',
|
|
50
|
+
'<>': '!=',
|
|
51
|
+
'not-equals': '!=',
|
|
52
|
+
'not-equal': '!=',
|
|
53
|
+
'is-null': 'null',
|
|
54
|
+
'!': 'null',
|
|
55
|
+
'nil': 'null',
|
|
56
|
+
'!!': '!null',
|
|
57
|
+
'not-null': '!null',
|
|
58
|
+
// string, number
|
|
59
|
+
'greater-than': '>',
|
|
60
|
+
'gt': '>',
|
|
61
|
+
'greater-than-or-equals': '>=',
|
|
62
|
+
'gte': '>=',
|
|
63
|
+
'=>': '>=',
|
|
64
|
+
'less-than': '<',
|
|
65
|
+
'lt': '<',
|
|
66
|
+
'less-than-or-equals': '<=',
|
|
67
|
+
'=<': '<=',
|
|
68
|
+
'lte': '<=',
|
|
69
|
+
'()': 'between',
|
|
70
|
+
'not-between': '!between',
|
|
71
|
+
')(': '!between',
|
|
72
|
+
'[]': 'in',
|
|
73
|
+
'][': '!in',
|
|
74
|
+
'not-in': '!in',
|
|
75
|
+
// string
|
|
76
|
+
'starts-with': '^',
|
|
77
|
+
'start-with': '^',
|
|
78
|
+
'starts': '^',
|
|
79
|
+
'start': '^',
|
|
80
|
+
'not-starts-with': '!^',
|
|
81
|
+
'not-start-with': '!^',
|
|
82
|
+
'not-starts': '!^',
|
|
83
|
+
'not-start': '!^',
|
|
84
|
+
'!starts-with': '!^',
|
|
85
|
+
'!start-with': '!^',
|
|
86
|
+
'!starts': '!^',
|
|
87
|
+
'!start': '!^',
|
|
88
|
+
'ends-with': '$',
|
|
89
|
+
'end-with': '$',
|
|
90
|
+
'ends': '$',
|
|
91
|
+
'end': '$',
|
|
92
|
+
'not-end-with': '!$',
|
|
93
|
+
'not-ends': '!$',
|
|
94
|
+
'not-end': '!$',
|
|
95
|
+
'!$': '!$',
|
|
96
|
+
'!ends-with': '!$',
|
|
97
|
+
'!end-with': '!$',
|
|
98
|
+
'!ends': '!$',
|
|
99
|
+
'!end': '!$',
|
|
100
|
+
'match': 'matches',
|
|
101
|
+
'not-matches': '!matches',
|
|
102
|
+
'not-match': '!matches',
|
|
103
|
+
'!match': '!matches',
|
|
104
|
+
'!matches': '!matches',
|
|
105
|
+
'like': 'contains',
|
|
106
|
+
'likes': 'contains',
|
|
107
|
+
'contain': 'contains',
|
|
108
|
+
'not-contains': '!contains',
|
|
109
|
+
'not-contain': '!contains',
|
|
110
|
+
'!contain': '!contains',
|
|
111
|
+
'not-likes': '!contains',
|
|
112
|
+
'not-like': '!contains',
|
|
113
|
+
'!likes': '!contains',
|
|
114
|
+
'!like': '!contains',
|
|
115
|
+
// boolean
|
|
116
|
+
'yes': 'true',
|
|
117
|
+
'on': 'true',
|
|
118
|
+
'ok': 'true',
|
|
119
|
+
'no': 'false',
|
|
120
|
+
'off': 'false',
|
|
121
|
+
'none': 'false',
|
|
122
|
+
// array object
|
|
123
|
+
'include': 'includes',
|
|
124
|
+
'not-includes': '!includes',
|
|
125
|
+
'not-include': '!includes',
|
|
126
|
+
'!include': '!includes',
|
|
127
|
+
'intersect': 'intersects',
|
|
128
|
+
'not-intersects': '!intersects',
|
|
129
|
+
'not-intersect': '!intersects',
|
|
130
|
+
'!intersect': '!intersects',
|
|
131
|
+
'exist': 'exists',
|
|
132
|
+
'?': 'exists',
|
|
133
|
+
'??': 'exists',
|
|
134
|
+
'not-exists': '!exists',
|
|
135
|
+
'not-exist': '!exists',
|
|
136
|
+
'!?': '!exists',
|
|
137
|
+
'!??': '!exists',
|
|
138
|
+
'!exist': '!exists',
|
|
139
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './condition-type';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./condition-type"), exports);
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./index.types"), exports);
|
|
18
|
+
__exportStar(require("./condition"), exports);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ConditionType } from "./condition";
|
|
2
|
+
import { KeyOf, Keys } from "@leyyo/common";
|
|
3
|
+
export type OrderType = 'asc' | 'desc';
|
|
4
|
+
export type OrderByAny<T> = KeyOf<T> | Keys<T> | Array<OrderBy<T>>;
|
|
5
|
+
export interface OrderBy<T> {
|
|
6
|
+
field: KeyOf<T>;
|
|
7
|
+
asc: boolean | OrderType;
|
|
8
|
+
}
|
|
9
|
+
export type PaginationAny = PaginationPage | PaginationLimit | PaginationLiteral;
|
|
10
|
+
export interface PaginationPage {
|
|
11
|
+
page?: number;
|
|
12
|
+
size?: number;
|
|
13
|
+
}
|
|
14
|
+
export interface PaginationLimit {
|
|
15
|
+
limit?: number;
|
|
16
|
+
offset?: number;
|
|
17
|
+
}
|
|
18
|
+
export type PaginationLiteral = [number?, number?];
|
|
19
|
+
export type WhereValue<T, K extends keyof T = keyof T> = {
|
|
20
|
+
[P in K]: T[P];
|
|
21
|
+
};
|
|
22
|
+
export type WhereAny<T> = WhereValue<T> | Array<Where<T>>;
|
|
23
|
+
export interface Where<T> {
|
|
24
|
+
field: KeyOf<T>;
|
|
25
|
+
condition?: string | ConditionType;
|
|
26
|
+
value: unknown;
|
|
27
|
+
lambda?: string;
|
|
28
|
+
}
|
|
29
|
+
export type SelectAny<T> = '*' | string | Keys<T>;
|
|
30
|
+
export type GroupByAny<T> = Keys<T>;
|
|
31
|
+
export interface QueryAny<T = Record<string, unknown>> {
|
|
32
|
+
select: SelectAny<T>;
|
|
33
|
+
where?: WhereAny<T>;
|
|
34
|
+
groupBy?: GroupByAny<T>;
|
|
35
|
+
orderBy?: OrderByAny<T>;
|
|
36
|
+
pagination?: PaginationAny;
|
|
37
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@leyyo/query",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Query common component",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"Query"
|
|
7
|
+
],
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/leyyonet/query.git"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"email": "mustafayelmer@gmail.com",
|
|
14
|
+
"url": "https://https://github.com/leyyonet/query/issues"
|
|
15
|
+
},
|
|
16
|
+
"homepage": "https://https://github.com/leyyonet/query#readme",
|
|
17
|
+
"author": {
|
|
18
|
+
"name": "Mustafa Yelmer",
|
|
19
|
+
"email": "mustafayelmer@gmail.com"
|
|
20
|
+
},
|
|
21
|
+
"main": "dist/index.js",
|
|
22
|
+
"type": "commonjs",
|
|
23
|
+
"scripts": {
|
|
24
|
+
"clear": "rimraf dist && rimraf coverage",
|
|
25
|
+
"clear:nm": "rimraf node_modules && npm run clear",
|
|
26
|
+
"lint": "eslint src/**/*.ts --quiet",
|
|
27
|
+
"lint:verbose": "eslint src/**/*.ts",
|
|
28
|
+
"asset": "node -r ts-node/register commands/assets.ts",
|
|
29
|
+
"build": "npm run clear && tsc && npm run asset",
|
|
30
|
+
"test": "jest --config=jest.json --detectOpenHandles",
|
|
31
|
+
"coverage": "rimraf coverage && jest --config=jest.json --coverage --coverageDirectory=coverage",
|
|
32
|
+
"sample": "node -r ts-node/register src/sample.ts",
|
|
33
|
+
"publish:public": "npm run build && npm publish -access=public"
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"dist/*"
|
|
37
|
+
],
|
|
38
|
+
"license": "ISC",
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@babel/preset-env": "^7.28.0",
|
|
41
|
+
"@babel/preset-typescript": "^7.27.1",
|
|
42
|
+
"@eslint/js": "^9.33.0",
|
|
43
|
+
"@types/jest": "^30.0.0",
|
|
44
|
+
"@types/node": "^24.2.1",
|
|
45
|
+
"@typescript-eslint/eslint-plugin": "^8.39.1",
|
|
46
|
+
"@typescript-eslint/parser": "^8.39.1",
|
|
47
|
+
"eslint": "^9.33.0",
|
|
48
|
+
"eslint-config-prettier": "^10.1.8",
|
|
49
|
+
"eslint-config-standard": "^17.1.0",
|
|
50
|
+
"eslint-plugin-import": "^2.32.0",
|
|
51
|
+
"eslint-plugin-jsdoc": "^54.0.0",
|
|
52
|
+
"eslint-plugin-node": "^11.1.0",
|
|
53
|
+
"husky": "^9.1.7",
|
|
54
|
+
"jest": "^29.7.0",
|
|
55
|
+
"prettier": "^3.6.2",
|
|
56
|
+
"rimraf": "^6.0.1",
|
|
57
|
+
"test": "^3.3.0",
|
|
58
|
+
"ts-jest": "^29.4.1",
|
|
59
|
+
"ts-node": "^10.9.2",
|
|
60
|
+
"typescript": "^5.9.2",
|
|
61
|
+
"typescript-eslint": "^8.39.1"
|
|
62
|
+
},
|
|
63
|
+
"overrides": {
|
|
64
|
+
"eslint-config-standard": {
|
|
65
|
+
"eslint": "^9.33.0"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"dependencies": {
|
|
69
|
+
"@leyyo/common": "^1.0.13"
|
|
70
|
+
}
|
|
71
|
+
}
|