@dnv-plant/typescriptpws 1.0.92 → 1.0.93-alpha.2047182

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,177 +1,23 @@
1
1
  /***********************************************************************
2
- * This file has been auto-generated by a code generation tool.
3
- *
4
- * DO NOT MODIFY THIS FILE
5
- * This file is maintained by DNV.
6
- * Editing it may lead to inconsistent results and limit DNV's ability to provide support.
7
- * Please contact DNV if you believe changes are required.
8
- *
9
- * Version: 1.0.92
10
- * Date/time: 09 Sept 2025 15:59:43
11
- * Template: templates/typescriptpws/calculations.razor.
12
- ***********************************************************************/
2
+ * This file has been auto-generated by a code generation tool.
3
+ *
4
+ * DO NOT MODIFY THIS FILE
5
+ * This file is maintained by DNV.
6
+ * Editing it may lead to inconsistent results and limit DNV's ability to provide support.
7
+ * Please contact DNV if you believe changes are required.
8
+ *
9
+ * Version: 1.0.93
10
+ * Date/time: 11 Sept 2025 11:24:42
11
+ * Template: templates/typescriptpws/calculations.razor.
12
+ ***********************************************************************/
13
13
 
14
14
  import * as Enums from "../enums";
15
15
  import * as Entities from "../entities";
16
16
  import * as EntitySchemas from "../entity-schemas";
17
- import {
18
- getAnalyticsApiTarget,
19
- getClientAliasId,
20
- postRequest,
21
- } from "../utilities";
17
+ import { getAnalyticsApiTarget, getClientAliasId } from "../utilities";
18
+ import { CalculationRequestBase, CalculationBase, CalculationResponseBase } from "./calculationBase"
22
19
 
23
20
  import Joi from "joi";
24
- import { AxiosResponse } from "axios";
25
-
26
- class CalculationRequestBase {
27
- /**
28
- * Calculation request base class.
29
- */
30
- constructor() {
31
- // Base class initialization code
32
- }
33
- }
34
-
35
- class CalculationBase {
36
- resultCode?: Enums.ResultCode = Enums.ResultCode.SUCCESS;
37
- messages: string[] = [];
38
- calculationElapsedTime?: number = 0.0;
39
- operationId?: string = "";
40
- controller?: AbortController;
41
-
42
- constructor(controller?: AbortController) {
43
- this.controller = controller;
44
- }
45
-
46
- /**
47
- * Post JSON to URL and time the call
48
- */
49
- async postRequest(url: string, data: string): Promise<AxiosResponse> {
50
- return postRequest(url, data, this.controller);
51
- }
52
-
53
- /**
54
- * Utility method to print the messages returned by the calculation.
55
- */
56
- printMessages(): void {
57
- if (this.messages && this.messages.length > 0) {
58
- this.messages.forEach((message) => console.log(message));
59
- } else {
60
- console.log("No messages");
61
- }
62
- }
63
-
64
- /**
65
- * Utility method to handle a failed response.
66
- */
67
- handleFailedResponse(response: AxiosResponse): void {
68
- try {
69
- const validatedFailedResponse =
70
- new CalculationFailedResponseSchema().validate(response.data);
71
-
72
- this.resultCode = validatedFailedResponse.resultCode;
73
- this.messages.push(...(validatedFailedResponse.messages ?? []));
74
- this.calculationElapsedTime =
75
- validatedFailedResponse.calculationElapsedTime;
76
- this.operationId = validatedFailedResponse.operationId;
77
- } catch (error) {
78
- if (error instanceof Error) {
79
- this.messages.push(`Failed to parse response: ${error.message}`);
80
- } else {
81
- this.messages.push(
82
- "An unknown error occurred during response parsing."
83
- );
84
- }
85
- console.error("Failed to parse response:", error);
86
- } finally {
87
- this.messages.push(
88
- `${response.statusText} (Status code: ${response.status})`
89
- );
90
- }
91
- }
92
- }
93
-
94
- class CalculationResponseBase {
95
- resultCode?: Enums.ResultCode;
96
- messages?: string[];
97
- calculationElapsedTime?: number;
98
- operationId?: string;
99
-
100
- /**
101
- * Calculation response base class.
102
- */
103
- constructor(
104
- resultCode?: Enums.ResultCode,
105
- messages?: string[],
106
- calculationElapsedTime?: number,
107
- operationId?: string
108
- ) {
109
- this.resultCode = resultCode;
110
- this.messages = messages;
111
- this.calculationElapsedTime = calculationElapsedTime;
112
- this.operationId = operationId;
113
- }
114
- }
115
-
116
- class CalculationFailedResponse extends CalculationResponseBase {
117
- /**
118
- * Calculation failed response class.
119
- */
120
- constructor(
121
- resultCode?: Enums.ResultCode,
122
- messages: string[] = [],
123
- calculationElapsedTime: number = 0,
124
- operationId: string = ""
125
- ) {
126
- super(resultCode, messages, calculationElapsedTime, operationId);
127
- }
128
- }
129
-
130
- class CalculationFailedResponseSchema {
131
- schema: Joi.ObjectSchema;
132
-
133
- /**
134
- * Calculation failed response schema.
135
- */
136
- constructor() {
137
- this.schema = Joi.object({
138
- resultCode: Joi.string()
139
- .valid(...Object.values(Enums.ResultCode))
140
- .required(),
141
- messages: Joi.array().items(Joi.string()).required(),
142
- calculationElapsedTime: Joi.number().optional(),
143
- operationId: Joi.string().required(),
144
- }).unknown(true);
145
- }
146
-
147
- validate(data: {
148
- resultCode: Enums.ResultCode;
149
- messages: string[];
150
- calculationElapsedTime: number;
151
- operationId: string;
152
- }) {
153
- const { error, value } = this.schema.validate(data);
154
- if (error)
155
- throw new Error(
156
- `Validation error: ${error.details.map((x) => x.message).join(", ")}`
157
- );
158
- return this.makeCalculationFailedResponse(value);
159
- }
160
-
161
- makeCalculationFailedResponse(data: {
162
- resultCode: Enums.ResultCode;
163
- messages: string[];
164
- calculationElapsedTime: number;
165
- operationId: string;
166
- }) {
167
- return new CalculationFailedResponse(
168
- data.resultCode,
169
- data.messages,
170
- data.calculationElapsedTime,
171
- data.operationId
172
- );
173
- }
174
- }
175
21
 
