@techextensor/tab-sdk 0.0.50 → 0.0.51
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.
- package/fesm2022/techextensor-tab-sdk.mjs +133 -81
- package/fesm2022/techextensor-tab-sdk.mjs.map +1 -1
- package/lib/crud/crud.service.d.ts +31 -18
- package/lib/enum/crud.enum.d.ts +14 -0
- package/lib/interface/crud.interface.d.ts +85 -0
- package/lib/ui/form.service.d.ts +10 -1
- package/package.json +2 -2
- package/public-api.d.ts +2 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { APISelectQuery, CommonApiResponse, DeletePayload, GetPayload, InsertPayload, UpdatePayload, ImprotDataPayload, RcordHistoryPayload, SearchDataPayload, executeStoredProcedurePayload } from '@techextensor/tab-core-utility';
|
|
2
|
+
import { CrudOptions } from '../interface/crud.interface';
|
|
2
3
|
import * as i0 from "@angular/core";
|
|
3
4
|
export declare class CrudService {
|
|
4
5
|
private readonly _tabCrudService;
|
|
@@ -15,34 +16,34 @@ export declare class CrudService {
|
|
|
15
16
|
* Inserts a record into the database using the provided payload.
|
|
16
17
|
*
|
|
17
18
|
* @param payload - The payload containing information to insert the record.
|
|
18
|
-
* @param
|
|
19
|
+
* @param optionsOrHeaders - Optional CrudOptions object with headers and notify config, or legacy headers object.
|
|
19
20
|
* @returns A promise that resolves to a common API response containing the inserted record.
|
|
20
21
|
*/
|
|
21
|
-
insert(payload: InsertPayload,
|
|
22
|
+
insert(payload: InsertPayload, optionsOrHeaders?: CrudOptions): Promise<CommonApiResponse>;
|
|
22
23
|
/**
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
bulkInsert(payload: InsertPayload,
|
|
24
|
+
* Inserts multiple records into the database using the provided payload.
|
|
25
|
+
*
|
|
26
|
+
* @param payload - The payload containing information to insert multiple records.
|
|
27
|
+
* @param optionsOrHeaders - Optional CrudOptions object with headers and notify config, or legacy headers object.
|
|
28
|
+
* @returns A promise that resolves to a common API response containing the inserted records.
|
|
29
|
+
*/
|
|
30
|
+
bulkInsert(payload: InsertPayload, optionsOrHeaders?: CrudOptions): Promise<CommonApiResponse>;
|
|
30
31
|
/**
|
|
31
32
|
* Updates a record in the database using the provided payload.
|
|
32
33
|
*
|
|
33
34
|
* @param payload - The payload containing information to update the record.
|
|
34
|
-
* @param
|
|
35
|
+
* @param optionsOrHeaders - Optional CrudOptions object with headers and notify config, or legacy headers object.
|
|
35
36
|
* @returns A promise that resolves to a common API response containing the updated record.
|
|
36
37
|
*/
|
|
37
|
-
update(payload: UpdatePayload,
|
|
38
|
+
update(payload: UpdatePayload, optionsOrHeaders?: CrudOptions): Promise<CommonApiResponse>;
|
|
38
39
|
/**
|
|
39
40
|
* Deletes a record from the database using the provided payload.
|
|
40
41
|
*
|
|
41
42
|
* @param payload - The payload containing information to delete the record.
|
|
42
|
-
* @param
|
|
43
|
+
* @param optionsOrHeaders - Optional CrudOptions object with headers and notify config, or legacy headers object.
|
|
43
44
|
* @returns A promise that resolves to a common API response containing the deleted record.
|
|
44
45
|
*/
|
|
45
|
-
delete(payload: DeletePayload,
|
|
46
|
+
delete(payload: DeletePayload, optionsOrHeaders?: CrudOptions): Promise<CommonApiResponse>;
|
|
46
47
|
/**
|
|
47
48
|
* Executes a stored procedure using the provided payload.
|
|
48
49
|
*
|
|
@@ -70,8 +71,7 @@ export declare class CrudService {
|
|
|
70
71
|
/**
|
|
71
72
|
* Gets the search data using the provided search query and limit.
|
|
72
73
|
*
|
|
73
|
-
* @param
|
|
74
|
-
* @param limit - The number of records to limit the results to.
|
|
74
|
+
* @param payload - The payload containing search query and limit.
|
|
75
75
|
* @param parameters - Optional parameters to pass to the search query.
|
|
76
76
|
* @returns A promise that resolves to a common API response containing the search data.
|
|
77
77
|
*/
|
|
@@ -79,18 +79,31 @@ export declare class CrudService {
|
|
|
79
79
|
/**
|
|
80
80
|
* Retrieves the history of records for a specified app object.
|
|
81
81
|
*
|
|
82
|
-
* @param
|
|
83
|
-
* @param recordIds - An array of record IDs to retrieve the history for.
|
|
82
|
+
* @param payload - The payload containing app object ID and record IDs.
|
|
84
83
|
* @returns A promise that resolves to a common API response containing the record history.
|
|
85
84
|
*/
|
|
86
85
|
getRecordHistory(payload: RcordHistoryPayload): Promise<CommonApiResponse>;
|
|
87
86
|
/**
|
|
88
87
|
* Imports data into the database.
|
|
89
88
|
*
|
|
90
|
-
* @param
|
|
89
|
+
* @param payload - The data to import.
|
|
91
90
|
* @returns A promise that resolves to a common API response containing the result of importing the data.
|
|
92
91
|
*/
|
|
93
92
|
import(payload: ImprotDataPayload): Promise<any>;
|
|
93
|
+
/**
|
|
94
|
+
* Handles notification display after a CRUD operation.
|
|
95
|
+
*
|
|
96
|
+
* Default behavior:
|
|
97
|
+
* - Success: auto-shown with operation-specific message (e.g., "Record Created Successfully")
|
|
98
|
+
* - Error: NOT shown (interceptor handles errors globally)
|
|
99
|
+
*
|
|
100
|
+
* Can be customized via CrudNotificationOptions:
|
|
101
|
+
* - `silent: true` - suppresses all notifications
|
|
102
|
+
* - `success: false` - suppresses success only
|
|
103
|
+
* - `success: { message, title, configuration }` - custom success notification
|
|
104
|
+
* - `error: { message, title, configuration }` - custom error notification (overrides interceptor)
|
|
105
|
+
*/
|
|
106
|
+
private handleNotification;
|
|
94
107
|
static ɵfac: i0.ɵɵFactoryDeclaration<CrudService, never>;
|
|
95
108
|
static ɵprov: i0.ɵɵInjectableDeclaration<CrudService>;
|
|
96
109
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CRUD operation types used internally by the SDK
|
|
3
|
+
* to determine default success messages and notification behavior.
|
|
4
|
+
*/
|
|
5
|
+
export declare enum CrudOperationType {
|
|
6
|
+
Insert = "insert",
|
|
7
|
+
Update = "update",
|
|
8
|
+
Delete = "delete",
|
|
9
|
+
ProcessRequest = "processRequest"
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Default success messages shown after each CRUD operation.
|
|
13
|
+
*/
|
|
14
|
+
export declare const CRUD_DEFAULT_SUCCESS_MESSAGES: Record<CrudOperationType, string>;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { IndividualConfig } from 'ngx-toastr';
|
|
2
|
+
/**
|
|
3
|
+
* Notification configuration for a single notification type (success or error).
|
|
4
|
+
*
|
|
5
|
+
* Supports full ngx-toastr IndividualConfig for toast customization
|
|
6
|
+
* (timeOut, positionClass, progressBar, closeButton, etc.)
|
|
7
|
+
*/
|
|
8
|
+
export interface CrudNotificationConfig {
|
|
9
|
+
/** Override the default notification message */
|
|
10
|
+
message?: string;
|
|
11
|
+
/** Override the default notification title */
|
|
12
|
+
title?: string;
|
|
13
|
+
/** Full ngx-toastr configuration for toast customization */
|
|
14
|
+
configuration?: Partial<IndividualConfig<any>>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Options to control automatic notifications after CRUD operations.
|
|
18
|
+
*
|
|
19
|
+
* By default:
|
|
20
|
+
* - Success notifications are ENABLED (auto-shown on StatusCode 200)
|
|
21
|
+
* - Error notifications are DISABLED (already handled by the API interceptor)
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* // Default behavior — auto success, no error (interceptor handles it)
|
|
26
|
+
* await TabSdk.crud.insert({ ... });
|
|
27
|
+
*
|
|
28
|
+
* // Custom success message
|
|
29
|
+
* await TabSdk.crud.insert(payload, {
|
|
30
|
+
* notify: { success: { message: 'User registered!', title: 'Welcome' } }
|
|
31
|
+
* });
|
|
32
|
+
*
|
|
33
|
+
* // Silent — no success notification
|
|
34
|
+
* await TabSdk.crud.insert(payload, { notify: { silent: true } });
|
|
35
|
+
*
|
|
36
|
+
* // Suppress only success, keep default error handling
|
|
37
|
+
* await TabSdk.crud.delete(payload, { notify: { success: false } });
|
|
38
|
+
*
|
|
39
|
+
* // Custom error notification (overrides interceptor for this call)
|
|
40
|
+
* await TabSdk.crud.update(payload, {
|
|
41
|
+
* notify: { error: { message: 'Could not save changes' } }
|
|
42
|
+
* });
|
|
43
|
+
*
|
|
44
|
+
* // Full toast customization
|
|
45
|
+
* await TabSdk.crud.update(payload, {
|
|
46
|
+
* notify: {
|
|
47
|
+
* success: {
|
|
48
|
+
* message: 'Saved!',
|
|
49
|
+
* configuration: { timeOut: 2000, positionClass: 'toast-top-center' }
|
|
50
|
+
* }
|
|
51
|
+
* }
|
|
52
|
+
* });
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export interface CrudNotificationOptions {
|
|
56
|
+
/**
|
|
57
|
+
* When true, suppresses both success and error notifications.
|
|
58
|
+
* Useful for background/silent operations (e.g., toggling favorites).
|
|
59
|
+
*/
|
|
60
|
+
silent?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Success notification configuration.
|
|
63
|
+
* - `undefined` (default): auto-shows default success message (e.g., "Record Created Successfully")
|
|
64
|
+
* - `false`: suppresses success notification
|
|
65
|
+
* - `CrudNotificationConfig`: shows custom success notification
|
|
66
|
+
*/
|
|
67
|
+
success?: CrudNotificationConfig | false;
|
|
68
|
+
/**
|
|
69
|
+
* Error notification configuration.
|
|
70
|
+
* - `undefined` (default): no error notification (interceptor handles it globally)
|
|
71
|
+
* - `false`: explicitly suppresses error notification
|
|
72
|
+
* - `CrudNotificationConfig`: shows custom error notification (overrides interceptor for this call)
|
|
73
|
+
*/
|
|
74
|
+
error?: CrudNotificationConfig | false;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Extended options for CRUD operations.
|
|
78
|
+
* Pass as the second argument to TabSdk.crud.insert/update/delete.
|
|
79
|
+
*/
|
|
80
|
+
export interface CrudOptions {
|
|
81
|
+
/** Optional HTTP headers to pass to the server */
|
|
82
|
+
headers?: any;
|
|
83
|
+
/** Notification options to control automatic success/error popups */
|
|
84
|
+
notify?: CrudNotificationOptions;
|
|
85
|
+
}
|
package/lib/ui/form.service.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BuildFormComponentType, CommonApiResponse, GetScreenConfig, ProcessRequestPayload, TemplateParsePayload } from '@techextensor/tab-core-utility';
|
|
2
|
+
import { CrudOptions } from '../interface/crud.interface';
|
|
2
3
|
import * as i0 from "@angular/core";
|
|
3
4
|
export declare class FormService {
|
|
4
5
|
private readonly _tabFormioService;
|
|
@@ -23,9 +24,10 @@ export declare class FormService {
|
|
|
23
24
|
* Processes a request using the provided request payload.
|
|
24
25
|
*
|
|
25
26
|
* @param requestPayload The payload to be processed.
|
|
27
|
+
* @param options - Optional CrudOptions object with headers and notify config.
|
|
26
28
|
* @returns A promise of the response from the server.
|
|
27
29
|
*/
|
|
28
|
-
processRequest(requestPayload: ProcessRequestPayload): Promise<CommonApiResponse>;
|
|
30
|
+
processRequest(requestPayload: ProcessRequestPayload, options?: CrudOptions): Promise<CommonApiResponse>;
|
|
29
31
|
/**
|
|
30
32
|
* Builds Form.io components for the specified app object ID and type.
|
|
31
33
|
*
|
|
@@ -42,6 +44,13 @@ export declare class FormService {
|
|
|
42
44
|
* @returns A promise of the response from the server.
|
|
43
45
|
*/
|
|
44
46
|
parseTemplate(requestPayload: TemplateParsePayload, onFailedParseOnServer?: boolean): Promise<CommonApiResponse>;
|
|
47
|
+
/**
|
|
48
|
+
* Handles notification display after a process request operation.
|
|
49
|
+
* Same behavior as CrudService notifications:
|
|
50
|
+
* - Success: auto-shown by default
|
|
51
|
+
* - Error: NOT shown by default (interceptor handles)
|
|
52
|
+
*/
|
|
53
|
+
private handleNotification;
|
|
45
54
|
static ɵfac: i0.ɵɵFactoryDeclaration<FormService, never>;
|
|
46
55
|
static ɵprov: i0.ɵɵInjectableDeclaration<FormService>;
|
|
47
56
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@techextensor/tab-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.51",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@angular/common": "^19.2.15",
|
|
6
6
|
"@angular/core": "^19.2.15",
|
|
7
|
-
"@techextensor/tab-core-utility": "2.2.
|
|
7
|
+
"@techextensor/tab-core-utility": "2.2.191"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"tslib": "^2.8.1"
|
package/public-api.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export * from './lib/tab-sdk.service';
|
|
2
2
|
export * from './lib/enum/ui.enum';
|
|
3
3
|
export * from './lib/enum/store.enum';
|
|
4
|
+
export * from './lib/enum/crud.enum';
|
|
4
5
|
export * from './lib/interface/ui.interface';
|
|
5
6
|
export * from './lib/interface/http.interface';
|
|
6
7
|
export * from './lib/interface/state.interface';
|
|
8
|
+
export * from './lib/interface/crud.interface';
|