@spytecgps/nova-orm 0.0.89 → 0.0.91

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 { BillingSubscriptionBraintree } from '../../entities';
2
+ import { NovaDataSource } from '../../novaDataSource';
3
+ import { GetBillingSubscriptionsBraintreeParams } from '../../types/billing';
4
+ import { Logger } from '../../types/logger';
5
+ export declare const getBillingSubscriptionsBraintree: (novaDataSource: NovaDataSource, params: GetBillingSubscriptionsBraintreeParams, logger: Logger) => Promise<BillingSubscriptionBraintree[]>;
@@ -0,0 +1,4 @@
1
+ import { NovaDataSource } from '../../novaDataSource';
2
+ import { BillingSubscriptionChurnStatus, GetChurnStatusByClientIdParams } from '../../types/billing';
3
+ import { Logger } from '../../types/logger';
4
+ export declare const getChurnStatusByClientId: (novaDataSource: NovaDataSource, params: GetChurnStatusByClientIdParams, logger: Logger) => Promise<BillingSubscriptionChurnStatus[]>;
@@ -1,5 +1,5 @@
1
- import { Billing, BillingCustomerBraintree, BillingDeviceHistory, BillingStatusHistoryBraintree, User } from '../../entities';
2
- import { CreateBillingDeviceHistoryParams, CreateBillingParams, CreateBillingStatusHistoryBraintreeParams, GetBillingCustomerBraintreeByIdParams, GetBillingsParams, GetClientIdFromBraintreeCustomerParams, GetUserByBraintreeCustomerIdParams, UpdateBillingCustomerBraintreeParams, UpdateBillingParams, UpsertBillingCustomerBraintreeParams } from '../../types/billing';
1
+ import { Billing, BillingCustomerBraintree, BillingDeviceHistory, BillingStatusHistoryBraintree, BillingSubscriptionBraintree, User } from '../../entities';
2
+ import { BillingSubscriptionChurnStatus, CreateBillingDeviceHistoryParams, CreateBillingParams, CreateBillingStatusHistoryBraintreeParams, GetBillingCustomerBraintreeByIdParams, GetBillingsParams, GetBillingSubscriptionsBraintreeParams, GetChurnStatusByClientIdParams, GetClientIdFromBraintreeCustomerParams, GetUserByBraintreeCustomerIdParams, UpdateBillingCustomerBraintreeParams, UpdateBillingParams, UpsertBillingCustomerBraintreeParams, UpsertBillingSubscriptionBraintreeParams } from '../../types/billing';
3
3
  import { BaseRepository } from '../baseRepository';
4
4
  export declare class BillingRepository extends BaseRepository {
5
5
  /**
@@ -119,4 +119,25 @@ export declare class BillingRepository extends BaseRepository {
119
119
  * @returns The user information
120
120
  */
121
121
  getUserByBraintreeCustomerId(params: GetUserByBraintreeCustomerIdParams): Promise<User>;
122
+ /**
123
+ * Get billing braintree subscriptions
124
+ * @param {GetBillingSubscriptionsBraintreeParams} params containing information to get billing braintree subscriptions
125
+ * - params.filters.subscriptionId: The braintree subscription id
126
+ * - params.filters.clientId: The clientId
127
+ * @returns The billing braintree subscriptions corresponding to the provided filters
128
+ */
129
+ getBillingSubscriptionsBraintree(params: GetBillingSubscriptionsBraintreeParams): Promise<BillingSubscriptionBraintree[]>;
130
+ /**
131
+ * Get churn status by clientId
132
+ * @param {GetChurnStatusByClientIdParams} params containing information to get billing braintree subscriptions
133
+ * - params.filters.clientId: The clientId
134
+ * @returns The churn status list for all subscriptions for the provided clientId
135
+ */
136
+ getChurnStatusByClientId(params: GetChurnStatusByClientIdParams): Promise<BillingSubscriptionChurnStatus[]>;
137
+ /**
138
+ * Upsert billing subscription braintree
139
+ * @param {UpsertBillingSubscriptionBraintreeParams} params containing information to upsert billing braintree subscription
140
+ * @returns Whether the billing braintree subscription was upserted
141
+ */
142
+ upsertBillingSubscriptionBraintree(params: UpsertBillingSubscriptionBraintreeParams): Promise<boolean>;
122
143
  }
@@ -0,0 +1,4 @@
1
+ import { NovaDataSource } from '../../novaDataSource';
2
+ import { UpsertBillingSubscriptionBraintreeParams } from '../../types/billing';
3
+ import { Logger } from '../../types/logger';
4
+ export declare const upsertBillingSubscriptionBraintree: (novaDataSource: NovaDataSource, params: UpsertBillingSubscriptionBraintreeParams, logger: Logger) => Promise<boolean>;
@@ -0,0 +1,4 @@
1
+ import { NovaDataSource } from '../../novaDataSource';
2
+ import { GetFirmwareUpgradeTasksCountParams } from '../../types/firmwares';
3
+ import { Logger } from '../../types/logger';
4
+ export declare const getFirmwareUpgradeTasksCount: (novaDataSource: NovaDataSource, params: GetFirmwareUpgradeTasksCountParams, logger: Logger) => Promise<number>;
@@ -1,5 +1,5 @@
1
1
  import { DeviceTypeFirmware, FirmwareUpgradeTask } from '../../entities';
