ng-qubee 2.0.4 → 2.1.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 +155 -0
- package/fesm2022/ng-qubee.mjs +219 -52
- package/fesm2022/ng-qubee.mjs.map +1 -1
- package/lib/errors/invalid-limit.error.d.ts +3 -0
- package/lib/errors/invalid-model-name.error.d.ts +3 -0
- package/lib/errors/invalid-page-number.error.d.ts +3 -0
- package/lib/interfaces/nest-state.interface.d.ts +4 -0
- package/lib/interfaces/page.interface.d.ts +2 -0
- package/lib/services/nest.service.d.ts +113 -12
- package/package.json +6 -1
- package/public-api.d.ts +15 -0
package/README.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
5
|
# Your next Angular Query Builder 🐝
|
|
6
|
+
|
|
7
|
+
[](https://github.com/AndreaAlhena/ng-qubee/actions)
|
|
8
|
+
[](https://codecov.io/gh/AndreaAlhena/ng-qubee)
|
|
9
|
+
[](https://www.npmjs.com/package/ng-qubee)
|
|
10
|
+
[](https://opensource.org/licenses/MIT)
|
|
11
|
+
|
|
6
12
|
NgQubee is a Query Builder for Angular. Easily compose your API requests without the hassle of writing the wheel again :)
|
|
7
13
|
|
|
8
14
|
- Easily retrieve URIs with a Service
|
|
@@ -133,11 +139,17 @@ Will output _/users?include=profile,settings_
|
|
|
133
139
|
Sort elements as following:
|
|
134
140
|
|
|
135
141
|
```typescript
|
|
142
|
+
import { SortEnum } from 'ng-qubee';
|
|
143
|
+
|
|
136
144
|
this._ngQubeeService.addSort('fieldName', SortEnum.ASC);
|
|
137
145
|
```
|
|
138
146
|
|
|
139
147
|
Will output _/users?sort=fieldName_ (or _/users?sort=-fieldName_ if DESC)
|
|
140
148
|
|
|
149
|
+
The `SortEnum` provides two ordering options:
|
|
150
|
+
- `SortEnum.ASC` - Ascending order
|
|
151
|
+
- `SortEnum.DESC` - Descending order
|
|
152
|
+
|
|
141
153
|
### Page and Limit
|
|
142
154
|
NgQubee supports paginated queries:
|
|
143
155
|
|
|
@@ -213,6 +225,149 @@ NgQubeeModule.forRoot({
|
|
|
213
225
|
|
|
214
226
|
Feel free to customize your PaginationService as you need, using the keys shown in the upper list.
|
|
215
227
|
|
|
228
|
+
## TypeScript Support
|
|
229
|
+
|
|
230
|
+
NgQubee is fully typed and exports all public interfaces, enums, and types for TypeScript users.
|
|
231
|
+
|
|
232
|
+
### Available Enums
|
|
233
|
+
|
|
234
|
+
```typescript
|
|
235
|
+
import { SortEnum } from 'ng-qubee';
|
|
236
|
+
|
|
237
|
+
// Sorting options
|
|
238
|
+
SortEnum.ASC // 'asc'
|
|
239
|
+
SortEnum.DESC // 'desc'
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Available Interfaces
|
|
243
|
+
|
|
244
|
+
NgQubee exports the following interfaces for type-safe development:
|
|
245
|
+
|
|
246
|
+
#### Configuration Interfaces
|
|
247
|
+
|
|
248
|
+
```typescript
|
|
249
|
+
import {
|
|
250
|
+
IConfig,
|
|
251
|
+
IQueryBuilderConfig,
|
|
252
|
+
IPaginationConfig
|
|
253
|
+
} from 'ng-qubee';
|
|
254
|
+
|
|
255
|
+
// Main configuration interface
|
|
256
|
+
const config: IConfig = {
|
|
257
|
+
request: {
|
|
258
|
+
filters: 'custom-filter-key',
|
|
259
|
+
fields: 'custom-fields-key',
|
|
260
|
+
includes: 'custom-include-key',
|
|
261
|
+
limit: 'custom-limit-key',
|
|
262
|
+
page: 'custom-page-key',
|
|
263
|
+
sort: 'custom-sort-key'
|
|
264
|
+
},
|
|
265
|
+
response: {
|
|
266
|
+
currentPage: 'pg',
|
|
267
|
+
data: 'items',
|
|
268
|
+
total: 'count',
|
|
269
|
+
perPage: 'itemsPerPage'
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
#### Query Building Interfaces
|
|
275
|
+
|
|
276
|
+
```typescript
|
|
277
|
+
import {
|
|
278
|
+
IFilters,
|
|
279
|
+
IFields,
|
|
280
|
+
ISort
|
|
281
|
+
} from 'ng-qubee';
|
|
282
|
+
|
|
283
|
+
// Filters interface - key-value pairs with array values
|
|
284
|
+
const filters: IFilters = {
|
|
285
|
+
id: [1, 2, 3],
|
|
286
|
+
status: ['active', 'pending']
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
// Fields interface - model name with array of field names
|
|
290
|
+
const fields: IFields = {
|
|
291
|
+
users: ['id', 'email', 'username'],
|
|
292
|
+
profile: ['avatar', 'bio']
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
// Sort interface - field and order
|
|
296
|
+
const sort: ISort = {
|
|
297
|
+
field: 'created_at',
|
|
298
|
+
order: SortEnum.DESC
|
|
299
|
+
};
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
#### Pagination Interfaces
|
|
303
|
+
|
|
304
|
+
```typescript
|
|
305
|
+
import { IPaginatedObject } from 'ng-qubee';
|
|
306
|
+
|
|
307
|
+
// Use with your model type
|
|
308
|
+
interface User {
|
|
309
|
+
id: number;
|
|
310
|
+
email: string;
|
|
311
|
+
username: string;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
// The paginated object can contain any additional keys
|
|
315
|
+
const paginatedData: IPaginatedObject = {
|
|
316
|
+
data: [/* users */],
|
|
317
|
+
currentPage: 1,
|
|
318
|
+
total: 100,
|
|
319
|
+
perPage: 15
|
|
320
|
+
};
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
### Usage Example with Full Types
|
|
324
|
+
|
|
325
|
+
```typescript
|
|
326
|
+
import { Component, OnInit } from '@angular/core';
|
|
327
|
+
import {
|
|
328
|
+
NgQubeeService,
|
|
329
|
+
SortEnum,
|
|
330
|
+
IFilters,
|
|
331
|
+
IFields
|
|
332
|
+
} from 'ng-qubee';
|
|
333
|
+
|
|
334
|
+
@Component({
|
|
335
|
+
selector: 'app-users',
|
|
336
|
+
template: '...'
|
|
337
|
+
})
|
|
338
|
+
export class UsersComponent implements OnInit {
|
|
339
|
+
constructor(private ngQubee: NgQubeeService) {}
|
|
340
|
+
|
|
341
|
+
ngOnInit(): void {
|
|
342
|
+
// Set up the query with type safety
|
|
343
|
+
this.ngQubee.setModel('users');
|
|
344
|
+
|
|
345
|
+
// Define fields with type checking
|
|
346
|
+
const userFields: IFields = {
|
|
347
|
+
users: ['id', 'email', 'username']
|
|
348
|
+
};
|
|
349
|
+
this.ngQubee.addFields('users', userFields.users);
|
|
350
|
+
|
|
351
|
+
// Define filters with type checking
|
|
352
|
+
const filters: IFilters = {
|
|
353
|
+
status: ['active'],
|
|
354
|
+
role: ['admin', 'moderator']
|
|
355
|
+
};
|
|
356
|
+
this.ngQubee.addFilter('status', ...filters.status);
|
|
357
|
+
this.ngQubee.addFilter('role', ...filters.role);
|
|
358
|
+
|
|
359
|
+
// Add sorting with enum
|
|
360
|
+
this.ngQubee.addSort('created_at', SortEnum.DESC);
|
|
361
|
+
|
|
362
|
+
// Generate URI
|
|
363
|
+
this.ngQubee.generateUri().subscribe(uri => {
|
|
364
|
+
console.log(uri);
|
|
365
|
+
// Output: /users?fields[users]=id,email,username&filter[status]=active&filter[role]=admin,moderator&sort=-created_at&limit=15&page=1
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
```
|
|
370
|
+
|
|
216
371
|
[ng-qubee]: <https://github.com/AndreaAlhena/ng-qubee>
|
|
217
372
|
[rxjs]: <https://reactivex.io>
|
|
218
373
|
[qs]: <https://github.com/ljharb/qs>
|
package/fesm2022/ng-qubee.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { signal, computed, Injectable, Inject, Optional, NgModule, makeEnvironmentProviders } from '@angular/core';
|
|
3
3
|
import * as qs from 'qs';
|
|
4
|
-
import { BehaviorSubject, filter } from 'rxjs';
|
|
4
|
+
import { BehaviorSubject, filter, throwError } from 'rxjs';
|
|
5
5
|
|
|
6
6
|
class KeyNotFoundError extends Error {
|
|
7
7
|
constructor(key) {
|
|
@@ -97,6 +97,27 @@ class QueryBuilderOptions {
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
+
class InvalidModelNameError extends Error {
|
|
101
|
+
constructor(model) {
|
|
102
|
+
super(`Invalid model name: Model name must be a non-empty string. Received: ${JSON.stringify(model)}`);
|
|
103
|
+
this.name = 'InvalidModelNameError';
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
class InvalidPageNumberError extends Error {
|
|
108
|
+
constructor(page) {
|
|
109
|
+
super(`Invalid page number: Page must be a positive integer greater than 0. Received: ${page}`);
|
|
110
|
+
this.name = 'InvalidPageNumberError';
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
class InvalidLimitError extends Error {
|
|
115
|
+
constructor(limit) {
|
|
116
|
+
super(`Invalid limit value: Limit must be a positive integer greater than 0. Received: ${limit}`);
|
|
117
|
+
this.name = 'InvalidLimitError';
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
100
121
|
const INITIAL_STATE = {
|
|
101
122
|
baseUrl: '',
|
|
102
123
|
fields: {},
|
|
@@ -123,25 +144,62 @@ class NestService {
|
|
|
123
144
|
constructor() {
|
|
124
145
|
// Nothing to see here 👮🏻♀️
|
|
125
146
|
}
|
|
147
|
+
/**
|
|
148
|
+
* Set the base URL for the API
|
|
149
|
+
*
|
|
150
|
+
* @param {string} baseUrl - The base URL to prepend to generated URIs
|
|
151
|
+
* @example
|
|
152
|
+
* service.baseUrl = 'https://api.example.com';
|
|
153
|
+
*/
|
|
126
154
|
set baseUrl(baseUrl) {
|
|
127
155
|
this._nest.update(nest => ({
|
|
128
156
|
...nest,
|
|
129
157
|
baseUrl
|
|
130
158
|
}));
|
|
131
159
|
}
|
|
160
|
+
/**
|
|
161
|
+
* Set the limit for paginated results
|
|
162
|
+
* Must be a positive integer greater than 0
|
|
163
|
+
*
|
|
164
|
+
* @param {number} limit - The number of items per page
|
|
165
|
+
* @throws {InvalidLimitError} If limit is not a positive integer
|
|
166
|
+
* @example
|
|
167
|
+
* service.limit = 25;
|
|
168
|
+
*/
|
|
132
169
|
set limit(limit) {
|
|
170
|
+
this._validateLimit(limit);
|
|
133
171
|
this._nest.update(nest => ({
|
|
134
172
|
...nest,
|
|
135
173
|
limit
|
|
136
174
|
}));
|
|
137
175
|
}
|
|
176
|
+
/**
|
|
177
|
+
* Set the model name for the query
|
|
178
|
+
* Must be a non-empty string
|
|
179
|
+
*
|
|
180
|
+
* @param {string} model - The model/resource name (e.g., 'users', 'posts')
|
|
181
|
+
* @throws {InvalidModelNameError} If model is not a non-empty string
|
|
182
|
+
* @example
|
|
183
|
+
* service.model = 'users';
|
|
184
|
+
*/
|
|
138
185
|
set model(model) {
|
|
186
|
+
this._validateModelName(model);
|
|
139
187
|
this._nest.update(nest => ({
|
|
140
188
|
...nest,
|
|
141
189
|
model
|
|
142
190
|
}));
|
|
143
191
|
}
|
|
192
|
+
/**
|
|
193
|
+
* Set the page number for pagination
|
|
194
|
+
* Must be a positive integer greater than 0
|
|
195
|
+
*
|
|
196
|
+
* @param {number} page - The page number to fetch
|
|
197
|
+
* @throws {InvalidPageNumberError} If page is not a positive integer
|
|
198
|
+
* @example
|
|
199
|
+
* service.page = 2;
|
|
200
|
+
*/
|
|
144
201
|
set page(page) {
|
|
202
|
+
this._validatePageNumber(page);
|
|
145
203
|
this._nest.update(nest => ({
|
|
146
204
|
...nest,
|
|
147
205
|
page
|
|
@@ -150,49 +208,123 @@ class NestService {
|
|
|
150
208
|
_clone(obj) {
|
|
151
209
|
return JSON.parse(JSON.stringify(obj));
|
|
152
210
|
}
|
|
211
|
+
/**
|
|
212
|
+
* Validates that the model name is a non-empty string
|
|
213
|
+
*
|
|
214
|
+
* @param {string} model - The model name to validate
|
|
215
|
+
* @throws {InvalidModelNameError} If model is not a non-empty string
|
|
216
|
+
* @private
|
|
217
|
+
*/
|
|
218
|
+
_validateModelName(model) {
|
|
219
|
+
if (!model || typeof model !== 'string' || model.trim().length === 0) {
|
|
220
|
+
throw new InvalidModelNameError(model);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Validates that the page number is a positive integer
|
|
225
|
+
*
|
|
226
|
+
* @param {number} page - The page number to validate
|
|
227
|
+
* @throws {InvalidPageNumberError} If page is not a positive integer
|
|
228
|
+
* @private
|
|
229
|
+
*/
|
|
230
|
+
_validatePageNumber(page) {
|
|
231
|
+
if (!Number.isInteger(page) || page < 1) {
|
|
232
|
+
throw new InvalidPageNumberError(page);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Validates that the limit is a positive integer
|
|
237
|
+
*
|
|
238
|
+
* @param {number} limit - The limit value to validate
|
|
239
|
+
* @throws {InvalidLimitError} If limit is not a positive integer
|
|
240
|
+
* @private
|
|
241
|
+
*/
|
|
242
|
+
_validateLimit(limit) {
|
|
243
|
+
if (!Number.isInteger(limit) || limit < 1) {
|
|
244
|
+
throw new InvalidLimitError(limit);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
153
247
|
/**
|
|
154
248
|
* Add selectable fields for the given model to the request
|
|
249
|
+
* Automatically prevents duplicate fields for each model
|
|
155
250
|
*
|
|
156
|
-
* @param {IFields} fields
|
|
251
|
+
* @param {IFields} fields - Object mapping model names to arrays of field names
|
|
157
252
|
* @return {void}
|
|
158
|
-
* @
|
|
253
|
+
* @example
|
|
254
|
+
* service.addFields({ users: ['id', 'email', 'username'] });
|
|
255
|
+
* service.addFields({ posts: ['title', 'content'] });
|
|
159
256
|
*/
|
|
160
257
|
addFields(fields) {
|
|
161
|
-
this._nest.update(nest =>
|
|
162
|
-
...nest
|
|
163
|
-
fields
|
|
164
|
-
|
|
258
|
+
this._nest.update(nest => {
|
|
259
|
+
const mergedFields = { ...nest.fields };
|
|
260
|
+
Object.keys(fields).forEach(model => {
|
|
261
|
+
const existingFields = mergedFields[model] || [];
|
|
262
|
+
const newFields = fields[model];
|
|
263
|
+
// Use Set to prevent duplicates
|
|
264
|
+
const uniqueFields = Array.from(new Set([...existingFields, ...newFields]));
|
|
265
|
+
mergedFields[model] = uniqueFields;
|
|
266
|
+
});
|
|
267
|
+
return {
|
|
268
|
+
...nest,
|
|
269
|
+
fields: mergedFields
|
|
270
|
+
};
|
|
271
|
+
});
|
|
165
272
|
}
|
|
166
273
|
/**
|
|
167
274
|
* Add filters to the request
|
|
275
|
+
* Automatically prevents duplicate filter values for each filter key
|
|
168
276
|
*
|
|
169
|
-
* @param {IFilters} filters
|
|
170
|
-
* @
|
|
277
|
+
* @param {IFilters} filters - Object mapping filter keys to arrays of values
|
|
278
|
+
* @return {void}
|
|
279
|
+
* @example
|
|
280
|
+
* service.addFilters({ id: [1, 2, 3] });
|
|
281
|
+
* service.addFilters({ status: ['active', 'pending'] });
|
|
171
282
|
*/
|
|
172
283
|
addFilters(filters) {
|
|
173
|
-
this._nest.update(nest =>
|
|
174
|
-
...nest
|
|
175
|
-
filters
|
|
176
|
-
|
|
284
|
+
this._nest.update(nest => {
|
|
285
|
+
const mergedFilters = { ...nest.filters };
|
|
286
|
+
Object.keys(filters).forEach(key => {
|
|
287
|
+
const existingValues = mergedFilters[key] || [];
|
|
288
|
+
const newValues = filters[key];
|
|
289
|
+
// Use Set to prevent duplicates
|
|
290
|
+
const uniqueValues = Array.from(new Set([...existingValues, ...newValues]));
|
|
291
|
+
mergedFilters[key] = uniqueValues;
|
|
292
|
+
});
|
|
293
|
+
return {
|
|
294
|
+
...nest,
|
|
295
|
+
filters: mergedFilters
|
|
296
|
+
};
|
|
297
|
+
});
|
|
177
298
|
}
|
|
178
299
|
/**
|
|
179
300
|
* Add resources to include with the request
|
|
301
|
+
* Automatically prevents duplicate includes
|
|
180
302
|
*
|
|
181
|
-
* @param {string[]} includes
|
|
303
|
+
* @param {string[]} includes - Array of model names to include in the response
|
|
182
304
|
* @return {void}
|
|
183
|
-
* @
|
|
305
|
+
* @example
|
|
306
|
+
* service.addIncludes(['profile', 'posts']);
|
|
307
|
+
* service.addIncludes(['comments']);
|
|
184
308
|
*/
|
|
185
309
|
addIncludes(includes) {
|
|
186
|
-
this._nest.update(nest =>
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
310
|
+
this._nest.update(nest => {
|
|
311
|
+
// Use Set to prevent duplicates
|
|
312
|
+
const uniqueIncludes = Array.from(new Set([...nest.includes, ...includes]));
|
|
313
|
+
return {
|
|
314
|
+
...nest,
|
|
315
|
+
includes: uniqueIncludes
|
|
316
|
+
};
|
|
317
|
+
});
|
|
190
318
|
}
|
|
191
319
|
/**
|
|
192
320
|
* Add a field that should be used for sorting data
|
|
193
321
|
*
|
|
194
|
-
* @param {ISort} sort
|
|
322
|
+
* @param {ISort} sort - Sort configuration with field name and order (ASC/DESC)
|
|
195
323
|
* @return {void}
|
|
324
|
+
* @example
|
|
325
|
+
* import { SortEnum } from 'ng-qubee';
|
|
326
|
+
* service.addSort({ field: 'created_at', order: SortEnum.DESC });
|
|
327
|
+
* service.addSort({ field: 'name', order: SortEnum.ASC });
|
|
196
328
|
*/
|
|
197
329
|
addSort(sort) {
|
|
198
330
|
this._nest.update(nest => ({
|
|
@@ -202,16 +334,22 @@ class NestService {
|
|
|
202
334
|
}
|
|
203
335
|
/**
|
|
204
336
|
* Remove fields for the given model
|
|
337
|
+
* Uses deep cloning to prevent mutations to the original state
|
|
205
338
|
*
|
|
206
|
-
* @param {IFields} fields
|
|
339
|
+
* @param {IFields} fields - Object mapping model names to arrays of field names to remove
|
|
340
|
+
* @return {void}
|
|
341
|
+
* @example
|
|
342
|
+
* service.deleteFields({ users: ['email'] });
|
|
343
|
+
* service.deleteFields({ posts: ['content', 'body'] });
|
|
207
344
|
*/
|
|
208
345
|
deleteFields(fields) {
|
|
209
|
-
|
|
346
|
+
// Deep clone the fields object to prevent mutations
|
|
347
|
+
const f = this._clone(this._nest().fields);
|
|
210
348
|
Object.keys(fields).forEach(k => {
|
|
211
349
|
if (!(k in f)) {
|
|
212
350
|
return;
|
|
213
351
|
}
|
|
214
|
-
f[k] =
|
|
352
|
+
f[k] = f[k].filter(v => !fields[k].includes(v));
|
|
215
353
|
});
|
|
216
354
|
this._nest.update(nest => ({
|
|
217
355
|
...nest,
|
|
@@ -219,12 +357,18 @@ class NestService {
|
|
|
219
357
|
}));
|
|
220
358
|
}
|
|
221
359
|
/**
|
|
360
|
+
* Remove filters from the request
|
|
361
|
+
* Uses deep cloning to prevent mutations to the original state
|
|
222
362
|
*
|
|
223
|
-
* @param filters
|
|
224
|
-
* @
|
|
363
|
+
* @param {...string[]} filters - Filter keys to remove
|
|
364
|
+
* @return {void}
|
|
365
|
+
* @example
|
|
366
|
+
* service.deleteFilters('id');
|
|
367
|
+
* service.deleteFilters('status', 'type');
|
|
225
368
|
*/
|
|
226
369
|
deleteFilters(...filters) {
|
|
227
|
-
|
|
370
|
+
// Deep clone the filters object to prevent mutations
|
|
371
|
+
const f = this._clone(this._nest().filters);
|
|
228
372
|
filters.forEach(k => delete f[k]);
|
|
229
373
|
this._nest.update(nest => ({
|
|
230
374
|
...nest,
|
|
@@ -232,8 +376,13 @@ class NestService {
|
|
|
232
376
|
}));
|
|
233
377
|
}
|
|
234
378
|
/**
|
|
379
|
+
* Remove includes from the request
|
|
235
380
|
*
|
|
236
|
-
* @param includes
|
|
381
|
+
* @param {...string[]} includes - Include names to remove
|
|
382
|
+
* @return {void}
|
|
383
|
+
* @example
|
|
384
|
+
* service.deleteIncludes('profile');
|
|
385
|
+
* service.deleteIncludes('posts', 'comments');
|
|
237
386
|
*/
|
|
238
387
|
deleteIncludes(...includes) {
|
|
239
388
|
this._nest.update(nest => ({
|
|
@@ -242,13 +391,18 @@ class NestService {
|
|
|
242
391
|
}));
|
|
243
392
|
}
|
|
244
393
|
/**
|
|
394
|
+
* Remove sorts from the request by field name
|
|
245
395
|
*
|
|
246
|
-
* @param sorts
|
|
396
|
+
* @param {...string[]} sorts - Field names of sorts to remove
|
|
397
|
+
* @return {void}
|
|
398
|
+
* @example
|
|
399
|
+
* service.deleteSorts('created_at');
|
|
400
|
+
* service.deleteSorts('name', 'created_at');
|
|
247
401
|
*/
|
|
248
402
|
deleteSorts(...sorts) {
|
|
249
403
|
const s = [...this._nest().sorts];
|
|
250
404
|
sorts.forEach(field => {
|
|
251
|
-
const p =
|
|
405
|
+
const p = s.findIndex(sort => sort.field === field);
|
|
252
406
|
if (p > -1) {
|
|
253
407
|
s.splice(p, 1);
|
|
254
408
|
}
|
|
@@ -258,13 +412,22 @@ class NestService {
|
|
|
258
412
|
sorts: s
|
|
259
413
|
}));
|
|
260
414
|
}
|
|
415
|
+
/**
|
|
416
|
+
* Reset the query builder state to initial values
|
|
417
|
+
* Clears all fields, filters, includes, sorts, and resets pagination
|
|
418
|
+
*
|
|
419
|
+
* @return {void}
|
|
420
|
+
* @example
|
|
421
|
+
* service.reset();
|
|
422
|
+
* // State is now: { baseUrl: '', fields: {}, filters: {}, includes: [], limit: 15, model: '', page: 1, sorts: [] }
|
|
423
|
+
*/
|
|
261
424
|
reset() {
|
|
262
425
|
this._nest.update(_ => this._clone(INITIAL_STATE));
|
|
263
426
|
}
|
|
264
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
265
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.
|
|
427
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: NestService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
428
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: NestService });
|
|
266
429
|
}
|
|
267
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
430
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: NestService, decorators: [{
|
|
268
431
|
type: Injectable
|
|
269
432
|
}], ctorParameters: () => [] });
|
|
270
433
|
|
|
@@ -368,14 +531,13 @@ class NgQubeeService {
|
|
|
368
531
|
return this._uri;
|
|
369
532
|
}
|
|
370
533
|
_prepend(model) {
|
|
371
|
-
|
|
534
|
+
const state = this._nestService.nest();
|
|
535
|
+
const baseUrl = state.baseUrl;
|
|
536
|
+
if (this._uri) {
|
|
537
|
+
return '&';
|
|
538
|
+
}
|
|
539
|
+
return baseUrl ? `${baseUrl}/${model}?` : `/${model}?`;
|
|
372
540
|
}
|
|
373
|
-
// private _removeArgIfEmpty(arg: string): string {
|
|
374
|
-
// const params = new URL(this._uri).searchParams;
|
|
375
|
-
// if (!params.get(arg)) {
|
|
376
|
-
// params.delete(arg);
|
|
377
|
-
// }
|
|
378
|
-
// }
|
|
379
541
|
/**
|
|
380
542
|
* Add fields to the select statement for the given model
|
|
381
543
|
*
|
|
@@ -513,8 +675,13 @@ class NgQubeeService {
|
|
|
513
675
|
* @returns {Observable<string>} An observable that emits the generated uri
|
|
514
676
|
*/
|
|
515
677
|
generateUri() {
|
|
516
|
-
|
|
517
|
-
|
|
678
|
+
try {
|
|
679
|
+
this._uri$.next(this._parse(this._nestService.nest()));
|
|
680
|
+
return this.uri$;
|
|
681
|
+
}
|
|
682
|
+
catch (error) {
|
|
683
|
+
return throwError(() => error);
|
|
684
|
+
}
|
|
518
685
|
}
|
|
519
686
|
/**
|
|
520
687
|
* Clear the current state and reset the Query Builder to a fresh, clean condition
|
|
@@ -566,10 +733,10 @@ class NgQubeeService {
|
|
|
566
733
|
this._nestService.page = page;
|
|
567
734
|
return this;
|
|
568
735
|
}
|
|
569
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
570
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.
|
|
736
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: NgQubeeService, deps: [{ token: NestService }, { token: 'QUERY_PARAMS_CONFIG', optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
737
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: NgQubeeService });
|
|
571
738
|
}
|
|
572
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
739
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: NgQubeeService, decorators: [{
|
|
573
740
|
type: Injectable
|
|
574
741
|
}], ctorParameters: () => [{ type: NestService }, { type: undefined, decorators: [{
|
|
575
742
|
type: Inject,
|
|
@@ -616,10 +783,10 @@ class PaginationService {
|
|
|
616
783
|
paginate(response) {
|
|
617
784
|
return new PaginatedCollection(response[this._options.data], response[this._options.currentPage], response[this._options.from], response[this._options.to], response[this._options.total], response[this._options.perPage], response[this._options.prevPageUrl], response[this._options.nextPageUrl], response[this._options.lastPage], response[this._options.firstPageUrl], response[this._options.lastPageUrl]);
|
|
618
785
|
}
|
|
619
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
620
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.
|
|
786
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: PaginationService, deps: [{ token: 'RESPONSE_OPTIONS', optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
787
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: PaginationService });
|
|
621
788
|
}
|
|
622
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
789
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: PaginationService, decorators: [{
|
|
623
790
|
type: Injectable
|
|
624
791
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
625
792
|
type: Inject,
|
|
@@ -646,15 +813,15 @@ class NgQubeeModule {
|
|
|
646
813
|
]
|
|
647
814
|
};
|
|
648
815
|
}
|
|
649
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
650
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.
|
|
651
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.
|
|
816
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: NgQubeeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
817
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.17", ngImport: i0, type: NgQubeeModule });
|
|
818
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: NgQubeeModule, providers: [{
|
|
652
819
|
deps: [NestService],
|
|
653
820
|
provide: NgQubeeService,
|
|
654
821
|
useFactory: (nestService) => new NgQubeeService(nestService, {})
|
|
655
822
|
}] });
|
|
656
823
|
}
|
|
657
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
824
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: NgQubeeModule, decorators: [{
|
|
658
825
|
type: NgModule,
|
|
659
826
|
args: [{
|
|
660
827
|
providers: [{
|
|
@@ -708,5 +875,5 @@ function provideNgQubee(config = {}) {
|
|
|
708
875
|
* Generated bundle index. Do not edit.
|
|
709
876
|
*/
|
|
710
877
|
|
|
711
|
-
export { NgQubeeModule, NgQubeeService, PaginatedCollection, PaginationService, provideNgQubee };
|
|
878
|
+
export { InvalidLimitError, InvalidModelNameError, InvalidPageNumberError, KeyNotFoundError, NgQubeeModule, NgQubeeService, PaginatedCollection, PaginationService, SortEnum, UnselectableModelError, provideNgQubee };
|
|
712
879
|
//# sourceMappingURL=ng-qubee.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-qubee.mjs","sources":["../../../projects/ng-qubee/src/lib/errors/key-not-found.error.ts","../../../projects/ng-qubee/src/lib/models/paginated-collection.ts","../../../projects/ng-qubee/src/lib/enums/sort.enum.ts","../../../projects/ng-qubee/src/lib/errors/unselectable-model.error.ts","../../../projects/ng-qubee/src/lib/models/query-builder-options.ts","../../../projects/ng-qubee/src/lib/services/nest.service.ts","../../../projects/ng-qubee/src/lib/services/ng-qubee.service.ts","../../../projects/ng-qubee/src/lib/models/response-options.ts","../../../projects/ng-qubee/src/lib/services/pagination.service.ts","../../../projects/ng-qubee/src/lib/ng-qubee.module.ts","../../../projects/ng-qubee/src/lib/provide-ngqubee.ts","../../../projects/ng-qubee/src/public-api.ts","../../../projects/ng-qubee/src/ng-qubee.ts"],"sourcesContent":["export class KeyNotFoundError extends Error {\n constructor(key: string) {\n super(`Cannot find the key ${key} inside the collection item: does it really exists?`);\n }\n}","import { KeyNotFoundError } from \"../errors/key-not-found.error\";\nimport { INormalized } from \"../interfaces/normalized.interface\";\nimport { IPaginatedObject } from \"../interfaces/paginated-object.interface\";\n\nexport class PaginatedCollection<T extends IPaginatedObject> {\n constructor(\n public data: T[],\n public readonly page: number,\n public readonly from?: number,\n public readonly to?: number,\n public readonly total?: number,\n public readonly perPage?: number,\n public readonly prevPageUrl?: string,\n public readonly nextPageUrl?: string,\n public readonly lastPage?: number,\n public readonly firstPageUrl?: string,\n public readonly lastPageUrl?: string\n ) {\n //\n }\n\n /**\n * Normalize the collection to a paginated list of ids for state-managed applications.\n * \n * This method returns a single key object, where the key is the page number and the associated value is\n * an array of ids. Each id is fetched by the collection items, looking up for the \"id\" key. If an id is supplied\n * to this method, it will be used instead of the default \"id\" key.\n * \n * Please note that in case the key doesn't exist in the collection's item, a KeyNotFoundError is thrown\n * \n * @param k A key to use instead of the default \"id\": this will be searched inside each element of the collection\n * @returns []\n * @throws KeyNotFoundItem\n */\n public normalize(id?: string): INormalized {\n return {\n [this.page]: this.data.reduce((ids: number[], value: T) => {\n if (id && id in value) {\n ids.push(value[id]);\n } else if (value.hasOwnProperty('id')) {\n ids.push(value['id']);\n } else {\n throw new KeyNotFoundError(id || 'id');\n }\n\n return ids;\n }, [])\n }\n }\n}","export enum SortEnum {\n ASC = 'asc',\n DESC = 'desc'\n}","export class UnselectableModelError extends Error {\n constructor(model: string) {\n super(`Unselectable Model: the selected model (${model}) is not present neither in the \"model\" property, nor in the includes object.`);\n }\n}","import { IQueryBuilderConfig } from '../interfaces/query-builder-config.interface';\n\nexport class QueryBuilderOptions {\n public readonly appends: string;\n public readonly fields: string;\n public readonly filters: string;\n public readonly includes: string;\n public readonly limit: string;\n public readonly page: string;\n public readonly sort: string;\n\n constructor(options: IQueryBuilderConfig) {\n this.appends = options.appends || 'append';\n this.fields = options.fields || 'fields';\n this.filters = options.filters || 'filter';\n this.includes = options.includes || 'include';\n this.limit = options.limit || 'limit';\n this.page = options.page || 'page';\n this.sort = options.sort || 'sort';\n }\n}","import { Injectable, Signal, WritableSignal, computed, signal } from '@angular/core';\nimport { IQueryBuilderState } from '../interfaces/query-builder-state.interface';\nimport { IFields } from '../interfaces/fields.interface';\nimport { IFilters } from '../interfaces/filters.interface';\nimport { ISort } from '../interfaces/sort.interface';\n\nconst INITIAL_STATE: IQueryBuilderState = {\n baseUrl: '',\n fields: {},\n filters: {},\n includes: [],\n limit: 15,\n model: '',\n page: 1,\n sorts: []\n};\n\n@Injectable()\nexport class NestService {\n\n /**\n * Private writable signal that holds the Query Builder state\n * \n * @type {IQueryBuilderState}\n */\n private _nest: WritableSignal<IQueryBuilderState> = signal(this._clone(INITIAL_STATE));\n\n /**\n * A computed signal that makes readonly the writable signal _nest\n * \n * @type {Signal<IQueryBuilderState>}\n */\n public nest: Signal<IQueryBuilderState> = computed(() => this._clone(this._nest()));\n\n constructor() {\n // Nothing to see here 👮🏻♀️\n }\n\n set baseUrl(baseUrl: string) {\n this._nest.update(nest => ({\n ...nest,\n baseUrl\n }));\n }\n\n set limit(limit: number) {\n this._nest.update(nest => ({\n ...nest,\n limit\n }));\n }\n\n set model(model: string) {\n this._nest.update(nest => ({\n ...nest,\n model\n }));\n }\n\n set page(page: number) {\n this._nest.update(nest => ({\n ...nest,\n page\n }));\n }\n\n private _clone<T>(obj: T): T {\n return JSON.parse( JSON.stringify(obj) );\n }\n\n /**\n * Add selectable fields for the given model to the request\n * \n * @param {IFields} fields \n * @return {void}\n * @todo Avoid duplicated fields\n */\n public addFields(fields: IFields): void {\n this._nest.update(nest => ({\n ...nest,\n fields: { ...nest.fields, ...fields }\n }));\n }\n\n /**\n * Add filters to the request\n * \n * @param {IFilters} filters\n * @todo Avoid duplicated filters\n */\n public addFilters(filters: IFilters): void {\n this._nest.update(nest => ({\n ...nest,\n filters: { ...nest.filters, ...filters }\n }));\n }\n\n /**\n * Add resources to include with the request\n * \n * @param {string[]} includes models to include to the request\n * @return {void}\n * @todo Avoid duplicated includes\n */\n public addIncludes(includes: string[]): void {\n this._nest.update(nest => ({\n ...nest,\n includes: [...nest.includes, ...includes]\n }))\n }\n\n /**\n * Add a field that should be used for sorting data\n * \n * @param {ISort} sort\n * @return {void}\n */\n public addSort(sort: ISort): void {\n this._nest.update(nest => ({\n ...nest,\n sorts: [...nest.sorts, sort]\n }));\n }\n\n /**\n * Remove fields for the given model\n * \n * @param {IFields} fields \n */\n public deleteFields(fields: IFields): void {\n const f = Object.assign({}, this.nest().fields);\n\n Object.keys(fields).forEach(k => {\n if (!(k in f)) {\n return;\n }\n\n f[k] = this._nest().fields[k].filter(v => !fields[k].includes(v));\n });\n\n this._nest.update(nest => ({\n ...nest,\n fields: f\n }));\n }\n\n /**\n * \n * @param filters \n * @todo Create a clone of the filter obj before assigning to f\n */\n public deleteFilters(...filters: string[]): void {\n const f = Object.assign({}, this._nest().filters);\n \n filters.forEach(k => delete f[k]);\n\n this._nest.update(nest => ({\n ...nest,\n filters: f\n }));\n }\n\n /**\n * \n * @param includes \n */\n public deleteIncludes(...includes: string[]): void {\n this._nest.update(nest => ({\n ...nest,\n includes: nest.includes.filter(v => !includes.includes(v))\n }));\n }\n\n /**\n * \n * @param sorts \n */\n public deleteSorts(...sorts: string[]): void {\n const s = [...this._nest().sorts];\n \n sorts.forEach(field => {\n const p = this.nest().sorts.findIndex(sort => sort.field === field);\n\n if (p > -1) {\n s.splice(p, 1);\n }\n });\n \n this._nest.update(nest => ({\n ...nest,\n sorts: s\n }));\n }\n\n public reset(): void {\n this._nest.update(_ => this._clone(INITIAL_STATE));\n }\n}\n","import { Inject, Injectable, Optional } from '@angular/core';\nimport * as qs from 'qs';\nimport { BehaviorSubject, Observable, filter } from 'rxjs';\n\n// Enums\nimport { SortEnum } from '../enums/sort.enum';\n\n// Errors\nimport { UnselectableModelError } from '../errors/unselectable-model.error';\n\n// Interfaces\nimport { IFields } from '../interfaces/fields.interface';\nimport { IQueryBuilderConfig } from '../interfaces/query-builder-config.interface';\nimport { IQueryBuilderState } from '../interfaces/query-builder-state.interface';\n\n// Models\nimport { QueryBuilderOptions } from '../models/query-builder-options';\n\n// Services\nimport { NestService } from './nest.service';\n\n@Injectable()\nexport class NgQubeeService {\n\n private _options: QueryBuilderOptions;\n\n /**\n * This property serves as an accumulator for holding the composed string with each query param\n */\n private _uri = '';\n\n private _uri$: BehaviorSubject<string> = new BehaviorSubject('');\n\n public uri$: Observable<string> = this._uri$.asObservable().pipe(\n filter(uri => !!uri)\n );\n\n constructor(private _nestService: NestService, @Inject('QUERY_PARAMS_CONFIG') @Optional() options: IQueryBuilderConfig = {}) {\n this._options = new QueryBuilderOptions(options);\n }\n\n private _parseFields(s: IQueryBuilderState): string {\n if (!Object.keys(s.fields).length) {\n return this._uri;\n }\n\n if (!s.model) {\n throw new Error('While selecting fields, the -> model <- is required');\n }\n\n if (!(s.model in s.fields)) {\n throw new Error(`Key ${s.model} is missing in the fields object`);\n }\n\n const f = {};\n\n for (const k in s.fields) {\n if (s.fields.hasOwnProperty(k)) {\n // Check if the key is the model or is declared in \"includes\".\n // If not, it means that has not been selected anywhere and that will cause an error on the API\n if (k !== s.model && !s.includes.includes(k)) {\n throw new UnselectableModelError(k);\n }\n\n Object.assign(f, { [`${this._options.fields}[${k}]`]: s.fields[k].join(',') });\n }\n }\n\n const param = `${this._prepend(s.model)}${qs.stringify(f, { encode: false })}`;\n this._uri += param;\n\n return param;\n }\n\n private _parseFilters(s: IQueryBuilderState): string {\n const keys = Object.keys(s.filters);\n\n if (!keys.length) {\n return this._uri;\n }\n\n const f = {\n [`${this._options.filters}`]: keys.reduce((acc, key) => {\n return Object.assign(acc, { [key]: s.filters[key].join(',') });\n }, {})\n };\n const param = `${this._prepend(s.model)}${qs.stringify(f, { encode: false })}`;\n\n this._uri += param;\n\n return param;\n }\n\n private _parseIncludes(s: IQueryBuilderState): string {\n if (!s.includes.length) {\n return this._uri;\n }\n\n const param = `${this._prepend(s.model)}${this._options.includes}=${s.includes}`;\n this._uri += param;\n\n return param;\n }\n\n private _parseLimit(s: IQueryBuilderState): string {\n const param = `${this._prepend(s.model)}${this._options.limit}=${s.limit}`;\n this._uri += param;\n\n return param;\n }\n\n private _parsePage(s: IQueryBuilderState): string {\n const param = `${this._prepend(s.model)}${this._options.page}=${s.page}`;\n this._uri += param;\n\n return param;\n }\n\n private _parseSort(s: IQueryBuilderState): string {\n let param: string = '';\n\n if (!s.sorts.length) {\n return param;\n }\n\n param = `${this._prepend(s.model)}${this._options.sort}=`;\n\n s.sorts.forEach((sort, idx) => {\n param += `${sort.order === SortEnum.DESC ? '-' : ''}${sort.field}`;\n\n if (idx < s.sorts.length - 1) {\n param += ','\n }\n });\n\n this._uri += param;\n\n return param;\n }\n\n private _parse(s: IQueryBuilderState): string {\n if (!s.model) {\n throw new Error('Set the model property BEFORE adding filters or calling the url() / get() methods');\n }\n\n // Cleanup the previously generated URI\n this._uri = '';\n\n this._parseIncludes(s);\n this._parseFields(s);\n this._parseFilters(s);\n this._parseLimit(s);\n this._parsePage(s);\n this._parseSort(s);\n\n return this._uri;\n }\n\n private _prepend(model: string): string {\n return this._uri ? '&' : `/${model}?`;\n }\n\n // private _removeArgIfEmpty(arg: string): string {\n // const params = new URL(this._uri).searchParams;\n \n // if (!params.get(arg)) {\n // params.delete(arg);\n // }\n \n\n // }\n\n /**\n * Add fields to the select statement for the given model\n * \n * @param model Model that holds the fields\n * @param fields Fields to select\n * @returns {this}\n */\n public addFields(model: string, fields: string[]): this {\n if (!fields.length) {\n return this;\n }\n\n this._nestService.addFields({ [model]: fields });\n\n return this;\n }\n\n /**\n * Add a filter with the given value(s)\n * I.e. filter[field]=1 or filter[field]=1,2,3\n * \n * @param {string} field Name of the field to filter\n * @param {string[]} value The needle(s)\n * @returns {this}\n */\n public addFilter(field: string, ...values: (string | number | boolean)[]): this {\n if (!values.length) {\n return this;\n }\n\n this._nestService.addFilters({\n [field]: values\n });\n\n return this;\n }\n\n /**\n * Add related entities to include in the request\n * \n * @param {string[]} models \n * @returns \n */\n public addIncludes(...models: string[]): this {\n if (!models.length) {\n return this;\n }\n\n this._nestService.addIncludes(models);\n\n return this;\n }\n\n /**\n * Add a field with a sort criteria\n * \n * @param field Field to use for sorting\n * @param {SortEnum} order A value from the SortEnum enumeration\n * @returns {this}\n */\n public addSort(field: string, order: SortEnum): this {\n this._nestService.addSort({\n field,\n order\n });\n\n return this;\n }\n\n /**\n * Delete selected fields for the given models in the current query builder state\n * \n * ```\n * ngQubeeService.deleteFields({\n * users: ['email', 'password'],\n * address: ['zipcode']\n * });\n * ```\n * \n * @param {IFields} fields \n * @returns \n */\n public deleteFields(fields: IFields): this {\n this._nestService.deleteFields(fields);\n return this;\n }\n\n /**\n * Delete selected fields for the given model in the current query builder state\n * \n * ```\n * ngQubeeService.deleteFieldsByModel('users', 'email', 'password']);\n * ```\n * \n * @param model Model that holds the fields\n * @param {string[]} fields Fields to delete from the state\n * @returns {this}\n */\n public deleteFieldsByModel(model: string, ...fields: string[]): this {\n if (!fields.length) {\n return this;\n }\n\n this._nestService.deleteFields({\n [model]: fields\n });\n\n return this;\n }\n\n /**\n * Remove given filters from the query builder state\n * \n * @param {string[]} filters Filters to remove\n * @returns {this}\n */\n public deleteFilters(...filters: string[]): this {\n if (!filters.length) {\n return this;\n }\n\n this._nestService.deleteFilters(...filters);\n\n return this;\n }\n\n /**\n * Remove selected related models from the query builder state\n * \n * @param {string[]} includes Models to remove\n * @returns \n */\n public deleteIncludes(...includes: string[]): this {\n if (!includes.length) {\n return this;\n }\n\n this._nestService.deleteIncludes(...includes);\n\n return this;\n }\n\n /**\n * Remove sorts rules from the query builder state\n * \n * @param sorts Fields used for sorting to remove\n * @returns {this}\n */\n public deleteSorts(...sorts: string[]): this {\n this._nestService.deleteSorts(...sorts);\n return this;\n }\n\n /**\n * Generate an URI accordingly to the given data\n *\n * @returns {Observable<string>} An observable that emits the generated uri\n */\n public generateUri(): Observable<string> {\n this._uri$.next(this._parse(this._nestService.nest()));\n return this.uri$;\n }\n\n /**\n * Clear the current state and reset the Query Builder to a fresh, clean condition\n * \n * @returns {this}\n */\n public reset(): this {\n this._nestService.reset();\n return this;\n }\n\n /**\n * Set the base url to use for composing the address\n * \n * @param {string} baseUrl \n * @returns {this}\n */\n public setBaseUrl(baseUrl: string): this {\n this._nestService.baseUrl = baseUrl;\n return this;\n }\n\n /**\n * Set the items per page number\n * \n * @param limit \n * @returns {this}\n */\n public setLimit(limit: number): this {\n this._nestService.limit = limit;\n return this;\n }\n\n /**\n * Set the model to use for running the query against\n * - I.e. the model \"users\" will return /users\n * \n * @param {string} model Model name\n * @returns {this}\n */\n public setModel(model: string): this {\n this._nestService.model = model;\n return this;\n }\n\n /**\n * Set the page that the backend will use to paginate the result set\n * \n * @param page Page param\n * @returns {this}\n */\n public setPage(page: number): this {\n this._nestService.page = page;\n return this;\n }\n}\n","import { IPaginationConfig } from '../interfaces/pagination-config.interface';\n\nexport class ResponseOptions {\n public readonly currentPage: string;\n public readonly data: string;\n public readonly firstPageUrl: string;\n public readonly from: string;\n public readonly lastPage: string;\n public readonly lastPageUrl: string;\n public readonly nextPageUrl: string;\n public readonly path: string;\n public readonly perPage: string;\n public readonly prevPageUrl: string;\n public readonly to: string;\n public readonly total: string;\n\n constructor(options: IPaginationConfig) {\n this.currentPage = options.currentPage || 'current_page';\n this.data = options.data || 'data';\n this.firstPageUrl = options.firstPageUrl || 'first_page_url';\n this.from = options.from || 'from';\n this.lastPage = options.lastPage || 'last_page';\n this.lastPageUrl = options.lastPageUrl || 'last_page_url';\n this.nextPageUrl = options.nextPageUrl || 'next_page_url';\n this.path = options.path || 'path';\n this.perPage = options.perPage || 'per_page';\n this.prevPageUrl = options.prevPageUrl || 'prev_page_url';\n this.to = options.to || 'to';\n this.total = options.total || 'total';\n }\n}","import { Inject, Injectable, Optional } from \"@angular/core\";\nimport { IPaginationConfig } from \"../interfaces/pagination-config.interface\";\nimport { PaginatedCollection } from \"../models/paginated-collection\";\nimport { ResponseOptions } from \"../models/response-options\";\nimport { IPaginatedObject } from \"../interfaces/paginated-object.interface\";\n\n@Injectable()\nexport class PaginationService {\n private _options: ResponseOptions;\n \n constructor(@Inject('RESPONSE_OPTIONS') @Optional() options: IPaginationConfig = {}) {\n this._options = new ResponseOptions(options);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public paginate<T extends IPaginatedObject>(response: {[key: string]: any}): PaginatedCollection<T> {\n return new PaginatedCollection(\n response[this._options.data],\n response[this._options.currentPage],\n response[this._options.from],\n response[this._options.to],\n response[this._options.total],\n response[this._options.perPage],\n response[this._options.prevPageUrl],\n response[this._options.nextPageUrl],\n response[this._options.lastPage],\n response[this._options.firstPageUrl],\n response[this._options.lastPageUrl]\n );\n }\n}","import { ModuleWithProviders, NgModule } from '@angular/core';\nimport { NgQubeeService } from './services/ng-qubee.service';\nimport { IConfig } from './interfaces/config.interface';\nimport { PaginationService } from './services/pagination.service';\nimport { NestService } from './services/nest.service';\n\n// @dynamic\n@NgModule({\n providers: [{\n deps: [NestService],\n provide: NgQubeeService,\n useFactory: (nestService: NestService) => new NgQubeeService(nestService, {})\n }]\n})\nexport class NgQubeeModule {\n public static forRoot(config: IConfig = {}): ModuleWithProviders<NgQubeeModule> {\n return {\n ngModule: NgQubeeModule,\n providers: [\n NestService,\n {\n deps: [NestService],\n provide: NgQubeeService,\n useFactory: (nestService: NestService) =>\n new NgQubeeService(nestService, Object.assign({}, config.request))\n }, {\n provide: PaginationService,\n useFactory: () =>\n new PaginationService(Object.assign({}, config.response))\n }\n ]\n };\n }\n}\n","import { EnvironmentProviders, makeEnvironmentProviders } from \"@angular/core\";\nimport { IConfig } from \"./interfaces/config.interface\";\nimport { NgQubeeService } from \"./services/ng-qubee.service\";\nimport { PaginationService } from \"./services/pagination.service\";\nimport { NestService } from \"./services/nest.service\";\n\n/**\n * Sets up providers necessary to enable `NgQubee` functionality for the application.\n *\n * @usageNotes\n *\n * Basic example of how you can add NgQubee to your application:\n * ```\n * const config = {};\n * \n * bootstrapApplication(AppComponent, {\n * providers: [provideNgQubee(config)]\n * });\n * ```\n *\n * @publicApi\n * @param config Configuration object compliant to the IConfig interface\n * @returns A set of providers to setup NgQubee\n */\nexport function provideNgQubee(config: IConfig = {}): EnvironmentProviders {\n return makeEnvironmentProviders([\n {\n provide: NestService,\n useClass: NestService\n },\n {\n deps: [NestService],\n provide: NgQubeeService,\n useFactory: (nestService: NestService) => new NgQubeeService(nestService, Object.assign({}, config.request))\n }, {\n provide: PaginationService,\n useFactory: () => new PaginationService(Object.assign({}, config.response))\n }\n ]);\n}","/*\n * Public API Surface of angular-query-builder\n */\n\nexport * from './lib/models/paginated-collection';\nexport * from './lib/ng-qubee.module';\nexport * from './lib/provide-ngqubee';\nexport * from './lib/services/ng-qubee.service';\nexport * from './lib/services/pagination.service';\n","/**\n * Generated bundle index. Do not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iB,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,QAAQ,CAAC;AAC3E;AACF,KAAA,CAAC;AACJ;;ACvCA;;AAEG;;ACFH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ng-qubee.mjs","sources":["../../../src/lib/errors/key-not-found.error.ts","../../../src/lib/models/paginated-collection.ts","../../../src/lib/enums/sort.enum.ts","../../../src/lib/errors/unselectable-model.error.ts","../../../src/lib/models/query-builder-options.ts","../../../src/lib/errors/invalid-model-name.error.ts","../../../src/lib/errors/invalid-page-number.error.ts","../../../src/lib/errors/invalid-limit.error.ts","../../../src/lib/services/nest.service.ts","../../../src/lib/services/ng-qubee.service.ts","../../../src/lib/models/response-options.ts","../../../src/lib/services/pagination.service.ts","../../../src/lib/ng-qubee.module.ts","../../../src/lib/provide-ngqubee.ts","../../../src/public-api.ts","../../../src/ng-qubee.ts"],"sourcesContent":["export class KeyNotFoundError extends Error {\n constructor(key: string) {\n super(`Cannot find the key ${key} inside the collection item: does it really exists?`);\n }\n}","import { KeyNotFoundError } from \"../errors/key-not-found.error\";\nimport { INormalized } from \"../interfaces/normalized.interface\";\nimport { IPaginatedObject } from \"../interfaces/paginated-object.interface\";\n\nexport class PaginatedCollection<T extends IPaginatedObject> {\n constructor(\n public data: T[],\n public readonly page: number,\n public readonly from?: number,\n public readonly to?: number,\n public readonly total?: number,\n public readonly perPage?: number,\n public readonly prevPageUrl?: string,\n public readonly nextPageUrl?: string,\n public readonly lastPage?: number,\n public readonly firstPageUrl?: string,\n public readonly lastPageUrl?: string\n ) {\n //\n }\n\n /**\n * Normalize the collection to a paginated list of ids for state-managed applications.\n * \n * This method returns a single key object, where the key is the page number and the associated value is\n * an array of ids. Each id is fetched by the collection items, looking up for the \"id\" key. If an id is supplied\n * to this method, it will be used instead of the default \"id\" key.\n * \n * Please note that in case the key doesn't exist in the collection's item, a KeyNotFoundError is thrown\n * \n * @param k A key to use instead of the default \"id\": this will be searched inside each element of the collection\n * @returns []\n * @throws KeyNotFoundItem\n */\n public normalize(id?: string): INormalized {\n return {\n [this.page]: this.data.reduce((ids: number[], value: T) => {\n if (id && id in value) {\n ids.push(value[id]);\n } else if (value.hasOwnProperty('id')) {\n ids.push(value['id']);\n } else {\n throw new KeyNotFoundError(id || 'id');\n }\n\n return ids;\n }, [])\n }\n }\n}","export enum SortEnum {\n ASC = 'asc',\n DESC = 'desc'\n}","export class UnselectableModelError extends Error {\n constructor(model: string) {\n super(`Unselectable Model: the selected model (${model}) is not present neither in the \"model\" property, nor in the includes object.`);\n }\n}","import { IQueryBuilderConfig } from '../interfaces/query-builder-config.interface';\n\nexport class QueryBuilderOptions {\n public readonly appends: string;\n public readonly fields: string;\n public readonly filters: string;\n public readonly includes: string;\n public readonly limit: string;\n public readonly page: string;\n public readonly sort: string;\n\n constructor(options: IQueryBuilderConfig) {\n this.appends = options.appends || 'append';\n this.fields = options.fields || 'fields';\n this.filters = options.filters || 'filter';\n this.includes = options.includes || 'include';\n this.limit = options.limit || 'limit';\n this.page = options.page || 'page';\n this.sort = options.sort || 'sort';\n }\n}","export class InvalidModelNameError extends Error {\n constructor(model: string | null | undefined) {\n super(\n `Invalid model name: Model name must be a non-empty string. Received: ${JSON.stringify(model)}`\n );\n this.name = 'InvalidModelNameError';\n }\n}\n","export class InvalidPageNumberError extends Error {\n constructor(page: number) {\n super(\n `Invalid page number: Page must be a positive integer greater than 0. Received: ${page}`\n );\n this.name = 'InvalidPageNumberError';\n }\n}\n","export class InvalidLimitError extends Error {\n constructor(limit: number) {\n super(\n `Invalid limit value: Limit must be a positive integer greater than 0. Received: ${limit}`\n );\n this.name = 'InvalidLimitError';\n }\n}\n","import { Injectable, Signal, WritableSignal, computed, signal } from '@angular/core';\nimport { IQueryBuilderState } from '../interfaces/query-builder-state.interface';\nimport { IFields } from '../interfaces/fields.interface';\nimport { IFilters } from '../interfaces/filters.interface';\nimport { ISort } from '../interfaces/sort.interface';\nimport { InvalidModelNameError } from '../errors/invalid-model-name.error';\nimport { InvalidPageNumberError } from '../errors/invalid-page-number.error';\nimport { InvalidLimitError } from '../errors/invalid-limit.error';\n\nconst INITIAL_STATE: IQueryBuilderState = {\n baseUrl: '',\n fields: {},\n filters: {},\n includes: [],\n limit: 15,\n model: '',\n page: 1,\n sorts: []\n};\n\n@Injectable()\nexport class NestService {\n\n /**\n * Private writable signal that holds the Query Builder state\n * \n * @type {IQueryBuilderState}\n */\n private _nest: WritableSignal<IQueryBuilderState> = signal(this._clone(INITIAL_STATE));\n\n /**\n * A computed signal that makes readonly the writable signal _nest\n * \n * @type {Signal<IQueryBuilderState>}\n */\n public nest: Signal<IQueryBuilderState> = computed(() => this._clone(this._nest()));\n\n constructor() {\n // Nothing to see here 👮🏻♀️\n }\n\n /**\n * Set the base URL for the API\n *\n * @param {string} baseUrl - The base URL to prepend to generated URIs\n * @example\n * service.baseUrl = 'https://api.example.com';\n */\n set baseUrl(baseUrl: string) {\n this._nest.update(nest => ({\n ...nest,\n baseUrl\n }));\n }\n\n /**\n * Set the limit for paginated results\n * Must be a positive integer greater than 0\n *\n * @param {number} limit - The number of items per page\n * @throws {InvalidLimitError} If limit is not a positive integer\n * @example\n * service.limit = 25;\n */\n set limit(limit: number) {\n this._validateLimit(limit);\n this._nest.update(nest => ({\n ...nest,\n limit\n }));\n }\n\n /**\n * Set the model name for the query\n * Must be a non-empty string\n *\n * @param {string} model - The model/resource name (e.g., 'users', 'posts')\n * @throws {InvalidModelNameError} If model is not a non-empty string\n * @example\n * service.model = 'users';\n */\n set model(model: string) {\n this._validateModelName(model);\n this._nest.update(nest => ({\n ...nest,\n model\n }));\n }\n\n /**\n * Set the page number for pagination\n * Must be a positive integer greater than 0\n *\n * @param {number} page - The page number to fetch\n * @throws {InvalidPageNumberError} If page is not a positive integer\n * @example\n * service.page = 2;\n */\n set page(page: number) {\n this._validatePageNumber(page);\n this._nest.update(nest => ({\n ...nest,\n page\n }));\n }\n\n private _clone<T>(obj: T): T {\n return JSON.parse( JSON.stringify(obj) );\n }\n\n /**\n * Validates that the model name is a non-empty string\n *\n * @param {string} model - The model name to validate\n * @throws {InvalidModelNameError} If model is not a non-empty string\n * @private\n */\n private _validateModelName(model: string): void {\n if (!model || typeof model !== 'string' || model.trim().length === 0) {\n throw new InvalidModelNameError(model);\n }\n }\n\n /**\n * Validates that the page number is a positive integer\n *\n * @param {number} page - The page number to validate\n * @throws {InvalidPageNumberError} If page is not a positive integer\n * @private\n */\n private _validatePageNumber(page: number): void {\n if (!Number.isInteger(page) || page < 1) {\n throw new InvalidPageNumberError(page);\n }\n }\n\n /**\n * Validates that the limit is a positive integer\n *\n * @param {number} limit - The limit value to validate\n * @throws {InvalidLimitError} If limit is not a positive integer\n * @private\n */\n private _validateLimit(limit: number): void {\n if (!Number.isInteger(limit) || limit < 1) {\n throw new InvalidLimitError(limit);\n }\n }\n\n /**\n * Add selectable fields for the given model to the request\n * Automatically prevents duplicate fields for each model\n *\n * @param {IFields} fields - Object mapping model names to arrays of field names\n * @return {void}\n * @example\n * service.addFields({ users: ['id', 'email', 'username'] });\n * service.addFields({ posts: ['title', 'content'] });\n */\n public addFields(fields: IFields): void {\n this._nest.update(nest => {\n const mergedFields = { ...nest.fields };\n\n Object.keys(fields).forEach(model => {\n const existingFields = mergedFields[model] || [];\n const newFields = fields[model];\n\n // Use Set to prevent duplicates\n const uniqueFields = Array.from(new Set([...existingFields, ...newFields]));\n mergedFields[model] = uniqueFields;\n });\n\n return {\n ...nest,\n fields: mergedFields\n };\n });\n }\n\n /**\n * Add filters to the request\n * Automatically prevents duplicate filter values for each filter key\n *\n * @param {IFilters} filters - Object mapping filter keys to arrays of values\n * @return {void}\n * @example\n * service.addFilters({ id: [1, 2, 3] });\n * service.addFilters({ status: ['active', 'pending'] });\n */\n public addFilters(filters: IFilters): void {\n this._nest.update(nest => {\n const mergedFilters = { ...nest.filters };\n\n Object.keys(filters).forEach(key => {\n const existingValues = mergedFilters[key] || [];\n const newValues = filters[key];\n\n // Use Set to prevent duplicates\n const uniqueValues = Array.from(new Set([...existingValues, ...newValues]));\n mergedFilters[key] = uniqueValues;\n });\n\n return {\n ...nest,\n filters: mergedFilters\n };\n });\n }\n\n /**\n * Add resources to include with the request\n * Automatically prevents duplicate includes\n *\n * @param {string[]} includes - Array of model names to include in the response\n * @return {void}\n * @example\n * service.addIncludes(['profile', 'posts']);\n * service.addIncludes(['comments']);\n */\n public addIncludes(includes: string[]): void {\n this._nest.update(nest => {\n // Use Set to prevent duplicates\n const uniqueIncludes = Array.from(new Set([...nest.includes, ...includes]));\n\n return {\n ...nest,\n includes: uniqueIncludes\n };\n });\n }\n\n /**\n * Add a field that should be used for sorting data\n *\n * @param {ISort} sort - Sort configuration with field name and order (ASC/DESC)\n * @return {void}\n * @example\n * import { SortEnum } from 'ng-qubee';\n * service.addSort({ field: 'created_at', order: SortEnum.DESC });\n * service.addSort({ field: 'name', order: SortEnum.ASC });\n */\n public addSort(sort: ISort): void {\n this._nest.update(nest => ({\n ...nest,\n sorts: [...nest.sorts, sort]\n }));\n }\n\n /**\n * Remove fields for the given model\n * Uses deep cloning to prevent mutations to the original state\n *\n * @param {IFields} fields - Object mapping model names to arrays of field names to remove\n * @return {void}\n * @example\n * service.deleteFields({ users: ['email'] });\n * service.deleteFields({ posts: ['content', 'body'] });\n */\n public deleteFields(fields: IFields): void {\n // Deep clone the fields object to prevent mutations\n const f = this._clone(this._nest().fields);\n\n Object.keys(fields).forEach(k => {\n if (!(k in f)) {\n return;\n }\n\n f[k] = f[k].filter(v => !fields[k].includes(v));\n });\n\n this._nest.update(nest => ({\n ...nest,\n fields: f\n }));\n }\n\n /**\n * Remove filters from the request\n * Uses deep cloning to prevent mutations to the original state\n *\n * @param {...string[]} filters - Filter keys to remove\n * @return {void}\n * @example\n * service.deleteFilters('id');\n * service.deleteFilters('status', 'type');\n */\n public deleteFilters(...filters: string[]): void {\n // Deep clone the filters object to prevent mutations\n const f = this._clone(this._nest().filters);\n\n filters.forEach(k => delete f[k]);\n\n this._nest.update(nest => ({\n ...nest,\n filters: f\n }));\n }\n\n /**\n * Remove includes from the request\n *\n * @param {...string[]} includes - Include names to remove\n * @return {void}\n * @example\n * service.deleteIncludes('profile');\n * service.deleteIncludes('posts', 'comments');\n */\n public deleteIncludes(...includes: string[]): void {\n this._nest.update(nest => ({\n ...nest,\n includes: nest.includes.filter(v => !includes.includes(v))\n }));\n }\n\n /**\n * Remove sorts from the request by field name\n *\n * @param {...string[]} sorts - Field names of sorts to remove\n * @return {void}\n * @example\n * service.deleteSorts('created_at');\n * service.deleteSorts('name', 'created_at');\n */\n public deleteSorts(...sorts: string[]): void {\n const s = [...this._nest().sorts];\n\n sorts.forEach(field => {\n const p = s.findIndex(sort => sort.field === field);\n\n if (p > -1) {\n s.splice(p, 1);\n }\n });\n\n this._nest.update(nest => ({\n ...nest,\n sorts: s\n }));\n }\n\n /**\n * Reset the query builder state to initial values\n * Clears all fields, filters, includes, sorts, and resets pagination\n *\n * @return {void}\n * @example\n * service.reset();\n * // State is now: { baseUrl: '', fields: {}, filters: {}, includes: [], limit: 15, model: '', page: 1, sorts: [] }\n */\n public reset(): void {\n this._nest.update(_ => this._clone(INITIAL_STATE));\n }\n}\n","import { Inject, Injectable, Optional } from '@angular/core';\nimport * as qs from 'qs';\nimport { BehaviorSubject, Observable, filter, throwError } from 'rxjs';\n\n// Enums\nimport { SortEnum } from '../enums/sort.enum';\n\n// Errors\nimport { UnselectableModelError } from '../errors/unselectable-model.error';\n\n// Interfaces\nimport { IFields } from '../interfaces/fields.interface';\nimport { IQueryBuilderConfig } from '../interfaces/query-builder-config.interface';\nimport { IQueryBuilderState } from '../interfaces/query-builder-state.interface';\n\n// Models\nimport { QueryBuilderOptions } from '../models/query-builder-options';\n\n// Services\nimport { NestService } from './nest.service';\n\n@Injectable()\nexport class NgQubeeService {\n\n private _options: QueryBuilderOptions;\n\n /**\n * This property serves as an accumulator for holding the composed string with each query param\n */\n private _uri = '';\n\n private _uri$: BehaviorSubject<string> = new BehaviorSubject('');\n\n public uri$: Observable<string> = this._uri$.asObservable().pipe(\n filter(uri => !!uri)\n );\n\n constructor(private _nestService: NestService, @Inject('QUERY_PARAMS_CONFIG') @Optional() options: IQueryBuilderConfig = {}) {\n this._options = new QueryBuilderOptions(options);\n }\n\n private _parseFields(s: IQueryBuilderState): string {\n if (!Object.keys(s.fields).length) {\n return this._uri;\n }\n\n if (!s.model) {\n throw new Error('While selecting fields, the -> model <- is required');\n }\n\n if (!(s.model in s.fields)) {\n throw new Error(`Key ${s.model} is missing in the fields object`);\n }\n\n const f = {};\n\n for (const k in s.fields) {\n if (s.fields.hasOwnProperty(k)) {\n // Check if the key is the model or is declared in \"includes\".\n // If not, it means that has not been selected anywhere and that will cause an error on the API\n if (k !== s.model && !s.includes.includes(k)) {\n throw new UnselectableModelError(k);\n }\n\n Object.assign(f, { [`${this._options.fields}[${k}]`]: s.fields[k].join(',') });\n }\n }\n\n const param = `${this._prepend(s.model)}${qs.stringify(f, { encode: false })}`;\n this._uri += param;\n\n return param;\n }\n\n private _parseFilters(s: IQueryBuilderState): string {\n const keys = Object.keys(s.filters);\n\n if (!keys.length) {\n return this._uri;\n }\n\n const f = {\n [`${this._options.filters}`]: keys.reduce((acc, key) => {\n return Object.assign(acc, { [key]: s.filters[key].join(',') });\n }, {})\n };\n const param = `${this._prepend(s.model)}${qs.stringify(f, { encode: false })}`;\n\n this._uri += param;\n\n return param;\n }\n\n private _parseIncludes(s: IQueryBuilderState): string {\n if (!s.includes.length) {\n return this._uri;\n }\n\n const param = `${this._prepend(s.model)}${this._options.includes}=${s.includes}`;\n this._uri += param;\n\n return param;\n }\n\n private _parseLimit(s: IQueryBuilderState): string {\n const param = `${this._prepend(s.model)}${this._options.limit}=${s.limit}`;\n this._uri += param;\n\n return param;\n }\n\n private _parsePage(s: IQueryBuilderState): string {\n const param = `${this._prepend(s.model)}${this._options.page}=${s.page}`;\n this._uri += param;\n\n return param;\n }\n\n private _parseSort(s: IQueryBuilderState): string {\n let param: string = '';\n\n if (!s.sorts.length) {\n return param;\n }\n\n param = `${this._prepend(s.model)}${this._options.sort}=`;\n\n s.sorts.forEach((sort, idx) => {\n param += `${sort.order === SortEnum.DESC ? '-' : ''}${sort.field}`;\n\n if (idx < s.sorts.length - 1) {\n param += ','\n }\n });\n\n this._uri += param;\n\n return param;\n }\n\n private _parse(s: IQueryBuilderState): string {\n if (!s.model) {\n throw new Error('Set the model property BEFORE adding filters or calling the url() / get() methods');\n }\n\n // Cleanup the previously generated URI\n this._uri = '';\n\n this._parseIncludes(s);\n this._parseFields(s);\n this._parseFilters(s);\n this._parseLimit(s);\n this._parsePage(s);\n this._parseSort(s);\n\n return this._uri;\n }\n\n private _prepend(model: string): string {\n const state = this._nestService.nest();\n const baseUrl = state.baseUrl;\n\n if (this._uri) {\n return '&';\n }\n\n return baseUrl ? `${baseUrl}/${model}?` : `/${model}?`;\n }\n\n /**\n * Add fields to the select statement for the given model\n *\n * @param model Model that holds the fields\n * @param fields Fields to select\n * @returns {this}\n */\n public addFields(model: string, fields: string[]): this {\n if (!fields.length) {\n return this;\n }\n\n this._nestService.addFields({ [model]: fields });\n\n return this;\n }\n\n /**\n * Add a filter with the given value(s)\n * I.e. filter[field]=1 or filter[field]=1,2,3\n * \n * @param {string} field Name of the field to filter\n * @param {string[]} value The needle(s)\n * @returns {this}\n */\n public addFilter(field: string, ...values: (string | number | boolean)[]): this {\n if (!values.length) {\n return this;\n }\n\n this._nestService.addFilters({\n [field]: values\n });\n\n return this;\n }\n\n /**\n * Add related entities to include in the request\n * \n * @param {string[]} models \n * @returns \n */\n public addIncludes(...models: string[]): this {\n if (!models.length) {\n return this;\n }\n\n this._nestService.addIncludes(models);\n\n return this;\n }\n\n /**\n * Add a field with a sort criteria\n * \n * @param field Field to use for sorting\n * @param {SortEnum} order A value from the SortEnum enumeration\n * @returns {this}\n */\n public addSort(field: string, order: SortEnum): this {\n this._nestService.addSort({\n field,\n order\n });\n\n return this;\n }\n\n /**\n * Delete selected fields for the given models in the current query builder state\n * \n * ```\n * ngQubeeService.deleteFields({\n * users: ['email', 'password'],\n * address: ['zipcode']\n * });\n * ```\n * \n * @param {IFields} fields \n * @returns \n */\n public deleteFields(fields: IFields): this {\n this._nestService.deleteFields(fields);\n return this;\n }\n\n /**\n * Delete selected fields for the given model in the current query builder state\n * \n * ```\n * ngQubeeService.deleteFieldsByModel('users', 'email', 'password']);\n * ```\n * \n * @param model Model that holds the fields\n * @param {string[]} fields Fields to delete from the state\n * @returns {this}\n */\n public deleteFieldsByModel(model: string, ...fields: string[]): this {\n if (!fields.length) {\n return this;\n }\n\n this._nestService.deleteFields({\n [model]: fields\n });\n\n return this;\n }\n\n /**\n * Remove given filters from the query builder state\n * \n * @param {string[]} filters Filters to remove\n * @returns {this}\n */\n public deleteFilters(...filters: string[]): this {\n if (!filters.length) {\n return this;\n }\n\n this._nestService.deleteFilters(...filters);\n\n return this;\n }\n\n /**\n * Remove selected related models from the query builder state\n * \n * @param {string[]} includes Models to remove\n * @returns \n */\n public deleteIncludes(...includes: string[]): this {\n if (!includes.length) {\n return this;\n }\n\n this._nestService.deleteIncludes(...includes);\n\n return this;\n }\n\n /**\n * Remove sorts rules from the query builder state\n * \n * @param sorts Fields used for sorting to remove\n * @returns {this}\n */\n public deleteSorts(...sorts: string[]): this {\n this._nestService.deleteSorts(...sorts);\n return this;\n }\n\n /**\n * Generate an URI accordingly to the given data\n *\n * @returns {Observable<string>} An observable that emits the generated uri\n */\n public generateUri(): Observable<string> {\n try {\n this._uri$.next(this._parse(this._nestService.nest()));\n return this.uri$;\n } catch (error) {\n return throwError(() => error);\n }\n }\n\n /**\n * Clear the current state and reset the Query Builder to a fresh, clean condition\n * \n * @returns {this}\n */\n public reset(): this {\n this._nestService.reset();\n return this;\n }\n\n /**\n * Set the base url to use for composing the address\n * \n * @param {string} baseUrl \n * @returns {this}\n */\n public setBaseUrl(baseUrl: string): this {\n this._nestService.baseUrl = baseUrl;\n return this;\n }\n\n /**\n * Set the items per page number\n * \n * @param limit \n * @returns {this}\n */\n public setLimit(limit: number): this {\n this._nestService.limit = limit;\n return this;\n }\n\n /**\n * Set the model to use for running the query against\n * - I.e. the model \"users\" will return /users\n * \n * @param {string} model Model name\n * @returns {this}\n */\n public setModel(model: string): this {\n this._nestService.model = model;\n return this;\n }\n\n /**\n * Set the page that the backend will use to paginate the result set\n * \n * @param page Page param\n * @returns {this}\n */\n public setPage(page: number): this {\n this._nestService.page = page;\n return this;\n }\n}\n","import { IPaginationConfig } from '../interfaces/pagination-config.interface';\n\nexport class ResponseOptions {\n public readonly currentPage: string;\n public readonly data: string;\n public readonly firstPageUrl: string;\n public readonly from: string;\n public readonly lastPage: string;\n public readonly lastPageUrl: string;\n public readonly nextPageUrl: string;\n public readonly path: string;\n public readonly perPage: string;\n public readonly prevPageUrl: string;\n public readonly to: string;\n public readonly total: string;\n\n constructor(options: IPaginationConfig) {\n this.currentPage = options.currentPage || 'current_page';\n this.data = options.data || 'data';\n this.firstPageUrl = options.firstPageUrl || 'first_page_url';\n this.from = options.from || 'from';\n this.lastPage = options.lastPage || 'last_page';\n this.lastPageUrl = options.lastPageUrl || 'last_page_url';\n this.nextPageUrl = options.nextPageUrl || 'next_page_url';\n this.path = options.path || 'path';\n this.perPage = options.perPage || 'per_page';\n this.prevPageUrl = options.prevPageUrl || 'prev_page_url';\n this.to = options.to || 'to';\n this.total = options.total || 'total';\n }\n}","import { Inject, Injectable, Optional } from \"@angular/core\";\nimport { IPaginationConfig } from \"../interfaces/pagination-config.interface\";\nimport { PaginatedCollection } from \"../models/paginated-collection\";\nimport { ResponseOptions } from \"../models/response-options\";\nimport { IPaginatedObject } from \"../interfaces/paginated-object.interface\";\n\n@Injectable()\nexport class PaginationService {\n private _options: ResponseOptions;\n \n constructor(@Inject('RESPONSE_OPTIONS') @Optional() options: IPaginationConfig = {}) {\n this._options = new ResponseOptions(options);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public paginate<T extends IPaginatedObject>(response: {[key: string]: any}): PaginatedCollection<T> {\n return new PaginatedCollection(\n response[this._options.data],\n response[this._options.currentPage],\n response[this._options.from],\n response[this._options.to],\n response[this._options.total],\n response[this._options.perPage],\n response[this._options.prevPageUrl],\n response[this._options.nextPageUrl],\n response[this._options.lastPage],\n response[this._options.firstPageUrl],\n response[this._options.lastPageUrl]\n );\n }\n}","import { ModuleWithProviders, NgModule } from '@angular/core';\nimport { NgQubeeService } from './services/ng-qubee.service';\nimport { IConfig } from './interfaces/config.interface';\nimport { PaginationService } from './services/pagination.service';\nimport { NestService } from './services/nest.service';\n\n// @dynamic\n@NgModule({\n providers: [{\n deps: [NestService],\n provide: NgQubeeService,\n useFactory: (nestService: NestService) => new NgQubeeService(nestService, {})\n }]\n})\nexport class NgQubeeModule {\n public static forRoot(config: IConfig = {}): ModuleWithProviders<NgQubeeModule> {\n return {\n ngModule: NgQubeeModule,\n providers: [\n NestService,\n {\n deps: [NestService],\n provide: NgQubeeService,\n useFactory: (nestService: NestService) =>\n new NgQubeeService(nestService, Object.assign({}, config.request))\n }, {\n provide: PaginationService,\n useFactory: () =>\n new PaginationService(Object.assign({}, config.response))\n }\n ]\n };\n }\n}\n","import { EnvironmentProviders, makeEnvironmentProviders } from \"@angular/core\";\nimport { IConfig } from \"./interfaces/config.interface\";\nimport { NgQubeeService } from \"./services/ng-qubee.service\";\nimport { PaginationService } from \"./services/pagination.service\";\nimport { NestService } from \"./services/nest.service\";\n\n/**\n * Sets up providers necessary to enable `NgQubee` functionality for the application.\n *\n * @usageNotes\n *\n * Basic example of how you can add NgQubee to your application:\n * ```\n * const config = {};\n * \n * bootstrapApplication(AppComponent, {\n * providers: [provideNgQubee(config)]\n * });\n * ```\n *\n * @publicApi\n * @param config Configuration object compliant to the IConfig interface\n * @returns A set of providers to setup NgQubee\n */\nexport function provideNgQubee(config: IConfig = {}): EnvironmentProviders {\n return makeEnvironmentProviders([\n {\n provide: NestService,\n useClass: NestService\n },\n {\n deps: [NestService],\n provide: NgQubeeService,\n useFactory: (nestService: NestService) => new NgQubeeService(nestService, Object.assign({}, config.request))\n }, {\n provide: PaginationService,\n useFactory: () => new PaginationService(Object.assign({}, config.response))\n }\n ]);\n}","/*\n * Public API Surface of angular-query-builder\n */\n\nexport * from './lib/models/paginated-collection';\nexport * from './lib/ng-qubee.module';\nexport * from './lib/provide-ngqubee';\nexport * from './lib/services/ng-qubee.service';\nexport * from './lib/services/pagination.service';\n\n// Enums\nexport * from './lib/enums/sort.enum';\n\n// Error classes\nexport * from './lib/errors/invalid-limit.error';\nexport * from './lib/errors/invalid-model-name.error';\nexport * from './lib/errors/invalid-page-number.error';\nexport * from './lib/errors/key-not-found.error';\nexport * from './lib/errors/unselectable-model.error';\n\n// Interfaces\nexport * from './lib/interfaces/config.interface';\nexport * from './lib/interfaces/fields.interface';\nexport * from './lib/interfaces/filters.interface';\nexport * from './lib/interfaces/nest-state.interface';\nexport * from './lib/interfaces/page.interface';\nexport * from './lib/interfaces/paginated-object.interface';\nexport * from './lib/interfaces/pagination-config.interface';\nexport * from './lib/interfaces/query-builder-config.interface';\nexport * from './lib/interfaces/sort.interface';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;AAAM,MAAO,gBAAiB,SAAQ,KAAK,CAAA;AACvC,IAAA,WAAA,CAAY,GAAW,EAAA;AACnB,QAAA,KAAK,CAAC,CAAA,oBAAA,EAAuB,GAAG,CAAA,mDAAA,CAAqD,CAAC;;AAE7F;;MCAY,mBAAmB,CAAA;AAEjB,IAAA,IAAA;AACS,IAAA,IAAA;AACA,IAAA,IAAA;AACA,IAAA,EAAA;AACA,IAAA,KAAA;AACA,IAAA,OAAA;AACA,IAAA,WAAA;AACA,IAAA,WAAA;AACA,IAAA,QAAA;AACA,IAAA,YAAA;AACA,IAAA,WAAA;IAXpB,WACW,CAAA,IAAS,EACA,IAAY,EACZ,IAAa,EACb,EAAW,EACX,KAAc,EACd,OAAgB,EAChB,WAAoB,EACpB,WAAoB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C;gBACV,IAAI,EAAE,CAAC,WAAW,CAAC;AACnB,gBAAA,OAAO,EAAE,cAAc;AACvB,gBAAA,UAAU,EAAE,CAAC,WAAwB,KAAK,IAAI,cAAc,CAAC,WAAW,EAAE,EAAE;aAC7E,CAAC,EAAA,CAAA;;4FAES,aAAa,EAAA,UAAA,EAAA,CAAA;kBAPzB,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,SAAS,EAAE,CAAC;4BACV,IAAI,EAAE,CAAC,WAAW,CAAC;AACnB,4BAAA,OAAO,EAAE,cAAc;AACvB,4BAAA,UAAU,EAAE,CAAC,WAAwB,KAAK,IAAI,cAAc,CAAC,WAAW,EAAE,EAAE;yBAC7E;AACF,iBAAA;;;ACPD;;;;;;;;;;;;;;;;;AAiBG;AACa,SAAA,cAAc,CAAC,MAAA,GAAkB,EAAE,EAAA;AACjD,IAAA,OAAO,wBAAwB,CAAC;AAC9B,QAAA;AACE,YAAA,OAAO,EAAE,WAAW;AACpB,YAAA,QAAQ,EAAE;AACX,SAAA;AACD,QAAA;YACE,IAAI,EAAE,CAAC,WAAW,CAAC;AACnB,YAAA,OAAO,EAAE,cAAc;YACvB,UAAU,EAAE,CAAC,WAAwB,KAAK,IAAI,cAAc,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,OAAO,CAAC;SAC5G,EAAE;AACD,YAAA,OAAO,EAAE,iBAAiB;AAC1B,YAAA,UAAU,EAAE,MAAM,IAAI,iBAAiB,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,QAAQ,CAAC;AAC3E;AACF,KAAA,CAAC;AACJ;;ACvCA;;AAEG;;ACFH;;AAEG;;;;"}
|
|
@@ -18,63 +18,164 @@ export declare class NestService {
|
|
|
18
18
|
*/
|
|
19
19
|
nest: Signal<IQueryBuilderState>;
|
|
20
20
|
constructor();
|
|
21
|
+
/**
|
|
22
|
+
* Set the base URL for the API
|
|
23
|
+
*
|
|
24
|
+
* @param {string} baseUrl - The base URL to prepend to generated URIs
|
|
25
|
+
* @example
|
|
26
|
+
* service.baseUrl = 'https://api.example.com';
|
|
27
|
+
*/
|
|
21
28
|
set baseUrl(baseUrl: string);
|
|
29
|
+
/**
|
|
30
|
+
* Set the limit for paginated results
|
|
31
|
+
* Must be a positive integer greater than 0
|
|
32
|
+
*
|
|
33
|
+
* @param {number} limit - The number of items per page
|
|
34
|
+
* @throws {InvalidLimitError} If limit is not a positive integer
|
|
35
|
+
* @example
|
|
36
|
+
* service.limit = 25;
|
|
37
|
+
*/
|
|
22
38
|
set limit(limit: number);
|
|
39
|
+
/**
|
|
40
|
+
* Set the model name for the query
|
|
41
|
+
* Must be a non-empty string
|
|
42
|
+
*
|
|
43
|
+
* @param {string} model - The model/resource name (e.g., 'users', 'posts')
|
|
44
|
+
* @throws {InvalidModelNameError} If model is not a non-empty string
|
|
45
|
+
* @example
|
|
46
|
+
* service.model = 'users';
|
|
47
|
+
*/
|
|
23
48
|
set model(model: string);
|
|
49
|
+
/**
|
|
50
|
+
* Set the page number for pagination
|
|
51
|
+
* Must be a positive integer greater than 0
|
|
52
|
+
*
|
|
53
|
+
* @param {number} page - The page number to fetch
|
|
54
|
+
* @throws {InvalidPageNumberError} If page is not a positive integer
|
|
55
|
+
* @example
|
|
56
|
+
* service.page = 2;
|
|
57
|
+
*/
|
|
24
58
|
set page(page: number);
|
|
25
59
|
private _clone;
|
|
60
|
+
/**
|
|
61
|
+
* Validates that the model name is a non-empty string
|
|
62
|
+
*
|
|
63
|
+
* @param {string} model - The model name to validate
|
|
64
|
+
* @throws {InvalidModelNameError} If model is not a non-empty string
|
|
65
|
+
* @private
|
|
66
|
+
*/
|
|
67
|
+
private _validateModelName;
|
|
68
|
+
/**
|
|
69
|
+
* Validates that the page number is a positive integer
|
|
70
|
+
*
|
|
71
|
+
* @param {number} page - The page number to validate
|
|
72
|
+
* @throws {InvalidPageNumberError} If page is not a positive integer
|
|
73
|
+
* @private
|
|
74
|
+
*/
|
|
75
|
+
private _validatePageNumber;
|
|
76
|
+
/**
|
|
77
|
+
* Validates that the limit is a positive integer
|
|
78
|
+
*
|
|
79
|
+
* @param {number} limit - The limit value to validate
|
|
80
|
+
* @throws {InvalidLimitError} If limit is not a positive integer
|
|
81
|
+
* @private
|
|
82
|
+
*/
|
|
83
|
+
private _validateLimit;
|
|
26
84
|
/**
|
|
27
85
|
* Add selectable fields for the given model to the request
|
|
86
|
+
* Automatically prevents duplicate fields for each model
|
|
28
87
|
*
|
|
29
|
-
* @param {IFields} fields
|
|
88
|
+
* @param {IFields} fields - Object mapping model names to arrays of field names
|
|
30
89
|
* @return {void}
|
|
31
|
-
* @
|
|
90
|
+
* @example
|
|
91
|
+
* service.addFields({ users: ['id', 'email', 'username'] });
|
|
92
|
+
* service.addFields({ posts: ['title', 'content'] });
|
|
32
93
|
*/
|
|
33
94
|
addFields(fields: IFields): void;
|
|
34
95
|
/**
|
|
35
96
|
* Add filters to the request
|
|
97
|
+
* Automatically prevents duplicate filter values for each filter key
|
|
36
98
|
*
|
|
37
|
-
* @param {IFilters} filters
|
|
38
|
-
* @
|
|
99
|
+
* @param {IFilters} filters - Object mapping filter keys to arrays of values
|
|
100
|
+
* @return {void}
|
|
101
|
+
* @example
|
|
102
|
+
* service.addFilters({ id: [1, 2, 3] });
|
|
103
|
+
* service.addFilters({ status: ['active', 'pending'] });
|
|
39
104
|
*/
|
|
40
105
|
addFilters(filters: IFilters): void;
|
|
41
106
|
/**
|
|
42
107
|
* Add resources to include with the request
|
|
108
|
+
* Automatically prevents duplicate includes
|
|
43
109
|
*
|
|
44
|
-
* @param {string[]} includes
|
|
110
|
+
* @param {string[]} includes - Array of model names to include in the response
|
|
45
111
|
* @return {void}
|
|
46
|
-
* @
|
|
112
|
+
* @example
|
|
113
|
+
* service.addIncludes(['profile', 'posts']);
|
|
114
|
+
* service.addIncludes(['comments']);
|
|
47
115
|
*/
|
|
48
116
|
addIncludes(includes: string[]): void;
|
|
49
117
|
/**
|
|
50
118
|
* Add a field that should be used for sorting data
|
|
51
119
|
*
|
|
52
|
-
* @param {ISort} sort
|
|
120
|
+
* @param {ISort} sort - Sort configuration with field name and order (ASC/DESC)
|
|
53
121
|
* @return {void}
|
|
122
|
+
* @example
|
|
123
|
+
* import { SortEnum } from 'ng-qubee';
|
|
124
|
+
* service.addSort({ field: 'created_at', order: SortEnum.DESC });
|
|
125
|
+
* service.addSort({ field: 'name', order: SortEnum.ASC });
|
|
54
126
|
*/
|
|
55
127
|
addSort(sort: ISort): void;
|
|
56
128
|
/**
|
|
57
129
|
* Remove fields for the given model
|
|
130
|
+
* Uses deep cloning to prevent mutations to the original state
|
|
58
131
|
*
|
|
59
|
-
* @param {IFields} fields
|
|
132
|
+
* @param {IFields} fields - Object mapping model names to arrays of field names to remove
|
|
133
|
+
* @return {void}
|
|
134
|
+
* @example
|
|
135
|
+
* service.deleteFields({ users: ['email'] });
|
|
136
|
+
* service.deleteFields({ posts: ['content', 'body'] });
|
|
60
137
|
*/
|
|
61
138
|
deleteFields(fields: IFields): void;
|
|
62
139
|
/**
|
|
140
|
+
* Remove filters from the request
|
|
141
|
+
* Uses deep cloning to prevent mutations to the original state
|
|
63
142
|
*
|
|
64
|
-
* @param filters
|
|
65
|
-
* @
|
|
143
|
+
* @param {...string[]} filters - Filter keys to remove
|
|
144
|
+
* @return {void}
|
|
145
|
+
* @example
|
|
146
|
+
* service.deleteFilters('id');
|
|
147
|
+
* service.deleteFilters('status', 'type');
|
|
66
148
|
*/
|
|
67
149
|
deleteFilters(...filters: string[]): void;
|
|
68
150
|
/**
|
|
151
|
+
* Remove includes from the request
|
|
69
152
|
*
|
|
70
|
-
* @param includes
|
|
153
|
+
* @param {...string[]} includes - Include names to remove
|
|
154
|
+
* @return {void}
|
|
155
|
+
* @example
|
|
156
|
+
* service.deleteIncludes('profile');
|
|
157
|
+
* service.deleteIncludes('posts', 'comments');
|
|
71
158
|
*/
|
|
72
159
|
deleteIncludes(...includes: string[]): void;
|
|
73
160
|
/**
|
|
161
|
+
* Remove sorts from the request by field name
|
|
74
162
|
*
|
|
75
|
-
* @param sorts
|
|
163
|
+
* @param {...string[]} sorts - Field names of sorts to remove
|
|
164
|
+
* @return {void}
|
|
165
|
+
* @example
|
|
166
|
+
* service.deleteSorts('created_at');
|
|
167
|
+
* service.deleteSorts('name', 'created_at');
|
|
76
168
|
*/
|
|
77
169
|
deleteSorts(...sorts: string[]): void;
|
|
170
|
+
/**
|
|
171
|
+
* Reset the query builder state to initial values
|
|
172
|
+
* Clears all fields, filters, includes, sorts, and resets pagination
|
|
173
|
+
*
|
|
174
|
+
* @return {void}
|
|
175
|
+
* @example
|
|
176
|
+
* service.reset();
|
|
177
|
+
* // State is now: { baseUrl: '', fields: {}, filters: {}, includes: [], limit: 15, model: '', page: 1, sorts: [] }
|
|
178
|
+
*/
|
|
78
179
|
reset(): void;
|
|
79
180
|
static ɵfac: i0.ɵɵFactoryDeclaration<NestService, never>;
|
|
80
181
|
static ɵprov: i0.ɵɵInjectableDeclaration<NestService>;
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"email": "info@andreatantimonaco.me",
|
|
6
6
|
"url": "https://andreatantimonaco.me"
|
|
7
7
|
},
|
|
8
|
-
"version": "2.0
|
|
8
|
+
"version": "2.1.0",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
@@ -38,6 +38,11 @@
|
|
|
38
38
|
"@angular/core": ">=16.0.0 <22.0.0",
|
|
39
39
|
"rxjs": "^6.5.0 || ^7.0.0"
|
|
40
40
|
},
|
|
41
|
+
"lint-staged": {
|
|
42
|
+
"src/**/*.ts": [
|
|
43
|
+
"eslint --fix"
|
|
44
|
+
]
|
|
45
|
+
},
|
|
41
46
|
"sideEffects": false,
|
|
42
47
|
"module": "fesm2022/ng-qubee.mjs",
|
|
43
48
|
"typings": "index.d.ts",
|
package/public-api.d.ts
CHANGED
|
@@ -3,3 +3,18 @@ export * from './lib/ng-qubee.module';
|
|
|
3
3
|
export * from './lib/provide-ngqubee';
|
|
4
4
|
export * from './lib/services/ng-qubee.service';
|
|
5
5
|
export * from './lib/services/pagination.service';
|
|
6
|
+
export * from './lib/enums/sort.enum';
|
|
7
|
+
export * from './lib/errors/invalid-limit.error';
|
|
8
|
+
export * from './lib/errors/invalid-model-name.error';
|
|
9
|
+
export * from './lib/errors/invalid-page-number.error';
|
|
10
|
+
export * from './lib/errors/key-not-found.error';
|
|
11
|
+
export * from './lib/errors/unselectable-model.error';
|
|
12
|
+
export * from './lib/interfaces/config.interface';
|
|
13
|
+
export * from './lib/interfaces/fields.interface';
|
|
14
|
+
export * from './lib/interfaces/filters.interface';
|
|
15
|
+
export * from './lib/interfaces/nest-state.interface';
|
|
16
|
+
export * from './lib/interfaces/page.interface';
|
|
17
|
+
export * from './lib/interfaces/paginated-object.interface';
|
|
18
|
+
export * from './lib/interfaces/pagination-config.interface';
|
|
19
|
+
export * from './lib/interfaces/query-builder-config.interface';
|
|
20
|
+
export * from './lib/interfaces/sort.interface';
|