@techextensor/tab-core-utility 2.2.158 → 2.2.161

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 (31) hide show
  1. package/esm2022/index.mjs +2 -1
  2. package/esm2022/lib/tab-core-utility/app/constants/api-constants.mjs +2 -1
  3. package/esm2022/lib/tab-core-utility/app/constants/common.mjs +9 -9
  4. package/esm2022/lib/tab-core-utility/app/crud/tab-crud.service.mjs +14 -2
  5. package/esm2022/lib/tab-core-utility/app/enums/query.enum.mjs +3 -1
  6. package/esm2022/lib/tab-core-utility/app/helpers/common/dsq.helpers.mjs +3 -1
  7. package/esm2022/lib/tab-core-utility/app/helpers/common/req-res.helpers.mjs +31 -1
  8. package/esm2022/lib/tab-core-utility/app/models/api-query.class.mjs +3 -1
  9. package/esm2022/lib/tab-core-utility/app/utils/json.util.mjs +46 -1
  10. package/esm2022/lib/tab-core-utility/app/utils/req-res.util.mjs +4 -4
  11. package/esm2022/lib/tab-core-utility/auth/idb-storage.service.mjs +23 -8
  12. package/esm2022/lib/tab-core-utility/auth/local-storage.service.mjs +57 -19
  13. package/esm2022/lib/tab-core-utility/auth/session-storage.service.mjs +57 -19
  14. package/esm2022/lib/tab-core-utility/core/service/encryption.service.mjs +89 -0
  15. package/index.d.ts +1 -0
  16. package/lib/tab-core-utility/app/constants/api-constants.d.ts +1 -0
  17. package/lib/tab-core-utility/app/constants/common.d.ts +2 -1
  18. package/lib/tab-core-utility/app/crud/tab-crud.service.d.ts +1 -0
  19. package/lib/tab-core-utility/app/enums/query.enum.d.ts +3 -1
  20. package/lib/tab-core-utility/app/helpers/common/req-res.helpers.d.ts +34 -1
  21. package/lib/tab-core-utility/app/models/api-query.class.d.ts +4 -0
  22. package/lib/tab-core-utility/app/utils/json.util.d.ts +12 -0
  23. package/lib/tab-core-utility/auth/idb-storage.service.d.ts +3 -1
  24. package/lib/tab-core-utility/auth/local-storage.service.d.ts +17 -0
  25. package/lib/tab-core-utility/auth/session-storage.service.d.ts +17 -0
  26. package/lib/tab-core-utility/core/service/encryption.service.d.ts +52 -0
  27. package/package.json +3 -2
  28. package/esm2022/lib/tab-core-utility/app/utils/get-api-url.function.mjs +0 -7
  29. package/esm2022/lib/tab-core-utility/core/http-client/injector.service.mjs +0 -20
  30. package/lib/tab-core-utility/app/utils/get-api-url.function.d.ts +0 -1
  31. package/lib/tab-core-utility/core/http-client/injector.service.d.ts +0 -10
@@ -1,4 +1,4 @@
1
- import { APIFilterCriteria, APIValueSets } from '../../models/api-query.class';
1
+ import { APIBulkInsertFieldsValueSets, APIFilterCriteria, APIValueSets } from '../../models/api-query.class';
2
2
  import { QueryType } from '../../enums/query.enum';
3
3
  import * as i0 from "@angular/core";
4
4
  export declare class RequestResponseHelper {
@@ -16,6 +16,22 @@ export declare class RequestResponseHelper {
16
16
  WhereClause: APIFilterCriteria;
17
17
  Values: APIValueSets[];
18
18
  };
19
+ /**
20
+ * Generates the payload for inserting data into a table in bulk
21
+ * @param table The table name to insert data into
22
+ * @param whereClause The filter criteria for the insert operation
23
+ * @param value The value sets to be inserted
24
+ * @param fields Optional list of fields to include in the insert operation
25
+ * @returns The payload for the bulk insert operation
26
+ */
27
+ bulkInsertPayload(table: string, whereClause: APIFilterCriteria, value: APIBulkInsertFieldsValueSets[], fields?: string[]): {
28
+ QueryObjectID: string;
29
+ QueryType: QueryType;
30
+ Joins: never[];
31
+ WhereClause: APIFilterCriteria;
32
+ Values: APIBulkInsertFieldsValueSets[];
33
+ Fields: string[] | undefined;
34
+ };
19
35
  /**
20
36
  * Generates the payload for deleting data from a table
21
37
  * @param tableName The table name to delete data from
@@ -57,6 +73,23 @@ export declare class RequestResponseHelper {
57
73
  WhereClause: APIFilterCriteria;
58
74
  Values: APIValueSets[];
59
75
  };
76
+ /**
77
+ * Creates a payload object for bulk insert operations
78
+ * @param table The table name for the payload
79
+ * @param whereClause The filter criteria for the payload
80
+ * @param value The value sets for the payload
81
+ * @param queryType The type of query for the payload (BulkInsert)
82
+ * @param fields Optional list of fields to include in the insert operation
83
+ * @returns The payload object with QueryObjectID, QueryType, Joins, WhereClause, Values, and Fields
84
+ */
85
+ createBulkInsertPayload(table: string, whereClause: APIFilterCriteria, value: APIBulkInsertFieldsValueSets[], queryType: QueryType, fields?: string[]): {
86
+ QueryObjectID: string;
87
+ QueryType: QueryType;
88
+ Joins: never[];
89
+ WhereClause: APIFilterCriteria;
90
+ Values: APIBulkInsertFieldsValueSets[];
91
+ Fields: string[] | undefined;
92
+ };
60
93
  static ɵfac: i0.ɵɵFactoryDeclaration<RequestResponseHelper, never>;
61
94
  static ɵprov: i0.ɵɵInjectableDeclaration<RequestResponseHelper>;
62
95
  }
