@spytecgps/nova-orm 0.0.82 → 0.0.84

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.
@@ -1,7 +1,6 @@
1
- import { InsertResult } from 'typeorm';
2
1
  import { Position } from '../../entities';
3
2
  import { NovaDataSource } from '../../novaDataSource';
4
3
  import { Logger } from '../../types/logger';
5
4
  import { CreatePositionParams } from '../../types/position';
6
5
  export declare const createPosition: (novaDataSource: NovaDataSource, params: CreatePositionParams, logger: Logger) => Promise<Position>;
7
- export declare const upsertPositions: (novaDataSource: NovaDataSource, params: CreatePositionParams[], logger: Logger) => Promise<InsertResult>;
6
+ export declare const upsertPositions: (novaDataSource: NovaDataSource, params: CreatePositionParams[], logger: Logger) => Promise<Position[]>;
@@ -0,0 +1,5 @@
1
+ import { LatestPosition } from '../../entities';
2
+ import { NovaDataSource } from '../../novaDataSource';
3
+ import { Logger } from '../../types/logger';
4
+ import { GetLatestPositionByImeiParams } from '../../types/position';
5
+ export declare const getLatestPositionByImei: (novaDataSource: NovaDataSource, params: GetLatestPositionByImeiParams, logger: Logger) => Promise<LatestPosition>;
@@ -1,6 +1,5 @@
1
- import { InsertResult } from 'typeorm';
2
- import { Position } from '../../entities';
3
- import { CreatePositionParams, GetPositionsByImeiParams, GetPositionsReportByClientParams, PositionReport } from '../../types/position';
1
+ import { LatestPosition, Position } from '../../entities';
2
+ import { CreatePositionParams, GetLatestPositionByImeiParams, GetPositionsByImeiParams, GetPositionsReportByClientParams, PositionReport } from '../../types/position';
4
3
  import { BaseRepository } from '../baseRepository';
5
4
  export declare class PositionRepository extends BaseRepository {
6
5
  /**
@@ -39,8 +38,9 @@ export declare class PositionRepository extends BaseRepository {
39
38
  * - sendTime: the time the message was sent
40
39
  * - gpsUtcTime: the time the gps was set
41
40
  * - externalBatteryPercentage: the external battery percentage reported by the device
41
+ * @returns {Position[]} the created positions
42
42
  */
43
- upsertPositions(params: CreatePositionParams[]): Promise<InsertResult>;
43
+ upsertPositions(params: CreatePositionParams[]): Promise<Position[]>;
44
44
  /**
45
45
  * Get positions by imei
46
46
  * @param {GetPositionsByImeiParams} params containing information to get positions
@@ -56,8 +56,13 @@ export declare class PositionRepository extends BaseRepository {
56
56
  * - filters.actualDateTo: filters by actual date to to get positions
57
57
  * - filters.speedMin: filters by speed min to get positions
58
58
  * - filters.speedMax: filters by speed max to get positions
59
- * - pageSize: the page size
60
- * - pageIndex: the page index
59
+ * - filters.odometerMin: filters by odometer min to get positions
60
+ * - filters.odometerMax: filters by odometer max to get positions
61
+ * - pagingOptions.pageSize: the page size
62
+ * - pagingOptions.pageIndex: the page index
63
+ * - sortOptions.sortField: the sort field
64
+ * - sortOptions.sortOrder: the sort order
61
65
  */
62
66
  getPositionsReportByClient(params: GetPositionsReportByClientParams): Promise<PositionReport[]>;
67
+ getLatestPositionByImei(params: GetLatestPositionByImeiParams): Promise<LatestPosition>;
63
68
  }
@@ -0,0 +1,3 @@
1
+ import { Position } from '../../entities';
2
+ import { NovaDataSource } from '../../novaDataSource';
3
+ export declare const upsertLatestPosition: (novaDataSource: NovaDataSource, position: Position) => Promise<boolean>;
@@ -22,7 +22,7 @@ export interface CreateAlertParams {
22
22
  export interface ReportPagination {
23
23
  pagingOptions: {
24
24
  pageSize: number | 25;
25
- pageIndex: number | 1;
25
+ pageIndex: number | 0;
26
26
  };
27
27
  sortOptions?: {
28
28
  sortField: string;
@@ -29,10 +29,16 @@ export interface GetPositionsReportByClientParams {
29
29
  actualDateTo?: Date | null;
30
30
  speedMin?: number | null;
31
31
  speedMax?: number | null;
32
+ odometerMin?: number | null;
33
+ odometerMax?: number | null;
32
34
  };
33
35
  pagingOptions: {
34
36
  pageSize: number | 25;
35
- pageIndex: number | 1;
37
+ pageIndex: number | 0;
38
+ };
39
+ sortOptions?: {
40
+ sortField: string;
41
+ sortOrder: 'ASC' | 'DESC';
36
42
  };
37
43
  }
38
44
  export interface PositionReport {
@@ -49,3 +55,8 @@ export interface PositionReport {
49
55
  externalBatteryPercentage: number;
50
56
  totalCount: number;
51
57
  }
58
+ export interface GetLatestPositionByImeiParams {
59
+ filters: {
60
+ imei: string;
61
+ };
62
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spytecgps/nova-orm",
3
- "version": "0.0.82",
3
+ "version": "0.0.84",
4
4
  "description": "ORM with PlanetScale",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",