@dnv-plant/typescriptpws 1.0.77 → 1.0.78-alpha.1946028

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.
@@ -1,7 +1,7 @@
1
1
  /***********************************************************************
2
2
  * This file has been auto-generated by a code generation tool.
3
- * Version: 1.0.77
4
- * Date/time: 18 Jun 2025 15:16:48
3
+ * Version: 1.0.78
4
+ * Date/time: 20 Jun 2025 16:35:08
5
5
  * Template: templates/typescriptpws/calculations.razor.
6
6
  ***********************************************************************/
7
7
 
@@ -243,33 +243,30 @@ to obtain the fluid properties.
243
243
 
244
244
  this.resultCode = Enums.ResultCode.UNEXPECTED_APPLICATION_ERROR;
245
245
 
246
- const response = await this.postRequest(url, requestJson);
247
-
248
- if (response.status >= 200 && response.status < 300) {
249
- const schema = new FlashCalculationResponseSchema();
250
- const validatedResponse = schema.validate(response.data);
251
-
252
- this.resultCode = validatedResponse.resultCode;
253
- if (this.resultCode === Enums.ResultCode.SUCCESS) {
254
- this.flashResult = validatedResponse.flashResult;
255
- this.resultCode = validatedResponse.resultCode;
256
- this.messages = validatedResponse.messages ?? [];
257
- this.calculationElapsedTime = validatedResponse.calculationElapsedTime;
258
- this.operationId = validatedResponse.operationId;
259
- } else {
260
- this.messages.push(...(validatedResponse.messages ?? []));
261
- }
246
+ const { data } = await this.postRequest(url, requestJson);
247
+
248
+ const responseSchema = new FlashCalculationResponseSchema();
249
+ const validatedResponse = responseSchema.validate(data);
250
+
251
+ this.resultCode = validatedResponse.resultCode;
252
+ if (this.resultCode === Enums.ResultCode.SUCCESS) {
253
+ Object.assign(this, {
254
+ flashResult: validatedResponse.flashResult,
255
+ resultCode: validatedResponse.resultCode,
256
+ messages: validatedResponse.messages ?? [],
257
+ calculationElapsedTime: validatedResponse.calculationElapsedTime,
258
+ operationId: validatedResponse.operationId,
259
+ });
262
260
  } else {
263
- this.handleFailedResponse(response);
261
+ this.messages.push(...(validatedResponse.messages ?? []));
264
262
  }
265
- } catch (error) {
266
- if (error instanceof Error) {
267
- this.messages.push(`Error: ${error.message}`);
263
+ } catch (err: any) {
264
+ if ((err as any)?.response) {
265
+ this.handleFailedResponse((err as any).response);
268
266
  } else {
269
- this.messages.push(`Unexpected error: ${JSON.stringify(error)}`);
267
+ throw err;
270
268
  }
271
- console.error(error);
272
- this.resultCode = Enums.ResultCode.UNEXPECTED_APPLICATION_ERROR;
269
+ console.error(err);
273
270
  }
274
271
 
275
272
  return this.resultCode;