@@ -56,6 +56,10 @@ export declare class APIValueSets {
56
56
  AppFieldID: string | any;
57
57
  Value: string | any;
58
58
  }
59
+ export declare class APIBulkInsertFieldsValueSets {
60
+ Fields: string | any;
61
+ Value: string | any;
62
+ }
59
63
  export declare class APISort {
60
64
  ID: string | any;
61
65
  FieldID: string | any;
@@ -10,6 +10,18 @@ export declare function validateJSON(str: string): boolean;
10
10
  * @returns The formatted array
11
11
  */
12
12
  export declare function createDynamicData(obj: any): any;
13
+ /**
14
+ * Returns the values for bulk insert based on the input data array
15
+ * @param {any[]} dataArray The input data array to create bulk insert values from
16
+ * @returns {any[][]} The formatted array of values
17
+ */
18
+ export declare function getBulkInsertValues(dataArray: any): any;
19
+ /**
20
+ * Returns the fields for bulk insert based on the input data array
21
+ * @param {any[]} dataArray The input data array to create bulk insert fields from
22
+ * @returns {string[]} The formatted array of fields
23
+ */
24
+ export declare function getBulkInsertFields(dataArray: any): string[];
13
25
  /**
14
26
  * Removes blank values from the input object
15
27
  * @param dataObj The input object to remove blank values from
@@ -1,9 +1,11 @@
1
+ import { EncryptionService } from '../core/service/encryption.service';
1
2
  import * as i0 from "@angular/core";
2
3
  export declare class IdbService {
4
+ private encryptionService;
3
5
  private readonly dbName;
4
6
  private readonly dbVersion;
5
7
  private dbPromise;
6
- constructor();
8
+ constructor(encryptionService: EncryptionService);
7
9
  setItem(key: string, data: any): Promise<void>;
8
10
  private setItemIndexedDb;
9
11
  getItem(key: string): Promise<any>;
@@ -1,5 +1,9 @@
1
+ import { EncryptionService } from '../core/service/encryption.service';
1
2
  import * as i0 from "@angular/core";
2
3
  export declare class LocalStorageService {
4
+ private encryptionService;
5
+ private cache;
6
+ constructor(encryptionService: EncryptionService);
3
7
  /**
4
8
  * Set data in local storage
5
9
  * @param key - Key to store the data
@@ -18,6 +22,19 @@ export declare class LocalStorageService {
18
22
  */
19
23
  removeLocalStorage: (key: string) => void;
20
24
  clearLocalStorage: () => void;
25
+ /**
26
+ * Encrypts the given data using the encryption service and stores it in local storage.
27
+ *
28
+ * @param key The key to store the data under
29
+ * @param data The data to be stored
30
+ */
31
+ private encryptAndStore;
32
+ /**
33
+ * Removes the data stored in local storage for the given key.
34
+ * This method is used internally by `removeLocalStorage`.
35
+ * @param key The key of the data to be removed
36
+ */
37
+ private removeFromLocalStorage;
21
38
  static ɵfac: i0.ɵɵFactoryDeclaration<LocalStorageService, never>;
22
39
  static ɵprov: i0.ɵɵInjectableDeclaration<LocalStorageService>;
23
40
  }
@@ -1,5 +1,9 @@
1
+ import { EncryptionService } from '../core/service/encryption.service';
1
2
  import * as i0 from "@angular/core";