2
- import { CreateDeviceFirmwareParams, CreateFirmwareUpgradeTaskParams, GetDeviceFirmwaresParams, GetFirmwareUpgradeTasksParams, UpdateFirmwareUpgradeTaskParams } from '../../types/firmwares';
2
+ import { CreateDeviceFirmwareParams, CreateFirmwareUpgradeTaskParams, GetDeviceFirmwaresParams, GetFirmwareUpgradeTasksCountParams, GetFirmwareUpgradeTasksParams, UpdateFirmwareUpgradeTaskParams } from '../../types/firmwares';
3
3
  import { BaseRepository } from '../baseRepository';
4
4
  export declare class FirmwaresRepository extends BaseRepository {
5
5
  /**
@@ -65,6 +65,18 @@ export declare class FirmwaresRepository extends BaseRepository {
65
65
  * @returns {FirmwareUpgradeTask[]} A list of firmware upgrade tasks.
66
66
  */
67
67
  getFirmwareUpgradeTasks(params: GetFirmwareUpgradeTasksParams): Promise<FirmwareUpgradeTask[]>;
68
+ /**
69
+ * Get firmware upgrade tasks count based on the filters.
70
+ * @param {GetFirmwareUpgradeTasksCountParams} params containing information to get the firmware upgrade task count with filters.
71
+ * At least one filter must be specified.
72
+ * - filters.deviceId: The device id
73
+ * - filters.firmwareId: The firmware id
74
+ * - filters.taskId: The task id
75
+ * - filters.statuses: The list of statuses to filter
76
+ * - filters.imeis: The list of imeis to filter
77
+ * @returns {number} The count of firmware upgrade tasks.
78
+ */
79
+ getFirmwareUpgradeTasksCount(params: GetFirmwareUpgradeTasksCountParams): Promise<number>;
68
80
  /**
69
81
  * Partially update firmware upgrade tasks based.
70
82
  * @param {UpdateFirmwareUpgradeTaskParams} params containing information to update a firmware upgrade task.
@@ -97,3 +97,54 @@ export interface GetUserByBraintreeCustomerIdParams {
97
97
  customerId: string;
98
98
  };
99
99
  }
100
+ export interface GetBillingSubscriptionsBraintreeParams {
101
+ filters: {
102
+ subscriptionId?: string;
103
+ clientId?: number;
104
+ };
105
+ }
106
+ export interface GetChurnStatusByClientIdParams {
107
+ filters: {
108
+ clientId: number;
109
+ };
110
+ }
111
+ export interface BillingSubscriptionChurnStatus {
112
+ braintreeCustomerId: string;
113
+ braintreeSubscriptionStatus: string;
114
+ subscriptionId: string;
115
+ churnStatus?: string | null;
116
+ }
117
+ export interface UpsertBillingSubscriptionBraintreeParams {
118
+ subscriptionId: string;
119
+ customerId?: string | null;
120
+ planId?: string | null;
121
+ createdAt?: Date | null;
122
+ updatedAt?: Date | null;
123
+ subscriptionStart?: Date | null;
124
+ subscriptionEnd?: Date | null;
125
+ nextBillingDate?: Date | null;
126
+ subscriptionValue?: number | null;
127
+ status?: string | null;
128
+ subscriptionPeriodMonths?: number | null;
129
+ paymentInstrumentType?: string | null;
130
+ paymentInstrumentDetails?: object | null;
131
+ isPaused?: boolean | null;
132
+ discountDetails?: object | null;
133
+ addons?: object | null;
134
+ balance?: number | null;
135
+ currentBillingCycle?: number | null;
136
+ daysPastDue?: number | null;
137
+ description?: string | null;
138
+ descriptor?: object | null;
139
+ failureCount?: number | null;
140
+ firstBillingDate?: Date | null;
141
+ merchantAccountId?: string | null;
142
+ nextBillingPeriodAmount?: number | null;
143
+ numberOfBillingCycles?: number | null;
144
+ paidThroughDate?: Date | null;
145
+ paymentMethodToken?: string | null;
146
+ statusHistory?: object | null;
147
+ trialDuration?: number | null;
148
+ trialDurationUnit?: string | null;
149
+ trialPeriod?: boolean | null;
150
+ }
@@ -25,6 +25,15 @@ export interface GetFirmwareUpgradeTasksParams {
25
25
  offset?: number;
26
26
  };
27
27
  }
28
+ export interface GetFirmwareUpgradeTasksCountParams {
29
+ filters: {
30
+ deviceId?: number;
31
+ firmwareId?: number;
32
+ taskId?: string;
33
+ statuses?: FirmwareUpgradeTaskStatus[];
34
+ imeis?: string[];
35
+ };
36
+ }
28
37
  export declare enum UpgradeType {
29
38
  BB = "0",
30
39
  MCU = "1",
@@ -0,0 +1,5 @@
1
+ import { ValueTransformer } from 'typeorm';
2
+ export declare class StringToDateTransformer implements ValueTransformer {
3
+ to(value: string | null): string | null;
4
+ from(value: string): Date | null;
5
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spytecgps/nova-orm",
3
- "version": "0.0.89",
3
+ "version": "0.0.91",
4
4
  "description": "ORM with PlanetScale",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",