@wisemen/quantity 0.0.1
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/README.md +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/quantities/distance/distance-unit.enum.d.ts +11 -0
- package/dist/quantities/distance/distance-unit.enum.js +20 -0
- package/dist/quantities/distance/distance-unit.enum.js.map +1 -0
- package/dist/quantities/distance/distance.column.d.ts +3 -0
- package/dist/quantities/distance/distance.column.js +6 -0
- package/dist/quantities/distance/distance.column.js.map +1 -0
- package/dist/quantities/distance/distance.d.ts +7 -0
- package/dist/quantities/distance/distance.dto.d.ts +21 -0
- package/dist/quantities/distance/distance.dto.js +60 -0
- package/dist/quantities/distance/distance.dto.js.map +1 -0
- package/dist/quantities/distance/distance.js +42 -0
- package/dist/quantities/distance/distance.js.map +1 -0
- package/dist/quantities/distance/index.d.ts +4 -0
- package/dist/quantities/distance/index.js +5 -0
- package/dist/quantities/distance/index.js.map +1 -0
- package/dist/quantities/distance/tests/distance.unit.test.d.ts +1 -0
- package/dist/quantities/distance/tests/distance.unit.test.js +21 -0
- package/dist/quantities/distance/tests/distance.unit.test.js.map +1 -0
- package/dist/quantities/duration/duration-unit.enum.d.ts +7 -0
- package/dist/quantities/duration/duration-unit.enum.js +16 -0
- package/dist/quantities/duration/duration-unit.enum.js.map +1 -0
- package/dist/quantities/duration/duration.column.d.ts +3 -0
- package/dist/quantities/duration/duration.column.js +6 -0
- package/dist/quantities/duration/duration.column.js.map +1 -0
- package/dist/quantities/duration/duration.d.ts +7 -0
- package/dist/quantities/duration/duration.dto.d.ts +21 -0
- package/dist/quantities/duration/duration.dto.js +60 -0
- package/dist/quantities/duration/duration.dto.js.map +1 -0
- package/dist/quantities/duration/duration.js +26 -0
- package/dist/quantities/duration/duration.js.map +1 -0
- package/dist/quantities/duration/index.d.ts +4 -0
- package/dist/quantities/duration/index.js +5 -0
- package/dist/quantities/duration/index.js.map +1 -0
- package/dist/quantities/temperature/index.d.ts +4 -0
- package/dist/quantities/temperature/index.js +5 -0
- package/dist/quantities/temperature/index.js.map +1 -0
- package/dist/quantities/temperature/temperature-unit.enum.d.ts +7 -0
- package/dist/quantities/temperature/temperature-unit.enum.js +16 -0
- package/dist/quantities/temperature/temperature-unit.enum.js.map +1 -0
- package/dist/quantities/temperature/temperature.column.d.ts +3 -0
- package/dist/quantities/temperature/temperature.column.js +6 -0
- package/dist/quantities/temperature/temperature.column.js.map +1 -0
- package/dist/quantities/temperature/temperature.d.ts +7 -0
- package/dist/quantities/temperature/temperature.dto.d.ts +21 -0
- package/dist/quantities/temperature/temperature.dto.js +60 -0
- package/dist/quantities/temperature/temperature.dto.js.map +1 -0
- package/dist/quantities/temperature/temperature.js +26 -0
- package/dist/quantities/temperature/temperature.js.map +1 -0
- package/dist/quantity.column.d.ts +12 -0
- package/dist/quantity.column.js +29 -0
- package/dist/quantity.column.js.map +1 -0
- package/dist/quantity.d.ts +66 -0
- package/dist/quantity.js +122 -0
- package/dist/quantity.js.map +1 -0
- package/package.json +40 -0
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Wisemen Quantity Package for TypeScript
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAA;AAC9C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,mCAAmC,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ApiPropertyOptions } from '@nestjs/swagger';
|
|
2
|
+
export declare enum DistanceUnit {
|
|
3
|
+
CENTIMETER = "cm",
|
|
4
|
+
METER = "m",
|
|
5
|
+
KILOMETER = "km",
|
|
6
|
+
MILES = "mi",
|
|
7
|
+
INCH = "in",
|
|
8
|
+
FOOT = "ft",
|
|
9
|
+
YARD = "yd"
|
|
10
|
+
}
|
|
11
|
+
export declare function DistanceUnitApiProperty(options?: ApiPropertyOptions): PropertyDecorator;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ApiProperty } from '@nestjs/swagger';
|
|
2
|
+
export var DistanceUnit;
|
|
3
|
+
(function (DistanceUnit) {
|
|
4
|
+
DistanceUnit["CENTIMETER"] = "cm";
|
|
5
|
+
DistanceUnit["METER"] = "m";
|
|
6
|
+
DistanceUnit["KILOMETER"] = "km";
|
|
7
|
+
DistanceUnit["MILES"] = "mi";
|
|
8
|
+
DistanceUnit["INCH"] = "in";
|
|
9
|
+
DistanceUnit["FOOT"] = "ft";
|
|
10
|
+
DistanceUnit["YARD"] = "yd";
|
|
11
|
+
})(DistanceUnit || (DistanceUnit = {}));
|
|
12
|
+
export function DistanceUnitApiProperty(options) {
|
|
13
|
+
return ApiProperty({
|
|
14
|
+
...options,
|
|
15
|
+
enum: DistanceUnit,
|
|
16
|
+
enumName: 'DistanceUnit',
|
|
17
|
+
example: DistanceUnit.METER
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=distance-unit.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"distance-unit.enum.js","sourceRoot":"","sources":["../../../lib/quantities/distance/distance-unit.enum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAsB,MAAM,iBAAiB,CAAA;AAEjE,MAAM,CAAN,IAAY,YAQX;AARD,WAAY,YAAY;IACtB,iCAAiB,CAAA;IACjB,2BAAW,CAAA;IACX,gCAAgB,CAAA;IAChB,4BAAY,CAAA;IACZ,2BAAW,CAAA;IACX,2BAAW,CAAA;IACX,2BAAW,CAAA;AACb,CAAC,EARW,YAAY,KAAZ,YAAY,QAQvB;AAED,MAAM,UAAU,uBAAuB,CAAE,OAA4B;IACnE,OAAO,WAAW,CAAC;QACjB,GAAG,OAAO;QACV,IAAI,EAAE,YAAY;QAClB,QAAQ,EAAE,cAAc;QACxB,OAAO,EAAE,YAAY,CAAC,KAAK;KAC5B,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"distance.column.js","sourceRoot":"","sources":["../../../lib/quantities/distance/distance.column.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAEzD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,MAAM,UAAU,cAAc,CAAE,WAAyB,EAAE,OAAoD;IAC7G,OAAO,cAAc,CAAC,QAAQ,EAAE,WAAW,EAAE,OAAO,CAAC,CAAA;AACvD,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Quantity } from '../../quantity.js';
|
|
2
|
+
import { DistanceUnit } from './distance-unit.enum.js';
|
|
3
|
+
export declare class Distance extends Quantity<DistanceUnit> {
|
|
4
|
+
protected baseUnit: DistanceUnit;
|
|
5
|
+
protected convertValueToBaseUnit(value: number, fromUnit: DistanceUnit): number;
|
|
6
|
+
protected convertBaseUnitValueTo(value: number, toUnit: DistanceUnit): number;
|
|
7
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Distance } from './distance.js';
|
|
2
|
+
import { DistanceUnit } from './distance-unit.enum.js';
|
|
3
|
+
export declare class DistanceDto {
|
|
4
|
+
value: number;
|
|
5
|
+
unit: DistanceUnit;
|
|
6
|
+
static from(distance: undefined): undefined;
|
|
7
|
+
static from(distance: null): null;
|
|
8
|
+
static from(distance: Distance): DistanceDto;
|
|
9
|
+
static from(distance: undefined | null): undefined | null;
|
|
10
|
+
static from(distance: Distance | null): DistanceDto | null;
|
|
11
|
+
static from(distance: Distance | undefined): DistanceDto | undefined;
|
|
12
|
+
static from(distance: Distance | null | undefined): DistanceDto | null | undefined;
|
|
13
|
+
parse(): Distance;
|
|
14
|
+
}
|
|
15
|
+
export declare class DistanceDtoBuilder {
|
|
16
|
+
private readonly dto;
|
|
17
|
+
constructor();
|
|
18
|
+
withValue(value: number): this;
|
|
19
|
+
withUnit(unit: DistanceUnit): this;
|
|
20
|
+
build(): DistanceDto;
|
|
21
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { ApiProperty } from '@nestjs/swagger';
|
|
11
|
+
import { IsEnum, IsNumber } from 'class-validator';
|
|
12
|
+
import { Distance } from './distance.js';
|
|
13
|
+
import { DistanceUnit, DistanceUnitApiProperty } from './distance-unit.enum.js';
|
|
14
|
+
export class DistanceDto {
|
|
15
|
+
value;
|
|
16
|
+
unit;
|
|
17
|
+
static from(distance) {
|
|
18
|
+
if (distance === null)
|
|
19
|
+
return null;
|
|
20
|
+
if (distance === undefined)
|
|
21
|
+
return undefined;
|
|
22
|
+
return new DistanceDtoBuilder()
|
|
23
|
+
.withValue(distance.value)
|
|
24
|
+
.withUnit(distance.unit)
|
|
25
|
+
.build();
|
|
26
|
+
}
|
|
27
|
+
parse() {
|
|
28
|
+
return new Distance(this.value, this.unit);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
__decorate([
|
|
32
|
+
ApiProperty({ type: Number }),
|
|
33
|
+
IsNumber(),
|
|
34
|
+
__metadata("design:type", Number)
|
|
35
|
+
], DistanceDto.prototype, "value", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
DistanceUnitApiProperty(),
|
|
38
|
+
IsEnum(DistanceUnit),
|
|
39
|
+
__metadata("design:type", String)
|
|
40
|
+
], DistanceDto.prototype, "unit", void 0);
|
|
41
|
+
export class DistanceDtoBuilder {
|
|
42
|
+
dto;
|
|
43
|
+
constructor() {
|
|
44
|
+
this.dto = new DistanceDto();
|
|
45
|
+
this.dto.value = 0;
|
|
46
|
+
this.dto.unit = DistanceUnit.METER;
|
|
47
|
+
}
|
|
48
|
+
withValue(value) {
|
|
49
|
+
this.dto.value = value;
|
|
50
|
+
return this;
|
|
51
|
+
}
|
|
52
|
+
withUnit(unit) {
|
|
53
|
+
this.dto.unit = unit;
|
|
54
|
+
return this;
|
|
55
|
+
}
|
|
56
|
+
build() {
|
|
57
|
+
return this.dto;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=distance.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"distance.dto.js","sourceRoot":"","sources":["../../../lib/quantities/distance/distance.dto.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAA;AAE/E,MAAM,OAAO,WAAW;IAGtB,KAAK,CAAQ;IAIb,IAAI,CAAc;IASlB,MAAM,CAAC,IAAI,CAAE,QAAqC;QAChD,IAAI,QAAQ,KAAK,IAAI;YAAE,OAAO,IAAI,CAAA;QAClC,IAAI,QAAQ,KAAK,SAAS;YAAE,OAAO,SAAS,CAAA;QAE5C,OAAO,IAAI,kBAAkB,EAAE;aAC5B,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC;aACzB,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC;aACvB,KAAK,EAAE,CAAA;IACZ,CAAC;IAED,KAAK;QACH,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAA;IAC5C,CAAC;CACF;AA1BC;IAFC,WAAW,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAC7B,QAAQ,EAAE;;0CACE;AAIb;IAFC,uBAAuB,EAAE;IACzB,MAAM,CAAC,YAAY,CAAC;;yCACH;AAwBpB,MAAM,OAAO,kBAAkB;IACZ,GAAG,CAAa;IAEjC;QACE,IAAI,CAAC,GAAG,GAAG,IAAI,WAAW,EAAE,CAAA;QAC5B,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAA;QAClB,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,YAAY,CAAC,KAAK,CAAA;IACpC,CAAC;IAED,SAAS,CAAE,KAAa;QACtB,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,KAAK,CAAA;QAEtB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,QAAQ,CAAE,IAAkB;QAC1B,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,CAAA;QAEpB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,KAAK;QACH,OAAO,IAAI,CAAC,GAAG,CAAA;IACjB,CAAC;CACF"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Quantity } from '../../quantity.js';
|
|
2
|
+
import { DistanceUnit } from './distance-unit.enum.js';
|
|
3
|
+
export class Distance extends Quantity {
|
|
4
|
+
baseUnit = DistanceUnit.METER;
|
|
5
|
+
convertValueToBaseUnit(value, fromUnit) {
|
|
6
|
+
switch (fromUnit) {
|
|
7
|
+
case DistanceUnit.CENTIMETER:
|
|
8
|
+
return value / 100;
|
|
9
|
+
case DistanceUnit.METER:
|
|
10
|
+
return value;
|
|
11
|
+
case DistanceUnit.KILOMETER:
|
|
12
|
+
return value * 1000;
|
|
13
|
+
case DistanceUnit.MILES:
|
|
14
|
+
return value * 1609.34;
|
|
15
|
+
case DistanceUnit.INCH:
|
|
16
|
+
return value * 0.0254;
|
|
17
|
+
case DistanceUnit.FOOT:
|
|
18
|
+
return value * 0.3048;
|
|
19
|
+
case DistanceUnit.YARD:
|
|
20
|
+
return value * 0.9144;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
convertBaseUnitValueTo(value, toUnit) {
|
|
24
|
+
switch (toUnit) {
|
|
25
|
+
case DistanceUnit.CENTIMETER:
|
|
26
|
+
return value * 100;
|
|
27
|
+
case DistanceUnit.METER:
|
|
28
|
+
return value;
|
|
29
|
+
case DistanceUnit.KILOMETER:
|
|
30
|
+
return value / 1000;
|
|
31
|
+
case DistanceUnit.MILES:
|
|
32
|
+
return value / 1609.34;
|
|
33
|
+
case DistanceUnit.INCH:
|
|
34
|
+
return value / 0.0254;
|
|
35
|
+
case DistanceUnit.FOOT:
|
|
36
|
+
return value / 0.3048;
|
|
37
|
+
case DistanceUnit.YARD:
|
|
38
|
+
return value / 0.9144;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=distance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"distance.js","sourceRoot":"","sources":["../../../lib/quantities/distance/distance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAEtD,MAAM,OAAO,QAAS,SAAQ,QAAsB;IACxC,QAAQ,GAAG,YAAY,CAAC,KAAK,CAAA;IAE7B,sBAAsB,CAAE,KAAa,EAAE,QAAsB;QACrE,QAAQ,QAAQ,EAAE,CAAC;YACjB,KAAK,YAAY,CAAC,UAAU;gBAC1B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 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { describe, it } from 'node:test';
|
|
2
|
+
import { expect } from 'expect';
|
|
3
|
+
import { Distance } from '../distance.js';
|
|
4
|
+
import { DistanceUnit } from '../distance-unit.enum.js';
|
|
5
|
+
void describe('Distance class', () => {
|
|
6
|
+
void describe('Distance calculations', () => {
|
|
7
|
+
void it('adds distances', () => {
|
|
8
|
+
const d1 = new Distance(10, DistanceUnit.METER);
|
|
9
|
+
const d2 = new Distance(50, DistanceUnit.CENTIMETER);
|
|
10
|
+
const r = d1.add(d2);
|
|
11
|
+
expect(r.isEqualTo(10.5, DistanceUnit.METER)).toBe(true);
|
|
12
|
+
});
|
|
13
|
+
void it('subtracts distances', () => {
|
|
14
|
+
const d1 = new Distance(10, DistanceUnit.METER);
|
|
15
|
+
const d2 = new Distance(50, DistanceUnit.CENTIMETER);
|
|
16
|
+
const r = d1.subtract(d2);
|
|
17
|
+
expect(r.isEqualTo(950, DistanceUnit.CENTIMETER)).toBe(true);
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
//# sourceMappingURL=distance.unit.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"distance.unit.test.js","sourceRoot":"","sources":["../../../../lib/quantities/distance/tests/distance.unit.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAEvD,KAAK,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IACnC,KAAK,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;QAC1C,KAAK,EAAE,CAAC,gBAAgB,EAAE,GAAG,EAAE;YAC7B,MAAM,EAAE,GAAG,IAAI,QAAQ,CAAC,EAAE,EAAE,YAAY,CAAC,KAAK,CAAC,CAAA;YAC/C,MAAM,EAAE,GAAG,IAAI,QAAQ,CAAC,EAAE,EAAE,YAAY,CAAC,UAAU,CAAC,CAAA;YACpD,MAAM,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;YAEpB,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC1D,CAAC,CAAC,CAAA;QAEF,KAAK,EAAE,CAAC,qBAAqB,EAAE,GAAG,EAAE;YAClC,MAAM,EAAE,GAAG,IAAI,QAAQ,CAAC,EAAE,EAAE,YAAY,CAAC,KAAK,CAAC,CAAA;YAC/C,MAAM,EAAE,GAAG,IAAI,QAAQ,CAAC,EAAE,EAAE,YAAY,CAAC,UAAU,CAAC,CAAA;YACpD,MAAM,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;YAEzB,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC9D,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ApiProperty } from '@nestjs/swagger';
|
|
2
|
+
export var DurationUnit;
|
|
3
|
+
(function (DurationUnit) {
|
|
4
|
+
DurationUnit["SECONDS"] = "s";
|
|
5
|
+
DurationUnit["MINUTES"] = "m";
|
|
6
|
+
DurationUnit["HOURS"] = "h";
|
|
7
|
+
})(DurationUnit || (DurationUnit = {}));
|
|
8
|
+
export function DurationUnitApiProperty(options) {
|
|
9
|
+
return ApiProperty({
|
|
10
|
+
...options,
|
|
11
|
+
enum: DurationUnit,
|
|
12
|
+
enumName: 'DurationUnit',
|
|
13
|
+
example: DurationUnit.SECONDS
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=duration-unit.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"duration-unit.enum.js","sourceRoot":"","sources":["../../../lib/quantities/duration/duration-unit.enum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAsB,MAAM,iBAAiB,CAAA;AAEjE,MAAM,CAAN,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,6BAAa,CAAA;IACb,6BAAa,CAAA;IACb,2BAAW,CAAA;AACb,CAAC,EAJW,YAAY,KAAZ,YAAY,QAIvB;AAED,MAAM,UAAU,uBAAuB,CAAE,OAA4B;IACnE,OAAO,WAAW,CAAC;QACjB,GAAG,OAAO;QACV,IAAI,EAAE,YAAY;QAClB,QAAQ,EAAE,cAAc;QACxB,OAAO,EAAE,YAAY,CAAC,OAAO;KAC9B,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"duration.column.js","sourceRoot":"","sources":["../../../lib/quantities/duration/duration.column.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAGxC,MAAM,UAAU,cAAc,CAAE,WAAyB,EAAE,OAAoD;IAC7G,OAAO,cAAc,CAAC,QAAQ,EAAE,WAAW,EAAE,OAAO,CAAC,CAAA;AACvD,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Quantity } from '../../quantity.js';
|
|
2
|
+
import { DurationUnit } from './duration-unit.enum.js';
|
|
3
|
+
export declare class Duration extends Quantity<DurationUnit> {
|
|
4
|
+
protected baseUnit: DurationUnit;
|
|
5
|
+
protected convertValueToBaseUnit(value: number, unit: DurationUnit): number;
|
|
6
|
+
protected convertBaseUnitValueTo(value: number, unit: DurationUnit): number;
|
|
7
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { DurationUnit } from './duration-unit.enum.js';
|
|
2
|
+
import { Duration } from './duration.js';
|
|
3
|
+
export declare class DurationDto {
|
|
4
|
+
value: number;
|
|
5
|
+
unit: DurationUnit;
|
|
6
|
+
static from(duration: undefined): undefined;
|
|
7
|
+
static from(duration: null): null;
|
|
8
|
+
static from(duration: Duration): DurationDto;
|
|
9
|
+
static from(duration: undefined | null): undefined | null;
|
|
10
|
+
static from(duration: Duration | null): DurationDto | null;
|
|
11
|
+
static from(duration: Duration | undefined): DurationDto | undefined;
|
|
12
|
+
static from(duration: Duration | null | undefined): DurationDto | null | undefined;
|
|
13
|
+
parse(): Duration;
|
|
14
|
+
}
|
|
15
|
+
export declare class DurationDtoBuilder {
|
|
16
|
+
private readonly dto;
|
|
17
|
+
constructor();
|
|
18
|
+
withValue(value: number): this;
|
|
19
|
+
withUnit(unit: DurationUnit): this;
|
|
20
|
+
build(): DurationDto;
|
|
21
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { ApiProperty } from '@nestjs/swagger';
|
|
11
|
+
import { IsEnum, IsNumber } from 'class-validator';
|
|
12
|
+
import { DurationUnit, DurationUnitApiProperty } from './duration-unit.enum.js';
|
|
13
|
+
import { Duration } from './duration.js';
|
|
14
|
+
export class DurationDto {
|
|
15
|
+
value;
|
|
16
|
+
unit;
|
|
17
|
+
static from(duration) {
|
|
18
|
+
if (duration === null)
|
|
19
|
+
return null;
|
|
20
|
+
if (duration === undefined)
|
|
21
|
+
return undefined;
|
|
22
|
+
return new DurationDtoBuilder()
|
|
23
|
+
.withValue(duration.value)
|
|
24
|
+
.withUnit(duration.unit)
|
|
25
|
+
.build();
|
|
26
|
+
}
|
|
27
|
+
parse() {
|
|
28
|
+
return new Duration(this.value, this.unit);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
__decorate([
|
|
32
|
+
ApiProperty({ type: Number }),
|
|
33
|
+
IsNumber(),
|
|
34
|
+
__metadata("design:type", Number)
|
|
35
|
+
], DurationDto.prototype, "value", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
DurationUnitApiProperty(),
|
|
38
|
+
IsEnum(DurationUnit),
|
|
39
|
+
__metadata("design:type", String)
|
|
40
|
+
], DurationDto.prototype, "unit", void 0);
|
|
41
|
+
export class DurationDtoBuilder {
|
|
42
|
+
dto;
|
|
43
|
+
constructor() {
|
|
44
|
+
this.dto = new DurationDto();
|
|
45
|
+
this.dto.value = 0;
|
|
46
|
+
this.dto.unit = DurationUnit.SECONDS;
|
|
47
|
+
}
|
|
48
|
+
withValue(value) {
|
|
49
|
+
this.dto.value = value;
|
|
50
|
+
return this;
|
|
51
|
+
}
|
|
52
|
+
withUnit(unit) {
|
|
53
|
+
this.dto.unit = unit;
|
|
54
|
+
return this;
|
|
55
|
+
}
|
|
56
|
+
build() {
|
|
57
|
+
return this.dto;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=duration.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"duration.dto.js","sourceRoot":"","sources":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AA;QAEtB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,QAAQ,CAAE,IAAkB;QAC1B,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,CAAA;QAEpB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,KAAK;QACH,OAAO,IAAI,CAAC,GAAG,CAAA;IACjB,CAAC;CACF"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Quantity } from '../../quantity.js';
|
|
2
|
+
import { DurationUnit } from './duration-unit.enum.js';
|
|
3
|
+
export class Duration extends Quantity {
|
|
4
|
+
baseUnit = DurationUnit.SECONDS;
|
|
5
|
+
convertValueToBaseUnit(value, unit) {
|
|
6
|
+
switch (unit) {
|
|
7
|
+
case DurationUnit.SECONDS:
|
|
8
|
+
return value;
|
|
9
|
+
case DurationUnit.MINUTES:
|
|
10
|
+
return value * 60;
|
|
11
|
+
case DurationUnit.HOURS:
|
|
12
|
+
return value * 3600;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
convertBaseUnitValueTo(value, unit) {
|
|
16
|
+
switch (unit) {
|
|
17
|
+
case DurationUnit.SECONDS:
|
|
18
|
+
return value;
|
|
19
|
+
case DurationUnit.MINUTES:
|
|
20
|
+
return value / 60;
|
|
21
|
+
case DurationUnit.HOURS:
|
|
22
|
+
return value / 3600;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=duration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"duration.js","sourceRoot":"","sources":["../../../lib/quantities/duration/duration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAEtD,MAAM,OAAO,QAAS,SAAQ,QAAsB;IACxC,QAAQ,GAAG,YAAY,CAAC,OAAO,CAAA;IAE/B,sBAAsB,CAAE,KAAa,EAAE,IAAkB;QACjE,QAAQ,IAAI,EAAE,CAAC;YACb,KAAK,YAAY,CAAC,OAAO;gBACvB,OAAO,KAAK,CAAA;YACd,KAAK,YAAY,CAAC,OAAO;gBACvB,OAAO,KAAK,GAAG,EAAE,CAAA;YACnB,KAAK,YAAY,CAAC,KAAK;gBACrB,OAAO,KAAK,GAAG,IAAI,CAAA;QACvB,CAAC;IACH,CAAC;IAES,sBAAsB,CAAE,KAAa,EAAE,IAAkB;QACjE,QAAQ,IAAI,EAAE,CAAC;YACb,KAAK,YAAY,CAAC,OAAO;gBACvB,OAAO,KAAK,CAAA;YACd,KAAK,YAAY,CAAC,OAAO;gBACvB,OAAO,KAAK,GAAG,EAAE,CAAA;YACnB,KAAK,YAAY,CAAC,KAAK;gBACrB,OAAO,KAAK,GAAG,IAAI,CAAA;QACvB,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/quantities/duration/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,sBAAsB,CAAA;AACpC,cAAc,yBAAyB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/quantities/temperature/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,sBAAsB,CAAA;AACpC,cAAc,yBAAyB,CAAA;AACvC,cAAc,4BAA4B,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ApiProperty } from '@nestjs/swagger';
|
|
2
|
+
export var TemperatureUnit;
|
|
3
|
+
(function (TemperatureUnit) {
|
|
4
|
+
TemperatureUnit["KELVIN"] = "K";
|
|
5
|
+
TemperatureUnit["CELSIUS"] = "C";
|
|
6
|
+
TemperatureUnit["FAHRENHEIT"] = "F";
|
|
7
|
+
})(TemperatureUnit || (TemperatureUnit = {}));
|
|
8
|
+
export function TemperatureUnitApiProperty(options) {
|
|
9
|
+
return ApiProperty({
|
|
10
|
+
...options,
|
|
11
|
+
enum: TemperatureUnit,
|
|
12
|
+
enumName: 'TemperatureUnit',
|
|
13
|
+
example: TemperatureUnit.CELSIUS
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=temperature-unit.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"temperature-unit.enum.js","sourceRoot":"","sources":["../../../lib/quantities/temperature/temperature-unit.enum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAsB,MAAM,iBAAiB,CAAA;AAEjE,MAAM,CAAN,IAAY,eAIX;AAJD,WAAY,eAAe;IACzB,+BAAY,CAAA;IACZ,gCAAa,CAAA;IACb,mCAAgB,CAAA;AAClB,CAAC,EAJW,eAAe,KAAf,eAAe,QAI1B;AAED,MAAM,UAAU,0BAA0B,CAAE,OAA4B;IACtE,OAAO,WAAW,CAAC;QACjB,GAAG,OAAO;QACV,IAAI,EAAE,eAAe;QACrB,QAAQ,EAAE,iBAAiB;QAC3B,OAAO,EAAE,eAAe,CAAC,OAAO;KACjC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { QuantityColumn } from '../../quantity.column.js';
|
|
2
|
+
import { Temperature } from './temperature.js';
|
|
3
|
+
export function TemperatureColumn(storeAsUnit, options) {
|
|
4
|
+
return QuantityColumn(Temperature, storeAsUnit, options);
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=temperature.column.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"temperature.column.js","sourceRoot":"","sources":["../../../lib/quantities/temperature/temperature.column.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAG9C,MAAM,UAAU,iBAAiB,CAAE,WAA4B,EAAE,OAAoD;IACnH,OAAO,cAAc,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,CAAC,CAAA;AAC1D,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Quantity } from '../../quantity.js';
|
|
2
|
+
import { TemperatureUnit } from './temperature-unit.enum.js';
|
|
3
|
+
export declare class Temperature extends Quantity<TemperatureUnit> {
|
|
4
|
+
protected baseUnit: TemperatureUnit;
|
|
5
|
+
protected convertValueToBaseUnit(value: number, unit: TemperatureUnit): number;
|
|
6
|
+
protected convertBaseUnitValueTo(value: number, unit: TemperatureUnit): number;
|
|
7
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { TemperatureUnit } from './temperature-unit.enum.js';
|
|
2
|
+
import { Temperature } from './temperature.js';
|
|
3
|
+
export declare class TemperatureDto {
|
|
4
|
+
value: number;
|
|
5
|
+
unit: TemperatureUnit;
|
|
6
|
+
static from(temperature: undefined): undefined;
|
|
7
|
+
static from(temperature: null): null;
|
|
8
|
+
static from(temperature: Temperature): TemperatureDto;
|
|
9
|
+
static from(temperature: undefined | null): undefined | null;
|
|
10
|
+
static from(temperature: Temperature | null): TemperatureDto | null;
|
|
11
|
+
static from(temperatureduration: Temperature | undefined): TemperatureDto | undefined;
|
|
12
|
+
static from(temperature: Temperature | null | undefined): TemperatureDto | null | undefined;
|
|
13
|
+
parse(): Temperature;
|
|
14
|
+
}
|
|
15
|
+
export declare class TemperatureDtoBuilder {
|
|
16
|
+
private readonly dto;
|
|
17
|
+
constructor();
|
|
18
|
+
withValue(value: number): this;
|
|
19
|
+
withUnit(unit: TemperatureUnit): this;
|
|
20
|
+
build(): TemperatureDto;
|
|
21
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { ApiProperty } from '@nestjs/swagger';
|
|
11
|
+
import { IsEnum, IsNumber } from 'class-validator';
|
|
12
|
+
import { TemperatureUnit, TemperatureUnitApiProperty } from './temperature-unit.enum.js';
|
|
13
|
+
import { Temperature } from './temperature.js';
|
|
14
|
+
export class TemperatureDto {
|
|
15
|
+
value;
|
|
16
|
+
unit;
|
|
17
|
+
static from(temperature) {
|
|
18
|
+
if (temperature === null)
|
|
19
|
+
return null;
|
|
20
|
+
if (temperature === undefined)
|
|
21
|
+
return undefined;
|
|
22
|
+
return new TemperatureDtoBuilder()
|
|
23
|
+
.withValue(temperature.value)
|
|
24
|
+
.withUnit(temperature.unit)
|
|
25
|
+
.build();
|
|
26
|
+
}
|
|
27
|
+
parse() {
|
|
28
|
+
return new Temperature(this.value, this.unit);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
__decorate([
|
|
32
|
+
ApiProperty({ type: Number }),
|
|
33
|
+
IsNumber(),
|
|
34
|
+
__metadata("design:type", Number)
|
|
35
|
+
], TemperatureDto.prototype, "value", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
TemperatureUnitApiProperty(),
|
|
38
|
+
IsEnum(TemperatureUnit),
|
|
39
|
+
__metadata("design:type", String)
|
|
40
|
+
], TemperatureDto.prototype, "unit", void 0);
|
|
41
|
+
export class TemperatureDtoBuilder {
|
|
42
|
+
dto;
|
|
43
|
+
constructor() {
|
|
44
|
+
this.dto = new TemperatureDto();
|
|
45
|
+
this.dto.value = 0;
|
|
46
|
+
this.dto.unit = TemperatureUnit.CELSIUS;
|
|
47
|
+
}
|
|
48
|
+
withValue(value) {
|
|
49
|
+
this.dto.value = value;
|
|
50
|
+
return this;
|
|
51
|
+
}
|
|
52
|
+
withUnit(unit) {
|
|
53
|
+
this.dto.unit = unit;
|
|
54
|
+
return this;
|
|
55
|
+
}
|
|
56
|
+
build() {
|
|
57
|
+
return this.dto;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=temperature.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"temperature.dto.js","sourceRoot":"","sources":["../../../lib/quantities/temperature/temperature.dto.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAAE,eAAe,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAA;AACxF,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,MAAM,OAAO,cAAc;IAGzB,KAAK,CAAQ;IAIb,IAAI,CAAiB;IASrB,MAAM,CAAC,IAAI,CAAE,WAA2C;QACtD,IAAI,WAAW,KAAK,IAAI;YAAE,OAAO,IAAI,CAAA;QACrC,IAAI,WAAW,KAAK,SAAS;YAAE,OAAO,SAAS,CAAA;QAE/C,OAAO,IAAI,qBAAqB,EAAE;aAC/B,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC;aAC5B,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC;aAC1B,KAAK,EAAE,CAAA;IACZ,CAAC;IAED,KAAK;QACH,OAAO,IAAI,WAAW,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAA;IAC/C,CAAC;CACF;AA1BC;IAFC,WAAW,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAC7B,QAAQ,EAAE;;6CACE;AAIb;IAFC,0BAA0B,EAAE;IAC5B,MAAM,CAAC,eAAe,CAAC;;4CACH;AAwBvB,MAAM,OAAO,qBAAqB;IACf,GAAG,CAAgB;IAEpC;QACE,IAAI,CAAC,GAAG,GAAG,IAAI,cAAc,EAAE,CAAA;QAC/B,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAA;QAClB,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,eAAe,CAAC,OAAO,CAAA;IACzC,CAAC;IAED,SAAS,CAAE,KAAa;QACtB,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,KAAK,CAAA;QAEtB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,QAAQ,CAAE,IAAqB;QAC7B,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,CAAA;QAEpB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,KAAK;QACH,OAAO,IAAI,CAAC,GAAG,CAAA;IACjB,CAAC;CACF"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Quantity } from '../../quantity.js';
|
|
2
|
+
import { TemperatureUnit } from './temperature-unit.enum.js';
|
|
3
|
+
export class Temperature extends Quantity {
|
|
4
|
+
baseUnit = TemperatureUnit.KELVIN;
|
|
5
|
+
convertValueToBaseUnit(value, unit) {
|
|
6
|
+
switch (unit) {
|
|
7
|
+
case TemperatureUnit.KELVIN:
|
|
8
|
+
return value;
|
|
9
|
+
case TemperatureUnit.CELSIUS:
|
|
10
|
+
return value + 273.15;
|
|
11
|
+
case TemperatureUnit.FAHRENHEIT:
|
|
12
|
+
return ((value - 32) * 5) / 9 + 273.15;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
convertBaseUnitValueTo(value, unit) {
|
|
16
|
+
switch (unit) {
|
|
17
|
+
case TemperatureUnit.KELVIN:
|
|
18
|
+
return value;
|
|
19
|
+
case TemperatureUnit.CELSIUS:
|
|
20
|
+
return value - 273.15;
|
|
21
|
+
case TemperatureUnit.FAHRENHEIT:
|
|
22
|
+
return ((value - 273.15) * 9) / 5 + 32;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=temperature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"temperature.js","sourceRoot":"","sources":["../../../lib/quantities/temperature/temperature.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAE5D,MAAM,OAAO,WAAY,SAAQ,QAAyB;IAC9C,QAAQ,GAAG,eAAe,CAAC,MAAM,CAAA;IAEjC,sBAAsB,CAAE,KAAa,EAAE,IAAqB;QACpE,QAAQ,IAAI,EAAE,CAAC;YACb,KAAK,eAAe,CAAC,MAAM;gBACzB,OAAO,KAAK,CAAA;YACd,KAAK,eAAe,CAAC,OAAO;gBAC1B,OAAO,KAAK,GAAG,MAAM,CAAA;YACvB,KAAK,eAAe,CAAC,UAAU;gBAC7B,OAAO,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,MAAM,CAAA;QAC1C,CAAC;IACH,CAAC;IAES,sBAAsB,CAAE,KAAa,EAAE,IAAqB;QACpE,QAAQ,IAAI,EAAE,CAAC;YACb,KAAK,eAAe,CAAC,MAAM;gBACzB,OAAO,KAAK,CAAA;YACd,KAAK,eAAe,CAAC,OAAO;gBAC1B,OAAO,KAAK,GAAG,MAAM,CAAA;YACvB,KAAK,eAAe,CAAC,UAAU;gBAC7B,OAAO,CAAC,CAAC,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,CAAA;QAC1C,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ColumnOptions, ValueTransformer } from 'typeorm';
|
|
2
|
+
import { Quantity, QuantityConstructor } from './quantity.js';
|
|
3
|
+
export declare function QuantityColumn<U extends string>(QuantityConstructor: QuantityConstructor<U>, storeAsUnit: U, options?: Omit<ColumnOptions, 'type' | 'transformer'>): PropertyDecorator;
|
|
4
|
+
export declare class QuantityTypeOrmTransformer<U extends string> implements ValueTransformer {
|
|
5
|
+
private readonly QuantityConstructor;
|
|
6
|
+
private readonly storedUnit;
|
|
7
|
+
constructor(QuantityConstructor: QuantityConstructor<U>, storedUnit: U);
|
|
8
|
+
from(value: number): Quantity<U>;
|
|
9
|
+
from(value: number | null): Quantity<U> | null;
|
|
10
|
+
to(quantity: Quantity<U>): number;
|
|
11
|
+
to(quantity: Quantity<U> | null): number | null;
|
|
12
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Column } from 'typeorm';
|
|
2
|
+
export function QuantityColumn(QuantityConstructor, storeAsUnit, options) {
|
|
3
|
+
return Column({
|
|
4
|
+
...options,
|
|
5
|
+
type: 'float',
|
|
6
|
+
transformer: new QuantityTypeOrmTransformer(QuantityConstructor, storeAsUnit)
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
export class QuantityTypeOrmTransformer {
|
|
10
|
+
QuantityConstructor;
|
|
11
|
+
storedUnit;
|
|
12
|
+
constructor(QuantityConstructor, storedUnit) {
|
|
13
|
+
this.QuantityConstructor = QuantityConstructor;
|
|
14
|
+
this.storedUnit = storedUnit;
|
|
15
|
+
}
|
|
16
|
+
from(value) {
|
|
17
|
+
if (value === null) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
return new this.QuantityConstructor(value, this.storedUnit);
|
|
21
|
+
}
|
|
22
|
+
to(quantity) {
|
|
23
|
+
if (quantity === null) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
return quantity.asNumber(this.storedUnit);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=quantity.column.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quantity.column.js","sourceRoot":"","sources":["../lib/quantity.column.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAmC,MAAM,SAAS,CAAA;AAGjE,MAAM,UAAU,cAAc,CAC5B,mBAA2C,EAC3C,WAAc,EACd,OAAqD;IAErD,OAAO,MAAM,CAAC;QACZ,GAAG,OAAO;QACV,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,IAAI,0BAA0B,CAAC,mBAAmB,EAAE,WAAW,CAAC;KAC9E,CAAC,CAAA;AACJ,CAAC;AAED,MAAM,OAAO,0BAA0B;IAElB;IACA;IAFnB,YACmB,mBAA2C,EAC3C,UAAa;QADb,wBAAmB,GAAnB,mBAAmB,CAAwB;QAC3C,eAAU,GAAV,UAAU,CAAG;IAC7B,CAAC;IAIJ,IAAI,CAAE,KAAoB;QACxB,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YACnB,OAAO,IAAI,CAAA;QACb,CAAC;QAED,OAAO,IAAI,IAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAA;IAC7D,CAAC;IAID,EAAE,CAAE,QAA4B;QAC9B,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;YACtB,OAAO,IAAI,CAAA;QACb,CAAC;QAED,OAAO,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;IAC3C,CAAC;CACF"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export type QuantityConstructor<U extends string> = {
|
|
2
|
+
new (...args: any[]): Quantity<U>;
|
|
3
|
+
};
|
|
4
|
+
export declare abstract class Quantity<U extends string> {
|
|
5
|
+
protected abstract baseUnit: U;
|
|
6
|
+
protected abstract convertValueToBaseUnit(value: number, fromUnit: U): number;
|
|
7
|
+
protected abstract convertBaseUnitValueTo(value: number, toUnit: U): number;
|
|
8
|
+
readonly value: number;
|
|
9
|
+
readonly unit: U;
|
|
10
|
+
constructor(quantity: Quantity<U>);
|
|
11
|
+
constructor(value: number, unit: U);
|
|
12
|
+
private get Constructor();
|
|
13
|
+
private construct;
|
|
14
|
+
/** Converts the quantity to the specified unit */
|
|
15
|
+
to(unit: U): Quantity<U>;
|
|
16
|
+
/** Returns the numeric value of the quantity in the specified unit */
|
|
17
|
+
asNumber(unit?: U): number;
|
|
18
|
+
/** Checks whether the quantity is equal to another quantity */
|
|
19
|
+
isEqualTo(value: number, unit: U): boolean;
|
|
20
|
+
isEqualTo(quantity: Quantity<U>): boolean;
|
|
21
|
+
/** Checks whether the quantity is less than another quantity */
|
|
22
|
+
isLessThan(value: number, unit: U): boolean;
|
|
23
|
+
isLessThan(quantity: Quantity<U>): boolean;
|
|
24
|
+
/** Checks whether the quantity is less than or equal to another quantity */
|
|
25
|
+
isLessThanOrEqualTo(value: number, unit: U): boolean;
|
|
26
|
+
isLessThanOrEqualTo(quantity: Quantity<U>): boolean;
|
|
27
|
+
/** Checks whether the quantity is more than another quantity */
|
|
28
|
+
isMoreThan(value: number, unit: U): boolean;
|
|
29
|
+
isMoreThan(quantity: Quantity<U>): boolean;
|
|
30
|
+
/** Checks whether the quantity is more than or equal to another quantity */
|
|
31
|
+
isMoreThanOrEqualTo(value: number, unit: U): boolean;
|
|
32
|
+
isMoreThanOrEqualTo(quantity: Quantity<U>): boolean;
|
|
33
|
+
/** Creates a new quantity by adding the current quantity to another quantity */
|
|
34
|
+
add(value: number, unit: U): Quantity<U>;
|
|
35
|
+
add(quantity: Quantity<U>): Quantity<U>;
|
|
36
|
+
/** Creates a new quantity by subtracting another quantity from the current quantity */
|
|
37
|
+
subtract(value: number, unit: U): Quantity<U>;
|
|
38
|
+
subtract(quantity: Quantity<U>): Quantity<U>;
|
|
39
|
+
/** Creates a new quantity by multiplying the current quantity with the specified factor */
|
|
40
|
+
multiply(factor: number): Quantity<U>;
|
|
41
|
+
/** Creates a new quantity by dividing the current quantity by the specified divisor */
|
|
42
|
+
divide(divisor: number): Quantity<U>;
|
|
43
|
+
/** Creates a new quantity by calculating the modulus of
|
|
44
|
+
* the current quantity and another quantity */
|
|
45
|
+
modulo(value: number, unit: U): Quantity<U>;
|
|
46
|
+
modulo(quantity: Quantity<U>): Quantity<U>;
|
|
47
|
+
/** Ceils the value to the nearest integer for the current unit */
|
|
48
|
+
ceil(): Quantity<U>;
|
|
49
|
+
/** Rounds the value half up to the nearest integer for the current unit */
|
|
50
|
+
round(): Quantity<U>;
|
|
51
|
+
/** Floors the value to the nearest integer for the current unit */
|
|
52
|
+
floor(): Quantity<U>;
|
|
53
|
+
/** Checks whether the value is an integer for the current unit */
|
|
54
|
+
isRounded(): boolean;
|
|
55
|
+
toString(): string;
|
|
56
|
+
valueOf(): number;
|
|
57
|
+
export(): {
|
|
58
|
+
value: number;
|
|
59
|
+
unit: U;
|
|
60
|
+
};
|
|
61
|
+
toJSON(): object;
|
|
62
|
+
/** Returns the maximum quantity from the provided quantities */
|
|
63
|
+
static max<U extends string>(...quantities: Quantity<U>[]): Quantity<U>;
|
|
64
|
+
/** Returns the minimum quantity from the provided quantities */
|
|
65
|
+
static min<U extends string>(...quantities: Quantity<U>[]): Quantity<U>;
|
|
66
|
+
}
|
package/dist/quantity.js
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import assert from 'assert';
|
|
2
|
+
export class Quantity {
|
|
3
|
+
value;
|
|
4
|
+
unit;
|
|
5
|
+
constructor(quantityOrValue, unit) {
|
|
6
|
+
if (quantityOrValue instanceof Quantity) {
|
|
7
|
+
this.value = quantityOrValue.value;
|
|
8
|
+
this.unit = quantityOrValue.unit;
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
assert(unit !== undefined, 'Unit must be provided when constructing from a numeric value');
|
|
12
|
+
this.value = quantityOrValue;
|
|
13
|
+
this.unit = unit;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
get Constructor() {
|
|
17
|
+
// eslint-disable-next-line @stylistic/max-len
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access
|
|
19
|
+
return Object.getPrototypeOf(this).constructor;
|
|
20
|
+
}
|
|
21
|
+
construct(quantityOrValue, unit) {
|
|
22
|
+
if (quantityOrValue instanceof Quantity) {
|
|
23
|
+
return new this.Constructor(quantityOrValue);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
assert(unit !== undefined, 'Unit must be provided when constructing from a numeric value');
|
|
27
|
+
return new this.Constructor(quantityOrValue, unit);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/** Converts the quantity to the specified unit */
|
|
31
|
+
to(unit) {
|
|
32
|
+
const value = this.convertBaseUnitValueTo(this.valueOf(), unit);
|
|
33
|
+
return new this.Constructor(value, unit);
|
|
34
|
+
}
|
|
35
|
+
/** Returns the numeric value of the quantity in the specified unit */
|
|
36
|
+
asNumber(unit = this.unit) {
|
|
37
|
+
return this.to(unit).value;
|
|
38
|
+
}
|
|
39
|
+
isEqualTo(quantityOrValue, unit) {
|
|
40
|
+
const other = this.construct(quantityOrValue, unit);
|
|
41
|
+
return this.valueOf() === other.valueOf();
|
|
42
|
+
}
|
|
43
|
+
isLessThan(quantityOrValue, unit) {
|
|
44
|
+
const other = this.construct(quantityOrValue, unit);
|
|
45
|
+
return this.valueOf() < other.valueOf();
|
|
46
|
+
}
|
|
47
|
+
isLessThanOrEqualTo(quantityOrValue, unit) {
|
|
48
|
+
const other = this.construct(quantityOrValue, unit);
|
|
49
|
+
return this.valueOf() <= other.valueOf();
|
|
50
|
+
}
|
|
51
|
+
isMoreThan(quantityOrValue, unit) {
|
|
52
|
+
const other = this.construct(quantityOrValue, unit);
|
|
53
|
+
return this.valueOf() > other.valueOf();
|
|
54
|
+
}
|
|
55
|
+
isMoreThanOrEqualTo(quantityOrValue, unit) {
|
|
56
|
+
const other = this.construct(quantityOrValue, unit);
|
|
57
|
+
return this.valueOf() >= other.valueOf();
|
|
58
|
+
}
|
|
59
|
+
add(quantityOrValue, unit) {
|
|
60
|
+
const other = this.construct(quantityOrValue, unit);
|
|
61
|
+
return new this.Constructor(this.valueOf() + other.valueOf(), this.baseUnit).to(this.unit);
|
|
62
|
+
}
|
|
63
|
+
subtract(quantityOrValue, unit) {
|
|
64
|
+
const other = this.construct(quantityOrValue, unit);
|
|
65
|
+
return new this.Constructor(this.valueOf() - other.valueOf(), this.baseUnit).to(this.unit);
|
|
66
|
+
}
|
|
67
|
+
/** Creates a new quantity by multiplying the current quantity with the specified factor */
|
|
68
|
+
multiply(factor) {
|
|
69
|
+
return new this.Constructor(this.valueOf() * factor, this.baseUnit).to(this.unit);
|
|
70
|
+
}
|
|
71
|
+
/** Creates a new quantity by dividing the current quantity by the specified divisor */
|
|
72
|
+
divide(divisor) {
|
|
73
|
+
return new this.Constructor(this.valueOf() / divisor, this.baseUnit).to(this.unit);
|
|
74
|
+
}
|
|
75
|
+
modulo(quantityOrValue, unit) {
|
|
76
|
+
const other = this.construct(quantityOrValue, unit);
|
|
77
|
+
return new this.Constructor(this.valueOf() % other.valueOf(), this.baseUnit).to(this.unit);
|
|
78
|
+
}
|
|
79
|
+
/** Ceils the value to the nearest integer for the current unit */
|
|
80
|
+
ceil() {
|
|
81
|
+
return new this.Constructor(Math.ceil(this.value), this.unit);
|
|
82
|
+
}
|
|
83
|
+
/** Rounds the value half up to the nearest integer for the current unit */
|
|
84
|
+
round() {
|
|
85
|
+
return new this.Constructor(Math.round(this.value), this.unit);
|
|
86
|
+
}
|
|
87
|
+
/** Floors the value to the nearest integer for the current unit */
|
|
88
|
+
floor() {
|
|
89
|
+
return new this.Constructor(Math.floor(this.value), this.unit);
|
|
90
|
+
}
|
|
91
|
+
/** Checks whether the value is an integer for the current unit */
|
|
92
|
+
isRounded() {
|
|
93
|
+
return Number.isInteger(this.value);
|
|
94
|
+
}
|
|
95
|
+
toString() {
|
|
96
|
+
return `${this.value}${this.unit}`;
|
|
97
|
+
}
|
|
98
|
+
valueOf() {
|
|
99
|
+
return this.convertValueToBaseUnit(this.value, this.unit);
|
|
100
|
+
}
|
|
101
|
+
export() {
|
|
102
|
+
return {
|
|
103
|
+
value: this.value,
|
|
104
|
+
unit: this.unit
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
toJSON() {
|
|
108
|
+
return {
|
|
109
|
+
value: this.value,
|
|
110
|
+
unit: this.unit
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
/** Returns the maximum quantity from the provided quantities */
|
|
114
|
+
static max(...quantities) {
|
|
115
|
+
return quantities.reduce((max, quantity) => quantity.valueOf() > max.valueOf() ? quantity : max);
|
|
116
|
+
}
|
|
117
|
+
/** Returns the minimum quantity from the provided quantities */
|
|
118
|
+
static min(...quantities) {
|
|
119
|
+
return quantities.reduce((min, quantity) => quantity.valueOf() < min.valueOf() ? quantity : min);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=quantity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quantity.js","sourceRoot":"","sources":["../lib/quantity.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAO3B,MAAM,OAAgB,QAAQ;IAKnB,KAAK,CAAQ;IACb,IAAI,CAAG;IAIhB,YAAa,eAAqC,EAAE,IAAQ;QAC1D,IAAI,eAAe,YAAY,QAAQ,EAAE,CAAC;YACxC,IAAI,CAAC,KAAK,GAAG,eAAe,CAAC,KAAK,CAAA;YAClC,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC,IAAI,CAAA;QAClC,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE,8DAA8D,CAAC,CAAA;YAC1F,IAAI,CAAC,KAAK,GAAG,eAAe,CAAA;YAC5B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAClB,CAAC;IACH,CAAC;IAED,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+
"files": [
|
|
8
|
+
"dist/"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"prebuild": "rm -rf ./dist",
|
|
12
|
+
"clean": "rm -rf ./dist",
|
|
13
|
+
"build": "tsc",
|
|
14
|
+
"pretest": "npm run clean && npm run build",
|
|
15
|
+
"test": "node --test",
|
|
16
|
+
"lint": "eslint --cache",
|
|
17
|
+
"prerelease": "npm run build",
|
|
18
|
+
"release": "pnpx release-it"
|
|
19
|
+
},
|
|
20
|
+
"peerDependencies": {
|
|
21
|
+
"@nestjs/common": "^11.1.6",
|
|
22
|
+
"@nestjs/swagger": "^11.2.0",
|
|
23
|
+
"@wisemen/nestjs-typeorm": "^0.0.29",
|
|
24
|
+
"class-transformer": "^0.5.1",
|
|
25
|
+
"class-validator": "^0.14.2",
|
|
26
|
+
"typeorm": "^0.3.27"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@wisemen/eslint-config-nestjs": "^0.1.7",
|
|
30
|
+
"eslint": "^9.36.0",
|
|
31
|
+
"expect": "^30.1.2",
|
|
32
|
+
"typescript": "^5.9.2"
|
|
33
|
+
},
|
|
34
|
+
"author": "Maarten Sijmkens",
|
|
35
|
+
"license": "GPL",
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "git@github.com:wisemen-digital/node-core.git"
|
|
39
|
+
}
|
|
40
|
+
}
|