@spytecgps/nova-orm 0.0.57 → 0.0.59

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.
@@ -0,0 +1,5 @@
1
+ import { UserDeviceBehaviorTask } from '../../entities';
2
+ import { NovaDataSource } from '../../novaDataSource';
3
+ import { CreateDeviceBehaviorTaskParams } from '../../types/deviceBehaviors';
4
+ import { Logger } from '../../types/logger';
5
+ export declare const createDeviceBehaviorTask: (novaDataSource: NovaDataSource, params: CreateDeviceBehaviorTaskParams, logger: Logger) => Promise<UserDeviceBehaviorTask>;
@@ -0,0 +1,5 @@
1
+ import { UserDeviceBehaviorTask } from '../../entities';
2
+ import { NovaDataSource } from '../../novaDataSource';
3
+ import { GetDeviceBehaviorTasksParams } from '../../types/deviceBehaviors';
4
+ import { Logger } from '../../types/logger';
5
+ export declare const getDeviceBehaviorTasks: (novaDataSource: NovaDataSource, params: GetDeviceBehaviorTasksParams, logger: Logger) => Promise<UserDeviceBehaviorTask[]>;
@@ -0,0 +1,5 @@
1
+ import { DeviceBehavior } from '../../entities';
2
+ import { NovaDataSource } from '../../novaDataSource';
3
+ import { GetDeviceBehaviorsParams } from '../../types/deviceBehaviors';
4
+ import { Logger } from '../../types/logger';
5
+ export declare const getDeviceBehaviors: (novaDataSource: NovaDataSource, params: GetDeviceBehaviorsParams, logger: Logger) => Promise<DeviceBehavior[]>;
@@ -0,0 +1,5 @@
1
+ import { DeviceBehavior } from '../../entities';
2
+ import { NovaDataSource } from '../../novaDataSource';
3
+ import { GetDeviceBehaviorsByIdsParams } from '../../types/deviceBehaviors';
4
+ import { Logger } from '../../types/logger';
5
+ export declare const getDeviceBehaviorsByIds: (novaDataSource: NovaDataSource, params: GetDeviceBehaviorsByIdsParams, logger: Logger) => Promise<DeviceBehavior[]>;
@@ -0,0 +1,4 @@
1
+ import { NovaDataSource } from '../../novaDataSource';
2
+ import { GetLatestDeviceBehaviorTasksParams, GetLatestDeviceBehaviorTasksResult } from '../../types/deviceBehaviors';
3
+ import { Logger } from '../../types/logger';
4
+ export declare const getLatestDeviceBehaviorTasks: (novaDataSource: NovaDataSource, params: GetLatestDeviceBehaviorTasksParams, logger: Logger) => Promise<GetLatestDeviceBehaviorTasksResult[]>;
@@ -0,0 +1,72 @@
1
+ import { DeviceBehavior, UserDeviceBehaviorTask } from '../../entities';
2
+ import { CreateDeviceBehaviorTaskParams, GetDeviceBehaviorsByIdsParams, GetDeviceBehaviorsParams, GetDeviceBehaviorTasksParams, GetLatestDeviceBehaviorTasksParams, GetLatestDeviceBehaviorTasksResult, UpdateDeviceBehaviorTaskParams } from '../../types/deviceBehaviors';
3
+ import { BaseRepository } from '../baseRepository';
4
+ export declare class DeviceBehaviorsRepository extends BaseRepository {
5
+ /**
6
+ * Get user rating requests
7
+ * @param {GetDeviceBehaviorsParams} params containing information to get device behaviors
8
+ * - filters.status: The status
9
+ * - filters.imeiList: The imei list
10
+ * - filters.deviceTypeIdList: The device type id list
11
+ * - filters.stage: The stage
12
+ * - filters.clientId: The client id, optional
13
+ * - filters.type: The type, optional
14
+ * @returns The device behaviors list
15
+ */
16
+ getDeviceBehaviors(params: GetDeviceBehaviorsParams): Promise<DeviceBehavior[]>;
17
+ /**
18
+ * Get device behaviors by ids
19
+ * @params {GetDeviceBehaviorsByIdsParams} params containing information to get device behaviors by ids
20
+ * - filters.deviceBehaviorIdList: The device behavior id list, required
21
+ * @returns The device behaviors list
22
+ */
23
+ getDeviceBehaviorsByIds(params: GetDeviceBehaviorsByIdsParams): Promise<DeviceBehavior[]>;
24
+ /**
25
+ * Get device behavior tasks
26
+ * @param {GetDeviceBehaviorTasksParams} params containing information to get device behavior tasks
27
+ * Filters (One of taskId or imeiList is required):
28
+ * - filters.taskId: The task id
29
+ * - filters.imeiList: The imei list
30
+ * - filters.status: The status, optional
31
+ * - filters.deviceBehaviorIdList: The device behavior id list, optional
32
+ * Paging options:
33
+ * - pagingOptions.offset: The offset, optional. Default is 0
34
+ * - pagingOptions.limit: The limit, optional. Default is 100
35
+ * @returns The device behavior tasks list
36
+ */
37
+ getDeviceBehaviorTasks(params: GetDeviceBehaviorTasksParams): Promise<UserDeviceBehaviorTask[]>;
38
+ /**
39
+ * Create device behavior task
40
+ * @param {CreateDeviceBehaviorTaskParams} params containing information to create a device behavior task
41
+ * - params.taskId: The task id
42
+ * - params.deviceBehaviorId: The device behavior id
43
+ * - params.clientId: The client id
44
+ * - params.userId: The user id
45
+ * - params.imei: The imei
46
+ * - params.behaviorName: The behavior name
47
+ * - params.behaviorParams: The behavior params, optional
48
+ * - params.status: The status
49
+ * - params.extraParams: The extra params, optional
50
+ * @returns The device behavior task
51
+ */
52
+ createDeviceBehaviorTask(params: CreateDeviceBehaviorTaskParams): Promise<UserDeviceBehaviorTask>;
53
+ /**
54
+ * Update device behavior task
55
+ * @param {UpdateDeviceBehaviorTaskParams} params containing information to update a device behavior task
56
+ * Filters:
57
+ * - params.filters.taskId: The task id
58
+ * Values:
59
+ * - params.values.status: The status
60
+ * @returns Whether the device behavior task was updated
61
+ */
62
+ updateDeviceBehaviorTask(params: UpdateDeviceBehaviorTaskParams): Promise<boolean>;
63
+ /**
64
+ * Get latest device behavior tasks
65
+ * @param {GetLatestDeviceBehaviorTasksParams} params containing information to get latest device behavior tasks
66
+ * - params.filters.clientId: The client id
67
+ * - params.filters.type: The device behavior type
68
+ * - params.filters.status: The task status
69
+ * @returns The latest device behavior tasks list
70
+ */
71
+ getLatestDeviceBehaviorTasks(params: GetLatestDeviceBehaviorTasksParams): Promise<GetLatestDeviceBehaviorTasksResult[]>;
72
+ }
@@ -0,0 +1,4 @@
1
+ import { NovaDataSource } from '../../novaDataSource';
2
+ import { UpdateDeviceBehaviorTaskParams } from '../../types/deviceBehaviors';
3
+ import { Logger } from '../../types/logger';
4
+ export declare const updateDeviceBehaviorTask: (novaDataSource: NovaDataSource, params: UpdateDeviceBehaviorTaskParams, logger: Logger) => Promise<boolean>;
@@ -2,6 +2,7 @@ import { AlertRepository } from './alerts';
2
2
  import { BoundariesRepository } from './boundaries';
