@dnv-plant/typescriptpws 1.0.91-alpha.2026090 → 1.0.92-alpha.2030251
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.ts +2 -2
- package/package.json +1 -1
- package/src/calculations/applicationTools.ts +3 -3
- package/src/calculations/discharge.ts +3 -3
- package/src/calculations/dispersion.ts +3 -3
- package/src/calculations/dispersionView.ts +3 -3
- package/src/calculations/fireball.ts +3 -3
- package/src/calculations/jetFire.ts +3 -3
- package/src/calculations/lateExplosion.ts +3 -3
- package/src/calculations/linkedRunners.ts +3 -3
- package/src/calculations/poolFire.ts +3 -3
- package/src/calculations/properties.ts +3 -3
- package/src/calculations/radiation.ts +3 -3
- package/src/calculations/standalones.ts +3 -3
- package/src/calculations/toxics.ts +3 -3
- package/src/calculations/utilities.ts +938 -435
- package/src/constants.ts +2 -2
- package/src/entities.ts +2 -2
- package/src/entity-schemas.ts +2 -2
- package/src/enums.ts +2 -2
- package/src/materials.ts +2 -2
- package/src/utilities.ts +2 -2
|
@@ -1,25 +1,28 @@
|
|
|
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.
|
|
10
|
-
* Date/time:
|
|
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.92
|
|
10
|
+
* Date/time: 09 Sept 2025 15:59:43
|
|
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 {
|
|
17
|
+
import {
|
|
18
|
+
getAnalyticsApiTarget,
|
|
19
|
+
getClientAliasId,
|
|
20
|
+
postRequest,
|
|
21
|
+
} from "../utilities";
|
|
18
22
|
|
|
19
23
|
import Joi from "joi";
|
|
20
24
|
import { AxiosResponse } from "axios";
|
|
21
25
|
|
|
22
|
-
|
|
23
26
|
class CalculationRequestBase {
|
|
24
27
|
/**
|
|
25
28
|
* Calculation request base class.
|
|
@@ -63,21 +66,27 @@ class CalculationBase {
|
|
|
63
66
|
*/
|
|
64
67
|
handleFailedResponse(response: AxiosResponse): void {
|
|
65
68
|
try {
|
|
66
|
-
const validatedFailedResponse =
|
|
69
|
+
const validatedFailedResponse =
|
|
70
|
+
new CalculationFailedResponseSchema().validate(response.data);
|
|
67
71
|
|
|
68
72
|
this.resultCode = validatedFailedResponse.resultCode;
|
|
69
73
|
this.messages.push(...(validatedFailedResponse.messages ?? []));
|
|
70
|
-
this.calculationElapsedTime =
|
|
74
|
+
this.calculationElapsedTime =
|
|
75
|
+
validatedFailedResponse.calculationElapsedTime;
|
|
71
76
|
this.operationId = validatedFailedResponse.operationId;
|
|
72
77
|
} catch (error) {
|
|
73
78
|
if (error instanceof Error) {
|
|
74
79
|
this.messages.push(`Failed to parse response: ${error.message}`);
|
|
75
80
|
} else {
|
|
76
|
-
this.messages.push(
|
|
81
|
+
this.messages.push(
|
|
82
|
+
"An unknown error occurred during response parsing."
|
|
83
|
+
);
|
|
77
84
|
}
|
|
78
85
|
console.error("Failed to parse response:", error);
|
|
79
86
|
} finally {
|
|
80
|
-
this.messages.push(
|
|
87
|
+
this.messages.push(
|
|
88
|
+
`${response.statusText} (Status code: ${response.status})`
|
|
89
|
+
);
|
|
81
90
|
}
|
|
82
91
|
}
|
|
83
92
|
}
|
|
@@ -130,7 +139,7 @@ class CalculationFailedResponseSchema {
|
|
|
130
139
|
.valid(...Object.values(Enums.ResultCode))
|
|
131
140
|
.required(),
|
|
132
141
|
messages: Joi.array().items(Joi.string()).required(),
|
|
133
|
-
calculationElapsedTime: Joi.number().
|
|
142
|
+
calculationElapsedTime: Joi.number().optional(),
|
|
134
143
|
operationId: Joi.string().required(),
|
|
135
144
|
}).unknown(true);
|
|
136
145
|
}
|
|
@@ -142,7 +151,10 @@ class CalculationFailedResponseSchema {
|
|
|
142
151
|
operationId: string;
|
|
143
152
|
}) {
|
|
144
153
|
const { error, value } = this.schema.validate(data);
|
|
145
|
-
if (error)
|
|
154
|
+
if (error)
|
|
155
|
+
throw new Error(
|
|
156
|
+
`Validation error: ${error.details.map((x) => x.message).join(", ")}`
|
|
157
|
+
);
|
|
146
158
|
return this.makeCalculationFailedResponse(value);
|
|
147
159
|
}
|
|
148
160
|
|
|
@@ -152,10 +164,15 @@ class CalculationFailedResponseSchema {
|
|
|
152
164
|
calculationElapsedTime: number;
|
|
153
165
|
operationId: string;
|
|
154
166
|
}) {
|
|
155
|
-
return new CalculationFailedResponse(
|
|
156
|
-
|
|
167
|
+
return new CalculationFailedResponse(
|
|
168
|
+
data.resultCode,
|
|
169
|
+
data.messages,
|
|
170
|
+
data.calculationElapsedTime,
|
|
171
|
+
data.operationId
|
|
172
|
+
);
|
|
157
173
|
}
|
|
158
|
-
|
|
174
|
+
}
|
|
175
|
+
|
|
159
176
|
export interface ConvertCompositionMassToMoleCalculationRequestSchemaData {
|
|
160
177
|
mixture: Entities.Material;
|
|
161
178
|
compositionMass: number[];
|
|
@@ -172,9 +189,9 @@ class ConvertCompositionMassToMoleCalculationRequest extends CalculationRequestB
|
|
|
172
189
|
*
|
|
173
190
|
*/
|
|
174
191
|
constructor(data: {
|
|
175
|
-
mixture: Entities.Material
|
|
176
|
-
compositionMass: number[]
|
|
177
|
-
compositionMassCount: number
|
|
192
|
+
mixture: Entities.Material;
|
|
193
|
+
compositionMass: number[];
|
|
194
|
+
compositionMassCount: number;
|
|
178
195
|
}) {
|
|
179
196
|
super();
|
|
180
197
|
this.mixture = data.mixture;
|
|
@@ -204,15 +221,21 @@ export class ConvertCompositionMassToMoleCalculationRequestSchema {
|
|
|
204
221
|
};
|
|
205
222
|
}
|
|
206
223
|
|
|
207
|
-
validate(
|
|
224
|
+
validate(
|
|
225
|
+
data: ConvertCompositionMassToMoleCalculationRequestSchemaData
|
|
226
|
+
): ConvertCompositionMassToMoleCalculationRequest {
|
|
208
227
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
209
228
|
if (error) {
|
|
210
|
-
throw new Error(
|
|
229
|
+
throw new Error(
|
|
230
|
+
`Validation error: ${error.details.map((x) => x.message).join(", ")}`
|
|
231
|
+
);
|
|
211
232
|
}
|
|
212
233
|
return this.makeCalculationRequest(value);
|
|
213
234
|
}
|
|
214
235
|
|
|
215
|
-
makeCalculationRequest(
|
|
236
|
+
makeCalculationRequest(
|
|
237
|
+
data: ConvertCompositionMassToMoleCalculationRequestSchemaData
|
|
238
|
+
): ConvertCompositionMassToMoleCalculationRequest {
|
|
216
239
|
return new ConvertCompositionMassToMoleCalculationRequest(data);
|
|
217
240
|
}
|
|
218
241
|
}
|
|
@@ -228,9 +251,9 @@ export class ConvertCompositionMassToMoleCalculation extends CalculationBase {
|
|
|
228
251
|
*
|
|
229
252
|
*/
|
|
230
253
|
constructor(data: {
|
|
231
|
-
mixture: Entities.Material
|
|
232
|
-
compositionMass: number[]
|
|
233
|
-
compositionMassCount: number
|
|
254
|
+
mixture: Entities.Material;
|
|
255
|
+
compositionMass: number[];
|
|
256
|
+
compositionMassCount: number;
|
|
234
257
|
controller?: AbortController;
|
|
235
258
|
}) {
|
|
236
259
|
super(data.controller);
|
|
@@ -244,7 +267,7 @@ export class ConvertCompositionMassToMoleCalculation extends CalculationBase {
|
|
|
244
267
|
const request = new ConvertCompositionMassToMoleCalculationRequest({
|
|
245
268
|
mixture: this.mixture,
|
|
246
269
|
compositionMass: this.compositionMass,
|
|
247
|
-
compositionMassCount: this.compositionMassCount
|
|
270
|
+
compositionMassCount: this.compositionMassCount,
|
|
248
271
|
});
|
|
249
272
|
|
|
250
273
|
const schema = new ConvertCompositionMassToMoleCalculationRequestSchema();
|
|
@@ -257,7 +280,8 @@ export class ConvertCompositionMassToMoleCalculation extends CalculationBase {
|
|
|
257
280
|
|
|
258
281
|
const { data } = await this.postRequest(url, requestJson);
|
|
259
282
|
|
|
260
|
-
const responseSchema =
|
|
283
|
+
const responseSchema =
|
|
284
|
+
new ConvertCompositionMassToMoleCalculationResponseSchema();
|
|
261
285
|
const validatedResponse = responseSchema.validate(data);
|
|
262
286
|
|
|
263
287
|
this.resultCode = validatedResponse.resultCode;
|
|
@@ -290,14 +314,28 @@ export class ConvertCompositionMassToMoleCalculation extends CalculationBase {
|
|
|
290
314
|
parts.push("*** compositionMole:");
|
|
291
315
|
parts.push(
|
|
292
316
|
this.compositionMole && this.compositionMole.length > 0
|
|
293
|
-
? this.compositionMole
|
|
317
|
+
? this.compositionMole
|
|
318
|
+
.map((point) => `compositionMoleElement: ${point}`)
|
|
319
|
+
.join("\n")
|
|
294
320
|
: "compositionMole does not contain any elements"
|
|
295
321
|
);
|
|
296
322
|
parts.push(`resultCode: ${String(this.resultCode)}`);
|
|
297
323
|
parts.push("*** messages:");
|
|
298
|
-
parts.push(
|
|
299
|
-
|
|
300
|
-
|
|
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
|
+
);
|
|
301
339
|
|
|
302
340
|
return parts.join("\n");
|
|
303
341
|
}
|
|
@@ -311,11 +349,11 @@ export class ConvertCompositionMassToMoleCalculationResponse extends Calculation
|
|
|
311
349
|
*
|
|
312
350
|
*/
|
|
313
351
|
constructor(data: {
|
|
314
|
-
compositionMole: number[]
|
|
315
|
-
resultCode: Enums.ResultCode
|
|
316
|
-
messages: string[]
|
|
317
|
-
calculationElapsedTime: number
|
|
318
|
-
operationId: string
|
|
352
|
+
compositionMole: number[];
|
|
353
|
+
resultCode: Enums.ResultCode;
|
|
354
|
+
messages: string[];
|
|
355
|
+
calculationElapsedTime: number;
|
|
356
|
+
operationId: string;
|
|
319
357
|
}) {
|
|
320
358
|
super();
|
|
321
359
|
this.compositionMole = data.compositionMole;
|
|
@@ -327,19 +365,31 @@ export class ConvertCompositionMassToMoleCalculationResponse extends Calculation
|
|
|
327
365
|
|
|
328
366
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
329
367
|
if (data.compositionMole && Array.isArray(data.compositionMole)) {
|
|
330
|
-
this.compositionMole = data.compositionMole.map((item) =>
|
|
331
|
-
|
|
332
|
-
|
|
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
|
+
) {
|
|
333
377
|
this.resultCode = data.resultCode as Enums.ResultCode;
|
|
334
378
|
}
|
|
335
379
|
this.messages = this.messages ?? [];
|
|
336
380
|
if (data.messages && Array.isArray(data.messages)) {
|
|
337
381
|
this.messages.push(...data.messages);
|
|
338
382
|
}
|
|
339
|
-
if (
|
|
383
|
+
if (
|
|
384
|
+
data.calculationElapsedTime !== undefined &&
|
|
385
|
+
typeof data.calculationElapsedTime === "number"
|
|
386
|
+
) {
|
|
340
387
|
this.calculationElapsedTime = data.calculationElapsedTime as number;
|
|
341
388
|
}
|
|
342
|
-
if (
|
|
389
|
+
if (
|
|
390
|
+
data.operationId !== undefined &&
|
|
391
|
+
typeof data.operationId === "string"
|
|
392
|
+
) {
|
|
343
393
|
this.operationId = data.operationId as string;
|
|
344
394
|
}
|
|
345
395
|
}
|
|
@@ -374,15 +424,21 @@ export class ConvertCompositionMassToMoleCalculationResponseSchema {
|
|
|
374
424
|
};
|
|
375
425
|
}
|
|
376
426
|
|
|
377
|
-
validate(
|
|
427
|
+
validate(
|
|
428
|
+
data: ConvertCompositionMassToMoleCalculationResponseSchemaData
|
|
429
|
+
): ConvertCompositionMassToMoleCalculationResponse {
|
|
378
430
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
379
431
|
if (error) {
|
|
380
|
-
throw new Error(
|
|
432
|
+
throw new Error(
|
|
433
|
+
`Validation error: ${error.details.map((x) => x.message).join(", ")}`
|
|
434
|
+
);
|
|
381
435
|
}
|
|
382
436
|
return this.makeCalculationResponse(value);
|
|
383
437
|
}
|
|
384
438
|
|
|
385
|
-
makeCalculationResponse(
|
|
439
|
+
makeCalculationResponse(
|
|
440
|
+
data: ConvertCompositionMassToMoleCalculationResponseSchemaData
|
|
441
|
+
): ConvertCompositionMassToMoleCalculationResponse {
|
|
386
442
|
return new ConvertCompositionMassToMoleCalculationResponse(data);
|
|
387
443
|
}
|
|
388
444
|
}
|
|
@@ -403,9 +459,9 @@ class ConvertCompositionMoleToMassCalculationRequest extends CalculationRequestB
|
|
|
403
459
|
*
|
|
404
460
|
*/
|
|
405
461
|
constructor(data: {
|
|
406
|
-
mixture: Entities.Material
|
|
407
|
-
compositionMoles: number[]
|
|
408
|
-
compositionMolesCount: number
|
|
462
|
+
mixture: Entities.Material;
|
|
463
|
+
compositionMoles: number[];
|
|
464
|
+
compositionMolesCount: number;
|
|
409
465
|
}) {
|
|
410
466
|
super();
|
|
411
467
|
this.mixture = data.mixture;
|
|
@@ -435,15 +491,21 @@ export class ConvertCompositionMoleToMassCalculationRequestSchema {
|
|
|
435
491
|
};
|
|
436
492
|
}
|
|
437
493
|
|
|
438
|
-
validate(
|
|
494
|
+
validate(
|
|
495
|
+
data: ConvertCompositionMoleToMassCalculationRequestSchemaData
|
|
496
|
+
): ConvertCompositionMoleToMassCalculationRequest {
|
|
439
497
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
440
498
|
if (error) {
|
|
441
|
-
throw new Error(
|
|
499
|
+
throw new Error(
|
|
500
|
+
`Validation error: ${error.details.map((x) => x.message).join(", ")}`
|
|
501
|
+
);
|
|
442
502
|
}
|
|
443
503
|
return this.makeCalculationRequest(value);
|
|
444
504
|
}
|
|
445
505
|
|
|
446
|
-
makeCalculationRequest(
|
|
506
|
+
makeCalculationRequest(
|
|
507
|
+
data: ConvertCompositionMoleToMassCalculationRequestSchemaData
|
|
508
|
+
): ConvertCompositionMoleToMassCalculationRequest {
|
|
447
509
|
return new ConvertCompositionMoleToMassCalculationRequest(data);
|
|
448
510
|
}
|
|
449
511
|
}
|
|
@@ -459,9 +521,9 @@ export class ConvertCompositionMoleToMassCalculation extends CalculationBase {
|
|
|
459
521
|
*
|
|
460
522
|
*/
|
|
461
523
|
constructor(data: {
|
|
462
|
-
mixture: Entities.Material
|
|
463
|
-
compositionMoles: number[]
|
|
464
|
-
compositionMolesCount: number
|
|
524
|
+
mixture: Entities.Material;
|
|
525
|
+
compositionMoles: number[];
|
|
526
|
+
compositionMolesCount: number;
|
|
465
527
|
controller?: AbortController;
|
|
466
528
|
}) {
|
|
467
529
|
super(data.controller);
|
|
@@ -475,7 +537,7 @@ export class ConvertCompositionMoleToMassCalculation extends CalculationBase {
|
|
|
475
537
|
const request = new ConvertCompositionMoleToMassCalculationRequest({
|
|
476
538
|
mixture: this.mixture,
|
|
477
539
|
compositionMoles: this.compositionMoles,
|
|
478
|
-
compositionMolesCount: this.compositionMolesCount
|
|
540
|
+
compositionMolesCount: this.compositionMolesCount,
|
|
479
541
|
});
|
|
480
542
|
|
|
481
543
|
const schema = new ConvertCompositionMoleToMassCalculationRequestSchema();
|
|
@@ -488,7 +550,8 @@ export class ConvertCompositionMoleToMassCalculation extends CalculationBase {
|
|
|
488
550
|
|
|
489
551
|
const { data } = await this.postRequest(url, requestJson);
|
|
490
552
|
|
|
491
|
-
const responseSchema =
|
|
553
|
+
const responseSchema =
|
|
554
|
+
new ConvertCompositionMoleToMassCalculationResponseSchema();
|
|
492
555
|
const validatedResponse = responseSchema.validate(data);
|
|
493
556
|
|
|
494
557
|
this.resultCode = validatedResponse.resultCode;
|
|
@@ -521,14 +584,28 @@ export class ConvertCompositionMoleToMassCalculation extends CalculationBase {
|
|
|
521
584
|
parts.push("*** compositionMass:");
|
|
522
585
|
parts.push(
|
|
523
586
|
this.compositionMass && this.compositionMass.length > 0
|
|
524
|
-
? this.compositionMass
|
|
587
|
+
? this.compositionMass
|
|
588
|
+
.map((point) => `compositionMassElement: ${point}`)
|
|
589
|
+
.join("\n")
|
|
525
590
|
: "compositionMass does not contain any elements"
|
|
526
591
|
);
|
|
527
592
|
parts.push(`resultCode: ${String(this.resultCode)}`);
|
|
528
593
|
parts.push("*** messages:");
|
|
529
|
-
parts.push(
|
|
530
|
-
|
|
531
|
-
|
|
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
|
+
);
|
|
532
609
|
|
|
533
610
|
return parts.join("\n");
|
|
534
611
|
}
|
|
@@ -542,11 +619,11 @@ export class ConvertCompositionMoleToMassCalculationResponse extends Calculation
|
|
|
542
619
|
*
|
|
543
620
|
*/
|
|
544
621
|
constructor(data: {
|
|
545
|
-
compositionMass: number[]
|
|
546
|
-
resultCode: Enums.ResultCode
|
|
547
|
-
messages: string[]
|
|
548
|
-
calculationElapsedTime: number
|
|
549
|
-
operationId: string
|
|
622
|
+
compositionMass: number[];
|
|
623
|
+
resultCode: Enums.ResultCode;
|
|
624
|
+
messages: string[];
|
|
625
|
+
calculationElapsedTime: number;
|
|
626
|
+
operationId: string;
|
|
550
627
|
}) {
|
|
551
628
|
super();
|
|
552
629
|
this.compositionMass = data.compositionMass;
|
|
@@ -558,19 +635,31 @@ export class ConvertCompositionMoleToMassCalculationResponse extends Calculation
|
|
|
558
635
|
|
|
559
636
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
560
637
|
if (data.compositionMass && Array.isArray(data.compositionMass)) {
|
|
561
|
-
this.compositionMass = data.compositionMass.map((item) =>
|
|
562
|
-
|
|
563
|
-
|
|
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
|
+
) {
|
|
564
647
|
this.resultCode = data.resultCode as Enums.ResultCode;
|
|
565
648
|
}
|
|
566
649
|
this.messages = this.messages ?? [];
|
|
567
650
|
if (data.messages && Array.isArray(data.messages)) {
|
|
568
651
|
this.messages.push(...data.messages);
|
|
569
652
|
}
|
|
570
|
-
if (
|
|
653
|
+
if (
|
|
654
|
+
data.calculationElapsedTime !== undefined &&
|
|
655
|
+
typeof data.calculationElapsedTime === "number"
|
|
656
|
+
) {
|
|
571
657
|
this.calculationElapsedTime = data.calculationElapsedTime as number;
|
|
572
658
|
}
|
|
573
|
-
if (
|
|
659
|
+
if (
|
|
660
|
+
data.operationId !== undefined &&
|
|
661
|
+
typeof data.operationId === "string"
|
|
662
|
+
) {
|
|
574
663
|
this.operationId = data.operationId as string;
|
|
575
664
|
}
|
|
576
665
|
}
|
|
@@ -605,15 +694,21 @@ export class ConvertCompositionMoleToMassCalculationResponseSchema {
|
|
|
605
694
|
};
|
|
606
695
|
}
|
|
607
696
|
|
|
608
|
-
validate(
|
|
697
|
+
validate(
|
|
698
|
+
data: ConvertCompositionMoleToMassCalculationResponseSchemaData
|
|
699
|
+
): ConvertCompositionMoleToMassCalculationResponse {
|
|
609
700
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
610
701
|
if (error) {
|
|
611
|
-
throw new Error(
|
|
702
|
+
throw new Error(
|
|
703
|
+
`Validation error: ${error.details.map((x) => x.message).join(", ")}`
|
|
704
|
+
);
|
|
612
705
|
}
|
|
613
706
|
return this.makeCalculationResponse(value);
|
|
614
707
|
}
|
|
615
708
|
|
|
616
|
-
makeCalculationResponse(
|
|
709
|
+
makeCalculationResponse(
|
|
710
|
+
data: ConvertCompositionMoleToMassCalculationResponseSchemaData
|
|
711
|
+
): ConvertCompositionMoleToMassCalculationResponse {
|
|
617
712
|
return new ConvertCompositionMoleToMassCalculationResponse(data);
|
|
618
713
|
}
|
|
619
714
|
}
|
|
@@ -629,9 +724,7 @@ class GetMassFromVesselCalculationRequest extends CalculationRequestBase {
|
|
|
629
724
|
* GetMassFromVessel calculation request class.
|
|
630
725
|
*
|
|
631
726
|
*/
|
|
632
|
-
constructor(data: {
|
|
633
|
-
vessel: Entities.Vessel
|
|
634
|
-
}) {
|
|
727
|
+
constructor(data: { vessel: Entities.Vessel }) {
|
|
635
728
|
super();
|
|
636
729
|
this.vessel = data.vessel;
|
|
637
730
|
}
|
|
@@ -654,15 +747,21 @@ export class GetMassFromVesselCalculationRequestSchema {
|
|
|
654
747
|
};
|
|
655
748
|
}
|
|
656
749
|
|
|
657
|
-
validate(
|
|
750
|
+
validate(
|
|
751
|
+
data: GetMassFromVesselCalculationRequestSchemaData
|
|
752
|
+
): GetMassFromVesselCalculationRequest {
|
|
658
753
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
659
754
|
if (error) {
|
|
660
|
-
throw new Error(
|
|
755
|
+
throw new Error(
|
|
756
|
+
`Validation error: ${error.details.map((x) => x.message).join(", ")}`
|
|
757
|
+
);
|
|
661
758
|
}
|
|
662
759
|
return this.makeCalculationRequest(value);
|
|
663
760
|
}
|
|
664
761
|
|
|
665
|
-
makeCalculationRequest(
|
|
762
|
+
makeCalculationRequest(
|
|
763
|
+
data: GetMassFromVesselCalculationRequestSchemaData
|
|
764
|
+
): GetMassFromVesselCalculationRequest {
|
|
666
765
|
return new GetMassFromVesselCalculationRequest(data);
|
|
667
766
|
}
|
|
668
767
|
}
|
|
@@ -675,10 +774,7 @@ export class GetMassFromVesselCalculation extends CalculationBase {
|
|
|
675
774
|
* Calculates the mass in a vessel.
|
|
676
775
|
*
|
|
677
776
|
*/
|
|
678
|
-
constructor(data: {
|
|
679
|
-
vessel: Entities.Vessel
|
|
680
|
-
controller?: AbortController;
|
|
681
|
-
}) {
|
|
777
|
+
constructor(data: { vessel: Entities.Vessel; controller?: AbortController }) {
|
|
682
778
|
super(data.controller);
|
|
683
779
|
this.vessel = data.vessel;
|
|
684
780
|
}
|
|
@@ -686,7 +782,7 @@ export class GetMassFromVesselCalculation extends CalculationBase {
|
|
|
686
782
|
async run() {
|
|
687
783
|
try {
|
|
688
784
|
const request = new GetMassFromVesselCalculationRequest({
|
|
689
|
-
vessel: this.vessel
|
|
785
|
+
vessel: this.vessel,
|
|
690
786
|
});
|
|
691
787
|
|
|
692
788
|
const schema = new GetMassFromVesselCalculationRequestSchema();
|
|
@@ -732,9 +828,21 @@ export class GetMassFromVesselCalculation extends CalculationBase {
|
|
|
732
828
|
parts.push(`massInventory: ${String(this.massInventory)}`);
|
|
733
829
|
parts.push(`resultCode: ${String(this.resultCode)}`);
|
|
734
830
|
parts.push("*** messages:");
|
|
735
|
-
parts.push(
|
|
736
|
-
|
|
737
|
-
|
|
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
|
+
);
|
|
738
846
|
|
|
739
847
|
return parts.join("\n");
|
|
740
848
|
}
|
|
@@ -748,11 +856,11 @@ export class GetMassFromVesselCalculationResponse extends CalculationResponseBas
|
|
|
748
856
|
*
|
|
749
857
|
*/
|
|
750
858
|
constructor(data: {
|
|
751
|
-
massInventory: number
|
|
752
|
-
resultCode: Enums.ResultCode
|
|
753
|
-
messages: string[]
|
|
754
|
-
calculationElapsedTime: number
|
|
755
|
-
operationId: string
|
|
859
|
+
massInventory: number;
|
|
860
|
+
resultCode: Enums.ResultCode;
|
|
861
|
+
messages: string[];
|
|
862
|
+
calculationElapsedTime: number;
|
|
863
|
+
operationId: string;
|
|
756
864
|
}) {
|
|
757
865
|
super();
|
|
758
866
|
this.massInventory = data.massInventory;
|
|
@@ -763,20 +871,33 @@ export class GetMassFromVesselCalculationResponse extends CalculationResponseBas
|
|
|
763
871
|
}
|
|
764
872
|
|
|
765
873
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
766
|
-
if (
|
|
874
|
+
if (
|
|
875
|
+
data.massInventory !== undefined &&
|
|
876
|
+
typeof data.massInventory === "number"
|
|
877
|
+
) {
|
|
767
878
|
this.massInventory = data.massInventory as number;
|
|
768
879
|
}
|
|
769
|
-
if (
|
|
880
|
+
if (
|
|
881
|
+
data.resultCode !== undefined &&
|
|
882
|
+
(typeof data.resultCode === "string" ||
|
|
883
|
+
typeof data.resultCode === "number")
|
|
884
|
+
) {
|
|
770
885
|
this.resultCode = data.resultCode as Enums.ResultCode;
|
|
771
886
|
}
|
|
772
887
|
this.messages = this.messages ?? [];
|
|
773
888
|
if (data.messages && Array.isArray(data.messages)) {
|
|
774
889
|
this.messages.push(...data.messages);
|
|
775
890
|
}
|
|
776
|
-
if (
|
|
891
|
+
if (
|
|
892
|
+
data.calculationElapsedTime !== undefined &&
|
|
893
|
+
typeof data.calculationElapsedTime === "number"
|
|
894
|
+
) {
|
|
777
895
|
this.calculationElapsedTime = data.calculationElapsedTime as number;
|
|
778
896
|
}
|
|
779
|
-
if (
|
|
897
|
+
if (
|
|
898
|
+
data.operationId !== undefined &&
|
|
899
|
+
typeof data.operationId === "string"
|
|
900
|
+
) {
|
|
780
901
|
this.operationId = data.operationId as string;
|
|
781
902
|
}
|
|
782
903
|
}
|
|
@@ -811,15 +932,21 @@ export class GetMassFromVesselCalculationResponseSchema {
|
|
|
811
932
|
};
|
|
812
933
|
}
|
|
813
934
|
|
|
814
|
-
validate(
|
|
935
|
+
validate(
|
|
936
|
+
data: GetMassFromVesselCalculationResponseSchemaData
|
|
937
|
+
): GetMassFromVesselCalculationResponse {
|
|
815
938
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
816
939
|
if (error) {
|
|
817
|
-
throw new Error(
|
|
940
|
+
throw new Error(
|
|
941
|
+
`Validation error: ${error.details.map((x) => x.message).join(", ")}`
|
|
942
|
+
);
|
|
818
943
|
}
|
|
819
944
|
return this.makeCalculationResponse(value);
|
|
820
945
|
}
|
|
821
946
|
|
|
822
|
-
makeCalculationResponse(
|
|
947
|
+
makeCalculationResponse(
|
|
948
|
+
data: GetMassFromVesselCalculationResponseSchemaData
|
|
949
|
+
): GetMassFromVesselCalculationResponse {
|
|
823
950
|
return new GetMassFromVesselCalculationResponse(data);
|
|
824
951
|
}
|
|
825
952
|
}
|
|
@@ -848,13 +975,13 @@ class LoadMassInventoryVesselForLeakScenarioCalculationRequest extends Calculati
|
|
|
848
975
|
*
|
|
849
976
|
*/
|
|
850
977
|
constructor(data: {
|
|
851
|
-
material: Entities.Material
|
|
852
|
-
mass: number
|
|
853
|
-
pressure: number
|
|
854
|
-
temperature: number
|
|
855
|
-
holeSize: number
|
|
856
|
-
releaseElevation: number
|
|
857
|
-
releaseAngle: number
|
|
978
|
+
material: Entities.Material;
|
|
979
|
+
mass: number;
|
|
980
|
+
pressure: number;
|
|
981
|
+
temperature: number;
|
|
982
|
+
holeSize: number;
|
|
983
|
+
releaseElevation: number;
|
|
984
|
+
releaseAngle: number;
|
|
858
985
|
}) {
|
|
859
986
|
super();
|
|
860
987
|
this.material = data.material;
|
|
@@ -896,15 +1023,21 @@ export class LoadMassInventoryVesselForLeakScenarioCalculationRequestSchema {
|
|
|
896
1023
|
};
|
|
897
1024
|
}
|
|
898
1025
|
|
|
899
|
-
validate(
|
|
1026
|
+
validate(
|
|
1027
|
+
data: LoadMassInventoryVesselForLeakScenarioCalculationRequestSchemaData
|
|
1028
|
+
): LoadMassInventoryVesselForLeakScenarioCalculationRequest {
|
|
900
1029
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
901
1030
|
if (error) {
|
|
902
|
-
throw new Error(
|
|
1031
|
+
throw new Error(
|
|
1032
|
+
`Validation error: ${error.details.map((x) => x.message).join(", ")}`
|
|
1033
|
+
);
|
|
903
1034
|
}
|
|
904
1035
|
return this.makeCalculationRequest(value);
|
|
905
1036
|
}
|
|
906
1037
|
|
|
907
|
-
makeCalculationRequest(
|
|
1038
|
+
makeCalculationRequest(
|
|
1039
|
+
data: LoadMassInventoryVesselForLeakScenarioCalculationRequestSchemaData
|
|
1040
|
+
): LoadMassInventoryVesselForLeakScenarioCalculationRequest {
|
|
908
1041
|
return new LoadMassInventoryVesselForLeakScenarioCalculationRequest(data);
|
|
909
1042
|
}
|
|
910
1043
|
}
|
|
@@ -925,13 +1058,13 @@ export class LoadMassInventoryVesselForLeakScenarioCalculation extends Calculati
|
|
|
925
1058
|
*
|
|
926
1059
|
*/
|
|
927
1060
|
constructor(data: {
|
|
928
|
-
material: Entities.Material
|
|
929
|
-
mass: number
|
|
930
|
-
pressure: number
|
|
931
|
-
temperature: number
|
|
932
|
-
holeSize: number
|
|
933
|
-
releaseElevation: number
|
|
934
|
-
releaseAngle: number
|
|
1061
|
+
material: Entities.Material;
|
|
1062
|
+
mass: number;
|
|
1063
|
+
pressure: number;
|
|
1064
|
+
temperature: number;
|
|
1065
|
+
holeSize: number;
|
|
1066
|
+
releaseElevation: number;
|
|
1067
|
+
releaseAngle: number;
|
|
935
1068
|
controller?: AbortController;
|
|
936
1069
|
}) {
|
|
937
1070
|
super(data.controller);
|
|
@@ -946,17 +1079,19 @@ export class LoadMassInventoryVesselForLeakScenarioCalculation extends Calculati
|
|
|
946
1079
|
|
|
947
1080
|
async run() {
|
|
948
1081
|
try {
|
|
949
|
-
const request =
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
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
|
+
});
|
|
958
1092
|
|
|
959
|
-
const schema =
|
|
1093
|
+
const schema =
|
|
1094
|
+
new LoadMassInventoryVesselForLeakScenarioCalculationRequestSchema();
|
|
960
1095
|
const validatedRequest = schema.validate(request);
|
|
961
1096
|
|
|
962
1097
|
const requestJson = JSON.stringify(validatedRequest);
|
|
@@ -966,7 +1101,8 @@ export class LoadMassInventoryVesselForLeakScenarioCalculation extends Calculati
|
|
|
966
1101
|
|
|
967
1102
|
const { data } = await this.postRequest(url, requestJson);
|
|
968
1103
|
|
|
969
|
-
const responseSchema =
|
|
1104
|
+
const responseSchema =
|
|
1105
|
+
new LoadMassInventoryVesselForLeakScenarioCalculationResponseSchema();
|
|
970
1106
|
const validatedResponse = responseSchema.validate(data);
|
|
971
1107
|
|
|
972
1108
|
this.resultCode = validatedResponse.resultCode;
|
|
@@ -1001,9 +1137,21 @@ export class LoadMassInventoryVesselForLeakScenarioCalculation extends Calculati
|
|
|
1001
1137
|
parts.push(`leak: ${String(this.leak)}`);
|
|
1002
1138
|
parts.push(`resultCode: ${String(this.resultCode)}`);
|
|
1003
1139
|
parts.push("*** messages:");
|
|
1004
|
-
parts.push(
|
|
1005
|
-
|
|
1006
|
-
|
|
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
|
+
);
|
|
1007
1155
|
|
|
1008
1156
|
return parts.join("\n");
|
|
1009
1157
|
}
|
|
@@ -1018,12 +1166,12 @@ export class LoadMassInventoryVesselForLeakScenarioCalculationResponse extends C
|
|
|
1018
1166
|
*
|
|
1019
1167
|
*/
|
|
1020
1168
|
constructor(data: {
|
|
1021
|
-
vessel: Entities.Vessel
|
|
1022
|
-
leak: Entities.Leak
|
|
1023
|
-
resultCode: Enums.ResultCode
|
|
1024
|
-
messages: string[]
|
|
1025
|
-
calculationElapsedTime: number
|
|
1026
|
-
operationId: string
|
|
1169
|
+
vessel: Entities.Vessel;
|
|
1170
|
+
leak: Entities.Leak;
|
|
1171
|
+
resultCode: Enums.ResultCode;
|
|
1172
|
+
messages: string[];
|
|
1173
|
+
calculationElapsedTime: number;
|
|
1174
|
+
operationId: string;
|
|
1027
1175
|
}) {
|
|
1028
1176
|
super();
|
|
1029
1177
|
this.vessel = data.vessel;
|
|
@@ -1037,23 +1185,37 @@ export class LoadMassInventoryVesselForLeakScenarioCalculationResponse extends C
|
|
|
1037
1185
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
1038
1186
|
if (data.vessel) {
|
|
1039
1187
|
this.vessel = new Entities.Vessel();
|
|
1040
|
-
this.vessel.initialiseFromDictionary(
|
|
1188
|
+
this.vessel.initialiseFromDictionary(
|
|
1189
|
+
data.vessel as { [key: string]: unknown }
|
|
1190
|
+
);
|
|
1041
1191
|
}
|
|
1042
1192
|
if (data.leak) {
|
|
1043
1193
|
this.leak = new Entities.Leak();
|
|
1044
|
-
this.leak.initialiseFromDictionary(
|
|
1045
|
-
|
|
1046
|
-
|
|
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
|
+
) {
|
|
1047
1203
|
this.resultCode = data.resultCode as Enums.ResultCode;
|
|
1048
1204
|
}
|
|
1049
1205
|
this.messages = this.messages ?? [];
|
|
1050
1206
|
if (data.messages && Array.isArray(data.messages)) {
|
|
1051
1207
|
this.messages.push(...data.messages);
|
|
1052
1208
|
}
|
|
1053
|
-
if (
|
|
1209
|
+
if (
|
|
1210
|
+
data.calculationElapsedTime !== undefined &&
|
|
1211
|
+
typeof data.calculationElapsedTime === "number"
|
|
1212
|
+
) {
|
|
1054
1213
|
this.calculationElapsedTime = data.calculationElapsedTime as number;
|
|
1055
1214
|
}
|
|
1056
|
-
if (
|
|
1215
|
+
if (
|
|
1216
|
+
data.operationId !== undefined &&
|
|
1217
|
+
typeof data.operationId === "string"
|
|
1218
|
+
) {
|
|
1057
1219
|
this.operationId = data.operationId as string;
|
|
1058
1220
|
}
|
|
1059
1221
|
}
|
|
@@ -1091,15 +1253,21 @@ export class LoadMassInventoryVesselForLeakScenarioCalculationResponseSchema {
|
|
|
1091
1253
|
};
|
|
1092
1254
|
}
|
|
1093
1255
|
|
|
1094
|
-
validate(
|
|
1256
|
+
validate(
|
|
1257
|
+
data: LoadMassInventoryVesselForLeakScenarioCalculationResponseSchemaData
|
|
1258
|
+
): LoadMassInventoryVesselForLeakScenarioCalculationResponse {
|
|
1095
1259
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
1096
1260
|
if (error) {
|
|
1097
|
-
throw new Error(
|
|
1261
|
+
throw new Error(
|
|
1262
|
+
`Validation error: ${error.details.map((x) => x.message).join(", ")}`
|
|
1263
|
+
);
|
|
1098
1264
|
}
|
|
1099
1265
|
return this.makeCalculationResponse(value);
|
|
1100
1266
|
}
|
|
1101
1267
|
|
|
1102
|
-
makeCalculationResponse(
|
|
1268
|
+
makeCalculationResponse(
|
|
1269
|
+
data: LoadMassInventoryVesselForLeakScenarioCalculationResponseSchemaData
|
|
1270
|
+
): LoadMassInventoryVesselForLeakScenarioCalculationResponse {
|
|
1103
1271
|
return new LoadMassInventoryVesselForLeakScenarioCalculationResponse(data);
|
|
1104
1272
|
}
|
|
1105
1273
|
}
|
|
@@ -1130,14 +1298,14 @@ class LoadMassInventoryVesselForLineRuptureScenarioCalculationRequest extends Ca
|
|
|
1130
1298
|
*
|
|
1131
1299
|
*/
|
|
1132
1300
|
constructor(data: {
|
|
1133
|
-
material: Entities.Material
|
|
1134
|
-
mass: number
|
|
1135
|
-
pressure: number
|
|
1136
|
-
temperature: number
|
|
1137
|
-
pipeDiameter: number
|
|
1138
|
-
pipeLength: number
|
|
1139
|
-
releaseElevation: number
|
|
1140
|
-
releaseAngle: number
|
|
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;
|
|
1141
1309
|
}) {
|
|
1142
1310
|
super();
|
|
1143
1311
|
this.material = data.material;
|
|
@@ -1182,16 +1350,24 @@ export class LoadMassInventoryVesselForLineRuptureScenarioCalculationRequestSche
|
|
|
1182
1350
|
};
|
|
1183
1351
|
}
|
|
1184
1352
|
|
|
1185
|
-
validate(
|
|
1353
|
+
validate(
|
|
1354
|
+
data: LoadMassInventoryVesselForLineRuptureScenarioCalculationRequestSchemaData
|
|
1355
|
+
): LoadMassInventoryVesselForLineRuptureScenarioCalculationRequest {
|
|
1186
1356
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
1187
1357
|
if (error) {
|
|
1188
|
-
throw new Error(
|
|
1358
|
+
throw new Error(
|
|
1359
|
+
`Validation error: ${error.details.map((x) => x.message).join(", ")}`
|
|
1360
|
+
);
|
|
1189
1361
|
}
|
|
1190
1362
|
return this.makeCalculationRequest(value);
|
|
1191
1363
|
}
|
|
1192
1364
|
|
|
1193
|
-
makeCalculationRequest(
|
|
1194
|
-
|
|
1365
|
+
makeCalculationRequest(
|
|
1366
|
+
data: LoadMassInventoryVesselForLineRuptureScenarioCalculationRequestSchemaData
|
|
1367
|
+
): LoadMassInventoryVesselForLineRuptureScenarioCalculationRequest {
|
|
1368
|
+
return new LoadMassInventoryVesselForLineRuptureScenarioCalculationRequest(
|
|
1369
|
+
data
|
|
1370
|
+
);
|
|
1195
1371
|
}
|
|
1196
1372
|
}
|
|
1197
1373
|
|
|
@@ -1212,14 +1388,14 @@ export class LoadMassInventoryVesselForLineRuptureScenarioCalculation extends Ca
|
|
|
1212
1388
|
*
|
|
1213
1389
|
*/
|
|
1214
1390
|
constructor(data: {
|
|
1215
|
-
material: Entities.Material
|
|
1216
|
-
mass: number
|
|
1217
|
-
pressure: number
|
|
1218
|
-
temperature: number
|
|
1219
|
-
pipeDiameter: number
|
|
1220
|
-
pipeLength: number
|
|
1221
|
-
releaseElevation: number
|
|
1222
|
-
releaseAngle: number
|
|
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;
|
|
1223
1399
|
controller?: AbortController;
|
|
1224
1400
|
}) {
|
|
1225
1401
|
super(data.controller);
|
|
@@ -1235,18 +1411,20 @@ export class LoadMassInventoryVesselForLineRuptureScenarioCalculation extends Ca
|
|
|
1235
1411
|
|
|
1236
1412
|
async run() {
|
|
1237
1413
|
try {
|
|
1238
|
-
const request =
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
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
|
+
});
|
|
1248
1425
|
|
|
1249
|
-
const schema =
|
|
1426
|
+
const schema =
|
|
1427
|
+
new LoadMassInventoryVesselForLineRuptureScenarioCalculationRequestSchema();
|
|
1250
1428
|
const validatedRequest = schema.validate(request);
|
|
1251
1429
|
|
|
1252
1430
|
const requestJson = JSON.stringify(validatedRequest);
|
|
@@ -1256,7 +1434,8 @@ export class LoadMassInventoryVesselForLineRuptureScenarioCalculation extends Ca
|
|
|
1256
1434
|
|
|
1257
1435
|
const { data } = await this.postRequest(url, requestJson);
|
|
1258
1436
|
|
|
1259
|
-
const responseSchema =
|
|
1437
|
+
const responseSchema =
|
|
1438
|
+
new LoadMassInventoryVesselForLineRuptureScenarioCalculationResponseSchema();
|
|
1260
1439
|
const validatedResponse = responseSchema.validate(data);
|
|
1261
1440
|
|
|
1262
1441
|
this.resultCode = validatedResponse.resultCode;
|
|
@@ -1291,9 +1470,21 @@ export class LoadMassInventoryVesselForLineRuptureScenarioCalculation extends Ca
|
|
|
1291
1470
|
parts.push(`lineRupture: ${String(this.lineRupture)}`);
|
|
1292
1471
|
parts.push(`resultCode: ${String(this.resultCode)}`);
|
|
1293
1472
|
parts.push("*** messages:");
|
|
1294
|
-
parts.push(
|
|
1295
|
-
|
|
1296
|
-
|
|
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
|
+
);
|
|
1297
1488
|
|
|
1298
1489
|
return parts.join("\n");
|
|
1299
1490
|
}
|
|
@@ -1308,12 +1499,12 @@ export class LoadMassInventoryVesselForLineRuptureScenarioCalculationResponse ex
|
|
|
1308
1499
|
*
|
|
1309
1500
|
*/
|
|
1310
1501
|
constructor(data: {
|
|
1311
|
-
vessel: Entities.Vessel
|
|
1312
|
-
lineRupture: Entities.LineRupture
|
|
1313
|
-
resultCode: Enums.ResultCode
|
|
1314
|
-
messages: string[]
|
|
1315
|
-
calculationElapsedTime: number
|
|
1316
|
-
operationId: string
|
|
1502
|
+
vessel: Entities.Vessel;
|
|
1503
|
+
lineRupture: Entities.LineRupture;
|
|
1504
|
+
resultCode: Enums.ResultCode;
|
|
1505
|
+
messages: string[];
|
|
1506
|
+
calculationElapsedTime: number;
|
|
1507
|
+
operationId: string;
|
|
1317
1508
|
}) {
|
|
1318
1509
|
super();
|
|
1319
1510
|
this.vessel = data.vessel;
|
|
@@ -1327,23 +1518,37 @@ export class LoadMassInventoryVesselForLineRuptureScenarioCalculationResponse ex
|
|
|
1327
1518
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
1328
1519
|
if (data.vessel) {
|
|
1329
1520
|
this.vessel = new Entities.Vessel();
|
|
1330
|
-
this.vessel.initialiseFromDictionary(
|
|
1521
|
+
this.vessel.initialiseFromDictionary(
|
|
1522
|
+
data.vessel as { [key: string]: unknown }
|
|
1523
|
+
);
|
|
1331
1524
|
}
|
|
1332
1525
|
if (data.lineRupture) {
|
|
1333
1526
|
this.lineRupture = new Entities.LineRupture();
|
|
1334
|
-
this.lineRupture.initialiseFromDictionary(
|
|
1335
|
-
|
|
1336
|
-
|
|
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
|
+
) {
|
|
1337
1536
|
this.resultCode = data.resultCode as Enums.ResultCode;
|
|
1338
1537
|
}
|
|
1339
1538
|
this.messages = this.messages ?? [];
|
|
1340
1539
|
if (data.messages && Array.isArray(data.messages)) {
|
|
1341
1540
|
this.messages.push(...data.messages);
|
|
1342
1541
|
}
|
|
1343
|
-
if (
|
|
1542
|
+
if (
|
|
1543
|
+
data.calculationElapsedTime !== undefined &&
|
|
1544
|
+
typeof data.calculationElapsedTime === "number"
|
|
1545
|
+
) {
|
|
1344
1546
|
this.calculationElapsedTime = data.calculationElapsedTime as number;
|
|
1345
1547
|
}
|
|
1346
|
-
if (
|
|
1548
|
+
if (
|
|
1549
|
+
data.operationId !== undefined &&
|
|
1550
|
+
typeof data.operationId === "string"
|
|
1551
|
+
) {
|
|
1347
1552
|
this.operationId = data.operationId as string;
|
|
1348
1553
|
}
|
|
1349
1554
|
}
|
|
@@ -1381,16 +1586,24 @@ export class LoadMassInventoryVesselForLineRuptureScenarioCalculationResponseSch
|
|
|
1381
1586
|
};
|
|
1382
1587
|
}
|
|
1383
1588
|
|
|
1384
|
-
validate(
|
|
1589
|
+
validate(
|
|
1590
|
+
data: LoadMassInventoryVesselForLineRuptureScenarioCalculationResponseSchemaData
|
|
1591
|
+
): LoadMassInventoryVesselForLineRuptureScenarioCalculationResponse {
|
|
1385
1592
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
1386
1593
|
if (error) {
|
|
1387
|
-
throw new Error(
|
|
1594
|
+
throw new Error(
|
|
1595
|
+
`Validation error: ${error.details.map((x) => x.message).join(", ")}`
|
|
1596
|
+
);
|
|
1388
1597
|
}
|
|
1389
1598
|
return this.makeCalculationResponse(value);
|
|
1390
1599
|
}
|
|
1391
1600
|
|
|
1392
|
-
makeCalculationResponse(
|
|
1393
|
-
|
|
1601
|
+
makeCalculationResponse(
|
|
1602
|
+
data: LoadMassInventoryVesselForLineRuptureScenarioCalculationResponseSchemaData
|
|
1603
|
+
): LoadMassInventoryVesselForLineRuptureScenarioCalculationResponse {
|
|
1604
|
+
return new LoadMassInventoryVesselForLineRuptureScenarioCalculationResponse(
|
|
1605
|
+
data
|
|
1606
|
+
);
|
|
1394
1607
|
}
|
|
1395
1608
|
}
|
|
1396
1609
|
|
|
@@ -1422,15 +1635,15 @@ class LoadMassInventoryVesselForReliefValveScenarioCalculationRequest extends Ca
|
|
|
1422
1635
|
*
|
|
1423
1636
|
*/
|
|
1424
1637
|
constructor(data: {
|
|
1425
|
-
material: Entities.Material
|
|
1426
|
-
mass: number
|
|
1427
|
-
pressure: number
|
|
1428
|
-
temperature: number
|
|
1429
|
-
constrictionSize: number
|
|
1430
|
-
pipeDiameter: number
|
|
1431
|
-
pipeLength: number
|
|
1432
|
-
releaseElevation: number
|
|
1433
|
-
releaseAngle: number
|
|
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;
|
|
1434
1647
|
}) {
|
|
1435
1648
|
super();
|
|
1436
1649
|
this.material = data.material;
|
|
@@ -1478,16 +1691,24 @@ export class LoadMassInventoryVesselForReliefValveScenarioCalculationRequestSche
|
|
|
1478
1691
|
};
|
|
1479
1692
|
}
|
|
1480
1693
|
|
|
1481
|
-
validate(
|
|
1694
|
+
validate(
|
|
1695
|
+
data: LoadMassInventoryVesselForReliefValveScenarioCalculationRequestSchemaData
|
|
1696
|
+
): LoadMassInventoryVesselForReliefValveScenarioCalculationRequest {
|
|
1482
1697
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
1483
1698
|
if (error) {
|
|
1484
|
-
throw new Error(
|
|
1699
|
+
throw new Error(
|
|
1700
|
+
`Validation error: ${error.details.map((x) => x.message).join(", ")}`
|
|
1701
|
+
);
|
|
1485
1702
|
}
|
|
1486
1703
|
return this.makeCalculationRequest(value);
|
|
1487
1704
|
}
|
|
1488
1705
|
|
|
1489
|
-
makeCalculationRequest(
|
|
1490
|
-
|
|
1706
|
+
makeCalculationRequest(
|
|
1707
|
+
data: LoadMassInventoryVesselForReliefValveScenarioCalculationRequestSchemaData
|
|
1708
|
+
): LoadMassInventoryVesselForReliefValveScenarioCalculationRequest {
|
|
1709
|
+
return new LoadMassInventoryVesselForReliefValveScenarioCalculationRequest(
|
|
1710
|
+
data
|
|
1711
|
+
);
|
|
1491
1712
|
}
|
|
1492
1713
|
}
|
|
1493
1714
|
|
|
@@ -1509,15 +1730,15 @@ export class LoadMassInventoryVesselForReliefValveScenarioCalculation extends Ca
|
|
|
1509
1730
|
*
|
|
1510
1731
|
*/
|
|
1511
1732
|
constructor(data: {
|
|
1512
|
-
material: Entities.Material
|
|
1513
|
-
mass: number
|
|
1514
|
-
pressure: number
|
|
1515
|
-
temperature: number
|
|
1516
|
-
constrictionSize: number
|
|
1517
|
-
pipeDiameter: number
|
|
1518
|
-
pipeLength: number
|
|
1519
|
-
releaseElevation: number
|
|
1520
|
-
releaseAngle: number
|
|
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;
|
|
1521
1742
|
controller?: AbortController;
|
|
1522
1743
|
}) {
|
|
1523
1744
|
super(data.controller);
|
|
@@ -1534,19 +1755,21 @@ export class LoadMassInventoryVesselForReliefValveScenarioCalculation extends Ca
|
|
|
1534
1755
|
|
|
1535
1756
|
async run() {
|
|
1536
1757
|
try {
|
|
1537
|
-
const request =
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
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
|
+
});
|
|
1548
1770
|
|
|
1549
|
-
const schema =
|
|
1771
|
+
const schema =
|
|
1772
|
+
new LoadMassInventoryVesselForReliefValveScenarioCalculationRequestSchema();
|
|
1550
1773
|
const validatedRequest = schema.validate(request);
|
|
1551
1774
|
|
|
1552
1775
|
const requestJson = JSON.stringify(validatedRequest);
|
|
@@ -1556,7 +1779,8 @@ export class LoadMassInventoryVesselForReliefValveScenarioCalculation extends Ca
|
|
|
1556
1779
|
|
|
1557
1780
|
const { data } = await this.postRequest(url, requestJson);
|
|
1558
1781
|
|
|
1559
|
-
const responseSchema =
|
|
1782
|
+
const responseSchema =
|
|
1783
|
+
new LoadMassInventoryVesselForReliefValveScenarioCalculationResponseSchema();
|
|
1560
1784
|
const validatedResponse = responseSchema.validate(data);
|
|
1561
1785
|
|
|
1562
1786
|
this.resultCode = validatedResponse.resultCode;
|
|
@@ -1591,9 +1815,21 @@ export class LoadMassInventoryVesselForReliefValveScenarioCalculation extends Ca
|
|
|
1591
1815
|
parts.push(`reliefValve: ${String(this.reliefValve)}`);
|
|
1592
1816
|
parts.push(`resultCode: ${String(this.resultCode)}`);
|
|
1593
1817
|
parts.push("*** messages:");
|
|
1594
|
-
parts.push(
|
|
1595
|
-
|
|
1596
|
-
|
|
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
|
+
);
|
|
1597
1833
|
|
|
1598
1834
|
return parts.join("\n");
|
|
1599
1835
|
}
|
|
@@ -1608,12 +1844,12 @@ export class LoadMassInventoryVesselForReliefValveScenarioCalculationResponse ex
|
|
|
1608
1844
|
*
|
|
1609
1845
|
*/
|
|
1610
1846
|
constructor(data: {
|
|
1611
|
-
vessel: Entities.Vessel
|
|
1612
|
-
reliefValve: Entities.ReliefValve
|
|
1613
|
-
resultCode: Enums.ResultCode
|
|
1614
|
-
messages: string[]
|
|
1615
|
-
calculationElapsedTime: number
|
|
1616
|
-
operationId: string
|
|
1847
|
+
vessel: Entities.Vessel;
|
|
1848
|
+
reliefValve: Entities.ReliefValve;
|
|
1849
|
+
resultCode: Enums.ResultCode;
|
|
1850
|
+
messages: string[];
|
|
1851
|
+
calculationElapsedTime: number;
|
|
1852
|
+
operationId: string;
|
|
1617
1853
|
}) {
|
|
1618
1854
|
super();
|
|
1619
1855
|
this.vessel = data.vessel;
|
|
@@ -1627,23 +1863,37 @@ export class LoadMassInventoryVesselForReliefValveScenarioCalculationResponse ex
|
|
|
1627
1863
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
1628
1864
|
if (data.vessel) {
|
|
1629
1865
|
this.vessel = new Entities.Vessel();
|
|
1630
|
-
this.vessel.initialiseFromDictionary(
|
|
1866
|
+
this.vessel.initialiseFromDictionary(
|
|
1867
|
+
data.vessel as { [key: string]: unknown }
|
|
1868
|
+
);
|
|
1631
1869
|
}
|
|
1632
1870
|
if (data.reliefValve) {
|
|
1633
1871
|
this.reliefValve = new Entities.ReliefValve();
|
|
1634
|
-
this.reliefValve.initialiseFromDictionary(
|
|
1635
|
-
|
|
1636
|
-
|
|
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
|
+
) {
|
|
1637
1881
|
this.resultCode = data.resultCode as Enums.ResultCode;
|
|
1638
1882
|
}
|
|
1639
1883
|
this.messages = this.messages ?? [];
|
|
1640
1884
|
if (data.messages && Array.isArray(data.messages)) {
|
|
1641
1885
|
this.messages.push(...data.messages);
|
|
1642
1886
|
}
|
|
1643
|
-
if (
|
|
1887
|
+
if (
|
|
1888
|
+
data.calculationElapsedTime !== undefined &&
|
|
1889
|
+
typeof data.calculationElapsedTime === "number"
|
|
1890
|
+
) {
|
|
1644
1891
|
this.calculationElapsedTime = data.calculationElapsedTime as number;
|
|
1645
1892
|
}
|
|
1646
|
-
if (
|
|
1893
|
+
if (
|
|
1894
|
+
data.operationId !== undefined &&
|
|
1895
|
+
typeof data.operationId === "string"
|
|
1896
|
+
) {
|
|
1647
1897
|
this.operationId = data.operationId as string;
|
|
1648
1898
|
}
|
|
1649
1899
|
}
|
|
@@ -1681,16 +1931,24 @@ export class LoadMassInventoryVesselForReliefValveScenarioCalculationResponseSch
|
|
|
1681
1931
|
};
|
|
1682
1932
|
}
|
|
1683
1933
|
|
|
1684
|
-
validate(
|
|
1934
|
+
validate(
|
|
1935
|
+
data: LoadMassInventoryVesselForReliefValveScenarioCalculationResponseSchemaData
|
|
1936
|
+
): LoadMassInventoryVesselForReliefValveScenarioCalculationResponse {
|
|
1685
1937
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
1686
1938
|
if (error) {
|
|
1687
|
-
throw new Error(
|
|
1939
|
+
throw new Error(
|
|
1940
|
+
`Validation error: ${error.details.map((x) => x.message).join(", ")}`
|
|
1941
|
+
);
|
|
1688
1942
|
}
|
|
1689
1943
|
return this.makeCalculationResponse(value);
|
|
1690
1944
|
}
|
|
1691
1945
|
|
|
1692
|
-
makeCalculationResponse(
|
|
1693
|
-
|
|
1946
|
+
makeCalculationResponse(
|
|
1947
|
+
data: LoadMassInventoryVesselForReliefValveScenarioCalculationResponseSchemaData
|
|
1948
|
+
): LoadMassInventoryVesselForReliefValveScenarioCalculationResponse {
|
|
1949
|
+
return new LoadMassInventoryVesselForReliefValveScenarioCalculationResponse(
|
|
1950
|
+
data
|
|
1951
|
+
);
|
|
1694
1952
|
}
|
|
1695
1953
|
}
|
|
1696
1954
|
|
|
@@ -1707,10 +1965,7 @@ class ReliefValveMinTemperatureCalculationRequest extends CalculationRequestBase
|
|
|
1707
1965
|
* ReliefValveMinTemperature calculation request class.
|
|
1708
1966
|
*
|
|
1709
1967
|
*/
|
|
1710
|
-
constructor(data: {
|
|
1711
|
-
material: Entities.Material,
|
|
1712
|
-
pressure: number
|
|
1713
|
-
}) {
|
|
1968
|
+
constructor(data: { material: Entities.Material; pressure: number }) {
|
|
1714
1969
|
super();
|
|
1715
1970
|
this.material = data.material;
|
|
1716
1971
|
this.pressure = data.pressure;
|
|
@@ -1736,15 +1991,21 @@ export class ReliefValveMinTemperatureCalculationRequestSchema {
|
|
|
1736
1991
|
};
|
|
1737
1992
|
}
|
|
1738
1993
|
|
|
1739
|
-
validate(
|
|
1994
|
+
validate(
|
|
1995
|
+
data: ReliefValveMinTemperatureCalculationRequestSchemaData
|
|
1996
|
+
): ReliefValveMinTemperatureCalculationRequest {
|
|
1740
1997
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
1741
1998
|
if (error) {
|
|
1742
|
-
throw new Error(
|
|
1999
|
+
throw new Error(
|
|
2000
|
+
`Validation error: ${error.details.map((x) => x.message).join(", ")}`
|
|
2001
|
+
);
|
|
1743
2002
|
}
|
|
1744
2003
|
return this.makeCalculationRequest(value);
|
|
1745
2004
|
}
|
|
1746
2005
|
|
|
1747
|
-
makeCalculationRequest(
|
|
2006
|
+
makeCalculationRequest(
|
|
2007
|
+
data: ReliefValveMinTemperatureCalculationRequestSchemaData
|
|
2008
|
+
): ReliefValveMinTemperatureCalculationRequest {
|
|
1748
2009
|
return new ReliefValveMinTemperatureCalculationRequest(data);
|
|
1749
2010
|
}
|
|
1750
2011
|
}
|
|
@@ -1759,8 +2020,8 @@ export class ReliefValveMinTemperatureCalculation extends CalculationBase {
|
|
|
1759
2020
|
*
|
|
1760
2021
|
*/
|
|
1761
2022
|
constructor(data: {
|
|
1762
|
-
material: Entities.Material
|
|
1763
|
-
pressure: number
|
|
2023
|
+
material: Entities.Material;
|
|
2024
|
+
pressure: number;
|
|
1764
2025
|
controller?: AbortController;
|
|
1765
2026
|
}) {
|
|
1766
2027
|
super(data.controller);
|
|
@@ -1772,7 +2033,7 @@ export class ReliefValveMinTemperatureCalculation extends CalculationBase {
|
|
|
1772
2033
|
try {
|
|
1773
2034
|
const request = new ReliefValveMinTemperatureCalculationRequest({
|
|
1774
2035
|
material: this.material,
|
|
1775
|
-
pressure: this.pressure
|
|
2036
|
+
pressure: this.pressure,
|
|
1776
2037
|
});
|
|
1777
2038
|
|
|
1778
2039
|
const schema = new ReliefValveMinTemperatureCalculationRequestSchema();
|
|
@@ -1785,7 +2046,8 @@ export class ReliefValveMinTemperatureCalculation extends CalculationBase {
|
|
|
1785
2046
|
|
|
1786
2047
|
const { data } = await this.postRequest(url, requestJson);
|
|
1787
2048
|
|
|
1788
|
-
const responseSchema =
|
|
2049
|
+
const responseSchema =
|
|
2050
|
+
new ReliefValveMinTemperatureCalculationResponseSchema();
|
|
1789
2051
|
const validatedResponse = responseSchema.validate(data);
|
|
1790
2052
|
|
|
1791
2053
|
this.resultCode = validatedResponse.resultCode;
|
|
@@ -1818,9 +2080,21 @@ export class ReliefValveMinTemperatureCalculation extends CalculationBase {
|
|
|
1818
2080
|
parts.push(`minTemperature: ${String(this.minTemperature)}`);
|
|
1819
2081
|
parts.push(`resultCode: ${String(this.resultCode)}`);
|
|
1820
2082
|
parts.push("*** messages:");
|
|
1821
|
-
parts.push(
|
|
1822
|
-
|
|
1823
|
-
|
|
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
|
+
);
|
|
1824
2098
|
|
|
1825
2099
|
return parts.join("\n");
|
|
1826
2100
|
}
|
|
@@ -1834,11 +2108,11 @@ export class ReliefValveMinTemperatureCalculationResponse extends CalculationRes
|
|
|
1834
2108
|
*
|
|
1835
2109
|
*/
|
|
1836
2110
|
constructor(data: {
|
|
1837
|
-
minTemperature: number
|
|
1838
|
-
resultCode: Enums.ResultCode
|
|
1839
|
-
messages: string[]
|
|
1840
|
-
calculationElapsedTime: number
|
|
1841
|
-
operationId: string
|
|
2111
|
+
minTemperature: number;
|
|
2112
|
+
resultCode: Enums.ResultCode;
|
|
2113
|
+
messages: string[];
|
|
2114
|
+
calculationElapsedTime: number;
|
|
2115
|
+
operationId: string;
|
|
1842
2116
|
}) {
|
|
1843
2117
|
super();
|
|
1844
2118
|
this.minTemperature = data.minTemperature;
|
|
@@ -1849,20 +2123,33 @@ export class ReliefValveMinTemperatureCalculationResponse extends CalculationRes
|
|
|
1849
2123
|
}
|
|
1850
2124
|
|
|
1851
2125
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
1852
|
-
if (
|
|
2126
|
+
if (
|
|
2127
|
+
data.minTemperature !== undefined &&
|
|
2128
|
+
typeof data.minTemperature === "number"
|
|
2129
|
+
) {
|
|
1853
2130
|
this.minTemperature = data.minTemperature as number;
|
|
1854
2131
|
}
|
|
1855
|
-
if (
|
|
2132
|
+
if (
|
|
2133
|
+
data.resultCode !== undefined &&
|
|
2134
|
+
(typeof data.resultCode === "string" ||
|
|
2135
|
+
typeof data.resultCode === "number")
|
|
2136
|
+
) {
|
|
1856
2137
|
this.resultCode = data.resultCode as Enums.ResultCode;
|
|
1857
2138
|
}
|
|
1858
2139
|
this.messages = this.messages ?? [];
|
|
1859
2140
|
if (data.messages && Array.isArray(data.messages)) {
|
|
1860
2141
|
this.messages.push(...data.messages);
|
|
1861
2142
|
}
|
|
1862
|
-
if (
|
|
2143
|
+
if (
|
|
2144
|
+
data.calculationElapsedTime !== undefined &&
|
|
2145
|
+
typeof data.calculationElapsedTime === "number"
|
|
2146
|
+
) {
|
|
1863
2147
|
this.calculationElapsedTime = data.calculationElapsedTime as number;
|
|
1864
2148
|
}
|
|
1865
|
-
if (
|
|
2149
|
+
if (
|
|
2150
|
+
data.operationId !== undefined &&
|
|
2151
|
+
typeof data.operationId === "string"
|
|
2152
|
+
) {
|
|
1866
2153
|
this.operationId = data.operationId as string;
|
|
1867
2154
|
}
|
|
1868
2155
|
}
|
|
@@ -1897,15 +2184,21 @@ export class ReliefValveMinTemperatureCalculationResponseSchema {
|
|
|
1897
2184
|
};
|
|
1898
2185
|
}
|
|
1899
2186
|
|
|
1900
|
-
validate(
|
|
2187
|
+
validate(
|
|
2188
|
+
data: ReliefValveMinTemperatureCalculationResponseSchemaData
|
|
2189
|
+
): ReliefValveMinTemperatureCalculationResponse {
|
|
1901
2190
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
1902
2191
|
if (error) {
|
|
1903
|
-
throw new Error(
|
|
2192
|
+
throw new Error(
|
|
2193
|
+
`Validation error: ${error.details.map((x) => x.message).join(", ")}`
|
|
2194
|
+
);
|
|
1904
2195
|
}
|
|
1905
2196
|
return this.makeCalculationResponse(value);
|
|
1906
2197
|
}
|
|
1907
2198
|
|
|
1908
|
-
makeCalculationResponse(
|
|
2199
|
+
makeCalculationResponse(
|
|
2200
|
+
data: ReliefValveMinTemperatureCalculationResponseSchemaData
|
|
2201
|
+
): ReliefValveMinTemperatureCalculationResponse {
|
|
1909
2202
|
return new ReliefValveMinTemperatureCalculationResponse(data);
|
|
1910
2203
|
}
|
|
1911
2204
|
}
|
|
@@ -1921,9 +2214,7 @@ class SetMixingLayerHeightCalculationRequest extends CalculationRequestBase {
|
|
|
1921
2214
|
* SetMixingLayerHeight calculation request class.
|
|
1922
2215
|
*
|
|
1923
2216
|
*/
|
|
1924
|
-
constructor(data: {
|
|
1925
|
-
weather: Entities.Weather
|
|
1926
|
-
}) {
|
|
2217
|
+
constructor(data: { weather: Entities.Weather }) {
|
|
1927
2218
|
super();
|
|
1928
2219
|
this.weather = data.weather;
|
|
1929
2220
|
}
|
|
@@ -1946,15 +2237,21 @@ export class SetMixingLayerHeightCalculationRequestSchema {
|
|
|
1946
2237
|
};
|
|
1947
2238
|
}
|
|
1948
2239
|
|
|
1949
|
-
validate(
|
|
2240
|
+
validate(
|
|
2241
|
+
data: SetMixingLayerHeightCalculationRequestSchemaData
|
|
2242
|
+
): SetMixingLayerHeightCalculationRequest {
|
|
1950
2243
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
1951
2244
|
if (error) {
|
|
1952
|
-
throw new Error(
|
|
2245
|
+
throw new Error(
|
|
2246
|
+
`Validation error: ${error.details.map((x) => x.message).join(", ")}`
|
|
2247
|
+
);
|
|
1953
2248
|
}
|
|
1954
2249
|
return this.makeCalculationRequest(value);
|
|
1955
2250
|
}
|
|
1956
2251
|
|
|
1957
|
-
makeCalculationRequest(
|
|
2252
|
+
makeCalculationRequest(
|
|
2253
|
+
data: SetMixingLayerHeightCalculationRequestSchemaData
|
|
2254
|
+
): SetMixingLayerHeightCalculationRequest {
|
|
1958
2255
|
return new SetMixingLayerHeightCalculationRequest(data);
|
|
1959
2256
|
}
|
|
1960
2257
|
}
|
|
@@ -1968,7 +2265,7 @@ export class SetMixingLayerHeightCalculation extends CalculationBase {
|
|
|
1968
2265
|
*
|
|
1969
2266
|
*/
|
|
1970
2267
|
constructor(data: {
|
|
1971
|
-
weather: Entities.Weather
|
|
2268
|
+
weather: Entities.Weather;
|
|
1972
2269
|
controller?: AbortController;
|
|
1973
2270
|
}) {
|
|
1974
2271
|
super(data.controller);
|
|
@@ -1978,7 +2275,7 @@ export class SetMixingLayerHeightCalculation extends CalculationBase {
|
|
|
1978
2275
|
async run() {
|
|
1979
2276
|
try {
|
|
1980
2277
|
const request = new SetMixingLayerHeightCalculationRequest({
|
|
1981
|
-
weather: this.weather
|
|
2278
|
+
weather: this.weather,
|
|
1982
2279
|
});
|
|
1983
2280
|
|
|
1984
2281
|
const schema = new SetMixingLayerHeightCalculationRequestSchema();
|
|
@@ -1991,7 +2288,8 @@ export class SetMixingLayerHeightCalculation extends CalculationBase {
|
|
|
1991
2288
|
|
|
1992
2289
|
const { data } = await this.postRequest(url, requestJson);
|
|
1993
2290
|
|
|
1994
|
-
const responseSchema =
|
|
2291
|
+
const responseSchema =
|
|
2292
|
+
new SetMixingLayerHeightCalculationResponseSchema();
|
|
1995
2293
|
const validatedResponse = responseSchema.validate(data);
|
|
1996
2294
|
|
|
1997
2295
|
this.resultCode = validatedResponse.resultCode;
|
|
@@ -2024,9 +2322,21 @@ export class SetMixingLayerHeightCalculation extends CalculationBase {
|
|
|
2024
2322
|
parts.push(`updatedWeather: ${String(this.updatedWeather)}`);
|
|
2025
2323
|
parts.push(`resultCode: ${String(this.resultCode)}`);
|
|
2026
2324
|
parts.push("*** messages:");
|
|
2027
|
-
parts.push(
|
|
2028
|
-
|
|
2029
|
-
|
|
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
|
+
);
|
|
2030
2340
|
|
|
2031
2341
|
return parts.join("\n");
|
|
2032
2342
|
}
|
|
@@ -2040,11 +2350,11 @@ export class SetMixingLayerHeightCalculationResponse extends CalculationResponse
|
|
|
2040
2350
|
*
|
|
2041
2351
|
*/
|
|
2042
2352
|
constructor(data: {
|
|
2043
|
-
updatedWeather: Entities.Weather
|
|
2044
|
-
resultCode: Enums.ResultCode
|
|
2045
|
-
messages: string[]
|
|
2046
|
-
calculationElapsedTime: number
|
|
2047
|
-
operationId: string
|
|
2353
|
+
updatedWeather: Entities.Weather;
|
|
2354
|
+
resultCode: Enums.ResultCode;
|
|
2355
|
+
messages: string[];
|
|
2356
|
+
calculationElapsedTime: number;
|
|
2357
|
+
operationId: string;
|
|
2048
2358
|
}) {
|
|
2049
2359
|
super();
|
|
2050
2360
|
this.updatedWeather = data.updatedWeather;
|
|
@@ -2057,19 +2367,31 @@ export class SetMixingLayerHeightCalculationResponse extends CalculationResponse
|
|
|
2057
2367
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
2058
2368
|
if (data.updatedWeather) {
|
|
2059
2369
|
this.updatedWeather = new Entities.Weather();
|
|
2060
|
-
this.updatedWeather.initialiseFromDictionary(
|
|
2061
|
-
|
|
2062
|
-
|
|
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
|
+
) {
|
|
2063
2379
|
this.resultCode = data.resultCode as Enums.ResultCode;
|
|
2064
2380
|
}
|
|
2065
2381
|
this.messages = this.messages ?? [];
|
|
2066
2382
|
if (data.messages && Array.isArray(data.messages)) {
|
|
2067
2383
|
this.messages.push(...data.messages);
|
|
2068
2384
|
}
|
|
2069
|
-
if (
|
|
2385
|
+
if (
|
|
2386
|
+
data.calculationElapsedTime !== undefined &&
|
|
2387
|
+
typeof data.calculationElapsedTime === "number"
|
|
2388
|
+
) {
|
|
2070
2389
|
this.calculationElapsedTime = data.calculationElapsedTime as number;
|
|
2071
2390
|
}
|
|
2072
|
-
if (
|
|
2391
|
+
if (
|
|
2392
|
+
data.operationId !== undefined &&
|
|
2393
|
+
typeof data.operationId === "string"
|
|
2394
|
+
) {
|
|
2073
2395
|
this.operationId = data.operationId as string;
|
|
2074
2396
|
}
|
|
2075
2397
|
}
|
|
@@ -2104,15 +2426,21 @@ export class SetMixingLayerHeightCalculationResponseSchema {
|
|
|
2104
2426
|
};
|
|
2105
2427
|
}
|
|
2106
2428
|
|
|
2107
|
-
validate(
|
|
2429
|
+
validate(
|
|
2430
|
+
data: SetMixingLayerHeightCalculationResponseSchemaData
|
|
2431
|
+
): SetMixingLayerHeightCalculationResponse {
|
|
2108
2432
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
2109
2433
|
if (error) {
|
|
2110
|
-
throw new Error(
|
|
2434
|
+
throw new Error(
|
|
2435
|
+
`Validation error: ${error.details.map((x) => x.message).join(", ")}`
|
|
2436
|
+
);
|
|
2111
2437
|
}
|
|
2112
2438
|
return this.makeCalculationResponse(value);
|
|
2113
2439
|
}
|
|
2114
2440
|
|
|
2115
|
-
makeCalculationResponse(
|
|
2441
|
+
makeCalculationResponse(
|
|
2442
|
+
data: SetMixingLayerHeightCalculationResponseSchemaData
|
|
2443
|
+
): SetMixingLayerHeightCalculationResponse {
|
|
2116
2444
|
return new SetMixingLayerHeightCalculationResponse(data);
|
|
2117
2445
|
}
|
|
2118
2446
|
}
|
|
@@ -2133,9 +2461,9 @@ class SetPhaseToReleaseForLeakScenarioCalculationRequest extends CalculationRequ
|
|
|
2133
2461
|
*
|
|
2134
2462
|
*/
|
|
2135
2463
|
constructor(data: {
|
|
2136
|
-
phaseToRelease: Enums.Phase
|
|
2137
|
-
releaseElevation: number
|
|
2138
|
-
vessel: Entities.Vessel
|
|
2464
|
+
phaseToRelease: Enums.Phase;
|
|
2465
|
+
releaseElevation: number;
|
|
2466
|
+
vessel: Entities.Vessel;
|
|
2139
2467
|
}) {
|
|
2140
2468
|
super();
|
|
2141
2469
|
this.phaseToRelease = data.phaseToRelease;
|
|
@@ -2165,15 +2493,21 @@ export class SetPhaseToReleaseForLeakScenarioCalculationRequestSchema {
|
|
|
2165
2493
|
};
|
|
2166
2494
|
}
|
|
2167
2495
|
|
|
2168
|
-
validate(
|
|
2496
|
+
validate(
|
|
2497
|
+
data: SetPhaseToReleaseForLeakScenarioCalculationRequestSchemaData
|
|
2498
|
+
): SetPhaseToReleaseForLeakScenarioCalculationRequest {
|
|
2169
2499
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
2170
2500
|
if (error) {
|
|
2171
|
-
throw new Error(
|
|
2501
|
+
throw new Error(
|
|
2502
|
+
`Validation error: ${error.details.map((x) => x.message).join(", ")}`
|
|
2503
|
+
);
|
|
2172
2504
|
}
|
|
2173
2505
|
return this.makeCalculationRequest(value);
|
|
2174
2506
|
}
|
|
2175
2507
|
|
|
2176
|
-
makeCalculationRequest(
|
|
2508
|
+
makeCalculationRequest(
|
|
2509
|
+
data: SetPhaseToReleaseForLeakScenarioCalculationRequestSchemaData
|
|
2510
|
+
): SetPhaseToReleaseForLeakScenarioCalculationRequest {
|
|
2177
2511
|
return new SetPhaseToReleaseForLeakScenarioCalculationRequest(data);
|
|
2178
2512
|
}
|
|
2179
2513
|
}
|
|
@@ -2190,9 +2524,9 @@ export class SetPhaseToReleaseForLeakScenarioCalculation extends CalculationBase
|
|
|
2190
2524
|
*
|
|
2191
2525
|
*/
|
|
2192
2526
|
constructor(data: {
|
|
2193
|
-
phaseToRelease: Enums.Phase
|
|
2194
|
-
releaseElevation: number
|
|
2195
|
-
vessel: Entities.Vessel
|
|
2527
|
+
phaseToRelease: Enums.Phase;
|
|
2528
|
+
releaseElevation: number;
|
|
2529
|
+
vessel: Entities.Vessel;
|
|
2196
2530
|
controller?: AbortController;
|
|
2197
2531
|
}) {
|
|
2198
2532
|
super(data.controller);
|
|
@@ -2206,10 +2540,11 @@ export class SetPhaseToReleaseForLeakScenarioCalculation extends CalculationBase
|
|
|
2206
2540
|
const request = new SetPhaseToReleaseForLeakScenarioCalculationRequest({
|
|
2207
2541
|
phaseToRelease: this.phaseToRelease,
|
|
2208
2542
|
releaseElevation: this.releaseElevation,
|
|
2209
|
-
vessel: this.vessel
|
|
2543
|
+
vessel: this.vessel,
|
|
2210
2544
|
});
|
|
2211
2545
|
|
|
2212
|
-
const schema =
|
|
2546
|
+
const schema =
|
|
2547
|
+
new SetPhaseToReleaseForLeakScenarioCalculationRequestSchema();
|
|
2213
2548
|
const validatedRequest = schema.validate(request);
|
|
2214
2549
|
|
|
2215
2550
|
const requestJson = JSON.stringify(validatedRequest);
|
|
@@ -2219,14 +2554,16 @@ export class SetPhaseToReleaseForLeakScenarioCalculation extends CalculationBase
|
|
|
2219
2554
|
|
|
2220
2555
|
const { data } = await this.postRequest(url, requestJson);
|
|
2221
2556
|
|
|
2222
|
-
const responseSchema =
|
|
2557
|
+
const responseSchema =
|
|
2558
|
+
new SetPhaseToReleaseForLeakScenarioCalculationResponseSchema();
|
|
2223
2559
|
const validatedResponse = responseSchema.validate(data);
|
|
2224
2560
|
|
|
2225
2561
|
this.resultCode = validatedResponse.resultCode;
|
|
2226
2562
|
if (this.resultCode === Enums.ResultCode.SUCCESS) {
|
|
2227
2563
|
Object.assign(this, {
|
|
2228
2564
|
zCoordUpdated: validatedResponse.zCoordUpdated,
|
|
2229
|
-
holeHeightFractionUpdated:
|
|
2565
|
+
holeHeightFractionUpdated:
|
|
2566
|
+
validatedResponse.holeHeightFractionUpdated,
|
|
2230
2567
|
resultCode: validatedResponse.resultCode,
|
|
2231
2568
|
messages: validatedResponse.messages ?? [],
|
|
2232
2569
|
calculationElapsedTime: validatedResponse.calculationElapsedTime,
|
|
@@ -2251,12 +2588,26 @@ export class SetPhaseToReleaseForLeakScenarioCalculation extends CalculationBase
|
|
|
2251
2588
|
const parts = ["* SetPhaseToReleaseForLeakScenario"];
|
|
2252
2589
|
|
|
2253
2590
|
parts.push(`zCoordUpdated: ${String(this.zCoordUpdated)}`);
|
|
2254
|
-
parts.push(
|
|
2591
|
+
parts.push(
|
|
2592
|
+
`holeHeightFractionUpdated: ${String(this.holeHeightFractionUpdated)}`
|
|
2593
|
+
);
|
|
2255
2594
|
parts.push(`resultCode: ${String(this.resultCode)}`);
|
|
2256
2595
|
parts.push("*** messages:");
|
|
2257
|
-
parts.push(
|
|
2258
|
-
|
|
2259
|
-
|
|
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
|
+
);
|
|
2260
2611
|
|
|
2261
2612
|
return parts.join("\n");
|
|
2262
2613
|
}
|
|
@@ -2271,12 +2622,12 @@ export class SetPhaseToReleaseForLeakScenarioCalculationResponse extends Calcula
|
|
|
2271
2622
|
*
|
|
2272
2623
|
*/
|
|
2273
2624
|
constructor(data: {
|
|
2274
|
-
zCoordUpdated: number
|
|
2275
|
-
holeHeightFractionUpdated: number
|
|
2276
|
-
resultCode: Enums.ResultCode
|
|
2277
|
-
messages: string[]
|
|
2278
|
-
calculationElapsedTime: number
|
|
2279
|
-
operationId: string
|
|
2625
|
+
zCoordUpdated: number;
|
|
2626
|
+
holeHeightFractionUpdated: number;
|
|
2627
|
+
resultCode: Enums.ResultCode;
|
|
2628
|
+
messages: string[];
|
|
2629
|
+
calculationElapsedTime: number;
|
|
2630
|
+
operationId: string;
|
|
2280
2631
|
}) {
|
|
2281
2632
|
super();
|
|
2282
2633
|
this.zCoordUpdated = data.zCoordUpdated;
|
|
@@ -2288,23 +2639,39 @@ export class SetPhaseToReleaseForLeakScenarioCalculationResponse extends Calcula
|
|
|
2288
2639
|
}
|
|
2289
2640
|
|
|
2290
2641
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
2291
|
-
if (
|
|
2642
|
+
if (
|
|
2643
|
+
data.zCoordUpdated !== undefined &&
|
|
2644
|
+
typeof data.zCoordUpdated === "number"
|
|
2645
|
+
) {
|
|
2292
2646
|
this.zCoordUpdated = data.zCoordUpdated as number;
|
|
2293
2647
|
}
|
|
2294
|
-
if (
|
|
2648
|
+
if (
|
|
2649
|
+
data.holeHeightFractionUpdated !== undefined &&
|
|
2650
|
+
typeof data.holeHeightFractionUpdated === "number"
|
|
2651
|
+
) {
|
|
2295
2652
|
this.holeHeightFractionUpdated = data.holeHeightFractionUpdated as number;
|
|
2296
2653
|
}
|
|
2297
|
-
if (
|
|
2654
|
+
if (
|
|
2655
|
+
data.resultCode !== undefined &&
|
|
2656
|
+
(typeof data.resultCode === "string" ||
|
|
2657
|
+
typeof data.resultCode === "number")
|
|
2658
|
+
) {
|
|
2298
2659
|
this.resultCode = data.resultCode as Enums.ResultCode;
|
|
2299
2660
|
}
|
|
2300
2661
|
this.messages = this.messages ?? [];
|
|
2301
2662
|
if (data.messages && Array.isArray(data.messages)) {
|
|
2302
2663
|
this.messages.push(...data.messages);
|
|
2303
2664
|
}
|
|
2304
|
-
if (
|
|
2665
|
+
if (
|
|
2666
|
+
data.calculationElapsedTime !== undefined &&
|
|
2667
|
+
typeof data.calculationElapsedTime === "number"
|
|
2668
|
+
) {
|
|
2305
2669
|
this.calculationElapsedTime = data.calculationElapsedTime as number;
|
|
2306
2670
|
}
|
|
2307
|
-
if (
|
|
2671
|
+
if (
|
|
2672
|
+
data.operationId !== undefined &&
|
|
2673
|
+
typeof data.operationId === "string"
|
|
2674
|
+
) {
|
|
2308
2675
|
this.operationId = data.operationId as string;
|
|
2309
2676
|
}
|
|
2310
2677
|
}
|
|
@@ -2342,15 +2709,21 @@ export class SetPhaseToReleaseForLeakScenarioCalculationResponseSchema {
|
|
|
2342
2709
|
};
|
|
2343
2710
|
}
|
|
2344
2711
|
|
|
2345
|
-
validate(
|
|
2712
|
+
validate(
|
|
2713
|
+
data: SetPhaseToReleaseForLeakScenarioCalculationResponseSchemaData
|
|
2714
|
+
): SetPhaseToReleaseForLeakScenarioCalculationResponse {
|
|
2346
2715
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
2347
2716
|
if (error) {
|
|
2348
|
-
throw new Error(
|
|
2717
|
+
throw new Error(
|
|
2718
|
+
`Validation error: ${error.details.map((x) => x.message).join(", ")}`
|
|
2719
|
+
);
|
|
2349
2720
|
}
|
|
2350
2721
|
return this.makeCalculationResponse(value);
|
|
2351
2722
|
}
|
|
2352
2723
|
|
|
2353
|
-
makeCalculationResponse(
|
|
2724
|
+
makeCalculationResponse(
|
|
2725
|
+
data: SetPhaseToReleaseForLeakScenarioCalculationResponseSchemaData
|
|
2726
|
+
): SetPhaseToReleaseForLeakScenarioCalculationResponse {
|
|
2354
2727
|
return new SetPhaseToReleaseForLeakScenarioCalculationResponse(data);
|
|
2355
2728
|
}
|
|
2356
2729
|
}
|
|
@@ -2371,9 +2744,9 @@ class SetPhaseToReleaseForLineRuptureScenarioCalculationRequest extends Calculat
|
|
|
2371
2744
|
*
|
|
2372
2745
|
*/
|
|
2373
2746
|
constructor(data: {
|
|
2374
|
-
phaseToRelease: Enums.Phase
|
|
2375
|
-
releaseElevation: number
|
|
2376
|
-
vessel: Entities.Vessel
|
|
2747
|
+
phaseToRelease: Enums.Phase;
|
|
2748
|
+
releaseElevation: number;
|
|
2749
|
+
vessel: Entities.Vessel;
|
|
2377
2750
|
}) {
|
|
2378
2751
|
super();
|
|
2379
2752
|
this.phaseToRelease = data.phaseToRelease;
|
|
@@ -2403,15 +2776,21 @@ export class SetPhaseToReleaseForLineRuptureScenarioCalculationRequestSchema {
|
|
|
2403
2776
|
};
|
|
2404
2777
|
}
|
|
2405
2778
|
|
|
2406
|
-
validate(
|
|
2779
|
+
validate(
|
|
2780
|
+
data: SetPhaseToReleaseForLineRuptureScenarioCalculationRequestSchemaData
|
|
2781
|
+
): SetPhaseToReleaseForLineRuptureScenarioCalculationRequest {
|
|
2407
2782
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
2408
2783
|
if (error) {
|
|
2409
|
-
throw new Error(
|
|
2784
|
+
throw new Error(
|
|
2785
|
+
`Validation error: ${error.details.map((x) => x.message).join(", ")}`
|
|
2786
|
+
);
|
|
2410
2787
|
}
|
|
2411
2788
|
return this.makeCalculationRequest(value);
|
|
2412
2789
|
}
|
|
2413
2790
|
|
|
2414
|
-
makeCalculationRequest(
|
|
2791
|
+
makeCalculationRequest(
|
|
2792
|
+
data: SetPhaseToReleaseForLineRuptureScenarioCalculationRequestSchemaData
|
|
2793
|
+
): SetPhaseToReleaseForLineRuptureScenarioCalculationRequest {
|
|
2415
2794
|
return new SetPhaseToReleaseForLineRuptureScenarioCalculationRequest(data);
|
|
2416
2795
|
}
|
|
2417
2796
|
}
|
|
@@ -2428,9 +2807,9 @@ export class SetPhaseToReleaseForLineRuptureScenarioCalculation extends Calculat
|
|
|
2428
2807
|
*
|
|
2429
2808
|
*/
|
|
2430
2809
|
constructor(data: {
|
|
2431
|
-
phaseToRelease: Enums.Phase
|
|
2432
|
-
releaseElevation: number
|
|
2433
|
-
vessel: Entities.Vessel
|
|
2810
|
+
phaseToRelease: Enums.Phase;
|
|
2811
|
+
releaseElevation: number;
|
|
2812
|
+
vessel: Entities.Vessel;
|
|
2434
2813
|
controller?: AbortController;
|
|
2435
2814
|
}) {
|
|
2436
2815
|
super(data.controller);
|
|
@@ -2441,13 +2820,15 @@ export class SetPhaseToReleaseForLineRuptureScenarioCalculation extends Calculat
|
|
|
2441
2820
|
|
|
2442
2821
|
async run() {
|
|
2443
2822
|
try {
|
|
2444
|
-
const request =
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2823
|
+
const request =
|
|
2824
|
+
new SetPhaseToReleaseForLineRuptureScenarioCalculationRequest({
|
|
2825
|
+
phaseToRelease: this.phaseToRelease,
|
|
2826
|
+
releaseElevation: this.releaseElevation,
|
|
2827
|
+
vessel: this.vessel,
|
|
2828
|
+
});
|
|
2449
2829
|
|
|
2450
|
-
const schema =
|
|
2830
|
+
const schema =
|
|
2831
|
+
new SetPhaseToReleaseForLineRuptureScenarioCalculationRequestSchema();
|
|
2451
2832
|
const validatedRequest = schema.validate(request);
|
|
2452
2833
|
|
|
2453
2834
|
const requestJson = JSON.stringify(validatedRequest);
|
|
@@ -2457,14 +2838,16 @@ export class SetPhaseToReleaseForLineRuptureScenarioCalculation extends Calculat
|
|
|
2457
2838
|
|
|
2458
2839
|
const { data } = await this.postRequest(url, requestJson);
|
|
2459
2840
|
|
|
2460
|
-
const responseSchema =
|
|
2841
|
+
const responseSchema =
|
|
2842
|
+
new SetPhaseToReleaseForLineRuptureScenarioCalculationResponseSchema();
|
|
2461
2843
|
const validatedResponse = responseSchema.validate(data);
|
|
2462
2844
|
|
|
2463
2845
|
this.resultCode = validatedResponse.resultCode;
|
|
2464
2846
|
if (this.resultCode === Enums.ResultCode.SUCCESS) {
|
|
2465
2847
|
Object.assign(this, {
|
|
2466
2848
|
zCoordUpdated: validatedResponse.zCoordUpdated,
|
|
2467
|
-
pipeHeightFractionUpdated:
|
|
2849
|
+
pipeHeightFractionUpdated:
|
|
2850
|
+
validatedResponse.pipeHeightFractionUpdated,
|
|
2468
2851
|
resultCode: validatedResponse.resultCode,
|
|
2469
2852
|
messages: validatedResponse.messages ?? [],
|
|
2470
2853
|
calculationElapsedTime: validatedResponse.calculationElapsedTime,
|
|
@@ -2489,12 +2872,26 @@ export class SetPhaseToReleaseForLineRuptureScenarioCalculation extends Calculat
|
|
|
2489
2872
|
const parts = ["* SetPhaseToReleaseForLineRuptureScenario"];
|
|
2490
2873
|
|
|
2491
2874
|
parts.push(`zCoordUpdated: ${String(this.zCoordUpdated)}`);
|
|
2492
|
-
parts.push(
|
|
2875
|
+
parts.push(
|
|
2876
|
+
`pipeHeightFractionUpdated: ${String(this.pipeHeightFractionUpdated)}`
|
|
2877
|
+
);
|
|
2493
2878
|
parts.push(`resultCode: ${String(this.resultCode)}`);
|
|
2494
2879
|
parts.push("*** messages:");
|
|
2495
|
-
parts.push(
|
|
2496
|
-
|
|
2497
|
-
|
|
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
|
+
);
|
|
2498
2895
|
|
|
2499
2896
|
return parts.join("\n");
|
|
2500
2897
|
}
|
|
@@ -2509,12 +2906,12 @@ export class SetPhaseToReleaseForLineRuptureScenarioCalculationResponse extends
|
|
|
2509
2906
|
*
|
|
2510
2907
|
*/
|
|
2511
2908
|
constructor(data: {
|
|
2512
|
-
zCoordUpdated: number
|
|
2513
|
-
pipeHeightFractionUpdated: number
|
|
2514
|
-
resultCode: Enums.ResultCode
|
|
2515
|
-
messages: string[]
|
|
2516
|
-
calculationElapsedTime: number
|
|
2517
|
-
operationId: string
|
|
2909
|
+
zCoordUpdated: number;
|
|
2910
|
+
pipeHeightFractionUpdated: number;
|
|
2911
|
+
resultCode: Enums.ResultCode;
|
|
2912
|
+
messages: string[];
|
|
2913
|
+
calculationElapsedTime: number;
|
|
2914
|
+
operationId: string;
|
|
2518
2915
|
}) {
|
|
2519
2916
|
super();
|
|
2520
2917
|
this.zCoordUpdated = data.zCoordUpdated;
|
|
@@ -2526,23 +2923,39 @@ export class SetPhaseToReleaseForLineRuptureScenarioCalculationResponse extends
|
|
|
2526
2923
|
}
|
|
2527
2924
|
|
|
2528
2925
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
2529
|
-
if (
|
|
2926
|
+
if (
|
|
2927
|
+
data.zCoordUpdated !== undefined &&
|
|
2928
|
+
typeof data.zCoordUpdated === "number"
|
|
2929
|
+
) {
|
|
2530
2930
|
this.zCoordUpdated = data.zCoordUpdated as number;
|
|
2531
2931
|
}
|
|
2532
|
-
if (
|
|
2932
|
+
if (
|
|
2933
|
+
data.pipeHeightFractionUpdated !== undefined &&
|
|
2934
|
+
typeof data.pipeHeightFractionUpdated === "number"
|
|
2935
|
+
) {
|
|
2533
2936
|
this.pipeHeightFractionUpdated = data.pipeHeightFractionUpdated as number;
|
|
2534
2937
|
}
|
|
2535
|
-
if (
|
|
2938
|
+
if (
|
|
2939
|
+
data.resultCode !== undefined &&
|
|
2940
|
+
(typeof data.resultCode === "string" ||
|
|
2941
|
+
typeof data.resultCode === "number")
|
|
2942
|
+
) {
|
|
2536
2943
|
this.resultCode = data.resultCode as Enums.ResultCode;
|
|
2537
2944
|
}
|
|
2538
2945
|
this.messages = this.messages ?? [];
|
|
2539
2946
|
if (data.messages && Array.isArray(data.messages)) {
|
|
2540
2947
|
this.messages.push(...data.messages);
|
|
2541
2948
|
}
|
|
2542
|
-
if (
|
|
2949
|
+
if (
|
|
2950
|
+
data.calculationElapsedTime !== undefined &&
|
|
2951
|
+
typeof data.calculationElapsedTime === "number"
|
|
2952
|
+
) {
|
|
2543
2953
|
this.calculationElapsedTime = data.calculationElapsedTime as number;
|
|
2544
2954
|
}
|
|
2545
|
-
if (
|
|
2955
|
+
if (
|
|
2956
|
+
data.operationId !== undefined &&
|
|
2957
|
+
typeof data.operationId === "string"
|
|
2958
|
+
) {
|
|
2546
2959
|
this.operationId = data.operationId as string;
|
|
2547
2960
|
}
|
|
2548
2961
|
}
|
|
@@ -2580,15 +2993,21 @@ export class SetPhaseToReleaseForLineRuptureScenarioCalculationResponseSchema {
|
|
|
2580
2993
|
};
|
|
2581
2994
|
}
|
|
2582
2995
|
|
|
2583
|
-
validate(
|
|
2996
|
+
validate(
|
|
2997
|
+
data: SetPhaseToReleaseForLineRuptureScenarioCalculationResponseSchemaData
|
|
2998
|
+
): SetPhaseToReleaseForLineRuptureScenarioCalculationResponse {
|
|
2584
2999
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
2585
3000
|
if (error) {
|
|
2586
|
-
throw new Error(
|
|
3001
|
+
throw new Error(
|
|
3002
|
+
`Validation error: ${error.details.map((x) => x.message).join(", ")}`
|
|
3003
|
+
);
|
|
2587
3004
|
}
|
|
2588
3005
|
return this.makeCalculationResponse(value);
|
|
2589
3006
|
}
|
|
2590
3007
|
|
|
2591
|
-
makeCalculationResponse(
|
|
3008
|
+
makeCalculationResponse(
|
|
3009
|
+
data: SetPhaseToReleaseForLineRuptureScenarioCalculationResponseSchemaData
|
|
3010
|
+
): SetPhaseToReleaseForLineRuptureScenarioCalculationResponse {
|
|
2592
3011
|
return new SetPhaseToReleaseForLineRuptureScenarioCalculationResponse(data);
|
|
2593
3012
|
}
|
|
2594
3013
|
}
|
|
@@ -2609,9 +3028,9 @@ class SetPhaseToReleaseForReliefValveScenarioCalculationRequest extends Calculat
|
|
|
2609
3028
|
*
|
|
2610
3029
|
*/
|
|
2611
3030
|
constructor(data: {
|
|
2612
|
-
phaseToRelease: Enums.Phase
|
|
2613
|
-
releaseElevation: number
|
|
2614
|
-
vessel: Entities.Vessel
|
|
3031
|
+
phaseToRelease: Enums.Phase;
|
|
3032
|
+
releaseElevation: number;
|
|
3033
|
+
vessel: Entities.Vessel;
|
|
2615
3034
|
}) {
|
|
2616
3035
|
super();
|
|
2617
3036
|
this.phaseToRelease = data.phaseToRelease;
|
|
@@ -2641,15 +3060,21 @@ export class SetPhaseToReleaseForReliefValveScenarioCalculationRequestSchema {
|
|
|
2641
3060
|
};
|
|
2642
3061
|
}
|
|
2643
3062
|
|
|
2644
|
-
validate(
|
|
3063
|
+
validate(
|
|
3064
|
+
data: SetPhaseToReleaseForReliefValveScenarioCalculationRequestSchemaData
|
|
3065
|
+
): SetPhaseToReleaseForReliefValveScenarioCalculationRequest {
|
|
2645
3066
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
2646
3067
|
if (error) {
|
|
2647
|
-
throw new Error(
|
|
3068
|
+
throw new Error(
|
|
3069
|
+
`Validation error: ${error.details.map((x) => x.message).join(", ")}`
|
|
3070
|
+
);
|
|
2648
3071
|
}
|
|
2649
3072
|
return this.makeCalculationRequest(value);
|
|
2650
3073
|
}
|
|
2651
3074
|
|
|
2652
|
-
makeCalculationRequest(
|
|
3075
|
+
makeCalculationRequest(
|
|
3076
|
+
data: SetPhaseToReleaseForReliefValveScenarioCalculationRequestSchemaData
|
|
3077
|
+
): SetPhaseToReleaseForReliefValveScenarioCalculationRequest {
|
|
2653
3078
|
return new SetPhaseToReleaseForReliefValveScenarioCalculationRequest(data);
|
|
2654
3079
|
}
|
|
2655
3080
|
}
|
|
@@ -2666,9 +3091,9 @@ export class SetPhaseToReleaseForReliefValveScenarioCalculation extends Calculat
|
|
|
2666
3091
|
*
|
|
2667
3092
|
*/
|
|
2668
3093
|
constructor(data: {
|
|
2669
|
-
phaseToRelease: Enums.Phase
|
|
2670
|
-
releaseElevation: number
|
|
2671
|
-
vessel: Entities.Vessel
|
|
3094
|
+
phaseToRelease: Enums.Phase;
|
|
3095
|
+
releaseElevation: number;
|
|
3096
|
+
vessel: Entities.Vessel;
|
|
2672
3097
|
controller?: AbortController;
|
|
2673
3098
|
}) {
|
|
2674
3099
|
super(data.controller);
|
|
@@ -2679,13 +3104,15 @@ export class SetPhaseToReleaseForReliefValveScenarioCalculation extends Calculat
|
|
|
2679
3104
|
|
|
2680
3105
|
async run() {
|
|
2681
3106
|
try {
|
|
2682
|
-
const request =
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
3107
|
+
const request =
|
|
3108
|
+
new SetPhaseToReleaseForReliefValveScenarioCalculationRequest({
|
|
3109
|
+
phaseToRelease: this.phaseToRelease,
|
|
3110
|
+
releaseElevation: this.releaseElevation,
|
|
3111
|
+
vessel: this.vessel,
|
|
3112
|
+
});
|
|
2687
3113
|
|
|
2688
|
-
const schema =
|
|
3114
|
+
const schema =
|
|
3115
|
+
new SetPhaseToReleaseForReliefValveScenarioCalculationRequestSchema();
|
|
2689
3116
|
const validatedRequest = schema.validate(request);
|
|
2690
3117
|
|
|
2691
3118
|
const requestJson = JSON.stringify(validatedRequest);
|
|
@@ -2695,14 +3122,16 @@ export class SetPhaseToReleaseForReliefValveScenarioCalculation extends Calculat
|
|
|
2695
3122
|
|
|
2696
3123
|
const { data } = await this.postRequest(url, requestJson);
|
|
2697
3124
|
|
|
2698
|
-
const responseSchema =
|
|
3125
|
+
const responseSchema =
|
|
3126
|
+
new SetPhaseToReleaseForReliefValveScenarioCalculationResponseSchema();
|
|
2699
3127
|
const validatedResponse = responseSchema.validate(data);
|
|
2700
3128
|
|
|
2701
3129
|
this.resultCode = validatedResponse.resultCode;
|
|
2702
3130
|
if (this.resultCode === Enums.ResultCode.SUCCESS) {
|
|
2703
3131
|
Object.assign(this, {
|
|
2704
3132
|
zCoordUpdated: validatedResponse.zCoordUpdated,
|
|
2705
|
-
pipeHeightFractionUpdated:
|
|
3133
|
+
pipeHeightFractionUpdated:
|
|
3134
|
+
validatedResponse.pipeHeightFractionUpdated,
|
|
2706
3135
|
resultCode: validatedResponse.resultCode,
|
|
2707
3136
|
messages: validatedResponse.messages ?? [],
|
|
2708
3137
|
calculationElapsedTime: validatedResponse.calculationElapsedTime,
|
|
@@ -2727,12 +3156,26 @@ export class SetPhaseToReleaseForReliefValveScenarioCalculation extends Calculat
|
|
|
2727
3156
|
const parts = ["* SetPhaseToReleaseForReliefValveScenario"];
|
|
2728
3157
|
|
|
2729
3158
|
parts.push(`zCoordUpdated: ${String(this.zCoordUpdated)}`);
|
|
2730
|
-
parts.push(
|
|
3159
|
+
parts.push(
|
|
3160
|
+
`pipeHeightFractionUpdated: ${String(this.pipeHeightFractionUpdated)}`
|
|
3161
|
+
);
|
|
2731
3162
|
parts.push(`resultCode: ${String(this.resultCode)}`);
|
|
2732
3163
|
parts.push("*** messages:");
|
|
2733
|
-
parts.push(
|
|
2734
|
-
|
|
2735
|
-
|
|
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
|
+
);
|
|
2736
3179
|
|
|
2737
3180
|
return parts.join("\n");
|
|
2738
3181
|
}
|
|
@@ -2747,12 +3190,12 @@ export class SetPhaseToReleaseForReliefValveScenarioCalculationResponse extends
|
|
|
2747
3190
|
*
|
|
2748
3191
|
*/
|
|
2749
3192
|
constructor(data: {
|
|
2750
|
-
zCoordUpdated: number
|
|
2751
|
-
pipeHeightFractionUpdated: number
|
|
2752
|
-
resultCode: Enums.ResultCode
|
|
2753
|
-
messages: string[]
|
|
2754
|
-
calculationElapsedTime: number
|
|
2755
|
-
operationId: string
|
|
3193
|
+
zCoordUpdated: number;
|
|
3194
|
+
pipeHeightFractionUpdated: number;
|
|
3195
|
+
resultCode: Enums.ResultCode;
|
|
3196
|
+
messages: string[];
|
|
3197
|
+
calculationElapsedTime: number;
|
|
3198
|
+
operationId: string;
|
|
2756
3199
|
}) {
|
|
2757
3200
|
super();
|
|
2758
3201
|
this.zCoordUpdated = data.zCoordUpdated;
|
|
@@ -2764,23 +3207,39 @@ export class SetPhaseToReleaseForReliefValveScenarioCalculationResponse extends
|
|
|
2764
3207
|
}
|
|
2765
3208
|
|
|
2766
3209
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
2767
|
-
if (
|
|
3210
|
+
if (
|
|
3211
|
+
data.zCoordUpdated !== undefined &&
|
|
3212
|
+
typeof data.zCoordUpdated === "number"
|
|
3213
|
+
) {
|
|
2768
3214
|
this.zCoordUpdated = data.zCoordUpdated as number;
|
|
2769
3215
|
}
|
|
2770
|
-
if (
|
|
3216
|
+
if (
|
|
3217
|
+
data.pipeHeightFractionUpdated !== undefined &&
|
|
3218
|
+
typeof data.pipeHeightFractionUpdated === "number"
|
|
3219
|
+
) {
|
|
2771
3220
|
this.pipeHeightFractionUpdated = data.pipeHeightFractionUpdated as number;
|
|
2772
3221
|
}
|
|
2773
|
-
if (
|
|
3222
|
+
if (
|
|
3223
|
+
data.resultCode !== undefined &&
|
|
3224
|
+
(typeof data.resultCode === "string" ||
|
|
3225
|
+
typeof data.resultCode === "number")
|
|
3226
|
+
) {
|
|
2774
3227
|
this.resultCode = data.resultCode as Enums.ResultCode;
|
|
2775
3228
|
}
|
|
2776
3229
|
this.messages = this.messages ?? [];
|
|
2777
3230
|
if (data.messages && Array.isArray(data.messages)) {
|
|
2778
3231
|
this.messages.push(...data.messages);
|
|
2779
3232
|
}
|
|
2780
|
-
if (
|
|
3233
|
+
if (
|
|
3234
|
+
data.calculationElapsedTime !== undefined &&
|
|
3235
|
+
typeof data.calculationElapsedTime === "number"
|
|
3236
|
+
) {
|
|
2781
3237
|
this.calculationElapsedTime = data.calculationElapsedTime as number;
|
|
2782
3238
|
}
|
|
2783
|
-
if (
|
|
3239
|
+
if (
|
|
3240
|
+
data.operationId !== undefined &&
|
|
3241
|
+
typeof data.operationId === "string"
|
|
3242
|
+
) {
|
|
2784
3243
|
this.operationId = data.operationId as string;
|
|
2785
3244
|
}
|
|
2786
3245
|
}
|
|
@@ -2818,15 +3277,21 @@ export class SetPhaseToReleaseForReliefValveScenarioCalculationResponseSchema {
|
|
|
2818
3277
|
};
|
|
2819
3278
|
}
|
|
2820
3279
|
|
|
2821
|
-
validate(
|
|
3280
|
+
validate(
|
|
3281
|
+
data: SetPhaseToReleaseForReliefValveScenarioCalculationResponseSchemaData
|
|
3282
|
+
): SetPhaseToReleaseForReliefValveScenarioCalculationResponse {
|
|
2822
3283
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
2823
3284
|
if (error) {
|
|
2824
|
-
throw new Error(
|
|
3285
|
+
throw new Error(
|
|
3286
|
+
`Validation error: ${error.details.map((x) => x.message).join(", ")}`
|
|
3287
|
+
);
|
|
2825
3288
|
}
|
|
2826
3289
|
return this.makeCalculationResponse(value);
|
|
2827
3290
|
}
|
|
2828
3291
|
|
|
2829
|
-
makeCalculationResponse(
|
|
3292
|
+
makeCalculationResponse(
|
|
3293
|
+
data: SetPhaseToReleaseForReliefValveScenarioCalculationResponseSchemaData
|
|
3294
|
+
): SetPhaseToReleaseForReliefValveScenarioCalculationResponse {
|
|
2830
3295
|
return new SetPhaseToReleaseForReliefValveScenarioCalculationResponse(data);
|
|
2831
3296
|
}
|
|
2832
3297
|
}
|
|
@@ -2847,9 +3312,9 @@ class SetReleaseElevationForScenarioCalculationRequest extends CalculationReques
|
|
|
2847
3312
|
*
|
|
2848
3313
|
*/
|
|
2849
3314
|
constructor(data: {
|
|
2850
|
-
releaseElevation: number
|
|
2851
|
-
releaseHeightFraction: number
|
|
2852
|
-
vessel: Entities.Vessel
|
|
3315
|
+
releaseElevation: number;
|
|
3316
|
+
releaseHeightFraction: number;
|
|
3317
|
+
vessel: Entities.Vessel;
|
|
2853
3318
|
}) {
|
|
2854
3319
|
super();
|
|
2855
3320
|
this.releaseElevation = data.releaseElevation;
|
|
@@ -2879,15 +3344,21 @@ export class SetReleaseElevationForScenarioCalculationRequestSchema {
|
|
|
2879
3344
|
};
|
|
2880
3345
|
}
|
|
2881
3346
|
|
|
2882
|
-
validate(
|
|
3347
|
+
validate(
|
|
3348
|
+
data: SetReleaseElevationForScenarioCalculationRequestSchemaData
|
|
3349
|
+
): SetReleaseElevationForScenarioCalculationRequest {
|
|
2883
3350
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
2884
3351
|
if (error) {
|
|
2885
|
-
throw new Error(
|
|
3352
|
+
throw new Error(
|
|
3353
|
+
`Validation error: ${error.details.map((x) => x.message).join(", ")}`
|
|
3354
|
+
);
|
|
2886
3355
|
}
|
|
2887
3356
|
return this.makeCalculationRequest(value);
|
|
2888
3357
|
}
|
|
2889
3358
|
|
|
2890
|
-
makeCalculationRequest(
|
|
3359
|
+
makeCalculationRequest(
|
|
3360
|
+
data: SetReleaseElevationForScenarioCalculationRequestSchemaData
|
|
3361
|
+
): SetReleaseElevationForScenarioCalculationRequest {
|
|
2891
3362
|
return new SetReleaseElevationForScenarioCalculationRequest(data);
|
|
2892
3363
|
}
|
|
2893
3364
|
}
|
|
@@ -2903,9 +3374,9 @@ export class SetReleaseElevationForScenarioCalculation extends CalculationBase {
|
|
|
2903
3374
|
*
|
|
2904
3375
|
*/
|
|
2905
3376
|
constructor(data: {
|
|
2906
|
-
releaseElevation: number
|
|
2907
|
-
releaseHeightFraction: number
|
|
2908
|
-
vessel: Entities.Vessel
|
|
3377
|
+
releaseElevation: number;
|
|
3378
|
+
releaseHeightFraction: number;
|
|
3379
|
+
vessel: Entities.Vessel;
|
|
2909
3380
|
controller?: AbortController;
|
|
2910
3381
|
}) {
|
|
2911
3382
|
super(data.controller);
|
|
@@ -2919,10 +3390,11 @@ export class SetReleaseElevationForScenarioCalculation extends CalculationBase {
|
|
|
2919
3390
|
const request = new SetReleaseElevationForScenarioCalculationRequest({
|
|
2920
3391
|
releaseElevation: this.releaseElevation,
|
|
2921
3392
|
releaseHeightFraction: this.releaseHeightFraction,
|
|
2922
|
-
vessel: this.vessel
|
|
3393
|
+
vessel: this.vessel,
|
|
2923
3394
|
});
|
|
2924
3395
|
|
|
2925
|
-
const schema =
|
|
3396
|
+
const schema =
|
|
3397
|
+
new SetReleaseElevationForScenarioCalculationRequestSchema();
|
|
2926
3398
|
const validatedRequest = schema.validate(request);
|
|
2927
3399
|
|
|
2928
3400
|
const requestJson = JSON.stringify(validatedRequest);
|
|
@@ -2932,7 +3404,8 @@ export class SetReleaseElevationForScenarioCalculation extends CalculationBase {
|
|
|
2932
3404
|
|
|
2933
3405
|
const { data } = await this.postRequest(url, requestJson);
|
|
2934
3406
|
|
|
2935
|
-
const responseSchema =
|
|
3407
|
+
const responseSchema =
|
|
3408
|
+
new SetReleaseElevationForScenarioCalculationResponseSchema();
|
|
2936
3409
|
const validatedResponse = responseSchema.validate(data);
|
|
2937
3410
|
|
|
2938
3411
|
this.resultCode = validatedResponse.resultCode;
|
|
@@ -2965,9 +3438,21 @@ export class SetReleaseElevationForScenarioCalculation extends CalculationBase {
|
|
|
2965
3438
|
parts.push(`updatedVessel: ${String(this.updatedVessel)}`);
|
|
2966
3439
|
parts.push(`resultCode: ${String(this.resultCode)}`);
|
|
2967
3440
|
parts.push("*** messages:");
|
|
2968
|
-
parts.push(
|
|
2969
|
-
|
|
2970
|
-
|
|
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
|
+
);
|
|
2971
3456
|
|
|
2972
3457
|
return parts.join("\n");
|
|
2973
3458
|
}
|
|
@@ -2981,11 +3466,11 @@ export class SetReleaseElevationForScenarioCalculationResponse extends Calculati
|
|
|
2981
3466
|
*
|
|
2982
3467
|
*/
|
|
2983
3468
|
constructor(data: {
|
|
2984
|
-
updatedVessel: Entities.Vessel
|
|
2985
|
-
resultCode: Enums.ResultCode
|
|
2986
|
-
messages: string[]
|
|
2987
|
-
calculationElapsedTime: number
|
|
2988
|
-
operationId: string
|
|
3469
|
+
updatedVessel: Entities.Vessel;
|
|
3470
|
+
resultCode: Enums.ResultCode;
|
|
3471
|
+
messages: string[];
|
|
3472
|
+
calculationElapsedTime: number;
|
|
3473
|
+
operationId: string;
|
|
2989
3474
|
}) {
|
|
2990
3475
|
super();
|
|
2991
3476
|
this.updatedVessel = data.updatedVessel;
|
|
@@ -2998,19 +3483,31 @@ export class SetReleaseElevationForScenarioCalculationResponse extends Calculati
|
|
|
2998
3483
|
initialiseFromDictionary(data: { [key: string]: unknown }) {
|
|
2999
3484
|
if (data.updatedVessel) {
|
|
3000
3485
|
this.updatedVessel = new Entities.Vessel();
|
|
3001
|
-
this.updatedVessel.initialiseFromDictionary(
|
|
3002
|
-
|
|
3003
|
-
|
|
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
|
+
) {
|
|
3004
3495
|
this.resultCode = data.resultCode as Enums.ResultCode;
|
|
3005
3496
|
}
|
|
3006
3497
|
this.messages = this.messages ?? [];
|
|
3007
3498
|
if (data.messages && Array.isArray(data.messages)) {
|
|
3008
3499
|
this.messages.push(...data.messages);
|
|
3009
3500
|
}
|
|
3010
|
-
if (
|
|
3501
|
+
if (
|
|
3502
|
+
data.calculationElapsedTime !== undefined &&
|
|
3503
|
+
typeof data.calculationElapsedTime === "number"
|
|
3504
|
+
) {
|
|
3011
3505
|
this.calculationElapsedTime = data.calculationElapsedTime as number;
|
|
3012
3506
|
}
|
|
3013
|
-
if (
|
|
3507
|
+
if (
|
|
3508
|
+
data.operationId !== undefined &&
|
|
3509
|
+
typeof data.operationId === "string"
|
|
3510
|
+
) {
|
|
3014
3511
|
this.operationId = data.operationId as string;
|
|
3015
3512
|
}
|
|
3016
3513
|
}
|
|
@@ -3045,15 +3542,21 @@ export class SetReleaseElevationForScenarioCalculationResponseSchema {
|
|
|
3045
3542
|
};
|
|
3046
3543
|
}
|
|
3047
3544
|
|
|
3048
|
-
validate(
|
|
3545
|
+
validate(
|
|
3546
|
+
data: SetReleaseElevationForScenarioCalculationResponseSchemaData
|
|
3547
|
+
): SetReleaseElevationForScenarioCalculationResponse {
|
|
3049
3548
|
const { error, value } = this.schema.validate(data, { abortEarly: false });
|
|
3050
3549
|
if (error) {
|
|
3051
|
-
throw new Error(
|
|
3550
|
+
throw new Error(
|
|
3551
|
+
`Validation error: ${error.details.map((x) => x.message).join(", ")}`
|
|
3552
|
+
);
|
|
3052
3553
|
}
|
|
3053
3554
|
return this.makeCalculationResponse(value);
|
|
3054
3555
|
}
|
|
3055
3556
|
|
|
3056
|
-
makeCalculationResponse(
|
|
3557
|
+
makeCalculationResponse(
|
|
3558
|
+
data: SetReleaseElevationForScenarioCalculationResponseSchemaData
|
|
3559
|
+
): SetReleaseElevationForScenarioCalculationResponse {
|
|
3057
3560
|
return new SetReleaseElevationForScenarioCalculationResponse(data);
|
|
3058
3561
|
}
|
|
3059
3562
|
}
|