@spytecgps/nova-orm 0.0.83 → 0.0.85

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
@@ -64,4 +64,5 @@ export declare class PositionRepository extends BaseRepository {
64
64
  * - sortOptions.sortOrder: the sort order
65
65
  */
66
66
  getPositionsReportByClient(params: GetPositionsReportByClientParams): Promise<PositionReport[]>;
67
+ getLatestPositionByImei(params: GetLatestPositionByImeiParams): Promise<LatestPosition>;
67
68
  }
@@ -0,0 +1,4 @@
1
+ import { Position } from '../../entities';
2
+ import { NovaDataSource } from '../../novaDataSource';
3
+ import { Logger } from '../../types/logger';
4
+ export declare const upsertLatestPosition: (novaDataSource: NovaDataSource, position: Position, logger: Logger) => Promise<boolean>;
@@ -55,3 +55,8 @@ export interface PositionReport {
55
55
  externalBatteryPercentage: number;
56
56
  totalCount: number;
57
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.83",
3
+ "version": "0.0.85",
4
4
  "description": "ORM with PlanetScale",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",