@spytecgps/nova-orm 0.0.165 → 0.0.167

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 { CustomerAttribute } from '../../entities/customerAttribute';
2
+ import { NovaDataSource } from '../../novaDataSource';
3
+ import { CreateCustomerAttributeParams } from '../../types/clients';
4
+ import { Logger } from '../../types/logger';
5
+ export declare const createCustomerAttribute: (novaDataSource: NovaDataSource, params: CreateCustomerAttributeParams, logger: Logger) => Promise<CustomerAttribute>;
@@ -0,0 +1,5 @@
1
+ import { CustomerAttribute } from '../../entities';
2
+ import { NovaDataSource } from '../../novaDataSource';
3
+ import { GetCustomerAttributeParams } from '../../types/clients';
4
+ import { Logger } from '../../types/logger';
5
+ export declare const getCustomerAttribute: (novaDataSource: NovaDataSource, params: GetCustomerAttributeParams, logger: Logger) => Promise<CustomerAttribute>;
@@ -1,5 +1,6 @@
1
1
  import { Client, ClientConfiguration } from '../../entities';
2
- import { CreateClientConfigurationParams, CreateClientParams, DeleteClientParams, GetClientConfigurationParams, GetClientParams, GetClientsParams, UpdateClientConfigurationParams, UpdateClientParams } from '../../types/clients';
2
+ import { CustomerAttribute } from '../../entities/customerAttribute';
3
+ import { CreateClientConfigurationParams, CreateClientParams, CreateCustomerAttributeParams, DeleteClientParams, GetClientConfigurationParams, GetClientParams, GetClientsParams, GetCustomerAttributeParams, UpdateClientConfigurationParams, UpdateClientParams, UpdateCustomerAttributeParams } from '../../types/clients';
3
4
  import { BaseRepository } from '../baseRepository';
4
5
  export declare class ClientsRepository extends BaseRepository {
5
6
  /**
@@ -90,4 +91,27 @@ export declare class ClientsRepository extends BaseRepository {
90
91
  * @returns {Promise<boolean>} True if the client configuration was updated, false otherwise
91
92
  */
92
93
  updateClientConfiguration(params: UpdateClientConfigurationParams): Promise<boolean>;
94
+ /**
95
+ * Create a customer attribute for a client
96
+ * @param {CreateCustomerAttributeParams} params containing information to create a customer attribute
97
+ * - clientId: The client id
98
+ * - enterprise: The enterprise, optional
99
+ * - maintenanceModule: The maintenance module, optional
100
+ */
101
+ createCustomerAttribute(params: CreateCustomerAttributeParams): Promise<CustomerAttribute>;
102
+ /**
103
+ * Update a customer attribute for a client
104
+ * @param {UpdateCustomerAttributeParams} params containing information to update a customer attribute
105
+ * - filters.clientId: The client id
106
+ * - enterprise: The enterprise, optional
107
+ * - maintenanceModule: The maintenance module, optional
108
+ * @returns {Promise<boolean>} True if the customer attribute was updated, false otherwise
109
+ */
110
+ updateCustomerAttribute(params: UpdateCustomerAttributeParams): Promise<boolean>;
111
+ /**
112
+ * Get a costumer attribute for a client
113
+ * @param {GetCustomerAttributeParams} params containing information to get a customer attribute
114
+ * - filters.clientId: The client id
115
+ */
116
+ getCustomerAttribute(params: GetCustomerAttributeParams): Promise<CustomerAttribute>;
93
117
  }
@@ -0,0 +1,4 @@
1
+ import { NovaDataSource } from '../../novaDataSource';
2
+ import { UpdateCustomerAttributeParams } from '../../types/clients';
3
+ import { Logger } from '../../types/logger';
4
+ export declare const updateCustomerAttribute: (novaDataSource: NovaDataSource, params: UpdateCustomerAttributeParams, logger: Logger) => Promise<boolean>;
@@ -1,5 +1,5 @@
1
1
  import { NotificationRecipient } from '../../entities';
2
- import { CreateNotificationRecipientParams, DeleteNotificationRecipientsByEmailOrPhoneParams, DeleteNotificationRecipientsParams, GetNotificationRecipientsParams, UpdateNotificationRecipientParams, UpdateUsersNotificationsUnsuscribedStatusParams } from '../../types/notificationRecipients';
2
+ import { CreateNotificationRecipientParams, DeleteNotificationRecipientsByEmailOrPhoneParams, DeleteNotificationRecipientsParams, GetNotificationRecipientsParams, UpdateNotificationRecipientParams, UpdateUsersNotificationsUnsubscribedInfoStatusParams, UpdateUsersNotificationsUnsuscribedStatusParams } from '../../types/notificationRecipients';
3
3
  import { BaseRepository } from '../baseRepository';
