@medyll/idae-query 0.147.0 → 0.149.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/README.md +10 -10
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/query/query.js +1 -1
- package/package.json +59 -60
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ npm install @medyll/idae-query
|
|
|
20
20
|
Here's a quick example to get you started:
|
|
21
21
|
|
|
22
22
|
```typescript
|
|
23
|
-
import {
|
|
23
|
+
import { getResultSet } from '@medyll/idae-query';
|
|
24
24
|
|
|
25
25
|
const data = [
|
|
26
26
|
{ id: 1, name: 'John', age: 25, metadata: { order: 1 } },
|
|
@@ -29,7 +29,7 @@ const data = [
|
|
|
29
29
|
{ id: 4, name: 'Alice', age: 40, metadata: { order: 4 } },
|
|
30
30
|
];
|
|
31
31
|
|
|
32
|
-
const resultSet =
|
|
32
|
+
const resultSet = getResultSet(data);
|
|
33
33
|
|
|
34
34
|
// Sorting
|
|
35
35
|
const sortedData = resultSet.sortBy({ age: 'asc' });
|
|
@@ -55,38 +55,38 @@ console.log(pageData);
|
|
|
55
55
|
|
|
56
56
|
### Multi-criteria Sorting
|
|
57
57
|
```typescript
|
|
58
|
-
const resultSet =
|
|
58
|
+
const resultSet = getResultSet(data);
|
|
59
59
|
const sorted = resultSet.sortBy({ age: 'asc', name: 'desc' });
|
|
60
60
|
// Tri d'abord par age croissant, puis par name décroissant
|
|
61
61
|
```
|
|
62
62
|
|
|
63
63
|
### Grouping by Nested Property
|
|
64
64
|
```typescript
|
|
65
|
-
const resultSet =
|
|
65
|
+
const resultSet = getResultSet(data);
|
|
66
66
|
const grouped = resultSet.groupBy('metadata.order');
|
|
67
67
|
// Regroupe par la propriété imbriquée metadata.order
|
|
68
68
|
```
|
|
69
69
|
|
|
70
70
|
### Pagination
|
|
71
71
|
```typescript
|
|
72
|
-
const resultSet =
|
|
72
|
+
const resultSet = getResultSet(data);
|
|
73
73
|
const page1 = resultSet.getPage(1, 2); // Page 1, 2 éléments
|
|
74
74
|
const page2 = resultSet.getPage(2, 2); // Page 2, 2 éléments
|
|
75
75
|
```
|
|
76
76
|
|
|
77
77
|
### Combined Example
|
|
78
78
|
```typescript
|
|
79
|
-
const resultSet =
|
|
79
|
+
const resultSet = getResultSet(data)
|
|
80
80
|
.sortBy({ age: 'asc' })
|
|
81
81
|
.groupBy('age');
|
|
82
82
|
const page = resultSet.getPage(1, 2);
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
-
All operators are used via the main API (`
|
|
85
|
+
All operators are used via the main API (`getResultSet` or `Query`).
|
|
86
86
|
|
|
87
|
-
### Example with
|
|
87
|
+
### Example with getResultSet
|
|
88
88
|
```typescript
|
|
89
|
-
import {
|
|
89
|
+
import { getResultSet } from '@medyll/idae-query';
|
|
90
90
|
|
|
91
91
|
const data = [
|
|
92
92
|
{ id: 1, name: 'John', age: 25 },
|
|
@@ -94,7 +94,7 @@ const data = [
|
|
|
94
94
|
{ id: 3, name: 'Bob', age: 35 },
|
|
95
95
|
];
|
|
96
96
|
|
|
97
|
-
const resultSet =
|
|
97
|
+
const resultSet = getResultSet(data);
|
|
98
98
|
|
|
99
99
|
// eq
|
|
100
100
|
const eqResult = resultSet.where({ age: { eq: 30 } }); // [{ id: 2, name: 'Jane', age: 30 }]
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// auto exports of entry components
|
|
2
2
|
export * from './types.js';
|
|
3
3
|
export * from './resultSet/resultset.js';
|
|
4
|
-
export * from './operators/operators.js';
|
|
5
4
|
export * from './query/query.js';
|
|
6
5
|
export * from './path/pathResolver.js';
|
|
6
|
+
export * from './operators/operators.js';
|
package/dist/query/query.js
CHANGED
package/package.json
CHANGED
|
@@ -1,62 +1,61 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
"type": "module"
|
|
2
|
+
"name": "@medyll/idae-query",
|
|
3
|
+
"scope": "@medyll",
|
|
4
|
+
"version": "0.149.0",
|
|
5
|
+
"description": "A powerful and flexible query library for TypeScript and JavaScript applications, featuring a MongoDB-like query interface, strong TypeScript support, and easy integration with front-end frameworks.",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite dev",
|
|
8
|
+
"build": "vite build && npm run package",
|
|
9
|
+
"preview": "vite preview",
|
|
10
|
+
"package": "svelte-kit sync && svelte-package && publint",
|
|
11
|
+
"package:watch": "svelte-kit sync && svelte-package --watch",
|
|
12
|
+
"prepublishOnly": "npm run package",
|
|
13
|
+
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
14
|
+
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
|
15
|
+
"test": "vitest",
|
|
16
|
+
"lint": "prettier --check . && eslint .",
|
|
17
|
+
"format": "prettier --write .",
|
|
18
|
+
"package:pre": "node scripts/package-pre.js"
|
|
19
|
+
},
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"svelte": "./dist/index.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"dist",
|
|
28
|
+
"!dist/**/*.test.*",
|
|
29
|
+
"!dist/**/*.spec.*"
|
|
30
|
+
],
|
|
31
|
+
"dependencies": {},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"svelte": "^5.0.0-next"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@medyll/idae-prettier-config": "next",
|
|
37
|
+
"@medyll/idae-engine": "next",
|
|
38
|
+
"@sveltejs/adapter-auto": "^6.0.0",
|
|
39
|
+
"@sveltejs/kit": "^2.20.7",
|
|
40
|
+
"@sveltejs/package": "^2.3.11",
|
|
41
|
+
"@sveltejs/vite-plugin-svelte": "^5.0.3",
|
|
42
|
+
"@types/eslint": "^9.6.1",
|
|
43
|
+
"@vitest/coverage-v8": "^3.1.1",
|
|
44
|
+
"eslint": "^9.25.0",
|
|
45
|
+
"eslint-config-prettier": "^10.1.2",
|
|
46
|
+
"eslint-plugin-svelte": "^3.5.1",
|
|
47
|
+
"globals": "^16.0.0",
|
|
48
|
+
"prettier": "^3.5.3",
|
|
49
|
+
"prettier-plugin-svelte": "^3.3.3",
|
|
50
|
+
"svelte": "^5.28.1",
|
|
51
|
+
"svelte-check": "^4.1.6",
|
|
52
|
+
"tslib": "^2.8.1",
|
|
53
|
+
"typescript": "^5.8.3",
|
|
54
|
+
"typescript-eslint": "^8.30.1",
|
|
55
|
+
"vite": "^6.3.2",
|
|
56
|
+
"vitest": "^3.1.1"
|
|
57
|
+
},
|
|
58
|
+
"svelte": "./dist/index.js",
|
|
59
|
+
"types": "./dist/index.d.ts",
|
|
60
|
+
"type": "module"
|
|
62
61
|
}
|