@techextensor/tab-sdk 0.0.51 → 0.0.53
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 +31 -83
- package/fesm2022/techextensor-tab-sdk.mjs.map +1 -1
- package/lib/app/analytics.service.d.ts +1 -1
- package/lib/app/file.service.d.ts +1 -1
- package/lib/crud/crud.service.d.ts +7 -14
- package/lib/interface/crud.interface.d.ts +12 -72
- package/lib/ui/form.service.d.ts +1 -3
- package/lib/workflow/transition.service.d.ts +2 -2
- package/package.json +2 -2
|
@@ -503,7 +503,7 @@ class FormService {
|
|
|
503
503
|
*/
|
|
504
504
|
async processRequest(requestPayload, options) {
|
|
505
505
|
const response = await firstValueFrom(this._tabFormioService.processRequest(requestPayload));
|
|
506
|
-
this.handleNotification(response, options?.
|
|
506
|
+
this.handleNotification(response, options?.skipDefaultToast, CrudOperationType.ProcessRequest);
|
|
507
507
|
return response;
|
|
508
508
|
}
|
|
509
509
|
/**
|
|
@@ -534,35 +534,15 @@ class FormService {
|
|
|
534
534
|
}
|
|
535
535
|
/**
|
|
536
536
|
* Handles notification display after a process request operation.
|
|
537
|
-
*
|
|
538
|
-
* - Success: auto-shown by default
|
|
539
|
-
* - Error: NOT shown by default (interceptor handles)
|
|
537
|
+
* Default: auto-shows success toast. When skipDefaultToast is true, no toast is shown.
|
|
540
538
|
*/
|
|
541
|
-
handleNotification(response,
|
|
542
|
-
if (
|
|
539
|
+
handleNotification(response, skipDefaultToast, operation) {
|
|
540
|
+
if (skipDefaultToast)
|
|
543
541
|
return;
|
|
544
|
-
const isSuccess = response?.
|
|
545
|
-
const hasErrors = response?.Errors?.length > 0;
|
|
542
|
+
const isSuccess = response?.IsSuccess === true;
|
|
546
543
|
if (isSuccess) {
|
|
547
|
-
const successOpt = notify?.success;
|
|
548
|
-
if (successOpt === false)
|
|
549
|
-
return;
|
|
550
|
-
const successConfig = typeof successOpt === 'object' ? successOpt : undefined;
|
|
551
544
|
TabSdk.ui.showSuccess({
|
|
552
|
-
message:
|
|
553
|
-
...(successConfig?.title ? { title: successConfig.title } : {}),
|
|
554
|
-
...(successConfig?.configuration ? { configuration: successConfig.configuration } : {})
|
|
555
|
-
});
|
|
556
|
-
}
|
|
557
|
-
else if (hasErrors) {
|
|
558
|
-
const errorOpt = notify?.error;
|
|
559
|
-
if (!errorOpt)
|
|
560
|
-
return;
|
|
561
|
-
const errorConfig = errorOpt;
|
|
562
|
-
TabSdk.ui.showError({
|
|
563
|
-
message: errorConfig.message || response.Errors[0],
|
|
564
|
-
...(errorConfig.title ? { title: errorConfig.title } : {}),
|
|
565
|
-
...(errorConfig.configuration ? { configuration: errorConfig.configuration } : {})
|
|
545
|
+
message: CRUD_DEFAULT_SUCCESS_MESSAGES[operation] || 'Success',
|
|
566
546
|
});
|
|
567
547
|
}
|
|
568
548
|
}
|
|
@@ -584,9 +564,9 @@ class TransitionService {
|
|
|
584
564
|
* @param payload - The payload containing information to determine the next status.
|
|
585
565
|
* @returns A promise that resolves to the common API response.
|
|
586
566
|
*/
|
|
587
|
-
async getNextStatus(payload) {
|
|
567
|
+
async getNextStatus(payload, headers) {
|
|
588
568
|
// Await the response from the getNextStatus method of the tabBlueprintService
|
|
589
|
-
const response = await firstValueFrom(this._tabBlueprintService.getNextStatus(payload));
|
|
569
|
+
const response = await firstValueFrom(this._tabBlueprintService.getNextStatus(payload, headers));
|
|
590
570
|
// Return the obtained response
|
|
591
571
|
return response;
|
|
592
572
|
}
|
|
@@ -596,8 +576,8 @@ class TransitionService {
|
|
|
596
576
|
* @param payload - The payload containing information to update the status.
|
|
597
577
|
* @returns A promise that resolves to the common API response.
|
|
598
578
|
*/
|
|
599
|
-
async updateStatus(payload) {
|
|
600
|
-
const response = await firstValueFrom(TabSdk.util?.updateStatus(payload));
|
|
579
|
+
async updateStatus(payload, headers) {
|
|
580
|
+
const response = await firstValueFrom(TabSdk.util?.updateStatus(payload, undefined, headers));
|
|
601
581
|
// Return the obtained response
|
|
602
582
|
return response;
|
|
603
583
|
}
|
|
@@ -804,9 +784,9 @@ class FileService {
|
|
|
804
784
|
* @param mediaId The ID of the media file to remove.
|
|
805
785
|
* @returns A promise that resolves to a common API response.
|
|
806
786
|
*/
|
|
807
|
-
async removeMediaFile(mediaId) {
|
|
787
|
+
async removeMediaFile(mediaId, headers) {
|
|
808
788
|
// Use the firstValueFrom RxJs operator to wait for the observable to complete
|
|
809
|
-
const response = await firstValueFrom(this._mediaUploadHelper.removeMediaFile(mediaId));
|
|
789
|
+
const response = await firstValueFrom(this._mediaUploadHelper.removeMediaFile(mediaId, headers));
|
|
810
790
|
// Return the response from the server
|
|
811
791
|
return response;
|
|
812
792
|
}
|
|
@@ -970,9 +950,9 @@ class AnalyticsService {
|
|
|
970
950
|
* @param payload The screen performance payload containing the statistics to be inserted.
|
|
971
951
|
* @returns A promise that resolves to a common API response containing the result of the insertion.
|
|
972
952
|
*/
|
|
973
|
-
async insertScreenPerformance(payload) {
|
|
953
|
+
async insertScreenPerformance(payload, headers) {
|
|
974
954
|
// Use the firstValueFrom RxJs operator to wait for the observable to complete
|
|
975
|
-
const response = await firstValueFrom(this._appHelper.insertScreenPerformanceStatistics(payload));
|
|
955
|
+
const response = await firstValueFrom(this._appHelper.insertScreenPerformanceStatistics(payload, headers));
|
|
976
956
|
// Return the response from the server
|
|
977
957
|
return response;
|
|
978
958
|
}
|
|
@@ -1082,7 +1062,7 @@ class CrudService {
|
|
|
1082
1062
|
*/
|
|
1083
1063
|
async insert(payload, optionsOrHeaders) {
|
|
1084
1064
|
const response = await firstValueFrom(this._tabCrudService.insert(payload, optionsOrHeaders?.headers));
|
|
1085
|
-
this.handleNotification(response, optionsOrHeaders?.
|
|
1065
|
+
this.handleNotification(response, optionsOrHeaders?.skipDefaultToast, CrudOperationType.Insert);
|
|
1086
1066
|
return response;
|
|
1087
1067
|
}
|
|
1088
1068
|
/**
|
|
@@ -1094,7 +1074,7 @@ class CrudService {
|
|
|
1094
1074
|
*/
|
|
1095
1075
|
async bulkInsert(payload, optionsOrHeaders) {
|
|
1096
1076
|
const response = await firstValueFrom(this._tabCrudService.bulkInsert(payload, optionsOrHeaders?.headers));
|
|
1097
|
-
this.handleNotification(response, optionsOrHeaders?.
|
|
1077
|
+
this.handleNotification(response, optionsOrHeaders?.skipDefaultToast, CrudOperationType.Insert);
|
|
1098
1078
|
return response;
|
|
1099
1079
|
}
|
|
1100
1080
|
/**
|
|
@@ -1106,7 +1086,7 @@ class CrudService {
|
|
|
1106
1086
|
*/
|
|
1107
1087
|
async update(payload, optionsOrHeaders) {
|
|
1108
1088
|
const response = await firstValueFrom(this._tabCrudService.update(payload, optionsOrHeaders?.headers));
|
|
1109
|
-
this.handleNotification(response, optionsOrHeaders?.
|
|
1089
|
+
this.handleNotification(response, optionsOrHeaders?.skipDefaultToast, CrudOperationType.Update);
|
|
1110
1090
|
return response;
|
|
1111
1091
|
}
|
|
1112
1092
|
/**
|
|
@@ -1118,7 +1098,7 @@ class CrudService {
|
|
|
1118
1098
|
*/
|
|
1119
1099
|
async delete(payload, optionsOrHeaders) {
|
|
1120
1100
|
const response = await firstValueFrom(this._tabCrudService.delete(payload, optionsOrHeaders?.headers));
|
|
1121
|
-
this.handleNotification(response, optionsOrHeaders?.
|
|
1101
|
+
this.handleNotification(response, optionsOrHeaders?.skipDefaultToast, CrudOperationType.Delete);
|
|
1122
1102
|
return response;
|
|
1123
1103
|
}
|
|
1124
1104
|
/**
|
|
@@ -1139,8 +1119,8 @@ class CrudService {
|
|
|
1139
1119
|
* @param parameters - Optional parameters to pass to the select query.
|
|
1140
1120
|
* @returns A promise that resolves to a common API response containing the result of executing the select query.
|
|
1141
1121
|
*/
|
|
1142
|
-
async executeSelectQuery(selectQueryId, parameters, additionalConfig) {
|
|
1143
|
-
const response = await firstValueFrom(this._tabGetService.executeSelectQueryById(selectQueryId, parameters, additionalConfig));
|
|
1122
|
+
async executeSelectQuery(selectQueryId, parameters, additionalConfig, headers) {
|
|
1123
|
+
const response = await firstValueFrom(this._tabGetService.executeSelectQueryById(selectQueryId, parameters, additionalConfig, headers));
|
|
1144
1124
|
return response;
|
|
1145
1125
|
}
|
|
1146
1126
|
/**
|
|
@@ -1150,8 +1130,8 @@ class CrudService {
|
|
|
1150
1130
|
* @param parameters - Optional parameters to pass to the select query.
|
|
1151
1131
|
* @returns A promise that resolves to a common API response containing the result of executing the select query.
|
|
1152
1132
|
*/
|
|
1153
|
-
async executeSelectExecutor(data, parameters) {
|
|
1154
|
-
const response = await firstValueFrom(this._tabGetService.selectExecutor(data, parameters));
|
|
1133
|
+
async executeSelectExecutor(data, parameters, headers) {
|
|
1134
|
+
const response = await firstValueFrom(this._tabGetService.selectExecutor(data, parameters, undefined, headers));
|
|
1155
1135
|
return response;
|
|
1156
1136
|
}
|
|
1157
1137
|
/**
|
|
@@ -1171,8 +1151,8 @@ class CrudService {
|
|
|
1171
1151
|
* @param payload - The payload containing app object ID and record IDs.
|
|
1172
1152
|
* @returns A promise that resolves to a common API response containing the record history.
|
|
1173
1153
|
*/
|
|
1174
|
-
async getRecordHistory(payload) {
|
|
1175
|
-
const response = await firstValueFrom(this._tabGetService.getHistory(payload));
|
|
1154
|
+
async getRecordHistory(payload, headers) {
|
|
1155
|
+
const response = await firstValueFrom(this._tabGetService.getHistory(payload, headers));
|
|
1176
1156
|
return response;
|
|
1177
1157
|
}
|
|
1178
1158
|
/**
|
|
@@ -1182,54 +1162,22 @@ class CrudService {
|
|
|
1182
1162
|
* @returns A promise that resolves to a common API response containing the result of importing the data.
|
|
1183
1163
|
*/
|
|
1184
1164
|
async import(payload) {
|
|
1185
|
-
const response = await firstValueFrom(
|
|
1186
|
-
// Call the pmjayImport method of the TabGetService and pass the data to import
|
|
1187
|
-
this._tabGetService.pmjayImport(payload));
|
|
1188
|
-
// Return the response from the server
|
|
1165
|
+
const response = await firstValueFrom(this._tabGetService.importData(payload));
|
|
1189
1166
|
return response;
|
|
1190
1167
|
}
|
|
1191
1168
|
/**
|
|
1192
1169
|
* Handles notification display after a CRUD operation.
|
|
1193
1170
|
*
|
|
1194
|
-
* Default behavior:
|
|
1195
|
-
*
|
|
1196
|
-
* - Error: NOT shown (interceptor handles errors globally)
|
|
1197
|
-
*
|
|
1198
|
-
* Can be customized via CrudNotificationOptions:
|
|
1199
|
-
* - `silent: true` - suppresses all notifications
|
|
1200
|
-
* - `success: false` - suppresses success only
|
|
1201
|
-
* - `success: { message, title, configuration }` - custom success notification
|
|
1202
|
-
* - `error: { message, title, configuration }` - custom error notification (overrides interceptor)
|
|
1171
|
+
* Default behavior: auto-shows success toast with operation-specific message.
|
|
1172
|
+
* When skipDefaultToast is true, no toast is shown — caller handles it via TabSdk.ui.showSuccess().
|
|
1203
1173
|
*/
|
|
1204
|
-
handleNotification(response,
|
|
1205
|
-
|
|
1206
|
-
if (notify?.silent)
|
|
1174
|
+
handleNotification(response, skipDefaultToast, operation) {
|
|
1175
|
+
if (skipDefaultToast)
|
|
1207
1176
|
return;
|
|
1208
|
-
const isSuccess = response?.
|
|
1209
|
-
const hasErrors = response?.Errors?.length > 0;
|
|
1177
|
+
const isSuccess = response?.IsSuccess === true;
|
|
1210
1178
|
if (isSuccess) {
|
|
1211
|
-
// Success notification: shown by default, unless explicitly suppressed
|
|
1212
|
-
const successOpt = notify?.success;
|
|
1213
|
-
if (successOpt === false)
|
|
1214
|
-
return;
|
|
1215
|
-
const successConfig = typeof successOpt === 'object' ? successOpt : undefined;
|
|
1216
1179
|
TabSdk.ui.showSuccess({
|
|
1217
|
-
message:
|
|
1218
|
-
...(successConfig?.title ? { title: successConfig.title } : {}),
|
|
1219
|
-
...(successConfig?.configuration ? { configuration: successConfig.configuration } : {})
|
|
1220
|
-
});
|
|
1221
|
-
}
|
|
1222
|
-
else if (hasErrors) {
|
|
1223
|
-
// Error notification: NOT shown by default (interceptor handles it)
|
|
1224
|
-
// Only shown if user explicitly provides error config
|
|
1225
|
-
const errorOpt = notify?.error;
|
|
1226
|
-
if (!errorOpt)
|
|
1227
|
-
return;
|
|
1228
|
-
const errorConfig = errorOpt;
|
|
1229
|
-
TabSdk.ui.showError({
|
|
1230
|
-
message: errorConfig.message || response.Errors[0],
|
|
1231
|
-
...(errorConfig.title ? { title: errorConfig.title } : {}),
|
|
1232
|
-
...(errorConfig.configuration ? { configuration: errorConfig.configuration } : {})
|
|
1180
|
+
message: CRUD_DEFAULT_SUCCESS_MESSAGES[operation],
|
|
1233
1181
|
});
|
|
1234
1182
|
}
|
|
1235
1183
|
}
|