@baasix/sdk 0.1.14 → 0.1.16
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 +12 -1
- package/dist/index.cjs +7 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/dist/modules/items.cjs +4 -1
- package/dist/modules/items.cjs.map +1 -1
- package/dist/modules/items.d.cts +3 -0
- package/dist/modules/items.d.ts +3 -0
- package/dist/modules/items.js +4 -1
- package/dist/modules/items.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -523,6 +523,10 @@ declare class SettingsModule {
|
|
|
523
523
|
interface ReportsModuleConfig {
|
|
524
524
|
client: HttpClient;
|
|
525
525
|
}
|
|
526
|
+
/**
|
|
527
|
+
* Sort direction type
|
|
528
|
+
*/
|
|
529
|
+
type SortDirection = 'asc' | 'desc';
|
|
526
530
|
/**
|
|
527
531
|
* Stats query for the stats endpoint
|
|
528
532
|
*/
|
|
@@ -610,6 +614,9 @@ declare class ReportsModule {
|
|
|
610
614
|
groupBy?: string[];
|
|
611
615
|
filter?: Filter;
|
|
612
616
|
fields?: string[];
|
|
617
|
+
sort?: string[] | Record<string, SortDirection>;
|
|
618
|
+
limit?: number;
|
|
619
|
+
page?: number;
|
|
613
620
|
}): Promise<ReportResult>;
|
|
614
621
|
/**
|
|
615
622
|
* Get statistics for multiple collections in a single request
|
|
@@ -660,6 +667,9 @@ declare class ReportsModule {
|
|
|
660
667
|
aggregate: Aggregate;
|
|
661
668
|
groupBy?: string[];
|
|
662
669
|
filter?: Filter;
|
|
670
|
+
sort?: string[] | Record<string, SortDirection>;
|
|
671
|
+
limit?: number;
|
|
672
|
+
page?: number;
|
|
663
673
|
}): Promise<Record<string, unknown>[]>;
|
|
664
674
|
/**
|
|
665
675
|
* Count items matching a filter
|
package/dist/index.d.ts
CHANGED
|
@@ -523,6 +523,10 @@ declare class SettingsModule {
|
|
|
523
523
|
interface ReportsModuleConfig {
|
|
524
524
|
client: HttpClient;
|
|
525
525
|
}
|
|
526
|
+
/**
|
|
527
|
+
* Sort direction type
|
|
528
|
+
*/
|
|
529
|
+
type SortDirection = 'asc' | 'desc';
|
|
526
530
|
/**
|
|
527
531
|
* Stats query for the stats endpoint
|
|
528
532
|
*/
|
|
@@ -610,6 +614,9 @@ declare class ReportsModule {
|
|
|
610
614
|
groupBy?: string[];
|
|
611
615
|
filter?: Filter;
|
|
612
616
|
fields?: string[];
|
|
617
|
+
sort?: string[] | Record<string, SortDirection>;
|
|
618
|
+
limit?: number;
|
|
619
|
+
page?: number;
|
|
613
620
|
}): Promise<ReportResult>;
|
|
614
621
|
/**
|
|
615
622
|
* Get statistics for multiple collections in a single request
|
|
@@ -660,6 +667,9 @@ declare class ReportsModule {
|
|
|
660
667
|
aggregate: Aggregate;
|
|
661
668
|
groupBy?: string[];
|
|
662
669
|
filter?: Filter;
|
|
670
|
+
sort?: string[] | Record<string, SortDirection>;
|
|
671
|
+
limit?: number;
|
|
672
|
+
page?: number;
|
|
663
673
|
}): Promise<Record<string, unknown>[]>;
|
|
664
674
|
/**
|
|
665
675
|
* Count items matching a filter
|
package/dist/index.js
CHANGED
|
@@ -1568,13 +1568,16 @@ var ItemsModule = class {
|
|
|
1568
1568
|
/**
|
|
1569
1569
|
* Restore a soft-deleted item
|
|
1570
1570
|
*
|
|
1571
|
+
* Only works for collections with `paranoid: true`. Clears the `deletedAt`
|
|
1572
|
+
* timestamp so the record reappears in normal queries.
|
|
1573
|
+
*
|
|
1571
1574
|
* @example
|
|
1572
1575
|
* ```typescript
|
|
1573
1576
|
* await items.restore('product-uuid');
|
|
1574
1577
|
* ```
|
|
1575
1578
|
*/
|
|
1576
1579
|
async restore(id) {
|
|
1577
|
-
await this.
|
|
1580
|
+
await this.client.post(`/items/${this.collection}/${id}/restore`);
|
|
1578
1581
|
}
|
|
1579
1582
|
/**
|
|
1580
1583
|
* Aggregate data with grouping
|
|
@@ -2881,7 +2884,9 @@ var ReportsModule = class {
|
|
|
2881
2884
|
aggregate: options.aggregate,
|
|
2882
2885
|
groupBy: options.groupBy,
|
|
2883
2886
|
filter: options.filter,
|
|
2884
|
-
|
|
2887
|
+
sort: options.sort,
|
|
2888
|
+
limit: options.limit ?? -1,
|
|
2889
|
+
page: options.page
|
|
2885
2890
|
}
|
|
2886
2891
|
}
|
|
2887
2892
|
);
|