@spytecgps/nova-orm 1.1.0-rc2 → 1.1.0

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.
Files changed (47) hide show
  1. package/dist/entities/aempToken.d.ts +1 -0
  2. package/dist/entities/alert.d.ts +1 -0
  3. package/dist/entities/alertBeta.d.ts +1 -0
  4. package/dist/entities/alertMigration.d.ts +1 -0
  5. package/dist/entities/boundaryEvent.d.ts +1 -0
  6. package/dist/entities/client.d.ts +1 -0
  7. package/dist/entities/clientAlertRecipient.d.ts +1 -0
  8. package/dist/entities/dataExport.d.ts +1 -0
  9. package/dist/entities/deviceBleMeshUpdateTask.d.ts +1 -0
  10. package/dist/entities/deviceReplacement.d.ts +1 -0
  11. package/dist/entities/firmwareUpgradeTask.d.ts +1 -0
  12. package/dist/entities/latestPosition.d.ts +1 -0
  13. package/dist/entities/latestPositionMigration.d.ts +1 -0
  14. package/dist/entities/latestUserAppInfo.d.ts +1 -0
  15. package/dist/entities/liveLink.d.ts +1 -0
  16. package/dist/entities/notificationRecipient.d.ts +1 -0
  17. package/dist/entities/organization.d.ts +1 -0
  18. package/dist/entities/position.d.ts +1 -0
  19. package/dist/entities/positionMigration.d.ts +1 -0
  20. package/dist/entities/trip.d.ts +1 -0
  21. package/dist/entities/user.d.ts +1 -0
  22. package/dist/entities/userActivation.d.ts +1 -0
  23. package/dist/entities/userActivationEvent.d.ts +1 -0
  24. package/dist/entities/userActivationMetric.d.ts +1 -0
  25. package/dist/entities/userAlertComplain.d.ts +1 -0
  26. package/dist/entities/userAlertConfiguration.d.ts +1 -0
  27. package/dist/entities/userAlertNotificationsConfig.d.ts +1 -0
  28. package/dist/entities/userAppFeedback.d.ts +1 -0
  29. package/dist/entities/userAppIncident.d.ts +1 -0
  30. package/dist/entities/userConfiguration.d.ts +1 -0
  31. package/dist/entities/userDataDeletionRequest.d.ts +1 -0
  32. package/dist/entities/userDeviceBehaviorTask.d.ts +1 -0
  33. package/dist/entities/userInvitation.d.ts +1 -0
  34. package/dist/entities/userRatingRequest.d.ts +1 -0
  35. package/dist/entities/userRegistrationAttempt.d.ts +1 -0
  36. package/dist/entities/userSecurityRole.d.ts +1 -0
  37. package/dist/index.js +1 -1
  38. package/dist/novaDataSource.d.ts +1 -0
  39. package/dist/repositories/baseRepository.d.ts +13 -1
  40. package/dist/repositories/clientAlertConfiguration/index.d.ts +2 -1
  41. package/dist/repositories/clientAlertConfiguration/isUserAllowedForAlertConfig.d.ts +4 -0
  42. package/dist/repositories/deviceStatus/index.d.ts +2 -2
  43. package/dist/repositories/devices/index.d.ts +2 -2
  44. package/dist/repositories/userConfigurations/index.d.ts +20 -2
  45. package/dist/types/alert.d.ts +1 -0
  46. package/dist/types/clientAlertConfiguration.d.ts +6 -1
  47. package/package.json +1 -1
@@ -70,4 +70,5 @@ export declare class NovaDataSource {
70
70
  createQueryRunner(mode?: ReplicationMode): QueryRunner;
71
71
  createQueryRunnerFromParams(params: BaseSelectQueryParams): QueryRunner;
72
72
  safeQuery<T>(queryBuilderHandler: queryBuilderHandler<T>, tag?: string, queryRunner?: QueryRunner): Promise<T>;
73
+ safeQuery2<T>(queryBuilderHandler: queryBuilderHandler<T>, tag?: string, queryRunner?: QueryRunner): Promise<T>;
73
74
  }
@@ -1,4 +1,4 @@
1
- import { NovaDataSourceConfig } from '../novaDataSource';
1
+ import { NovaDataSource, NovaDataSourceConfig } from '../novaDataSource';
2
2
  import { Logger } from '../types/logger';
