namirasoft-cost 1.4.1 → 1.4.4

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.
Files changed (60) hide show
  1. package/dist/NamirasoftCostServer.d.ts +4 -0
  2. package/dist/NamirasoftCostServer.js +5 -1
  3. package/dist/NamirasoftCostServer.js.map +1 -1
  4. package/dist/NamirasoftCostServerBillWatchAWS.d.ts +1 -2
  5. package/dist/NamirasoftCostServerBillWatchAWS.js.map +1 -1
  6. package/dist/NamirasoftCostServerBillWatchAzure.d.ts +11 -0
  7. package/dist/NamirasoftCostServerBillWatchAzure.js +29 -0
  8. package/dist/NamirasoftCostServerBillWatchAzure.js.map +1 -0
  9. package/dist/NamirasoftCostServerBillWatchGCP.d.ts +11 -0
  10. package/dist/NamirasoftCostServerBillWatchGCP.js +29 -0
  11. package/dist/NamirasoftCostServerBillWatchGCP.js.map +1 -0
  12. package/dist/NamirasoftCostServerCost.d.ts +1 -1
  13. package/dist/NamirasoftCostServerCost.js +3 -3
  14. package/dist/NamirasoftCostServerCost.js.map +1 -1
  15. package/dist/command/BillWatchAWSEstimationCommand.js +4 -13
  16. package/dist/command/BillWatchAWSEstimationCommand.js.map +1 -1
  17. package/dist/command/BillWatchAzureCommand.d.ts +4 -0
  18. package/dist/command/BillWatchAzureCommand.js +15 -0
  19. package/dist/command/BillWatchAzureCommand.js.map +1 -0
  20. package/dist/command/BillWatchAzureEstimationCommand.d.ts +5 -0
  21. package/dist/command/BillWatchAzureEstimationCommand.js +58 -0
  22. package/dist/command/BillWatchAzureEstimationCommand.js.map +1 -0
  23. package/dist/command/BillWatchGCPCommand.d.ts +4 -0
  24. package/dist/command/BillWatchGCPCommand.js +15 -0
  25. package/dist/command/BillWatchGCPCommand.js.map +1 -0
  26. package/dist/command/BillWatchGCPEstimationCommand.d.ts +5 -0
  27. package/dist/command/BillWatchGCPEstimationCommand.js +58 -0
  28. package/dist/command/BillWatchGCPEstimationCommand.js.map +1 -0
  29. package/dist/command/CostCommand.js +2 -2
  30. package/dist/command/CostCommand.js.map +1 -1
  31. package/dist/command/{Cost_CreateCommand.d.ts → Cost_CreateForCommand.d.ts} +1 -1
  32. package/dist/command/{Cost_CreateCommand.js → Cost_CreateForCommand.js} +6 -15
  33. package/dist/command/Cost_CreateForCommand.js.map +1 -0
  34. package/dist/command/cli.js +4 -0
  35. package/dist/command/cli.js.map +1 -1
  36. package/dist/index.d.ts +7 -1
  37. package/dist/index.js +7 -1
  38. package/dist/index.js.map +1 -1
  39. package/dist/meta/NamirasoftCostMetaDatabase.js +1 -1
  40. package/dist/meta/NamirasoftCostMetaDatabase.js.map +1 -1
  41. package/dist/row/CostCreateRow.d.ts +0 -1
  42. package/logo.png +0 -0
  43. package/package.json +4 -4
  44. package/src/NamirasoftCostServer.ts +7 -1
  45. package/src/NamirasoftCostServerBillWatchAWS.ts +1 -1
  46. package/src/NamirasoftCostServerBillWatchAzure.ts +39 -0
  47. package/src/NamirasoftCostServerBillWatchGCP.ts +39 -0
  48. package/src/NamirasoftCostServerCost.ts +3 -3
  49. package/src/command/BillWatchAWSEstimationCommand.ts +4 -13
  50. package/src/command/BillWatchAzureCommand.ts +32 -0
  51. package/src/command/BillWatchAzureEstimationCommand.ts +65 -0
  52. package/src/command/BillWatchGCPCommand.ts +32 -0
  53. package/src/command/BillWatchGCPEstimationCommand.ts +65 -0
  54. package/src/command/CostCommand.ts +2 -2
  55. package/src/command/{Cost_CreateCommand.ts → Cost_CreateForCommand.ts} +3 -12
  56. package/src/command/cli.ts +4 -0
  57. package/src/index.ts +7 -1
  58. package/src/meta/NamirasoftCostMetaDatabase.ts +1 -1
  59. package/src/row/CostCreateRow.ts +0 -1
  60. package/dist/command/Cost_CreateCommand.js.map +0 -1
