@spytecgps/nova-orm 0.0.16 → 0.0.18

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 { Geofence } from '../../entities';
2
+ import { NovaDataSource } from '../../novaDataSource';
3
+ import { CreateBoundaryParams } from '../../types/boundaries';
4
+ import { Logger } from '../../types/logger';
5
+ export declare const createBoundary: (novaDataSource: NovaDataSource, params: CreateBoundaryParams, logger: Logger) => Promise<Geofence>;
@@ -0,0 +1,4 @@
1
+ import { NovaDataSource } from '../../novaDataSource';
2
+ import { DeleteBoundaryParams } from '../../types/boundaries';
3
+ import { Logger } from '../../types/logger';
4
+ export declare const deleteBoundary: (novaDataSource: NovaDataSource, params: DeleteBoundaryParams, logger: Logger) => Promise<boolean>;
@@ -0,0 +1,5 @@
1
+ import { Geofence } from '../../entities';
2
+ import { NovaDataSource } from '../../novaDataSource';
3
+ import { GetBoundariesByClientIdParams } from '../../types/boundaries';
4
+ import { Logger } from '../../types/logger';
5
+ export declare const getBoundariesByClientId: (novaDataSource: NovaDataSource, params: GetBoundariesByClientIdParams, logger: Logger) => Promise<Geofence[]>;
@@ -0,0 +1,4 @@
1
+ import { NovaDataSource } from '../../novaDataSource';
2
+ import { GetBoundariesByClientIdParams } from '../../types/boundaries';
3
+ import { Logger } from '../../types/logger';
4
+ export declare const getBoundariesIdsByClientId: (novaDataSource: NovaDataSource, params: GetBoundariesByClientIdParams, logger: Logger) => Promise<number[]>;
@@ -0,0 +1,5 @@
1
+ import { Geofence } from '../../entities';
2
+ import { NovaDataSource } from '../../novaDataSource';
3
+ import { GetBoundaryByIdParams } from '../../types/boundaries';
4
+ import { Logger } from '../../types/logger';
5
+ export declare const getBoundaryById: (novaDataSource: NovaDataSource, params: GetBoundaryByIdParams, logger: Logger) => Promise<Geofence>;
@@ -0,0 +1,67 @@
1
+ import { Geofence } from '../../entities';
2
+ import { CreateBoundaryParams, DeleteBoundaryParams, GetBoundariesByClientIdParams, GetBoundaryByIdParams, UpdateBoundaryParams } from '../../types/boundaries';
3
+ import { BaseRepository } from '../baseRepository';
4
+ export declare class BoundariesRepository extends BaseRepository {
5
+ /**
6
+ * Get all boundaries by client id
7
+ * @param {GetBoundariesByClientIdParams} params containing information to get boundaries by clientId
8
+ * - filters.clientId: The client id
9
+ * - filters.status: The status to only obtain boundaries with that status, optional
10
+ */
11
+ getBoundariesByClientId(params: GetBoundariesByClientIdParams): Promise<Geofence[]>;
12
+ /**
13
+ * Get all boundaries ids by client id
14
+ * @param {GetBoundariesByClientIdParams} params containing information to get boundaries ids by clientId
15
+ * - filters.clientId: The client id
16
+ * - filters.status: The status to only obtain boundaries with that status, optional
17
+ */
18
+ getBoundariesIdsByClientId(params: GetBoundariesByClientIdParams): Promise<number[]>;
19
+ /**
20
+ * Get a boundary by id
21
+ * @param {GetBoundaryByIdParams} params containing information to get a boundary by id
22
+ * - filters.boundaryId: The boundary id
23
+ */
24
+ getBoundaryById(params: GetBoundaryByIdParams): Promise<Geofence>;
25
+ /**
26
+ * Create a boundary
27
+ * @param {CreateBoundaryParams} params containing information to create a boundary
28
+ * - name: boundary name
29
+ * - type: boundary type
30
+ * - clientId: id of the client that owns the boundary
31
+ * - createdBy: id of the user that created the boundary
32
+ * - location: location of the boundary
33
+ * - buffer: buffer of the boundary
34
+ * - radiusDisplayUnit: radius display unit of the boundary
35
+ * - color: color of the boundary
36
+ * - geometry: geometry of the boundary
37
+ * - status: status of the boundary
38
+ * - dataSourceTypeId: data source type id of the boundary, optional
39
+ * - isUserCreated: if the boundary was created by a user, optional
40
+ * - area: area of the boundary, optional
41
+ */
42
+ createBoundary(params: CreateBoundaryParams): Promise<Geofence>;
43
+ /**
44
+ * Update a boundary
45
+ * @param {UpdateBoundaryParams} params containing information to update a boundary
46
+ * - filters.boundaryId: The id of the boundary to update
47
+ * - values.name: The name of the boundary. Optional, if undefined, the name will not be updated.
48
+ * - values.type: The type of the boundary. Optional, if undefined, the type will not be updated.
49
+ * - values.modifiedBy: The user id of the user that modified the boundary. Optional, if undefined, the modifiedBy will not be updated.
50
+ * - values.location: The location of the boundary. Optional, if undefined, the location will not be updated.
51
+ * - values.geometry: The geometry of the boundary. Optional, if undefined, the geometry will not be updated.
52
+ * - values.status: The status of the boundary. Optional, if undefined, the status will not be updated.
53
+ * - values.buffer: The buffer of the boundary. Optional, if undefined, the buffer will not be updated.
54
+ * - values.radiusDisplayUnit: The radius display unit of the boundary. Optional, if undefined, the radius display unit will not be updated.
55
+ * - values.color: The color of the boundary. Optional, if undefined, the color will not be updated.
56
+ * - values.area: The area of the boundary. Optional, if undefined, the area will not be updated.
57
+ */
58
+ updateBoundary(params: UpdateBoundaryParams): Promise<boolean>;
59
+ /**
60
+ * Delete a boundary
61
+ * @param {DeleteBoundaryParams} params containing information to delete a boundary
62
+ * The boundary will not be removed from the database, it will only be marked as deleted
63
+ * - filters.boundaryId: The id of the boundary to delete
64
+ * - values.modifiedBy: The user id of the user that deleted the boundary
65
+ */
66
+ deleteBoundary(params: DeleteBoundaryParams): Promise<boolean>;
67
+ }
@@ -0,0 +1,4 @@
1
+ import { NovaDataSource } from '../../novaDataSource';
2
+ import { UpdateBoundaryParams } from '../../types/boundaries';
3
+ import { Logger } from '../../types/logger';
4
+ export declare const updateBoundary: (novaDataSource: NovaDataSource, params: UpdateBoundaryParams, logger: Logger) => Promise<boolean>;
@@ -1,3 +1,4 @@
1
+ import { BoundariesRepository } from './boundaries';
1
2
  import { DevicesRepository } from './devices';
