namirasoft-cost 1.4.35 → 1.4.36
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 -3
- package/.ns-sdkg-file-keep +27 -27
- package/dist/estimator/SecretSecretReadEstimator.d.ts +1 -0
- package/dist/estimator/SecretSecretReadEstimator.js +2 -1
- package/dist/estimator/SecretSecretReadEstimator.js.map +1 -1
- package/dist/estimator/SecretSecretRecordEstimator.d.ts +1 -0
- package/dist/estimator/SecretSecretRecordEstimator.js +2 -1
- package/dist/estimator/SecretSecretRecordEstimator.js.map +1 -1
- package/package.json +28 -28
- package/src/NamirasoftCostServer.ts +59 -59
- package/src/NamirasoftCostServerBase.ts +29 -29
- package/src/NamirasoftCostServerBillWatchAWS.ts +47 -47
- package/src/NamirasoftCostServerBillWatchAzure.ts +47 -47
- package/src/NamirasoftCostServerBillWatchGCP.ts +47 -47
- package/src/NamirasoftCostServerCost.ts +41 -41
- package/src/NamirasoftCostServerFieldCategory.ts +47 -47
- package/src/NamirasoftCostServerFieldField.ts +47 -47
- package/src/NamirasoftCostServerHealthz.ts +35 -35
- package/src/NamirasoftCostServerMetrics.ts +35 -35
- package/src/NamirasoftCostServerSecretSecret.ts +61 -61
- package/src/NamirasoftCostServerValue.ts +36 -36
- package/src/bonus/BaseBonus.ts +13 -13
- package/src/bonus/DeactiveBonus.ts +14 -14
- package/src/bonus/FreeCountBonus.ts +14 -14
- package/src/bonus/FreeTotalValueBonus.ts +28 -28
- package/src/bonus/FreeValueBonus.ts +24 -24
- package/src/bonus/LowAmountBonus.ts +14 -14
- package/src/bonus/LowSecondsBonus.ts +14 -14
- package/src/bonus/LowTotalValueBonus.ts +14 -14
- package/src/bonus/LowValueBonus.ts +14 -14
- package/src/bonus/TrialBonus.ts +18 -18
- package/src/command/BillWatchAWSCommand.ts +33 -33
- package/src/command/BillWatchAWSEstimateRecordCommand.ts +109 -109
- package/src/command/BillWatchAWS_CreateForRecordCommand.ts +118 -118
- package/src/command/BillWatchAzureCommand.ts +33 -33
- package/src/command/BillWatchAzureEstimateRecordCommand.ts +109 -109
- package/src/command/BillWatchAzure_CreateForRecordCommand.ts +118 -118
- package/src/command/BillWatchGCPCommand.ts +33 -33
- package/src/command/BillWatchGCPEstimateRecordCommand.ts +109 -109
- package/src/command/BillWatchGCP_CreateForRecordCommand.ts +118 -118
- package/src/command/CostCommand.ts +31 -31
- package/src/command/CostListCommand.ts +44 -44
- package/src/command/FieldCategoryCommand.ts +33 -33
- package/src/command/FieldCategoryEstimateRecordCommand.ts +109 -109
- package/src/command/FieldCategory_CreateForRecordCommand.ts +118 -118
- package/src/command/FieldFieldCommand.ts +33 -33
- package/src/command/FieldFieldEstimateRecordCommand.ts +109 -109
- package/src/command/FieldField_CreateForRecordCommand.ts +118 -118
- package/src/command/HealthzCommand.ts +31 -31
- package/src/command/HealthzGetCommand.ts +44 -44
- package/src/command/MetricsCommand.ts +31 -31
- package/src/command/MetricsGetCommand.ts +44 -44
- package/src/command/SecretSecretCommand.ts +37 -37
- package/src/command/SecretSecretEstimateReadCommand.ts +109 -109
- package/src/command/SecretSecretEstimateRecordCommand.ts +109 -109
- package/src/command/SecretSecret_CreateForReadCommand.ts +118 -118
- package/src/command/SecretSecret_CreateForRecordCommand.ts +118 -118
- package/src/command/ValueCommand.ts +31 -31
- package/src/command/ValueListCommand.ts +44 -44
- package/src/command/cli.ts +50 -50
- package/src/estimator/SecretSecretReadEstimator.ts +2 -1
- package/src/estimator/SecretSecretRecordEstimator.ts +2 -1
- package/src/index.ts +90 -90
- package/src/meta/CostMetaTable.ts +81 -81
- package/src/meta/NamirasoftCostMetaDatabase.ts +50 -50
- package/src/row/CostRow.ts +40 -40
- package/src/type/Bonus.ts +20 -20
- package/src/type/CalculationOption.ts +33 -33
- package/src/type/Estimation.ts +34 -34
- package/src/type/EstimationOption.ts +31 -31
- package/src/type/EstimationUsage.ts +22 -22
- package/src/type/Period.ts +101 -101
- package/src/type/SimulationOption.ts +29 -29
- package/src/type/Usage.ts +24 -24
@@ -1,62 +1,62 @@
|
|
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 { CalculationOption } from "./type/CalculationOption";
|
22
|
-
import { CostRow } from "./row/CostRow";
|
23
|
-
import { Estimation } from "./type/Estimation";
|
24
|
-
import { EstimationOption } from "./type/EstimationOption";
|
25
|
-
import { NamirasoftCostServer } from "./NamirasoftCostServer";
|
26
|
-
import { NamirasoftCostServerBase } from "./NamirasoftCostServerBase";
|
27
|
-
|
28
|
-
export class NamirasoftCostServerSecretSecret extends NamirasoftCostServerBase
|
29
|
-
{
|
30
|
-
constructor(server: NamirasoftCostServer)
|
31
|
-
{
|
32
|
-
super(server);
|
33
|
-
this.EstimateRecord = this.EstimateRecord.bind(this);
|
34
|
-
this._CreateForRecord = this._CreateForRecord.bind(this);
|
35
|
-
this.EstimateRead = this.EstimateRead.bind(this);
|
36
|
-
this._CreateForRead = this._CreateForRead.bind(this);
|
37
|
-
}
|
38
|
-
async EstimateRecord(body: EstimationOption): Promise<Estimation[]>
|
39
|
-
{
|
40
|
-
let path = `/estimation/secret/secret/record`;
|
41
|
-
let { data } = await this.server._post<Estimation[]>(path, {}, body);
|
42
|
-
return data;
|
43
|
-
}
|
44
|
-
async _CreateForRecord(user_id: string, body: CalculationOption): Promise<CostRow[]>
|
45
|
-
{
|
46
|
-
let path = `/application/user/${user_id}/cost/secret/secret/record`;
|
47
|
-
let { data } = await this.server._post<CostRow[]>(path, {}, body);
|
48
|
-
return data;
|
49
|
-
}
|
50
|
-
async EstimateRead(body: EstimationOption): Promise<Estimation[]>
|
51
|
-
{
|
52
|
-
let path = `/estimation/secret/secret/read`;
|
53
|
-
let { data } = await this.server._post<Estimation[]>(path, {}, body);
|
54
|
-
return data;
|
55
|
-
}
|
56
|
-
async _CreateForRead(user_id: string, body: CalculationOption): Promise<CostRow[]>
|
57
|
-
{
|
58
|
-
let path = `/application/user/${user_id}/cost/secret/secret/read`;
|
59
|
-
let { data } = await this.server._post<CostRow[]>(path, {}, body);
|
60
|
-
return data;
|
61
|
-
}
|
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 { CalculationOption } from "./type/CalculationOption";
|
22
|
+
import { CostRow } from "./row/CostRow";
|
23
|
+
import { Estimation } from "./type/Estimation";
|
24
|
+
import { EstimationOption } from "./type/EstimationOption";
|
25
|
+
import { NamirasoftCostServer } from "./NamirasoftCostServer";
|
26
|
+
import { NamirasoftCostServerBase } from "./NamirasoftCostServerBase";
|
27
|
+
|
28
|
+
export class NamirasoftCostServerSecretSecret extends NamirasoftCostServerBase
|
29
|
+
{
|
30
|
+
constructor(server: NamirasoftCostServer)
|
31
|
+
{
|
32
|
+
super(server);
|
33
|
+
this.EstimateRecord = this.EstimateRecord.bind(this);
|
34
|
+
this._CreateForRecord = this._CreateForRecord.bind(this);
|
35
|
+
this.EstimateRead = this.EstimateRead.bind(this);
|
36
|
+
this._CreateForRead = this._CreateForRead.bind(this);
|
37
|
+
}
|
38
|
+
async EstimateRecord(body: EstimationOption): Promise<Estimation[]>
|
39
|
+
{
|
40
|
+
let path = `/estimation/secret/secret/record`;
|
41
|
+
let { data } = await this.server._post<Estimation[]>(path, {}, body);
|
42
|
+
return data;
|
43
|
+
}
|
44
|
+
async _CreateForRecord(user_id: string, body: CalculationOption): Promise<CostRow[]>
|
45
|
+
{
|
46
|
+
let path = `/application/user/${user_id}/cost/secret/secret/record`;
|
47
|
+
let { data } = await this.server._post<CostRow[]>(path, {}, body);
|
48
|
+
return data;
|
49
|
+
}
|
50
|
+
async EstimateRead(body: EstimationOption): Promise<Estimation[]>
|
51
|
+
{
|
52
|
+
let path = `/estimation/secret/secret/read`;
|
53
|
+
let { data } = await this.server._post<Estimation[]>(path, {}, body);
|
54
|
+
return data;
|
55
|
+
}
|
56
|
+
async _CreateForRead(user_id: string, body: CalculationOption): Promise<CostRow[]>
|
57
|
+
{
|
58
|
+
let path = `/application/user/${user_id}/cost/secret/secret/read`;
|
59
|
+
let { data } = await this.server._post<CostRow[]>(path, {}, body);
|
60
|
+
return data;
|
61
|
+
}
|
62
62
|
};
|
@@ -1,37 +1,37 @@
|
|
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 { NamirasoftCostServer } from "./NamirasoftCostServer";
|
22
|
-
import { NamirasoftCostServerBase } from "./NamirasoftCostServerBase";
|
23
|
-
|
24
|
-
export class NamirasoftCostServerValue extends NamirasoftCostServerBase
|
25
|
-
{
|
26
|
-
constructor(server: NamirasoftCostServer)
|
27
|
-
{
|
28
|
-
super(server);
|
29
|
-
this.List = this.List.bind(this);
|
30
|
-
}
|
31
|
-
async List(table: string, column: string, search: (string | null), field_id: (string | null), limit: (number | null)): Promise<string[]>
|
32
|
-
{
|
33
|
-
let path = `/value/list/${table}/${column}`;
|
34
|
-
let { data } = await this.server._get<string[]>(path, { search, field_id, limit });
|
35
|
-
return data;
|
36
|
-
}
|
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 { NamirasoftCostServer } from "./NamirasoftCostServer";
|
22
|
+
import { NamirasoftCostServerBase } from "./NamirasoftCostServerBase";
|
23
|
+
|
24
|
+
export class NamirasoftCostServerValue extends NamirasoftCostServerBase
|
25
|
+
{
|
26
|
+
constructor(server: NamirasoftCostServer)
|
27
|
+
{
|
28
|
+
super(server);
|
29
|
+
this.List = this.List.bind(this);
|
30
|
+
}
|
31
|
+
async List(table: string, column: string, search: (string | null), field_id: (string | null), limit: (number | null)): Promise<string[]>
|
32
|
+
{
|
33
|
+
let path = `/value/list/${table}/${column}`;
|
34
|
+
let { data } = await this.server._get<string[]>(path, { search, field_id, limit });
|
35
|
+
return data;
|
36
|
+
}
|
37
37
|
};
|
package/src/bonus/BaseBonus.ts
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
import { Estimation } from "../type/Estimation";
|
2
|
-
import { EstimationOption } from "../type/EstimationOption";
|
3
|
-
|
4
|
-
export abstract class BaseBonus
|
5
|
-
{
|
6
|
-
constructor(public name: string, public unblocker: boolean)
|
7
|
-
{ }
|
8
|
-
abstract isFree(option: EstimationOption, estimation: Estimation): Promise<{
|
9
|
-
free: boolean, split?: {
|
10
|
-
free: EstimationOption;
|
11
|
-
paids: EstimationOption[];
|
12
|
-
}
|
13
|
-
}>;
|
1
|
+
import { Estimation } from "../type/Estimation";
|
2
|
+
import { EstimationOption } from "../type/EstimationOption";
|
3
|
+
|
4
|
+
export abstract class BaseBonus
|
5
|
+
{
|
6
|
+
constructor(public name: string, public unblocker: boolean)
|
7
|
+
{ }
|
8
|
+
abstract isFree(option: EstimationOption, estimation: Estimation): Promise<{
|
9
|
+
free: boolean, split?: {
|
10
|
+
free: EstimationOption;
|
11
|
+
paids: EstimationOption[];
|
12
|
+
}
|
13
|
+
}>;
|
14
14
|
};
|
@@ -1,15 +1,15 @@
|
|
1
|
-
import { Estimation } from "../type/Estimation";
|
2
|
-
import { EstimationOption } from "../type/EstimationOption";
|
3
|
-
import { BaseBonus } from "./BaseBonus";
|
4
|
-
|
5
|
-
export class DeactiveBonus extends BaseBonus
|
6
|
-
{
|
7
|
-
constructor()
|
8
|
-
{
|
9
|
-
super("Deactive", false);
|
10
|
-
}
|
11
|
-
async isFree(option: EstimationOption, _: Estimation)
|
12
|
-
{
|
13
|
-
return { free: !option.active };
|
14
|
-
}
|
1
|
+
import { Estimation } from "../type/Estimation";
|
2
|
+
import { EstimationOption } from "../type/EstimationOption";
|
3
|
+
import { BaseBonus } from "./BaseBonus";
|
4
|
+
|
5
|
+
export class DeactiveBonus extends BaseBonus
|
6
|
+
{
|
7
|
+
constructor()
|
8
|
+
{
|
9
|
+
super("Deactive", false);
|
10
|
+
}
|
11
|
+
async isFree(option: EstimationOption, _: Estimation)
|
12
|
+
{
|
13
|
+
return { free: !option.active };
|
14
|
+
}
|
15
15
|
};
|
@@ -1,15 +1,15 @@
|
|
1
|
-
import { Estimation } from "../type/Estimation";
|
2
|
-
import { EstimationOption } from "../type/EstimationOption";
|
3
|
-
import { BaseBonus } from "./BaseBonus";
|
4
|
-
|
5
|
-
export class FreeCountBonus extends BaseBonus
|
6
|
-
{
|
7
|
-
constructor(public count: number)
|
8
|
-
{
|
9
|
-
super("Free Count", true);
|
10
|
-
}
|
11
|
-
async isFree(option: EstimationOption, _: Estimation)
|
12
|
-
{
|
13
|
-
return { free: option.number <= this.count };
|
14
|
-
}
|
1
|
+
import { Estimation } from "../type/Estimation";
|
2
|
+
import { EstimationOption } from "../type/EstimationOption";
|
3
|
+
import { BaseBonus } from "./BaseBonus";
|
4
|
+
|
5
|
+
export class FreeCountBonus extends BaseBonus
|
6
|
+
{
|
7
|
+
constructor(public count: number)
|
8
|
+
{
|
9
|
+
super("Free Count", true);
|
10
|
+
}
|
11
|
+
async isFree(option: EstimationOption, _: Estimation)
|
12
|
+
{
|
13
|
+
return { free: option.number <= this.count };
|
14
|
+
}
|
15
15
|
};
|
@@ -1,29 +1,29 @@
|
|
1
|
-
import { Estimation } from "../type/Estimation";
|
2
|
-
import { EstimationOption } from "../type/EstimationOption";
|
3
|
-
import { BaseBonus } from "./BaseBonus";
|
4
|
-
|
5
|
-
export class FreeTotalValueBonus extends BaseBonus
|
6
|
-
{
|
7
|
-
constructor(public value: number)
|
8
|
-
{
|
9
|
-
super("Free Total Value", true);
|
10
|
-
}
|
11
|
-
async isFree(option: EstimationOption, _: Estimation)
|
12
|
-
{
|
13
|
-
let exceeded = option.total_value - this.value;
|
14
|
-
if (exceeded > 0)
|
15
|
-
{
|
16
|
-
let value_free = Math.max(option.value - exceeded, 0);
|
17
|
-
let value_paid = option.value - value_free;
|
18
|
-
if (value_free > 0 && value_paid > 0)
|
19
|
-
{
|
20
|
-
let free = { ...option, total_value: this.value, value: value_free };
|
21
|
-
let paid = { ...option, value: value_paid };
|
22
|
-
return { free: true, split: { free, paids: [paid] } };
|
23
|
-
}
|
24
|
-
else if (value_paid > 0)
|
25
|
-
return { free: false };
|
26
|
-
}
|
27
|
-
return { free: true };
|
28
|
-
}
|
1
|
+
import { Estimation } from "../type/Estimation";
|
2
|
+
import { EstimationOption } from "../type/EstimationOption";
|
3
|
+
import { BaseBonus } from "./BaseBonus";
|
4
|
+
|
5
|
+
export class FreeTotalValueBonus extends BaseBonus
|
6
|
+
{
|
7
|
+
constructor(public value: number)
|
8
|
+
{
|
9
|
+
super("Free Total Value", true);
|
10
|
+
}
|
11
|
+
async isFree(option: EstimationOption, _: Estimation)
|
12
|
+
{
|
13
|
+
let exceeded = option.total_value - this.value;
|
14
|
+
if (exceeded > 0)
|
15
|
+
{
|
16
|
+
let value_free = Math.max(option.value - exceeded, 0);
|
17
|
+
let value_paid = option.value - value_free;
|
18
|
+
if (value_free > 0 && value_paid > 0)
|
19
|
+
{
|
20
|
+
let free = { ...option, total_value: this.value, value: value_free };
|
21
|
+
let paid = { ...option, value: value_paid };
|
22
|
+
return { free: true, split: { free, paids: [paid] } };
|
23
|
+
}
|
24
|
+
else if (value_paid > 0)
|
25
|
+
return { free: false };
|
26
|
+
}
|
27
|
+
return { free: true };
|
28
|
+
}
|
29
29
|
};
|
@@ -1,25 +1,25 @@
|
|
1
|
-
import { Estimation } from "../type/Estimation";
|
2
|
-
import { EstimationOption } from "../type/EstimationOption";
|
3
|
-
import { BaseBonus } from "./BaseBonus";
|
4
|
-
|
5
|
-
export class FreeValueBonus extends BaseBonus
|
6
|
-
{
|
7
|
-
constructor(public value: number)
|
8
|
-
{
|
9
|
-
super("Free Value", true);
|
10
|
-
}
|
11
|
-
async isFree(option: EstimationOption, _: Estimation)
|
12
|
-
{
|
13
|
-
let exceeded = option.value - this.value;
|
14
|
-
if (exceeded > 0)
|
15
|
-
{
|
16
|
-
let value_free = this.value;
|
17
|
-
let value_paid = exceeded;
|
18
|
-
|
19
|
-
let free = { ...option, total_value: option.total_value - value_paid, value: value_free };
|
20
|
-
let paid = { ...option, value: value_paid };
|
21
|
-
return { free: true, split: { free, paids: [paid] } };
|
22
|
-
}
|
23
|
-
return { free: true };
|
24
|
-
}
|
1
|
+
import { Estimation } from "../type/Estimation";
|
2
|
+
import { EstimationOption } from "../type/EstimationOption";
|
3
|
+
import { BaseBonus } from "./BaseBonus";
|
4
|
+
|
5
|
+
export class FreeValueBonus extends BaseBonus
|
6
|
+
{
|
7
|
+
constructor(public value: number)
|
8
|
+
{
|
9
|
+
super("Free Value", true);
|
10
|
+
}
|
11
|
+
async isFree(option: EstimationOption, _: Estimation)
|
12
|
+
{
|
13
|
+
let exceeded = option.value - this.value;
|
14
|
+
if (exceeded > 0)
|
15
|
+
{
|
16
|
+
let value_free = this.value;
|
17
|
+
let value_paid = exceeded;
|
18
|
+
|
19
|
+
let free = { ...option, total_value: option.total_value - value_paid, value: value_free };
|
20
|
+
let paid = { ...option, value: value_paid };
|
21
|
+
return { free: true, split: { free, paids: [paid] } };
|
22
|
+
}
|
23
|
+
return { free: true };
|
24
|
+
}
|
25
25
|
};
|
@@ -1,15 +1,15 @@
|
|
1
|
-
import { Estimation } from "../type/Estimation";
|
2
|
-
import { EstimationOption } from "../type/EstimationOption";
|
3
|
-
import { BaseBonus } from "./BaseBonus";
|
4
|
-
|
5
|
-
export class LowAmountBonus extends BaseBonus
|
6
|
-
{
|
7
|
-
constructor(public amount: number)
|
8
|
-
{
|
9
|
-
super("Low Amount", false);
|
10
|
-
}
|
11
|
-
async isFree(_: EstimationOption, estimation: Estimation)
|
12
|
-
{
|
13
|
-
return { free: estimation.amount <= this.amount };
|
14
|
-
}
|
1
|
+
import { Estimation } from "../type/Estimation";
|
2
|
+
import { EstimationOption } from "../type/EstimationOption";
|
3
|
+
import { BaseBonus } from "./BaseBonus";
|
4
|
+
|
5
|
+
export class LowAmountBonus extends BaseBonus
|
6
|
+
{
|
7
|
+
constructor(public amount: number)
|
8
|
+
{
|
9
|
+
super("Low Amount", false);
|
10
|
+
}
|
11
|
+
async isFree(_: EstimationOption, estimation: Estimation)
|
12
|
+
{
|
13
|
+
return { free: estimation.amount <= this.amount };
|
14
|
+
}
|
15
15
|
};
|
@@ -1,15 +1,15 @@
|
|
1
|
-
import { Estimation } from "../type/Estimation";
|
2
|
-
import { EstimationOption } from "../type/EstimationOption";
|
3
|
-
import { BaseBonus } from "./BaseBonus";
|
4
|
-
|
5
|
-
export class LowSecondsBonus extends BaseBonus
|
6
|
-
{
|
7
|
-
constructor(public seconds: number)
|
8
|
-
{
|
9
|
-
super("Low Seconds", false);
|
10
|
-
}
|
11
|
-
async isFree(_: EstimationOption, estimation: Estimation)
|
12
|
-
{
|
13
|
-
return { free: estimation.seconds <= this.seconds };
|
14
|
-
}
|
1
|
+
import { Estimation } from "../type/Estimation";
|
2
|
+
import { EstimationOption } from "../type/EstimationOption";
|
3
|
+
import { BaseBonus } from "./BaseBonus";
|
4
|
+
|
5
|
+
export class LowSecondsBonus extends BaseBonus
|
6
|
+
{
|
7
|
+
constructor(public seconds: number)
|
8
|
+
{
|
9
|
+
super("Low Seconds", false);
|
10
|
+
}
|
11
|
+
async isFree(_: EstimationOption, estimation: Estimation)
|
12
|
+
{
|
13
|
+
return { free: estimation.seconds <= this.seconds };
|
14
|
+
}
|
15
15
|
};
|
@@ -1,15 +1,15 @@
|
|
1
|
-
import { Estimation } from "../type/Estimation";
|
2
|
-
import { EstimationOption } from "../type/EstimationOption";
|
3
|
-
import { BaseBonus } from "./BaseBonus";
|
4
|
-
|
5
|
-
export class LowTotalValueBonus extends BaseBonus
|
6
|
-
{
|
7
|
-
constructor(public value: number)
|
8
|
-
{
|
9
|
-
super("Low Total Value", true);
|
10
|
-
}
|
11
|
-
async isFree(option: EstimationOption, _: Estimation)
|
12
|
-
{
|
13
|
-
return { free: option.total_value <= this.value };
|
14
|
-
}
|
1
|
+
import { Estimation } from "../type/Estimation";
|
2
|
+
import { EstimationOption } from "../type/EstimationOption";
|
3
|
+
import { BaseBonus } from "./BaseBonus";
|
4
|
+
|
5
|
+
export class LowTotalValueBonus extends BaseBonus
|
6
|
+
{
|
7
|
+
constructor(public value: number)
|
8
|
+
{
|
9
|
+
super("Low Total Value", true);
|
10
|
+
}
|
11
|
+
async isFree(option: EstimationOption, _: Estimation)
|
12
|
+
{
|
13
|
+
return { free: option.total_value <= this.value };
|
14
|
+
}
|
15
15
|
};
|
@@ -1,15 +1,15 @@
|
|
1
|
-
import { Estimation } from "../type/Estimation";
|
2
|
-
import { EstimationOption } from "../type/EstimationOption";
|
3
|
-
import { BaseBonus } from "./BaseBonus";
|
4
|
-
|
5
|
-
export class LowValueBonus extends BaseBonus
|
6
|
-
{
|
7
|
-
constructor(public value: number)
|
8
|
-
{
|
9
|
-
super("Low Value", true);
|
10
|
-
}
|
11
|
-
async isFree(option: EstimationOption, _: Estimation)
|
12
|
-
{
|
13
|
-
return { free: option.value <= this.value };
|
14
|
-
}
|
1
|
+
import { Estimation } from "../type/Estimation";
|
2
|
+
import { EstimationOption } from "../type/EstimationOption";
|
3
|
+
import { BaseBonus } from "./BaseBonus";
|
4
|
+
|
5
|
+
export class LowValueBonus extends BaseBonus
|
6
|
+
{
|
7
|
+
constructor(public value: number)
|
8
|
+
{
|
9
|
+
super("Low Value", true);
|
10
|
+
}
|
11
|
+
async isFree(option: EstimationOption, _: Estimation)
|
12
|
+
{
|
13
|
+
return { free: option.value <= this.value };
|
14
|
+
}
|
15
15
|
};
|
package/src/bonus/TrialBonus.ts
CHANGED
@@ -1,19 +1,19 @@
|
|
1
|
-
import { DurationUnit, TimeUnitOperation } from "namirasoft-core";
|
2
|
-
import { Estimation } from "../type/Estimation";
|
3
|
-
import { EstimationOption } from "../type/EstimationOption";
|
4
|
-
import { PeriodUtil } from "../type/Period";
|
5
|
-
import { BaseBonus } from "./BaseBonus";
|
6
|
-
|
7
|
-
export class TrialBonus extends BaseBonus
|
8
|
-
{
|
9
|
-
constructor(public value: number, public unit: DurationUnit)
|
10
|
-
{
|
11
|
-
super("Trial", false);
|
12
|
-
}
|
13
|
-
async isFree(option: EstimationOption, _: Estimation)
|
14
|
-
{
|
15
|
-
let { start } = PeriodUtil.toDates(option.period);
|
16
|
-
let trial_ends_at = TimeUnitOperation.later(this.value, this.unit, option.trial_started_at)
|
17
|
-
return { free: start <= trial_ends_at };
|
18
|
-
}
|
1
|
+
import { DurationUnit, TimeUnitOperation } from "namirasoft-core";
|
2
|
+
import { Estimation } from "../type/Estimation";
|
3
|
+
import { EstimationOption } from "../type/EstimationOption";
|
4
|
+
import { PeriodUtil } from "../type/Period";
|
5
|
+
import { BaseBonus } from "./BaseBonus";
|
6
|
+
|
7
|
+
export class TrialBonus extends BaseBonus
|
8
|
+
{
|
9
|
+
constructor(public value: number, public unit: DurationUnit)
|
10
|
+
{
|
11
|
+
super("Trial", false);
|
12
|
+
}
|
13
|
+
async isFree(option: EstimationOption, _: Estimation)
|
14
|
+
{
|
15
|
+
let { start } = PeriodUtil.toDates(option.period);
|
16
|
+
let trial_ends_at = TimeUnitOperation.later(this.value, this.unit, option.trial_started_at)
|
17
|
+
return { free: start <= trial_ends_at };
|
18
|
+
}
|
19
19
|
};
|
@@ -1,34 +1,34 @@
|
|
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 { BaseNavigatorCommand } from "namirasoft-node-cli";
|
22
|
-
import { BillWatchAWSEstimateRecordCommand } from "./BillWatchAWSEstimateRecordCommand";
|
23
|
-
import { BillWatchAWS_CreateForRecordCommand } from "./BillWatchAWS_CreateForRecordCommand";
|
24
|
-
|
25
|
-
export class BillWatchAWSCommand extends BaseNavigatorCommand
|
26
|
-
{
|
27
|
-
constructor(argv: string[])
|
28
|
-
{
|
29
|
-
super(argv, {
|
30
|
-
"estimaterecord": BillWatchAWSEstimateRecordCommand,
|
31
|
-
"_createforrecord": BillWatchAWS_CreateForRecordCommand,
|
32
|
-
});
|
33
|
-
}
|
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 { BaseNavigatorCommand } from "namirasoft-node-cli";
|
22
|
+
import { BillWatchAWSEstimateRecordCommand } from "./BillWatchAWSEstimateRecordCommand";
|
23
|
+
import { BillWatchAWS_CreateForRecordCommand } from "./BillWatchAWS_CreateForRecordCommand";
|
24
|
+
|
25
|
+
export class BillWatchAWSCommand extends BaseNavigatorCommand
|
26
|
+
{
|
27
|
+
constructor(argv: string[])
|
28
|
+
{
|
29
|
+
super(argv, {
|
30
|
+
"estimaterecord": BillWatchAWSEstimateRecordCommand,
|
31
|
+
"_createforrecord": BillWatchAWS_CreateForRecordCommand,
|
32
|
+
});
|
33
|
+
}
|
34
34
|
};
|