@@ -7,7 +7,7 @@ const namirasoft_site_1 = require("namirasoft-site");
7
7
  const NamirasoftCostServer_1 = require("../NamirasoftCostServer");
8
8
  class NamirasoftCostMetaDatabase extends namirasoft_site_1.NSBaseMetaDatabase {
9
9
  constructor(manager, onError) {
10
- super({ id: "prd-10bb85099e6f4c0a", name: "Namirasoft History", headline: "Activity Record Keeping", description: "A service that provides a comprehensive record of all activities across all services, such as edit and delete, to keep users informed.", logo: "https://static.namirasoft.com/image/namirasoft/history/logo/base.png", link: "https://history.namirasoft.com" });
10
+ super({ id: "prd-bd9199b941c445bf", name: "Namirasoft Cost", headline: "", description: "", logo: "https://static.namirasoft.com/image/namirasoft/cost/logo/base.png", link: "https://cost.namirasoft.com" });
11
11
  this.manager = manager;
12
12
  this.onError = onError;
13
13
  this.tables = {
@@ -1 +1 @@
1
- {"version":3,"file":"NamirasoftCostMetaDatabase.js","sourceRoot":"","sources":["../../src/meta/NamirasoftCostMetaDatabase.ts"],"names":[],"mappings":";;;AAoBA,mDAAgD;AAChD,qDAA6C;AAC7C,qDAAqD;AACrD,kEAA+D;AAG/D,MAAa,0BAA2B,SAAQ,oCAAwC;IAOpF,YAAY,OAAsB,EAAE,OAAgC;QAEhE,KAAK,CAAC,EAAE,EAAE,EAAE,sBAAsB,EAAE,IAAI,EAAE,oBAAoB,EAAE,QAAQ,EAAE,yBAAyB,EAAE,WAAW,EAAE,wIAAwI,EAAE,IAAI,EAAE,sEAAsE,EAAE,IAAI,EAAE,gCAAgC,EAAE,CAAC,CAAC;QACpX,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG;YACV,IAAI,EAAE,IAAI,6BAAa,CAAC,IAAI,CAAC;SAChC,CAAC;IACN,CAAC;IACQ,SAAS;QAEd,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO;YAC9B,MAAM,IAAI,KAAK,CAAC,gGAAgG,CAAC,CAAA;QACrH,IAAI,IAAI,GAAG,oCAAkB,CAAC,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAClE,IAAI,QAAQ,GAAG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AO,CAAC,CAAC;IAC1E,CAAC;CACJ;AAxBD,gEAwBC;AAAA,CAAC"}
@@ -1,5 +1,4 @@
1
1
  export type CostCreateRow = {
2
- user_id: string;
3
2
  sales_item_id: string;
4
3
  offer_id: string;
5
4
  offer_item_id: string;
package/logo.png CHANGED
Binary file
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "framework": "npm",
9
9
  "application": "package",
10
10
  "private": false,
11
- "version": "1.4.1",
11
+ "version": "1.4.4",
12
12
  "author": "Amir Abolhasani",
13
13
  "license": "MIT",
14
14
  "main": "./dist/index.js",
@@ -17,10 +17,10 @@
17
17
  "build": ""
18
18
  },
19
19
  "dependencies": {
20
- "namirasoft-core": "^1.4.68",
21
- "namirasoft-site": "^1.4.31",
20
+ "namirasoft-core": "^1.4.71",
21
+ "namirasoft-site": "^1.4.36",
22
22
  "namirasoft-node-cli": "^1.4.7",
23
- "namirasoft-account": "^1.4.71"
23
+ "namirasoft-account": "^1.4.72"
24
24
  },
25
25
  "bin": {
26
26
  "ns-cost": "./dist/command/cli.js"
@@ -20,6 +20,8 @@
20
20
 
21
21
  import { NSABaseServer } from "namirasoft-account";
22
22
  import { NamirasoftCostServerBillWatchAWS } from "./NamirasoftCostServerBillWatchAWS";
23
+ import { NamirasoftCostServerBillWatchAzure } from "./NamirasoftCostServerBillWatchAzure";
24
+ import { NamirasoftCostServerBillWatchGCP } from "./NamirasoftCostServerBillWatchGCP";
23
25
  import { NamirasoftCostServerCost } from "./NamirasoftCostServerCost";
24
26
  import { NamirasoftCostServerHealthz } from "./NamirasoftCostServerHealthz";
25
27
  import { NamirasoftCostServerValue } from "./NamirasoftCostServerValue";
@@ -30,13 +32,17 @@ export class NamirasoftCostServer extends NSABaseServer
30
32
  healthz: NamirasoftCostServerHealthz;
31
33
  value: NamirasoftCostServerValue;
32
34
  bill_watch_a_w_s: NamirasoftCostServerBillWatchAWS;
35
+ bill_watch_azure: NamirasoftCostServerBillWatchAzure;
36
+ bill_watch_g_c_p: NamirasoftCostServerBillWatchGCP;
33
37
  cost: NamirasoftCostServerCost;
34
38
  constructor(base_url: string, manager: TokenManager, onError: (error: Error) => void)
35
39
  {
36
- super(base_url, `1.4.1`, manager, onError);
40
+ super(base_url, `1.4.4`, manager, onError);
37
41
  this.healthz = new NamirasoftCostServerHealthz(this);
38
42
  this.value = new NamirasoftCostServerValue(this);
39
43
  this.bill_watch_a_w_s = new NamirasoftCostServerBillWatchAWS(this);
44
+ this.bill_watch_azure = new NamirasoftCostServerBillWatchAzure(this);
45
+ this.bill_watch_g_c_p = new NamirasoftCostServerBillWatchGCP(this);
40
46
  this.cost = new NamirasoftCostServerCost(this);
41
47
  }
42
48
  };
@@ -30,7 +30,7 @@ export class NamirasoftCostServerBillWatchAWS extends NamirasoftCostServerBase
30
30
  super(server);
31
31
  this.Estimation = this.Estimation.bind(this);
32
32
  }
33
- async Estimation(body: { first_watch_created_at: string, period: PeriodRow, regions: string[] }): Promise<EstimationRow>
33
+ async Estimation(body: { period: PeriodRow, active: boolean }): Promise<EstimationRow>
34
34
  {
35
35
  let path = `/estimation/bill-watch/watch/aws`;
36
36
  let { data } = await this.server._post<EstimationRow>(path, {}, body);
@@ -0,0 +1,39 @@
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 { EstimationRow } from "./row/EstimationRow";
22
+ import { NamirasoftCostServer } from "./NamirasoftCostServer";
23
+ import { NamirasoftCostServerBase } from "./NamirasoftCostServerBase";
24
+ import { PeriodRow } from "./row/PeriodRow";
25
+
26
+ export class NamirasoftCostServerBillWatchAzure extends NamirasoftCostServerBase
27
+ {
28
+ constructor(server: NamirasoftCostServer)
29
+ {
30
+ super(server);
31
+ this.Estimation = this.Estimation.bind(this);
32
+ }
33
+ async Estimation(body: { period: PeriodRow, active: boolean }): Promise<EstimationRow>
34
+ {
35
+ let path = `/estimation/bill-watch/watch/azure`;
36
+ let { data } = await this.server._post<EstimationRow>(path, {}, body);
37
+ return data;
38
+ }
39
+ };
@@ -0,0 +1,39 @@
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 { EstimationRow } from "./row/EstimationRow";
22
+ import { NamirasoftCostServer } from "./NamirasoftCostServer";
23
+ import { NamirasoftCostServerBase } from "./NamirasoftCostServerBase";
24
+ import { PeriodRow } from "./row/PeriodRow";
25
+
26
+ export class NamirasoftCostServerBillWatchGCP extends NamirasoftCostServerBase
27
+ {
28
+ constructor(server: NamirasoftCostServer)
29
+ {
30
+ super(server);
31
+ this.Estimation = this.Estimation.bind(this);
32
+ }
33
+ async Estimation(body: { period: PeriodRow, active: boolean }): Promise<EstimationRow>
34
+ {
35
+ let path = `/estimation/bill-watch/watch/gcp`;
36
+ let { data } = await this.server._post<EstimationRow>(path, {}, body);
37
+ return data;
38
+ }
39
+ };
@@ -31,7 +31,7 @@ export class NamirasoftCostServerCost extends NamirasoftCostServerBase
31
31
  {
32
32
  super(server);
33
33
  this.List = this.List.bind(this);
34
- this._Create = this._Create.bind(this);
34
+ this._CreateFor = this._CreateFor.bind(this);
35
35
  }
36
36
  async List(filters: FilterItem[] | null, page: (number | null), size: (number | null), sorts: SortItem[]): Promise<{ rows: CostRow[], count: number }>
37
37
  {
@@ -41,9 +41,9 @@ export class NamirasoftCostServerCost extends NamirasoftCostServerBase
41
41
  let { data } = await this.server._get<{ rows: CostRow[], count: number }>(path, { filters: filters_string_value, page, size, sorts: sorts_string_value });
42
42
  return data;
43
43
  }
44
- async _Create(body: CostCreateRow): Promise<CostRow>
44
+ async _CreateFor(user_id: string, body: CostCreateRow): Promise<CostRow>
45
45
  {
46
- let path = `/application/cost`;
46
+ let path = `/application/user/${user_id}/cost`;
47
47
  let { data } = await this.server._post<CostRow>(path, {}, body);
48
48
  return data;
49
49
  }
@@ -28,14 +28,6 @@ export class BillWatchAWSEstimationCommand extends BaseFinalCommand
28
28
  constructor(argv: string[])
29
29
  {
30
30
  super(argv, [], [
31
- {
32
- name: "first_watch_created_at",
33
- short: "",
34
- description: "Provides the value of 'first_watch_created_at' in body",
35
- optional: false,
36
- args: ["first_watch_created_at"],
37
- defaults: [""]
38
- },
39
31
  {
40
32
  name: "period",
41
33
  short: "",
@@ -45,11 +37,11 @@ export class BillWatchAWSEstimationCommand extends BaseFinalCommand
45
37
  defaults: [""]
46
38
  },
47
39
  {
48
- name: "regions",
40
+ name: "active",
49
41
  short: "",
50
- description: "Provides the value of 'regions' in body",
42
+ description: "Provides the value of 'active' in body",
51
43
  optional: false,
52
- args: ["regions"],
44
+ args: ["active"],
53
45
  defaults: [""]
54
46
  }
55
47
  ]);
@@ -65,9 +57,8 @@ export class BillWatchAWSEstimationCommand extends BaseFinalCommand
65
57
  let url = this.app.storage.getItem("ns-cost-server-url");
66
58
  let server = new NamirasoftCostServer(url, manager, e => this.app.logger.error(e.message));
67
59
  let ans = await server.bill_watch_a_w_s.Estimation({
68
- first_watch_created_at: this.option_values.first_watch_created_at,
69
60
  period: this.option_values.period,
70
- regions: this.option_values.regions
61
+ active: this.option_values.active
71
62
  });
72
63
  this.app.logger.success(JSON.stringify(ans));
73
64
  }
@@ -0,0 +1,32 @@
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 { BillWatchAzureEstimationCommand } from "./BillWatchAzureEstimationCommand";
23
+
24
+ export class BillWatchAzureCommand extends BaseNavigatorCommand
25
+ {
26
+ constructor(argv: string[])
27
+ {
28
+ super(argv, {
29
+ "estimation": BillWatchAzureEstimationCommand,
30
+ });
31
+ }
32
+ };
@@ -0,0 +1,65 @@
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 BillWatchAzureEstimationCommand extends BaseFinalCommand
27
+ {
28
+ constructor(argv: string[])
29
+ {
30
+ super(argv, [], [
31
+ {
32
+ name: "period",
33
+ short: "",
34
+ description: "Provides the value of 'period' in body",
35
+ optional: false,
36
+ args: ["period"],
37
+ defaults: [""]
38
+ },
39
+ {
40
+ name: "active",
41
+ short: "",
42
+ description: "Provides the value of 'active' in body",
43
+ optional: false,
44
+ args: ["active"],
45
+ defaults: [""]
46
+ }
47
+ ]);
48
+ }
49
+ override async exec()
50
+ {
51
+ let token = this.app.storage.getNSAToken();
52
+ if (token == null)
53
+ throw new Error("Token is not available. Please login first using:\nns-cost account config \nor \nns-cost account login.");
54
+ let storage = new IStorageMemoryDedicated();
55
+ let manager = new TokenManager(storage, () => { });
56
+ manager.setValue(token, false);
57
+ let url = this.app.storage.getItem("ns-cost-server-url");
58
+ let server = new NamirasoftCostServer(url, manager, e => this.app.logger.error(e.message));
59
+ let ans = await server.bill_watch_azure.Estimation({
60
+ period: this.option_values.period,
61
+ active: this.option_values.active
62
+ });
63
+ this.app.logger.success(JSON.stringify(ans));
64
+ }
65
+ };
@@ -0,0 +1,32 @@
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 { BillWatchGCPEstimationCommand } from "./BillWatchGCPEstimationCommand";
23
+
24
+ export class BillWatchGCPCommand extends BaseNavigatorCommand
25
+ {
26
+ constructor(argv: string[])
27
+ {
28
+ super(argv, {
29
+ "estimation": BillWatchGCPEstimationCommand,
30
+ });
31
+ }
32
+ };
@@ -0,0 +1,65 @@
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 BillWatchGCPEstimationCommand extends BaseFinalCommand
27
+ {
28
+ constructor(argv: string[])
29
+ {
30
+ super(argv, [], [
31
+ {
32
+ name: "period",
33
+ short: "",
34
+ description: "Provides the value of 'period' in body",
35
+ optional: false,
36
+ args: ["period"],
37
+ defaults: [""]
38
+ },
39
+ {
40
+ name: "active",
41
+ short: "",
42
+ description: "Provides the value of 'active' in body",
43
+ optional: false,
44
+ args: ["active"],
45
+ defaults: [""]
46
+ }
47
+ ]);
48
+ }
49
+ override async exec()
50
+ {
51
+ let token = this.app.storage.getNSAToken();
52
+ if (token == null)
53
+ throw new Error("Token is not available. Please login first using:\nns-cost account config \nor \nns-cost account login.");
54
+ let storage = new IStorageMemoryDedicated();
55
+ let manager = new TokenManager(storage, () => { });
56
+ manager.setValue(token, false);
57
+ let url = this.app.storage.getItem("ns-cost-server-url");
58
+ let server = new NamirasoftCostServer(url, manager, e => this.app.logger.error(e.message));
59
+ let ans = await server.bill_watch_g_c_p.Estimation({
60
+ period: this.option_values.period,
61
+ active: this.option_values.active
62
+ });
63
+ this.app.logger.success(JSON.stringify(ans));
64
+ }
65
+ };
@@ -20,7 +20,7 @@
20
20
 
21
21
  import { BaseNavigatorCommand } from "namirasoft-node-cli";
22
22
  import { CostListCommand } from "./CostListCommand";
23
- import { Cost_CreateCommand } from "./Cost_CreateCommand";
23
+ import { Cost_CreateForCommand } from "./Cost_CreateForCommand";
24
24
 
25
25
  export class CostCommand extends BaseNavigatorCommand
26
26
  {
@@ -28,7 +28,7 @@ export class CostCommand extends BaseNavigatorCommand
28
28
  {
29
29
  super(argv, {
30
30
  "list": CostListCommand,
31
- "_create": Cost_CreateCommand,
31
+ "_createfor": Cost_CreateForCommand,
32
32
  });
33
33
  }
34
34
  };
@@ -23,19 +23,11 @@ import { IStorageMemoryDedicated } from "namirasoft-core";
23
23
  import { NamirasoftCostServer } from "../NamirasoftCostServer";
24
24
  import { TokenManager } from "namirasoft-account";
25
25
 
26
- export class Cost_CreateCommand extends BaseFinalCommand
26
+ export class Cost_CreateForCommand extends BaseFinalCommand
27
27
  {
28
28
  constructor(argv: string[])
29
29
  {
30
- super(argv, [], [
31
- {
32
- name: "user_id",
33
- short: "",
34
- description: "Provides the value of 'user_id' in body",
35
- optional: false,
36
- args: ["user_id"],
37
- defaults: [""]
38
- },
30
+ super(argv, ["user_id"], [
39
31
  {
40
32
  name: "sales_item_id",
41
33
  short: "",
@@ -160,8 +152,7 @@ export class Cost_CreateCommand extends BaseFinalCommand
160
152
  manager.setValue(token, false);
161
153
  let url = this.app.storage.getItem("ns-cost-server-url");
162
154
  let server = new NamirasoftCostServer(url, manager, e => this.app.logger.error(e.message));
163
- let ans = await server.cost._Create({
164
- user_id: this.option_values.user_id,
155
+ let ans = await server.cost._CreateFor(this.arg_values[0], {
165
156
  sales_item_id: this.option_values.sales_item_id,
166
157
  offer_id: this.option_values.offer_id,
167
158
  offer_item_id: this.option_values.offer_item_id,
@@ -22,6 +22,8 @@
22
22
  import { AccountCommand } from "namirasoft-account";
23
23
  import { Application, BaseStorage } from "namirasoft-node-cli";
24
24
  import { BillWatchAWSCommand } from "./BillWatchAWSCommand";
25
+ import { BillWatchAzureCommand } from "./BillWatchAzureCommand";
26
+ import { BillWatchGCPCommand } from "./BillWatchGCPCommand";
25
27
  import { ConfigCommand } from "namirasoft-node-cli";
26
28
  import { CostCommand } from "./CostCommand";
27
29
  import { HealthzCommand } from "./HealthzCommand";
@@ -32,6 +34,8 @@ let app = new Application("ns-cost", new BaseStorage(),
32
34
  "healthz": HealthzCommand,
33
35
  "value": ValueCommand,
34
36
  "billwatchaws": BillWatchAWSCommand,
37
+ "billwatchazure": BillWatchAzureCommand,
38
+ "billwatchgcp": BillWatchGCPCommand,
35
39
  "cost": CostCommand,
36
40
  "account": AccountCommand,
37
41
  "config": (argv: string[]) => new ConfigCommand(argv, ["ns-cost-server-url"])
package/src/index.ts CHANGED
@@ -21,14 +21,20 @@
21
21
  export * from "./NamirasoftCostServer";
22
22
  export * from "./NamirasoftCostServerBase";
23
23
  export * from "./NamirasoftCostServerBillWatchAWS";
24
+ export * from "./NamirasoftCostServerBillWatchAzure";
25
+ export * from "./NamirasoftCostServerBillWatchGCP";
24
26
  export * from "./NamirasoftCostServerCost";
25
27
  export * from "./NamirasoftCostServerHealthz";
26
28
  export * from "./NamirasoftCostServerValue";
27
29
  export * from "./command/BillWatchAWSCommand";
28
30
  export * from "./command/BillWatchAWSEstimationCommand";
31
+ export * from "./command/BillWatchAzureCommand";
32
+ export * from "./command/BillWatchAzureEstimationCommand";
33
+ export * from "./command/BillWatchGCPCommand";
34
+ export * from "./command/BillWatchGCPEstimationCommand";
29
35
  export * from "./command/CostCommand";
30
36
  export * from "./command/CostListCommand";
31
- export * from "./command/Cost_CreateCommand";
37
+ export * from "./command/Cost_CreateForCommand";
32
38
  export * from "./command/HealthzCommand";
33
39
  export * from "./command/HealthzGetCommand";
34
40
  export * from "./command/ValueCommand";
@@ -33,7 +33,7 @@ export class NamirasoftCostMetaDatabase extends NSBaseMetaDatabase<NamirasoftCos
33
33
  };
34
34
  constructor(manager?: TokenManager, onError?: (error: Error) => void)
35
35
  {
36
- super({ id: "prd-10bb85099e6f4c0a", name: "Namirasoft History", headline: "Activity Record Keeping", description: "A service that provides a comprehensive record of all activities across all services, such as edit and delete, to keep users informed.", logo: "https://static.namirasoft.com/image/namirasoft/history/logo/base.png", link: "https://history.namirasoft.com" });
36
+ super({ id: "prd-bd9199b941c445bf", name: "Namirasoft Cost", headline: "", description: "", logo: "https://static.namirasoft.com/image/namirasoft/cost/logo/base.png", link: "https://cost.namirasoft.com" });
37
37
  this.manager = manager;
38
38
  this.onError = onError;
39
39
  this.tables = {
@@ -20,7 +20,6 @@
20
20
 
21
21
  export type CostCreateRow =
22
22
  {
23
- user_id: string;
24
23
  sales_item_id: string;
25
24
  offer_id: string;
26
25
  offer_item_id: string;
@@ -1 +0,0 @@
1
- {"version":3,"file":"Cost_CreateCommand.js","sourceRoot":"","sources":["../../src/command/Cost_CreateCommand.ts"],"names":[],"mappings":";;;;;;;;;;;;AAoBA,6DAAuD;AACvD,qDAA0D;AAC1D,kEAA+D;AAC/D,2DAAkD;AAElD,MAAa,kBAAmB,SAAQ,sCAAgB;IAEpD,YAAY,IAAc;QAEtB,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE;YACZ;gBACI,IAAI,EAAE,SAAS;gBACf,KAAK,EAAE,EAAE;gBACT,WAAW,EAAE,yCAAyC;gBACtD,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,CAAC,SAAS,CAAC;gBACjB,QAAQ,EAAE,CAAC,EAAE,CAAC;aACjB;YACD;gBACI,IAAI,EAAE,eAAe;gBACrB,KAAK,EAAE,EAAE;gBACT,WAAW,EAAE,+CAA+C;gBAC5D,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,CAAC,eAAe,CAAC;gBACvB,QAAQ,EAAE,CAAC,EAAE,CAAC;aACjB;YACD;gBACI,IAAI,EAAE,UAAU;gBAChB,KAAK,EAAE,EAAE;gBACT,WAAW,EAAE,0CAA0C;gBACvD,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,CAAC,UAAU,CAAC;gBAClB,QAAQ,EAAE,CAAC,EAAE,CAAC;aACjB;YACD;gBACI,IAAI,EAAE,eAAe;gBACrB,KAAK,EAAE,EAAE;gBACT,WAAW,EAAE,+CAA+C;gBAC5D,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,CAAC,eAAe,CAAC;gBACvB,QAAQ,EAAE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