namirasoft-cost 1.4.4 → 1.4.5
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/.ns-sdkg-dir-deep +3 -0
- package/.ns-sdkg-dir-keep +0 -0
- package/.ns-sdkg-file-keep +7 -0
- package/dist/NamirasoftCostServerBillWatchAWS.d.ts +4 -4
- package/dist/NamirasoftCostServerBillWatchAWS.js.map +1 -1
- package/dist/NamirasoftCostServerBillWatchAzure.d.ts +4 -4
- package/dist/NamirasoftCostServerBillWatchAzure.js.map +1 -1
- package/dist/NamirasoftCostServerBillWatchGCP.d.ts +4 -4
- package/dist/NamirasoftCostServerBillWatchGCP.js.map +1 -1
- package/dist/TimeUtil.d.ts +7 -0
- package/dist/TimeUtil.js +44 -0
- package/dist/TimeUtil.js.map +1 -0
- package/dist/enum/TrialUnit.d.ts +5 -0
- package/dist/enum/TrialUnit.js +10 -0
- package/dist/enum/TrialUnit.js.map +1 -0
- package/dist/index.d.ts +7 -3
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/type/Estimation.d.ts +5 -0
- package/dist/{row/EstimationRowRow.js → type/Estimation.js} +1 -1
- package/dist/type/Estimation.js.map +1 -0
- package/dist/type/EstimationRow.d.ts +5 -0
- package/dist/{row → type}/EstimationRow.js.map +1 -1
- package/dist/type/Period.d.ts +4 -0
- package/dist/{row/PeriodRow.js → type/Period.js} +1 -1
- package/dist/type/Period.js.map +1 -0
- package/dist/type/Trial.d.ts +5 -0
- package/dist/type/Trial.js +3 -0
- package/dist/type/Trial.js.map +1 -0
- package/dist/type/TrialDuration.d.ts +5 -0
- package/dist/type/TrialDuration.js +3 -0
- package/dist/type/TrialDuration.js.map +1 -0
- package/package.json +1 -1
- package/src/NamirasoftCostServerBillWatchAWS.ts +4 -4
- package/src/NamirasoftCostServerBillWatchAzure.ts +4 -4
- package/src/NamirasoftCostServerBillWatchGCP.ts +4 -4
- package/src/TimeUtil.ts +53 -0
- package/src/enum/TrialUnit.ts +6 -0
- package/src/index.ts +7 -3
- package/src/type/Estimation.ts +7 -0
- package/src/type/EstimationRow.ts +7 -0
- package/src/type/Period.ts +5 -0
- package/src/type/Trial.ts +7 -0
- package/src/type/TrialDuration.ts +7 -0
- package/dist/row/EstimationRow.d.ts +0 -5
- package/dist/row/EstimationRowRow.d.ts +0 -5
- package/dist/row/EstimationRowRow.js.map +0 -1
- package/dist/row/PeriodRow.d.ts +0 -4
- package/dist/row/PeriodRow.js.map +0 -1
- package/src/row/EstimationRow.ts +0 -27
- package/src/row/EstimationRowRow.ts +0 -27
- package/src/row/PeriodRow.ts +0 -25
- /package/dist/{row → type}/EstimationRow.js +0 -0
File without changes
|
@@ -1,11 +1,11 @@
|
|
1
|
-
import {
|
1
|
+
import { Estimation } from "./type/Estimation";
|
2
2
|
import { NamirasoftCostServer } from "./NamirasoftCostServer";
|
3
3
|
import { NamirasoftCostServerBase } from "./NamirasoftCostServerBase";
|
4
|
-
import {
|
4
|
+
import { Period } from "./type/Period";
|
5
5
|
export declare class NamirasoftCostServerBillWatchAWS extends NamirasoftCostServerBase {
|
6
6
|
constructor(server: NamirasoftCostServer);
|
7
7
|
Estimation(body: {
|
8
|
-
period:
|
8
|
+
period: Period;
|
9
9
|
active: boolean;
|
10
|
-
}): Promise<
|
10
|
+
}): Promise<Estimation>;
|
11
11
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"NamirasoftCostServerBillWatchAWS.js","sourceRoot":"","sources":["../src/NamirasoftCostServerBillWatchAWS.ts"],"names":[],"mappings":";;;;;;;;;;;;AAsBA,yEAAsE;AAGtE,MAAa,gCAAiC,SAAQ,mDAAwB;IAE1E,YAAY,MAA4B;QAEpC,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjD,CAAC;IACK,UAAU,CAAC,
|
1
|
+
{"version":3,"file":"NamirasoftCostServerBillWatchAWS.js","sourceRoot":"","sources":["../src/NamirasoftCostServerBillWatchAWS.ts"],"names":[],"mappings":";;;;;;;;;;;;AAsBA,yEAAsE;AAGtE,MAAa,gCAAiC,SAAQ,mDAAwB;IAE1E,YAAY,MAA4B;QAEpC,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjD,CAAC;IACK,UAAU,CAAC,IAAyC;;YAEtD,IAAI,IAAI,GAAG,kCAAkC,CAAC;YAC9C,IAAI,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAa,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;YACnE,OAAO,IAAI,CAAC;QAChB,CAAC;KAAA;CACJ;AAbD,4EAaC;AAAA,CAAC"}
|
@@ -1,11 +1,11 @@
|
|
1
|
-
import {
|
1
|
+
import { Estimation } from "./type/Estimation";
|
2
2
|
import { NamirasoftCostServer } from "./NamirasoftCostServer";
|
3
3
|
import { NamirasoftCostServerBase } from "./NamirasoftCostServerBase";
|
4
|
-
import {
|
4
|
+
import { Period } from "./type/Period";
|
5
5
|
export declare class NamirasoftCostServerBillWatchAzure extends NamirasoftCostServerBase {
|
6
6
|
constructor(server: NamirasoftCostServer);
|
7
7
|
Estimation(body: {
|
8
|
-
period:
|
8
|
+
period: Period;
|
9
9
|
active: boolean;
|
10
|
-
}): Promise<
|
10
|
+
}): Promise<Estimation>;
|
11
11
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"NamirasoftCostServerBillWatchAzure.js","sourceRoot":"","sources":["../src/NamirasoftCostServerBillWatchAzure.ts"],"names":[],"mappings":";;;;;;;;;;;;AAsBA,yEAAsE;AAGtE,MAAa,kCAAmC,SAAQ,mDAAwB;IAE5E,YAAY,MAA4B;QAEpC,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjD,CAAC;IACK,UAAU,CAAC,
|
1
|
+
{"version":3,"file":"NamirasoftCostServerBillWatchAzure.js","sourceRoot":"","sources":["../src/NamirasoftCostServerBillWatchAzure.ts"],"names":[],"mappings":";;;;;;;;;;;;AAsBA,yEAAsE;AAGtE,MAAa,kCAAmC,SAAQ,mDAAwB;IAE5E,YAAY,MAA4B;QAEpC,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjD,CAAC;IACK,UAAU,CAAC,IAAyC;;YAEtD,IAAI,IAAI,GAAG,oCAAoC,CAAC;YAChD,IAAI,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAa,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;YACnE,OAAO,IAAI,CAAC;QAChB,CAAC;KAAA;CACJ;AAbD,gFAaC;AAAA,CAAC"}
|
@@ -1,11 +1,11 @@
|
|
1
|
-
import {
|
1
|
+
import { Estimation } from "./type/Estimation";
|
2
2
|
import { NamirasoftCostServer } from "./NamirasoftCostServer";
|
3
3
|
import { NamirasoftCostServerBase } from "./NamirasoftCostServerBase";
|
4
|
-
import {
|
4
|
+
import { Period } from "./type/Period";
|
5
5
|
export declare class NamirasoftCostServerBillWatchGCP extends NamirasoftCostServerBase {
|
6
6
|
constructor(server: NamirasoftCostServer);
|
7
7
|
Estimation(body: {
|
8
|
-
period:
|
8
|
+
period: Period;
|
9
9
|
active: boolean;
|
10
|
-
}): Promise<
|
10
|
+
}): Promise<Estimation>;
|
11
11
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"NamirasoftCostServerBillWatchGCP.js","sourceRoot":"","sources":["../src/NamirasoftCostServerBillWatchGCP.ts"],"names":[],"mappings":";;;;;;;;;;;;AAsBA,yEAAsE;AAGtE,MAAa,gCAAiC,SAAQ,mDAAwB;IAE1E,YAAY,MAA4B;QAEpC,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjD,CAAC;IACK,UAAU,CAAC,
|
1
|
+
{"version":3,"file":"NamirasoftCostServerBillWatchGCP.js","sourceRoot":"","sources":["../src/NamirasoftCostServerBillWatchGCP.ts"],"names":[],"mappings":";;;;;;;;;;;;AAsBA,yEAAsE;AAGtE,MAAa,gCAAiC,SAAQ,mDAAwB;IAE1E,YAAY,MAA4B;QAEpC,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjD,CAAC;IACK,UAAU,CAAC,IAAyC;;YAEtD,IAAI,IAAI,GAAG,kCAAkC,CAAC;YAC9C,IAAI,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAa,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;YACnE,OAAO,IAAI,CAAC;QAChB,CAAC;KAAA;CACJ;AAbD,4EAaC;AAAA,CAAC"}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { Trial } from "./type/Trial";
|
2
|
+
import { Period } from "./type/Period";
|
3
|
+
export declare class TimeUtil {
|
4
|
+
static trialEndsAt(trial: Trial): Date;
|
5
|
+
static isTrial(trial: Trial, date: Date): boolean;
|
6
|
+
static loopHourly(trial: Trial | null, period: Period, estimate_hour: (period: Period) => void): void;
|
7
|
+
}
|
package/dist/TimeUtil.js
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.TimeUtil = void 0;
|
4
|
+
const namirasoft_core_1 = require("namirasoft-core");
|
5
|
+
const TrialUnit_1 = require("./enum/TrialUnit");
|
6
|
+
class TimeUtil {
|
7
|
+
static trialEndsAt(trial) {
|
8
|
+
if (trial.duration.unit == TrialUnit_1.TrialUnit.Day)
|
9
|
+
return namirasoft_core_1.TimeOperation.daysLater(trial.duration.value, trial.started_at);
|
10
|
+
if (trial.duration.unit == TrialUnit_1.TrialUnit.Week)
|
11
|
+
return namirasoft_core_1.TimeOperation.daysLater(trial.duration.value * 7, trial.started_at);
|
12
|
+
if (trial.duration.unit == TrialUnit_1.TrialUnit.Month)
|
13
|
+
return namirasoft_core_1.TimeOperation.monthsLater(trial.duration.value, trial.started_at);
|
14
|
+
return trial.started_at;
|
15
|
+
}
|
16
|
+
static isTrial(trial, date) {
|
17
|
+
return date <= TimeUtil.trialEndsAt(trial);
|
18
|
+
}
|
19
|
+
static loopHourly(trial, period, estimate_hour) {
|
20
|
+
if (period.end <= period.start)
|
21
|
+
return;
|
22
|
+
if (trial) {
|
23
|
+
let ends_at = TimeUtil.trialEndsAt(trial);
|
24
|
+
if (period.end <= ends_at)
|
25
|
+
return;
|
26
|
+
if (period.start <= ends_at)
|
27
|
+
period.start = ends_at;
|
28
|
+
}
|
29
|
+
let start = period.start;
|
30
|
+
let end = null;
|
31
|
+
do {
|
32
|
+
end = namirasoft_core_1.TimeOperation.hoursLater(1, start);
|
33
|
+
end.setMilliseconds(0);
|
34
|
+
end.setSeconds(0);
|
35
|
+
end.setMinutes(0);
|
36
|
+
if (period.end < end)
|
37
|
+
end = period.end;
|
38
|
+
estimate_hour({ start, end });
|
39
|
+
start = end;
|
40
|
+
} while (end < period.end);
|
41
|
+
}
|
42
|
+
}
|
43
|
+
exports.TimeUtil = TimeUtil;
|
44
|
+
//# sourceMappingURL=TimeUtil.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"TimeUtil.js","sourceRoot":"","sources":["../src/TimeUtil.ts"],"names":[],"mappings":";;;AAAA,qDAAgD;AAGhD,gDAA6C;AAE7C,MAAa,QAAQ;IAEjB,MAAM,CAAC,WAAW,CAAC,KAAY;QAE3B,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,IAAI,qBAAS,CAAC,GAAG;YACpC,OAAO,+BAAa,CAAC,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;QAC3E,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,IAAI,qBAAS,CAAC,IAAI;YACrC,OAAO,+BAAa,CAAC,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,GAAG,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;QAC/E,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,IAAI,qBAAS,CAAC,KAAK;YACtC,OAAO,+BAAa,CAAC,WAAW,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;QAC7E,OAAO,KAAK,CAAC,UAAU,CAAC;IAC5B,CAAC;IACD,MAAM,CAAC,OAAO,CAAC,KAAY,EAAE,IAAU;QAEnC,OAAO,IAAI,IAAI,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAC/C,CAAC;IACD,MAAM,CAAC,UAAU,CAAC,KAAmB,EAAE,MAAc,EAAE,aAAuC;QAE1F,IAAI,MAAM,CAAC,GAAG,IAAI,MAAM,CAAC,KAAK;YAC1B,OAAO;QAEX,IAAI,KAAK,EACT,CAAC;YACG,IAAI,OAAO,GAAG,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;YAC1C,IAAI,MAAM,CAAC,GAAG,IAAI,OAAO;gBACrB,OAAO;YACX,IAAI,MAAM,CAAC,KAAK,IAAI,OAAO;gBACvB,MAAM,CAAC,KAAK,GAAG,OAAO,CAAC;QAC/B,CAAC;QAED,IAAI,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QACzB,IAAI,GAAG,GAAG,IAAI,CAAC;QAEf,GACA,CAAC;YACG,GAAG,GAAG,+BAAa,CAAC,UAAU,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;YACzC,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;YACvB,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;YAClB,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;YAClB,IAAI,MAAM,CAAC,GAAG,GAAG,GAAG;gBAChB,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC;YAErB,aAAa,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;YAC9B,KAAK,GAAG,GAAG,CAAC;QAChB,CAAC,QACM,GAAG,GAAG,MAAM,CAAC,GAAG,EAAC;IAC5B,CAAC;CACJ;AA/CD,4BA+CC"}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.TrialUnit = void 0;
|
4
|
+
var TrialUnit;
|
5
|
+
(function (TrialUnit) {
|
6
|
+
TrialUnit["Day"] = "Day";
|
7
|
+
TrialUnit["Week"] = "Week";
|
8
|
+
TrialUnit["Month"] = "Month";
|
9
|
+
})(TrialUnit || (exports.TrialUnit = TrialUnit = {}));
|
10
|
+
//# sourceMappingURL=TrialUnit.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"TrialUnit.js","sourceRoot":"","sources":["../../src/enum/TrialUnit.ts"],"names":[],"mappings":";;;AAAA,IAAY,SAKX;AALD,WAAY,SAAS;IAEjB,wBAAW,CAAA;IACX,0BAAa,CAAA;IACb,4BAAe,CAAA;AACnB,CAAC,EALW,SAAS,yBAAT,SAAS,QAKpB"}
|
package/dist/index.d.ts
CHANGED
@@ -23,6 +23,10 @@ export * from "./meta/CostMetaTable";
|
|
23
23
|
export * from "./meta/NamirasoftCostMetaDatabase";
|
24
24
|
export * from "./row/CostCreateRow";
|
25
25
|
export * from "./row/CostRow";
|
26
|
-
export * from "./
|
27
|
-
export * from "./
|
28
|
-
export * from "./
|
26
|
+
export * from "./enum/TrialUnit";
|
27
|
+
export * from "./type/Estimation";
|
28
|
+
export * from "./type/EstimationRow";
|
29
|
+
export * from "./type/Period";
|
30
|
+
export * from "./type/Trial";
|
31
|
+
export * from "./type/TrialDuration";
|
32
|
+
export * from "./TimeUtil";
|
package/dist/index.js
CHANGED
@@ -39,7 +39,11 @@ __exportStar(require("./meta/CostMetaTable"), exports);
|
|
39
39
|
__exportStar(require("./meta/NamirasoftCostMetaDatabase"), exports);
|
40
40
|
__exportStar(require("./row/CostCreateRow"), exports);
|
41
41
|
__exportStar(require("./row/CostRow"), exports);
|
42
|
-
__exportStar(require("./
|
43
|
-
__exportStar(require("./
|
44
|
-
__exportStar(require("./
|
42
|
+
__exportStar(require("./enum/TrialUnit"), exports);
|
43
|
+
__exportStar(require("./type/Estimation"), exports);
|
44
|
+
__exportStar(require("./type/EstimationRow"), exports);
|
45
|
+
__exportStar(require("./type/Period"), exports);
|
46
|
+
__exportStar(require("./type/Trial"), exports);
|
47
|
+
__exportStar(require("./type/TrialDuration"), exports);
|
48
|
+
__exportStar(require("./TimeUtil"), exports);
|
45
49
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAoBA,yDAAuC;AACvC,6DAA2C;AAC3C,qEAAmD;AACnD,uEAAqD;AACrD,qEAAmD;AACnD,6DAA2C;AAC3C,gEAA8C;AAC9C,8DAA4C;AAC5C,gEAA8C;AAC9C,0EAAwD;AACxD,kEAAgD;AAChD,4EAA0D;AAC1D,gEAA8C;AAC9C,0EAAwD;AACxD,wDAAsC;AACtC,4DAA0C;AAC1C,kEAAgD;AAChD,2DAAyC;AACzC,8DAA4C;AAC5C,yDAAuC;AACvC,6DAA2C;AAC3C,uDAAqC;AACrC,oEAAkD;AAClD,sDAAoC;AACpC,gDAA8B;AAC9B,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAoBA,yDAAuC;AACvC,6DAA2C;AAC3C,qEAAmD;AACnD,uEAAqD;AACrD,qEAAmD;AACnD,6DAA2C;AAC3C,gEAA8C;AAC9C,8DAA4C;AAC5C,gEAA8C;AAC9C,0EAAwD;AACxD,kEAAgD;AAChD,4EAA0D;AAC1D,gEAA8C;AAC9C,0EAAwD;AACxD,wDAAsC;AACtC,4DAA0C;AAC1C,kEAAgD;AAChD,2DAAyC;AACzC,8DAA4C;AAC5C,yDAAuC;AACvC,6DAA2C;AAC3C,uDAAqC;AACrC,oEAAkD;AAClD,sDAAoC;AACpC,gDAA8B;AAC9B,mDAAiC;AACjC,oDAAkC;AAClC,uDAAqC;AACrC,gDAA8B;AAC9B,+CAA6B;AAC7B,uDAAqC;AACrC,6CAA2B"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Estimation.js","sourceRoot":"","sources":["../../src/type/Estimation.ts"],"names":[],"mappings":""}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"EstimationRow.js","sourceRoot":"","sources":["../../src/
|
1
|
+
{"version":3,"file":"EstimationRow.js","sourceRoot":"","sources":["../../src/type/EstimationRow.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Period.js","sourceRoot":"","sources":["../../src/type/Period.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Trial.js","sourceRoot":"","sources":["../../src/type/Trial.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"TrialDuration.js","sourceRoot":"","sources":["../../src/type/TrialDuration.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
@@ -18,10 +18,10 @@
|
|
18
18
|
/* */
|
19
19
|
/****************************************************************/
|
20
20
|
|
21
|
-
import {
|
21
|
+
import { Estimation } from "./type/Estimation";
|
22
22
|
import { NamirasoftCostServer } from "./NamirasoftCostServer";
|
23
23
|
import { NamirasoftCostServerBase } from "./NamirasoftCostServerBase";
|
24
|
-
import {
|
24
|
+
import { Period } from "./type/Period";
|
25
25
|
|
26
26
|
export class NamirasoftCostServerBillWatchAWS extends NamirasoftCostServerBase
|
27
27
|
{
|
@@ -30,10 +30,10 @@ export class NamirasoftCostServerBillWatchAWS extends NamirasoftCostServerBase
|
|
30
30
|
super(server);
|
31
31
|
this.Estimation = this.Estimation.bind(this);
|
32
32
|
}
|
33
|
-
async Estimation(body: { period:
|
33
|
+
async Estimation(body: { period: Period, active: boolean }): Promise<Estimation>
|
34
34
|
{
|
35
35
|
let path = `/estimation/bill-watch/watch/aws`;
|
36
|
-
let { data } = await this.server._post<
|
36
|
+
let { data } = await this.server._post<Estimation>(path, {}, body);
|
37
37
|
return data;
|
38
38
|
}
|
39
39
|
};
|
@@ -18,10 +18,10 @@
|
|
18
18
|
/* */
|
19
19
|
/****************************************************************/
|
20
20
|
|
21
|
-
import {
|
21
|
+
import { Estimation } from "./type/Estimation";
|
22
22
|
import { NamirasoftCostServer } from "./NamirasoftCostServer";
|
23
23
|
import { NamirasoftCostServerBase } from "./NamirasoftCostServerBase";
|
24
|
-
import {
|
24
|
+
import { Period } from "./type/Period";
|
25
25
|
|
26
26
|
export class NamirasoftCostServerBillWatchAzure extends NamirasoftCostServerBase
|
27
27
|
{
|
@@ -30,10 +30,10 @@ export class NamirasoftCostServerBillWatchAzure extends NamirasoftCostServerBase
|
|
30
30
|
super(server);
|
31
31
|
this.Estimation = this.Estimation.bind(this);
|
32
32
|
}
|
33
|
-
async Estimation(body: { period:
|
33
|
+
async Estimation(body: { period: Period, active: boolean }): Promise<Estimation>
|
34
34
|
{
|
35
35
|
let path = `/estimation/bill-watch/watch/azure`;
|
36
|
-
let { data } = await this.server._post<
|
36
|
+
let { data } = await this.server._post<Estimation>(path, {}, body);
|
37
37
|
return data;
|
38
38
|
}
|
39
39
|
};
|
@@ -18,10 +18,10 @@
|
|
18
18
|
/* */
|
19
19
|
/****************************************************************/
|
20
20
|
|
21
|
-
import {
|
21
|
+
import { Estimation } from "./type/Estimation";
|
22
22
|
import { NamirasoftCostServer } from "./NamirasoftCostServer";
|
23
23
|
import { NamirasoftCostServerBase } from "./NamirasoftCostServerBase";
|
24
|
-
import {
|
24
|
+
import { Period } from "./type/Period";
|
25
25
|
|
26
26
|
export class NamirasoftCostServerBillWatchGCP extends NamirasoftCostServerBase
|
27
27
|
{
|
@@ -30,10 +30,10 @@ export class NamirasoftCostServerBillWatchGCP extends NamirasoftCostServerBase
|
|
30
30
|
super(server);
|
31
31
|
this.Estimation = this.Estimation.bind(this);
|
32
32
|
}
|
33
|
-
async Estimation(body: { period:
|
33
|
+
async Estimation(body: { period: Period, active: boolean }): Promise<Estimation>
|
34
34
|
{
|
35
35
|
let path = `/estimation/bill-watch/watch/gcp`;
|
36
|
-
let { data } = await this.server._post<
|
36
|
+
let { data } = await this.server._post<Estimation>(path, {}, body);
|
37
37
|
return data;
|
38
38
|
}
|
39
39
|
};
|
package/src/TimeUtil.ts
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
import { TimeOperation } from "namirasoft-core";
|
2
|
+
import { Trial } from "./type/Trial";
|
3
|
+
import { Period } from "./type/Period";
|
4
|
+
import { TrialUnit } from "./enum/TrialUnit";
|
5
|
+
|
6
|
+
export class TimeUtil
|
7
|
+
{
|
8
|
+
static trialEndsAt(trial: Trial)
|
9
|
+
{
|
10
|
+
if (trial.duration.unit == TrialUnit.Day)
|
11
|
+
return TimeOperation.daysLater(trial.duration.value, trial.started_at);
|
12
|
+
if (trial.duration.unit == TrialUnit.Week)
|
13
|
+
return TimeOperation.daysLater(trial.duration.value * 7, trial.started_at);
|
14
|
+
if (trial.duration.unit == TrialUnit.Month)
|
15
|
+
return TimeOperation.monthsLater(trial.duration.value, trial.started_at);
|
16
|
+
return trial.started_at;
|
17
|
+
}
|
18
|
+
static isTrial(trial: Trial, date: Date)
|
19
|
+
{
|
20
|
+
return date <= TimeUtil.trialEndsAt(trial);
|
21
|
+
}
|
22
|
+
static loopHourly(trial: Trial | null, period: Period, estimate_hour: (period: Period) => void)
|
23
|
+
{
|
24
|
+
if (period.end <= period.start)
|
25
|
+
return;
|
26
|
+
|
27
|
+
if (trial)
|
28
|
+
{
|
29
|
+
let ends_at = TimeUtil.trialEndsAt(trial);
|
30
|
+
if (period.end <= ends_at)
|
31
|
+
return;
|
32
|
+
if (period.start <= ends_at)
|
33
|
+
period.start = ends_at;
|
34
|
+
}
|
35
|
+
|
36
|
+
let start = period.start;
|
37
|
+
let end = null;
|
38
|
+
|
39
|
+
do
|
40
|
+
{
|
41
|
+
end = TimeOperation.hoursLater(1, start);
|
42
|
+
end.setMilliseconds(0);
|
43
|
+
end.setSeconds(0);
|
44
|
+
end.setMinutes(0);
|
45
|
+
if (period.end < end)
|
46
|
+
end = period.end;
|
47
|
+
|
48
|
+
estimate_hour({ start, end });
|
49
|
+
start = end;
|
50
|
+
}
|
51
|
+
while (end < period.end)
|
52
|
+
}
|
53
|
+
}
|
package/src/index.ts
CHANGED
@@ -43,6 +43,10 @@ export * from "./meta/CostMetaTable";
|
|
43
43
|
export * from "./meta/NamirasoftCostMetaDatabase";
|
44
44
|
export * from "./row/CostCreateRow";
|
45
45
|
export * from "./row/CostRow";
|
46
|
-
export * from "./
|
47
|
-
export * from "./
|
48
|
-
export * from "./
|
46
|
+
export * from "./enum/TrialUnit";
|
47
|
+
export * from "./type/Estimation";
|
48
|
+
export * from "./type/EstimationRow";
|
49
|
+
export * from "./type/Period";
|
50
|
+
export * from "./type/Trial";
|
51
|
+
export * from "./type/TrialDuration";
|
52
|
+
export * from "./TimeUtil";
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"EstimationRowRow.js","sourceRoot":"","sources":["../../src/row/EstimationRowRow.ts"],"names":[],"mappings":""}
|
package/dist/row/PeriodRow.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"PeriodRow.js","sourceRoot":"","sources":["../../src/row/PeriodRow.ts"],"names":[],"mappings":""}
|
package/src/row/EstimationRow.ts
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
/****************************************************************/
|
2
|
-
/* */
|
3
|
-
/* This is an Auto-Generated File */
|
4
|
-
/* Made By */
|
5
|
-
/* Namirasoft SDK Generator NPM Package */
|
6
|
-
/* */
|
7
|
-
/****************************************************************/
|
8
|
-
/****************************************************************/
|
9
|
-
/* */
|
10
|
-
/* Please do not make any change to this file */
|
11
|
-
/* If any change is required, ns-sdkg command must be used */
|
12
|
-
/* */
|
13
|
-
/****************************************************************/
|
14
|
-
/****************************************************************/
|
15
|
-
/* */
|
16
|
-
/* Namira Software Corporation */
|
17
|
-
/* https://namirasoft.com */
|
18
|
-
/* */
|
19
|
-
/****************************************************************/
|
20
|
-
|
21
|
-
import { EstimationRowRow } from "./EstimationRowRow";
|
22
|
-
|
23
|
-
export type EstimationRow =
|
24
|
-
{
|
25
|
-
sum: number;
|
26
|
-
rows: EstimationRowRow[];
|
27
|
-
}
|
@@ -1,27 +0,0 @@
|
|
1
|
-
/****************************************************************/
|
2
|
-
/* */
|
3
|
-
/* This is an Auto-Generated File */
|
4
|
-
/* Made By */
|
5
|
-
/* Namirasoft SDK Generator NPM Package */
|
6
|
-
/* */
|
7
|
-
/****************************************************************/
|
8
|
-
/****************************************************************/
|
9
|
-
/* */
|
10
|
-
/* Please do not make any change to this file */
|
11
|
-
/* If any change is required, ns-sdkg command must be used */
|
12
|
-
/* */
|
13
|
-
/****************************************************************/
|
14
|
-
/****************************************************************/
|
15
|
-
/* */
|
16
|
-
/* Namira Software Corporation */
|
17
|
-
/* https://namirasoft.com */
|
18
|
-
/* */
|
19
|
-
/****************************************************************/
|
20
|
-
|
21
|
-
import { PeriodRow } from "./PeriodRow";
|
22
|
-
|
23
|
-
export type EstimationRowRow =
|
24
|
-
{
|
25
|
-
period: PeriodRow;
|
26
|
-
amount: number;
|
27
|
-
}
|
package/src/row/PeriodRow.ts
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
/****************************************************************/
|
2
|
-
/* */
|
3
|
-
/* This is an Auto-Generated File */
|
4
|
-
/* Made By */
|
5
|
-
/* Namirasoft SDK Generator NPM Package */
|
6
|
-
/* */
|
7
|
-
/****************************************************************/
|
8
|
-
/****************************************************************/
|
9
|
-
/* */
|
10
|
-
/* Please do not make any change to this file */
|
11
|
-
/* If any change is required, ns-sdkg command must be used */
|
12
|
-
/* */
|
13
|
-
/****************************************************************/
|
14
|
-
/****************************************************************/
|
15
|
-
/* */
|
16
|
-
/* Namira Software Corporation */
|
17
|
-
/* https://namirasoft.com */
|
18
|
-
/* */
|
19
|
-
/****************************************************************/
|
20
|
-
|
21
|
-
export type PeriodRow =
|
22
|
-
{
|
23
|
-
start: string;
|
24
|
-
end: string;
|
25
|
-
}
|
File without changes
|