ng-qubee 3.4.0 → 3.5.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 +3 -2
- package/fesm2022/ng-qubee.mjs +582 -105
- package/fesm2022/ng-qubee.mjs.map +1 -1
- package/package.json +3 -1
- package/types/ng-qubee.d.ts +50 -20
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"name": "Andrea Tantimonaco",
|
|
5
5
|
"url": "https://andreatantimonaco.me"
|
|
6
6
|
},
|
|
7
|
-
"version": "3.
|
|
7
|
+
"version": "3.5.0",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
"angular",
|
|
19
19
|
"api",
|
|
20
20
|
"builder",
|
|
21
|
+
"django",
|
|
22
|
+
"drf",
|
|
21
23
|
"filter",
|
|
22
24
|
"headless-cms",
|
|
23
25
|
"json-api",
|
package/types/ng-qubee.d.ts
CHANGED
|
@@ -46,6 +46,7 @@ declare class PaginatedCollection<T extends IPaginatedObject> {
|
|
|
46
46
|
* request building (URI generation) and response parsing.
|
|
47
47
|
*/
|
|
48
48
|
declare enum DriverEnum {
|
|
49
|
+
DRF = "drf",
|
|
49
50
|
JSON_API = "json-api",
|
|
50
51
|
LARAVEL = "laravel",
|
|
51
52
|
NESTJS = "nestjs",
|
|
@@ -1642,6 +1643,36 @@ declare class LaravelRequestStrategy extends AbstractRequestStrategy {
|
|
|
1642
1643
|
protected parts(state: IQueryBuilderState, options: QueryBuilderOptions): string[];
|
|
1643
1644
|
}
|
|
1644
1645
|
|
|
1646
|
+
/**
|
|
1647
|
+
* Base class for response strategies whose pagination metadata is a flat
|
|
1648
|
+
* key-value envelope on the response body
|
|
1649
|
+
*
|
|
1650
|
+
* Laravel's stock pagination and Spatie's `QueryBuilder` both emit the
|
|
1651
|
+
* same flat shape — `{ data, current_page, total, per_page, from, to,
|
|
1652
|
+
* next_page_url, prev_page_url, first_page_url, last_page, last_page_url
|
|
1653
|
+
* }` — and both response strategies were duplicating the byte-identical
|
|
1654
|
+
* `new PaginatedCollection(response[options.X], ...)` body before this
|
|
1655
|
+
* base existed. Concrete classes now extend and provide only the
|
|
1656
|
+
* docstring describing their driver's specific shape (see
|
|
1657
|
+
* `LaravelResponseStrategy`, `SpatieResponseStrategy`).
|
|
1658
|
+
*
|
|
1659
|
+
* Drivers whose pagination metadata is a nested envelope (JSON:API,
|
|
1660
|
+
* NestJS, Strapi) extend `AbstractDotPathResponseStrategy` instead.
|
|
1661
|
+
* Drivers whose metadata comes from HTTP headers (PostgREST) or is
|
|
1662
|
+
* derived from response URLs (DRF) implement `IResponseStrategy`
|
|
1663
|
+
* directly.
|
|
1664
|
+
*/
|
|
1665
|
+
declare abstract class AbstractFlatResponseStrategy implements IResponseStrategy {
|
|
1666
|
+
/**
|
|
1667
|
+
* Parse a flat-envelope pagination response into a PaginatedCollection
|
|
1668
|
+
*
|
|
1669
|
+
* @param response - The raw API response object
|
|
1670
|
+
* @param options - The response key name configuration
|
|
1671
|
+
* @returns A typed PaginatedCollection instance
|
|
1672
|
+
*/
|
|
1673
|
+
paginate<T extends IPaginatedObject>(response: Record<string, any>, options: ResponseOptions): PaginatedCollection<T>;
|
|
1674
|
+
}
|
|
1675
|
+
|
|
1645
1676
|
/**
|
|
1646
1677
|
* Response strategy for the Laravel (pagination-only) driver
|
|
1647
1678
|
*
|
|
@@ -1654,19 +1685,20 @@ declare class LaravelRequestStrategy extends AbstractRequestStrategy {
|
|
|
1654
1685
|
* "per_page": 15,
|
|
1655
1686
|
* "from": 1,
|
|
1656
1687
|
* "to": 15,
|
|
1657
|
-
* ...
|
|
1688
|
+
* "next_page_url": "...",
|
|
1689
|
+
* "prev_page_url": "...",
|
|
1690
|
+
* "first_page_url": "...",
|
|
1691
|
+
* "last_page": 7,
|
|
1692
|
+
* "last_page_url": "..."
|
|
1658
1693
|
* }
|
|
1659
1694
|
* ```
|
|
1695
|
+
*
|
|
1696
|
+
* The traversal algorithm (flat `response[options.X]` lookups) is
|
|
1697
|
+
* inherited from `AbstractFlatResponseStrategy`; this class exists so
|
|
1698
|
+
* `DriverEnum.LARAVEL` resolves to a distinct identity at the DI layer
|
|
1699
|
+
* even though the parsing logic is shared with Spatie.
|
|
1660
1700
|
*/
|
|
1661
|
-
declare class LaravelResponseStrategy
|
|
1662
|
-
/**
|
|
1663
|
-
* Parse a flat Laravel pagination response into a PaginatedCollection
|
|
1664
|
-
*
|
|
1665
|
-
* @param response - The raw API response object
|
|
1666
|
-
* @param options - The response key name configuration
|
|
1667
|
-
* @returns A typed PaginatedCollection instance
|
|
1668
|
-
*/
|
|
1669
|
-
paginate<T extends IPaginatedObject>(response: Record<string, any>, options: ResponseOptions): PaginatedCollection<T>;
|
|
1701
|
+
declare class LaravelResponseStrategy extends AbstractFlatResponseStrategy {
|
|
1670
1702
|
}
|
|
1671
1703
|
|
|
1672
1704
|
/**
|
|
@@ -2085,7 +2117,8 @@ declare class SpatieRequestStrategy extends AbstractRequestStrategy {
|
|
|
2085
2117
|
/**
|
|
2086
2118
|
* Response strategy for the Spatie Query Builder driver
|
|
2087
2119
|
*
|
|
2088
|
-
* Parses flat Laravel pagination responses
|
|
2120
|
+
* Parses flat Laravel-style pagination responses (Spatie's Query Builder
|
|
2121
|
+
* is built on Laravel's pagination):
|
|
2089
2122
|
* ```json
|
|
2090
2123
|
* {
|
|
2091
2124
|
* "data": [...],
|
|
@@ -2098,17 +2131,14 @@ declare class SpatieRequestStrategy extends AbstractRequestStrategy {
|
|
|
2098
2131
|
* }
|
|
2099
2132
|
* ```
|
|
2100
2133
|
*
|
|
2134
|
+
* The traversal algorithm (flat `response[options.X]` lookups) is
|
|
2135
|
+
* inherited from `AbstractFlatResponseStrategy`; this class exists so
|
|
2136
|
+
* `DriverEnum.SPATIE` resolves to a distinct identity at the DI layer
|
|
2137
|
+
* even though the parsing logic is shared with the plain Laravel driver.
|
|
2138
|
+
*
|
|
2101
2139
|
* @see https://spatie.be/docs/laravel-query-builder
|
|
2102
2140
|
*/
|
|
2103
|
-
declare class SpatieResponseStrategy
|
|
2104
|
-
/**
|
|
2105
|
-
* Parse a flat Laravel pagination response into a PaginatedCollection
|
|
2106
|
-
*
|
|
2107
|
-
* @param response - The raw API response object
|
|
2108
|
-
* @param options - The response key name configuration
|
|
2109
|
-
* @returns A typed PaginatedCollection instance
|
|
2110
|
-
*/
|
|
2111
|
-
paginate<T extends IPaginatedObject>(response: Record<string, any>, options: ResponseOptions): PaginatedCollection<T>;
|
|
2141
|
+
declare class SpatieResponseStrategy extends AbstractFlatResponseStrategy {
|
|
2112
2142
|
}
|
|
2113
2143
|
|
|
2114
2144
|
/**
|