@medyll/idae-query 0.180.0 → 0.186.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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2024 medyll
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.
1
+ MIT License
2
+
3
+ Copyright (c) 2024 medyll
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.
package/README.md CHANGED
@@ -1,185 +1,185 @@
1
- # @medyll/idae-query
2
-
3
- A powerful and flexible query library for TypeScript and JavaScript applications.
4
-
5
- ## Features
6
-
7
- - Chainable and iterable result sets
8
- - Sorting, grouping, and pagination support
9
- - Dot path resolution for nested properties
10
- - Integration with `@medyll/idae-engine` for data operations
11
-
12
- ## Installation
13
-
14
- ```bash
15
- npm install @medyll/idae-query
16
- ```
17
-
18
- ## Quick Start
19
-
20
- Here's a quick example to get you started:
21
-
22
- ```typescript
23
- import { getResultSet } from '@medyll/idae-query';
24
-
25
- const data = [
26
- { id: 1, name: 'John', age: 25, metadata: { order: 1 } },
27
- { id: 2, name: 'Jane', age: 30, metadata: { order: 2 } },
28
- { id: 3, name: 'Bob', age: 35, metadata: { order: 3 } },
29
- { id: 4, name: 'Alice', age: 40, metadata: { order: 4 } },
30
- ];
31
-
32
- const resultSet = getResultSet(data);
33
-
34
- // Sorting
35
- const sortedData = resultSet.sortBy({ age: 'asc' });
36
-
37
- // Grouping
38
- const groupedData = resultSet.groupBy('age');
39
-
40
- // Pagination
41
- const pageData = resultSet.getPage(1, 2);
42
-
43
- console.log(sortedData);
44
- console.log(groupedData);
45
- console.log(pageData);
46
- ```
47
-
48
- ## API
49
-
50
- ## Operators Demo
51
-
52
- ## Query Operators Usage
53
-
54
- ## Advanced Usage
55
-
56
- ### Multi-criteria Sorting
57
- ```typescript
58
- const resultSet = getResultSet(data);
59
- const sorted = resultSet.sortBy({ age: 'asc', name: 'desc' });
60
- // Tri d'abord par age croissant, puis par name décroissant
61
- ```
62
-
63
- ### Grouping by Nested Property
64
- ```typescript
65
- const resultSet = getResultSet(data);
66
- const grouped = resultSet.groupBy('metadata.order');
67
- // Regroupe par la propriété imbriquée metadata.order
68
- ```
69
-
70
- ### Pagination
71
- ```typescript
72
- const resultSet = getResultSet(data);
73
- const page1 = resultSet.getPage(1, 2); // Page 1, 2 éléments
74
- const page2 = resultSet.getPage(2, 2); // Page 2, 2 éléments
75
- ```
76
-
77
- ### Combined Example
78
- ```typescript
79
- const resultSet = getResultSet(data)
80
- .sortBy({ age: 'asc' })
81
- .groupBy('age');
82
- const page = resultSet.getPage(1, 2);
83
- ```
84
-
85
- All operators are used via the main API (`getResultSet` or `Query`).
86
-
87
- ### Example with getResultSet
88
- ```typescript
89
- import { getResultSet } from '@medyll/idae-query';
90
-
91
- const data = [
92
- { id: 1, name: 'John', age: 25 },
93
- { id: 2, name: 'Jane', age: 30 },
94
- { id: 3, name: 'Bob', age: 35 },
95
- ];
96
-
97
- const resultSet = getResultSet(data);
98
-
99
- // eq
100
- const eqResult = resultSet.where({ age: { eq: 30 } }); // [{ id: 2, name: 'Jane', age: 30 }]
101
-
102
- // gt
103
- const gtResult = resultSet.where({ age: { gt: 25 } }); // [{ id: 2, name: 'Jane', age: 30 }, { id: 3, name: 'Bob', age: 35 }]
104
-
105
- // gte
106
- const gteResult = resultSet.where({ age: { gte: 30 } }); // [{ id: 2, name: 'Jane', age: 30 }, { id: 3, name: 'Bob', age: 35 }]
107
-
108
- // lt
109
- const ltResult = resultSet.where({ age: { lt: 30 } }); // [{ id: 1, name: 'John', age: 25 }]
110
-
111
- // lte
112
- const lteResult = resultSet.where({ age: { lte: 30 } }); // [{ id: 1, name: 'John', age: 25 }, { id: 2, name: 'Jane', age: 30 }]
113
-
114
- // ne
115
- const neResult = resultSet.where({ age: { ne: 25 } }); // [{ id: 2, name: 'Jane', age: 30 }, { id: 3, name: 'Bob', age: 35 }]
116
-
117
- // in
118
- const inResult = resultSet.where({ age: { in: [25, 35] } }); // [{ id: 1, name: 'John', age: 25 }, { id: 3, name: 'Bob', age: 35 }]
119
-
120
- // nin
121
- const ninResult = resultSet.where({ age: { nin: [25, 35] } }); // [{ id: 2, name: 'Jane', age: 30 }]
122
-
123
- // contains
124
- const containsResult = resultSet.where({ name: { contains: 'an' } }); // [{ id: 2, name: 'Jane', age: 30 }]
125
-
126
- // startsWith
127
- const startsWithResult = resultSet.where({ name: { startsWith: 'Ja' } }); // [{ id: 2, name: 'Jane', age: 30 }]
128
-
129
- // endsWith
130
- const endsWithResult = resultSet.where({ name: { endsWith: 'hn' } }); // [{ id: 1, name: 'John', age: 25 }]
131
-
132
- // btw
133
- const btwResult = resultSet.where({ age: { btw: [25, 35] } }); // [{ id: 1, name: 'John', age: 25 }, { id: 2, name: 'Jane', age: 30 }, { id: 3, name: 'Bob', age: 35 }]
134
-
135
- // Custom operator
136
- import { Operators } from '@medyll/idae-query';
137
- Operators.addCustomOperator('isEven', (field, value, data) => data[field] % 2 === 0);
138
- const customResult = resultSet.where({ age: { isEven: true } }); // [{ id: 2, name: 'Jane', age: 30 }]
139
- ```
140
-
141
- ### Example with Query class
142
- ```typescript
143
- import { Query } from '@medyll/idae-query';
144
-
145
- const data = [
146
- { id: 1, value: 10 },
147
- { id: 2, value: 20 },
148
- { id: 3, value: 30 },
149
- ];
150
-
151
- const query = new Query(data);
152
- const result = query.where({ value: { gt: 15, lt: 30 } }); // [{ id: 2, value: 20 }]
153
- ```
154
-
155
- ## API
156
-
157
- ### `getResultset(data: any[]): ResultSet`
158
-
159
- Creates a new result set from the provided data.
160
-
161
- ### `ResultSet`
162
-
163
- A chainable and iterable result set of data.
164
-
165
- #### Methods
166
-
167
- - `setOptions(options: ResultsetOptions): ResultSet` - Sets options for the result set.
168
- - `sortBy(sortOptions: Record<DotPath, 'asc' | 'desc'>): ResultSet` - Sorts the result set by the specified options.
169
- - `groupBy(groupBy: DotPath): Record<string, any[]>` - Groups the result set by the specified property.
170
- - `getPage(page: number, pageSize: number): any[]` - Gets the specified page of data.
171
-
172
- ## Testing
173
-
174
- To run the tests:
175
-
176
- 1. Clone the repository
177
- 2. Install dependencies: `npm install` or `yarn install`
178
- 3. Run tests: `npm test` or `yarn test`
179
-
180
- The tests cover various scenarios for each method, ensuring the reliability and correctness of the `ResultSet` class.
181
-
182
- ## License
183
-
184
- This project is licensed under the MIT License.
185
-
1
+ # @medyll/idae-query
2
+
3
+ A powerful and flexible query library for TypeScript and JavaScript applications.
4
+
5
+ ## Features
6
+
7
+ - Chainable and iterable result sets
8
+ - Sorting, grouping, and pagination support
9
+ - Dot path resolution for nested properties
10
+ - Integration with `@medyll/idae-engine` for data operations
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install @medyll/idae-query
16
+ ```
17
+
18
+ ## Quick Start
19
+
20
+ Here's a quick example to get you started:
21
+
22
+ ```typescript
23
+ import { getResultSet } from '@medyll/idae-query';
24
+
25
+ const data = [
26
+ { id: 1, name: 'John', age: 25, metadata: { order: 1 } },
27
+ { id: 2, name: 'Jane', age: 30, metadata: { order: 2 } },
28
+ { id: 3, name: 'Bob', age: 35, metadata: { order: 3 } },
29
+ { id: 4, name: 'Alice', age: 40, metadata: { order: 4 } },
30
+ ];
31
+
32
+ const resultSet = getResultSet(data);
33
+
34
+ // Sorting
35
+ const sortedData = resultSet.sortBy({ age: 'asc' });
36
+
37
+ // Grouping
38
+ const groupedData = resultSet.groupBy('age');
39
+
40
+ // Pagination
41
+ const pageData = resultSet.getPage(1, 2);
42
+
43
+ console.log(sortedData);
44
+ console.log(groupedData);
45
+ console.log(pageData);
46
+ ```
47
+
48
+ ## API
49
+
50
+ ## Operators Demo
51
+
52
+ ## Query Operators Usage
53
+
54
+ ## Advanced Usage
55
+
56
+ ### Multi-criteria Sorting
57
+ ```typescript
58
+ const resultSet = getResultSet(data);
59
+ const sorted = resultSet.sortBy({ age: 'asc', name: 'desc' });
60
+ // Tri d'abord par age croissant, puis par name décroissant
61
+ ```
62
+
63
+ ### Grouping by Nested Property
64
+ ```typescript
65
+ const resultSet = getResultSet(data);
66
+ const grouped = resultSet.groupBy('metadata.order');
67
+ // Regroupe par la propriété imbriquée metadata.order
68
+ ```
69
+
70
+ ### Pagination
71
+ ```typescript
72
+ const resultSet = getResultSet(data);
73
+ const page1 = resultSet.getPage(1, 2); // Page 1, 2 éléments
74
+ const page2 = resultSet.getPage(2, 2); // Page 2, 2 éléments
75
+ ```
76
+
77
+ ### Combined Example
78
+ ```typescript
79
+ const resultSet = getResultSet(data)
80
+ .sortBy({ age: 'asc' })
81
+ .groupBy('age');
82
+ const page = resultSet.getPage(1, 2);
83
+ ```
84
+
85
+ All operators are used via the main API (`getResultSet` or `Query`).
86
+
87
+ ### Example with getResultSet
88
+ ```typescript
89
+ import { getResultSet } from '@medyll/idae-query';
90
+
91
+ const data = [
92
+ { id: 1, name: 'John', age: 25 },
93
+ { id: 2, name: 'Jane', age: 30 },
94
+ { id: 3, name: 'Bob', age: 35 },
95
+ ];
96
+
97
+ const resultSet = getResultSet(data);
98
+
99
+ // eq
100
+ const eqResult = resultSet.where({ age: { eq: 30 } }); // [{ id: 2, name: 'Jane', age: 30 }]
101
+
102
+ // gt
103
+ const gtResult = resultSet.where({ age: { gt: 25 } }); // [{ id: 2, name: 'Jane', age: 30 }, { id: 3, name: 'Bob', age: 35 }]
104
+
105
+ // gte
106
+ const gteResult = resultSet.where({ age: { gte: 30 } }); // [{ id: 2, name: 'Jane', age: 30 }, { id: 3, name: 'Bob', age: 35 }]
107
+
108
+ // lt
109
+ const ltResult = resultSet.where({ age: { lt: 30 } }); // [{ id: 1, name: 'John', age: 25 }]
110
+
111
+ // lte
112
+ const lteResult = resultSet.where({ age: { lte: 30 } }); // [{ id: 1, name: 'John', age: 25 }, { id: 2, name: 'Jane', age: 30 }]
113
+
114
+ // ne
115
+ const neResult = resultSet.where({ age: { ne: 25 } }); // [{ id: 2, name: 'Jane', age: 30 }, { id: 3, name: 'Bob', age: 35 }]
116
+
117
+ // in
118
+ const inResult = resultSet.where({ age: { in: [25, 35] } }); // [{ id: 1, name: 'John', age: 25 }, { id: 3, name: 'Bob', age: 35 }]
119
+
120
+ // nin
121
+ const ninResult = resultSet.where({ age: { nin: [25, 35] } }); // [{ id: 2, name: 'Jane', age: 30 }]
122
+
123
+ // contains
124
+ const containsResult = resultSet.where({ name: { contains: 'an' } }); // [{ id: 2, name: 'Jane', age: 30 }]
125
+
126
+ // startsWith
127
+ const startsWithResult = resultSet.where({ name: { startsWith: 'Ja' } }); // [{ id: 2, name: 'Jane', age: 30 }]
128
+
129
+ // endsWith
130
+ const endsWithResult = resultSet.where({ name: { endsWith: 'hn' } }); // [{ id: 1, name: 'John', age: 25 }]
131
+
132
+ // btw
133
+ const btwResult = resultSet.where({ age: { btw: [25, 35] } }); // [{ id: 1, name: 'John', age: 25 }, { id: 2, name: 'Jane', age: 30 }, { id: 3, name: 'Bob', age: 35 }]
134
+
135
+ // Custom operator
136
+ import { Operators } from '@medyll/idae-query';
137
+ Operators.addCustomOperator('isEven', (field, value, data) => data[field] % 2 === 0);
138
+ const customResult = resultSet.where({ age: { isEven: true } }); // [{ id: 2, name: 'Jane', age: 30 }]
139
+ ```
140
+
141
+ ### Example with Query class
142
+ ```typescript
143
+ import { Query } from '@medyll/idae-query';
144
+
145
+ const data = [
146
+ { id: 1, value: 10 },
147
+ { id: 2, value: 20 },
148
+ { id: 3, value: 30 },
149
+ ];
150
+
151
+ const query = new Query(data);
152
+ const result = query.where({ value: { gt: 15, lt: 30 } }); // [{ id: 2, value: 20 }]
153
+ ```
154
+
155
+ ## API
156
+
157
+ ### `getResultset(data: any[]): ResultSet`
158
+
159
+ Creates a new result set from the provided data.
160
+
161
+ ### `ResultSet`
162
+
163
+ A chainable and iterable result set of data.
164
+
165
+ #### Methods
166
+
167
+ - `setOptions(options: ResultsetOptions): ResultSet` - Sets options for the result set.
168
+ - `sortBy(sortOptions: Record<DotPath, 'asc' | 'desc'>): ResultSet` - Sorts the result set by the specified options.
169
+ - `groupBy(groupBy: DotPath): Record<string, any[]>` - Groups the result set by the specified property.
170
+ - `getPage(page: number, pageSize: number): any[]` - Gets the specified page of data.
171
+
172
+ ## Testing
173
+
174
+ To run the tests:
175
+
176
+ 1. Clone the repository
177
+ 2. Install dependencies: `npm install` or `yarn install`
178
+ 3. Run tests: `npm test` or `yarn test`
179
+
180
+ The tests cover various scenarios for each method, ensuring the reliability and correctness of the `ResultSet` class.
181
+
182
+ ## License
183
+
184
+ This project is licensed under the MIT License.
185
+
package/cli.js ADDED
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+
6
+
7
+ const pkgJson = require(path.join(__dirname, 'package.json'));
8
+ const packageName = pkgJson.name.replace(/^@[^/]+\//, '');
9
+ const cmd = process.argv[2];
10
+
11
+
12
+ if (cmd === 'get-readme') {
13
+ const readmePath = path.join(__dirname, 'README.md');
14
+ if (fs.existsSync(readmePath)) {
15
+ const content = fs.readFileSync(readmePath, 'utf8');
16
+ console.log(content);
17
+ } else {
18
+ console.error('README.md not found in this package.');
19
+ process.exit(1);
20
+ }
21
+ } else if (cmd === 'install-skill') {
22
+ const readline = require('readline');
23
+ const rl = readline.createInterface({
24
+ input: process.stdin,
25
+ output: process.stdout
26
+ });
27
+ const skillSrc = path.join(__dirname, 'SKILL.md');
28
+ const skillDest = path.resolve(__dirname, `../../../.github/skills/${packageName}/SKILL.md`);
29
+ if (!fs.existsSync(skillSrc)) {
30
+ console.error('SKILL.md not found in this package.');
31
+ process.exit(1);
32
+ }
33
+ rl.question(`This will copy SKILL.md to .github/skills/${packageName}/SKILL.md. Continue? (y/n): `, (answer) => {
34
+ if (answer.trim().toLowerCase() === 'y' || answer.trim().toLowerCase() === 'yes') {
35
+ fs.mkdirSync(path.dirname(skillDest), { recursive: true });
36
+ fs.copyFileSync(skillSrc, skillDest);
37
+ console.log(`SKILL.md installed to .github/skills/${packageName}/SKILL.md`);
38
+ } else {
39
+ console.log('Operation cancelled.');
40
+ }
41
+ rl.close();
42
+ });
43
+ } else {
44
+ console.log('Usage: <cli> get-readme | install-skill');
45
+ process.exit(1);
46
+ }
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from './types.js';
2
- export * from './resultSet/resultset.js';
3
2
  export * from './query/query.js';
4
- export * from './path/pathResolver.js';
3
+ export * from './resultSet/resultset.js';
5
4
  export * from './operators/operators.js';
5
+ export * from './path/pathResolver.js';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // auto exports of entry components
2
2
  export * from './types.js';
3
- export * from './resultSet/resultset.js';
4
3
  export * from './query/query.js';
5
- export * from './path/pathResolver.js';
4
+ export * from './resultSet/resultset.js';
6
5
  export * from './operators/operators.js';
6
+ export * from './path/pathResolver.js';
@@ -2,7 +2,7 @@ import type { Where } from '../types.js';
2
2
  export declare class Query<T extends object> {
3
3
  data: T[];
4
4
  constructor(data: T[]);
5
- where(qy: Where<T>): any;
5
+ where(qy: Where<T>): import("../resultset/resultset.js").ResultSet<T>;
6
6
  private matchesQuery;
7
7
  private matchesField;
8
8
  }
@@ -1,39 +1,39 @@
1
- ## ResultSet.ts
2
-
3
- This class `ResultSet` is used to manipulate and iterate over a set of data. The class is iterable, meaning it can be spread into an array or iterated over with a `for...of` loop.
4
-
5
- ### Methods
6
-
7
-
8
-
9
- #### setOptions<T>(options: OptionsType)
10
-
11
- - Action: Sets the options for the result set in one pass.
12
- - Arguments: An `OptionsType` object which can contain `sort`, `page`, and `groupBy` properties.
13
- - `sort`: An object where the keys represent the properties to sort by, and the values represent the sort order ("asc" for ascending, "desc" for descending).
14
- - `page`: An object with `size` and `number` properties, representing the number of items per page and the page number to retrieve, respectively.
15
- - `groupBy`: A string or an array of strings, representing the field names to group by.
16
- - Return: The updated result set.
17
-
18
-
19
- #### sortBy(args: Record<string, "asc" | "desc">)
20
-
21
- - Action: Sorts the data in the result set based on the provided sorting criteria.
22
- - Arguments: An object where the keys represent the properties to sort by, and the values represent the sort order ("asc" for ascending, "desc" for descending).
23
- - Return: The sorted result set.
24
-
25
- #### getPage(size: number, page: number)
26
-
27
- - Action: Retrieves a specific page of data from the result set.
28
- - Arguments: The `size` parameter specifies the number of items per page, and the `page` parameter specifies the page number to retrieve.
29
- - Return: A new result set containing the specified page of data.
30
-
31
- #### groupBy(fieldName: string | string[], transform?: (value: any) => void)
32
-
33
- - Action: Groups the result set by the specified field name(s).
34
- - Arguments: The `fieldName` parameter can be a string or an array of strings, representing the field names to group by. The `transform` parameter is an optional transformation function to apply to each grouped value.
35
- - Return: An object representing the grouped result set.
36
-
37
- ### Iterability
38
-
39
- The `ResultSet` class is iterable, meaning it can be spread into an array or iterated over with a `for...of` loop. This is achieved by implementing the `[Symbol.iterator]` method.
1
+ ## ResultSet.ts
2
+
3
+ This class `ResultSet` is used to manipulate and iterate over a set of data. The class is iterable, meaning it can be spread into an array or iterated over with a `for...of` loop.
4
+
5
+ ### Methods
6
+
7
+
8
+
9
+ #### setOptions<T>(options: OptionsType)
10
+
11
+ - Action: Sets the options for the result set in one pass.
12
+ - Arguments: An `OptionsType` object which can contain `sort`, `page`, and `groupBy` properties.
13
+ - `sort`: An object where the keys represent the properties to sort by, and the values represent the sort order ("asc" for ascending, "desc" for descending).
14
+ - `page`: An object with `size` and `number` properties, representing the number of items per page and the page number to retrieve, respectively.
15
+ - `groupBy`: A string or an array of strings, representing the field names to group by.
16
+ - Return: The updated result set.
17
+
18
+
19
+ #### sortBy(args: Record<string, "asc" | "desc">)
20
+
21
+ - Action: Sorts the data in the result set based on the provided sorting criteria.
22
+ - Arguments: An object where the keys represent the properties to sort by, and the values represent the sort order ("asc" for ascending, "desc" for descending).
23
+ - Return: The sorted result set.
24
+
25
+ #### getPage(size: number, page: number)
26
+
27
+ - Action: Retrieves a specific page of data from the result set.
28
+ - Arguments: The `size` parameter specifies the number of items per page, and the `page` parameter specifies the page number to retrieve.
29
+ - Return: A new result set containing the specified page of data.
30
+
31
+ #### groupBy(fieldName: string | string[], transform?: (value: any) => void)
32
+
33
+ - Action: Groups the result set by the specified field name(s).
34
+ - Arguments: The `fieldName` parameter can be a string or an array of strings, representing the field names to group by. The `transform` parameter is an optional transformation function to apply to each grouped value.
35
+ - Return: An object representing the grouped result set.
36
+
37
+ ### Iterability
38
+
39
+ The `ResultSet` class is iterable, meaning it can be spread into an array or iterated over with a `for...of` loop. This is achieved by implementing the `[Symbol.iterator]` method.
package/package.json CHANGED
@@ -1,7 +1,15 @@
1
1
  {
2
2
  "name": "@medyll/idae-query",
3
+ "bin": {
4
+ "idae-query": "./cli.js"
5
+ },
3
6
  "scope": "@medyll",
4
- "version": "0.180.0",
7
+ "author": "Lebrun Meddy",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/medyll/idae.git"
11
+ },
12
+ "version": "0.186.2",
5
13
  "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
14
  "exports": {
7
15
  ".": {
@@ -17,7 +25,12 @@
17
25
  "peerDependencies": {
18
26
  "svelte": "^5.0.0-next"
19
27
  },
28
+ "publishConfig": {
29
+ "access": "public",
30
+ "directory": "."
31
+ },
20
32
  "devDependencies": {
33
+ "@semantic-release/github": "^10.3.5",
21
34
  "@sveltejs/adapter-auto": "^6.0.0",
22
35
  "@sveltejs/kit": "^2.20.7",
23
36
  "@sveltejs/package": "^2.3.11",
@@ -37,8 +50,8 @@
37
50
  "typescript-eslint": "^8.30.1",
38
51
  "vite": "^6.3.2",
39
52
  "vitest": "^3.1.1",
40
- "@medyll/idae-engine": "1.179.0",
41
- "@medyll/idae-prettier-config": "1.2.1"
53
+ "@medyll/idae-engine": "1.185.2",
54
+ "@medyll/idae-eslint-config": "0.1.5"
42
55
  },
43
56
  "svelte": "./dist/index.js",
44
57
  "types": "./dist/index.d.ts",
@@ -54,6 +67,6 @@
54
67
  "test": "vitest",
55
68
  "lint": "prettier --check . && eslint .",
56
69
  "format": "prettier --write .",
57
- "package:pre": "node scripts/package-pre.js"
70
+ "prepackage": "node scripts/package-pre.js"
58
71
  }
59
72
  }