4
4
  export declare class NotificationRecipientsRepository extends BaseRepository {
5
5
  /**
@@ -38,6 +38,7 @@ export declare class NotificationRecipientsRepository extends BaseRepository {
38
38
  */
39
39
  updateNotificationRecipient(params: UpdateNotificationRecipientParams): Promise<boolean>;
40
40
  /**
41
+ * @deprecated The method should not be used, use 'updateUsersNotificationsUnsuscribedInfoStatus'
41
42
  * Update users notifications unsubscribed status
42
43
  * @param {UpdateUsersNotificationsUnsuscribedStatusParams} params containing information to update users notifications unsubscribed status
43
44
  * - params.filters: Using these filters, the query will update the users notifications unsubscribed
@@ -49,6 +50,18 @@ export declare class NotificationRecipientsRepository extends BaseRepository {
49
50
  * @returns Whether the users notifications unsubscribed status was updated or not
50
51
  */
51
52
  updateUsersNotificationsUnsuscribedStatus(params: UpdateUsersNotificationsUnsuscribedStatusParams): Promise<boolean>;
53
+ /**
54
+ * Update users notifications unsubscribed status
55
+ * @param {UpdateUsersNotificationsUnsuscribedInfoParams} params containing information to update users notifications unsubscribed status
56
+ * - params.filters: Using these filters, the query will update the users notifications unsubscribed
57
+ * status for all users with the corresponding phone number.
58
+ * The user country code will be used to remove the country code from the phone number before comparing it with the user phone number.
59
+ * - params.filters.userPhone: The user phone
60
+ * - params.filters.userCountryCode: The user country code
61
+ * - params.values.unsubscribed: The unsubscribed flag, optional
62
+ * @returns Whether the users notifications unsubscribed status was updated or not
63
+ */
64
+ updateUsersNotificationsUnsuscribedInfoStatus(params: UpdateUsersNotificationsUnsubscribedInfoStatusParams): Promise<boolean>;
52
65
  /**
53
66
  * Delete notification recipients
54
67
  * @param {DeleteNotificationRecipientsParams} params containing information to delete notification recipients
@@ -0,0 +1,4 @@
1
+ import { NovaDataSource } from '../../novaDataSource';
2
+ import { Logger } from '../../types/logger';
3
+ import { UpdateUsersNotificationsUnsubscribedInfoStatusParams } from '../../types/notificationRecipients';
4
+ export declare const updateUsersNotificationsUnsuscribedInfoStatus: (novaDataSource: NovaDataSource, params: UpdateUsersNotificationsUnsubscribedInfoStatusParams, logger: Logger) => Promise<boolean>;
@@ -76,3 +76,22 @@ export interface UpdateClientConfigurationParams {
76
76
  maxUsersAllowed?: number;
77
77
  };
78
78
  }
79
+ export interface CreateCustomerAttributeParams {
80
+ clientId: number;
81
+ enterprise?: boolean;
82
+ maintenanceModule?: boolean;
83
+ }
84
+ export interface UpdateCustomerAttributeParams {
85
+ filters: {
86
+ clientId: number;
87
+ };
88
+ values: {
89
+ enterprise?: boolean;
90
+ maintenanceModule?: boolean;
91
+ };
92
+ }
93
+ export interface GetCustomerAttributeParams {
94
+ filters: {
95
+ clientId: number;
96
+ };
97
+ }
@@ -39,6 +39,17 @@ export interface UpdateUsersNotificationsUnsuscribedStatusParams {
39
39
  unsubscribedInfo?: string;
40
40
  };
41
41
  }
42
+ export interface UpdateUsersNotificationsUnsubscribedInfoStatusParams {
43
+ filters: {
44
+ recipient: string;
45
+ notificationType: NotificationRecipientType;
46
+ countryCode?: string;
47
+ };
48
+ values: {
49
+ unsubscribed: boolean;
50
+ unsubscribedInfo: string;
51
+ };
52
+ }
42
53
  export interface DeleteNotificationRecipientsParams {
43
54
  filters: {
44
55
  id?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spytecgps/nova-orm",
3
- "version": "0.0.165",
3
+ "version": "0.0.167",
4
4
  "description": "ORM with PlanetScale",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "scripts": {
37
37
  "prepare": "npm run build",
38
- "test": "yarn jest --ci --runInBand --reporters=default --reporters=jest-junit --collectCoverage=true",
38
+ "test": "git update-index --skip-worktree test/utils/setEnvVars.ts && yarn jest --ci --runInBand --reporters=default --reporters=jest-junit --collectCoverage=true",
39
39
  "typeorm": "typeorm-ts-node-commonjs",
40
40
  "lint": "eslint \"./src/**\"",
41
41
  "lint-fix": "eslint \"./src/**\" --fix",
@@ -43,7 +43,7 @@
43
43
  "build-dev": "webpack --mode=development",
44
44
  "build": "webpack --mode=production",
45
45
  "copydistfolder": "./scripts/copyDistFolder.sh",
46
- "schema-sync": "yarn typeorm schema:drop --dataSource ./data-source.ts && yarn typeorm schema:sync --dataSource ./data-source.ts && yarn typeorm migration:run --dataSource ./data-source.ts"
46
+ "schema-sync": "git update-index --skip-worktree test/utils/setEnvVars.ts && yarn typeorm schema:drop --dataSource ./data-source.ts && yarn typeorm schema:sync --dataSource ./data-source.ts && yarn typeorm migration:run --dataSource ./data-source.ts"
47
47
  },
48
48
  "author": "Spytec",
49
49
  "license": "ISC",