3
3
  import { ClientsRepository } from './clients';
4
4
  import { CountriesRepository } from './countries';
5
+ import { DeviceBehaviorsRepository } from './deviceBehaviors';
5
6
  import { DevicesRepository } from './devices';
6
7
  import { FirmwaresRepository } from './firmwares';
7
8
  import { PositionRepository } from './positions';
@@ -10,4 +11,4 @@ import { UserDataDeletionRequestsRepository } from './userDataDeletionRequests';
10
11
  import { UserInvitationsRepository } from './userInvitations';
11
12
  import { UserRatingRequestsRepository } from './userRatingRequests';
12
13
  import { UsersRepository } from './users';
13
- export { SecurityRepository, DevicesRepository, BoundariesRepository, ClientsRepository, FirmwaresRepository, PositionRepository, AlertRepository, UsersRepository, CountriesRepository, UserInvitationsRepository, UserDataDeletionRequestsRepository, UserRatingRequestsRepository, };
14
+ export { SecurityRepository, DevicesRepository, BoundariesRepository, ClientsRepository, FirmwaresRepository, PositionRepository, AlertRepository, UsersRepository, CountriesRepository, UserInvitationsRepository, UserDataDeletionRequestsRepository, UserRatingRequestsRepository, DeviceBehaviorsRepository, };
@@ -1,11 +1,11 @@
1
1
  export interface GetCountryParams {
2
2
  filters: {
3
- id?: string;
3
+ id?: number;
4
4
  alpha2Code?: string;
5
5
  };
6
6
  }
