@dnv-plant/typescriptpws 1.0.95 → 1.0.96

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,23 +1,23 @@
1
1
  /***********************************************************************
2
- * This file has been auto-generated by a code generation tool.
3
- *
4
- * DO NOT MODIFY THIS FILE
5
- * This file is maintained by DNV.
6
- * Editing it may lead to inconsistent results and limit DNV's ability to provide support.
7
- * Please contact DNV if you believe changes are required.
8
- *
9
- * Version: 1.0.95
10
- * Date/time: 19 Jan 2026 12:11:52
11
- * Template: templates/typescriptpws/calculations.razor.
12
- ***********************************************************************/
13
-
14
- import * as Enums from "../enums";
15
- import * as Entities from "../entities";
16
- import * as EntitySchemas from "../entity-schemas";
17
- import { getAnalyticsApiTarget, getClientAliasId } from "../utilities";
18
- import { CalculationRequestBase, CalculationBase, CalculationResponseBase } from "./calculationBase"
19
-
20
- import Joi from "joi";
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.96
10
+ * Date/time: 4 Apr 2026 08:17:52
11
+ * Template: templates/typescriptpws/calculations.razor.
12
+ ***********************************************************************/
13
+
14
+ import * as Enums from '../enums';
15
+ import * as Entities from '../entities';
16
+ import * as EntitySchemas from '../entity-schemas';
17
+ import { getAnalyticsApiTarget, getClientAliasId } from '../utilities';
18
+ import { CalculationRequestBase, CalculationBase, CalculationResponseBase } from './calculationBase';
19
+
20
+ import Joi from 'joi';
21
21
 
22
22
  export interface DispersionCalculationRequestSchemaData {
23
23
  material: Entities.Material;
@@ -45,14 +45,14 @@ class DispersionCalculationRequest extends CalculationRequestBase {
45
45
  *
46
46
  */
47
47
  constructor(data: {
48
- material: Entities.Material,
49
- substrate: Entities.Substrate,
50
- dischargeResult: Entities.DischargeResult,
51
- dischargeRecords: Entities.DischargeRecord[],
52
- dischargeRecordCount: number,
53
- weather: Entities.Weather,
54
- dispersionParameters: Entities.DispersionParameters,
55
- endPointConcentration: number
48
+ material: Entities.Material;
49
+ substrate: Entities.Substrate;
50
+ dischargeResult: Entities.DischargeResult;
51
+ dischargeRecords: Entities.DischargeRecord[];
52
+ dischargeRecordCount: number;
53
+ weather: Entities.Weather;
54
+ dispersionParameters: Entities.DispersionParameters;
55
+ endPointConcentration: number;
56
56
  }) {
57
57
  super();
58
58
  this.material = data.material;
@@ -86,21 +86,21 @@ export class DispersionCalculationRequestSchema {
86
86
  }).unknown(true);
87
87
 
88
88
  this.propertyTypes = {
89
- material: "Entities.Material",
90
- substrate: "Entities.Substrate",
91
- dischargeResult: "Entities.DischargeResult",
92
- dischargeRecords: "Entities.DischargeRecord[]",
93
- dischargeRecordCount: "number",
94
- weather: "Entities.Weather",
95
- dispersionParameters: "Entities.DispersionParameters",
96
- endPointConcentration: "number",
89
+ material: 'Entities.Material',
90
+ substrate: 'Entities.Substrate',
91
+ dischargeResult: 'Entities.DischargeResult',
92
+ dischargeRecords: 'Entities.DischargeRecord[]',
93
+ dischargeRecordCount: 'number',
94
+ weather: 'Entities.Weather',
95
+ dispersionParameters: 'Entities.DispersionParameters',
96
+ endPointConcentration: 'number',
97
97
  };
98
98
  }
99
99
 
100
100
  validate(data: DispersionCalculationRequestSchemaData): DispersionCalculationRequest {
101
101
  const { error, value } = this.schema.validate(data, { abortEarly: false });
102
102
  if (error) {
103
- throw new Error(`Validation error: ${error.details.map((x) => x.message).join(", ")}`);
103
+ throw new Error(`Validation error: ${error.details.map((x) => x.message).join(', ')}`);
104
104
  }
105
105
  return this.makeCalculationRequest(value);
106
106
  }
@@ -130,14 +130,14 @@ Time-varying scenarios with mixtures are not currently handled and will give an
130
130
  *
131
131
  */
132
132
  constructor(data: {
133
- material: Entities.Material,
134
- substrate: Entities.Substrate,
135
- dischargeResult: Entities.DischargeResult,
136
- dischargeRecords: Entities.DischargeRecord[],
137
- dischargeRecordCount: number,
138
- weather: Entities.Weather,
139
- dispersionParameters: Entities.DispersionParameters,
140
- endPointConcentration: number
133
+ material: Entities.Material;
134
+ substrate: Entities.Substrate;
135
+ dischargeResult: Entities.DischargeResult;
136
+ dischargeRecords: Entities.DischargeRecord[];
137
+ dischargeRecordCount: number;
138
+ weather: Entities.Weather;
139
+ dispersionParameters: Entities.DispersionParameters;
140
+ endPointConcentration: number;
141
141
  controller?: AbortController;
142
142
  }) {
143
143
  super(data.controller);
@@ -161,7 +161,7 @@ Time-varying scenarios with mixtures are not currently handled and will give an
161
161
  dischargeRecordCount: this.dischargeRecordCount,
162
162
  weather: this.weather,
163
163
  dispersionParameters: this.dispersionParameters,
164
- endPointConcentration: this.endPointConcentration
164
+ endPointConcentration: this.endPointConcentration,
165
165
  });
