@spytecgps/nova-orm 0.0.67 → 0.0.69

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.
@@ -7,6 +7,7 @@ import { CountriesRepository } from './countries';
7
7
  import { DeviceBehaviorsRepository } from './deviceBehaviors';
8
8
  import { DevicesRepository } from './devices';
9
9
  import { FirmwaresRepository } from './firmwares';
10
+ import { NotificationRecipientsRepository } from './notificationRecipients';
10
11
  import { PositionRepository } from './positions';
11
12
  import { SecurityRepository } from './security';
12
13
  import { UserActivationsRepository } from './userActivations';
@@ -15,4 +16,4 @@ import { UserDataDeletionRequestsRepository } from './userDataDeletionRequests';
15
16
  import { UserInvitationsRepository } from './userInvitations';
16
17
  import { UserRatingRequestsRepository } from './userRatingRequests';
17
18
  import { UsersRepository } from './users';
18
- export { AlertRepository, AlertTypesRepository, AssetCategoriesRepository, BoundariesRepository, ClientsRepository, CountriesRepository, DeviceBehaviorsRepository, DevicesRepository, FirmwaresRepository, PositionRepository, SecurityRepository, UserActivationsRepository, UserConfigurationsRepository, UserDataDeletionRequestsRepository, UserInvitationsRepository, UserRatingRequestsRepository, UsersRepository, };
19
+ export { AlertRepository, AlertTypesRepository, AssetCategoriesRepository, BoundariesRepository, ClientsRepository, CountriesRepository, DeviceBehaviorsRepository, DevicesRepository, FirmwaresRepository, NotificationRecipientsRepository, PositionRepository, SecurityRepository, UserActivationsRepository, UserConfigurationsRepository, UserDataDeletionRequestsRepository, UserInvitationsRepository, UserRatingRequestsRepository, UsersRepository, };
@@ -0,0 +1,5 @@
1
+ import { NotificationRecipient } from '../../entities';
2
+ import { NovaDataSource } from '../../novaDataSource';
3
+ import { Logger } from '../../types/logger';
4
+ import { CreateNotificationRecipientParams } from '../../types/notificationRecipients';
5
+ export declare const createNotificationRecipient: (novaDataSource: NovaDataSource, params: CreateNotificationRecipientParams, logger: Logger) => Promise<NotificationRecipient>;
@@ -0,0 +1,4 @@
1
+ import { NovaDataSource } from '../../novaDataSource';
2
+ import { Logger } from '../../types/logger';
3
+ import { DeleteNotificationRecipientsParams } from '../../types/notificationRecipients';
4
+ export declare const deleteNotificationRecipients: (novaDataSource: NovaDataSource, params: DeleteNotificationRecipientsParams, logger: Logger) => Promise<boolean>;
@@ -0,0 +1,4 @@
1
+ import { NovaDataSource } from '../../novaDataSource';
2
+ import { Logger } from '../../types/logger';
3
+ import { DeleteNotificationRecipientsByEmailOrPhoneParams } from '../../types/notificationRecipients';
4
+ export declare const deleteNotificationRecipientsByEmailOrPhone: (novaDataSource: NovaDataSource, params: DeleteNotificationRecipientsByEmailOrPhoneParams, logger: Logger) => Promise<boolean>;
@@ -0,0 +1,5 @@
1
+ import { NotificationRecipient } from '../../entities';
2
+ import { NovaDataSource } from '../../novaDataSource';
3
+ import { Logger } from '../../types/logger';
4
+ import { GetNotificationRecipientsParams } from '../../types/notificationRecipients';
5
+ export declare const getNotificationRecipients: (novaDataSource: NovaDataSource, params: GetNotificationRecipientsParams, logger: Logger) => Promise<NotificationRecipient[]>;
@@ -0,0 +1,70 @@
1
+ import { NotificationRecipient } from '../../entities';
2
+ import { CreateNotificationRecipientParams, DeleteNotificationRecipientsByEmailOrPhoneParams, DeleteNotificationRecipientsParams, GetNotificationRecipientsParams, UpdateNotificationRecipientParams, UpdateUsersNotificationsUnsuscribedStatusParams } from '../../types/notificationRecipients';
3
+ import { BaseRepository } from '../baseRepository';
4
+ export declare class NotificationRecipientsRepository extends BaseRepository {
5
+ /**
6
+ * Create notification recipient
7
+ * @param {CreateNotificationRecipientParams} params containing information to create a notification recipient
8
+ * - params.id: The notification recipient id, optional. If not provided, a new id will be generated
9
+ * - params.clientId: The client id
10
+ * - params.userId: The user id
11
+ * - params.notificationType: The notification type
12
+ * - params.recipient: The recipient
13
+ * - params.isEnabled: The is enabled flag
14
+ * - params.isUserProfile: The is user profile flag
15
+ * - params.unsubscribed: The unsubscribed flag
16
+ * - params.dataSourceTypeId: The data source type id, optional
17
+ * @returns The notification recipient information
18
+ */
19
+ createNotificationRecipient(params: CreateNotificationRecipientParams): Promise<NotificationRecipient>;
20
+ /**
21
+ * Get notification recipients with filters
22
+ * @param {GetNotificationRecipientsParams} params containing information to get notification recipients with filters
23
+ * - filters.clientId: The client id to obtain all notification recipients from that client
24
+ * @returns The notification recipients information
25
+ */
26
+ getNotificationRecipients(params: GetNotificationRecipientsParams): Promise<NotificationRecipient[]>;
27
+ /**
28
+ * Update notification recipient
29
+ * @param {UpdateNotificationRecipientParams} params containing information to update a notification recipient
30
+ * - params.filters.id: The notification recipient id
31
+ * At least one of the following fields is required:
32
+ * - params.values.notificationType: The notification type, optional
33
+ * - params.values.recipient: The recipient, optional
34
+ * - params.values.isEnabled: The is enabled flag, optional
35
+ * - params.values.isUserProfile: The is user profile flag, optional
36
+ * - params.values.unsubscribed: The unsubscribed flag, optional
37
+ * @returns Whether the notification recipient was updated or not
38
+ */
39
+ updateNotificationRecipient(params: UpdateNotificationRecipientParams): Promise<boolean>;
40
+ /**
41
+ * Update users notifications unsubscribed status
42
+ * @param {UpdateUsersNotificationsUnsuscribedStatusParams} params containing information to update users notifications unsubscribed status
43
+ * - params.filters: Using these filters, the query will update the users notifications unsubscribed
44
+ * status for all users with the corresponding phone number.
45
+ * The user country code will be used to remove the country code from the phone number before comparing it with the user phone number.
46
+ * - params.filters.userPhone: The user phone
47
+ * - params.filters.userCountryCode: The user country code
48
+ * - params.values.unsubscribed: The unsubscribed flag, optional
49
+ * @returns Whether the users notifications unsubscribed status was updated or not
50
+ */
51
+ updateUsersNotificationsUnsuscribedStatus(params: UpdateUsersNotificationsUnsuscribedStatusParams): Promise<boolean>;
52
+ /**
53
+ * Delete notification recipients
54
+ * @param {DeleteNotificationRecipientsParams} params containing information to delete notification recipients
55
+ * At least one of the following fields is required:
56
+ * - params.filters.id: The notification recipient id, optional
57
+ * - params.filters.userId: The user id, optional
58
+ * @returns Whether the notification recipients were deleted or not
59
+ */
60
+ deleteNotificationRecipients(params: DeleteNotificationRecipientsParams): Promise<boolean>;
61
+ /**
62
+ * Delete notification recipients by email or phone
63
+ * @param {DeleteNotificationRecipientsByEmailOrPhoneParams} params containing information to delete notification recipients by email or phone
64
+ * - params.filters.clientId: The client id
65
+ * - params.filters.notificationType: The notification type
66
+ * - params.filters.recipient: The recipient
67
+ * @returns Whether the notification recipients were deleted or not
68
+ */
69
+ deleteNotificationRecipientsByEmailOrPhone(params: DeleteNotificationRecipientsByEmailOrPhoneParams): Promise<boolean>;
70
+ }
@@ -0,0 +1,4 @@
1
+ import { NovaDataSource } from '../../novaDataSource';
2
+ import { Logger } from '../../types/logger';
3
+ import { UpdateNotificationRecipientParams } from '../../types/notificationRecipients';
4
+ export declare const updateNotificationRecipient: (novaDataSource: NovaDataSource, params: UpdateNotificationRecipientParams, logger: Logger) => Promise<boolean>;
@@ -0,0 +1,4 @@
1
+ import { NovaDataSource } from '../../novaDataSource';
2
+ import { Logger } from '../../types/logger';
3
+ import { UpdateUsersNotificationsUnsuscribedStatusParams } from '../../types/notificationRecipients';
4
+ export declare const updateUsersNotificationsUnsuscribedStatus: (novaDataSource: NovaDataSource, params: UpdateUsersNotificationsUnsuscribedStatusParams, logger: Logger) => Promise<boolean>;
@@ -33,3 +33,7 @@ export declare enum DeviceBehaviorTaskStatus {
33
33
  Canceled = "Canceled",
34
34
  Failed = "Failed"
35
35
  }