2
3
  export declare class SessionStorageService {
4
+ private encryptionService;
5
+ private cache;
6
+ constructor(encryptionService: EncryptionService);
3
7
  /**
4
8
  * Set data in session storage
5
9
  * @param key - Key to store the data
@@ -18,6 +22,19 @@ export declare class SessionStorageService {
18
22
  */
19
23
  removeSessionStorage: (key: string) => void;
20
24
  clearSessionStorage: () => void;
25
+ /**
26
+ * Encrypts the given data using the encryption service and stores it in session storage.
27
+ *
28
+ * @param key The key to store the data under
29
+ * @param data The data to be stored
30
+ */
31
+ private encryptAndStore;
32
+ /**
33
+ * Removes the data stored in session storage for the given key.
34
+ * This method is used internally by `removeLocalStorage`.
35
+ * @param key The key of the data to be removed
36
+ */
37
+ private removeFromSessionStorage;
21
38
  static ɵfac: i0.ɵɵFactoryDeclaration<SessionStorageService, never>;
22
39
  static ɵprov: i0.ɵɵInjectableDeclaration<SessionStorageService>;
23
40
  }
@@ -0,0 +1,52 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class EncryptionService {
3
+ private readonly encryptionKey;
4
+ private shouldEncryptCache;
5
+ /**
6
+ * Constructor
7
+ *
8
+ * Generates domain-based key synchronously
9
+ *
10
+ * @param {string} domain - current domain
11
+ * @returns {void}
12
+ */
13
+ constructor();
14
+ /**
15
+ * Encrypts the given string using AES encryption with the encryption key.
16
+ *
17
+ * @param {string} data - The string to be encrypted.
18
+ * @returns {string} The encrypted string.
19
+ */
20
+ encrypt(data: string): string;
21
+ /**
22
+ * Decrypts the given encrypted data using AES decryption with the encryption key.
23
+ *
24
+ * @param {string} encryptedData - The data to be decrypted.
25
+ * @returns {string} The decrypted string.
26
+ */
27
+ decrypt(encryptedData: string): string;
28
+ /**
29
+ * Returns a secure key for the given key.
30
+ * If encryption is enabled, it encrypts the key using SHA-256 and the encryption key.
31
+ *
32
+ * @param {string} key - The key to be secured.
33
+ * @returns {string} The secure key.
34
+ */
35
+ getSecureKey(key: string): string;
36
+ /**
37
+ * Encrypts the given key using SHA-256 and the encryption key.
38
+ *
39
+ * @param {string} key - The key to be encrypted.
40
+ * @returns {string} The encrypted key (16 characters long).
41
+ */
42
+ private encryptKey;
43
+ /**
44
+ * Determines whether encryption should be applied based on the environment.
45
+ * Caches the result to avoid repeated checks.
46
+ *
47
+ * @returns {boolean} True if encryption should be applied, false otherwise.
48
+ */
49
+ shouldEncrypt(): boolean;
50
+ static ɵfac: i0.ɵɵFactoryDeclaration<EncryptionService, never>;
51
+ static ɵprov: i0.ɵɵInjectableDeclaration<EncryptionService>;
52
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@techextensor/tab-core-utility",
3
- "version": "2.2.158",
3
+ "version": "2.2.161",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^17.3.0",
6
6
  "@angular/core": "^17.3.0",
@@ -9,7 +9,8 @@
9
9
  "ngx-toastr": "^19.0.0",
10
10
  "rxjs": "^7.8.1",
11
11
  "idb": "^8.0.0",
12
- "liquidjs": "^10.12.0"
12
+ "liquidjs": "^10.12.0",
13
+ "cypress": "^13.6.6"
13
14
  },