166
166
 
167
167
  const schema = new DispersionCalculationRequestSchema();
@@ -204,28 +204,24 @@ Time-varying scenarios with mixtures are not currently handled and will give an
204
204
  }
205
205
 
206
206
  toString() {
207
- const parts = ["* Dispersion"];
207
+ const parts = ['* Dispersion'];
208
208
 
209
209
  parts.push(`scalarUdmOutputs: ${String(this.scalarUdmOutputs)}`);
210
- parts.push("*** dispersionRecords:");
210
+ parts.push('*** dispersionRecords:');
211
211
  parts.push(
212
212
  this.dispersionRecords && this.dispersionRecords.length > 0
213
- ? this.dispersionRecords.map((point) => `dispersionRecordsElement: ${point}`).join("\n")
214
- : "dispersionRecords does not contain any elements"
215
- );
216
- parts.push("*** poolRecords:");
217
- parts.push(
218
- this.poolRecords && this.poolRecords.length > 0
219
- ? this.poolRecords.map((point) => `poolRecordsElement: ${point}`).join("\n")
220
- : "poolRecords does not contain any elements"
213
+ ? this.dispersionRecords.map((point) => `dispersionRecordsElement: ${point}`).join('\n')
214
+ : 'dispersionRecords does not contain any elements',
221
215
  );
216
+ parts.push('*** poolRecords:');
217
+ parts.push(this.poolRecords && this.poolRecords.length > 0 ? this.poolRecords.map((point) => `poolRecordsElement: ${point}`).join('\n') : 'poolRecords does not contain any elements');
222
218
  parts.push(`resultCode: ${String(this.resultCode)}`);
223
- parts.push("*** messages:");
224
- parts.push(`messages: ${this.messages !== undefined ? this.messages : "(None)"}`);
225
- parts.push(`calculationElapsedTime: ${this.calculationElapsedTime !== undefined ? this.calculationElapsedTime : "(None)"}`);
226
- parts.push(`operationId: ${this.operationId !== undefined ? this.operationId : "(None)"}`);
219
+ parts.push('*** messages:');
220
+ parts.push(`messages: ${this.messages !== undefined ? this.messages : '(None)'}`);
221
+ parts.push(`calculationElapsedTime: ${this.calculationElapsedTime !== undefined ? this.calculationElapsedTime : '(None)'}`);
222
+ parts.push(`operationId: ${this.operationId !== undefined ? this.operationId : '(None)'}`);
227
223
 
228
- return parts.join("\n");
224
+ return parts.join('\n');
229
225
  }
230
226
  }
231
227
 
