@spytecgps/nova-orm 0.0.195 → 0.0.197

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 { AppFeatureType } from '../../entities';
2
+ import { NovaDataSource } from '../../novaDataSource';
3
+ import { CreateAppFeatureTypeParams } from '../../types/appFeatures';
4
+ import { Logger } from '../../types/logger';
5
+ export declare const createAppFeatureType: (novaDataSource: NovaDataSource, params: CreateAppFeatureTypeParams, logger: Logger) => Promise<AppFeatureType>;
@@ -0,0 +1,5 @@
1
+ import { ClientAppFeature } from '../../entities';
2
+ import { NovaDataSource } from '../../novaDataSource';
3
+ import { CreateClientAppFeatureParams } from '../../types/appFeatures';
4
+ import { Logger } from '../../types/logger';
5
+ export declare const createClientAppFeature: (novaDataSource: NovaDataSource, params: CreateClientAppFeatureParams, logger: Logger) => Promise<ClientAppFeature>;
@@ -0,0 +1,5 @@
1
+ import { ClientAppFeature } from '../../entities';
2
+ import { NovaDataSource } from '../../novaDataSource';
3
+ import { GetClientAppFeaturesParams } from '../../types/appFeatures';
4
+ import { Logger } from '../../types/logger';
5
+ export declare const getClientAppFeatures: (novaDataSource: NovaDataSource, params: GetClientAppFeaturesParams, logger: Logger) => Promise<ClientAppFeature[]>;
@@ -0,0 +1,37 @@
1
+ import { AppFeatureType, ClientAppFeature } from '../../entities';
2
+ import { CreateAppFeatureTypeParams, CreateClientAppFeatureParams, GetClientAppFeaturesParams } from '../../types/appFeatures';
3
+ import { BaseRepository } from '../baseRepository';
4
+ export declare class AppFeaturesRepository extends BaseRepository {
5
+ /**
6
+ * Create a new app feature type
7
+ * @param params - The parameters to create the app feature type
8
+ * params.id - The id of the app feature type, optional. If not provided, it will be auto-generated
9
+ * params.name - The name of the app feature type, required
10
+ * params.description - The description of the app feature type, required
11
+ * params.statusId - The status id of the app feature type, optional, default to 1
12
+ * @returns The created app feature type
13
+ */
14
+ createAppFeatureType(params: CreateAppFeatureTypeParams): Promise<AppFeatureType>;
15
+ /**
16
+ * Create a new client app feature
17
+ * @param params - The parameters to create the client app feature
18
+ * params.clientId: The client id of the client app feature, required
19
+ * params.appFeatureTypeId: The app feature type id of the client app feature, required
20
+ * params.entityId: The entity id of the client app feature, required
21
+ * params.statusId: The status id of the client app feature, optional, default to 1
22
+ * @returns The created client app feature
23
+ */
24
+ createClientAppFeature(params: CreateClientAppFeatureParams): Promise<ClientAppFeature>;
25
+ /**
26
+ * Get client app features
27
+ * @param params - The parameters to get client app features
28
+ * One of the following filters is required:
29
+ * params.filters.clientId: The client id to filter, optional
30
+ * params.filters.appFeatureTypeId: The app feature type id to filter, optional
31
+ * params.filters.entityId: The entity id to filter, optional
32
+ * params.filters.statusId: The status id to filter, optional
33
+ * params.projectionOptions.withAppFeatureType: Whether to include app feature type relation in the result
34
+ * @returns The client app features
35
+ */
36
+ getClientAppFeatures(params: GetClientAppFeaturesParams): Promise<ClientAppFeature[]>;
37
+ }
@@ -2,6 +2,7 @@ import { AcumaticaRepository } from './acumatica';
2
2
  import { AempTokenRepository } from './aempToken';
3
3
  import { AlertRepository } from './alerts';
4
4
  import { AlertTypesRepository } from './alertTypes';
5
+ import { AppFeaturesRepository } from './appFeatures';
5
6
  import { AssetCategoriesRepository } from './assetCategories';
6
7
  import { BillingRepository } from './billing';
7
8
  import { BlacklistRepository } from './blacklist';
@@ -27,4 +28,4 @@ import { UserInvitationsRepository } from './userInvitations';
27
28
  import { UserRatingRequestsRepository } from './userRatingRequests';
28
29
  import { UserRegistrationAttemptsRepository } from './userRegistrationAttempts';
29
30
  import { UsersRepository } from './users';
