@sdflc/backend-helpers 1.0.92 → 1.0.93
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/build/BaseCore.d.ts +2 -2
- package/build/Database.d.ts +1 -1
- package/build/Database.js +3 -2
- package/build/esm/BaseCore.d.ts +2 -2
- package/build/esm/Database.d.ts +1 -1
- package/build/esm/Database.js +3 -2
- package/build/esm/interfaces/ListArgsInterface.d.ts +3 -1
- package/build/esm/interfaces/PaginationInterface.d.ts +5 -2
- package/build/interfaces/ListArgsInterface.d.ts +3 -1
- package/build/interfaces/PaginationInterface.d.ts +5 -2
- package/package.json +1 -1
package/build/BaseCore.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { OpResult } from '@sdflc/api-helpers';
|
|
|
2
2
|
import { Logger, MeasureTool } from '@sdflc/utils';
|
|
3
3
|
import { ID_TYPES } from './constants';
|
|
4
4
|
import { Database } from './Database';
|
|
5
|
-
import { BaseCorePropsInterface, BaseCoreActionsInterface, CoreActionInterface, JwtTokenSecretAndSettings, ApiContext, ExtractCredentialsArgs } from './interfaces';
|
|
5
|
+
import { BaseCorePropsInterface, BaseCoreActionsInterface, CoreActionInterface, JwtTokenSecretAndSettings, ApiContext, ExtractCredentialsArgs, ListArgsInterface } from './interfaces';
|
|
6
6
|
declare class BaseCore {
|
|
7
7
|
protected measureTool: MeasureTool;
|
|
8
8
|
protected config: BaseCorePropsInterface;
|
|
@@ -21,7 +21,7 @@ declare class BaseCore {
|
|
|
21
21
|
exceptionFailure(ex: any, doingWhat: string, data?: any): any;
|
|
22
22
|
checkResult(args: any): Promise<void>;
|
|
23
23
|
runAction(opt: CoreActionInterface): Promise<any>;
|
|
24
|
-
list(args:
|
|
24
|
+
list(args: ListArgsInterface): Promise<any>;
|
|
25
25
|
get(args: any): Promise<any>;
|
|
26
26
|
getMany(args: any): Promise<any>;
|
|
27
27
|
getGatewayToSetOrerNo(): any;
|
package/build/Database.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ declare class Database {
|
|
|
23
23
|
limit: number | undefined;
|
|
24
24
|
offset: number;
|
|
25
25
|
};
|
|
26
|
-
createLimitOffsetSortBy(
|
|
26
|
+
createLimitOffsetSortBy(params: any, defaultSortBy: any): {
|
|
27
27
|
limit: number | undefined;
|
|
28
28
|
offset: number;
|
|
29
29
|
sortBy: any[] | null;
|
package/build/Database.js
CHANGED
|
@@ -165,8 +165,9 @@ class Database {
|
|
|
165
165
|
offset: limit ? (pageToUse - 1) * limit : 0,
|
|
166
166
|
};
|
|
167
167
|
}
|
|
168
|
-
createLimitOffsetSortBy(
|
|
169
|
-
const {
|
|
168
|
+
createLimitOffsetSortBy(params, defaultSortBy) {
|
|
169
|
+
const { pagination, sortBy } = params || {};
|
|
170
|
+
const { page, pageSize } = pagination || {};
|
|
170
171
|
const { limit, offset } = this.createLimitOffset(page, pageSize);
|
|
171
172
|
const sortByToUse = this.createSortBy(sortBy, defaultSortBy);
|
|
172
173
|
return {
|
package/build/esm/BaseCore.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { OpResult } from '@sdflc/api-helpers';
|
|
|
2
2
|
import { Logger, MeasureTool } from '@sdflc/utils';
|
|
3
3
|
import { ID_TYPES } from './constants';
|
|
4
4
|
import { Database } from './Database';
|
|
5
|
-
import { BaseCorePropsInterface, BaseCoreActionsInterface, CoreActionInterface, JwtTokenSecretAndSettings, ApiContext, ExtractCredentialsArgs } from './interfaces';
|
|
5
|
+
import { BaseCorePropsInterface, BaseCoreActionsInterface, CoreActionInterface, JwtTokenSecretAndSettings, ApiContext, ExtractCredentialsArgs, ListArgsInterface } from './interfaces';
|
|
6
6
|
declare class BaseCore {
|
|
7
7
|
protected measureTool: MeasureTool;
|
|
8
8
|
protected config: BaseCorePropsInterface;
|
|
@@ -21,7 +21,7 @@ declare class BaseCore {
|
|
|
21
21
|
exceptionFailure(ex: any, doingWhat: string, data?: any): any;
|
|
22
22
|
checkResult(args: any): Promise<void>;
|
|
23
23
|
runAction(opt: CoreActionInterface): Promise<any>;
|
|
24
|
-
list(args:
|
|
24
|
+
list(args: ListArgsInterface): Promise<any>;
|
|
25
25
|
get(args: any): Promise<any>;
|
|
26
26
|
getMany(args: any): Promise<any>;
|
|
27
27
|
getGatewayToSetOrerNo(): any;
|
package/build/esm/Database.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ declare class Database {
|
|
|
23
23
|
limit: number | undefined;
|
|
24
24
|
offset: number;
|
|
25
25
|
};
|
|
26
|
-
createLimitOffsetSortBy(
|
|
26
|
+
createLimitOffsetSortBy(params: any, defaultSortBy: any): {
|
|
27
27
|
limit: number | undefined;
|
|
28
28
|
offset: number;
|
|
29
29
|
sortBy: any[] | null;
|
package/build/esm/Database.js
CHANGED
|
@@ -159,8 +159,9 @@ class Database {
|
|
|
159
159
|
offset: limit ? (pageToUse - 1) * limit : 0,
|
|
160
160
|
};
|
|
161
161
|
}
|
|
162
|
-
createLimitOffsetSortBy(
|
|
163
|
-
const {
|
|
162
|
+
createLimitOffsetSortBy(params, defaultSortBy) {
|
|
163
|
+
const { pagination, sortBy } = params || {};
|
|
164
|
+
const { page, pageSize } = pagination || {};
|
|
164
165
|
const { limit, offset } = this.createLimitOffset(page, pageSize);
|
|
165
166
|
const sortByToUse = this.createSortBy(sortBy, defaultSortBy);
|
|
166
167
|
return {
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { SortItemInterface } from './SortItemInterface';
|
|
2
2
|
export interface PaginationInterface {
|
|
3
|
-
page
|
|
3
|
+
page?: number;
|
|
4
4
|
pageSize?: number;
|
|
5
|
+
cursor?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface PaginationAndSortingInterface {
|
|
8
|
+
pagination?: PaginationInterface;
|
|
5
9
|
sortBy: SortItemInterface[];
|
|
6
|
-
cursor: string;
|
|
7
10
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { SortItemInterface } from './SortItemInterface';
|
|
2
2
|
export interface PaginationInterface {
|
|
3
|
-
page
|
|
3
|
+
page?: number;
|
|
4
4
|
pageSize?: number;
|
|
5
|
+
cursor?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface PaginationAndSortingInterface {
|
|
8
|
+
pagination?: PaginationInterface;
|
|
5
9
|
sortBy: SortItemInterface[];
|
|
6
|
-
cursor: string;
|
|
7
10
|
}
|