@@ -239,13 +235,13 @@ export class DispersionCalculationResponse extends CalculationResponseBase {
239
235
  *
240
236
  */
241
237
  constructor(data: {
242
- scalarUdmOutputs: Entities.ScalarUdmOutputs,
243
- dispersionRecords: Entities.DispersionRecord[],
244
- poolRecords: Entities.PoolRecord[],
245
- resultCode: Enums.ResultCode,
246
- messages: string[],
247
- calculationElapsedTime: number,
248
- operationId: string
238
+ scalarUdmOutputs: Entities.ScalarUdmOutputs;
239
+ dispersionRecords: Entities.DispersionRecord[];
240
+ poolRecords: Entities.PoolRecord[];
241
+ resultCode: Enums.ResultCode;
242
+ messages: string[];
243
+ calculationElapsedTime: number;
244
+ operationId: string;
249
245
  }) {
250
246
  super();
251
247
  this.scalarUdmOutputs = data.scalarUdmOutputs;
@@ -263,34 +259,30 @@ export class DispersionCalculationResponse extends CalculationResponseBase {
263
259
  this.scalarUdmOutputs.initialiseFromDictionary(data.scalarUdmOutputs as { [key: string]: unknown });
264
260
  }
265
261
  if (data.dispersionRecords && Array.isArray(data.dispersionRecords)) {
266
- this.dispersionRecords = data.dispersionRecords.map(
267
- (item) => {
268
- const record = new Entities.DispersionRecord();
269
- record.initialiseFromDictionary(item);
270
- return record;
271
- }
272
- );
262
+ this.dispersionRecords = data.dispersionRecords.map((item) => {
263
+ const record = new Entities.DispersionRecord();
264
+ record.initialiseFromDictionary(item);
265
+ return record;
266
+ });
273
267
  }
274
268
  if (data.poolRecords && Array.isArray(data.poolRecords)) {
275
- this.poolRecords = data.poolRecords.map(
276
- (item) => {
277
- const record = new Entities.PoolRecord();
278
- record.initialiseFromDictionary(item);
279
- return record;
280
- }
281
- );
269
+ this.poolRecords = data.poolRecords.map((item) => {
270
+ const record = new Entities.PoolRecord();
271
+ record.initialiseFromDictionary(item);
272
+ return record;
273
+ });
282
274
  }
283
- if (data.resultCode !== undefined && (typeof data.resultCode === "string" || typeof data.resultCode === "number")) {
275
+ if (data.resultCode !== undefined && (typeof data.resultCode === 'string' || typeof data.resultCode === 'number')) {
284
276
  this.resultCode = data.resultCode as Enums.ResultCode;
285
277
  }
286
278
  this.messages = this.messages ?? [];
287
279
  if (data.messages && Array.isArray(data.messages)) {
288
280
  this.messages.push(...data.messages);
289
281
  }
290
- if (data.calculationElapsedTime !== undefined && typeof data.calculationElapsedTime === "number") {
282
+ if (data.calculationElapsedTime !== undefined && typeof data.calculationElapsedTime === 'number') {
291
283
  this.calculationElapsedTime = data.calculationElapsedTime as number;
292
284
  }
293
- if (data.operationId !== undefined && typeof data.operationId === "string") {
285
+ if (data.operationId !== undefined && typeof data.operationId === 'string') {
294
286
  this.operationId = data.operationId as string;
295
287
  }
296
288
  }
@@ -325,16 +317,16 @@ export class DispersionCalculationResponseSchema {
325
317
  }).unknown(true);
326
318
 
327
319
  this.propertyTypes = {
328
- scalarUdmOutputs: "Entities.ScalarUdmOutputs",
329
- dispersionRecords: "Entities.DispersionRecord[]",
330
- poolRecords: "Entities.PoolRecord[]",
320
+ scalarUdmOutputs: 'Entities.ScalarUdmOutputs',
321
+ dispersionRecords: 'Entities.DispersionRecord[]',
322
+ poolRecords: 'Entities.PoolRecord[]',
331
323
  };
332
324
  }
333
325
 
334
326
  validate(data: DispersionCalculationResponseSchemaData): DispersionCalculationResponse {
335
327
  const { error, value } = this.schema.validate(data, { abortEarly: false });
336
328
  if (error) {
337
- throw new Error(`Validation error: ${error.details.map((x) => x.message).join(", ")}`);
329
+ throw new Error(`Validation error: ${error.details.map((x) => x.message).join(', ')}`);
338
330
  }
339
331
  return this.makeCalculationResponse(value);
340
332
  }