30
- export { AcumaticaRepository, AempTokenRepository, AlertRepository, AlertTypesRepository, AssetCategoriesRepository, BillingRepository, BlacklistRepository, BoundariesRepository, ClientsRepository, CountriesRepository, DeactivationsRepository, DeviceBehaviorsRepository, DevicePairingsRepository, DevicesRepository, FirmwaresRepository, NotificationRecipientsRepository, PositionRepository, SecurityRepository, TasksRepository, TripRepository, UserActivationsRepository, UserAppFeedbackRepository, UserAppIncidentsRepository, UserConfigurationsRepository, UserDataDeletionRequestsRepository, UserInvitationsRepository, UserRatingRequestsRepository, UserRegistrationAttemptsRepository, UsersRepository, };
31
+ export { AcumaticaRepository, AempTokenRepository, AlertRepository, AlertTypesRepository, AppFeaturesRepository, AssetCategoriesRepository, BillingRepository, BlacklistRepository, BoundariesRepository, ClientsRepository, CountriesRepository, DeactivationsRepository, DeviceBehaviorsRepository, DevicePairingsRepository, DevicesRepository, FirmwaresRepository, NotificationRecipientsRepository, PositionRepository, SecurityRepository, TasksRepository, TripRepository, UserActivationsRepository, UserAppFeedbackRepository, UserAppIncidentsRepository, UserConfigurationsRepository, UserDataDeletionRequestsRepository, UserInvitationsRepository, UserRatingRequestsRepository, UserRegistrationAttemptsRepository, UsersRepository, };
@@ -0,0 +1,5 @@
1
+ import { Task } from '../../entities';
2
+ import { NovaDataSource } from '../../novaDataSource';
3
+ import { Logger } from '../../types/logger';
4
+ import { GetTasksParams } from '../../types/tasks';
5
+ export declare const getTasks: (novaDataSource: NovaDataSource, params: GetTasksParams, logger: Logger) => Promise<Task[]>;
@@ -1,5 +1,5 @@
1
1
  import { DeviceTask, Task, TaskSchedule } from '../../entities';
2
- import { AddTaskScheduleDevicesParams, CreateTaskParams, CreateTaskScheduleParams, DeleteTaskScheduleDevicesParams, DeleteTaskScheduleParams, GetDeviceTasksParams, GetTaskScheduleParams, GetTaskSchedulesParams, SetTaskScheduleDevicesParams, UpdateTaskScheduleParams } from '../../types/tasks';
2
+ import { AddTaskScheduleDevicesParams, CreateTaskParams, CreateTaskScheduleParams, DeleteTaskScheduleDevicesParams, DeleteTaskScheduleParams, GetDeviceTasksParams, GetTaskScheduleParams, GetTaskSchedulesParams, GetTasksParams, SetTaskScheduleDevicesParams, UpdateTaskScheduleParams } from '../../types/tasks';
3
3
  import { BaseRepository } from '../baseRepository';
4
4
  export declare class TasksRepository extends BaseRepository {
5
5
  /**
@@ -158,4 +158,35 @@ export declare class TasksRepository extends BaseRepository {
158
158
  * @returns Promise<Task> the created task
159
159
  */
160
160
  createTask(params: CreateTaskParams): Promise<Task>;
161
+ /**
162
+ * Get tasks with filters
163
+ * @param params params containing information to get tasks
164
+ * At least one of the following filters is required:
165
+ * params.filters.taskId: the task ID
166
+ * params.filters.taskScheduleId: the task schedule ID
167
+ * params.filters.imei: the IMEI
168
+ * params.filters.clientId: the client ID
169
+ * params.filters.dueDateFilter: the due date range filter
170
+ * params.filters.dueOdometerFilter: the due odometer range filter
171
+ * params.filters.dueActiveHoursFilter: the due active hours range filter
172
+ * params.filters.startDateFilter: the start date range filter
173
+ * params.filters.startingOdometerFilter: the starting odometer range filter
174
+ * params.filters.startingActiveHoursFilter: the starting active hours range filter
175
+ * params.filters.status: the status (pending, past_due, completed, deleted)
176
+ * params.filters.pastDueAtFilter: the past due at range filter
177
+ * params.filters.createdAtFilter: the created at range filter
178
+ * params.filters.completedAtFilter: the completed at range filter
179
+ * params.filters.completionNotes: the completion notes for partial match search
180
+ * params.filters.completionOdometerFilter: the completion odometer range filter
181
+ * params.filters.completionActiveHoursFilter: the completion active hours range filter
182
+ * params.filters.completedBy: the completed by, partial match search
183
+ * params.filters.modifiedBy: the modified by, partial match search
184
+ * params.filters.modifiedAtFilter: the modified at range filter
185
+ * params.filters.queuedAtFilter: the queued at range filter
186
+ * params.filters.predictedDueDateFilter: the predicted due date range filter
187
+ * params.filters.deletedAtFilter: the deleted at range filter
188
+ * params.filters.deletedBy: the deleted by, partial match search
189
+ * @returns Promise<Task[]> the tasks corresponding to the filters
190
+ */
191
+ getTasks(params: GetTasksParams): Promise<Task[]>;
161
192
  }
