@temboplus/tembo-dashboard 0.0.8 → 0.0.10
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/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/modules/collection/collection.query-params.model.d.ts +218 -0
- package/dist/modules/collection/collection.repository.d.ts +7 -31
- package/dist/modules/collection/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { BaseRepository, PaginationDTO, WalletSummaryDTO } from "@/lib/api";
|
|
2
2
|
import { collectionContract } from "./collection.api-contract";
|
|
3
|
-
import { type CollectionQueryParamsDTO } from "./collection.dtos";
|
|
4
3
|
import { Collection } from "./collection.model";
|
|
5
4
|
import { CollectionQueryBuilder } from "./collection.query-builder";
|
|
5
|
+
import { CollectionQueryParams } from "./collection.query-params.model";
|
|
6
6
|
/**
|
|
7
|
-
* Flexible query input type - supports
|
|
7
|
+
* Flexible query input type - supports the class, DTO, URL params, etc.
|
|
8
8
|
*/
|
|
9
|
-
export type CollectionQueryInput =
|
|
9
|
+
export type CollectionQueryInput = CollectionQueryParams | Parameters<typeof CollectionQueryParams.from>[0];
|
|
10
10
|
/**
|
|
11
11
|
* Repository class for managing collections through API interactions.
|
|
12
12
|
* Handles collection operations, filtering, and summary data retrieval.
|
|
@@ -18,36 +18,12 @@ export declare class CollectionRepository extends BaseRepository<typeof collecti
|
|
|
18
18
|
root?: string;
|
|
19
19
|
});
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* @
|
|
25
|
-
* @returns Validated and typed CollectionQueryParamsDTO
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* ```typescript
|
|
29
|
-
* // Works with URL search params
|
|
30
|
-
* const urlParams = new URLSearchParams("page=1&limit=20&status=PAYMENT_ACCEPTED");
|
|
31
|
-
* const dto = repository.normalizeQueryParams(urlParams);
|
|
32
|
-
*
|
|
33
|
-
* // Works with string record
|
|
34
|
-
* const stringParams = { page: "1", limit: "20", status: "PAYMENT_ACCEPTED" };
|
|
35
|
-
* const dto2 = repository.normalizeQueryParams(stringParams);
|
|
36
|
-
*
|
|
37
|
-
* // Works with typed DTO
|
|
38
|
-
* const typedParams: CollectionQueryParamsDTO = { page: 1, limit: 20 };
|
|
39
|
-
* const dto3 = repository.normalizeQueryParams(typedParams);
|
|
40
|
-
* ```
|
|
21
|
+
* Normalize query input to CollectionQueryParams class instance
|
|
22
|
+
* @param query - Any supported query input type
|
|
23
|
+
* @returns CollectionQueryParams instance
|
|
24
|
+
* @throws Error if validation fails
|
|
41
25
|
*/
|
|
42
26
|
private normalizeQueryParams;
|
|
43
|
-
/**
|
|
44
|
-
* Type guard to check if input is a string-based record (from URL params)
|
|
45
|
-
*/
|
|
46
|
-
private isStringRecord;
|
|
47
|
-
/**
|
|
48
|
-
* Type guard to check if input is a typed DTO
|
|
49
|
-
*/
|
|
50
|
-
private isTypedDTO;
|
|
51
27
|
/**
|
|
52
28
|
* Get all collections with filtering and pagination.
|
|
53
29
|
* Supports flexible input types: typed DTO, URL search params, or string records.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@temboplus/tembo-dashboard",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"description": "A foundational library for Temboplus-Dashboard projects providing type-safe data layer abstraction with API contracts, domain models, and repositories.",
|
|
5
5
|
"main": "./dist/index.cjs.js",
|
|
6
6
|
"module": "./dist/index.esm.js",
|