@messaia/cdk 22.0.1-rc.8 → 22.0.1-rc.9
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/messaia-cdk.mjs +69 -120
- package/fesm2022/messaia-cdk.mjs.map +1 -1
- package/package.json +1 -1
- package/types/messaia-cdk.d.ts +175 -0
package/fesm2022/messaia-cdk.mjs
CHANGED
|
@@ -15015,72 +15015,39 @@ class GenericService {
|
|
|
15015
15015
|
getListAsObservable() {
|
|
15016
15016
|
return this.list.asObservable();
|
|
15017
15017
|
}
|
|
15018
|
-
|
|
15019
|
-
|
|
15020
|
-
|
|
15021
|
-
* @param path Optional relative path to the action
|
|
15022
|
-
* @param httpOptions Optional HTTP options (headers, etc.)
|
|
15023
|
-
* @param handleError Whether to handle errors (default: true)
|
|
15024
|
-
*/
|
|
15025
|
-
create(entity, path, httpOptions, handleError = true, showMessage = false) {
|
|
15026
|
-
const options = this.withShowMessage(httpOptions, showMessage);
|
|
15018
|
+
create(entity, path, optionsOrHttpOptions, handleError = true, showMessage = false) {
|
|
15019
|
+
const resolved = this.resolveMutationOptions(optionsOrHttpOptions, handleError, showMessage);
|
|
15020
|
+
const options = this.withShowMessage(resolved.httpOptions, resolved.showMessage);
|
|
15027
15021
|
let request = this.http
|
|
15028
15022
|
.post(`${this.endpoint}${path ? path : ''}`, entity, options);
|
|
15029
15023
|
/* Handle error */
|
|
15030
|
-
if (handleError) {
|
|
15024
|
+
if (resolved.handleError) {
|
|
15031
15025
|
request = request.pipe(catchError(this.handleError('create')));
|
|
15032
15026
|
}
|
|
15033
15027
|
return request;
|
|
15034
15028
|
}
|
|
15035
|
-
|
|
15036
|
-
|
|
15037
|
-
|
|
15038
|
-
* @param path Optional relative path to the action
|
|
15039
|
-
* @param httpOptions Optional HTTP options (headers, etc.)
|
|
15040
|
-
* @returns Promise resolving to the created entity
|
|
15041
|
-
*/
|
|
15042
|
-
async createAsync(entity, path, httpOptions, showMessage = false) {
|
|
15043
|
-
return await firstValueFrom(this.create(entity, path, httpOptions, true, showMessage));
|
|
15029
|
+
async createAsync(entity, path, optionsOrHttpOptions, showMessage = false) {
|
|
15030
|
+
const resolved = this.resolveMutationOptions(optionsOrHttpOptions, true, showMessage);
|
|
15031
|
+
return await firstValueFrom(this.create(entity, path, resolved.httpOptions, resolved.handleError, resolved.showMessage));
|
|
15044
15032
|
}
|
|
15045
|
-
|
|
15046
|
-
|
|
15047
|
-
|
|
15048
|
-
* @param entity The updated entity data
|
|
15049
|
-
* @param path Optional relative path to the action
|
|
15050
|
-
* @param httpOptions Optional HTTP options (headers, etc.)
|
|
15051
|
-
* @param handleError Whether to handle errors (default: true)
|
|
15052
|
-
*/
|
|
15053
|
-
update(id, entity, path, httpOptions, handleError = true, showMessage = false) {
|
|
15054
|
-
const options = this.withShowMessage(httpOptions, showMessage);
|
|
15033
|
+
update(id, entity, path, optionsOrHttpOptions, handleError = true, showMessage = false) {
|
|
15034
|
+
const resolved = this.resolveMutationOptions(optionsOrHttpOptions, handleError, showMessage);
|
|
15035
|
+
const options = this.withShowMessage(resolved.httpOptions, resolved.showMessage);
|
|
15055
15036
|
let request = this.http
|
|
15056
15037
|
.put(`${this.endpoint}${path ? path : ''}/${id}`, entity, options);
|
|
15057
15038
|
/* Handle error */
|
|
15058
|
-
if (handleError) {
|
|
15039
|
+
if (resolved.handleError) {
|
|
15059
15040
|
request = request.pipe(catchError(this.handleError('update')));
|
|
15060
15041
|
}
|
|
15061
15042
|
return request;
|
|
15062
15043
|
}
|
|
15063
|
-
|
|
15064
|
-
|
|
15065
|
-
|
|
15066
|
-
* @param entity The updated entity data
|
|
15067
|
-
* @param path Optional relative path to the action
|
|
15068
|
-
* @param httpOptions Optional HTTP options (headers, etc.)
|
|
15069
|
-
* @returns Promise resolving to the updated entity
|
|
15070
|
-
*/
|
|
15071
|
-
async updateAsync(id, entity, path, httpOptions, showMessage = false) {
|
|
15072
|
-
return await firstValueFrom(this.update(id, entity, path, httpOptions, true, showMessage));
|
|
15044
|
+
async updateAsync(id, entity, path, optionsOrHttpOptions, showMessage = false) {
|
|
15045
|
+
const resolved = this.resolveMutationOptions(optionsOrHttpOptions, true, showMessage);
|
|
15046
|
+
return await firstValueFrom(this.update(id, entity, path, resolved.httpOptions, resolved.handleError, resolved.showMessage));
|
|
15073
15047
|
}
|
|
15074
|
-
|
|
15075
|
-
|
|
15076
|
-
|
|
15077
|
-
* @param body The patch body
|
|
15078
|
-
* @param path Optional relative path to the action
|
|
15079
|
-
* @param httpOptions Optional HTTP options (headers, etc.)
|
|
15080
|
-
* @param handleError Whether to handle errors (default: true)
|
|
15081
|
-
*/
|
|
15082
|
-
patch(id, body, path, httpOptions, handleError = true, showMessage = false) {
|
|
15083
|
-
const options = this.withShowMessage(httpOptions, showMessage);
|
|
15048
|
+
patch(id, body, path, optionsOrHttpOptions, handleError = true, showMessage = false) {
|
|
15049
|
+
const resolved = this.resolveMutationOptions(optionsOrHttpOptions, handleError, showMessage);
|
|
15050
|
+
const options = this.withShowMessage(resolved.httpOptions, resolved.showMessage) || {};
|
|
15084
15051
|
/* Ensure correct content-type for patch */
|
|
15085
15052
|
const mergedHeaders = options?.headers instanceof HttpHeaders
|
|
15086
15053
|
? options.headers
|
|
@@ -15089,103 +15056,58 @@ class GenericService {
|
|
|
15089
15056
|
/* Create request */
|
|
15090
15057
|
let request = this.http.patch(`${this.endpoint}${path ? path : ''}/${id}`, body, options);
|
|
15091
15058
|
/* Handle error */
|
|
15092
|
-
if (handleError) {
|
|
15059
|
+
if (resolved.handleError) {
|
|
15093
15060
|
request = request.pipe(catchError(this.handleError('patch')));
|
|
15094
15061
|
}
|
|
15095
15062
|
return request;
|
|
15096
15063
|
}
|
|
15097
|
-
|
|
15098
|
-
|
|
15099
|
-
|
|
15100
|
-
* @param body The patch body
|
|
15101
|
-
* @param path Optional relative path to the action
|
|
15102
|
-
* @param httpOptions Optional HTTP options (headers, etc.)
|
|
15103
|
-
* @returns Promise resolving to the patched entity
|
|
15104
|
-
*/
|
|
15105
|
-
async patchAsync(id, body, path, httpOptions, showMessage = false) {
|
|
15106
|
-
return await firstValueFrom(this.patch(id, body, path, httpOptions, true, showMessage));
|
|
15064
|
+
async patchAsync(id, body, path, optionsOrHttpOptions, showMessage = false) {
|
|
15065
|
+
const resolved = this.resolveMutationOptions(optionsOrHttpOptions, true, showMessage);
|
|
15066
|
+
return await firstValueFrom(this.patch(id, body, path, resolved.httpOptions, resolved.handleError, resolved.showMessage));
|
|
15107
15067
|
}
|
|
15108
|
-
|
|
15109
|
-
|
|
15110
|
-
|
|
15111
|
-
* @param body The patch body
|
|
15112
|
-
* @param path Optional relative path to the action
|
|
15113
|
-
* @param httpOptions Optional HTTP options (headers, etc.)
|
|
15114
|
-
* @param handleError Whether to handle errors (default: true)
|
|
15115
|
-
*/
|
|
15116
|
-
patchList(ids, body, path, httpOptions, handleError = true, showMessage = false) {
|
|
15117
|
-
const options = this.withShowMessage(httpOptions, showMessage);
|
|
15068
|
+
patchList(ids, body, path, optionsOrHttpOptions, handleError = true, showMessage = false) {
|
|
15069
|
+
const resolved = this.resolveMutationOptions(optionsOrHttpOptions, handleError, showMessage);
|
|
15070
|
+
const options = this.withShowMessage(resolved.httpOptions, resolved.showMessage);
|
|
15118
15071
|
let request = this.http
|
|
15119
15072
|
.patch(`${this.endpoint}${path ? path : ''}`, body, Object.assign(options || {}, { params: Utils.toHttpParams({ ids: ids }) }));
|
|
15120
15073
|
/* Handle error */
|
|
15121
|
-
if (handleError) {
|
|
15074
|
+
if (resolved.handleError) {
|
|
15122
15075
|
request = request.pipe(catchError(this.handleError('patch')));
|
|
15123
15076
|
}
|
|
15124
15077
|
return request;
|
|
15125
15078
|
}
|
|
15126
|
-
|
|
15127
|
-
|
|
15128
|
-
|
|
15129
|
-
* @param body The patch body
|
|
15130
|
-
* @param path Optional relative path to the action
|
|
15131
|
-
* @param httpOptions Optional HTTP options (headers, etc.)
|
|
15132
|
-
* @returns Promise resolving to the patched entities
|
|
15133
|
-
*/
|
|
15134
|
-
async patchListAsync(ids, body, path, httpOptions, showMessage = false) {
|
|
15135
|
-
return await firstValueFrom(this.patchList(ids, body, path, httpOptions, true, showMessage));
|
|
15079
|
+
async patchListAsync(ids, body, path, optionsOrHttpOptions, showMessage = false) {
|
|
15080
|
+
const resolved = this.resolveMutationOptions(optionsOrHttpOptions, true, showMessage);
|
|
15081
|
+
return await firstValueFrom(this.patchList(ids, body, path, resolved.httpOptions, resolved.handleError, resolved.showMessage));
|
|
15136
15082
|
}
|
|
15137
|
-
|
|
15138
|
-
|
|
15139
|
-
|
|
15140
|
-
* @param path Optional relative path to the action
|
|
15141
|
-
* @param httpOptions Optional HTTP options (headers, etc.)
|
|
15142
|
-
* @param handleError Whether to handle errors (default: true)
|
|
15143
|
-
*/
|
|
15144
|
-
delete(id, path, httpOptions, handleError = true, showMessage = false) {
|
|
15145
|
-
const options = this.withShowMessage(httpOptions, showMessage);
|
|
15083
|
+
delete(id, path, optionsOrHttpOptions, handleError = true, showMessage = false) {
|
|
15084
|
+
const resolved = this.resolveMutationOptions(optionsOrHttpOptions, handleError, showMessage);
|
|
15085
|
+
const options = this.withShowMessage(resolved.httpOptions, resolved.showMessage);
|
|
15146
15086
|
let request = this.http
|
|
15147
15087
|
.delete(`${this.endpoint}${path ? path : ''}/${id}`, options);
|
|
15148
15088
|
/* Handle error */
|
|
15149
|
-
if (handleError) {
|
|
15089
|
+
if (resolved.handleError) {
|
|
15150
15090
|
request = request.pipe(catchError(this.handleError('delete')));
|
|
15151
15091
|
}
|
|
15152
15092
|
return request;
|
|
15153
15093
|
}
|
|
15154
|
-
|
|
15155
|
-
|
|
15156
|
-
|
|
15157
|
-
* @param path Optional relative path to the action
|
|
15158
|
-
* @param httpOptions Optional HTTP options (headers, etc.)
|
|
15159
|
-
* @returns Promise resolving to the delete result
|
|
15160
|
-
*/
|
|
15161
|
-
async deleteAsync(id, path, httpOptions, showMessage = false) {
|
|
15162
|
-
return await firstValueFrom(this.delete(id, path, httpOptions, true, showMessage));
|
|
15094
|
+
async deleteAsync(id, path, optionsOrHttpOptions, showMessage = false) {
|
|
15095
|
+
const resolved = this.resolveMutationOptions(optionsOrHttpOptions, true, showMessage);
|
|
15096
|
+
return await firstValueFrom(this.delete(id, path, resolved.httpOptions, resolved.handleError, resolved.showMessage));
|
|
15163
15097
|
}
|
|
15164
|
-
|
|
15165
|
-
|
|
15166
|
-
|
|
15167
|
-
* @param path Optional relative path to the action
|
|
15168
|
-
* @param httpOptions Optional HTTP options (headers, etc.)
|
|
15169
|
-
* @param handleError Whether to handle errors (default: true)
|
|
15170
|
-
*/
|
|
15171
|
-
deleteList(ids, path, httpOptions, handleError = true, showMessage = false) {
|
|
15172
|
-
const options = this.withShowMessage(httpOptions, showMessage);
|
|
15098
|
+
deleteList(ids, path, optionsOrHttpOptions, handleError = true, showMessage = false) {
|
|
15099
|
+
const resolved = this.resolveMutationOptions(optionsOrHttpOptions, handleError, showMessage);
|
|
15100
|
+
const options = this.withShowMessage(resolved.httpOptions, resolved.showMessage);
|
|
15173
15101
|
let request = this.http.delete(`${this.endpoint}${path ? path : ''}`, Object.assign(options || {}, { params: Utils.toHttpParams({ ids: ids }) }));
|
|
15174
15102
|
/* Handle error */
|
|
15175
|
-
if (handleError) {
|
|
15103
|
+
if (resolved.handleError) {
|
|
15176
15104
|
request = request.pipe(catchError(this.handleError('deleteList')));
|
|
15177
15105
|
}
|
|
15178
15106
|
return request;
|
|
15179
15107
|
}
|
|
15180
|
-
|
|
15181
|
-
|
|
15182
|
-
|
|
15183
|
-
* @param path Optional relative path to the action
|
|
15184
|
-
* @param httpOptions Optional HTTP options (headers, etc.)
|
|
15185
|
-
* @returns Promise resolving to the delete result
|
|
15186
|
-
*/
|
|
15187
|
-
async deleteListAsync(ids, path, httpOptions, showMessage = false) {
|
|
15188
|
-
return await firstValueFrom(this.deleteList(ids, path, httpOptions, true, showMessage));
|
|
15108
|
+
async deleteListAsync(ids, path, optionsOrHttpOptions, showMessage = false) {
|
|
15109
|
+
const resolved = this.resolveMutationOptions(optionsOrHttpOptions, true, showMessage);
|
|
15110
|
+
return await firstValueFrom(this.deleteList(ids, path, resolved.httpOptions, resolved.handleError, resolved.showMessage));
|
|
15189
15111
|
}
|
|
15190
15112
|
/**
|
|
15191
15113
|
* Downloads a file from the server
|
|
@@ -15319,6 +15241,33 @@ class GenericService {
|
|
|
15319
15241
|
options.headers = headers.set('Show-Message', 'Yes');
|
|
15320
15242
|
return options;
|
|
15321
15243
|
}
|
|
15244
|
+
/**
|
|
15245
|
+
* Normalizes legacy mutation arguments and options-object overload arguments
|
|
15246
|
+
* @param optionsOrHttpOptions Legacy httpOptions or options object
|
|
15247
|
+
* @param handleError Legacy handleError value
|
|
15248
|
+
* @param showMessage Legacy showMessage value
|
|
15249
|
+
* @returns Normalized mutation options
|
|
15250
|
+
*/
|
|
15251
|
+
resolveMutationOptions(optionsOrHttpOptions, handleError = true, showMessage = false) {
|
|
15252
|
+
if (optionsOrHttpOptions && typeof optionsOrHttpOptions === 'object') {
|
|
15253
|
+
const options = optionsOrHttpOptions;
|
|
15254
|
+
/* Interpret as options-object overload only when one of its dedicated keys exists */
|
|
15255
|
+
if (Object.prototype.hasOwnProperty.call(options, 'httpOptions') ||
|
|
15256
|
+
Object.prototype.hasOwnProperty.call(options, 'handleError') ||
|
|
15257
|
+
Object.prototype.hasOwnProperty.call(options, 'showMessage')) {
|
|
15258
|
+
return {
|
|
15259
|
+
httpOptions: options.httpOptions ?? {},
|
|
15260
|
+
handleError: options.handleError ?? true,
|
|
15261
|
+
showMessage: options.showMessage ?? false
|
|
15262
|
+
};
|
|
15263
|
+
}
|
|
15264
|
+
}
|
|
15265
|
+
return {
|
|
15266
|
+
httpOptions: optionsOrHttpOptions ?? {},
|
|
15267
|
+
handleError,
|
|
15268
|
+
showMessage
|
|
15269
|
+
};
|
|
15270
|
+
}
|
|
15322
15271
|
/**
|
|
15323
15272
|
* Normalizes the 'projection' parameter in query parameters
|
|
15324
15273
|
* @param params The query parameters (HttpParams or object)
|