@@ -0,0 +1,23 @@
1
+ export interface CreateAppFeatureTypeParams {
2
+ id?: number;
3
+ name: string;
4
+ description: string;
5
+ statusId?: number;
6
+ }
7
+ export interface CreateClientAppFeatureParams {
8
+ clientId: number;
9
+ appFeatureTypeId: number;
10
+ entityId: number;
11
+ statusId?: number;
12
+ }
13
+ export interface GetClientAppFeaturesParams {
14
+ filters: {
15
+ clientId?: number;
16
+ appFeatureTypeId?: number;
17
+ entityId?: number;
18
+ statusId?: number;
19
+ };
20
+ projectionOptions?: {
21
+ withAppFeatureType?: boolean;
22
+ };
23
+ }
@@ -1,6 +1,7 @@
1
1
  import * as Acumatica from './acumatica';
2
2
  import * as Alerts from './alert';
3
3
  import * as AlertTypes from './alertTypes';
4
+ import * as AppFeatures from './appFeatures';
4
5
  import * as Billing from './billing';
5
6
  import * as Blacklist from './blacklist';
6
7
  import * as Boundaries from './boundaries';
@@ -26,4 +27,4 @@ import * as UserDataDeletionRequests from './userDataDeletionRequests';
26
27
  import * as UserInvitations from './userInvitations';
27
28
  import * as UserRatingRequests from './userRatingRequests';
28
29
  import * as UserRegistrationAttempts from './userRegistrationAttempts';
29
- export { Acumatica, Alerts, AlertTypes, Billing, Blacklist, Boundaries, Clients, Countries, Deactivations, DeviceBehaviors, DevicePairings, Devices, Firmwares, Logger, NotificationRecipients, Positions, Security, Trips, Users, UserActivations, UserAppFeedback, UserAppIncidents, UserConfigurations, UserDataDeletionRequests, UserInvitations, UserRatingRequests, UserRegistrationAttempts, Enums, };
30
+ export { Acumatica, Alerts, AlertTypes, AppFeatures, Billing, Blacklist, Boundaries, Clients, Countries, Deactivations, DeviceBehaviors, DevicePairings, Devices, Firmwares, Logger, NotificationRecipients, Positions, Security, Trips, Users, UserActivations, UserAppFeedback, UserAppIncidents, UserConfigurations, UserDataDeletionRequests, UserInvitations, UserRatingRequests, UserRegistrationAttempts, Enums, };
@@ -109,3 +109,32 @@ export interface CreateTaskParams {
109
109
  startingOdometer?: number;
110
110
  startingActiveHours?: number;
111
111
  }
112
+ export interface GetTasksFilters {
113
+ taskScheduleId?: number;
114
+ taskId?: number;
115
+ imei?: string;
116
+ clientId?: number;
117
+ dueDateFilter?: RangeFilter<Date>;
118
+ dueOdometerFilter?: RangeFilter<number>;
119
+ dueActiveHoursFilter?: RangeFilter<number>;
120
+ startDateFilter?: RangeFilter<Date>;
121
+ startingOdometerFilter?: RangeFilter<number>;
122
+ startingActiveHoursFilter?: RangeFilter<number>;
123
+ status?: 'pending' | 'past_due' | 'completed' | 'deleted';
124
+ pastDueAtFilter?: RangeFilter<Date>;
125
+ createdAtFilter?: RangeFilter<Date>;
126
+ completedAtFilter?: RangeFilter<Date>;
127
+ completionNotes?: string;
128
+ completionOdometerFilter?: RangeFilter<number>;
129
+ completionActiveHoursFilter?: RangeFilter<number>;
130
+ completedBy?: string;
131
+ modifiedBy?: string;
132
+ modifiedAtFilter?: RangeFilter<Date>;
133
+ queuedAtFilter?: RangeFilter<Date>;
134
+ predictedDueDateFilter?: RangeFilter<Date>;
135
+ deletedAtFilter?: RangeFilter<Date>;
136
+ deletedBy?: string;
137
+ }
138
+ export interface GetTasksParams {
139
+ filters: GetTasksFilters;
140
+ }
@@ -0,0 +1,7 @@
1
+ import { SelectQueryBuilder } from 'typeorm';
2
+ export interface FilterMap<T1, T2> {
3
+ targetFieldName: keyof T1;
4
+ filterName: keyof T2;
5
+ comparisonOperator?: 'RANGE' | '=' | 'LIKE';
6
+ }
7
+ export declare const addFilters: <T>(queryBuilder: SelectQueryBuilder<T>, filters: any, filterMapping: FilterMap<T, any>[]) => SelectQueryBuilder<T>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spytecgps/nova-orm",
3
- "version": "0.0.195",
3
+ "version": "0.0.197",
4
4
  "description": "ORM with PlanetScale",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",