36
+ export declare enum NotificationRecipientType {
37
+ Email = 1,
38
+ Phone = 2
39
+ }
@@ -7,6 +7,7 @@ import * as DeviceBehaviors from './deviceBehaviors';
7
7
  import * as Devices from './devices';
8
8
  import * as Firmwares from './firmwares';
9
9
  import * as Logger from './logger';
10
+ import * as NotificationRecipients from './notificationRecipients';
10
11
  import * as Positions from './position';
11
12
  import * as Security from './security';
12
13
  import * as Users from './user';
@@ -15,4 +16,4 @@ import * as UserConfigurations from './userConfigurations';
15
16
  import * as UserDataDeletionRequests from './userDataDeletionRequests';
16
17
  import * as UserInvitations from './userInvitations';
17
18
  import * as UserRatingRequests from './userRatingRequests';
18
- export { Alerts, AlertTypes, Boundaries, Clients, Countries, DeviceBehaviors, Devices, Firmwares, Logger, Positions, Security, Users, UserActivations, UserConfigurations, UserDataDeletionRequests, UserInvitations, UserRatingRequests, };
19
+ export { Alerts, AlertTypes, Boundaries, Clients, Countries, DeviceBehaviors, Devices, Firmwares, Logger, NotificationRecipients, Positions, Security, Users, UserActivations, UserConfigurations, UserDataDeletionRequests, UserInvitations, UserRatingRequests, };
@@ -0,0 +1,51 @@
1
+ import { NotificationRecipientType } from './enums';
2
+ export interface GetNotificationRecipientsParams {
3
+ filters: {
4
+ clientId: number;
5
+ };
6
+ }
7
+ export interface CreateNotificationRecipientParams {
8
+ id?: number;
9
+ clientId: number;
10
+ notificationType: NotificationRecipientType;
11
+ recipient: string;
12
+ isEnabled: boolean;
13
+ isUserProfile: boolean;
14
+ unsubscribed: boolean;
15
+ userId: string;
16
+ dataSourceTypeId?: number;
17
+ }
18
+ export interface UpdateNotificationRecipientParams {
19
+ filters: {
20
+ id: number;
21
+ };
22
+ values: {
23
+ notificationType?: NotificationRecipientType;
24
+ recipient?: string;
25
+ isEnabled?: boolean;
26
+ isUserProfile?: boolean;
27
+ unsubscribed?: boolean;
28
+ };
29
+ }
30
+ export interface UpdateUsersNotificationsUnsuscribedStatusParams {
31
+ filters: {
32
+ userPhone: string;
33
+ userCountryCode: string;
34
+ };
35
+ values: {
36
+ unsubscribed?: boolean;
37
+ };
38
+ }
39
+ export interface DeleteNotificationRecipientsParams {
40
+ filters: {
41
+ id?: number;
42
+ userId?: string;
43
+ };
44
+ }
45
+ export interface DeleteNotificationRecipientsByEmailOrPhoneParams {
46
+ filters: {
47
+ clientId: number;
48
+ recipient: string;
49
+ notificationType: NotificationRecipientType;
50
+ };
51
+ }
@@ -117,6 +117,7 @@ export interface CreateUserActivationEventParams {
117
117
  platform?: string;
118
118
  ip?: string;
119
119
  userAgent?: string;
120
+ createdAt?: Date;
120
121
  }
121
122
  export interface UpdateUserActivationDeviceParams {
122
123
  filters: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spytecgps/nova-orm",
3
- "version": "0.0.67",
3
+ "version": "0.0.69",
4
4
  "description": "ORM with PlanetScale",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",