namirasoft-cost 1.4.20 → 1.4.22
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 -2
- package/.ns-sdkg-file-keep +21 -5
- package/dist/NamirasoftCostServer.d.ts +2 -0
- package/dist/NamirasoftCostServer.js +3 -1
- package/dist/NamirasoftCostServer.js.map +1 -1
- package/dist/NamirasoftCostServerBillWatchAWS.d.ts +4 -4
- package/dist/NamirasoftCostServerBillWatchAWS.js +6 -6
- package/dist/NamirasoftCostServerBillWatchAWS.js.map +1 -1
- package/dist/NamirasoftCostServerBillWatchAzure.d.ts +4 -4
- package/dist/NamirasoftCostServerBillWatchAzure.js +6 -6
- package/dist/NamirasoftCostServerBillWatchAzure.js.map +1 -1
- package/dist/NamirasoftCostServerBillWatchGCP.d.ts +4 -4
- package/dist/NamirasoftCostServerBillWatchGCP.js +6 -6
- package/dist/NamirasoftCostServerBillWatchGCP.js.map +1 -1
- package/dist/NamirasoftCostServerFieldCategory.d.ts +4 -4
- package/dist/NamirasoftCostServerFieldCategory.js +6 -6
- package/dist/NamirasoftCostServerFieldCategory.js.map +1 -1
- package/dist/NamirasoftCostServerFieldField.d.ts +4 -4
- package/dist/NamirasoftCostServerFieldField.js +6 -6
- package/dist/NamirasoftCostServerFieldField.js.map +1 -1
- package/dist/NamirasoftCostServerSecretSecret.d.ts +36 -0
- package/dist/NamirasoftCostServerSecretSecret.js +53 -0
- package/dist/NamirasoftCostServerSecretSecret.js.map +1 -0
- package/dist/bonus/BaseBonus.d.ts +13 -0
- package/dist/bonus/BaseBonus.js +11 -0
- package/dist/bonus/BaseBonus.js.map +1 -0
- package/dist/bonus/DeactiveBonus.d.ts +10 -0
- package/dist/bonus/DeactiveBonus.js +27 -0
- package/dist/bonus/DeactiveBonus.js.map +1 -0
- package/dist/bonus/FreeCountBonus.d.ts +10 -0
- package/dist/bonus/FreeCountBonus.js +27 -0
- package/dist/bonus/FreeCountBonus.js.map +1 -0
- package/dist/bonus/FreeTotalValueBonus.d.ts +33 -0
- package/dist/bonus/FreeTotalValueBonus.js +39 -0
- package/dist/bonus/FreeTotalValueBonus.js.map +1 -0
- package/dist/bonus/LowAmountBonus.d.ts +10 -0
- package/dist/bonus/LowAmountBonus.js +27 -0
- package/dist/bonus/LowAmountBonus.js.map +1 -0
- package/dist/bonus/LowSecondsBonus.d.ts +10 -0
- package/dist/bonus/LowSecondsBonus.js +27 -0
- package/dist/bonus/LowSecondsBonus.js.map +1 -0
- package/dist/bonus/LowTotalCountBonus.d.ts +10 -0
- package/dist/bonus/LowTotalCountBonus.js +27 -0
- package/dist/bonus/LowTotalCountBonus.js.map +1 -0
- package/dist/bonus/LowTotalValueBonus.d.ts +10 -0
- package/dist/bonus/LowTotalValueBonus.js +27 -0
- package/dist/bonus/LowTotalValueBonus.js.map +1 -0
- package/dist/bonus/TrialBonus.d.ts +12 -0
- package/dist/bonus/TrialBonus.js +32 -0
- package/dist/bonus/TrialBonus.js.map +1 -0
- package/dist/command/BillWatchAWSCommand.js +4 -4
- package/dist/command/BillWatchAWSCommand.js.map +1 -1
- package/dist/command/{BillWatchAWS_CreateForCommand.d.ts → BillWatchAWSEstimateHourlyCommand.d.ts} +1 -1
- package/dist/command/{BillWatchGCPEstimationCommand.js → BillWatchAWSEstimateHourlyCommand.js} +15 -15
- package/dist/command/BillWatchAWSEstimateHourlyCommand.js.map +1 -0
- package/dist/command/BillWatchAWS_CreateForHourlyCommand.d.ts +5 -0
- package/dist/command/{BillWatchAWS_CreateForCommand.js → BillWatchAWS_CreateForHourlyCommand.js} +14 -14
- package/dist/command/BillWatchAWS_CreateForHourlyCommand.js.map +1 -0
- package/dist/command/BillWatchAzureCommand.js +4 -4
- package/dist/command/BillWatchAzureCommand.js.map +1 -1
- package/dist/command/BillWatchAzureEstimateHourlyCommand.d.ts +5 -0
- package/dist/command/BillWatchAzureEstimateHourlyCommand.js +76 -0
- package/dist/command/BillWatchAzureEstimateHourlyCommand.js.map +1 -0
- package/dist/command/BillWatchAzure_CreateForHourlyCommand.d.ts +5 -0
- package/dist/command/BillWatchAzure_CreateForHourlyCommand.js +94 -0
- package/dist/command/BillWatchAzure_CreateForHourlyCommand.js.map +1 -0
- package/dist/command/BillWatchGCPCommand.js +4 -4
- package/dist/command/BillWatchGCPCommand.js.map +1 -1
- package/dist/command/{BillWatchAWSEstimationCommand.d.ts → BillWatchGCPEstimateHourlyCommand.d.ts} +1 -1
- package/dist/command/{FieldCategoryEstimationCommand.js → BillWatchGCPEstimateHourlyCommand.js} +15 -15
- package/dist/command/BillWatchGCPEstimateHourlyCommand.js.map +1 -0
- package/dist/command/BillWatchGCP_CreateForHourlyCommand.d.ts +5 -0
- package/dist/command/{FieldCategory_CreateForCommand.js → BillWatchGCP_CreateForHourlyCommand.js} +14 -14
- package/dist/command/BillWatchGCP_CreateForHourlyCommand.js.map +1 -0
- package/dist/command/FieldCategoryCommand.js +4 -4
- package/dist/command/FieldCategoryCommand.js.map +1 -1
- package/dist/command/FieldCategoryEstimateHourlyCommand.d.ts +5 -0
- package/dist/command/FieldCategoryEstimateHourlyCommand.js +76 -0
- package/dist/command/FieldCategoryEstimateHourlyCommand.js.map +1 -0
- package/dist/command/FieldCategory_CreateForHourlyCommand.d.ts +5 -0
- package/dist/command/FieldCategory_CreateForHourlyCommand.js +94 -0
- package/dist/command/FieldCategory_CreateForHourlyCommand.js.map +1 -0
- package/dist/command/FieldFieldCommand.js +4 -4
- package/dist/command/FieldFieldCommand.js.map +1 -1
- package/dist/command/{BillWatchAzure_CreateForCommand.d.ts → FieldFieldEstimateHourlyCommand.d.ts} +1 -1
- package/dist/command/{BillWatchAzureEstimationCommand.js → FieldFieldEstimateHourlyCommand.js} +15 -15
- package/dist/command/{BillWatchAzureEstimationCommand.js.map → FieldFieldEstimateHourlyCommand.js.map} +1 -1
- package/dist/command/FieldField_CreateForHourlyCommand.d.ts +5 -0
- package/dist/command/{BillWatchGCP_CreateForCommand.js → FieldField_CreateForHourlyCommand.js} +14 -14
- package/dist/command/FieldField_CreateForHourlyCommand.js.map +1 -0
- package/dist/command/SecretSecretCommand.d.ts +4 -0
- package/dist/command/SecretSecretCommand.js +21 -0
- package/dist/command/SecretSecretCommand.js.map +1 -0
- package/dist/command/SecretSecretEstimateHourlyCommand.d.ts +5 -0
- package/dist/command/{BillWatchAWSEstimationCommand.js → SecretSecretEstimateHourlyCommand.js} +15 -15
- package/dist/command/SecretSecretEstimateHourlyCommand.js.map +1 -0
- package/dist/command/{BillWatchAzureEstimationCommand.d.ts → SecretSecretEstimateReadCommand.d.ts} +1 -1
- package/dist/command/{FieldFieldEstimationCommand.js → SecretSecretEstimateReadCommand.js} +17 -17
- package/dist/command/SecretSecretEstimateReadCommand.js.map +1 -0
- package/dist/command/SecretSecret_CreateForHourlyCommand.d.ts +5 -0
- package/dist/command/{BillWatchAzure_CreateForCommand.js → SecretSecret_CreateForHourlyCommand.js} +14 -14
- package/dist/command/SecretSecret_CreateForHourlyCommand.js.map +1 -0
- package/dist/command/SecretSecret_CreateForReadCommand.d.ts +5 -0
- package/dist/command/{FieldField_CreateForCommand.js → SecretSecret_CreateForReadCommand.js} +16 -16
- package/dist/command/SecretSecret_CreateForReadCommand.js.map +1 -0
- package/dist/command/cli.js +2 -0
- package/dist/command/cli.js.map +1 -1
- package/dist/estimator/BaseEstimator.d.ts +15 -0
- package/dist/estimator/BaseEstimator.js +58 -0
- package/dist/estimator/BaseEstimator.js.map +1 -0
- package/dist/estimator/BillWatchAWSHourlyEstimator.d.ts +3 -0
- package/dist/estimator/BillWatchAWSHourlyEstimator.js +8 -0
- package/dist/estimator/BillWatchAWSHourlyEstimator.js.map +1 -0
- package/dist/estimator/BillWatchAzureHourlyEstimator.d.ts +3 -0
- package/dist/estimator/BillWatchAzureHourlyEstimator.js +8 -0
- package/dist/estimator/BillWatchAzureHourlyEstimator.js.map +1 -0
- package/dist/estimator/BillWatchBaseHourlyEstimator.d.ts +14 -0
- package/dist/estimator/BillWatchBaseHourlyEstimator.js +26 -0
- package/dist/estimator/BillWatchBaseHourlyEstimator.js.map +1 -0
- package/dist/estimator/BillWatchGCPHourlyEstimator.d.ts +3 -0
- package/dist/estimator/BillWatchGCPHourlyEstimator.js +8 -0
- package/dist/estimator/BillWatchGCPHourlyEstimator.js.map +1 -0
- package/dist/estimator/FieldBaseHourlyEstimator.d.ts +9 -0
- package/dist/estimator/FieldBaseHourlyEstimator.js +22 -0
- package/dist/estimator/FieldBaseHourlyEstimator.js.map +1 -0
- package/dist/estimator/FieldCategoryHourlyEstimator.d.ts +8 -0
- package/dist/estimator/FieldCategoryHourlyEstimator.js +12 -0
- package/dist/estimator/FieldCategoryHourlyEstimator.js.map +1 -0
- package/dist/estimator/FieldFieldHourlyEstimator.d.ts +8 -0
- package/dist/estimator/FieldFieldHourlyEstimator.js +12 -0
- package/dist/estimator/FieldFieldHourlyEstimator.js.map +1 -0
- package/dist/estimator/SecretSecretHourlyEstimator.d.ts +14 -0
- package/dist/estimator/SecretSecretHourlyEstimator.js +25 -0
- package/dist/estimator/SecretSecretHourlyEstimator.js.map +1 -0
- package/dist/estimator/SecretSecretReadEstimator.d.ts +14 -0
- package/dist/estimator/SecretSecretReadEstimator.js +25 -0
- package/dist/estimator/SecretSecretReadEstimator.js.map +1 -0
- package/dist/index.d.ts +16 -15
- package/dist/index.js +16 -15
- package/dist/index.js.map +1 -1
- package/dist/type/Estimation.d.ts +10 -3
- package/dist/type/EstimationOption.d.ts +10 -0
- package/dist/type/{EstimationRow.js → EstimationOption.js} +2 -1
- package/dist/type/EstimationOption.js.map +1 -0
- package/dist/type/Period.d.ts +20 -2
- package/dist/type/Period.js +61 -0
- package/dist/type/Period.js.map +1 -1
- package/dist/type/Usage.d.ts +24 -0
- package/dist/type/Usage.js +30 -0
- package/dist/type/Usage.js.map +1 -0
- package/package.json +2 -2
- package/src/NamirasoftCostServer.ts +4 -1
- package/src/NamirasoftCostServerBillWatchAWS.ts +6 -6
- package/src/NamirasoftCostServerBillWatchAzure.ts +6 -6
- package/src/NamirasoftCostServerBillWatchGCP.ts +6 -6
- package/src/NamirasoftCostServerFieldCategory.ts +6 -6
- package/src/NamirasoftCostServerFieldField.ts +6 -6
- package/src/NamirasoftCostServerSecretSecret.ts +61 -0
- package/src/bonus/BaseBonus.ts +14 -0
- package/src/bonus/DeactiveBonus.ts +15 -0
- package/src/bonus/FreeCountBonus.ts +15 -0
- package/src/bonus/FreeTotalValueBonus.ts +29 -0
- package/src/bonus/LowAmountBonus.ts +15 -0
- package/src/bonus/LowSecondsBonus.ts +15 -0
- package/src/bonus/LowTotalCountBonus.ts +15 -0
- package/src/bonus/LowTotalValueBonus.ts +15 -0
- package/src/bonus/TrialBonus.ts +19 -0
- package/src/command/BillWatchAWSCommand.ts +4 -4
- package/src/command/{FieldCategoryEstimationCommand.ts → BillWatchAWSEstimateHourlyCommand.ts} +12 -12
- package/src/command/{BillWatchAzure_CreateForCommand.ts → BillWatchAWS_CreateForHourlyCommand.ts} +11 -11
- package/src/command/BillWatchAzureCommand.ts +4 -4
- package/src/command/BillWatchAzureEstimateHourlyCommand.ts +83 -0
- package/src/command/BillWatchAzure_CreateForHourlyCommand.ts +101 -0
- package/src/command/BillWatchGCPCommand.ts +4 -4
- package/src/command/{BillWatchGCPEstimationCommand.ts → BillWatchGCPEstimateHourlyCommand.ts} +12 -12
- package/src/command/{FieldCategory_CreateForCommand.ts → BillWatchGCP_CreateForHourlyCommand.ts} +11 -11
- package/src/command/FieldCategoryCommand.ts +4 -4
- package/src/command/FieldCategoryEstimateHourlyCommand.ts +83 -0
- package/src/command/FieldCategory_CreateForHourlyCommand.ts +101 -0
- package/src/command/FieldFieldCommand.ts +4 -4
- package/src/command/{BillWatchAzureEstimationCommand.ts → FieldFieldEstimateHourlyCommand.ts} +12 -12
- package/src/command/{BillWatchGCP_CreateForCommand.ts → FieldField_CreateForHourlyCommand.ts} +11 -11
- package/src/command/SecretSecretCommand.ts +38 -0
- package/src/command/{BillWatchAWSEstimationCommand.ts → SecretSecretEstimateHourlyCommand.ts} +12 -12
- package/src/command/{FieldFieldEstimationCommand.ts → SecretSecretEstimateReadCommand.ts} +14 -14
- package/src/command/{BillWatchAWS_CreateForCommand.ts → SecretSecret_CreateForHourlyCommand.ts} +11 -11
- package/src/command/{FieldField_CreateForCommand.ts → SecretSecret_CreateForReadCommand.ts} +13 -13
- package/src/command/cli.ts +2 -0
- package/src/estimator/BaseEstimator.ts +63 -0
- package/src/estimator/BillWatchAWSHourlyEstimator.ts +5 -0
- package/src/estimator/BillWatchAzureHourlyEstimator.ts +5 -0
- package/src/estimator/BillWatchBaseHourlyEstimator.ts +26 -0
- package/src/estimator/BillWatchGCPHourlyEstimator.ts +5 -0
- package/src/estimator/FieldBaseHourlyEstimator.ts +21 -0
- package/src/estimator/FieldCategoryHourlyEstimator.ts +10 -0
- package/src/estimator/FieldFieldHourlyEstimator.ts +10 -0
- package/src/estimator/SecretSecretHourlyEstimator.ts +25 -0
- package/src/estimator/SecretSecretReadEstimator.ts +26 -0
- package/src/index.ts +17 -16
- package/src/type/Estimation.ts +10 -3
- package/src/type/EstimationOption.ts +12 -0
- package/src/type/Period.ts +72 -3
- package/src/type/Usage.ts +25 -0
- package/dist/TimeUtil.d.ts +0 -7
- package/dist/TimeUtil.js +0 -66
- package/dist/TimeUtil.js.map +0 -1
- package/dist/command/BillWatchAWSEstimationCommand.js.map +0 -1
- package/dist/command/BillWatchAWS_CreateForCommand.js.map +0 -1
- package/dist/command/BillWatchAzure_CreateForCommand.js.map +0 -1
- package/dist/command/BillWatchGCPEstimationCommand.d.ts +0 -5
- package/dist/command/BillWatchGCPEstimationCommand.js.map +0 -1
- package/dist/command/BillWatchGCP_CreateForCommand.d.ts +0 -5
- package/dist/command/BillWatchGCP_CreateForCommand.js.map +0 -1
- package/dist/command/FieldCategoryEstimationCommand.d.ts +0 -5
- package/dist/command/FieldCategoryEstimationCommand.js.map +0 -1
- package/dist/command/FieldCategory_CreateForCommand.d.ts +0 -5
- package/dist/command/FieldCategory_CreateForCommand.js.map +0 -1
- package/dist/command/FieldFieldEstimationCommand.d.ts +0 -5
- package/dist/command/FieldFieldEstimationCommand.js.map +0 -1
- package/dist/command/FieldField_CreateForCommand.d.ts +0 -5
- package/dist/command/FieldField_CreateForCommand.js.map +0 -1
- package/dist/enum/TrialUnit.d.ts +0 -5
- package/dist/enum/TrialUnit.js +0 -10
- package/dist/enum/TrialUnit.js.map +0 -1
- package/dist/type/EstimationRow.d.ts +0 -9
- package/dist/type/EstimationRow.js.map +0 -1
- package/dist/type/Trial.d.ts +0 -5
- package/dist/type/Trial.js +0 -3
- package/dist/type/Trial.js.map +0 -1
- package/dist/type/TrialDuration.d.ts +0 -5
- package/dist/type/TrialDuration.js +0 -3
- package/dist/type/TrialDuration.js.map +0 -1
- package/src/TimeUtil.ts +0 -67
- package/src/enum/TrialUnit.ts +0 -6
- package/src/type/EstimationRow.ts +0 -10
- package/src/type/Trial.ts +0 -7
- package/src/type/TrialDuration.ts +0 -7
@@ -23,7 +23,7 @@ import { IStorageMemoryDedicated } from "namirasoft-core";
|
|
23
23
|
import { NamirasoftCostServer } from "../NamirasoftCostServer";
|
24
24
|
import { TokenManager } from "namirasoft-account";
|
25
25
|
|
26
|
-
export class
|
26
|
+
export class SecretSecretEstimateReadCommand extends BaseFinalCommand
|
27
27
|
{
|
28
28
|
constructor(argv: string[])
|
29
29
|
{
|
@@ -37,27 +37,27 @@ export class FieldFieldEstimationCommand extends BaseFinalCommand
|
|
37
37
|
defaults: [""]
|
38
38
|
},
|
39
39
|
{
|
40
|
-
name: "
|
40
|
+
name: "period",
|
41
41
|
short: "",
|
42
|
-
description: "Provides the value of '
|
42
|
+
description: "Provides the value of 'period' in body",
|
43
43
|
optional: false,
|
44
|
-
args: ["
|
44
|
+
args: ["period"],
|
45
45
|
defaults: [""]
|
46
46
|
},
|
47
47
|
{
|
48
|
-
name: "
|
48
|
+
name: "total",
|
49
49
|
short: "",
|
50
|
-
description: "Provides the value of '
|
50
|
+
description: "Provides the value of 'total' in body",
|
51
51
|
optional: false,
|
52
|
-
args: ["
|
52
|
+
args: ["total"],
|
53
53
|
defaults: [""]
|
54
54
|
},
|
55
55
|
{
|
56
|
-
name: "
|
56
|
+
name: "count",
|
57
57
|
short: "",
|
58
|
-
description: "Provides the value of '
|
58
|
+
description: "Provides the value of 'count' in body",
|
59
59
|
optional: false,
|
60
|
-
args: ["
|
60
|
+
args: ["count"],
|
61
61
|
defaults: [""]
|
62
62
|
}
|
63
63
|
]);
|
@@ -72,11 +72,11 @@ export class FieldFieldEstimationCommand extends BaseFinalCommand
|
|
72
72
|
manager.setValue(token, false);
|
73
73
|
let url = this.app.storage.getItem("ns-cost-server-url");
|
74
74
|
let server = new NamirasoftCostServer(url, manager, e => this.app.logger.error(e.message));
|
75
|
-
let ans = await server.
|
75
|
+
let ans = await server.secret_secret.EstimateRead({
|
76
76
|
first_entity_created_at: this.option_values.first_entity_created_at,
|
77
|
-
|
78
|
-
|
79
|
-
|
77
|
+
period: this.option_values.period,
|
78
|
+
total: this.option_values.total,
|
79
|
+
count: this.option_values.count
|
80
80
|
});
|
81
81
|
this.app.logger.success(JSON.stringify(ans));
|
82
82
|
}
|
package/src/command/{BillWatchAWS_CreateForCommand.ts → SecretSecret_CreateForHourlyCommand.ts}
RENAMED
@@ -23,7 +23,7 @@ import { IStorageMemoryDedicated } from "namirasoft-core";
|
|
23
23
|
import { NamirasoftCostServer } from "../NamirasoftCostServer";
|
24
24
|
import { TokenManager } from "namirasoft-account";
|
25
25
|
|
26
|
-
export class
|
26
|
+
export class SecretSecret_CreateForHourlyCommand extends BaseFinalCommand
|
27
27
|
{
|
28
28
|
constructor(argv: string[])
|
29
29
|
{
|
@@ -36,6 +36,14 @@ export class BillWatchAWS_CreateForCommand extends BaseFinalCommand
|
|
36
36
|
args: ["first_entity_created_at"],
|
37
37
|
defaults: [""]
|
38
38
|
},
|
39
|
+
{
|
40
|
+
name: "period",
|
41
|
+
short: "",
|
42
|
+
description: "Provides the value of 'period' in body",
|
43
|
+
optional: false,
|
44
|
+
args: ["period"],
|
45
|
+
defaults: [""]
|
46
|
+
},
|
39
47
|
{
|
40
48
|
name: "row_number",
|
41
49
|
short: "",
|
@@ -52,14 +60,6 @@ export class BillWatchAWS_CreateForCommand extends BaseFinalCommand
|
|
52
60
|
args: ["active"],
|
53
61
|
defaults: [""]
|
54
62
|
},
|
55
|
-
{
|
56
|
-
name: "period",
|
57
|
-
short: "",
|
58
|
-
description: "Provides the value of 'period' in body",
|
59
|
-
optional: false,
|
60
|
-
args: ["period"],
|
61
|
-
defaults: [""]
|
62
|
-
},
|
63
63
|
{
|
64
64
|
name: "workspace_id",
|
65
65
|
short: "",
|
@@ -88,11 +88,11 @@ export class BillWatchAWS_CreateForCommand extends BaseFinalCommand
|
|
88
88
|
manager.setValue(token, false);
|
89
89
|
let url = this.app.storage.getItem("ns-cost-server-url");
|
90
90
|
let server = new NamirasoftCostServer(url, manager, e => this.app.logger.error(e.message));
|
91
|
-
let ans = await server.
|
91
|
+
let ans = await server.secret_secret._CreateForHourly(this.arg_values[0], {
|
92
92
|
first_entity_created_at: this.option_values.first_entity_created_at,
|
93
|
+
period: this.option_values.period,
|
93
94
|
row_number: this.option_values.row_number,
|
94
95
|
active: this.option_values.active,
|
95
|
-
period: this.option_values.period,
|
96
96
|
workspace_id: this.option_values.workspace_id,
|
97
97
|
resource_id: this.option_values.resource_id
|
98
98
|
});
|
@@ -23,7 +23,7 @@ import { IStorageMemoryDedicated } from "namirasoft-core";
|
|
23
23
|
import { NamirasoftCostServer } from "../NamirasoftCostServer";
|
24
24
|
import { TokenManager } from "namirasoft-account";
|
25
25
|
|
26
|
-
export class
|
26
|
+
export class SecretSecret_CreateForReadCommand extends BaseFinalCommand
|
27
27
|
{
|
28
28
|
constructor(argv: string[])
|
29
29
|
{
|
@@ -37,27 +37,27 @@ export class FieldField_CreateForCommand extends BaseFinalCommand
|
|
37
37
|
defaults: [""]
|
38
38
|
},
|
39
39
|
{
|
40
|
-
name: "
|
40
|
+
name: "period",
|
41
41
|
short: "",
|
42
|
-
description: "Provides the value of '
|
42
|
+
description: "Provides the value of 'period' in body",
|
43
43
|
optional: false,
|
44
|
-
args: ["
|
44
|
+
args: ["period"],
|
45
45
|
defaults: [""]
|
46
46
|
},
|
47
47
|
{
|
48
|
-
name: "
|
48
|
+
name: "total",
|
49
49
|
short: "",
|
50
|
-
description: "Provides the value of '
|
50
|
+
description: "Provides the value of 'total' in body",
|
51
51
|
optional: false,
|
52
|
-
args: ["
|
52
|
+
args: ["total"],
|
53
53
|
defaults: [""]
|
54
54
|
},
|
55
55
|
{
|
56
|
-
name: "
|
56
|
+
name: "count",
|
57
57
|
short: "",
|
58
|
-
description: "Provides the value of '
|
58
|
+
description: "Provides the value of 'count' in body",
|
59
59
|
optional: false,
|
60
|
-
args: ["
|
60
|
+
args: ["count"],
|
61
61
|
defaults: [""]
|
62
62
|
},
|
63
63
|
{
|
@@ -88,11 +88,11 @@ export class FieldField_CreateForCommand extends BaseFinalCommand
|
|
88
88
|
manager.setValue(token, false);
|
89
89
|
let url = this.app.storage.getItem("ns-cost-server-url");
|
90
90
|
let server = new NamirasoftCostServer(url, manager, e => this.app.logger.error(e.message));
|
91
|
-
let ans = await server.
|
91
|
+
let ans = await server.secret_secret._CreateForRead(this.arg_values[0], {
|
92
92
|
first_entity_created_at: this.option_values.first_entity_created_at,
|
93
|
-
row_number: this.option_values.row_number,
|
94
|
-
active: this.option_values.active,
|
95
93
|
period: this.option_values.period,
|
94
|
+
total: this.option_values.total,
|
95
|
+
count: this.option_values.count,
|
96
96
|
workspace_id: this.option_values.workspace_id,
|
97
97
|
resource_id: this.option_values.resource_id
|
98
98
|
});
|
package/src/command/cli.ts
CHANGED
@@ -30,6 +30,7 @@ import { FieldCategoryCommand } from "./FieldCategoryCommand";
|
|
30
30
|
import { FieldFieldCommand } from "./FieldFieldCommand";
|
31
31
|
import { HealthzCommand } from "./HealthzCommand";
|
32
32
|
import { MetricsCommand } from "./MetricsCommand";
|
33
|
+
import { SecretSecretCommand } from "./SecretSecretCommand";
|
33
34
|
import { ValueCommand } from "./ValueCommand";
|
34
35
|
|
35
36
|
let app = new Application("ns-cost", new BaseStorage(),
|
@@ -42,6 +43,7 @@ let app = new Application("ns-cost", new BaseStorage(),
|
|
42
43
|
"billwatchgcp": BillWatchGCPCommand,
|
43
44
|
"fieldcategory": FieldCategoryCommand,
|
44
45
|
"fieldfield": FieldFieldCommand,
|
46
|
+
"secretsecret": SecretSecretCommand,
|
45
47
|
"cost": CostCommand,
|
46
48
|
"account": AccountCommand,
|
47
49
|
"config": (argv: string[]) => new ConfigCommand(argv, ["ns-cost-server-url"])
|
@@ -0,0 +1,63 @@
|
|
1
|
+
import { EstimationOption } from "../type/EstimationOption";
|
2
|
+
import { BaseBonus } from "../bonus/BaseBonus";
|
3
|
+
import { Estimation } from "../type/Estimation";
|
4
|
+
import { PeriodUtil } from "../type/Period";
|
5
|
+
|
6
|
+
export abstract class BaseEstimator
|
7
|
+
{
|
8
|
+
async estimate(option: EstimationOption, calculate_bonus: boolean = true): Promise<Estimation[]>
|
9
|
+
{
|
10
|
+
let seconds = PeriodUtil.toSeconds(option.period);
|
11
|
+
let percent = seconds / 3600;
|
12
|
+
let fee_object = this.getFee();
|
13
|
+
let fee = option.active ? fee_object.active : fee_object.deactive;
|
14
|
+
|
15
|
+
let amount = percent * fee * option.value;
|
16
|
+
let currency = "USD";
|
17
|
+
|
18
|
+
let estimation: Estimation = {
|
19
|
+
option,
|
20
|
+
seconds,
|
21
|
+
usage: {
|
22
|
+
value: option.value,
|
23
|
+
...this.getUsage()
|
24
|
+
},
|
25
|
+
fee,
|
26
|
+
amount,
|
27
|
+
currency,
|
28
|
+
free: undefined
|
29
|
+
};
|
30
|
+
|
31
|
+
let ans: Estimation[] = [];
|
32
|
+
if (calculate_bonus)
|
33
|
+
{
|
34
|
+
let bonuses = this.getBonues();
|
35
|
+
for (let bonus of bonuses)
|
36
|
+
{
|
37
|
+
let res = await bonus.isFree(option, estimation);
|
38
|
+
if (res.free)
|
39
|
+
{
|
40
|
+
if (res.split)
|
41
|
+
{
|
42
|
+
let estimation_free = await this.estimate(res.split.free, false);
|
43
|
+
estimation_free.forEach(e => { e.free = bonus; });
|
44
|
+
ans.push(...estimation_free);
|
45
|
+
for (let estimation_paid of res.split.paids)
|
46
|
+
ans.push(...await this.estimate(estimation_paid, false));
|
47
|
+
}
|
48
|
+
else
|
49
|
+
{
|
50
|
+
estimation.free = bonus;
|
51
|
+
ans.push(estimation);
|
52
|
+
}
|
53
|
+
break;
|
54
|
+
}
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
return ans;
|
59
|
+
}
|
60
|
+
abstract getFee(): { active: number, deactive: number };
|
61
|
+
abstract getUsage(): { name: string, unit: string };
|
62
|
+
abstract getBonues(): BaseBonus[];
|
63
|
+
}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import { DurationUnit, PriceOperation } from "namirasoft-core";
|
2
|
+
import { BaseEstimator } from "./BaseEstimator";
|
3
|
+
import { Usage } from "../type/Usage";
|
4
|
+
import { TrialBonus } from "../bonus/TrialBonus";
|
5
|
+
|
6
|
+
export abstract class BillWatchBaseHourlyEstimator extends BaseEstimator
|
7
|
+
{
|
8
|
+
static WATCH_PER_HOUR_ACTIVE = PriceOperation.cent_to_millicent(3);
|
9
|
+
override getFee()
|
10
|
+
{
|
11
|
+
return { active: BillWatchBaseHourlyEstimator.WATCH_PER_HOUR_ACTIVE, deactive: 0 };
|
12
|
+
}
|
13
|
+
override getUsage()
|
14
|
+
{
|
15
|
+
return {
|
16
|
+
name: Usage.Time.name,
|
17
|
+
unit: Usage.Time.units.Hour.name
|
18
|
+
};
|
19
|
+
}
|
20
|
+
override getBonues()
|
21
|
+
{
|
22
|
+
return [
|
23
|
+
new TrialBonus(1, DurationUnit.Week)
|
24
|
+
];
|
25
|
+
}
|
26
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { DurationUnit } from "namirasoft-core";
|
2
|
+
import { TrialBonus } from "../bonus/TrialBonus";
|
3
|
+
import { BaseEstimator } from "./BaseEstimator";
|
4
|
+
import { Usage } from "../type/Usage";
|
5
|
+
|
6
|
+
export abstract class FieldBaseHourlyEstimator extends BaseEstimator
|
7
|
+
{
|
8
|
+
override getBonues()
|
9
|
+
{
|
10
|
+
return [
|
11
|
+
new TrialBonus(1, DurationUnit.Week)
|
12
|
+
];
|
13
|
+
}
|
14
|
+
override getUsage()
|
15
|
+
{
|
16
|
+
return {
|
17
|
+
name: Usage.Time.name,
|
18
|
+
unit: Usage.Time.units.Hour.name
|
19
|
+
};
|
20
|
+
}
|
21
|
+
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { FieldBaseHourlyEstimator } from "./FieldBaseHourlyEstimator";
|
2
|
+
|
3
|
+
export class FieldCategoryHourlyEstimator extends FieldBaseHourlyEstimator
|
4
|
+
{
|
5
|
+
static PER_HOUR_ACTIVE = 200;
|
6
|
+
override getFee()
|
7
|
+
{
|
8
|
+
return { active: FieldCategoryHourlyEstimator.PER_HOUR_ACTIVE, deactive: FieldCategoryHourlyEstimator.PER_HOUR_ACTIVE };
|
9
|
+
}
|
10
|
+
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { FieldBaseHourlyEstimator } from "./FieldBaseHourlyEstimator";
|
2
|
+
|
3
|
+
export class FieldFieldHourlyEstimator extends FieldBaseHourlyEstimator
|
4
|
+
{
|
5
|
+
static PER_HOUR_ACTIVE = 250;
|
6
|
+
override getFee()
|
7
|
+
{
|
8
|
+
return { active: FieldFieldHourlyEstimator.PER_HOUR_ACTIVE, deactive: FieldFieldHourlyEstimator.PER_HOUR_ACTIVE };
|
9
|
+
}
|
10
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import { FreeCountBonus } from "../bonus/FreeCountBonus";
|
2
|
+
import { Usage } from "../type/Usage";
|
3
|
+
import { BaseEstimator } from "./BaseEstimator";
|
4
|
+
|
5
|
+
export class SecretSecretHourlyEstimator extends BaseEstimator
|
6
|
+
{
|
7
|
+
static PER_HOUR_ACTIVE = 2;
|
8
|
+
override getFee()
|
9
|
+
{
|
10
|
+
return { active: SecretSecretHourlyEstimator.PER_HOUR_ACTIVE, deactive: SecretSecretHourlyEstimator.PER_HOUR_ACTIVE };
|
11
|
+
}
|
12
|
+
override getUsage()
|
13
|
+
{
|
14
|
+
return {
|
15
|
+
name: Usage.Time.name,
|
16
|
+
unit: Usage.Time.units.Hour.name
|
17
|
+
};
|
18
|
+
}
|
19
|
+
override getBonues()
|
20
|
+
{
|
21
|
+
return [
|
22
|
+
new FreeCountBonus(100)
|
23
|
+
];
|
24
|
+
}
|
25
|
+
}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import { FreeTotalValueBonus } from "../bonus/FreeTotalValueBonus";
|
2
|
+
import { Usage } from "../type/Usage";
|
3
|
+
import { BaseEstimator } from "./BaseEstimator";
|
4
|
+
|
5
|
+
export class SecretSecretReadEstimator extends BaseEstimator
|
6
|
+
{
|
7
|
+
static PER_CALL = 1;
|
8
|
+
|
9
|
+
override getFee()
|
10
|
+
{
|
11
|
+
return { active: SecretSecretReadEstimator.PER_CALL, deactive: SecretSecretReadEstimator.PER_CALL };
|
12
|
+
}
|
13
|
+
override getUsage()
|
14
|
+
{
|
15
|
+
return {
|
16
|
+
name: Usage.APICALL.name,
|
17
|
+
unit: Usage.APICALL.units.REQUEST.name
|
18
|
+
};
|
19
|
+
}
|
20
|
+
override getBonues()
|
21
|
+
{
|
22
|
+
return [
|
23
|
+
new FreeTotalValueBonus(1000)
|
24
|
+
];
|
25
|
+
}
|
26
|
+
}
|
package/src/index.ts
CHANGED
@@ -28,40 +28,41 @@ export * from "./NamirasoftCostServerFieldCategory";
|
|
28
28
|
export * from "./NamirasoftCostServerFieldField";
|
29
29
|
export * from "./NamirasoftCostServerHealthz";
|
30
30
|
export * from "./NamirasoftCostServerMetrics";
|
31
|
+
export * from "./NamirasoftCostServerSecretSecret";
|
31
32
|
export * from "./NamirasoftCostServerValue";
|
32
|
-
export * from "./TimeUtil";
|
33
33
|
export * from "./command/BillWatchAWSCommand";
|
34
|
-
export * from "./command/
|
35
|
-
export * from "./command/
|
34
|
+
export * from "./command/BillWatchAWSEstimateHourlyCommand";
|
35
|
+
export * from "./command/BillWatchAWS_CreateForHourlyCommand";
|
36
36
|
export * from "./command/BillWatchAzureCommand";
|
37
|
-
export * from "./command/
|
38
|
-
export * from "./command/
|
37
|
+
export * from "./command/BillWatchAzureEstimateHourlyCommand";
|
38
|
+
export * from "./command/BillWatchAzure_CreateForHourlyCommand";
|
39
39
|
export * from "./command/BillWatchGCPCommand";
|
40
|
-
export * from "./command/
|
41
|
-
export * from "./command/
|
40
|
+
export * from "./command/BillWatchGCPEstimateHourlyCommand";
|
41
|
+
export * from "./command/BillWatchGCP_CreateForHourlyCommand";
|
42
42
|
export * from "./command/CostCommand";
|
43
43
|
export * from "./command/CostListCommand";
|
44
44
|
export * from "./command/Cost_CreateForCommand";
|
45
45
|
export * from "./command/FieldCategoryCommand";
|
46
|
-
export * from "./command/
|
47
|
-
export * from "./command/
|
46
|
+
export * from "./command/FieldCategoryEstimateHourlyCommand";
|
47
|
+
export * from "./command/FieldCategory_CreateForHourlyCommand";
|
48
48
|
export * from "./command/FieldFieldCommand";
|
49
|
-
export * from "./command/
|
50
|
-
export * from "./command/
|
49
|
+
export * from "./command/FieldFieldEstimateHourlyCommand";
|
50
|
+
export * from "./command/FieldField_CreateForHourlyCommand";
|
51
51
|
export * from "./command/HealthzCommand";
|
52
52
|
export * from "./command/HealthzGetCommand";
|
53
53
|
export * from "./command/MetricsCommand";
|
54
54
|
export * from "./command/MetricsGetCommand";
|
55
|
+
export * from "./command/SecretSecretCommand";
|
56
|
+
export * from "./command/SecretSecretEstimateHourlyCommand";
|
57
|
+
export * from "./command/SecretSecretEstimateReadCommand";
|
58
|
+
export * from "./command/SecretSecret_CreateForHourlyCommand";
|
59
|
+
export * from "./command/SecretSecret_CreateForReadCommand";
|
55
60
|
export * from "./command/ValueCommand";
|
56
61
|
export * from "./command/ValueListCommand";
|
57
|
-
export * from "./enum/TrialUnit";
|
58
62
|
export * from "./meta/CostMetaTable";
|
59
63
|
export * from "./meta/NamirasoftCostMetaDatabase";
|
60
64
|
export * from "./row/CostCreateRow";
|
61
65
|
export * from "./row/CostRow";
|
62
66
|
export * from "./type/Estimation";
|
63
|
-
export * from "./type/EstimationRow";
|
64
67
|
export * from "./type/EstimationUsage";
|
65
|
-
export * from "./type/Period";
|
66
|
-
export * from "./type/Trial";
|
67
|
-
export * from "./type/TrialDuration";
|
68
|
+
export * from "./type/Period";
|
package/src/type/Estimation.ts
CHANGED
@@ -1,7 +1,14 @@
|
|
1
|
-
import {
|
1
|
+
import { BaseBonus } from "../bonus/BaseBonus";
|
2
|
+
import { EstimationOption } from "./EstimationOption";
|
3
|
+
import { EstimationUsage } from "./EstimationUsage";
|
2
4
|
|
3
5
|
export type Estimation =
|
4
6
|
{
|
5
|
-
|
6
|
-
|
7
|
+
option: EstimationOption;
|
8
|
+
seconds: number;
|
9
|
+
usage: EstimationUsage;
|
10
|
+
fee: number;
|
11
|
+
amount: number;
|
12
|
+
currency: string;
|
13
|
+
free?: BaseBonus;
|
7
14
|
};
|
package/src/type/Period.ts
CHANGED
@@ -1,5 +1,74 @@
|
|
1
|
+
import { TimeOperation } from "namirasoft-core";
|
2
|
+
|
1
3
|
export type Period =
|
2
4
|
{
|
3
|
-
|
4
|
-
|
5
|
-
|
5
|
+
year: number;
|
6
|
+
month: number;
|
7
|
+
day: number;
|
8
|
+
hour: number;
|
9
|
+
start: {
|
10
|
+
minute: number;
|
11
|
+
second: number;
|
12
|
+
};
|
13
|
+
end: {
|
14
|
+
minute: number;
|
15
|
+
second: number;
|
16
|
+
};
|
17
|
+
};
|
18
|
+
|
19
|
+
export class PeriodUtil
|
20
|
+
{
|
21
|
+
static toSeconds(period: Period)
|
22
|
+
{
|
23
|
+
return (period.end.minute * 60 + period.end.second) - (period.start.minute * 60 + period.start.second) + 1
|
24
|
+
}
|
25
|
+
static toDates(period: Period)
|
26
|
+
{
|
27
|
+
let start = new Date(period.year, period.month, period.day, period.hour, period.start.minute, period.start.second);
|
28
|
+
let end = new Date(period.year, period.month, period.day, period.hour, period.end.minute, period.end.second);
|
29
|
+
return { start, end };
|
30
|
+
}
|
31
|
+
static async loop(start: Date, end: Date, estimate_hour: (period: Period) => Promise<void>): Promise<void>
|
32
|
+
{
|
33
|
+
let pre_estimate_hour = async (start: Date, end: Date) =>
|
34
|
+
{
|
35
|
+
if (end <= start)
|
36
|
+
return;
|
37
|
+
return await estimate_hour({
|
38
|
+
year: start.getFullYear(),
|
39
|
+
month: start.getMonth(),
|
40
|
+
day: start.getDate(),
|
41
|
+
hour: start.getHours(),
|
42
|
+
start: {
|
43
|
+
minute: start.getMinutes(),
|
44
|
+
second: start.getSeconds(),
|
45
|
+
},
|
46
|
+
end: {
|
47
|
+
minute: end.getMinutes(),
|
48
|
+
second: end.getSeconds(),
|
49
|
+
}
|
50
|
+
});
|
51
|
+
}
|
52
|
+
|
53
|
+
let s = start;
|
54
|
+
let e = null;
|
55
|
+
|
56
|
+
do
|
57
|
+
{
|
58
|
+
let next_start = TimeOperation.hoursLater(1, s);
|
59
|
+
next_start.setMilliseconds(0);
|
60
|
+
next_start.setSeconds(0);
|
61
|
+
next_start.setMinutes(0);
|
62
|
+
if (end < next_start)
|
63
|
+
{
|
64
|
+
next_start = end;
|
65
|
+
e = end;
|
66
|
+
}
|
67
|
+
else
|
68
|
+
e = TimeOperation.secondsAgo(1, next_start);
|
69
|
+
await pre_estimate_hour(s, e);
|
70
|
+
s = next_start;
|
71
|
+
}
|
72
|
+
while (e < end)
|
73
|
+
}
|
74
|
+
};
|
@@ -0,0 +1,25 @@
|
|
1
|
+
export class Usage
|
2
|
+
{
|
3
|
+
static Time = {
|
4
|
+
name: "Time",
|
5
|
+
units: {
|
6
|
+
Second: {
|
7
|
+
name: "Second"
|
8
|
+
},
|
9
|
+
Minute: {
|
10
|
+
name: "Minute"
|
11
|
+
},
|
12
|
+
Hour: {
|
13
|
+
name: "Hour"
|
14
|
+
}
|
15
|
+
}
|
16
|
+
};
|
17
|
+
static APICALL = {
|
18
|
+
name: "API Call",
|
19
|
+
units: {
|
20
|
+
REQUEST: {
|
21
|
+
name: "Request"
|
22
|
+
}
|
23
|
+
}
|
24
|
+
};
|
25
|
+
};
|
package/dist/TimeUtil.d.ts
DELETED
@@ -1,7 +0,0 @@
|
|
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, trial: boolean) => Promise<void>): Promise<void>;
|
7
|
-
}
|