@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.
@@ -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: any): Promise<any>;
24
+ list(args: ListArgsInterface): Promise<any>;
25
25
  get(args: any): Promise<any>;
26
26
  getMany(args: any): Promise<any>;
27
27
  getGatewayToSetOrerNo(): any;
@@ -23,7 +23,7 @@ declare class Database {
23
23
  limit: number | undefined;
24
24
  offset: number;
25
25
  };
26
- createLimitOffsetSortBy(pagination: any, defaultSortBy: any): {
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(pagination, defaultSortBy) {
169
- const { page, pageSize, sortBy } = pagination || {};
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 {
@@ -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: any): Promise<any>;
24
+ list(args: ListArgsInterface): Promise<any>;
25
25
  get(args: any): Promise<any>;
26
26
  getMany(args: any): Promise<any>;
27
27
  getGatewayToSetOrerNo(): any;
@@ -23,7 +23,7 @@ declare class Database {
23
23
  limit: number | undefined;
24
24
  offset: number;
25
25
  };
26
- createLimitOffsetSortBy(pagination: any, defaultSortBy: any): {
26
+ createLimitOffsetSortBy(params: any, defaultSortBy: any): {
27
27
  limit: number | undefined;
28
28
  offset: number;
29
29
  sortBy: any[] | null;
@@ -159,8 +159,9 @@ class Database {
159
159
  offset: limit ? (pageToUse - 1) * limit : 0,
160
160
  };
161
161
  }
162
- createLimitOffsetSortBy(pagination, defaultSortBy) {
163
- const { page, pageSize, sortBy } = pagination || {};
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,5 +1,7 @@
1
+ import { PaginationAndSortingInterface } from '..';
1
2
  export interface ListArgsInterface {
2
3
  filter: any;
3
- params?: any;
4
+ params?: PaginationAndSortingInterface;
4
5
  useCache?: boolean;
6
+ skipAuth?: boolean;
5
7
  }
@@ -1,7 +1,10 @@
1
1
  import { SortItemInterface } from './SortItemInterface';
2
2
  export interface PaginationInterface {
3
- page: number;
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,5 +1,7 @@
1
+ import { PaginationAndSortingInterface } from '..';
1
2
  export interface ListArgsInterface {
2
3
  filter: any;
3
- params?: any;
4
+ params?: PaginationAndSortingInterface;
4
5
  useCache?: boolean;
6
+ skipAuth?: boolean;
5
7
  }
@@ -1,7 +1,10 @@
1
1
  import { SortItemInterface } from './SortItemInterface';
2
2
  export interface PaginationInterface {
3
- page: number;
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sdflc/backend-helpers",
3
- "version": "1.0.92",
3
+ "version": "1.0.93",
4
4
  "description": "Set of helper functions and classes to simplify building backend apps within @sdflc ecosystem",
5
5
  "type": "commonjs",
6
6
  "exports": {