namirasoft-cost 1.4.27 → 1.4.31
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-file-keep +10 -0
- package/dist/NamirasoftCostServer.js +1 -1
- package/dist/NamirasoftCostServerBillWatchAWS.d.ts +4 -15
- package/dist/NamirasoftCostServerBillWatchAWS.js +2 -2
- package/dist/NamirasoftCostServerBillWatchAWS.js.map +1 -1
- package/dist/NamirasoftCostServerBillWatchAzure.d.ts +4 -15
- package/dist/NamirasoftCostServerBillWatchAzure.js +2 -2
- package/dist/NamirasoftCostServerBillWatchAzure.js.map +1 -1
- package/dist/NamirasoftCostServerBillWatchGCP.d.ts +4 -15
- package/dist/NamirasoftCostServerBillWatchGCP.js +2 -2
- package/dist/NamirasoftCostServerBillWatchGCP.js.map +1 -1
- package/dist/NamirasoftCostServerCost.d.ts +0 -2
- package/dist/NamirasoftCostServerCost.js +0 -8
- package/dist/NamirasoftCostServerCost.js.map +1 -1
- package/dist/NamirasoftCostServerFieldCategory.d.ts +4 -15
- package/dist/NamirasoftCostServerFieldCategory.js +2 -2
- package/dist/NamirasoftCostServerFieldCategory.js.map +1 -1
- package/dist/NamirasoftCostServerFieldField.d.ts +4 -15
- package/dist/NamirasoftCostServerFieldField.js +2 -2
- package/dist/NamirasoftCostServerFieldField.js.map +1 -1
- package/dist/NamirasoftCostServerSecretSecret.d.ts +6 -29
- package/dist/NamirasoftCostServerSecretSecret.js +2 -2
- package/dist/NamirasoftCostServerSecretSecret.js.map +1 -1
- package/dist/command/BillWatchAWSCommand.d.ts +4 -0
- package/dist/command/BillWatchAWSCommand.js +17 -0
- package/dist/command/BillWatchAWSCommand.js.map +1 -0
- package/dist/command/BillWatchAWSEstimateRecordCommand.d.ts +5 -0
- package/dist/command/BillWatchAWSEstimateRecordCommand.js +103 -0
- package/dist/command/BillWatchAWSEstimateRecordCommand.js.map +1 -0
- package/dist/command/BillWatchAWS_CreateForRecordCommand.d.ts +5 -0
- package/dist/command/BillWatchAWS_CreateForRecordCommand.js +112 -0
- package/dist/command/BillWatchAWS_CreateForRecordCommand.js.map +1 -0
- package/dist/command/BillWatchAzureCommand.d.ts +4 -0
- package/dist/command/BillWatchAzureCommand.js +17 -0
- package/dist/command/BillWatchAzureCommand.js.map +1 -0
- package/dist/command/BillWatchAzureEstimateRecordCommand.d.ts +5 -0
- package/dist/command/BillWatchAzureEstimateRecordCommand.js +103 -0
- package/dist/command/BillWatchAzureEstimateRecordCommand.js.map +1 -0
- package/dist/command/BillWatchAzure_CreateForRecordCommand.d.ts +5 -0
- package/dist/command/BillWatchAzure_CreateForRecordCommand.js +112 -0
- package/dist/command/BillWatchAzure_CreateForRecordCommand.js.map +1 -0
- package/dist/command/BillWatchGCPCommand.d.ts +4 -0
- package/dist/command/BillWatchGCPCommand.js +17 -0
- package/dist/command/BillWatchGCPCommand.js.map +1 -0
- package/dist/command/BillWatchGCPEstimateRecordCommand.d.ts +5 -0
- package/dist/command/BillWatchGCPEstimateRecordCommand.js +103 -0
- package/dist/command/BillWatchGCPEstimateRecordCommand.js.map +1 -0
- package/dist/command/BillWatchGCP_CreateForRecordCommand.d.ts +5 -0
- package/dist/command/BillWatchGCP_CreateForRecordCommand.js +112 -0
- package/dist/command/BillWatchGCP_CreateForRecordCommand.js.map +1 -0
- package/dist/command/CostCommand.d.ts +4 -0
- package/dist/command/CostCommand.js +15 -0
- package/dist/command/CostCommand.js.map +1 -0
- package/dist/command/CostListCommand.d.ts +5 -0
- package/dist/command/CostListCommand.js +38 -0
- package/dist/command/CostListCommand.js.map +1 -0
- package/dist/command/FieldCategoryCommand.d.ts +4 -0
- package/dist/command/FieldCategoryCommand.js +17 -0
- package/dist/command/FieldCategoryCommand.js.map +1 -0
- package/dist/command/FieldCategoryEstimateRecordCommand.d.ts +5 -0
- package/dist/command/FieldCategoryEstimateRecordCommand.js +103 -0
- package/dist/command/FieldCategoryEstimateRecordCommand.js.map +1 -0
- package/dist/command/FieldCategory_CreateForRecordCommand.d.ts +5 -0
- package/dist/command/FieldCategory_CreateForRecordCommand.js +112 -0
- package/dist/command/FieldCategory_CreateForRecordCommand.js.map +1 -0
- package/dist/command/FieldFieldCommand.d.ts +4 -0
- package/dist/command/FieldFieldCommand.js +17 -0
- package/dist/command/FieldFieldCommand.js.map +1 -0
- package/dist/command/FieldFieldEstimateRecordCommand.d.ts +5 -0
- package/dist/command/FieldFieldEstimateRecordCommand.js +103 -0
- package/dist/command/FieldFieldEstimateRecordCommand.js.map +1 -0
- package/dist/command/FieldField_CreateForRecordCommand.d.ts +5 -0
- package/dist/command/FieldField_CreateForRecordCommand.js +112 -0
- package/dist/command/FieldField_CreateForRecordCommand.js.map +1 -0
- package/dist/command/HealthzCommand.d.ts +4 -0
- package/dist/command/HealthzCommand.js +15 -0
- package/dist/command/HealthzCommand.js.map +1 -0
- package/dist/command/HealthzGetCommand.d.ts +5 -0
- package/dist/command/HealthzGetCommand.js +38 -0
- package/dist/command/HealthzGetCommand.js.map +1 -0
- package/dist/command/MetricsCommand.d.ts +4 -0
- package/dist/command/MetricsCommand.js +15 -0
- package/dist/command/MetricsCommand.js.map +1 -0
- package/dist/command/MetricsGetCommand.d.ts +5 -0
- package/dist/command/MetricsGetCommand.js +38 -0
- package/dist/command/MetricsGetCommand.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/SecretSecretEstimateReadCommand.d.ts +5 -0
- package/dist/command/SecretSecretEstimateReadCommand.js +103 -0
- package/dist/command/SecretSecretEstimateReadCommand.js.map +1 -0
- package/dist/command/SecretSecretEstimateRecordCommand.d.ts +5 -0
- package/dist/command/SecretSecretEstimateRecordCommand.js +103 -0
- package/dist/command/SecretSecretEstimateRecordCommand.js.map +1 -0
- package/dist/command/SecretSecret_CreateForReadCommand.d.ts +5 -0
- package/dist/command/SecretSecret_CreateForReadCommand.js +112 -0
- package/dist/command/SecretSecret_CreateForReadCommand.js.map +1 -0
- package/dist/command/SecretSecret_CreateForRecordCommand.d.ts +5 -0
- package/dist/command/SecretSecret_CreateForRecordCommand.js +112 -0
- package/dist/command/SecretSecret_CreateForRecordCommand.js.map +1 -0
- package/dist/command/ValueCommand.d.ts +4 -0
- package/dist/command/ValueCommand.js +15 -0
- package/dist/command/ValueCommand.js.map +1 -0
- package/dist/command/ValueListCommand.d.ts +5 -0
- package/dist/command/ValueListCommand.js +38 -0
- package/dist/command/ValueListCommand.js.map +1 -0
- package/dist/command/cli.d.ts +2 -0
- package/dist/command/cli.js +32 -0
- package/dist/command/cli.js.map +1 -0
- package/dist/estimator/BaseEstimator.d.ts +1 -1
- package/dist/estimator/BaseEstimator.js +1 -1
- package/dist/estimator/BaseEstimator.js.map +1 -1
- package/dist/estimator/BillWatchBaseRecordEstimator.d.ts +1 -1
- package/dist/estimator/BillWatchBaseRecordEstimator.js +1 -1
- package/dist/estimator/BillWatchBaseRecordEstimator.js.map +1 -1
- package/dist/estimator/FieldBaseRecordEstimator.d.ts +1 -1
- package/dist/estimator/FieldBaseRecordEstimator.js +1 -1
- package/dist/estimator/FieldBaseRecordEstimator.js.map +1 -1
- package/dist/estimator/SecretSecretReadEstimator.d.ts +1 -1
- package/dist/estimator/SecretSecretReadEstimator.js +1 -1
- package/dist/estimator/SecretSecretReadEstimator.js.map +1 -1
- package/dist/estimator/SecretSecretRecordEstimator.d.ts +1 -1
- package/dist/estimator/SecretSecretRecordEstimator.js +1 -1
- package/dist/estimator/SecretSecretRecordEstimator.js.map +1 -1
- package/dist/index.d.ts +47 -12
- package/dist/index.js +47 -12
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/NamirasoftCostServer.ts +1 -1
- package/src/NamirasoftCostServerBillWatchAWS.ts +8 -7
- package/src/NamirasoftCostServerBillWatchAzure.ts +8 -7
- package/src/NamirasoftCostServerBillWatchGCP.ts +8 -7
- package/src/NamirasoftCostServerCost.ts +0 -8
- package/src/NamirasoftCostServerFieldCategory.ts +8 -7
- package/src/NamirasoftCostServerFieldField.ts +8 -7
- package/src/NamirasoftCostServerSecretSecret.ts +12 -11
- package/src/command/BillWatchAWSCommand.ts +34 -0
- package/src/command/BillWatchAWSEstimateRecordCommand.ts +110 -0
- package/src/command/BillWatchAWS_CreateForRecordCommand.ts +119 -0
- package/src/command/BillWatchAzureCommand.ts +34 -0
- package/src/command/BillWatchAzureEstimateRecordCommand.ts +110 -0
- package/src/command/BillWatchAzure_CreateForRecordCommand.ts +119 -0
- package/src/command/BillWatchGCPCommand.ts +34 -0
- package/src/command/BillWatchGCPEstimateRecordCommand.ts +110 -0
- package/src/command/BillWatchGCP_CreateForRecordCommand.ts +119 -0
- package/src/{row/CostCreateRow.ts → command/CostCommand.ts} +11 -17
- package/src/command/CostListCommand.ts +45 -0
- package/src/command/FieldCategoryCommand.ts +34 -0
- package/src/command/FieldCategoryEstimateRecordCommand.ts +110 -0
- package/src/command/FieldCategory_CreateForRecordCommand.ts +119 -0
- package/src/command/FieldFieldCommand.ts +34 -0
- package/src/command/FieldFieldEstimateRecordCommand.ts +110 -0
- package/src/command/FieldField_CreateForRecordCommand.ts +119 -0
- package/src/command/HealthzCommand.ts +32 -0
- package/src/command/HealthzGetCommand.ts +45 -0
- package/src/command/MetricsCommand.ts +32 -0
- package/src/command/MetricsGetCommand.ts +45 -0
- package/src/command/SecretSecretCommand.ts +38 -0
- package/src/command/SecretSecretEstimateReadCommand.ts +110 -0
- package/src/command/SecretSecretEstimateRecordCommand.ts +110 -0
- package/src/command/SecretSecret_CreateForReadCommand.ts +119 -0
- package/src/command/SecretSecret_CreateForRecordCommand.ts +119 -0
- package/src/command/ValueCommand.ts +32 -0
- package/src/command/ValueListCommand.ts +45 -0
- package/src/command/cli.ts +51 -0
- package/src/estimator/BaseEstimator.ts +62 -62
- package/src/estimator/BillWatchAWSRecordEstimator.ts +4 -4
- package/src/estimator/BillWatchAzureRecordEstimator.ts +4 -4
- package/src/estimator/BillWatchBaseRecordEstimator.ts +25 -25
- package/src/estimator/BillWatchGCPRecordEstimator.ts +4 -4
- package/src/estimator/FieldBaseRecordEstimator.ts +20 -20
- package/src/estimator/FieldCategoryRecordEstimator.ts +9 -9
- package/src/estimator/FieldFieldRecordEstimator.ts +9 -9
- package/src/estimator/SecretSecretReadEstimator.ts +25 -25
- package/src/estimator/SecretSecretRecordEstimator.ts +24 -24
- package/src/index.ts +47 -12
- package/src/type/CalculationOption.ts +1 -1
- package/src/type/Estimation.ts +1 -1
- package/dist/row/CostCreateRow.d.ts +0 -17
- package/dist/row/CostCreateRow.js +0 -3
- package/dist/row/CostCreateRow.js.map +0 -1
@@ -0,0 +1,45 @@
|
|
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 { BaseFinalCommand } from "namirasoft-node-cli";
|
22
|
+
import { IStorageMemoryDedicated } from "namirasoft-core";
|
23
|
+
import { NamirasoftCostServer } from "../NamirasoftCostServer";
|
24
|
+
import { TokenManager } from "namirasoft-account";
|
25
|
+
|
26
|
+
export class ValueListCommand extends BaseFinalCommand
|
27
|
+
{
|
28
|
+
constructor(argv: string[])
|
29
|
+
{
|
30
|
+
super(argv, ["table", "column", "search", "field_id", "limit"], []);
|
31
|
+
}
|
32
|
+
override async exec()
|
33
|
+
{
|
34
|
+
let token = this.app.storage.getNSAToken();
|
35
|
+
if (token == null)
|
36
|
+
throw new Error("Token is not available. Please login first using:\nns-cost account config \nor \nns-cost account login.");
|
37
|
+
let storage = new IStorageMemoryDedicated();
|
38
|
+
let manager = new TokenManager(storage, () => { });
|
39
|
+
manager.setValue(token, false);
|
40
|
+
let url = this.app.storage.getItem("ns-cost-server-url");
|
41
|
+
let server = new NamirasoftCostServer(url, manager, e => this.app.logger.error(e.message));
|
42
|
+
let ans = await server.value.List(this.arg_values[0], this.arg_values[1], this.arg_values[2], this.arg_values[3], this.arg_values[4]);
|
43
|
+
this.app.logger.success(JSON.stringify(ans));
|
44
|
+
}
|
45
|
+
};
|
@@ -0,0 +1,51 @@
|
|
1
|
+
#!/usr/bin/env node
|
2
|
+
/****************************************************************/
|
3
|
+
/* */
|
4
|
+
/* This is an Auto-Generated File */
|
5
|
+
/* Made By */
|
6
|
+
/* Namirasoft SDK Generator NPM Package */
|
7
|
+
/* */
|
8
|
+
/****************************************************************/
|
9
|
+
/****************************************************************/
|
10
|
+
/* */
|
11
|
+
/* Please do not make any change to this file */
|
12
|
+
/* If any change is required, ns-sdkg command must be used */
|
13
|
+
/* */
|
14
|
+
/****************************************************************/
|
15
|
+
/****************************************************************/
|
16
|
+
/* */
|
17
|
+
/* Namira Software Corporation */
|
18
|
+
/* https://namirasoft.com */
|
19
|
+
/* */
|
20
|
+
/****************************************************************/
|
21
|
+
|
22
|
+
import { AccountCommand } from "namirasoft-account";
|
23
|
+
import { Application, BaseStorage } from "namirasoft-node-cli";
|
24
|
+
import { BillWatchAWSCommand } from "./BillWatchAWSCommand";
|
25
|
+
import { BillWatchAzureCommand } from "./BillWatchAzureCommand";
|
26
|
+
import { BillWatchGCPCommand } from "./BillWatchGCPCommand";
|
27
|
+
import { ConfigCommand } from "namirasoft-node-cli";
|
28
|
+
import { CostCommand } from "./CostCommand";
|
29
|
+
import { FieldCategoryCommand } from "./FieldCategoryCommand";
|
30
|
+
import { FieldFieldCommand } from "./FieldFieldCommand";
|
31
|
+
import { HealthzCommand } from "./HealthzCommand";
|
32
|
+
import { MetricsCommand } from "./MetricsCommand";
|
33
|
+
import { SecretSecretCommand } from "./SecretSecretCommand";
|
34
|
+
import { ValueCommand } from "./ValueCommand";
|
35
|
+
|
36
|
+
let app = new Application("ns-cost", new BaseStorage(),
|
37
|
+
{
|
38
|
+
"healthz": HealthzCommand,
|
39
|
+
"metrics": MetricsCommand,
|
40
|
+
"value": ValueCommand,
|
41
|
+
"billwatchaws": BillWatchAWSCommand,
|
42
|
+
"billwatchazure": BillWatchAzureCommand,
|
43
|
+
"billwatchgcp": BillWatchGCPCommand,
|
44
|
+
"fieldcategory": FieldCategoryCommand,
|
45
|
+
"fieldfield": FieldFieldCommand,
|
46
|
+
"secretsecret": SecretSecretCommand,
|
47
|
+
"cost": CostCommand,
|
48
|
+
"account": AccountCommand,
|
49
|
+
"config": (argv: string[]) => new ConfigCommand(argv, ["ns-cost-server-url"])
|
50
|
+
});
|
51
|
+
app.run();
|
@@ -1,63 +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.
|
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
|
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.getBonuses();
|
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 getBonuses(): BaseBonus[];
|
63
63
|
}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { BillWatchBaseRecordEstimator } from "./BillWatchBaseRecordEstimator";
|
2
|
-
|
3
|
-
export class BillWatchAWSRecordEstimator extends BillWatchBaseRecordEstimator
|
4
|
-
{
|
1
|
+
import { BillWatchBaseRecordEstimator } from "./BillWatchBaseRecordEstimator";
|
2
|
+
|
3
|
+
export class BillWatchAWSRecordEstimator extends BillWatchBaseRecordEstimator
|
4
|
+
{
|
5
5
|
}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { BillWatchBaseRecordEstimator } from "./BillWatchBaseRecordEstimator";
|
2
|
-
|
3
|
-
export class BillWatchAzureRecordEstimator extends BillWatchBaseRecordEstimator
|
4
|
-
{
|
1
|
+
import { BillWatchBaseRecordEstimator } from "./BillWatchBaseRecordEstimator";
|
2
|
+
|
3
|
+
export class BillWatchAzureRecordEstimator extends BillWatchBaseRecordEstimator
|
4
|
+
{
|
5
5
|
}
|
@@ -1,26 +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 BillWatchBaseRecordEstimator extends BaseEstimator
|
7
|
-
{
|
8
|
-
static WATCH_PER_HOUR_ACTIVE = PriceOperation.cent_to_millicent(3);
|
9
|
-
override getFee()
|
10
|
-
{
|
11
|
-
return { active: BillWatchBaseRecordEstimator.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
|
21
|
-
{
|
22
|
-
return [
|
23
|
-
new TrialBonus(1, DurationUnit.Week)
|
24
|
-
];
|
25
|
-
}
|
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 BillWatchBaseRecordEstimator extends BaseEstimator
|
7
|
+
{
|
8
|
+
static WATCH_PER_HOUR_ACTIVE = PriceOperation.cent_to_millicent(3);
|
9
|
+
override getFee()
|
10
|
+
{
|
11
|
+
return { active: BillWatchBaseRecordEstimator.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 getBonuses()
|
21
|
+
{
|
22
|
+
return [
|
23
|
+
new TrialBonus(1, DurationUnit.Week)
|
24
|
+
];
|
25
|
+
}
|
26
26
|
}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { BillWatchBaseRecordEstimator } from "./BillWatchBaseRecordEstimator";
|
2
|
-
|
3
|
-
export class BillWatchGCPRecordEstimator extends BillWatchBaseRecordEstimator
|
4
|
-
{
|
1
|
+
import { BillWatchBaseRecordEstimator } from "./BillWatchBaseRecordEstimator";
|
2
|
+
|
3
|
+
export class BillWatchGCPRecordEstimator extends BillWatchBaseRecordEstimator
|
4
|
+
{
|
5
5
|
}
|
@@ -1,21 +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 FieldBaseRecordEstimator extends BaseEstimator
|
7
|
-
{
|
8
|
-
override
|
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
|
-
}
|
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 FieldBaseRecordEstimator extends BaseEstimator
|
7
|
+
{
|
8
|
+
override getBonuses()
|
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
21
|
}
|
@@ -1,10 +1,10 @@
|
|
1
|
-
import { FieldBaseRecordEstimator } from "./FieldBaseRecordEstimator";
|
2
|
-
|
3
|
-
export class FieldCategoryRecordEstimator extends FieldBaseRecordEstimator
|
4
|
-
{
|
5
|
-
static PER_HOUR_ACTIVE = 200;
|
6
|
-
override getFee()
|
7
|
-
{
|
8
|
-
return { active: FieldCategoryRecordEstimator.PER_HOUR_ACTIVE, deactive: FieldCategoryRecordEstimator.PER_HOUR_ACTIVE };
|
9
|
-
}
|
1
|
+
import { FieldBaseRecordEstimator } from "./FieldBaseRecordEstimator";
|
2
|
+
|
3
|
+
export class FieldCategoryRecordEstimator extends FieldBaseRecordEstimator
|
4
|
+
{
|
5
|
+
static PER_HOUR_ACTIVE = 200;
|
6
|
+
override getFee()
|
7
|
+
{
|
8
|
+
return { active: FieldCategoryRecordEstimator.PER_HOUR_ACTIVE, deactive: FieldCategoryRecordEstimator.PER_HOUR_ACTIVE };
|
9
|
+
}
|
10
10
|
}
|
@@ -1,10 +1,10 @@
|
|
1
|
-
import { FieldBaseRecordEstimator } from "./FieldBaseRecordEstimator";
|
2
|
-
|
3
|
-
export class FieldFieldRecordEstimator extends FieldBaseRecordEstimator
|
4
|
-
{
|
5
|
-
static PER_HOUR_ACTIVE = 250;
|
6
|
-
override getFee()
|
7
|
-
{
|
8
|
-
return { active: FieldFieldRecordEstimator.PER_HOUR_ACTIVE, deactive: FieldFieldRecordEstimator.PER_HOUR_ACTIVE };
|
9
|
-
}
|
1
|
+
import { FieldBaseRecordEstimator } from "./FieldBaseRecordEstimator";
|
2
|
+
|
3
|
+
export class FieldFieldRecordEstimator extends FieldBaseRecordEstimator
|
4
|
+
{
|
5
|
+
static PER_HOUR_ACTIVE = 250;
|
6
|
+
override getFee()
|
7
|
+
{
|
8
|
+
return { active: FieldFieldRecordEstimator.PER_HOUR_ACTIVE, deactive: FieldFieldRecordEstimator.PER_HOUR_ACTIVE };
|
9
|
+
}
|
10
10
|
}
|
@@ -1,26 +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
|
21
|
-
{
|
22
|
-
return [
|
23
|
-
new FreeTotalValueBonus(1000)
|
24
|
-
];
|
25
|
-
}
|
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 getBonuses()
|
21
|
+
{
|
22
|
+
return [
|
23
|
+
new FreeTotalValueBonus(1000)
|
24
|
+
];
|
25
|
+
}
|
26
26
|
}
|
@@ -1,25 +1,25 @@
|
|
1
|
-
import { FreeCountBonus } from "../bonus/FreeCountBonus";
|
2
|
-
import { Usage } from "../type/Usage";
|
3
|
-
import { BaseEstimator } from "./BaseEstimator";
|
4
|
-
|
5
|
-
export class SecretSecretRecordEstimator extends BaseEstimator
|
6
|
-
{
|
7
|
-
static PER_HOUR_ACTIVE = 2;
|
8
|
-
override getFee()
|
9
|
-
{
|
10
|
-
return { active: SecretSecretRecordEstimator.PER_HOUR_ACTIVE, deactive: SecretSecretRecordEstimator.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
|
20
|
-
{
|
21
|
-
return [
|
22
|
-
new FreeCountBonus(100)
|
23
|
-
];
|
24
|
-
}
|
1
|
+
import { FreeCountBonus } from "../bonus/FreeCountBonus";
|
2
|
+
import { Usage } from "../type/Usage";
|
3
|
+
import { BaseEstimator } from "./BaseEstimator";
|
4
|
+
|
5
|
+
export class SecretSecretRecordEstimator extends BaseEstimator
|
6
|
+
{
|
7
|
+
static PER_HOUR_ACTIVE = 2;
|
8
|
+
override getFee()
|
9
|
+
{
|
10
|
+
return { active: SecretSecretRecordEstimator.PER_HOUR_ACTIVE, deactive: SecretSecretRecordEstimator.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 getBonuses()
|
20
|
+
{
|
21
|
+
return [
|
22
|
+
new FreeCountBonus(100)
|
23
|
+
];
|
24
|
+
}
|
25
25
|
}
|
package/src/index.ts
CHANGED
@@ -18,17 +18,6 @@
|
|
18
18
|
/* */
|
19
19
|
/****************************************************************/
|
20
20
|
|
21
|
-
export * from "./bonus/BaseBonus";
|
22
|
-
export * from "./estimator/BaseEstimator";
|
23
|
-
export * from "./estimator/BillWatchAWSRecordEstimator";
|
24
|
-
export * from "./estimator/BillWatchAzureRecordEstimator";
|
25
|
-
export * from "./estimator/BillWatchBaseRecordEstimator";
|
26
|
-
export * from "./estimator/BillWatchGCPRecordEstimator";
|
27
|
-
export * from "./estimator/FieldBaseRecordEstimator";
|
28
|
-
export * from "./estimator/FieldCategoryRecordEstimator";
|
29
|
-
export * from "./estimator/FieldFieldRecordEstimator";
|
30
|
-
export * from "./estimator/SecretSecretRecordEstimator";
|
31
|
-
export * from "./estimator/SecretSecretReadEstimator";
|
32
21
|
export * from "./NamirasoftCostServer";
|
33
22
|
export * from "./NamirasoftCostServerBase";
|
34
23
|
export * from "./NamirasoftCostServerBillWatchAWS";
|
@@ -41,9 +30,55 @@ export * from "./NamirasoftCostServerHealthz";
|
|
41
30
|
export * from "./NamirasoftCostServerMetrics";
|
42
31
|
export * from "./NamirasoftCostServerSecretSecret";
|
43
32
|
export * from "./NamirasoftCostServerValue";
|
33
|
+
export * from "./bonus/BaseBonus";
|
34
|
+
export * from "./bonus/DeactiveBonus";
|
35
|
+
export * from "./bonus/FreeCountBonus";
|
36
|
+
export * from "./bonus/FreeTotalValueBonus";
|
37
|
+
export * from "./bonus/LowAmountBonus";
|
38
|
+
export * from "./bonus/LowSecondsBonus";
|
39
|
+
export * from "./bonus/LowTotalCountBonus";
|
40
|
+
export * from "./bonus/LowTotalValueBonus";
|
41
|
+
export * from "./bonus/TrialBonus";
|
42
|
+
export * from "./command/BillWatchAWSCommand";
|
43
|
+
export * from "./command/BillWatchAWSEstimateRecordCommand";
|
44
|
+
export * from "./command/BillWatchAWS_CreateForRecordCommand";
|
45
|
+
export * from "./command/BillWatchAzureCommand";
|
46
|
+
export * from "./command/BillWatchAzureEstimateRecordCommand";
|
47
|
+
export * from "./command/BillWatchAzure_CreateForRecordCommand";
|
48
|
+
export * from "./command/BillWatchGCPCommand";
|
49
|
+
export * from "./command/BillWatchGCPEstimateRecordCommand";
|
50
|
+
export * from "./command/BillWatchGCP_CreateForRecordCommand";
|
51
|
+
export * from "./command/CostCommand";
|
52
|
+
export * from "./command/CostListCommand";
|
53
|
+
export * from "./command/FieldCategoryCommand";
|
54
|
+
export * from "./command/FieldCategoryEstimateRecordCommand";
|
55
|
+
export * from "./command/FieldCategory_CreateForRecordCommand";
|
56
|
+
export * from "./command/FieldFieldCommand";
|
57
|
+
export * from "./command/FieldFieldEstimateRecordCommand";
|
58
|
+
export * from "./command/FieldField_CreateForRecordCommand";
|
59
|
+
export * from "./command/HealthzCommand";
|
60
|
+
export * from "./command/HealthzGetCommand";
|
61
|
+
export * from "./command/MetricsCommand";
|
62
|
+
export * from "./command/MetricsGetCommand";
|
63
|
+
export * from "./command/SecretSecretCommand";
|
64
|
+
export * from "./command/SecretSecretEstimateReadCommand";
|
65
|
+
export * from "./command/SecretSecretEstimateRecordCommand";
|
66
|
+
export * from "./command/SecretSecret_CreateForReadCommand";
|
67
|
+
export * from "./command/SecretSecret_CreateForRecordCommand";
|
68
|
+
export * from "./command/ValueCommand";
|
69
|
+
export * from "./command/ValueListCommand";
|
70
|
+
export * from "./estimator/BaseEstimator";
|
71
|
+
export * from "./estimator/BillWatchAWSRecordEstimator";
|
72
|
+
export * from "./estimator/BillWatchAzureRecordEstimator";
|
73
|
+
export * from "./estimator/BillWatchBaseRecordEstimator";
|
74
|
+
export * from "./estimator/BillWatchGCPRecordEstimator";
|
75
|
+
export * from "./estimator/FieldBaseRecordEstimator";
|
76
|
+
export * from "./estimator/FieldCategoryRecordEstimator";
|
77
|
+
export * from "./estimator/FieldFieldRecordEstimator";
|
78
|
+
export * from "./estimator/SecretSecretReadEstimator";
|
79
|
+
export * from "./estimator/SecretSecretRecordEstimator";
|
44
80
|
export * from "./meta/CostMetaTable";
|
45
81
|
export * from "./meta/NamirasoftCostMetaDatabase";
|
46
|
-
export * from "./row/CostCreateRow";
|
47
82
|
export * from "./row/CostRow";
|
48
83
|
export * from "./type/Bonus";
|
49
84
|
export * from "./type/CalculationOption";
|
package/src/type/Estimation.ts
CHANGED
@@ -1,17 +0,0 @@
|
|
1
|
-
export type CostCreateRow = {
|
2
|
-
workspace_id: string;
|
3
|
-
product_id: string;
|
4
|
-
sales_item_id: string;
|
5
|
-
offer_id: string;
|
6
|
-
offer_item_id: string;
|
7
|
-
resource_entity: string;
|
8
|
-
resource_id: string;
|
9
|
-
usage_name: string;
|
10
|
-
usage_value: number;
|
11
|
-
usage_unit: string;
|
12
|
-
period_start: Date;
|
13
|
-
period_end: Date;
|
14
|
-
amount: number;
|
15
|
-
currency: string;
|
16
|
-
description: string;
|
17
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"CostCreateRow.js","sourceRoot":"","sources":["../../src/row/CostCreateRow.ts"],"names":[],"mappings":""}
|