3
3
  export declare class BaseRepository {
4
4
  protected readonly novaDataSourceConfig: NovaDataSourceConfig;
@@ -7,3 +7,15 @@ export declare class BaseRepository {
7
7
  protected readonly useBeta: boolean;
8
8
  constructor(config: NovaDataSourceConfig, logger: Logger, replicaConfig?: NovaDataSourceConfig, useBeta?: boolean);
9
9
  }
10
+ interface BaseRepository2Options {
11
+ useBeta?: boolean;
12
+ dataSource: NovaDataSource;
13
+ logger?: Logger;
14
+ }
15
+ export declare class BaseRepository2 {
16
+ protected readonly useBeta: boolean;
17
+ protected readonly dataSource: NovaDataSource;
18
+ protected readonly logger: Logger;
19
+ constructor(options: BaseRepository2Options);
20
+ }
21
+ export {};
@@ -1,5 +1,5 @@
1
1
  import { ClientAlertConfiguration } from '../../entities';
2
- import { CreateClientAlertConfigurationParams, DeleteClientAlertConfigurationsParams, GetClientAlertConfigurationsParams, GetClientAlertRecipientsParams, GetClientAlertRecipientsResult, SetClientAlertRecipientsParams, UpdateClientAlertConfigurationParams } from '../../types/clientAlertConfiguration';
2
+ import { CreateClientAlertConfigurationParams, DeleteClientAlertConfigurationsParams, GetClientAlertConfigurationsParams, GetClientAlertRecipientsParams, GetClientAlertRecipientsResult, IsUserAllowedForAlertConfigParams, SetClientAlertRecipientsParams, UpdateClientAlertConfigurationParams } from '../../types/clientAlertConfiguration';
3
3
  import { BaseRepository } from '../baseRepository';
4
4
  export declare class ClientAlertConfigurationRepository extends BaseRepository {
5
5
  getClientAlertConfigurations(params: GetClientAlertConfigurationsParams): Promise<ClientAlertConfiguration[]>;
@@ -8,4 +8,5 @@ export declare class ClientAlertConfigurationRepository extends BaseRepository {
8
8
  deleteClientAlertConfigurations(params: DeleteClientAlertConfigurationsParams): Promise<boolean>;
9
9
  getClientAlertRecipients(params: GetClientAlertRecipientsParams): Promise<GetClientAlertRecipientsResult>;
10
10
  setClientAlertRecipients(params: SetClientAlertRecipientsParams): Promise<boolean>;
11
+ isUserAllowedForAlertConfig(params: IsUserAllowedForAlertConfigParams): Promise<boolean>;
11
12
  }
@@ -0,0 +1,4 @@
1
+ import { NovaDataSource } from '../../novaDataSource';
2
+ import { IsUserAllowedForAlertConfigParams } from '../../types/clientAlertConfiguration';
3
+ import { Logger } from '../../types/logger';
4
+ export declare const isUserAllowedForAlertConfig: (novaDataSource: NovaDataSource, params: IsUserAllowedForAlertConfigParams, logger: Logger) => Promise<boolean>;
@@ -1,6 +1,6 @@
1
1
  import { DeviceStatusRecord, GetDeviceStatusesCountParams, GetDeviceStatusesParams, UpsertDeviceStatusesParams } from '../../types/deviceStatus';
2
- import { BaseRepository } from './../baseRepository';
3
- export declare class DeviceStatusRepository extends BaseRepository {
2
+ import { BaseRepository2 } from './../baseRepository';
3
+ export declare class DeviceStatusRepository extends BaseRepository2 {
4
4
  /**
5
5
  * Get device statuses
6
6
  * @param {GetDeviceStatusesParams} params containing information to get device statuses
@@ -1,7 +1,7 @@
1
1
  import { ClientDeviceSetting, Device, DeviceCustomConfiguration, DeviceReplacement, DeviceType, IccidStatus, ImeiIccidCarrier, ServiceProviderProduct } from '../../entities';
2
2
  import { AllImeisAreActiveForClientParams, CanceledDeviceWithActiveSimCard, CarrierStatus, CreateClientDeviceSettingParams, CreateDeviceParams, CreateDeviceReplacementParams, CreateDeviceTypeParams, DeleteDeviceParams, DevicesCountByStatus, DeviceTypeModelWithDeviceCount, DeviceWithUsersInfo, GenerateIdentifierKeyParams, GetCanceledDevicesWithActiveSimCardsParams, GetCarrierStatusUpdatedBeforeParams, GetClientDeviceSettingParams, GetClientDeviceSettingsParams, GetDeviceCustomConfigParams, GetDeviceParams, GetDevicesCountByStatusParams, GetDevicesParams, GetDeviceTypeByImeiParams, GetDeviceTypesModelsOrderedByDeviceCountParams, GetDeviceTypesParams, GetDeviceWithUsersInfoParams, GetFilteredImeisWithStatusParams, GetIccidStatusParams, GetImeiIccidCarrierParams, GetImeiIccidCarriersParams, GetServiceProviderProductParams, UpdateClientDeviceSettingParams, UpdateDeviceParams, UpdateDeviceTypeParams, UpdateIccidStatusParams, UpdateImeiIccidCarrierParams, UpsertDeviceCustomConfigParams, UpsertIccidStatusParams } from '../../types/devices';
3
- import { BaseRepository } from './../baseRepository';
4
- export declare class DevicesRepository extends BaseRepository {
3
+ import { BaseRepository2 } from './../baseRepository';
4
+ export declare class DevicesRepository extends BaseRepository2 {
5
5
  /**
6
6
  * Get device with filters
7
7
  * @param {GetDeviceParams} params containing information to get a device with filters
@@ -146,7 +146,25 @@ export declare class UserConfigurationsRepository extends BaseRepository {
146
146
  * @returns Whether the user alert configurations were deleted
147
147
  */
148
148
  deleteUserAlertConfigurations(params: DeleteUserAlertConfigurationsParams): Promise<boolean>;
149
- getUserAlertNotificationsConfig: (params: GetUserAlertNotificationsConfigParams) => Promise<UserAlertNotificationsConfig[]>;
150
- upsertUserAlertNotificationsConfig: (params: UpsertUserAlertNotificationsConfigParams) => Promise<boolean>;
149
+ /**
150
+ * Get user alert notifications config
151
+ * @param {GetUserAlertNotificationsConfigParams} params containing information to get user alert notifications config
152
+ * - filters.userId: The user id to obtain all user alert notifications config from that user, required
153
+ * @returns The user alert notifications config
154
+ */
155
+ getUserAlertNotificationsConfig(params: GetUserAlertNotificationsConfigParams): Promise<UserAlertNotificationsConfig[]>;
156
+ /**
157
+ * Upsert user alert notifications config
158
+ * @param {UpsertUserAlertNotificationsConfigParams} params containing information to upsert user alert notifications config
159
+ * - id: The user alert notifications config id, optional. If not provided, it will be generated
160
+ * - clientAlertConfigurationId: The client alert configuration id, required
161
+ * - userId: The user id, required
162
+ * - smsNotification: The user sms notification, optional
163
+ * - emailNotification: The user email notification, optional
164
+ * - appNotification: The user app notification, optional. If not provided, it will be true
165
+ * - pushNotification: The user push notification, optional. If not provided, it will be true
166
+ * @returns Whether the user alert notifications config was upserted
167
+ */
168
+ upsertUserAlertNotificationsConfig(params: UpsertUserAlertNotificationsConfigParams): Promise<boolean>;
151
169
  deleteUserAlertNotificationsConfig: (params: DeleteUserAlertNotificationsConfigParams) => Promise<boolean>;
152
170
  }
@@ -1,4 +1,5 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="node" />
2
3
  import { ReportPagination } from './common';
3
4
  export interface CreateAlertParams {
4
5
  id?: number;
@@ -62,9 +62,10 @@ export interface BaseRecipient {
62
62
  pushNotification: boolean;
63
63
  isEnabled: boolean;
64
64
  }
65
- export interface ClientAlertExternalRecipient extends BaseRecipient {
65
+ export interface ClientAlertExternalRecipient {
66
66
  recipient: string;
67
67
  type: 'email' | 'sms';
68
+ isEnabled: boolean;
68
69
  }
69
70
  export interface ClientAlertUserIdRecipient extends BaseRecipient {
70
71
  userId: string;
@@ -84,3 +85,7 @@ export interface SetClientAlertRecipientsParams {
84
85
  externalRecipients?: ClientAlertExternalRecipient[];
85
86
  };
86
87
  }
88
+ export interface IsUserAllowedForAlertConfigParams {
89
+ clientAlertConfigurationId: number;
90
+ userId: string;
91
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spytecgps/nova-orm",
3
- "version": "1.1.0-rc2",
3
+ "version": "1.1.0",
4
4
  "description": "ORM with PlanetScale",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",