@utiliread/primitives 1.0.0-144 → 1.0.0-146
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/dist/csv.d.ts +3 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/aggregate-id.ts +9 -9
- package/src/breakdown-rule.spec.ts +61 -61
- package/src/breakdown-rule.ts +58 -58
- package/src/csv.spec.ts +42 -34
- package/src/csv.ts +9 -9
- package/src/cursor-navigation-state.spec.ts +194 -194
- package/src/cursor-navigation-state.ts +168 -168
- package/src/index.ts +61 -61
- package/src/measure-id.ts +17 -17
- package/src/measures/duration.ts +11 -11
- package/src/measures/energy.ts +13 -13
- package/src/measures/humidity.ts +3 -3
- package/src/measures/infocode.ts +3 -3
- package/src/measures/mass-flow.ts +19 -19
- package/src/measures/mass.ts +10 -10
- package/src/measures/noise.ts +5 -5
- package/src/measures/power.ts +23 -23
- package/src/measures/pressure.ts +9 -9
- package/src/measures/reactive-energy.ts +7 -7
- package/src/measures/reactive-power.ts +3 -3
- package/src/measures/temperature.ts +9 -9
- package/src/measures/time.ts +3 -3
- package/src/measures/volume-flow.ts +25 -25
- package/src/measures/volume.ts +3 -3
- package/src/medium.spec.ts +12 -12
- package/src/medium.ts +47 -47
- package/src/number-formatter.spec.ts +549 -549
- package/src/number-formatter.ts +118 -118
- package/src/optional.ts +1 -1
- package/src/precision-number.spec.ts +251 -251
- package/src/precision-number.ts +123 -123
- package/src/register-convention.spec.ts +52 -52
- package/src/register-convention.ts +70 -70
- package/src/register-definition.ts +23 -23
- package/src/register-id.ts +288 -288
- package/src/register-library.spec.ts +41 -41
- package/src/register-library.ts +64 -64
- package/src/register-pack.ts +5 -5
- package/src/register-utils.ts +6 -6
- package/src/registers/acoustic-noise.ts +52 -52
- package/src/registers/ambient-temperature.ts +52 -52
- package/src/registers/axioma-infocode.ts +16 -16
- package/src/registers/consumer.ts +17 -17
- package/src/registers/cooling-energy-inlet.ts +23 -23
- package/src/registers/cooling-energy-outlet.ts +23 -23
- package/src/registers/cooling-energy.ts +23 -23
- package/src/registers/cooling.ts +113 -113
- package/src/registers/device-addresses-kamdraft.ts +14 -14
- package/src/registers/device-addresses-msisdn.ts +14 -14
- package/src/registers/device-addresses-tchlr.ts +14 -14
- package/src/registers/device-addresses-wmbus.ts +17 -17
- package/src/registers/device-date-time.ts +9 -9
- package/src/registers/device-date.ts +9 -9
- package/src/registers/device-nominal-diameter.ts +9 -9
- package/src/registers/device-permanent-volume-flow.ts +9 -9
- package/src/registers/device-registers.ts +9 -9
- package/src/registers/device-samples.ts +37 -37
- package/src/registers/device-software-version.ts +8 -8
- package/src/registers/device-time.ts +9 -9
- package/src/registers/device.ts +16 -16
- package/src/registers/diehl-infocode.ts +44 -44
- package/src/registers/electrical-energy.ts +23 -23
- package/src/registers/energy-inlet.ts +23 -23
- package/src/registers/energy-outlet.ts +23 -23
- package/src/registers/error-operating-time.ts +23 -23
- package/src/registers/flow-temperature-aux.ts +52 -52
- package/src/registers/flow-temperature-inlet.ts +52 -52
- package/src/registers/flow-temperature-outlet.ts +52 -52
- package/src/registers/flow-temperature.ts +52 -52
- package/src/registers/heat-energy-inlet.ts +65 -65
- package/src/registers/heat-energy-outlet.ts +65 -65
- package/src/registers/heat-energy.ts +65 -65
- package/src/registers/index.ts +71 -71
- package/src/registers/infocode.ts +70 -70
- package/src/registers/kamstrup-module-type.ts +8 -8
- package/src/registers/kamstrup-multical-infocode.ts +58 -58
- package/src/registers/landis-gyr-infocode.ts +23 -23
- package/src/registers/landis-gyr-mbus-status.ts +23 -23
- package/src/registers/mass-flow-inlet.ts +52 -52
- package/src/registers/mass-flow-outlet.ts +52 -52
- package/src/registers/mass-flow.ts +52 -52
- package/src/registers/mass-inlet.ts +23 -23
- package/src/registers/mass-outlet.ts +23 -23
- package/src/registers/mass.ts +23 -23
- package/src/registers/mbus-format-string-signature.ts +8 -8
- package/src/registers/none.ts +8 -8
- package/src/registers/operating-time.ts +23 -23
- package/src/registers/place.ts +31 -31
- package/src/registers/power-inlet.ts +52 -52
- package/src/registers/power-outlet.ts +52 -52
- package/src/registers/power.ts +52 -52
- package/src/registers/pressure-inlet.ts +52 -52
- package/src/registers/pressure-outlet.ts +52 -52
- package/src/registers/pressure.ts +52 -52
- package/src/registers/radiator-temperature.ts +52 -52
- package/src/registers/reactive-energy.ts +23 -23
- package/src/registers/relative-humidity.ts +8 -8
- package/src/registers/remaining-battery-time.ts +23 -23
- package/src/registers/time-last-exact-overhearing-arrived.ts +19 -19
- package/src/registers/time-last-installation-mounted.ts +19 -19
- package/src/registers/time-last-possible-candidate-overhearing-arrived.ts +21 -21
- package/src/registers/time-last-sampled.ts +19 -19
- package/src/registers/time.ts +45 -45
- package/src/registers/volume-flow-inlet.ts +52 -52
- package/src/registers/volume-flow-outlet.ts +52 -52
- package/src/registers/volume-flow.ts +52 -52
- package/src/registers/volume-inlet.ts +23 -23
- package/src/registers/volume-outlet.ts +23 -23
- package/src/registers/volume-pulse-input-a.ts +23 -23
- package/src/registers/volume-pulse-input-b.ts +23 -23
- package/src/registers/volume.ts +23 -23
- package/src/repository.spec.ts +30 -30
- package/src/repository.ts +26 -26
- package/src/step.spec.ts +37 -37
- package/src/step.ts +45 -45
- package/src/time-or-rule.ts +42 -42
- package/src/unit-id.ts +108 -108
package/src/measures/power.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import type { UnitId } from "../unit-id";
|
|
2
|
-
|
|
3
|
-
export const units: ReadonlyArray<UnitId> = [
|
|
4
|
-
"milliWatt",
|
|
5
|
-
"watt",
|
|
6
|
-
"kiloWatt",
|
|
7
|
-
"megaWatt",
|
|
8
|
-
"gigaWatt",
|
|
9
|
-
"joulesPerSecond",
|
|
10
|
-
"joulesPerMinute",
|
|
11
|
-
"joulesPerHour",
|
|
12
|
-
];
|
|
13
|
-
|
|
14
|
-
export const sqUnits: ReadonlyArray<UnitId> = [
|
|
15
|
-
"milliWatt2",
|
|
16
|
-
"watt2",
|
|
17
|
-
"kiloWatt2",
|
|
18
|
-
"megaWatt2",
|
|
19
|
-
"gigaWatt2",
|
|
20
|
-
"joulesPerSecond2",
|
|
21
|
-
"joulesPerMinute2",
|
|
22
|
-
"joulesPerHour2",
|
|
23
|
-
];
|
|
1
|
+
import type { UnitId } from "../unit-id";
|
|
2
|
+
|
|
3
|
+
export const units: ReadonlyArray<UnitId> = [
|
|
4
|
+
"milliWatt",
|
|
5
|
+
"watt",
|
|
6
|
+
"kiloWatt",
|
|
7
|
+
"megaWatt",
|
|
8
|
+
"gigaWatt",
|
|
9
|
+
"joulesPerSecond",
|
|
10
|
+
"joulesPerMinute",
|
|
11
|
+
"joulesPerHour",
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
export const sqUnits: ReadonlyArray<UnitId> = [
|
|
15
|
+
"milliWatt2",
|
|
16
|
+
"watt2",
|
|
17
|
+
"kiloWatt2",
|
|
18
|
+
"megaWatt2",
|
|
19
|
+
"gigaWatt2",
|
|
20
|
+
"joulesPerSecond2",
|
|
21
|
+
"joulesPerMinute2",
|
|
22
|
+
"joulesPerHour2",
|
|
23
|
+
];
|
package/src/measures/pressure.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { UnitId } from "../unit-id";
|
|
2
|
-
|
|
3
|
-
export const units: ReadonlyArray<UnitId> = ["bar", "pascal", "kiloPascal"];
|
|
4
|
-
|
|
5
|
-
export const sqUnits: ReadonlyArray<UnitId> = [
|
|
6
|
-
"bar2",
|
|
7
|
-
"pascal2",
|
|
8
|
-
"kiloPascal2",
|
|
9
|
-
];
|
|
1
|
+
import type { UnitId } from "../unit-id";
|
|
2
|
+
|
|
3
|
+
export const units: ReadonlyArray<UnitId> = ["bar", "pascal", "kiloPascal"];
|
|
4
|
+
|
|
5
|
+
export const sqUnits: ReadonlyArray<UnitId> = [
|
|
6
|
+
"bar2",
|
|
7
|
+
"pascal2",
|
|
8
|
+
"kiloPascal2",
|
|
9
|
+
];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { UnitId } from "../unit-id";
|
|
2
|
-
|
|
3
|
-
export const units: ReadonlyArray<UnitId> = [
|
|
4
|
-
"varHour",
|
|
5
|
-
"kiloVarHour",
|
|
6
|
-
"megaVarHour",
|
|
7
|
-
];
|
|
1
|
+
import type { UnitId } from "../unit-id";
|
|
2
|
+
|
|
3
|
+
export const units: ReadonlyArray<UnitId> = [
|
|
4
|
+
"varHour",
|
|
5
|
+
"kiloVarHour",
|
|
6
|
+
"megaVarHour",
|
|
7
|
+
];
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { UnitId } from "../unit-id";
|
|
2
|
-
|
|
3
|
-
export const units: ReadonlyArray<UnitId> = ["var", "kiloVar", "megaVar"];
|
|
1
|
+
import type { UnitId } from "../unit-id";
|
|
2
|
+
|
|
3
|
+
export const units: ReadonlyArray<UnitId> = ["var", "kiloVar", "megaVar"];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { UnitId } from "../unit-id";
|
|
2
|
-
|
|
3
|
-
export const units: ReadonlyArray<UnitId> = ["celcius", "kelvin", "fahrenheit"];
|
|
4
|
-
|
|
5
|
-
export const sqUnits: ReadonlyArray<UnitId> = [
|
|
6
|
-
"celcius2",
|
|
7
|
-
"kelvin2",
|
|
8
|
-
"fahrenheit2",
|
|
9
|
-
];
|
|
1
|
+
import type { UnitId } from "../unit-id";
|
|
2
|
+
|
|
3
|
+
export const units: ReadonlyArray<UnitId> = ["celcius", "kelvin", "fahrenheit"];
|
|
4
|
+
|
|
5
|
+
export const sqUnits: ReadonlyArray<UnitId> = [
|
|
6
|
+
"celcius2",
|
|
7
|
+
"kelvin2",
|
|
8
|
+
"fahrenheit2",
|
|
9
|
+
];
|
package/src/measures/time.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { UnitId } from "../unit-id";
|
|
2
|
-
|
|
3
|
-
export const units: ReadonlyArray<UnitId> = [];
|
|
1
|
+
import type { UnitId } from "../unit-id";
|
|
2
|
+
|
|
3
|
+
export const units: ReadonlyArray<UnitId> = [];
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import type { UnitId } from "../unit-id";
|
|
2
|
-
|
|
3
|
-
export const units: ReadonlyArray<UnitId> = [
|
|
4
|
-
"litersPerSecond",
|
|
5
|
-
"litersPerMinute",
|
|
6
|
-
"litersPerHour",
|
|
7
|
-
"cubicMetersPerSecond",
|
|
8
|
-
"cubicMetersPerMinute",
|
|
9
|
-
"cubicMetersPerHour",
|
|
10
|
-
"gallonsPerSecond",
|
|
11
|
-
"gallonsPerMinute",
|
|
12
|
-
"gallonsPerHour",
|
|
13
|
-
];
|
|
14
|
-
|
|
15
|
-
export const sqUnits: ReadonlyArray<UnitId> = [
|
|
16
|
-
"litersPerSecond2",
|
|
17
|
-
"litersPerMinute2",
|
|
18
|
-
"litersPerHour2",
|
|
19
|
-
"cubicMetersPerSecond2",
|
|
20
|
-
"cubicMetersPerMinute2",
|
|
21
|
-
"cubicMetersPerHour2",
|
|
22
|
-
"gallonsPerSecond2",
|
|
23
|
-
"gallonsPerMinute2",
|
|
24
|
-
"gallonsPerHour2",
|
|
25
|
-
];
|
|
1
|
+
import type { UnitId } from "../unit-id";
|
|
2
|
+
|
|
3
|
+
export const units: ReadonlyArray<UnitId> = [
|
|
4
|
+
"litersPerSecond",
|
|
5
|
+
"litersPerMinute",
|
|
6
|
+
"litersPerHour",
|
|
7
|
+
"cubicMetersPerSecond",
|
|
8
|
+
"cubicMetersPerMinute",
|
|
9
|
+
"cubicMetersPerHour",
|
|
10
|
+
"gallonsPerSecond",
|
|
11
|
+
"gallonsPerMinute",
|
|
12
|
+
"gallonsPerHour",
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
export const sqUnits: ReadonlyArray<UnitId> = [
|
|
16
|
+
"litersPerSecond2",
|
|
17
|
+
"litersPerMinute2",
|
|
18
|
+
"litersPerHour2",
|
|
19
|
+
"cubicMetersPerSecond2",
|
|
20
|
+
"cubicMetersPerMinute2",
|
|
21
|
+
"cubicMetersPerHour2",
|
|
22
|
+
"gallonsPerSecond2",
|
|
23
|
+
"gallonsPerMinute2",
|
|
24
|
+
"gallonsPerHour2",
|
|
25
|
+
];
|
package/src/measures/volume.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { UnitId } from "../unit-id";
|
|
2
|
-
|
|
3
|
-
export const units: ReadonlyArray<UnitId> = ["liter", "cubicMeter", "gallon"];
|
|
1
|
+
import type { UnitId } from "../unit-id";
|
|
2
|
+
|
|
3
|
+
export const units: ReadonlyArray<UnitId> = ["liter", "cubicMeter", "gallon"];
|
package/src/medium.spec.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Medium } from "./medium";
|
|
2
|
-
import { expect } from "chai";
|
|
3
|
-
|
|
4
|
-
describe("isMedium", () => {
|
|
5
|
-
it("should correctly determine if input is a medium", () => {
|
|
6
|
-
expect(Medium.isMedium("heat")).to.equal(true);
|
|
7
|
-
expect(Medium.isMedium("water")).to.equal(true);
|
|
8
|
-
expect(Medium.isMedium(["heat", "water"])).to.equal(true);
|
|
9
|
-
expect(Medium.isMedium("heat,water")).to.equal(false);
|
|
10
|
-
expect(Medium.isMedium("notamedium")).to.equal(false);
|
|
11
|
-
});
|
|
12
|
-
});
|
|
1
|
+
import { Medium } from "./medium";
|
|
2
|
+
import { expect } from "chai";
|
|
3
|
+
|
|
4
|
+
describe("isMedium", () => {
|
|
5
|
+
it("should correctly determine if input is a medium", () => {
|
|
6
|
+
expect(Medium.isMedium("heat")).to.equal(true);
|
|
7
|
+
expect(Medium.isMedium("water")).to.equal(true);
|
|
8
|
+
expect(Medium.isMedium(["heat", "water"])).to.equal(true);
|
|
9
|
+
expect(Medium.isMedium("heat,water")).to.equal(false);
|
|
10
|
+
expect(Medium.isMedium("notamedium")).to.equal(false);
|
|
11
|
+
});
|
|
12
|
+
});
|
package/src/medium.ts
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
export type Medium =
|
|
2
|
-
| "none"
|
|
3
|
-
| "heat"
|
|
4
|
-
| "water"
|
|
5
|
-
| "cooling"
|
|
6
|
-
| "electricity"
|
|
7
|
-
| "infrastructure"
|
|
8
|
-
| "all";
|
|
9
|
-
|
|
10
|
-
export namespace Medium {
|
|
11
|
-
export function isMedium(input: string): input is Medium;
|
|
12
|
-
export function isMedium(input: string[]): input is Medium[];
|
|
13
|
-
export function isMedium(
|
|
14
|
-
input: string | string[],
|
|
15
|
-
): input is Medium | Medium[] {
|
|
16
|
-
if (input === "none" || input === "all") {
|
|
17
|
-
return true;
|
|
18
|
-
}
|
|
19
|
-
const ALL_MEDIUMS: Medium[] = [
|
|
20
|
-
"heat",
|
|
21
|
-
"water",
|
|
22
|
-
"cooling",
|
|
23
|
-
"electricity",
|
|
24
|
-
"infrastructure",
|
|
25
|
-
];
|
|
26
|
-
return Array.isArray(input)
|
|
27
|
-
? !input.some((x) => !ALL_MEDIUMS.includes(<Medium>x))
|
|
28
|
-
: ALL_MEDIUMS.includes(<Medium>input);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function isMeter(medium: Medium | Medium[]) {
|
|
32
|
-
return (
|
|
33
|
-
medium.includes("heat") ||
|
|
34
|
-
medium.includes("water") ||
|
|
35
|
-
medium.includes("cooling") ||
|
|
36
|
-
medium.includes("electricity")
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export function isFlowMeter(medium: Medium | Medium[]) {
|
|
41
|
-
return (
|
|
42
|
-
medium.includes("heat") ||
|
|
43
|
-
medium.includes("water") ||
|
|
44
|
-
medium.includes("cooling")
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
1
|
+
export type Medium =
|
|
2
|
+
| "none"
|
|
3
|
+
| "heat"
|
|
4
|
+
| "water"
|
|
5
|
+
| "cooling"
|
|
6
|
+
| "electricity"
|
|
7
|
+
| "infrastructure"
|
|
8
|
+
| "all";
|
|
9
|
+
|
|
10
|
+
export namespace Medium {
|
|
11
|
+
export function isMedium(input: string): input is Medium;
|
|
12
|
+
export function isMedium(input: string[]): input is Medium[];
|
|
13
|
+
export function isMedium(
|
|
14
|
+
input: string | string[],
|
|
15
|
+
): input is Medium | Medium[] {
|
|
16
|
+
if (input === "none" || input === "all") {
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
const ALL_MEDIUMS: Medium[] = [
|
|
20
|
+
"heat",
|
|
21
|
+
"water",
|
|
22
|
+
"cooling",
|
|
23
|
+
"electricity",
|
|
24
|
+
"infrastructure",
|
|
25
|
+
];
|
|
26
|
+
return Array.isArray(input)
|
|
27
|
+
? !input.some((x) => !ALL_MEDIUMS.includes(<Medium>x))
|
|
28
|
+
: ALL_MEDIUMS.includes(<Medium>input);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function isMeter(medium: Medium | Medium[]) {
|
|
32
|
+
return (
|
|
33
|
+
medium.includes("heat") ||
|
|
34
|
+
medium.includes("water") ||
|
|
35
|
+
medium.includes("cooling") ||
|
|
36
|
+
medium.includes("electricity")
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function isFlowMeter(medium: Medium | Medium[]) {
|
|
41
|
+
return (
|
|
42
|
+
medium.includes("heat") ||
|
|
43
|
+
medium.includes("water") ||
|
|
44
|
+
medium.includes("cooling")
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
}
|