2
3
  import { SecurityRepository } from './security';
3
- export { SecurityRepository, DevicesRepository };
4
+ export { SecurityRepository, DevicesRepository, BoundariesRepository };
@@ -0,0 +1,56 @@
1
+ import { BoundaryStatus } from './enums';
2
+ export interface GetBoundariesByClientIdParams {
3
+ filters: {
4
+ clientId: number;
5
+ status?: BoundaryStatus;
6
+ };
7
+ }
8
+ export interface GetBoundaryByIdParams {
9
+ filters: {
10
+ boundaryId: number;
11
+ };
12
+ }
13
+ export interface CreateBoundaryParams {
14
+ name: string;
15
+ type: string;
16
+ clientId: number;
17
+ createdBy: string;
18
+ location: string;
19
+ buffer: string;
20
+ radiusDisplayUnit: string;
21
+ color: string;
22
+ geometry: string;
23
+ status: BoundaryStatus;
24
+ dataSourceTypeId?: number;
25
+ isUserCreated?: boolean;
26
+ area?: number;
27
+ centerLat?: number;
28
+ centerLon?: number;
29
+ }
30
+ export interface UpdateBoundaryParams {
31
+ filters: {
32
+ boundaryId: number;
33
+ };
34
+ values: {
35
+ name?: string;
36
+ type?: string;
37
+ modifiedBy?: string;
38
+ location?: string;
39
+ buffer?: string;
40
+ radiusDisplayUnit?: string;
41
+ color?: string;
42
+ geometry?: string;
43
+ status?: BoundaryStatus;
44
+ area?: number;
45
+ centerLat?: number;
46
+ centerLon?: number;
47
+ };
48
+ }
49
+ export interface DeleteBoundaryParams {
50
+ filters: {
51
+ boundaryId: number;
52
+ };
53
+ values: {
54
+ modifiedBy: string;
55
+ };
56
+ }
@@ -7,3 +7,8 @@ export declare enum DeviceStatus {
7
7
  Active = "A",
8
8
  Deleted = "D"
9
9
  }
10
+ export declare enum BoundaryStatus {
11
+ Active = 1,
12
+ Inactive = 2,
13
+ Deleted = 3
14
+ }
@@ -1,4 +1,5 @@
1
+ import * as Boundaries from './boundaries';
1
2
  import * as Devices from './devices';
2
3
  import * as Logger from './logger';
3
4
  import * as Security from './security';
4
- export { Logger, Devices, Security };
5
+ export { Logger, Devices, Security, Boundaries };
@@ -1 +1,2 @@
1
1
  export declare const uuidStringToBinaryBuffer: (uuidString: string) => Buffer;
2
+ export declare const binaryBufferToUuidString: (buffer: Buffer) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spytecgps/nova-orm",
3
- "version": "0.0.16",
3
+ "version": "0.0.18",
4
4
  "description": "ORM with PlanetScale",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",