14
15
  "dependencies": {
15
16
  "tslib": "^2.3.0"
@@ -1,7 +0,0 @@
1
- import { InjectorService } from '../../core/http-client/injector.service';
2
- import { API_URL } from '../../core/http-client/api-url.token';
3
- export function getApiUrl() {
4
- const injector = InjectorService.instance.getInjector();
5
- return injector.get(API_URL);
6
- }
7
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0LWFwaS11cmwuZnVuY3Rpb24uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi9saWJzL2RhdGEtYWNjZXNzL3NyYy9saWIvdGFiLWNvcmUtdXRpbGl0eS9hcHAvdXRpbHMvZ2V0LWFwaS11cmwuZnVuY3Rpb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLGVBQWUsRUFBRSxNQUFNLHlDQUF5QyxDQUFDO0FBQzFFLE9BQU8sRUFBRSxPQUFPLEVBQUUsTUFBTSxzQ0FBc0MsQ0FBQztBQUUvRCxNQUFNLFVBQVUsU0FBUztJQUN2QixNQUFNLFFBQVEsR0FBRyxlQUFlLENBQUMsUUFBUSxDQUFDLFdBQVcsRUFBRSxDQUFDO0lBQ3hELE9BQU8sUUFBUSxDQUFDLEdBQUcsQ0FBQyxPQUFPLENBQUMsQ0FBQztBQUMvQixDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgSW5qZWN0b3JTZXJ2aWNlIH0gZnJvbSAnLi4vLi4vY29yZS9odHRwLWNsaWVudC9pbmplY3Rvci5zZXJ2aWNlJztcbmltcG9ydCB7IEFQSV9VUkwgfSBmcm9tICcuLi8uLi9jb3JlL2h0dHAtY2xpZW50L2FwaS11cmwudG9rZW4nO1xuXG5leHBvcnQgZnVuY3Rpb24gZ2V0QXBpVXJsKCk6IHN0cmluZyB7XG4gIGNvbnN0IGluamVjdG9yID0gSW5qZWN0b3JTZXJ2aWNlLmluc3RhbmNlLmdldEluamVjdG9yKCk7XG4gIHJldHVybiBpbmplY3Rvci5nZXQoQVBJX1VSTCk7XG59Il19
@@ -1,20 +0,0 @@
1
- import { Injectable, Injector } from '@angular/core';
2
- import * as i0 from "@angular/core";
3
- export class InjectorService {
4
- constructor(injector) {
5
- this.injector = injector;
6
- InjectorService.instance = this;
7
- }
8
- getInjector() {
9
- return this.injector;
10
- }
11
- static { this.ɵfac = function InjectorService_Factory(t) { return new (t || InjectorService)(i0.ɵɵinject(i0.Injector)); }; }
12
- static { this.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: InjectorService, factory: InjectorService.ɵfac, providedIn: 'root' }); }
13
- }
14
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(InjectorService, [{
15
- type: Injectable,
16
- args: [{
17
- providedIn: 'root'
18
- }]
19
- }], () => [{ type: i0.Injector }], null); })();
20
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5qZWN0b3Iuc2VydmljZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uL2xpYnMvZGF0YS1hY2Nlc3Mvc3JjL2xpYi90YWItY29yZS11dGlsaXR5L2NvcmUvaHR0cC1jbGllbnQvaW5qZWN0b3Iuc2VydmljZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsVUFBVSxFQUFFLFFBQVEsRUFBRSxNQUFNLGVBQWUsQ0FBQzs7QUFLckQsTUFBTSxPQUFPLGVBQWU7SUFHMUIsWUFBb0IsUUFBa0I7UUFBbEIsYUFBUSxHQUFSLFFBQVEsQ0FBVTtRQUNwQyxlQUFlLENBQUMsUUFBUSxHQUFHLElBQUksQ0FBQztJQUNsQyxDQUFDO0lBRUQsV0FBVztRQUNULE9BQU8sSUFBSSxDQUFDLFFBQVEsQ0FBQztJQUN2QixDQUFDO2dGQVRVLGVBQWU7dUVBQWYsZUFBZSxXQUFmLGVBQWUsbUJBRmQsTUFBTTs7aUZBRVAsZUFBZTtjQUgzQixVQUFVO2VBQUM7Z0JBQ1YsVUFBVSxFQUFFLE1BQU07YUFDbkIiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBJbmplY3RhYmxlLCBJbmplY3RvciB9IGZyb20gJ0Bhbmd1bGFyL2NvcmUnO1xuXG5ASW5qZWN0YWJsZSh7XG4gIHByb3ZpZGVkSW46ICdyb290J1xufSlcbmV4cG9ydCBjbGFzcyBJbmplY3RvclNlcnZpY2Uge1xuICBzdGF0aWMgaW5zdGFuY2U6IEluamVjdG9yU2VydmljZTtcblxuICBjb25zdHJ1Y3Rvcihwcml2YXRlIGluamVjdG9yOiBJbmplY3Rvcikge1xuICAgIEluamVjdG9yU2VydmljZS5pbnN0YW5jZSA9IHRoaXM7XG4gIH1cblxuICBnZXRJbmplY3RvcigpOiBJbmplY3RvciB7XG4gICAgcmV0dXJuIHRoaXMuaW5qZWN0b3I7XG4gIH1cbn0iXX0=
@@ -1 +0,0 @@
1
- export declare function getApiUrl(): string;
@@ -1,10 +0,0 @@
1
- import { Injector } from '@angular/core';
2
- import * as i0 from "@angular/core";
3
- export declare class InjectorService {
4
- private injector;
5
- static instance: InjectorService;
6
- constructor(injector: Injector);
7
- getInjector(): Injector;
8
- static ɵfac: i0.ɵɵFactoryDeclaration<InjectorService, never>;
9
- static ɵprov: i0.ɵɵInjectableDeclaration<InjectorService>;
10
- }