176
22
  export interface ConvertCompositionMassToMoleCalculationRequestSchemaData {
177
23
  mixture: Entities.Material;
@@ -189,9 +35,9 @@ class ConvertCompositionMassToMoleCalculationRequest extends CalculationRequestB
189
35
  *
190
36
  */
191
37
  constructor(data: {
192
- mixture: Entities.Material;
193
- compositionMass: number[];
194
- compositionMassCount: number;
38
+ mixture: Entities.Material,
39
+ compositionMass: number[],
40
+ compositionMassCount: number
195
41
  }) {
196
42
  super();
197
43
  this.mixture = data.mixture;
@@ -221,21 +67,15 @@ export class ConvertCompositionMassToMoleCalculationRequestSchema {
221
67
  };
222
68
  }
223
69
 
224
- validate(
225
- data: ConvertCompositionMassToMoleCalculationRequestSchemaData
226
- ): ConvertCompositionMassToMoleCalculationRequest {
70
+ validate(data: ConvertCompositionMassToMoleCalculationRequestSchemaData): ConvertCompositionMassToMoleCalculationRequest {
227
71
  const { error, value } = this.schema.validate(data, { abortEarly: false });
228
72
  if (error) {
229
- throw new Error(
230
- `Validation error: ${error.details.map((x) => x.message).join(", ")}`
231
- );
73
+ throw new Error(`Validation error: ${error.details.map((x) => x.message).join(", ")}`);
232
74
  }
233
75
  return this.makeCalculationRequest(value);
234
76
  }
235
77
 
236
- makeCalculationRequest(
237
- data: ConvertCompositionMassToMoleCalculationRequestSchemaData
238
- ): ConvertCompositionMassToMoleCalculationRequest {
78
+ makeCalculationRequest(data: ConvertCompositionMassToMoleCalculationRequestSchemaData): ConvertCompositionMassToMoleCalculationRequest {
239
79
  return new ConvertCompositionMassToMoleCalculationRequest(data);
240
80
  }
241
81
  }
@@ -251,9 +91,9 @@ export class ConvertCompositionMassToMoleCalculation extends CalculationBase {
251
91
  *
252
92
  */
253
93
  constructor(data: {
254
- mixture: Entities.Material;
255
- compositionMass: number[];
256
- compositionMassCount: number;
94
+ mixture: Entities.Material,
95
+ compositionMass: number[],
96
+ compositionMassCount: number
257
97
  controller?: AbortController;
258
98
  }) {
259
99
  super(data.controller);
@@ -267,7 +107,7 @@ export class ConvertCompositionMassToMoleCalculation extends CalculationBase {
267
107
  const request = new ConvertCompositionMassToMoleCalculationRequest({
268
108
  mixture: this.mixture,
269
109
  compositionMass: this.compositionMass,
270
- compositionMassCount: this.compositionMassCount,
110
+ compositionMassCount: this.compositionMassCount
271
111
  });
272
112
 
273
113
  const schema = new ConvertCompositionMassToMoleCalculationRequestSchema();
@@ -280,8 +120,7 @@ export class ConvertCompositionMassToMoleCalculation extends CalculationBase {
280
120
 
281
121
  const { data } = await this.postRequest(url, requestJson);
282
122
 
283
- const responseSchema =
284
- new ConvertCompositionMassToMoleCalculationResponseSchema();
123
+ const responseSchema = new ConvertCompositionMassToMoleCalculationResponseSchema();
285
124
  const validatedResponse = responseSchema.validate(data);
286
125
 
287
126
  this.resultCode = validatedResponse.resultCode;
@@ -314,28 +153,14 @@ export class ConvertCompositionMassToMoleCalculation extends CalculationBase {
314
153
  parts.push("*** compositionMole:");
315
154
  parts.push(
316
155
  this.compositionMole && this.compositionMole.length > 0
317
- ? this.compositionMole
318
- .map((point) => `compositionMoleElement: ${point}`)
319
- .join("\n")
156
+ ? this.compositionMole.map((point) => `compositionMoleElement: ${point}`).join("\n")
320
157
  : "compositionMole does not contain any elements"
321
158
  );
322
159
  parts.push(`resultCode: ${String(this.resultCode)}`);
323
160
  parts.push("*** messages:");
324
- parts.push(
325
- `messages: ${this.messages !== undefined ? this.messages : "(None)"}`
326
- );
327
- parts.push(
328
- `calculationElapsedTime: ${
329
- this.calculationElapsedTime !== undefined
330
- ? this.calculationElapsedTime
331
- : "(None)"
332
- }`
333
- );
334
- parts.push(
335
- `operationId: ${
336
- this.operationId !== undefined ? this.operationId : "(None)"
337
- }`
338
- );
161
+ parts.push(`messages: ${this.messages !== undefined ? this.messages : "(None)"}`);
162
+ parts.push(`calculationElapsedTime: ${this.calculationElapsedTime !== undefined ? this.calculationElapsedTime : "(None)"}`);
163
+ parts.push(`operationId: ${this.operationId !== undefined ? this.operationId : "(None)"}`);
339
164
 
340
165
  return parts.join("\n");
341
166
  }
@@ -349,11 +174,11 @@ export class ConvertCompositionMassToMoleCalculationResponse extends Calculation
349
174
  *
350
175
  */
351
176
  constructor(data: {
352
- compositionMole: number[];
353
- resultCode: Enums.ResultCode;
354
- messages: string[];
355
- calculationElapsedTime: number;
356
- operationId: string;
177
+ compositionMole: number[],
178
+ resultCode: Enums.ResultCode,
179
+ messages: string[],
180
+ calculationElapsedTime: number,
181
+ operationId: string
357
182
  }) {
358
183
  super();
359
184
  this.compositionMole = data.compositionMole;
@@ -365,31 +190,19 @@ export class ConvertCompositionMassToMoleCalculationResponse extends Calculation
365
190
 
366
191
  initialiseFromDictionary(data: { [key: string]: unknown }) {
367
192
  if (data.compositionMole && Array.isArray(data.compositionMole)) {
368
- this.compositionMole = data.compositionMole.map((item) =>
369
- parseFloat(item)
370
- );
371
- }
372
- if (
373
- data.resultCode !== undefined &&
374
- (typeof data.resultCode === "string" ||
375
- typeof data.resultCode === "number")
376
- ) {
193
+ this.compositionMole = data.compositionMole.map((item) => parseFloat(item));
194
+ }
195
+ if (data.resultCode !== undefined && (typeof data.resultCode === "string" || typeof data.resultCode === "number")) {
377
196
  this.resultCode = data.resultCode as Enums.ResultCode;
378
197
  }
379
198
  this.messages = this.messages ?? [];
380
199
  if (data.messages && Array.isArray(data.messages)) {
381
200
  this.messages.push(...data.messages);
382
201
  }
383
- if (
384
- data.calculationElapsedTime !== undefined &&
385
- typeof data.calculationElapsedTime === "number"
386
- ) {
202
+ if (data.calculationElapsedTime !== undefined && typeof data.calculationElapsedTime === "number") {
387
203
  this.calculationElapsedTime = data.calculationElapsedTime as number;
388
204
  }
389
- if (
390
- data.operationId !== undefined &&
391
- typeof data.operationId === "string"
392
- ) {
205
+ if (data.operationId !== undefined && typeof data.operationId === "string") {
393
206
  this.operationId = data.operationId as string;
394
207
  }
395
208
  }
@@ -424,21 +237,15 @@ export class ConvertCompositionMassToMoleCalculationResponseSchema {
424
237
  };
425
238
  }
426
239
 
427
- validate(
428
- data: ConvertCompositionMassToMoleCalculationResponseSchemaData
429
- ): ConvertCompositionMassToMoleCalculationResponse {
240
+ validate(data: ConvertCompositionMassToMoleCalculationResponseSchemaData): ConvertCompositionMassToMoleCalculationResponse {
430
241
  const { error, value } = this.schema.validate(data, { abortEarly: false });
431
242
  if (error) {
432
- throw new Error(
433
- `Validation error: ${error.details.map((x) => x.message).join(", ")}`
434
- );
243
+ throw new Error(`Validation error: ${error.details.map((x) => x.message).join(", ")}`);
435
244
  }
436
245
  return this.makeCalculationResponse(value);
437
246
  }
438
247
 
439
- makeCalculationResponse(
440
- data: ConvertCompositionMassToMoleCalculationResponseSchemaData
441
- ): ConvertCompositionMassToMoleCalculationResponse {
248
+ makeCalculationResponse(data: ConvertCompositionMassToMoleCalculationResponseSchemaData): ConvertCompositionMassToMoleCalculationResponse {
442
249
  return new ConvertCompositionMassToMoleCalculationResponse(data);
443
250
  }
444
251
  }
@@ -459,9 +266,9 @@ class ConvertCompositionMoleToMassCalculationRequest extends CalculationRequestB
459
266
  *
460
267
  */
461
268
  constructor(data: {
462
- mixture: Entities.Material;
463
- compositionMoles: number[];
464
- compositionMolesCount: number;
269
+ mixture: Entities.Material,
270
+ compositionMoles: number[],
271
+ compositionMolesCount: number
465
272
  }) {
466
273
  super();
467
274
  this.mixture = data.mixture;
@@ -491,21 +298,15 @@ export class ConvertCompositionMoleToMassCalculationRequestSchema {
491
298
  };
492
299
  }
493
300
 
494
- validate(
495
- data: ConvertCompositionMoleToMassCalculationRequestSchemaData
496
- ): ConvertCompositionMoleToMassCalculationRequest {
301
+ validate(data: ConvertCompositionMoleToMassCalculationRequestSchemaData): ConvertCompositionMoleToMassCalculationRequest {
497
302
  const { error, value } = this.schema.validate(data, { abortEarly: false });
498
303
  if (error) {
499
- throw new Error(
500
- `Validation error: ${error.details.map((x) => x.message).join(", ")}`
501
- );
304
+ throw new Error(`Validation error: ${error.details.map((x) => x.message).join(", ")}`);
502
305
  }
503
306
  return this.makeCalculationRequest(value);
504
307
  }
505
308
 
506
- makeCalculationRequest(
507
- data: ConvertCompositionMoleToMassCalculationRequestSchemaData
508
- ): ConvertCompositionMoleToMassCalculationRequest {
309
+ makeCalculationRequest(data: ConvertCompositionMoleToMassCalculationRequestSchemaData): ConvertCompositionMoleToMassCalculationRequest {
509
310
  return new ConvertCompositionMoleToMassCalculationRequest(data);
510
311
  }
511
312
  }
@@ -521,9 +322,9 @@ export class ConvertCompositionMoleToMassCalculation extends CalculationBase {
521
322
  *
522
323
  */
523
324
  constructor(data: {
524
- mixture: Entities.Material;
525
- compositionMoles: number[];
526
- compositionMolesCount: number;
325
+ mixture: Entities.Material,
326
+ compositionMoles: number[],
327
+ compositionMolesCount: number
527
328
  controller?: AbortController;
528
329
  }) {
529
330
  super(data.controller);
@@ -537,7 +338,7 @@ export class ConvertCompositionMoleToMassCalculation extends CalculationBase {
537
338
  const request = new ConvertCompositionMoleToMassCalculationRequest({
538
339
  mixture: this.mixture,
539
340
  compositionMoles: this.compositionMoles,
540
- compositionMolesCount: this.compositionMolesCount,
341
+ compositionMolesCount: this.compositionMolesCount
541
342
  });
542
343
 
543
344
  const schema = new ConvertCompositionMoleToMassCalculationRequestSchema();
@@ -550,8 +351,7 @@ export class ConvertCompositionMoleToMassCalculation extends CalculationBase {
550
351
 
551
352
  const { data } = await this.postRequest(url, requestJson);
552
353
 
553
- const responseSchema =
554
- new ConvertCompositionMoleToMassCalculationResponseSchema();
354
+ const responseSchema = new ConvertCompositionMoleToMassCalculationResponseSchema();
555
355
  const validatedResponse = responseSchema.validate(data);
556
356
 
557
357
  this.resultCode = validatedResponse.resultCode;
@@ -584,28 +384,14 @@ export class ConvertCompositionMoleToMassCalculation extends CalculationBase {
584
384
  parts.push("*** compositionMass:");
585
385
  parts.push(
586
386
  this.compositionMass && this.compositionMass.length > 0
587
- ? this.compositionMass
588
- .map((point) => `compositionMassElement: ${point}`)
589
- .join("\n")
387
+ ? this.compositionMass.map((point) => `compositionMassElement: ${point}`).join("\n")
590
388
  : "compositionMass does not contain any elements"
591
389
  );
592
390
  parts.push(`resultCode: ${String(this.resultCode)}`);
593
391
  parts.push("*** messages:");
594
- parts.push(
595
- `messages: ${this.messages !== undefined ? this.messages : "(None)"}`
596
- );
597
- parts.push(
598
- `calculationElapsedTime: ${
599
- this.calculationElapsedTime !== undefined
600
- ? this.calculationElapsedTime
601
- : "(None)"
602
- }`
603
- );
604
- parts.push(
605
- `operationId: ${
606
- this.operationId !== undefined ? this.operationId : "(None)"
607
- }`
608
- );
392
+ parts.push(`messages: ${this.messages !== undefined ? this.messages : "(None)"}`);
393
+ parts.push(`calculationElapsedTime: ${this.calculationElapsedTime !== undefined ? this.calculationElapsedTime : "(None)"}`);
394
+ parts.push(`operationId: ${this.operationId !== undefined ? this.operationId : "(None)"}`);
609
395
 
610
396
  return parts.join("\n");
611
397
  }
@@ -619,11 +405,11 @@ export class ConvertCompositionMoleToMassCalculationResponse extends Calculation
619
405
  *
620
406
  */
621
407
  constructor(data: {
622
- compositionMass: number[];
623
- resultCode: Enums.ResultCode;
624
- messages: string[];
625
- calculationElapsedTime: number;
626
- operationId: string;
408
+ compositionMass: number[],
409
+ resultCode: Enums.ResultCode,
410
+ messages: string[],
411
+ calculationElapsedTime: number,
412
+ operationId: string
627
413
  }) {
628
414
  super();
629
415
  this.compositionMass = data.compositionMass;
@@ -635,31 +421,19 @@ export class ConvertCompositionMoleToMassCalculationResponse extends Calculation
635
421
 
636
422
  initialiseFromDictionary(data: { [key: string]: unknown }) {
637
423
  if (data.compositionMass && Array.isArray(data.compositionMass)) {
638
- this.compositionMass = data.compositionMass.map((item) =>
639
- parseFloat(item)
640
- );
641
- }
642
- if (
643
- data.resultCode !== undefined &&
644
- (typeof data.resultCode === "string" ||
645
- typeof data.resultCode === "number")
646
- ) {
424
+ this.compositionMass = data.compositionMass.map((item) => parseFloat(item));
425
+ }
426
+ if (data.resultCode !== undefined && (typeof data.resultCode === "string" || typeof data.resultCode === "number")) {
647
427
  this.resultCode = data.resultCode as Enums.ResultCode;
648
428
  }
649
429
  this.messages = this.messages ?? [];
650
430
  if (data.messages && Array.isArray(data.messages)) {
651
431
  this.messages.push(...data.messages);
652
432
  }
653
- if (
654
- data.calculationElapsedTime !== undefined &&
655
- typeof data.calculationElapsedTime === "number"
656
- ) {
433
+ if (data.calculationElapsedTime !== undefined && typeof data.calculationElapsedTime === "number") {
657
434
  this.calculationElapsedTime = data.calculationElapsedTime as number;
658
435
  }
659
- if (
660
- data.operationId !== undefined &&
661
- typeof data.operationId === "string"
662
- ) {
436
+ if (data.operationId !== undefined && typeof data.operationId === "string") {
663
437
  this.operationId = data.operationId as string;
664
438
  }
665
439
  }
@@ -694,21 +468,15 @@ export class ConvertCompositionMoleToMassCalculationResponseSchema {
694
468
  };
695
469
  }
696
470
 
697
- validate(
698
- data: ConvertCompositionMoleToMassCalculationResponseSchemaData
699
- ): ConvertCompositionMoleToMassCalculationResponse {
471
+ validate(data: ConvertCompositionMoleToMassCalculationResponseSchemaData): ConvertCompositionMoleToMassCalculationResponse {
700
472
  const { error, value } = this.schema.validate(data, { abortEarly: false });
701
473
  if (error) {
702
- throw new Error(
703
- `Validation error: ${error.details.map((x) => x.message).join(", ")}`
704
- );
474
+ throw new Error(`Validation error: ${error.details.map((x) => x.message).join(", ")}`);
705
475
  }
706
476
  return this.makeCalculationResponse(value);
707
477
  }
708
478
 
709
- makeCalculationResponse(
710
- data: ConvertCompositionMoleToMassCalculationResponseSchemaData
711
- ): ConvertCompositionMoleToMassCalculationResponse {
479
+ makeCalculationResponse(data: ConvertCompositionMoleToMassCalculationResponseSchemaData): ConvertCompositionMoleToMassCalculationResponse {
712
480
  return new ConvertCompositionMoleToMassCalculationResponse(data);
713
481
  }
714
482
  }
@@ -724,7 +492,9 @@ class GetMassFromVesselCalculationRequest extends CalculationRequestBase {
724
492
  * GetMassFromVessel calculation request class.
725
493
  *
726
494
  */
727
- constructor(data: { vessel: Entities.Vessel }) {
495
+ constructor(data: {
496
+ vessel: Entities.Vessel
497
+ }) {
728
498
  super();
729
499
  this.vessel = data.vessel;
730
500
  }
@@ -747,21 +517,15 @@ export class GetMassFromVesselCalculationRequestSchema {
747
517
  };
748
518
  }
749
519
 
750
- validate(
751
- data: GetMassFromVesselCalculationRequestSchemaData
752
- ): GetMassFromVesselCalculationRequest {
520
+ validate(data: GetMassFromVesselCalculationRequestSchemaData): GetMassFromVesselCalculationRequest {
753
521
  const { error, value } = this.schema.validate(data, { abortEarly: false });
754
522
  if (error) {
755
- throw new Error(
756
- `Validation error: ${error.details.map((x) => x.message).join(", ")}`
757
- );
523
+ throw new Error(`Validation error: ${error.details.map((x) => x.message).join(", ")}`);
758
524
  }
759
525
  return this.makeCalculationRequest(value);
760
526
  }
761
527
 
762
- makeCalculationRequest(
763
- data: GetMassFromVesselCalculationRequestSchemaData
764
- ): GetMassFromVesselCalculationRequest {
528
+ makeCalculationRequest(data: GetMassFromVesselCalculationRequestSchemaData): GetMassFromVesselCalculationRequest {
765
529
  return new GetMassFromVesselCalculationRequest(data);
766
530
  }
767
531
  }
@@ -774,7 +538,10 @@ export class GetMassFromVesselCalculation extends CalculationBase {
774
538
  * Calculates the mass in a vessel.
775
539
  *
776
540
  */
777
- constructor(data: { vessel: Entities.Vessel; controller?: AbortController }) {
541
+ constructor(data: {
542
+ vessel: Entities.Vessel
543
+ controller?: AbortController;
544
+ }) {
778
545
  super(data.controller);
779
546
  this.vessel = data.vessel;
780
547
  }
@@ -782,7 +549,7 @@ export class GetMassFromVesselCalculation extends CalculationBase {
782
549
  async run() {
783
550
  try {
784
551
  const request = new GetMassFromVesselCalculationRequest({
785
- vessel: this.vessel,
552
+ vessel: this.vessel
786
553
  });
787
554
 
788
555
  const schema = new GetMassFromVesselCalculationRequestSchema();
@@ -828,21 +595,9 @@ export class GetMassFromVesselCalculation extends CalculationBase {
828
595
  parts.push(`massInventory: ${String(this.massInventory)}`);
829
596
  parts.push(`resultCode: ${String(this.resultCode)}`);
830
597
  parts.push("*** messages:");
831
- parts.push(
832
- `messages: ${this.messages !== undefined ? this.messages : "(None)"}`
833
- );
834
- parts.push(
835
- `calculationElapsedTime: ${
836
- this.calculationElapsedTime !== undefined
837
- ? this.calculationElapsedTime
838
- : "(None)"
839
- }`
840
- );
841
- parts.push(
842
- `operationId: ${
843
- this.operationId !== undefined ? this.operationId : "(None)"
844
- }`
845
- );
598
+ parts.push(`messages: ${this.messages !== undefined ? this.messages : "(None)"}`);
599
+ parts.push(`calculationElapsedTime: ${this.calculationElapsedTime !== undefined ? this.calculationElapsedTime : "(None)"}`);
600
+ parts.push(`operationId: ${this.operationId !== undefined ? this.operationId : "(None)"}`);
846
601
 
847
602
  return parts.join("\n");
848
603
  }
@@ -856,11 +611,11 @@ export class GetMassFromVesselCalculationResponse extends CalculationResponseBas
856
611
  *
857
612
  */
858
613
  constructor(data: {
859
- massInventory: number;
860
- resultCode: Enums.ResultCode;
861
- messages: string[];
862
- calculationElapsedTime: number;
863
- operationId: string;
614
+ massInventory: number,
615
+ resultCode: Enums.ResultCode,
616
+ messages: string[],
617
+ calculationElapsedTime: number,
618
+ operationId: string
864
619
  }) {
865
620
  super();
866
621
  this.massInventory = data.massInventory;
@@ -871,33 +626,20 @@ export class GetMassFromVesselCalculationResponse extends CalculationResponseBas
871
626
  }
872
627
 
873
628
  initialiseFromDictionary(data: { [key: string]: unknown }) {
874
- if (
875
- data.massInventory !== undefined &&
876
- typeof data.massInventory === "number"
877
- ) {
629
+ if (data.massInventory !== undefined && typeof data.massInventory === "number") {
878
630
  this.massInventory = data.massInventory as number;
879
631
  }
880
- if (
881
- data.resultCode !== undefined &&
882
- (typeof data.resultCode === "string" ||
883
- typeof data.resultCode === "number")
884
- ) {
632
+ if (data.resultCode !== undefined && (typeof data.resultCode === "string" || typeof data.resultCode === "number")) {
885
633
  this.resultCode = data.resultCode as Enums.ResultCode;
886
634
  }
887
635
  this.messages = this.messages ?? [];
888
636
  if (data.messages && Array.isArray(data.messages)) {
889
637
  this.messages.push(...data.messages);
890
638
  }
891
- if (
892
- data.calculationElapsedTime !== undefined &&
893
- typeof data.calculationElapsedTime === "number"
894
- ) {
639
+ if (data.calculationElapsedTime !== undefined && typeof data.calculationElapsedTime === "number") {
895
640
  this.calculationElapsedTime = data.calculationElapsedTime as number;
896
641
  }
897
- if (
898
- data.operationId !== undefined &&
899
- typeof data.operationId === "string"
900
- ) {
642
+ if (data.operationId !== undefined && typeof data.operationId === "string") {
901
643
  this.operationId = data.operationId as string;
902
644
  }
903
645
  }
@@ -932,21 +674,15 @@ export class GetMassFromVesselCalculationResponseSchema {
932
674
  };
933
675
  }
934
676
 
935
- validate(
936
- data: GetMassFromVesselCalculationResponseSchemaData
937
- ): GetMassFromVesselCalculationResponse {
677
+ validate(data: GetMassFromVesselCalculationResponseSchemaData): GetMassFromVesselCalculationResponse {
938
678
  const { error, value } = this.schema.validate(data, { abortEarly: false });
939
679
  if (error) {
940
- throw new Error(
941
- `Validation error: ${error.details.map((x) => x.message).join(", ")}`
942
- );
680
+ throw new Error(`Validation error: ${error.details.map((x) => x.message).join(", ")}`);
943
681
  }
944
682
  return this.makeCalculationResponse(value);
945
683
  }
946
684
 
947
- makeCalculationResponse(
948
- data: GetMassFromVesselCalculationResponseSchemaData
949
- ): GetMassFromVesselCalculationResponse {
685
+ makeCalculationResponse(data: GetMassFromVesselCalculationResponseSchemaData): GetMassFromVesselCalculationResponse {
950
686
  return new GetMassFromVesselCalculationResponse(data);
951
687
  }
952
688
  }
@@ -975,13 +711,13 @@ class LoadMassInventoryVesselForLeakScenarioCalculationRequest extends Calculati
975
711
  *
976
712
  */
977
713
  constructor(data: {
978
- material: Entities.Material;
979
- mass: number;
980
- pressure: number;
981
- temperature: number;
982
- holeSize: number;
983
- releaseElevation: number;
984
- releaseAngle: number;
714
+ material: Entities.Material,
715
+ mass: number,
716
+ pressure: number,
717
+ temperature: number,
718
+ holeSize: number,
719
+ releaseElevation: number,
720
+ releaseAngle: number
985
721
  }) {
986
722
  super();
987
723
  this.material = data.material;
@@ -1023,21 +759,15 @@ export class LoadMassInventoryVesselForLeakScenarioCalculationRequestSchema {
1023
759
  };
1024
760
  }
1025
761
 
1026
- validate(
1027
- data: LoadMassInventoryVesselForLeakScenarioCalculationRequestSchemaData
1028
- ): LoadMassInventoryVesselForLeakScenarioCalculationRequest {
762
+ validate(data: LoadMassInventoryVesselForLeakScenarioCalculationRequestSchemaData): LoadMassInventoryVesselForLeakScenarioCalculationRequest {
1029
763
  const { error, value } = this.schema.validate(data, { abortEarly: false });
1030
764
  if (error) {
1031
- throw new Error(
1032
- `Validation error: ${error.details.map((x) => x.message).join(", ")}`
1033
- );
765
+ throw new Error(`Validation error: ${error.details.map((x) => x.message).join(", ")}`);
1034
766
  }
1035
767
  return this.makeCalculationRequest(value);
1036
768
  }
1037
769
 
1038
- makeCalculationRequest(
1039
- data: LoadMassInventoryVesselForLeakScenarioCalculationRequestSchemaData
1040
- ): LoadMassInventoryVesselForLeakScenarioCalculationRequest {
770
+ makeCalculationRequest(data: LoadMassInventoryVesselForLeakScenarioCalculationRequestSchemaData): LoadMassInventoryVesselForLeakScenarioCalculationRequest {
1041
771
  return new LoadMassInventoryVesselForLeakScenarioCalculationRequest(data);
1042
772
  }
1043
773
  }
@@ -1052,19 +782,20 @@ export class LoadMassInventoryVesselForLeakScenarioCalculation extends Calculati
1052
782
  releaseAngle: number;
1053
783
  vessel?: Entities.Vessel;
1054
784
  leak?: Entities.Leak;
785
+ volume?: number;
1055
786
 
1056
787
  /**
1057
- * Sets up a vessel and a leak scenario from a mass inventory, pressure, temperature and hole size specifications.
788
+ * Sets up a vessel and a leak scenario from a mass inventory, pressure, temperature and hole size specifications.
1058
789
  *
1059
790
  */
1060
791
  constructor(data: {
1061
- material: Entities.Material;
1062
- mass: number;
1063
- pressure: number;
1064
- temperature: number;
1065
- holeSize: number;
1066
- releaseElevation: number;
1067
- releaseAngle: number;
792
+ material: Entities.Material,
793
+ mass: number,
794
+ pressure: number,
795
+ temperature: number,
796
+ holeSize: number,
797
+ releaseElevation: number,
798
+ releaseAngle: number
1068
799
  controller?: AbortController;
1069
800
  }) {
1070
801
  super(data.controller);
@@ -1079,19 +810,17 @@ export class LoadMassInventoryVesselForLeakScenarioCalculation extends Calculati
1079
810
 
1080
811
  async run() {
1081
812
  try {
1082
- const request =
1083
- new LoadMassInventoryVesselForLeakScenarioCalculationRequest({
1084
- material: this.material,
1085
- mass: this.mass,
1086
- pressure: this.pressure,
1087
- temperature: this.temperature,
1088
- holeSize: this.holeSize,
1089
- releaseElevation: this.releaseElevation,
1090
- releaseAngle: this.releaseAngle,
1091
- });
813
+ const request = new LoadMassInventoryVesselForLeakScenarioCalculationRequest({
814
+ material: this.material,
815
+ mass: this.mass,
816
+ pressure: this.pressure,
817
+ temperature: this.temperature,
818
+ holeSize: this.holeSize,
819
+ releaseElevation: this.releaseElevation,
820
+ releaseAngle: this.releaseAngle
821
+ });
1092
822
 
1093
- const schema =
1094
- new LoadMassInventoryVesselForLeakScenarioCalculationRequestSchema();
823
+ const schema = new LoadMassInventoryVesselForLeakScenarioCalculationRequestSchema();
1095
824
  const validatedRequest = schema.validate(request);
1096
825
 
1097
826
  const requestJson = JSON.stringify(validatedRequest);
@@ -1101,8 +830,7 @@ export class LoadMassInventoryVesselForLeakScenarioCalculation extends Calculati
1101
830
 
1102
831
  const { data } = await this.postRequest(url, requestJson);
1103
832
 
1104
- const responseSchema =
1105
- new LoadMassInventoryVesselForLeakScenarioCalculationResponseSchema();
833
+ const responseSchema = new LoadMassInventoryVesselForLeakScenarioCalculationResponseSchema();
1106
834
  const validatedResponse = responseSchema.validate(data);
1107
835
 
1108
836
  this.resultCode = validatedResponse.resultCode;
@@ -1110,6 +838,7 @@ export class LoadMassInventoryVesselForLeakScenarioCalculation extends Calculati
1110
838
  Object.assign(this, {
1111
839
  vessel: validatedResponse.vessel,
1112
840
  leak: validatedResponse.leak,
841
+ volume: validatedResponse.volume,
1113
842
  resultCode: validatedResponse.resultCode,
1114
843
  messages: validatedResponse.messages ?? [],
1115
844
  calculationElapsedTime: validatedResponse.calculationElapsedTime,
@@ -1135,23 +864,12 @@ export class LoadMassInventoryVesselForLeakScenarioCalculation extends Calculati
1135
864
 
1136
865
  parts.push(`vessel: ${String(this.vessel)}`);
1137
866
  parts.push(`leak: ${String(this.leak)}`);
867
+ parts.push(`volume: ${String(this.volume)}`);
1138
868
  parts.push(`resultCode: ${String(this.resultCode)}`);
1139
869
  parts.push("*** messages:");
1140
- parts.push(
1141
- `messages: ${this.messages !== undefined ? this.messages : "(None)"}`
1142
- );
1143
- parts.push(
1144
- `calculationElapsedTime: ${
1145
- this.calculationElapsedTime !== undefined
1146
- ? this.calculationElapsedTime
1147
- : "(None)"
1148
- }`
1149
- );
1150
- parts.push(
1151
- `operationId: ${
1152
- this.operationId !== undefined ? this.operationId : "(None)"
1153
- }`
1154
- );
870
+ parts.push(`messages: ${this.messages !== undefined ? this.messages : "(None)"}`);
871
+ parts.push(`calculationElapsedTime: ${this.calculationElapsedTime !== undefined ? this.calculationElapsedTime : "(None)"}`);
872
+ parts.push(`operationId: ${this.operationId !== undefined ? this.operationId : "(None)"}`);
1155
873
 
1156
874
  return parts.join("\n");
1157
875
  }
@@ -1160,22 +878,25 @@ export class LoadMassInventoryVesselForLeakScenarioCalculation extends Calculati
1160
878
  export class LoadMassInventoryVesselForLeakScenarioCalculationResponse extends CalculationResponseBase {
1161
879
  vessel: Entities.Vessel;
1162
880
  leak: Entities.Leak;
881
+ volume: number;
1163
882
 
1164
883
  /**
1165
884
  * LoadMassInventoryVesselForLeakScenario calculation response class.
1166
885
  *
1167
886
  */
1168
887
  constructor(data: {
1169
- vessel: Entities.Vessel;
1170
- leak: Entities.Leak;
1171
- resultCode: Enums.ResultCode;
1172
- messages: string[];
1173
- calculationElapsedTime: number;
1174
- operationId: string;
888
+ vessel: Entities.Vessel,
889
+ leak: Entities.Leak,
890
+ volume: number,
891
+ resultCode: Enums.ResultCode,
892
+ messages: string[],
893
+ calculationElapsedTime: number,
894
+ operationId: string
1175
895
  }) {
1176
896
  super();
1177
897
  this.vessel = data.vessel;
1178
898
  this.leak = data.leak;
899
+ this.volume = data.volume;
1179
900
  this.resultCode = data.resultCode;
1180
901
  this.messages = data.messages;
1181
902
  this.calculationElapsedTime = data.calculationElapsedTime;
@@ -1185,37 +906,26 @@ export class LoadMassInventoryVesselForLeakScenarioCalculationResponse extends C
1185
906
  initialiseFromDictionary(data: { [key: string]: unknown }) {
1186
907
  if (data.vessel) {
1187
908
  this.vessel = new Entities.Vessel();
1188
- this.vessel.initialiseFromDictionary(
1189
- data.vessel as { [key: string]: unknown }
1190
- );
909
+ this.vessel.initialiseFromDictionary(data.vessel as { [key: string]: unknown });
1191
910
  }
1192
911
  if (data.leak) {
1193
912
  this.leak = new Entities.Leak();
1194
- this.leak.initialiseFromDictionary(
1195
- data.leak as { [key: string]: unknown }
1196
- );
1197
- }
1198
- if (
1199
- data.resultCode !== undefined &&
1200
- (typeof data.resultCode === "string" ||
1201
- typeof data.resultCode === "number")
1202
- ) {
913
+ this.leak.initialiseFromDictionary(data.leak as { [key: string]: unknown });
914
+ }
915
+ if (data.volume !== undefined && typeof data.volume === "number") {
916
+ this.volume = data.volume as number;
917
+ }
918
+ if (data.resultCode !== undefined && (typeof data.resultCode === "string" || typeof data.resultCode === "number")) {
1203
919
  this.resultCode = data.resultCode as Enums.ResultCode;
1204
920
  }
1205
921
  this.messages = this.messages ?? [];
1206
922
  if (data.messages && Array.isArray(data.messages)) {
1207
923
  this.messages.push(...data.messages);
1208
924
  }
1209
- if (
1210
- data.calculationElapsedTime !== undefined &&
1211
- typeof data.calculationElapsedTime === "number"
1212
- ) {
925
+ if (data.calculationElapsedTime !== undefined && typeof data.calculationElapsedTime === "number") {
1213
926
  this.calculationElapsedTime = data.calculationElapsedTime as number;
1214
927
  }
1215
- if (
1216
- data.operationId !== undefined &&
1217
- typeof data.operationId === "string"
1218
- ) {
928
+ if (data.operationId !== undefined && typeof data.operationId === "string") {
1219
929
  this.operationId = data.operationId as string;
1220
930
  }
1221
931
  }
@@ -1224,6 +934,7 @@ export class LoadMassInventoryVesselForLeakScenarioCalculationResponse extends C
1224
934
  export interface LoadMassInventoryVesselForLeakScenarioCalculationResponseSchemaData {
1225
935
  vessel: Entities.Vessel;
1226
936
  leak: Entities.Leak;
937
+ volume: number;
1227
938
  resultCode: Enums.ResultCode;
1228
939
  messages: string[];
1229
940
  calculationElapsedTime: number;
@@ -1241,6 +952,7 @@ export class LoadMassInventoryVesselForLeakScenarioCalculationResponseSchema {
1241
952
  this.schema = Joi.object({
1242
953
  vessel: new EntitySchemas.VesselSchema().schema,
1243
954
  leak: new EntitySchemas.LeakSchema().schema,
955
+ volume: Joi.number().unsafe(),
1244
956
  resultCode: Joi.string().valid(...Object.values(Enums.ResultCode)),
1245
957
  messages: Joi.array().items(Joi.string()),
1246
958
  calculationElapsedTime: Joi.number().unsafe(),
@@ -1250,24 +962,19 @@ export class LoadMassInventoryVesselForLeakScenarioCalculationResponseSchema {
1250
962
  this.propertyTypes = {
1251
963
  vessel: "Entities.Vessel",
1252
964
  leak: "Entities.Leak",
965
+ volume: "number",
1253
966
  };
1254
967
  }
1255
968
 
1256
- validate(
1257
- data: LoadMassInventoryVesselForLeakScenarioCalculationResponseSchemaData
1258
- ): LoadMassInventoryVesselForLeakScenarioCalculationResponse {
969
+ validate(data: LoadMassInventoryVesselForLeakScenarioCalculationResponseSchemaData): LoadMassInventoryVesselForLeakScenarioCalculationResponse {
1259
970
  const { error, value } = this.schema.validate(data, { abortEarly: false });
1260
971
  if (error) {
1261
- throw new Error(
1262
- `Validation error: ${error.details.map((x) => x.message).join(", ")}`
1263
- );
972
+ throw new Error(`Validation error: ${error.details.map((x) => x.message).join(", ")}`);
1264
973
  }
1265
974
  return this.makeCalculationResponse(value);
1266
975
  }
1267
976
 
1268
- makeCalculationResponse(
1269
- data: LoadMassInventoryVesselForLeakScenarioCalculationResponseSchemaData
1270
- ): LoadMassInventoryVesselForLeakScenarioCalculationResponse {
977
+ makeCalculationResponse(data: LoadMassInventoryVesselForLeakScenarioCalculationResponseSchemaData): LoadMassInventoryVesselForLeakScenarioCalculationResponse {
1271
978
  return new LoadMassInventoryVesselForLeakScenarioCalculationResponse(data);
1272
979
  }
1273
980
  }
@@ -1298,14 +1005,14 @@ class LoadMassInventoryVesselForLineRuptureScenarioCalculationRequest extends Ca
1298
1005
  *
1299
1006
  */
1300
1007
  constructor(data: {
1301
- material: Entities.Material;
1302
- mass: number;
1303
- pressure: number;
1304
- temperature: number;
1305
- pipeDiameter: number;
1306
- pipeLength: number;
1307
- releaseElevation: number;
1308
- releaseAngle: number;
1008
+ material: Entities.Material,
1009
+ mass: number,
1010
+ pressure: number,
1011
+ temperature: number,
1012
+ pipeDiameter: number,
1013
+ pipeLength: number,
1014
+ releaseElevation: number,
1015
+ releaseAngle: number
1309
1016
  }) {
1310
1017
  super();
1311
1018
  this.material = data.material;
@@ -1350,24 +1057,16 @@ export class LoadMassInventoryVesselForLineRuptureScenarioCalculationRequestSche
1350
1057
  };
1351
1058
  }
1352
1059
 
1353
- validate(
1354
- data: LoadMassInventoryVesselForLineRuptureScenarioCalculationRequestSchemaData
1355
- ): LoadMassInventoryVesselForLineRuptureScenarioCalculationRequest {
1060
+ validate(data: LoadMassInventoryVesselForLineRuptureScenarioCalculationRequestSchemaData): LoadMassInventoryVesselForLineRuptureScenarioCalculationRequest {
1356
1061
  const { error, value } = this.schema.validate(data, { abortEarly: false });
1357
1062
  if (error) {
1358
- throw new Error(
1359
- `Validation error: ${error.details.map((x) => x.message).join(", ")}`
1360
- );
1063
+ throw new Error(`Validation error: ${error.details.map((x) => x.message).join(", ")}`);
1361
1064
  }
1362
1065
  return this.makeCalculationRequest(value);
1363
1066
  }
1364
1067
 
1365
- makeCalculationRequest(
1366
- data: LoadMassInventoryVesselForLineRuptureScenarioCalculationRequestSchemaData
1367
- ): LoadMassInventoryVesselForLineRuptureScenarioCalculationRequest {
1368
- return new LoadMassInventoryVesselForLineRuptureScenarioCalculationRequest(
1369
- data
1370
- );
1068
+ makeCalculationRequest(data: LoadMassInventoryVesselForLineRuptureScenarioCalculationRequestSchemaData): LoadMassInventoryVesselForLineRuptureScenarioCalculationRequest {
1069
+ return new LoadMassInventoryVesselForLineRuptureScenarioCalculationRequest(data);
1371
1070
  }
1372
1071
  }
1373
1072
 
@@ -1382,20 +1081,21 @@ export class LoadMassInventoryVesselForLineRuptureScenarioCalculation extends Ca
1382
1081
  releaseAngle: number;
1383
1082
  vessel?: Entities.Vessel;
1384
1083
  lineRupture?: Entities.LineRupture;
1084
+ volume?: number;
1385
1085
 
1386
1086
  /**
1387
- * Sets up a vessel and a line rupture scenario from a mass inventory, pressure, temperature pipe diameter and length specifications.
1087
+ * Sets up a vessel and a line rupture scenario from a mass inventory, pressure, temperature, pipe diameter and length specifications.
1388
1088
  *
1389
1089
  */
1390
1090
  constructor(data: {
1391
- material: Entities.Material;
1392
- mass: number;
1393
- pressure: number;
1394
- temperature: number;
1395
- pipeDiameter: number;
1396
- pipeLength: number;
1397
- releaseElevation: number;
1398
- releaseAngle: number;
1091
+ material: Entities.Material,
1092
+ mass: number,
1093
+ pressure: number,
1094
+ temperature: number,
1095
+ pipeDiameter: number,
1096
+ pipeLength: number,
1097
+ releaseElevation: number,
1098
+ releaseAngle: number
1399
1099
  controller?: AbortController;
1400
1100
  }) {
1401
1101
  super(data.controller);
@@ -1411,20 +1111,18 @@ export class LoadMassInventoryVesselForLineRuptureScenarioCalculation extends Ca
1411
1111
 
1412
1112
  async run() {
1413
1113
  try {
1414
- const request =
1415
- new LoadMassInventoryVesselForLineRuptureScenarioCalculationRequest({
1416
- material: this.material,
1417
- mass: this.mass,
1418
- pressure: this.pressure,
1419
- temperature: this.temperature,
1420
- pipeDiameter: this.pipeDiameter,
1421
- pipeLength: this.pipeLength,
1422
- releaseElevation: this.releaseElevation,
1423
- releaseAngle: this.releaseAngle,
1424
- });
1114
+ const request = new LoadMassInventoryVesselForLineRuptureScenarioCalculationRequest({
1115
+ material: this.material,
1116
+ mass: this.mass,
1117
+ pressure: this.pressure,
1118
+ temperature: this.temperature,
1119
+ pipeDiameter: this.pipeDiameter,
1120
+ pipeLength: this.pipeLength,
1121
+ releaseElevation: this.releaseElevation,
1122
+ releaseAngle: this.releaseAngle
1123
+ });
1425
1124
 
1426
- const schema =
1427
- new LoadMassInventoryVesselForLineRuptureScenarioCalculationRequestSchema();
1125
+ const schema = new LoadMassInventoryVesselForLineRuptureScenarioCalculationRequestSchema();
1428
1126
  const validatedRequest = schema.validate(request);
1429
1127
 
1430
1128
  const requestJson = JSON.stringify(validatedRequest);
@@ -1434,8 +1132,7 @@ export class LoadMassInventoryVesselForLineRuptureScenarioCalculation extends Ca
1434
1132
 
1435
1133
  const { data } = await this.postRequest(url, requestJson);
1436
1134
 
1437
- const responseSchema =
1438
- new LoadMassInventoryVesselForLineRuptureScenarioCalculationResponseSchema();
1135
+ const responseSchema = new LoadMassInventoryVesselForLineRuptureScenarioCalculationResponseSchema();
1439
1136
  const validatedResponse = responseSchema.validate(data);
1440
1137
 
1441
1138
  this.resultCode = validatedResponse.resultCode;
@@ -1443,6 +1140,7 @@ export class LoadMassInventoryVesselForLineRuptureScenarioCalculation extends Ca
1443
1140
  Object.assign(this, {
1444
1141
  vessel: validatedResponse.vessel,
1445
1142
  lineRupture: validatedResponse.lineRupture,
1143
+ volume: validatedResponse.volume,
1446
1144
  resultCode: validatedResponse.resultCode,
1447
1145
  messages: validatedResponse.messages ?? [],
1448
1146
  calculationElapsedTime: validatedResponse.calculationElapsedTime,
@@ -1468,23 +1166,12 @@ export class LoadMassInventoryVesselForLineRuptureScenarioCalculation extends Ca
1468
1166
 
1469
1167
  parts.push(`vessel: ${String(this.vessel)}`);
1470
1168
  parts.push(`lineRupture: ${String(this.lineRupture)}`);
1169
+ parts.push(`volume: ${String(this.volume)}`);
1471
1170
  parts.push(`resultCode: ${String(this.resultCode)}`);
1472
1171
  parts.push("*** messages:");
1473
- parts.push(
1474
- `messages: ${this.messages !== undefined ? this.messages : "(None)"}`
1475
- );
1476
- parts.push(
1477
- `calculationElapsedTime: ${
1478
- this.calculationElapsedTime !== undefined
1479
- ? this.calculationElapsedTime
1480
- : "(None)"
1481
- }`
1482
- );
1483
- parts.push(
1484
- `operationId: ${
1485
- this.operationId !== undefined ? this.operationId : "(None)"
1486
- }`
1487
- );
1172
+ parts.push(`messages: ${this.messages !== undefined ? this.messages : "(None)"}`);
1173
+ parts.push(`calculationElapsedTime: ${this.calculationElapsedTime !== undefined ? this.calculationElapsedTime : "(None)"}`);
1174
+ parts.push(`operationId: ${this.operationId !== undefined ? this.operationId : "(None)"}`);
1488
1175
 
1489
1176
  return parts.join("\n");
1490
1177
  }
@@ -1493,22 +1180,25 @@ export class LoadMassInventoryVesselForLineRuptureScenarioCalculation extends Ca
1493
1180
  export class LoadMassInventoryVesselForLineRuptureScenarioCalculationResponse extends CalculationResponseBase {
1494
1181
  vessel: Entities.Vessel;
1495
1182
  lineRupture: Entities.LineRupture;
1183
+ volume: number;
1496
1184
 
1497
1185
  /**
1498
1186
  * LoadMassInventoryVesselForLineRuptureScenario calculation response class.
1499
1187
  *
1500
1188
  */
1501
1189
  constructor(data: {
1502
- vessel: Entities.Vessel;
1503
- lineRupture: Entities.LineRupture;
1504
- resultCode: Enums.ResultCode;
1505
- messages: string[];
1506
- calculationElapsedTime: number;
1507
- operationId: string;
1190
+ vessel: Entities.Vessel,
1191
+ lineRupture: Entities.LineRupture,
1192
+ volume: number,
1193
+ resultCode: Enums.ResultCode,
1194
+ messages: string[],
1195
+ calculationElapsedTime: number,
1196
+ operationId: string
1508
1197
  }) {
1509
1198
  super();
1510
1199
  this.vessel = data.vessel;
1511
1200
  this.lineRupture = data.lineRupture;
1201
+ this.volume = data.volume;
1512
1202
  this.resultCode = data.resultCode;
1513
1203
  this.messages = data.messages;
1514
1204
  this.calculationElapsedTime = data.calculationElapsedTime;
@@ -1518,37 +1208,26 @@ export class LoadMassInventoryVesselForLineRuptureScenarioCalculationResponse ex
1518
1208
  initialiseFromDictionary(data: { [key: string]: unknown }) {
1519
1209
  if (data.vessel) {
1520
1210
  this.vessel = new Entities.Vessel();
1521
- this.vessel.initialiseFromDictionary(
1522
- data.vessel as { [key: string]: unknown }
1523
- );
1211
+ this.vessel.initialiseFromDictionary(data.vessel as { [key: string]: unknown });
1524
1212
  }
1525
1213
  if (data.lineRupture) {
1526
1214
  this.lineRupture = new Entities.LineRupture();
1527
- this.lineRupture.initialiseFromDictionary(
1528
- data.lineRupture as { [key: string]: unknown }
1529
- );
1530
- }
1531
- if (
1532
- data.resultCode !== undefined &&
1533
- (typeof data.resultCode === "string" ||
1534
- typeof data.resultCode === "number")
1535
- ) {
1215
+ this.lineRupture.initialiseFromDictionary(data.lineRupture as { [key: string]: unknown });
1216
+ }
1217
+ if (data.volume !== undefined && typeof data.volume === "number") {
1218
+ this.volume = data.volume as number;
1219
+ }
1220
+ if (data.resultCode !== undefined && (typeof data.resultCode === "string" || typeof data.resultCode === "number")) {
1536
1221
  this.resultCode = data.resultCode as Enums.ResultCode;
1537
1222
  }
1538
1223
  this.messages = this.messages ?? [];
1539
1224
  if (data.messages && Array.isArray(data.messages)) {
1540
1225
  this.messages.push(...data.messages);
1541
1226
  }
1542
- if (
1543
- data.calculationElapsedTime !== undefined &&
1544
- typeof data.calculationElapsedTime === "number"
1545
- ) {
1227
+ if (data.calculationElapsedTime !== undefined && typeof data.calculationElapsedTime === "number") {
1546
1228
  this.calculationElapsedTime = data.calculationElapsedTime as number;
1547
1229
  }
1548
- if (
1549
- data.operationId !== undefined &&
1550
- typeof data.operationId === "string"
1551
- ) {
1230
+ if (data.operationId !== undefined && typeof data.operationId === "string") {
1552
1231
  this.operationId = data.operationId as string;
1553
1232
  }
1554
1233
  }
@@ -1557,6 +1236,7 @@ export class LoadMassInventoryVesselForLineRuptureScenarioCalculationResponse ex
1557
1236
  export interface LoadMassInventoryVesselForLineRuptureScenarioCalculationResponseSchemaData {
1558
1237
  vessel: Entities.Vessel;
1559
1238
  lineRupture: Entities.LineRupture;
1239
+ volume: number;
1560
1240
  resultCode: Enums.ResultCode;
1561
1241
  messages: string[];
1562
1242
  calculationElapsedTime: number;
@@ -1574,6 +1254,7 @@ export class LoadMassInventoryVesselForLineRuptureScenarioCalculationResponseSch
1574
1254
  this.schema = Joi.object({
1575
1255
  vessel: new EntitySchemas.VesselSchema().schema,
1576
1256
  lineRupture: new EntitySchemas.LineRuptureSchema().schema,
1257
+ volume: Joi.number().unsafe(),
1577
1258
  resultCode: Joi.string().valid(...Object.values(Enums.ResultCode)),
1578
1259
  messages: Joi.array().items(Joi.string()),
1579
1260
  calculationElapsedTime: Joi.number().unsafe(),
@@ -1583,27 +1264,20 @@ export class LoadMassInventoryVesselForLineRuptureScenarioCalculationResponseSch
1583
1264
  this.propertyTypes = {
1584
1265
  vessel: "Entities.Vessel",
1585
1266
  lineRupture: "Entities.LineRupture",
1267
+ volume: "number",
1586
1268
  };
1587
1269
  }
1588
1270
 
1589
- validate(
1590
- data: LoadMassInventoryVesselForLineRuptureScenarioCalculationResponseSchemaData
1591
- ): LoadMassInventoryVesselForLineRuptureScenarioCalculationResponse {
1271
+ validate(data: LoadMassInventoryVesselForLineRuptureScenarioCalculationResponseSchemaData): LoadMassInventoryVesselForLineRuptureScenarioCalculationResponse {
1592
1272
  const { error, value } = this.schema.validate(data, { abortEarly: false });
1593
1273
  if (error) {
1594
- throw new Error(
1595
- `Validation error: ${error.details.map((x) => x.message).join(", ")}`
1596
- );
1274
+ throw new Error(`Validation error: ${error.details.map((x) => x.message).join(", ")}`);
1597
1275
  }
1598
1276
  return this.makeCalculationResponse(value);
1599
1277
  }
1600
1278
 
1601
- makeCalculationResponse(
1602
- data: LoadMassInventoryVesselForLineRuptureScenarioCalculationResponseSchemaData
1603
- ): LoadMassInventoryVesselForLineRuptureScenarioCalculationResponse {
1604
- return new LoadMassInventoryVesselForLineRuptureScenarioCalculationResponse(
1605
- data
1606
- );
1279
+ makeCalculationResponse(data: LoadMassInventoryVesselForLineRuptureScenarioCalculationResponseSchemaData): LoadMassInventoryVesselForLineRuptureScenarioCalculationResponse {
1280
+ return new LoadMassInventoryVesselForLineRuptureScenarioCalculationResponse(data);
1607
1281
  }
1608
1282
  }
1609
1283
 
@@ -1635,15 +1309,15 @@ class LoadMassInventoryVesselForReliefValveScenarioCalculationRequest extends Ca
1635
1309
  *
1636
1310
  */
1637
1311
  constructor(data: {
1638
- material: Entities.Material;
1639
- mass: number;
1640
- pressure: number;
1641
- temperature: number;
1642
- constrictionSize: number;
1643
- pipeDiameter: number;
1644
- pipeLength: number;
1645
- releaseElevation: number;
1646
- releaseAngle: number;
1312
+ material: Entities.Material,
1313
+ mass: number,
1314
+ pressure: number,
1315
+ temperature: number,
1316
+ constrictionSize: number,
1317
+ pipeDiameter: number,
1318
+ pipeLength: number,
1319
+ releaseElevation: number,
1320
+ releaseAngle: number
1647
1321
  }) {
1648
1322
  super();
1649
1323
  this.material = data.material;
@@ -1691,24 +1365,16 @@ export class LoadMassInventoryVesselForReliefValveScenarioCalculationRequestSche
1691
1365
  };
1692
1366
  }
1693
1367
 
1694
- validate(
1695
- data: LoadMassInventoryVesselForReliefValveScenarioCalculationRequestSchemaData
1696
- ): LoadMassInventoryVesselForReliefValveScenarioCalculationRequest {
1368
+ validate(data: LoadMassInventoryVesselForReliefValveScenarioCalculationRequestSchemaData): LoadMassInventoryVesselForReliefValveScenarioCalculationRequest {
1697
1369
  const { error, value } = this.schema.validate(data, { abortEarly: false });
1698
1370
  if (error) {
1699
- throw new Error(
1700
- `Validation error: ${error.details.map((x) => x.message).join(", ")}`
1701
- );
1371
+ throw new Error(`Validation error: ${error.details.map((x) => x.message).join(", ")}`);
1702
1372
  }
1703
1373
  return this.makeCalculationRequest(value);
1704
1374
  }
1705
1375
 
1706
- makeCalculationRequest(
1707
- data: LoadMassInventoryVesselForReliefValveScenarioCalculationRequestSchemaData
1708
- ): LoadMassInventoryVesselForReliefValveScenarioCalculationRequest {
1709
- return new LoadMassInventoryVesselForReliefValveScenarioCalculationRequest(
1710
- data
1711
- );
1376
+ makeCalculationRequest(data: LoadMassInventoryVesselForReliefValveScenarioCalculationRequestSchemaData): LoadMassInventoryVesselForReliefValveScenarioCalculationRequest {
1377
+ return new LoadMassInventoryVesselForReliefValveScenarioCalculationRequest(data);
1712
1378
  }
1713
1379
  }
1714
1380
 
@@ -1724,21 +1390,22 @@ export class LoadMassInventoryVesselForReliefValveScenarioCalculation extends Ca
1724
1390
  releaseAngle: number;
1725
1391
  vessel?: Entities.Vessel;
1726
1392
  reliefValve?: Entities.ReliefValve;
1393
+ volume?: number;
1727
1394
 
1728
1395
  /**
1729
- * Sets up a vessel and a relief valve scenario from a mass inventory, pressure, temperature pipe diameter, length and constriction size specifications.
1396
+ * Sets up a vessel and a relief valve scenario from a mass inventory, pressure, temperature, pipe diameter, length and constriction size specifications.
1730
1397
  *
1731
1398
  */
1732
1399
  constructor(data: {
1733
- material: Entities.Material;
1734
- mass: number;
1735
- pressure: number;
1736
- temperature: number;
1737
- constrictionSize: number;
1738
- pipeDiameter: number;
1739
- pipeLength: number;
1740
- releaseElevation: number;
1741
- releaseAngle: number;
1400
+ material: Entities.Material,
1401
+ mass: number,
1402
+ pressure: number,
1403
+ temperature: number,
1404
+ constrictionSize: number,
1405
+ pipeDiameter: number,
1406
+ pipeLength: number,
1407
+ releaseElevation: number,
1408
+ releaseAngle: number
1742
1409
  controller?: AbortController;
1743
1410
  }) {
1744
1411
  super(data.controller);
@@ -1755,21 +1422,19 @@ export class LoadMassInventoryVesselForReliefValveScenarioCalculation extends Ca
1755
1422
 
1756
1423
  async run() {
1757
1424
  try {
1758
- const request =
1759
- new LoadMassInventoryVesselForReliefValveScenarioCalculationRequest({
1760
- material: this.material,
1761
- mass: this.mass,
1762
- pressure: this.pressure,
1763
- temperature: this.temperature,
1764
- constrictionSize: this.constrictionSize,
1765
- pipeDiameter: this.pipeDiameter,
1766
- pipeLength: this.pipeLength,
1767
- releaseElevation: this.releaseElevation,
1768
- releaseAngle: this.releaseAngle,
1769
- });
1425
+ const request = new LoadMassInventoryVesselForReliefValveScenarioCalculationRequest({
1426
+ material: this.material,
1427
+ mass: this.mass,
1428
+ pressure: this.pressure,
1429
+ temperature: this.temperature,
1430
+ constrictionSize: this.constrictionSize,
1431
+ pipeDiameter: this.pipeDiameter,
1432
+ pipeLength: this.pipeLength,
1433
+ releaseElevation: this.releaseElevation,
1434
+ releaseAngle: this.releaseAngle
1435
+ });
1770
1436
 
1771
- const schema =
1772
- new LoadMassInventoryVesselForReliefValveScenarioCalculationRequestSchema();
1437
+ const schema = new LoadMassInventoryVesselForReliefValveScenarioCalculationRequestSchema();
1773
1438
  const validatedRequest = schema.validate(request);
1774
1439
 
1775
1440
  const requestJson = JSON.stringify(validatedRequest);
@@ -1779,8 +1444,7 @@ export class LoadMassInventoryVesselForReliefValveScenarioCalculation extends Ca
1779
1444
 
1780
1445
  const { data } = await this.postRequest(url, requestJson);
1781
1446
 
1782
- const responseSchema =
1783
- new LoadMassInventoryVesselForReliefValveScenarioCalculationResponseSchema();
1447
+ const responseSchema = new LoadMassInventoryVesselForReliefValveScenarioCalculationResponseSchema();
1784
1448
  const validatedResponse = responseSchema.validate(data);
1785
1449
 
1786
1450
  this.resultCode = validatedResponse.resultCode;
@@ -1788,6 +1452,7 @@ export class LoadMassInventoryVesselForReliefValveScenarioCalculation extends Ca
1788
1452
  Object.assign(this, {
1789
1453
  vessel: validatedResponse.vessel,
1790
1454
  reliefValve: validatedResponse.reliefValve,
1455
+ volume: validatedResponse.volume,
1791
1456
  resultCode: validatedResponse.resultCode,
1792
1457
  messages: validatedResponse.messages ?? [],
1793
1458
  calculationElapsedTime: validatedResponse.calculationElapsedTime,
@@ -1813,23 +1478,12 @@ export class LoadMassInventoryVesselForReliefValveScenarioCalculation extends Ca
1813
1478
 
1814
1479
  parts.push(`vessel: ${String(this.vessel)}`);
1815
1480
  parts.push(`reliefValve: ${String(this.reliefValve)}`);
1481
+ parts.push(`volume: ${String(this.volume)}`);
1816
1482
  parts.push(`resultCode: ${String(this.resultCode)}`);
1817
1483
  parts.push("*** messages:");
1818
- parts.push(
1819
- `messages: ${this.messages !== undefined ? this.messages : "(None)"}`
1820
- );
1821
- parts.push(
1822
- `calculationElapsedTime: ${
1823
- this.calculationElapsedTime !== undefined
1824
- ? this.calculationElapsedTime
1825
- : "(None)"
1826
- }`
1827
- );
1828
- parts.push(
1829
- `operationId: ${
1830
- this.operationId !== undefined ? this.operationId : "(None)"
1831
- }`
1832
- );
1484
+ parts.push(`messages: ${this.messages !== undefined ? this.messages : "(None)"}`);
1485
+ parts.push(`calculationElapsedTime: ${this.calculationElapsedTime !== undefined ? this.calculationElapsedTime : "(None)"}`);
1486
+ parts.push(`operationId: ${this.operationId !== undefined ? this.operationId : "(None)"}`);
1833
1487
 
1834
1488
  return parts.join("\n");
1835
1489
  }
@@ -1838,22 +1492,25 @@ export class LoadMassInventoryVesselForReliefValveScenarioCalculation extends Ca
1838
1492
  export class LoadMassInventoryVesselForReliefValveScenarioCalculationResponse extends CalculationResponseBase {
1839
1493
  vessel: Entities.Vessel;
1840
1494
  reliefValve: Entities.ReliefValve;
1495
+ volume: number;
1841
1496
 
1842
1497
  /**
1843
1498
  * LoadMassInventoryVesselForReliefValveScenario calculation response class.
1844
1499
  *
1845
1500
  */
1846
1501
  constructor(data: {
1847
- vessel: Entities.Vessel;
1848
- reliefValve: Entities.ReliefValve;
1849
- resultCode: Enums.ResultCode;
1850
- messages: string[];
1851
- calculationElapsedTime: number;
1852
- operationId: string;
1502
+ vessel: Entities.Vessel,
1503
+ reliefValve: Entities.ReliefValve,
1504
+ volume: number,
1505
+ resultCode: Enums.ResultCode,
1506
+ messages: string[],
1507
+ calculationElapsedTime: number,
1508
+ operationId: string
1853
1509
  }) {
1854
1510
  super();
1855
1511
  this.vessel = data.vessel;
1856
1512
  this.reliefValve = data.reliefValve;
1513
+ this.volume = data.volume;
1857
1514
  this.resultCode = data.resultCode;
1858
1515
  this.messages = data.messages;
1859
1516
  this.calculationElapsedTime = data.calculationElapsedTime;
@@ -1863,37 +1520,26 @@ export class LoadMassInventoryVesselForReliefValveScenarioCalculationResponse ex
1863
1520
  initialiseFromDictionary(data: { [key: string]: unknown }) {
1864
1521
  if (data.vessel) {
1865
1522
  this.vessel = new Entities.Vessel();
1866
- this.vessel.initialiseFromDictionary(
1867
- data.vessel as { [key: string]: unknown }
1868
- );
1523
+ this.vessel.initialiseFromDictionary(data.vessel as { [key: string]: unknown });
1869
1524
  }
1870
1525
  if (data.reliefValve) {
1871
1526
  this.reliefValve = new Entities.ReliefValve();
1872
- this.reliefValve.initialiseFromDictionary(
1873
- data.reliefValve as { [key: string]: unknown }
1874
- );
1875
- }
1876
- if (
1877
- data.resultCode !== undefined &&
1878
- (typeof data.resultCode === "string" ||
1879
- typeof data.resultCode === "number")
1880
- ) {
1527
+ this.reliefValve.initialiseFromDictionary(data.reliefValve as { [key: string]: unknown });
1528
+ }
1529
+ if (data.volume !== undefined && typeof data.volume === "number") {
1530
+ this.volume = data.volume as number;
1531
+ }
1532
+ if (data.resultCode !== undefined && (typeof data.resultCode === "string" || typeof data.resultCode === "number")) {
1881
1533
  this.resultCode = data.resultCode as Enums.ResultCode;
1882
1534
  }
1883
1535
  this.messages = this.messages ?? [];
1884
1536
  if (data.messages && Array.isArray(data.messages)) {
1885
1537
  this.messages.push(...data.messages);
1886
1538
  }
1887
- if (
1888
- data.calculationElapsedTime !== undefined &&
1889
- typeof data.calculationElapsedTime === "number"
1890
- ) {
1539
+ if (data.calculationElapsedTime !== undefined && typeof data.calculationElapsedTime === "number") {
1891
1540
  this.calculationElapsedTime = data.calculationElapsedTime as number;
1892
1541
  }
1893
- if (
1894
- data.operationId !== undefined &&
1895
- typeof data.operationId === "string"
1896
- ) {
1542
+ if (data.operationId !== undefined && typeof data.operationId === "string") {
1897
1543
  this.operationId = data.operationId as string;
1898
1544
  }
1899
1545
  }
@@ -1902,6 +1548,7 @@ export class LoadMassInventoryVesselForReliefValveScenarioCalculationResponse ex
1902
1548
  export interface LoadMassInventoryVesselForReliefValveScenarioCalculationResponseSchemaData {
1903
1549
  vessel: Entities.Vessel;
1904
1550
  reliefValve: Entities.ReliefValve;
1551
+ volume: number;
1905
1552
  resultCode: Enums.ResultCode;
1906
1553
  messages: string[];
1907
1554
  calculationElapsedTime: number;
@@ -1919,6 +1566,7 @@ export class LoadMassInventoryVesselForReliefValveScenarioCalculationResponseSch
1919
1566
  this.schema = Joi.object({
1920
1567
  vessel: new EntitySchemas.VesselSchema().schema,
1921
1568
  reliefValve: new EntitySchemas.ReliefValveSchema().schema,
1569
+ volume: Joi.number().unsafe(),
1922
1570
  resultCode: Joi.string().valid(...Object.values(Enums.ResultCode)),
1923
1571
  messages: Joi.array().items(Joi.string()),
1924
1572
  calculationElapsedTime: Joi.number().unsafe(),
@@ -1928,27 +1576,20 @@ export class LoadMassInventoryVesselForReliefValveScenarioCalculationResponseSch
1928
1576
  this.propertyTypes = {
1929
1577
  vessel: "Entities.Vessel",
1930
1578
  reliefValve: "Entities.ReliefValve",
1579
+ volume: "number",
1931
1580
  };
1932
1581
  }
1933
1582
 
1934
- validate(
1935
- data: LoadMassInventoryVesselForReliefValveScenarioCalculationResponseSchemaData
1936
- ): LoadMassInventoryVesselForReliefValveScenarioCalculationResponse {
1583
+ validate(data: LoadMassInventoryVesselForReliefValveScenarioCalculationResponseSchemaData): LoadMassInventoryVesselForReliefValveScenarioCalculationResponse {
1937
1584
  const { error, value } = this.schema.validate(data, { abortEarly: false });
1938
1585
  if (error) {
1939
- throw new Error(
1940
- `Validation error: ${error.details.map((x) => x.message).join(", ")}`
1941
- );
1586
+ throw new Error(`Validation error: ${error.details.map((x) => x.message).join(", ")}`);
1942
1587
  }
1943
1588
  return this.makeCalculationResponse(value);
1944
1589
  }
1945
1590
 
1946
- makeCalculationResponse(
1947
- data: LoadMassInventoryVesselForReliefValveScenarioCalculationResponseSchemaData
1948
- ): LoadMassInventoryVesselForReliefValveScenarioCalculationResponse {
1949
- return new LoadMassInventoryVesselForReliefValveScenarioCalculationResponse(
1950
- data
1951
- );
1591
+ makeCalculationResponse(data: LoadMassInventoryVesselForReliefValveScenarioCalculationResponseSchemaData): LoadMassInventoryVesselForReliefValveScenarioCalculationResponse {
1592
+ return new LoadMassInventoryVesselForReliefValveScenarioCalculationResponse(data);
1952
1593
  }
1953
1594
  }
1954
1595
 
@@ -1965,7 +1606,10 @@ class ReliefValveMinTemperatureCalculationRequest extends CalculationRequestBase
1965
1606
  * ReliefValveMinTemperature calculation request class.
1966
1607
  *
1967
1608
  */
1968
- constructor(data: { material: Entities.Material; pressure: number }) {
1609
+ constructor(data: {
1610
+ material: Entities.Material,
1611
+ pressure: number
1612
+ }) {
1969
1613
  super();
1970
1614
  this.material = data.material;
1971
1615
  this.pressure = data.pressure;
@@ -1991,21 +1635,15 @@ export class ReliefValveMinTemperatureCalculationRequestSchema {
1991
1635
  };
1992
1636
  }
1993
1637
 
1994
- validate(
1995
- data: ReliefValveMinTemperatureCalculationRequestSchemaData
1996
- ): ReliefValveMinTemperatureCalculationRequest {
1638
+ validate(data: ReliefValveMinTemperatureCalculationRequestSchemaData): ReliefValveMinTemperatureCalculationRequest {
1997
1639
  const { error, value } = this.schema.validate(data, { abortEarly: false });
1998
1640
  if (error) {
1999
- throw new Error(
2000
- `Validation error: ${error.details.map((x) => x.message).join(", ")}`
2001
- );
1641
+ throw new Error(`Validation error: ${error.details.map((x) => x.message).join(", ")}`);
2002
1642
  }
2003
1643
  return this.makeCalculationRequest(value);
2004
1644
  }
2005
1645
 
2006
- makeCalculationRequest(
2007
- data: ReliefValveMinTemperatureCalculationRequestSchemaData
2008
- ): ReliefValveMinTemperatureCalculationRequest {
1646
+ makeCalculationRequest(data: ReliefValveMinTemperatureCalculationRequestSchemaData): ReliefValveMinTemperatureCalculationRequest {
2009
1647
  return new ReliefValveMinTemperatureCalculationRequest(data);
2010
1648
  }
2011
1649
  }
@@ -2020,8 +1658,8 @@ export class ReliefValveMinTemperatureCalculation extends CalculationBase {
2020
1658
  *
2021
1659
  */
2022
1660
  constructor(data: {
2023
- material: Entities.Material;
2024
- pressure: number;
1661
+ material: Entities.Material,
1662
+ pressure: number
2025
1663
  controller?: AbortController;
2026
1664
  }) {
2027
1665
  super(data.controller);
@@ -2033,7 +1671,7 @@ export class ReliefValveMinTemperatureCalculation extends CalculationBase {
2033
1671
  try {
2034
1672
  const request = new ReliefValveMinTemperatureCalculationRequest({
2035
1673
  material: this.material,
2036
- pressure: this.pressure,
1674
+ pressure: this.pressure
2037
1675
  });
2038
1676
 
2039
1677
  const schema = new ReliefValveMinTemperatureCalculationRequestSchema();
@@ -2046,8 +1684,7 @@ export class ReliefValveMinTemperatureCalculation extends CalculationBase {
2046
1684
 
2047
1685
  const { data } = await this.postRequest(url, requestJson);
2048
1686
 
2049
- const responseSchema =
2050
- new ReliefValveMinTemperatureCalculationResponseSchema();
1687
+ const responseSchema = new ReliefValveMinTemperatureCalculationResponseSchema();
2051
1688
  const validatedResponse = responseSchema.validate(data);
2052
1689
 
2053
1690
  this.resultCode = validatedResponse.resultCode;
@@ -2080,21 +1717,9 @@ export class ReliefValveMinTemperatureCalculation extends CalculationBase {
2080
1717
  parts.push(`minTemperature: ${String(this.minTemperature)}`);
2081
1718
  parts.push(`resultCode: ${String(this.resultCode)}`);
2082
1719
  parts.push("*** messages:");
2083
- parts.push(
2084
- `messages: ${this.messages !== undefined ? this.messages : "(None)"}`
2085
- );
2086
- parts.push(
2087
- `calculationElapsedTime: ${
2088
- this.calculationElapsedTime !== undefined
2089
- ? this.calculationElapsedTime
2090
- : "(None)"
2091
- }`
2092
- );
2093
- parts.push(
2094
- `operationId: ${
2095
- this.operationId !== undefined ? this.operationId : "(None)"
2096
- }`
2097
- );
1720
+ parts.push(`messages: ${this.messages !== undefined ? this.messages : "(None)"}`);
1721
+ parts.push(`calculationElapsedTime: ${this.calculationElapsedTime !== undefined ? this.calculationElapsedTime : "(None)"}`);
1722
+ parts.push(`operationId: ${this.operationId !== undefined ? this.operationId : "(None)"}`);
2098
1723
 
2099
1724
  return parts.join("\n");
2100
1725
  }
@@ -2108,11 +1733,11 @@ export class ReliefValveMinTemperatureCalculationResponse extends CalculationRes
2108
1733
  *
2109
1734
  */
2110
1735
  constructor(data: {
2111
- minTemperature: number;
2112
- resultCode: Enums.ResultCode;
2113
- messages: string[];
2114
- calculationElapsedTime: number;
2115
- operationId: string;
1736
+ minTemperature: number,
1737
+ resultCode: Enums.ResultCode,
1738
+ messages: string[],
1739
+ calculationElapsedTime: number,
1740
+ operationId: string
2116
1741
  }) {
2117
1742
  super();
2118
1743
  this.minTemperature = data.minTemperature;
@@ -2123,33 +1748,20 @@ export class ReliefValveMinTemperatureCalculationResponse extends CalculationRes
2123
1748
  }
2124
1749
 
2125
1750
  initialiseFromDictionary(data: { [key: string]: unknown }) {
2126
- if (
2127
- data.minTemperature !== undefined &&
2128
- typeof data.minTemperature === "number"
2129
- ) {
1751
+ if (data.minTemperature !== undefined && typeof data.minTemperature === "number") {
2130
1752
  this.minTemperature = data.minTemperature as number;
2131
1753
  }
2132
- if (
2133
- data.resultCode !== undefined &&
2134
- (typeof data.resultCode === "string" ||
2135
- typeof data.resultCode === "number")
2136
- ) {
1754
+ if (data.resultCode !== undefined && (typeof data.resultCode === "string" || typeof data.resultCode === "number")) {
2137
1755
  this.resultCode = data.resultCode as Enums.ResultCode;
2138
1756
  }
2139
1757
  this.messages = this.messages ?? [];
2140
1758
  if (data.messages && Array.isArray(data.messages)) {
2141
1759
  this.messages.push(...data.messages);
2142
1760
  }
2143
- if (
2144
- data.calculationElapsedTime !== undefined &&
2145
- typeof data.calculationElapsedTime === "number"
2146
- ) {
1761
+ if (data.calculationElapsedTime !== undefined && typeof data.calculationElapsedTime === "number") {
2147
1762
  this.calculationElapsedTime = data.calculationElapsedTime as number;
2148
1763
  }
2149
- if (
2150
- data.operationId !== undefined &&
2151
- typeof data.operationId === "string"
2152
- ) {
1764
+ if (data.operationId !== undefined && typeof data.operationId === "string") {
2153
1765
  this.operationId = data.operationId as string;
2154
1766
  }
2155
1767
  }
@@ -2184,21 +1796,15 @@ export class ReliefValveMinTemperatureCalculationResponseSchema {
2184
1796
  };
2185
1797
  }
2186
1798
 
2187
- validate(
2188
- data: ReliefValveMinTemperatureCalculationResponseSchemaData
2189
- ): ReliefValveMinTemperatureCalculationResponse {
1799
+ validate(data: ReliefValveMinTemperatureCalculationResponseSchemaData): ReliefValveMinTemperatureCalculationResponse {
2190
1800
  const { error, value } = this.schema.validate(data, { abortEarly: false });
2191
1801
  if (error) {
2192
- throw new Error(
2193
- `Validation error: ${error.details.map((x) => x.message).join(", ")}`
2194
- );
1802
+ throw new Error(`Validation error: ${error.details.map((x) => x.message).join(", ")}`);
2195
1803
  }
2196
1804
  return this.makeCalculationResponse(value);
2197
1805
  }
2198
1806
 
2199
- makeCalculationResponse(
2200
- data: ReliefValveMinTemperatureCalculationResponseSchemaData
2201
- ): ReliefValveMinTemperatureCalculationResponse {
1807
+ makeCalculationResponse(data: ReliefValveMinTemperatureCalculationResponseSchemaData): ReliefValveMinTemperatureCalculationResponse {
2202
1808
  return new ReliefValveMinTemperatureCalculationResponse(data);
2203
1809
  }
2204
1810
  }
@@ -2214,7 +1820,9 @@ class SetMixingLayerHeightCalculationRequest extends CalculationRequestBase {
2214
1820
  * SetMixingLayerHeight calculation request class.
2215
1821
  *
2216
1822
  */
2217
- constructor(data: { weather: Entities.Weather }) {
1823
+ constructor(data: {
1824
+ weather: Entities.Weather
1825
+ }) {
2218
1826
  super();
2219
1827
  this.weather = data.weather;
2220
1828
  }
@@ -2237,21 +1845,15 @@ export class SetMixingLayerHeightCalculationRequestSchema {
2237
1845
  };
2238
1846
  }
2239
1847
 
2240
- validate(
2241
- data: SetMixingLayerHeightCalculationRequestSchemaData
2242
- ): SetMixingLayerHeightCalculationRequest {
1848
+ validate(data: SetMixingLayerHeightCalculationRequestSchemaData): SetMixingLayerHeightCalculationRequest {
2243
1849
  const { error, value } = this.schema.validate(data, { abortEarly: false });
2244
1850
  if (error) {
2245
- throw new Error(
2246
- `Validation error: ${error.details.map((x) => x.message).join(", ")}`
2247
- );
1851
+ throw new Error(`Validation error: ${error.details.map((x) => x.message).join(", ")}`);
2248
1852
  }
2249
1853
  return this.makeCalculationRequest(value);
2250
1854
  }
2251
1855
 
2252
- makeCalculationRequest(
2253
- data: SetMixingLayerHeightCalculationRequestSchemaData
2254
- ): SetMixingLayerHeightCalculationRequest {
1856
+ makeCalculationRequest(data: SetMixingLayerHeightCalculationRequestSchemaData): SetMixingLayerHeightCalculationRequest {
2255
1857
  return new SetMixingLayerHeightCalculationRequest(data);
2256
1858
  }
2257
1859
  }
@@ -2265,7 +1867,7 @@ export class SetMixingLayerHeightCalculation extends CalculationBase {
2265
1867
  *
2266
1868
  */
2267
1869
  constructor(data: {
2268
- weather: Entities.Weather;
1870
+ weather: Entities.Weather
2269
1871
  controller?: AbortController;
2270
1872
  }) {
2271
1873
  super(data.controller);
@@ -2275,7 +1877,7 @@ export class SetMixingLayerHeightCalculation extends CalculationBase {
2275
1877
  async run() {
2276
1878
  try {
2277
1879
  const request = new SetMixingLayerHeightCalculationRequest({
2278
- weather: this.weather,
1880
+ weather: this.weather
2279
1881
  });
2280
1882
 
2281
1883
  const schema = new SetMixingLayerHeightCalculationRequestSchema();
@@ -2288,8 +1890,7 @@ export class SetMixingLayerHeightCalculation extends CalculationBase {
2288
1890
 
2289
1891
  const { data } = await this.postRequest(url, requestJson);
2290
1892
 
2291
- const responseSchema =
2292
- new SetMixingLayerHeightCalculationResponseSchema();
1893
+ const responseSchema = new SetMixingLayerHeightCalculationResponseSchema();
2293
1894
  const validatedResponse = responseSchema.validate(data);
2294
1895
 
2295
1896
  this.resultCode = validatedResponse.resultCode;
@@ -2322,21 +1923,9 @@ export class SetMixingLayerHeightCalculation extends CalculationBase {
2322
1923
  parts.push(`updatedWeather: ${String(this.updatedWeather)}`);
2323
1924
  parts.push(`resultCode: ${String(this.resultCode)}`);
2324
1925
  parts.push("*** messages:");
2325
- parts.push(
2326
- `messages: ${this.messages !== undefined ? this.messages : "(None)"}`
2327
- );
2328
- parts.push(
2329
- `calculationElapsedTime: ${
2330
- this.calculationElapsedTime !== undefined
2331
- ? this.calculationElapsedTime
2332
- : "(None)"
2333
- }`
2334
- );
2335
- parts.push(
2336
- `operationId: ${
2337
- this.operationId !== undefined ? this.operationId : "(None)"
2338
- }`
2339
- );
1926
+ parts.push(`messages: ${this.messages !== undefined ? this.messages : "(None)"}`);
1927
+ parts.push(`calculationElapsedTime: ${this.calculationElapsedTime !== undefined ? this.calculationElapsedTime : "(None)"}`);
1928
+ parts.push(`operationId: ${this.operationId !== undefined ? this.operationId : "(None)"}`);
2340
1929
 
2341
1930
  return parts.join("\n");
2342
1931
  }
@@ -2350,11 +1939,11 @@ export class SetMixingLayerHeightCalculationResponse extends CalculationResponse
2350
1939
  *
2351
1940
  */
2352
1941
  constructor(data: {
2353
- updatedWeather: Entities.Weather;
2354
- resultCode: Enums.ResultCode;
2355
- messages: string[];
2356
- calculationElapsedTime: number;
2357
- operationId: string;
1942
+ updatedWeather: Entities.Weather,
1943
+ resultCode: Enums.ResultCode,
1944
+ messages: string[],
1945
+ calculationElapsedTime: number,
1946
+ operationId: string
2358
1947
  }) {
2359
1948
  super();
2360
1949
  this.updatedWeather = data.updatedWeather;
@@ -2367,31 +1956,19 @@ export class SetMixingLayerHeightCalculationResponse extends CalculationResponse
2367
1956
  initialiseFromDictionary(data: { [key: string]: unknown }) {
2368
1957
  if (data.updatedWeather) {
2369
1958
  this.updatedWeather = new Entities.Weather();
2370
- this.updatedWeather.initialiseFromDictionary(
2371
- data.updatedWeather as { [key: string]: unknown }
2372
- );
2373
- }
2374
- if (
2375
- data.resultCode !== undefined &&
2376
- (typeof data.resultCode === "string" ||
2377
- typeof data.resultCode === "number")
2378
- ) {
1959
+ this.updatedWeather.initialiseFromDictionary(data.updatedWeather as { [key: string]: unknown });
1960
+ }
1961
+ if (data.resultCode !== undefined && (typeof data.resultCode === "string" || typeof data.resultCode === "number")) {
2379
1962
  this.resultCode = data.resultCode as Enums.ResultCode;
2380
1963
  }
2381
1964
  this.messages = this.messages ?? [];
2382
1965
  if (data.messages && Array.isArray(data.messages)) {
2383
1966
  this.messages.push(...data.messages);
2384
1967
  }
2385
- if (
2386
- data.calculationElapsedTime !== undefined &&
2387
- typeof data.calculationElapsedTime === "number"
2388
- ) {
1968
+ if (data.calculationElapsedTime !== undefined && typeof data.calculationElapsedTime === "number") {
2389
1969
  this.calculationElapsedTime = data.calculationElapsedTime as number;
2390
1970
  }
2391
- if (
2392
- data.operationId !== undefined &&
2393
- typeof data.operationId === "string"
2394
- ) {
1971
+ if (data.operationId !== undefined && typeof data.operationId === "string") {
2395
1972
  this.operationId = data.operationId as string;
2396
1973
  }
2397
1974
  }
@@ -2426,21 +2003,15 @@ export class SetMixingLayerHeightCalculationResponseSchema {
2426
2003
  };
2427
2004
  }
2428
2005
 
2429
- validate(
2430
- data: SetMixingLayerHeightCalculationResponseSchemaData
2431
- ): SetMixingLayerHeightCalculationResponse {
2006
+ validate(data: SetMixingLayerHeightCalculationResponseSchemaData): SetMixingLayerHeightCalculationResponse {
2432
2007
  const { error, value } = this.schema.validate(data, { abortEarly: false });
2433
2008
  if (error) {
2434
- throw new Error(
2435
- `Validation error: ${error.details.map((x) => x.message).join(", ")}`
2436
- );
2009
+ throw new Error(`Validation error: ${error.details.map((x) => x.message).join(", ")}`);
2437
2010
  }
2438
2011
  return this.makeCalculationResponse(value);
2439
2012
  }
2440
2013
 
2441
- makeCalculationResponse(
2442
- data: SetMixingLayerHeightCalculationResponseSchemaData
2443
- ): SetMixingLayerHeightCalculationResponse {
2014
+ makeCalculationResponse(data: SetMixingLayerHeightCalculationResponseSchemaData): SetMixingLayerHeightCalculationResponse {
2444
2015
  return new SetMixingLayerHeightCalculationResponse(data);
2445
2016
  }
2446
2017
  }
@@ -2461,9 +2032,9 @@ class SetPhaseToReleaseForLeakScenarioCalculationRequest extends CalculationRequ
2461
2032
  *
2462
2033
  */
2463
2034
  constructor(data: {
2464
- phaseToRelease: Enums.Phase;
2465
- releaseElevation: number;
2466
- vessel: Entities.Vessel;
2035
+ phaseToRelease: Enums.Phase,
2036
+ releaseElevation: number,
2037
+ vessel: Entities.Vessel
2467
2038
  }) {
2468
2039
  super();
2469
2040
  this.phaseToRelease = data.phaseToRelease;
@@ -2493,21 +2064,15 @@ export class SetPhaseToReleaseForLeakScenarioCalculationRequestSchema {
2493
2064
  };
2494
2065
  }
2495
2066
 
2496
- validate(
2497
- data: SetPhaseToReleaseForLeakScenarioCalculationRequestSchemaData
2498
- ): SetPhaseToReleaseForLeakScenarioCalculationRequest {
2067
+ validate(data: SetPhaseToReleaseForLeakScenarioCalculationRequestSchemaData): SetPhaseToReleaseForLeakScenarioCalculationRequest {
2499
2068
  const { error, value } = this.schema.validate(data, { abortEarly: false });
2500
2069
  if (error) {
2501
- throw new Error(
2502
- `Validation error: ${error.details.map((x) => x.message).join(", ")}`
2503
- );
2070
+ throw new Error(`Validation error: ${error.details.map((x) => x.message).join(", ")}`);
2504
2071
  }
2505
2072
  return this.makeCalculationRequest(value);
2506
2073
  }
2507
2074
 
2508
- makeCalculationRequest(
2509
- data: SetPhaseToReleaseForLeakScenarioCalculationRequestSchemaData
2510
- ): SetPhaseToReleaseForLeakScenarioCalculationRequest {
2075
+ makeCalculationRequest(data: SetPhaseToReleaseForLeakScenarioCalculationRequestSchemaData): SetPhaseToReleaseForLeakScenarioCalculationRequest {
2511
2076
  return new SetPhaseToReleaseForLeakScenarioCalculationRequest(data);
2512
2077
  }
2513
2078
  }
@@ -2524,9 +2089,9 @@ export class SetPhaseToReleaseForLeakScenarioCalculation extends CalculationBase
2524
2089
  *
2525
2090
  */
2526
2091
  constructor(data: {
2527
- phaseToRelease: Enums.Phase;
2528
- releaseElevation: number;
2529
- vessel: Entities.Vessel;
2092
+ phaseToRelease: Enums.Phase,
2093
+ releaseElevation: number,
2094
+ vessel: Entities.Vessel
2530
2095
  controller?: AbortController;
2531
2096
  }) {
2532
2097
  super(data.controller);
@@ -2540,11 +2105,10 @@ export class SetPhaseToReleaseForLeakScenarioCalculation extends CalculationBase
2540
2105
  const request = new SetPhaseToReleaseForLeakScenarioCalculationRequest({
2541
2106
  phaseToRelease: this.phaseToRelease,
2542
2107
  releaseElevation: this.releaseElevation,
2543
- vessel: this.vessel,
2108
+ vessel: this.vessel
2544
2109
  });
2545
2110
 
2546
- const schema =
2547
- new SetPhaseToReleaseForLeakScenarioCalculationRequestSchema();
2111
+ const schema = new SetPhaseToReleaseForLeakScenarioCalculationRequestSchema();
2548
2112
  const validatedRequest = schema.validate(request);
2549
2113
 
2550
2114
  const requestJson = JSON.stringify(validatedRequest);
@@ -2554,16 +2118,14 @@ export class SetPhaseToReleaseForLeakScenarioCalculation extends CalculationBase
2554
2118
 
2555
2119
  const { data } = await this.postRequest(url, requestJson);
2556
2120
 
2557
- const responseSchema =
2558
- new SetPhaseToReleaseForLeakScenarioCalculationResponseSchema();
2121
+ const responseSchema = new SetPhaseToReleaseForLeakScenarioCalculationResponseSchema();
2559
2122
  const validatedResponse = responseSchema.validate(data);
2560
2123
 
2561
2124
  this.resultCode = validatedResponse.resultCode;
2562
2125
  if (this.resultCode === Enums.ResultCode.SUCCESS) {
2563
2126
  Object.assign(this, {
2564
2127
  zCoordUpdated: validatedResponse.zCoordUpdated,
2565
- holeHeightFractionUpdated:
2566
- validatedResponse.holeHeightFractionUpdated,
2128
+ holeHeightFractionUpdated: validatedResponse.holeHeightFractionUpdated,
2567
2129
  resultCode: validatedResponse.resultCode,
2568
2130
  messages: validatedResponse.messages ?? [],
2569
2131
  calculationElapsedTime: validatedResponse.calculationElapsedTime,
@@ -2588,26 +2150,12 @@ export class SetPhaseToReleaseForLeakScenarioCalculation extends CalculationBase
2588
2150
  const parts = ["* SetPhaseToReleaseForLeakScenario"];
2589
2151
 
2590
2152
  parts.push(`zCoordUpdated: ${String(this.zCoordUpdated)}`);
2591
- parts.push(
2592
- `holeHeightFractionUpdated: ${String(this.holeHeightFractionUpdated)}`
2593
- );
2153
+ parts.push(`holeHeightFractionUpdated: ${String(this.holeHeightFractionUpdated)}`);
2594
2154
  parts.push(`resultCode: ${String(this.resultCode)}`);
2595
2155
  parts.push("*** messages:");
2596
- parts.push(
2597
- `messages: ${this.messages !== undefined ? this.messages : "(None)"}`
2598
- );
2599
- parts.push(
2600
- `calculationElapsedTime: ${
2601
- this.calculationElapsedTime !== undefined
2602
- ? this.calculationElapsedTime
2603
- : "(None)"
2604
- }`
2605
- );
2606
- parts.push(
2607
- `operationId: ${
2608
- this.operationId !== undefined ? this.operationId : "(None)"
2609
- }`
2610
- );
2156
+ parts.push(`messages: ${this.messages !== undefined ? this.messages : "(None)"}`);
2157
+ parts.push(`calculationElapsedTime: ${this.calculationElapsedTime !== undefined ? this.calculationElapsedTime : "(None)"}`);
2158
+ parts.push(`operationId: ${this.operationId !== undefined ? this.operationId : "(None)"}`);
2611
2159
 
2612
2160
  return parts.join("\n");
2613
2161
  }
@@ -2622,12 +2170,12 @@ export class SetPhaseToReleaseForLeakScenarioCalculationResponse extends Calcula
2622
2170
  *
2623
2171
  */
2624
2172
  constructor(data: {
2625
- zCoordUpdated: number;
2626
- holeHeightFractionUpdated: number;
2627
- resultCode: Enums.ResultCode;
2628
- messages: string[];
2629
- calculationElapsedTime: number;
2630
- operationId: string;
2173
+ zCoordUpdated: number,
2174
+ holeHeightFractionUpdated: number,
2175
+ resultCode: Enums.ResultCode,
2176
+ messages: string[],
2177
+ calculationElapsedTime: number,
2178
+ operationId: string
2631
2179
  }) {
2632
2180
  super();
2633
2181
  this.zCoordUpdated = data.zCoordUpdated;
@@ -2639,39 +2187,23 @@ export class SetPhaseToReleaseForLeakScenarioCalculationResponse extends Calcula
2639
2187
  }
2640
2188
 
2641
2189
  initialiseFromDictionary(data: { [key: string]: unknown }) {
2642
- if (
2643
- data.zCoordUpdated !== undefined &&
2644
- typeof data.zCoordUpdated === "number"
2645
- ) {
2190
+ if (data.zCoordUpdated !== undefined && typeof data.zCoordUpdated === "number") {
2646
2191
  this.zCoordUpdated = data.zCoordUpdated as number;
2647
2192
  }
2648
- if (
2649
- data.holeHeightFractionUpdated !== undefined &&
2650
- typeof data.holeHeightFractionUpdated === "number"
2651
- ) {
2193
+ if (data.holeHeightFractionUpdated !== undefined && typeof data.holeHeightFractionUpdated === "number") {
2652
2194
  this.holeHeightFractionUpdated = data.holeHeightFractionUpdated as number;
2653
2195
  }
2654
- if (
2655
- data.resultCode !== undefined &&
2656
- (typeof data.resultCode === "string" ||
2657
- typeof data.resultCode === "number")
2658
- ) {
2196
+ if (data.resultCode !== undefined && (typeof data.resultCode === "string" || typeof data.resultCode === "number")) {
2659
2197
  this.resultCode = data.resultCode as Enums.ResultCode;
2660
2198
  }
2661
2199
  this.messages = this.messages ?? [];
2662
2200
  if (data.messages && Array.isArray(data.messages)) {
2663
2201
  this.messages.push(...data.messages);
2664
2202
  }
2665
- if (
2666
- data.calculationElapsedTime !== undefined &&
2667
- typeof data.calculationElapsedTime === "number"
2668
- ) {
2203
+ if (data.calculationElapsedTime !== undefined && typeof data.calculationElapsedTime === "number") {
2669
2204
  this.calculationElapsedTime = data.calculationElapsedTime as number;
2670
2205
  }
2671
- if (
2672
- data.operationId !== undefined &&
2673
- typeof data.operationId === "string"
2674
- ) {
2206
+ if (data.operationId !== undefined && typeof data.operationId === "string") {
2675
2207
  this.operationId = data.operationId as string;
2676
2208
  }
2677
2209
  }
@@ -2709,21 +2241,15 @@ export class SetPhaseToReleaseForLeakScenarioCalculationResponseSchema {
2709
2241
  };
2710
2242
  }
2711
2243
 
2712
- validate(
2713
- data: SetPhaseToReleaseForLeakScenarioCalculationResponseSchemaData
2714
- ): SetPhaseToReleaseForLeakScenarioCalculationResponse {
2244
+ validate(data: SetPhaseToReleaseForLeakScenarioCalculationResponseSchemaData): SetPhaseToReleaseForLeakScenarioCalculationResponse {
2715
2245
  const { error, value } = this.schema.validate(data, { abortEarly: false });
2716
2246
  if (error) {
2717
- throw new Error(
2718
- `Validation error: ${error.details.map((x) => x.message).join(", ")}`
2719
- );
2247
+ throw new Error(`Validation error: ${error.details.map((x) => x.message).join(", ")}`);
2720
2248
  }
2721
2249
  return this.makeCalculationResponse(value);
2722
2250
  }
2723
2251
 
2724
- makeCalculationResponse(
2725
- data: SetPhaseToReleaseForLeakScenarioCalculationResponseSchemaData
2726
- ): SetPhaseToReleaseForLeakScenarioCalculationResponse {
2252
+ makeCalculationResponse(data: SetPhaseToReleaseForLeakScenarioCalculationResponseSchemaData): SetPhaseToReleaseForLeakScenarioCalculationResponse {
2727
2253
  return new SetPhaseToReleaseForLeakScenarioCalculationResponse(data);
2728
2254
  }
2729
2255
  }
@@ -2744,9 +2270,9 @@ class SetPhaseToReleaseForLineRuptureScenarioCalculationRequest extends Calculat
2744
2270
  *
2745
2271
  */
2746
2272
  constructor(data: {
2747
- phaseToRelease: Enums.Phase;
2748
- releaseElevation: number;
2749
- vessel: Entities.Vessel;
2273
+ phaseToRelease: Enums.Phase,
2274
+ releaseElevation: number,
2275
+ vessel: Entities.Vessel
2750
2276
  }) {
2751
2277
  super();
2752
2278
  this.phaseToRelease = data.phaseToRelease;
@@ -2776,21 +2302,15 @@ export class SetPhaseToReleaseForLineRuptureScenarioCalculationRequestSchema {
2776
2302
  };
2777
2303
  }
2778
2304
 
2779
- validate(
2780
- data: SetPhaseToReleaseForLineRuptureScenarioCalculationRequestSchemaData
2781
- ): SetPhaseToReleaseForLineRuptureScenarioCalculationRequest {
2305
+ validate(data: SetPhaseToReleaseForLineRuptureScenarioCalculationRequestSchemaData): SetPhaseToReleaseForLineRuptureScenarioCalculationRequest {
2782
2306
  const { error, value } = this.schema.validate(data, { abortEarly: false });
2783
2307
  if (error) {
2784
- throw new Error(
2785
- `Validation error: ${error.details.map((x) => x.message).join(", ")}`
2786
- );
2308
+ throw new Error(`Validation error: ${error.details.map((x) => x.message).join(", ")}`);
2787
2309
  }
2788
2310
  return this.makeCalculationRequest(value);
2789
2311
  }
2790
2312
 
2791
- makeCalculationRequest(
2792
- data: SetPhaseToReleaseForLineRuptureScenarioCalculationRequestSchemaData
2793
- ): SetPhaseToReleaseForLineRuptureScenarioCalculationRequest {
2313
+ makeCalculationRequest(data: SetPhaseToReleaseForLineRuptureScenarioCalculationRequestSchemaData): SetPhaseToReleaseForLineRuptureScenarioCalculationRequest {
2794
2314
  return new SetPhaseToReleaseForLineRuptureScenarioCalculationRequest(data);
2795
2315
  }
2796
2316
  }
@@ -2807,9 +2327,9 @@ export class SetPhaseToReleaseForLineRuptureScenarioCalculation extends Calculat
2807
2327
  *
2808
2328
  */
2809
2329
  constructor(data: {
2810
- phaseToRelease: Enums.Phase;
2811
- releaseElevation: number;
2812
- vessel: Entities.Vessel;
2330
+ phaseToRelease: Enums.Phase,
2331
+ releaseElevation: number,
2332
+ vessel: Entities.Vessel
2813
2333
  controller?: AbortController;
2814
2334
  }) {
2815
2335
  super(data.controller);
@@ -2820,15 +2340,13 @@ export class SetPhaseToReleaseForLineRuptureScenarioCalculation extends Calculat
2820
2340
 
2821
2341
  async run() {
2822
2342
  try {
2823
- const request =
2824
- new SetPhaseToReleaseForLineRuptureScenarioCalculationRequest({
2825
- phaseToRelease: this.phaseToRelease,
2826
- releaseElevation: this.releaseElevation,
2827
- vessel: this.vessel,
2828
- });
2343
+ const request = new SetPhaseToReleaseForLineRuptureScenarioCalculationRequest({
2344
+ phaseToRelease: this.phaseToRelease,
2345
+ releaseElevation: this.releaseElevation,
2346
+ vessel: this.vessel
2347
+ });
2829
2348
 
2830
- const schema =
2831
- new SetPhaseToReleaseForLineRuptureScenarioCalculationRequestSchema();
2349
+ const schema = new SetPhaseToReleaseForLineRuptureScenarioCalculationRequestSchema();
2832
2350
  const validatedRequest = schema.validate(request);
2833
2351
 
2834
2352
  const requestJson = JSON.stringify(validatedRequest);
@@ -2838,16 +2356,14 @@ export class SetPhaseToReleaseForLineRuptureScenarioCalculation extends Calculat
2838
2356
 
2839
2357
  const { data } = await this.postRequest(url, requestJson);
2840
2358
 
2841
- const responseSchema =
2842
- new SetPhaseToReleaseForLineRuptureScenarioCalculationResponseSchema();
2359
+ const responseSchema = new SetPhaseToReleaseForLineRuptureScenarioCalculationResponseSchema();
2843
2360
  const validatedResponse = responseSchema.validate(data);
2844
2361
 
2845
2362
  this.resultCode = validatedResponse.resultCode;
2846
2363
  if (this.resultCode === Enums.ResultCode.SUCCESS) {
2847
2364
  Object.assign(this, {
2848
2365
  zCoordUpdated: validatedResponse.zCoordUpdated,
2849
- pipeHeightFractionUpdated:
2850
- validatedResponse.pipeHeightFractionUpdated,
2366
+ pipeHeightFractionUpdated: validatedResponse.pipeHeightFractionUpdated,
2851
2367
  resultCode: validatedResponse.resultCode,
2852
2368
  messages: validatedResponse.messages ?? [],
2853
2369
  calculationElapsedTime: validatedResponse.calculationElapsedTime,
@@ -2872,26 +2388,12 @@ export class SetPhaseToReleaseForLineRuptureScenarioCalculation extends Calculat
2872
2388
  const parts = ["* SetPhaseToReleaseForLineRuptureScenario"];
2873
2389
 
2874
2390
  parts.push(`zCoordUpdated: ${String(this.zCoordUpdated)}`);
2875
- parts.push(
2876
- `pipeHeightFractionUpdated: ${String(this.pipeHeightFractionUpdated)}`
2877
- );
2391
+ parts.push(`pipeHeightFractionUpdated: ${String(this.pipeHeightFractionUpdated)}`);
2878
2392
  parts.push(`resultCode: ${String(this.resultCode)}`);
2879
2393
  parts.push("*** messages:");
2880
- parts.push(
2881
- `messages: ${this.messages !== undefined ? this.messages : "(None)"}`
2882
- );
2883
- parts.push(
2884
- `calculationElapsedTime: ${
2885
- this.calculationElapsedTime !== undefined
2886
- ? this.calculationElapsedTime
2887
- : "(None)"
2888
- }`
2889
- );
2890
- parts.push(
2891
- `operationId: ${
2892
- this.operationId !== undefined ? this.operationId : "(None)"
2893
- }`
2894
- );
2394
+ parts.push(`messages: ${this.messages !== undefined ? this.messages : "(None)"}`);
2395
+ parts.push(`calculationElapsedTime: ${this.calculationElapsedTime !== undefined ? this.calculationElapsedTime : "(None)"}`);
2396
+ parts.push(`operationId: ${this.operationId !== undefined ? this.operationId : "(None)"}`);
2895
2397
 
2896
2398
  return parts.join("\n");
2897
2399
  }
@@ -2906,12 +2408,12 @@ export class SetPhaseToReleaseForLineRuptureScenarioCalculationResponse extends
2906
2408
  *
2907
2409
  */
2908
2410
  constructor(data: {
2909
- zCoordUpdated: number;
2910
- pipeHeightFractionUpdated: number;
2911
- resultCode: Enums.ResultCode;
2912
- messages: string[];
2913
- calculationElapsedTime: number;
2914
- operationId: string;
2411
+ zCoordUpdated: number,
2412
+ pipeHeightFractionUpdated: number,
2413
+ resultCode: Enums.ResultCode,
2414
+ messages: string[],
2415
+ calculationElapsedTime: number,
2416
+ operationId: string
2915
2417
  }) {
2916
2418
  super();
2917
2419
  this.zCoordUpdated = data.zCoordUpdated;
@@ -2923,39 +2425,23 @@ export class SetPhaseToReleaseForLineRuptureScenarioCalculationResponse extends
2923
2425
  }
2924
2426
 
2925
2427
  initialiseFromDictionary(data: { [key: string]: unknown }) {
2926
- if (
2927
- data.zCoordUpdated !== undefined &&
2928
- typeof data.zCoordUpdated === "number"
2929
- ) {
2428
+ if (data.zCoordUpdated !== undefined && typeof data.zCoordUpdated === "number") {
2930
2429
  this.zCoordUpdated = data.zCoordUpdated as number;
2931
2430
  }
2932
- if (
2933
- data.pipeHeightFractionUpdated !== undefined &&
2934
- typeof data.pipeHeightFractionUpdated === "number"
2935
- ) {
2431
+ if (data.pipeHeightFractionUpdated !== undefined && typeof data.pipeHeightFractionUpdated === "number") {
2936
2432
  this.pipeHeightFractionUpdated = data.pipeHeightFractionUpdated as number;
2937
2433
  }
2938
- if (
2939
- data.resultCode !== undefined &&
2940
- (typeof data.resultCode === "string" ||
2941
- typeof data.resultCode === "number")
2942
- ) {
2434
+ if (data.resultCode !== undefined && (typeof data.resultCode === "string" || typeof data.resultCode === "number")) {
2943
2435
  this.resultCode = data.resultCode as Enums.ResultCode;
2944
2436
  }
2945
2437
  this.messages = this.messages ?? [];
2946
2438
  if (data.messages && Array.isArray(data.messages)) {
2947
2439
  this.messages.push(...data.messages);
2948
2440
  }
2949
- if (
2950
- data.calculationElapsedTime !== undefined &&
2951
- typeof data.calculationElapsedTime === "number"
2952
- ) {
2441
+ if (data.calculationElapsedTime !== undefined && typeof data.calculationElapsedTime === "number") {
2953
2442
  this.calculationElapsedTime = data.calculationElapsedTime as number;
2954
2443
  }
2955
- if (
2956
- data.operationId !== undefined &&
2957
- typeof data.operationId === "string"
2958
- ) {
2444
+ if (data.operationId !== undefined && typeof data.operationId === "string") {
2959
2445
  this.operationId = data.operationId as string;
2960
2446
  }
2961
2447
  }
@@ -2993,21 +2479,15 @@ export class SetPhaseToReleaseForLineRuptureScenarioCalculationResponseSchema {
2993
2479
  };
2994
2480
  }
2995
2481
 
2996
- validate(
2997
- data: SetPhaseToReleaseForLineRuptureScenarioCalculationResponseSchemaData
2998
- ): SetPhaseToReleaseForLineRuptureScenarioCalculationResponse {
2482
+ validate(data: SetPhaseToReleaseForLineRuptureScenarioCalculationResponseSchemaData): SetPhaseToReleaseForLineRuptureScenarioCalculationResponse {
2999
2483
  const { error, value } = this.schema.validate(data, { abortEarly: false });
3000
2484
  if (error) {
3001
- throw new Error(
3002
- `Validation error: ${error.details.map((x) => x.message).join(", ")}`
3003
- );
2485
+ throw new Error(`Validation error: ${error.details.map((x) => x.message).join(", ")}`);
3004
2486
  }
3005
2487
  return this.makeCalculationResponse(value);
3006
2488
  }
3007
2489
 
3008
- makeCalculationResponse(
3009
- data: SetPhaseToReleaseForLineRuptureScenarioCalculationResponseSchemaData
3010
- ): SetPhaseToReleaseForLineRuptureScenarioCalculationResponse {
2490
+ makeCalculationResponse(data: SetPhaseToReleaseForLineRuptureScenarioCalculationResponseSchemaData): SetPhaseToReleaseForLineRuptureScenarioCalculationResponse {
3011
2491
  return new SetPhaseToReleaseForLineRuptureScenarioCalculationResponse(data);
3012
2492
  }
3013
2493
  }
@@ -3028,9 +2508,9 @@ class SetPhaseToReleaseForReliefValveScenarioCalculationRequest extends Calculat
3028
2508
  *
3029
2509
  */
3030
2510
  constructor(data: {
3031
- phaseToRelease: Enums.Phase;
3032
- releaseElevation: number;
3033
- vessel: Entities.Vessel;
2511
+ phaseToRelease: Enums.Phase,
2512
+ releaseElevation: number,
2513
+ vessel: Entities.Vessel
3034
2514
  }) {
3035
2515
  super();
3036
2516
  this.phaseToRelease = data.phaseToRelease;
@@ -3060,21 +2540,15 @@ export class SetPhaseToReleaseForReliefValveScenarioCalculationRequestSchema {
3060
2540
  };
3061
2541
  }
3062
2542
 
3063
- validate(
3064
- data: SetPhaseToReleaseForReliefValveScenarioCalculationRequestSchemaData
3065
- ): SetPhaseToReleaseForReliefValveScenarioCalculationRequest {
2543
+ validate(data: SetPhaseToReleaseForReliefValveScenarioCalculationRequestSchemaData): SetPhaseToReleaseForReliefValveScenarioCalculationRequest {
3066
2544
  const { error, value } = this.schema.validate(data, { abortEarly: false });
3067
2545
  if (error) {
3068
- throw new Error(
3069
- `Validation error: ${error.details.map((x) => x.message).join(", ")}`
3070
- );
2546
+ throw new Error(`Validation error: ${error.details.map((x) => x.message).join(", ")}`);
3071
2547
  }
3072
2548
  return this.makeCalculationRequest(value);
3073
2549
  }
3074
2550
 
3075
- makeCalculationRequest(
3076
- data: SetPhaseToReleaseForReliefValveScenarioCalculationRequestSchemaData
3077
- ): SetPhaseToReleaseForReliefValveScenarioCalculationRequest {
2551
+ makeCalculationRequest(data: SetPhaseToReleaseForReliefValveScenarioCalculationRequestSchemaData): SetPhaseToReleaseForReliefValveScenarioCalculationRequest {
3078
2552
  return new SetPhaseToReleaseForReliefValveScenarioCalculationRequest(data);
3079
2553
  }
3080
2554
  }
@@ -3091,9 +2565,9 @@ export class SetPhaseToReleaseForReliefValveScenarioCalculation extends Calculat
3091
2565
  *
3092
2566
  */
3093
2567
  constructor(data: {
3094
- phaseToRelease: Enums.Phase;
3095
- releaseElevation: number;
3096
- vessel: Entities.Vessel;
2568
+ phaseToRelease: Enums.Phase,
2569
+ releaseElevation: number,
2570
+ vessel: Entities.Vessel
3097
2571
  controller?: AbortController;
3098
2572
  }) {
3099
2573
  super(data.controller);
@@ -3104,15 +2578,13 @@ export class SetPhaseToReleaseForReliefValveScenarioCalculation extends Calculat
3104
2578
 
3105
2579
  async run() {
3106
2580
  try {
3107
- const request =
3108
- new SetPhaseToReleaseForReliefValveScenarioCalculationRequest({
3109
- phaseToRelease: this.phaseToRelease,
3110
- releaseElevation: this.releaseElevation,
3111
- vessel: this.vessel,
3112
- });
2581
+ const request = new SetPhaseToReleaseForReliefValveScenarioCalculationRequest({
2582
+ phaseToRelease: this.phaseToRelease,
2583
+ releaseElevation: this.releaseElevation,
2584
+ vessel: this.vessel
2585
+ });
3113
2586
 
3114
- const schema =
3115
- new SetPhaseToReleaseForReliefValveScenarioCalculationRequestSchema();
2587
+ const schema = new SetPhaseToReleaseForReliefValveScenarioCalculationRequestSchema();
3116
2588
  const validatedRequest = schema.validate(request);
3117
2589
 
3118
2590
  const requestJson = JSON.stringify(validatedRequest);
@@ -3122,16 +2594,14 @@ export class SetPhaseToReleaseForReliefValveScenarioCalculation extends Calculat
3122
2594
 
3123
2595
  const { data } = await this.postRequest(url, requestJson);
3124
2596
 
3125
- const responseSchema =
3126
- new SetPhaseToReleaseForReliefValveScenarioCalculationResponseSchema();
2597
+ const responseSchema = new SetPhaseToReleaseForReliefValveScenarioCalculationResponseSchema();
3127
2598
  const validatedResponse = responseSchema.validate(data);
3128
2599
 
3129
2600
  this.resultCode = validatedResponse.resultCode;
3130
2601
  if (this.resultCode === Enums.ResultCode.SUCCESS) {
3131
2602
  Object.assign(this, {
3132
2603
  zCoordUpdated: validatedResponse.zCoordUpdated,
3133
- pipeHeightFractionUpdated:
3134
- validatedResponse.pipeHeightFractionUpdated,
2604
+ pipeHeightFractionUpdated: validatedResponse.pipeHeightFractionUpdated,
3135
2605
  resultCode: validatedResponse.resultCode,
3136
2606
  messages: validatedResponse.messages ?? [],
3137
2607
  calculationElapsedTime: validatedResponse.calculationElapsedTime,
@@ -3156,26 +2626,12 @@ export class SetPhaseToReleaseForReliefValveScenarioCalculation extends Calculat
3156
2626
  const parts = ["* SetPhaseToReleaseForReliefValveScenario"];
3157
2627
 
3158
2628
  parts.push(`zCoordUpdated: ${String(this.zCoordUpdated)}`);
3159
- parts.push(
3160
- `pipeHeightFractionUpdated: ${String(this.pipeHeightFractionUpdated)}`
3161
- );
2629
+ parts.push(`pipeHeightFractionUpdated: ${String(this.pipeHeightFractionUpdated)}`);
3162
2630
  parts.push(`resultCode: ${String(this.resultCode)}`);
3163
2631
  parts.push("*** messages:");
3164
- parts.push(
3165
- `messages: ${this.messages !== undefined ? this.messages : "(None)"}`
3166
- );
3167
- parts.push(
3168
- `calculationElapsedTime: ${
3169
- this.calculationElapsedTime !== undefined
3170
- ? this.calculationElapsedTime
3171
- : "(None)"
3172
- }`
3173
- );
3174
- parts.push(
3175
- `operationId: ${
3176
- this.operationId !== undefined ? this.operationId : "(None)"
3177
- }`
3178
- );
2632
+ parts.push(`messages: ${this.messages !== undefined ? this.messages : "(None)"}`);
2633
+ parts.push(`calculationElapsedTime: ${this.calculationElapsedTime !== undefined ? this.calculationElapsedTime : "(None)"}`);
2634
+ parts.push(`operationId: ${this.operationId !== undefined ? this.operationId : "(None)"}`);
3179
2635
 
3180
2636
  return parts.join("\n");
3181
2637
  }
@@ -3190,12 +2646,12 @@ export class SetPhaseToReleaseForReliefValveScenarioCalculationResponse extends
3190
2646
  *
3191
2647
  */
3192
2648
  constructor(data: {
3193
- zCoordUpdated: number;
3194
- pipeHeightFractionUpdated: number;
3195
- resultCode: Enums.ResultCode;
3196
- messages: string[];
3197
- calculationElapsedTime: number;
3198
- operationId: string;
2649
+ zCoordUpdated: number,
2650
+ pipeHeightFractionUpdated: number,
2651
+ resultCode: Enums.ResultCode,
2652
+ messages: string[],
2653
+ calculationElapsedTime: number,
2654
+ operationId: string
3199
2655
  }) {
3200
2656
  super();
3201
2657
  this.zCoordUpdated = data.zCoordUpdated;
@@ -3207,39 +2663,23 @@ export class SetPhaseToReleaseForReliefValveScenarioCalculationResponse extends
3207
2663
  }
3208
2664
 
3209
2665
  initialiseFromDictionary(data: { [key: string]: unknown }) {
3210
- if (
3211
- data.zCoordUpdated !== undefined &&
3212
- typeof data.zCoordUpdated === "number"
3213
- ) {
2666
+ if (data.zCoordUpdated !== undefined && typeof data.zCoordUpdated === "number") {
3214
2667
  this.zCoordUpdated = data.zCoordUpdated as number;
3215
2668
  }
3216
- if (
3217
- data.pipeHeightFractionUpdated !== undefined &&
3218
- typeof data.pipeHeightFractionUpdated === "number"
3219
- ) {
2669
+ if (data.pipeHeightFractionUpdated !== undefined && typeof data.pipeHeightFractionUpdated === "number") {
3220
2670
  this.pipeHeightFractionUpdated = data.pipeHeightFractionUpdated as number;
3221
2671
  }
3222
- if (
3223
- data.resultCode !== undefined &&
3224
- (typeof data.resultCode === "string" ||
3225
- typeof data.resultCode === "number")
3226
- ) {
2672
+ if (data.resultCode !== undefined && (typeof data.resultCode === "string" || typeof data.resultCode === "number")) {
3227
2673
  this.resultCode = data.resultCode as Enums.ResultCode;
3228
2674
  }
3229
2675
  this.messages = this.messages ?? [];
3230
2676
  if (data.messages && Array.isArray(data.messages)) {
3231
2677
  this.messages.push(...data.messages);
3232
2678
  }
3233
- if (
3234
- data.calculationElapsedTime !== undefined &&
3235
- typeof data.calculationElapsedTime === "number"
3236
- ) {
2679
+ if (data.calculationElapsedTime !== undefined && typeof data.calculationElapsedTime === "number") {
3237
2680
  this.calculationElapsedTime = data.calculationElapsedTime as number;
3238
2681
  }
3239
- if (
3240
- data.operationId !== undefined &&
3241
- typeof data.operationId === "string"
3242
- ) {
2682
+ if (data.operationId !== undefined && typeof data.operationId === "string") {
3243
2683
  this.operationId = data.operationId as string;
3244
2684
  }
3245
2685
  }
@@ -3277,21 +2717,15 @@ export class SetPhaseToReleaseForReliefValveScenarioCalculationResponseSchema {
3277
2717
  };
3278
2718
  }
3279
2719
 
3280
- validate(
3281
- data: SetPhaseToReleaseForReliefValveScenarioCalculationResponseSchemaData
3282
- ): SetPhaseToReleaseForReliefValveScenarioCalculationResponse {
2720
+ validate(data: SetPhaseToReleaseForReliefValveScenarioCalculationResponseSchemaData): SetPhaseToReleaseForReliefValveScenarioCalculationResponse {
3283
2721
  const { error, value } = this.schema.validate(data, { abortEarly: false });
3284
2722
  if (error) {
3285
- throw new Error(
3286
- `Validation error: ${error.details.map((x) => x.message).join(", ")}`
3287
- );
2723
+ throw new Error(`Validation error: ${error.details.map((x) => x.message).join(", ")}`);
3288
2724
  }
3289
2725
  return this.makeCalculationResponse(value);
3290
2726
  }
3291
2727
 
3292
- makeCalculationResponse(
3293
- data: SetPhaseToReleaseForReliefValveScenarioCalculationResponseSchemaData
3294
- ): SetPhaseToReleaseForReliefValveScenarioCalculationResponse {
2728
+ makeCalculationResponse(data: SetPhaseToReleaseForReliefValveScenarioCalculationResponseSchemaData): SetPhaseToReleaseForReliefValveScenarioCalculationResponse {
3295
2729
  return new SetPhaseToReleaseForReliefValveScenarioCalculationResponse(data);
3296
2730
  }
3297
2731
  }
@@ -3312,9 +2746,9 @@ class SetReleaseElevationForScenarioCalculationRequest extends CalculationReques
3312
2746
  *
3313
2747
  */
3314
2748
  constructor(data: {
3315
- releaseElevation: number;
3316
- releaseHeightFraction: number;
3317
- vessel: Entities.Vessel;
2749
+ releaseElevation: number,
2750
+ releaseHeightFraction: number,
2751
+ vessel: Entities.Vessel
3318
2752
  }) {
3319
2753
  super();
3320
2754
  this.releaseElevation = data.releaseElevation;
@@ -3344,21 +2778,15 @@ export class SetReleaseElevationForScenarioCalculationRequestSchema {
3344
2778
  };
3345
2779
  }
3346
2780
 
3347
- validate(
3348
- data: SetReleaseElevationForScenarioCalculationRequestSchemaData
3349
- ): SetReleaseElevationForScenarioCalculationRequest {
2781
+ validate(data: SetReleaseElevationForScenarioCalculationRequestSchemaData): SetReleaseElevationForScenarioCalculationRequest {
3350
2782
  const { error, value } = this.schema.validate(data, { abortEarly: false });
3351
2783
  if (error) {
3352
- throw new Error(
3353
- `Validation error: ${error.details.map((x) => x.message).join(", ")}`
3354
- );
2784
+ throw new Error(`Validation error: ${error.details.map((x) => x.message).join(", ")}`);
3355
2785
  }
3356
2786
  return this.makeCalculationRequest(value);
3357
2787
  }
3358
2788
 
3359
- makeCalculationRequest(
3360
- data: SetReleaseElevationForScenarioCalculationRequestSchemaData
3361
- ): SetReleaseElevationForScenarioCalculationRequest {
2789
+ makeCalculationRequest(data: SetReleaseElevationForScenarioCalculationRequestSchemaData): SetReleaseElevationForScenarioCalculationRequest {
3362
2790
  return new SetReleaseElevationForScenarioCalculationRequest(data);
3363
2791
  }
3364
2792
  }
@@ -3374,9 +2802,9 @@ export class SetReleaseElevationForScenarioCalculation extends CalculationBase {
3374
2802
  *
3375
2803
  */
3376
2804
  constructor(data: {
3377
- releaseElevation: number;
3378
- releaseHeightFraction: number;
3379
- vessel: Entities.Vessel;
2805
+ releaseElevation: number,
2806
+ releaseHeightFraction: number,
2807
+ vessel: Entities.Vessel
3380
2808
  controller?: AbortController;
3381
2809
  }) {
3382
2810
  super(data.controller);
@@ -3390,11 +2818,10 @@ export class SetReleaseElevationForScenarioCalculation extends CalculationBase {
3390
2818
  const request = new SetReleaseElevationForScenarioCalculationRequest({
3391
2819
  releaseElevation: this.releaseElevation,
3392
2820
  releaseHeightFraction: this.releaseHeightFraction,
3393
- vessel: this.vessel,
2821
+ vessel: this.vessel
3394
2822
  });
3395
2823
 
3396
- const schema =
3397
- new SetReleaseElevationForScenarioCalculationRequestSchema();
2824
+ const schema = new SetReleaseElevationForScenarioCalculationRequestSchema();
3398
2825
  const validatedRequest = schema.validate(request);
3399
2826
 
3400
2827
  const requestJson = JSON.stringify(validatedRequest);
@@ -3404,8 +2831,7 @@ export class SetReleaseElevationForScenarioCalculation extends CalculationBase {
3404
2831
 
3405
2832
  const { data } = await this.postRequest(url, requestJson);
3406
2833
 
3407
- const responseSchema =
3408
- new SetReleaseElevationForScenarioCalculationResponseSchema();
2834
+ const responseSchema = new SetReleaseElevationForScenarioCalculationResponseSchema();
3409
2835
  const validatedResponse = responseSchema.validate(data);
3410
2836
 
3411
2837
  this.resultCode = validatedResponse.resultCode;
@@ -3438,21 +2864,9 @@ export class SetReleaseElevationForScenarioCalculation extends CalculationBase {
3438
2864
  parts.push(`updatedVessel: ${String(this.updatedVessel)}`);
3439
2865
  parts.push(`resultCode: ${String(this.resultCode)}`);
3440
2866
  parts.push("*** messages:");
3441
- parts.push(
3442
- `messages: ${this.messages !== undefined ? this.messages : "(None)"}`
3443
- );
3444
- parts.push(
3445
- `calculationElapsedTime: ${
3446
- this.calculationElapsedTime !== undefined
3447
- ? this.calculationElapsedTime
3448
- : "(None)"
3449
- }`
3450
- );
3451
- parts.push(
3452
- `operationId: ${
3453
- this.operationId !== undefined ? this.operationId : "(None)"
3454
- }`
3455
- );
2867
+ parts.push(`messages: ${this.messages !== undefined ? this.messages : "(None)"}`);
2868
+ parts.push(`calculationElapsedTime: ${this.calculationElapsedTime !== undefined ? this.calculationElapsedTime : "(None)"}`);
2869
+ parts.push(`operationId: ${this.operationId !== undefined ? this.operationId : "(None)"}`);
3456
2870
 
3457
2871
  return parts.join("\n");
3458
2872
  }
@@ -3466,11 +2880,11 @@ export class SetReleaseElevationForScenarioCalculationResponse extends Calculati
3466
2880
  *
3467
2881
  */
3468
2882
  constructor(data: {
3469
- updatedVessel: Entities.Vessel;
3470
- resultCode: Enums.ResultCode;
3471
- messages: string[];
3472
- calculationElapsedTime: number;
3473
- operationId: string;
2883
+ updatedVessel: Entities.Vessel,
2884
+ resultCode: Enums.ResultCode,
2885
+ messages: string[],
2886
+ calculationElapsedTime: number,
2887
+ operationId: string
3474
2888
  }) {
3475
2889
  super();
3476
2890
  this.updatedVessel = data.updatedVessel;
@@ -3483,31 +2897,19 @@ export class SetReleaseElevationForScenarioCalculationResponse extends Calculati
3483
2897
  initialiseFromDictionary(data: { [key: string]: unknown }) {
3484
2898
  if (data.updatedVessel) {
3485
2899
  this.updatedVessel = new Entities.Vessel();
3486
- this.updatedVessel.initialiseFromDictionary(
3487
- data.updatedVessel as { [key: string]: unknown }
3488
- );
3489
- }
3490
- if (
3491
- data.resultCode !== undefined &&
3492
- (typeof data.resultCode === "string" ||
3493
- typeof data.resultCode === "number")
3494
- ) {
2900
+ this.updatedVessel.initialiseFromDictionary(data.updatedVessel as { [key: string]: unknown });
2901
+ }
2902
+ if (data.resultCode !== undefined && (typeof data.resultCode === "string" || typeof data.resultCode === "number")) {
3495
2903
  this.resultCode = data.resultCode as Enums.ResultCode;
3496
2904
  }
3497
2905
  this.messages = this.messages ?? [];
3498
2906
  if (data.messages && Array.isArray(data.messages)) {
3499
2907
  this.messages.push(...data.messages);
3500
2908
  }
3501
- if (
3502
- data.calculationElapsedTime !== undefined &&
3503
- typeof data.calculationElapsedTime === "number"
3504
- ) {
2909
+ if (data.calculationElapsedTime !== undefined && typeof data.calculationElapsedTime === "number") {
3505
2910
  this.calculationElapsedTime = data.calculationElapsedTime as number;
3506
2911
  }
3507
- if (
3508
- data.operationId !== undefined &&
3509
- typeof data.operationId === "string"
3510
- ) {
2912
+ if (data.operationId !== undefined && typeof data.operationId === "string") {
3511
2913
  this.operationId = data.operationId as string;
3512
2914
  }
3513
2915
  }
@@ -3542,21 +2944,15 @@ export class SetReleaseElevationForScenarioCalculationResponseSchema {
3542
2944
  };
3543
2945
  }
3544
2946
 
3545
- validate(
3546
- data: SetReleaseElevationForScenarioCalculationResponseSchemaData
3547
- ): SetReleaseElevationForScenarioCalculationResponse {
2947
+ validate(data: SetReleaseElevationForScenarioCalculationResponseSchemaData): SetReleaseElevationForScenarioCalculationResponse {
3548
2948
  const { error, value } = this.schema.validate(data, { abortEarly: false });
3549
2949
  if (error) {
3550
- throw new Error(
3551
- `Validation error: ${error.details.map((x) => x.message).join(", ")}`
3552
- );
2950
+ throw new Error(`Validation error: ${error.details.map((x) => x.message).join(", ")}`);
3553
2951
  }
3554
2952
  return this.makeCalculationResponse(value);
3555
2953
  }
3556
2954
 
3557
- makeCalculationResponse(
3558
- data: SetReleaseElevationForScenarioCalculationResponseSchemaData
3559
- ): SetReleaseElevationForScenarioCalculationResponse {
2955
+ makeCalculationResponse(data: SetReleaseElevationForScenarioCalculationResponseSchemaData): SetReleaseElevationForScenarioCalculationResponse {
3560
2956
  return new SetReleaseElevationForScenarioCalculationResponse(data);
3561
2957
  }
3562
2958
  }