7
7
  export interface GetCountriesParams {
8
8
  filters: {
9
- idList?: string;
9
+ idList?: number[];
10
10
  };
11
11
  }
@@ -0,0 +1,61 @@
1
+ import { DeviceBehaviorStatus, DeviceBehaviorTaskStatus, DeviceBehaviorType } from './enums';
2
+ export interface GetDeviceBehaviorsParams {
3
+ filters: {
4
+ status: DeviceBehaviorStatus;
5
+ imeiList: string[];
6
+ deviceTypeIdList: number[];
7
+ stage: string;
8
+ clientId?: number;
9
+ type?: DeviceBehaviorType;
10
+ };
11
+ }
12
+ export interface GetDeviceBehaviorsByIdsParams {
13
+ filters: {
14
+ deviceBehaviorIdList: number[];
15
+ };
16
+ }
17
+ export interface GetDeviceBehaviorTasksParams {
18
+ filters: {
19
+ taskId?: string;
20
+ imeiList?: string[];
21
+ status?: DeviceBehaviorTaskStatus;
22
+ deviceBehaviorIdList?: number[];
23
+ };
24
+ pagingOptions?: {
25
+ limit?: number;
26
+ offset?: number;
27
+ };
28
+ }
29
+ export interface CreateDeviceBehaviorTaskParams {
30
+ taskId: string;
31
+ deviceBehaviorId: number;
32
+ clientId: number;
33
+ userId: string;
34
+ imei: string;
35
+ behaviorName: string;
36
+ behaviorParams?: object;
37
+ status: DeviceBehaviorTaskStatus;
38
+ extraParams?: object;
39
+ }
40
+ export interface UpdateDeviceBehaviorTaskParams {
41
+ filters: {
42
+ taskId: string;
43
+ };
44
+ values: {
45
+ status: DeviceBehaviorTaskStatus;
46
+ };
47
+ }
48
+ export interface GetLatestDeviceBehaviorTasksParams {
49
+ filters: {
50
+ clientId: number;
51
+ type: DeviceBehaviorType;
52
+ status: DeviceBehaviorTaskStatus;
53
+ };
54
+ }
55
+ export interface GetLatestDeviceBehaviorTasksResult {
56
+ imei: string;
57
+ name: string;
58
+ description: string;
59
+ taskId: string;
60
+ modifiedAt: Date;
61
+ }
@@ -17,3 +17,19 @@ export declare enum HapnClientType {
17
17
  b2b = 2,
18
18
  test = 3
19
19
  }
20
+ export declare enum DeviceBehaviorType {
21
+ ReportingFrequency = "ReportingFrequency",
22
+ Advanced = "Advanced",
23
+ Query = "Query",
24
+ General = "General"
25
+ }
26
+ export declare enum DeviceBehaviorStatus {
27
+ Active = "active",
28
+ Inactive = "inactive"
29
+ }
30
+ export declare enum DeviceBehaviorTaskStatus {
31
+ InProgress = "InProgress",
32
+ Completed = "Completed",
33
+ Canceled = "Canceled",
34
+ Failed = "Failed"
35
+ }
@@ -1,5 +1,6 @@
1
1
  import * as Boundaries from './boundaries';
2
2
  import * as Clients from './clients';
3
+ import * as DeviceBehaviors from './deviceBehaviors';
3
4
  import * as Devices from './devices';
4
5
  import * as Firmwares from './firmwares';
5
6
  import * as Logger from './logger';
@@ -8,4 +9,4 @@ import * as Users from './user';
8
9
  import * as UserDataDeletionRequests from './userDataDeletionRequests';
9
10
  import * as UserInvitations from './userInvitations';
10
11
  import * as UserRatingRequests from './userRatingRequests';
11
- export { Logger, Devices, Firmwares, Security, Boundaries, Clients, Users, UserInvitations, UserDataDeletionRequests, UserRatingRequests, };
12
+ export { Logger, Devices, Firmwares, Security, Boundaries, Clients, Users, UserInvitations, UserDataDeletionRequests, UserRatingRequests, DeviceBehaviors, };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spytecgps/nova-orm",
3
- "version": "0.0.57",
3
+ "version": "0.0.59",
4
4
  "description": "ORM with PlanetScale",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",