namirasoft-log 1.3.7 → 1.3.9

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.
@@ -1,9 +1,13 @@
1
1
  import { IStream } from "./IStream";
2
2
  import { Log } from "./Log";
3
+ import { NamirasoftLogServer } from "./NamirasoftLogServer";
3
4
  export declare class StreamNamirasoftLog implements IStream {
4
- token: string;
5
- constructor(token: string);
6
- write(_: Log, __: {
5
+ server: NamirasoftLogServer;
6
+ log_group_id: string;
7
+ product_id: (string | null);
8
+ project_id: (string | null);
9
+ constructor(server: NamirasoftLogServer, log_group_id: string, product_id: (string | null), project_id: (string | null));
10
+ write(log: Log, formated: {
7
11
  pre: string[];
8
12
  messages: string[];
9
13
  post: string[];
@@ -2,10 +2,22 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.StreamNamirasoftLog = void 0;
4
4
  class StreamNamirasoftLog {
5
- constructor(token) {
6
- this.token = token;
5
+ constructor(server, log_group_id, product_id, project_id) {
6
+ this.server = server;
7
+ this.log_group_id = log_group_id;
8
+ this.product_id = product_id;
9
+ this.project_id = project_id;
7
10
  }
8
- write(_, __) {
11
+ write(log, formated) {
12
+ let message = [...formated.pre, ...formated.messages, ...formated.post].join("\n");
13
+ this.server.log.Create({
14
+ level: log.level.toString(),
15
+ log_group_id: this.log_group_id,
16
+ product_id: this.product_id,
17
+ project_id: this.project_id,
18
+ message,
19
+ stack: ""
20
+ });
9
21
  }
10
22
  }
11
23
  exports.StreamNamirasoftLog = StreamNamirasoftLog;
@@ -1 +1 @@
1
- {"version":3,"file":"StreamNamirasoftLog.js","sourceRoot":"","sources":["../src/StreamNamirasoftLog.ts"],"names":[],"mappings":";;;AAGA,MAAa,mBAAmB;IAG5B,YAAY,KAAa;QAErB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACvB,CAAC;IACD,KAAK,CAAC,CAAM,EAAE,EAAyD;IAEvE,CAAC;CACJ;AAVD,kDAUC"}
1
+ {"version":3,"file":"StreamNamirasoftLog.js","sourceRoot":"","sources":["../src/StreamNamirasoftLog.ts"],"names":[],"mappings":";;;AAIA,MAAa,mBAAmB;IAM5B,YAAY,MAA2B,EAAE,YAAoB,EAAE,UAA2B,EAAE,UAA2B;QAEnH,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IACjC,CAAC;IACD,KAAK,CAAC,GAAQ,EAAE,QAA+D;QAE3E,IAAI,OAAO,GAAG,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,GAAG,QAAQ,CAAC,QAAQ,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnF,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC;YACnB,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,QAAQ,EAAE;YAC3B,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,OAAO;YACP,KAAK,EAAE,EAAE;SACZ,CAAC,CAAC;IACP,CAAC;CACJ;AAzBD,kDAyBC"}
@@ -17,22 +17,6 @@ const namirasoft_account_1 = require("namirasoft-account");
17
17
  class LogCreateCommand extends namirasoft_node_cli_1.BaseFinalCommand {
18
18
  constructor(argv) {
19
19
  super(argv, [], [
20
- {
21
- name: "id",
22
- short: "",
23
- description: "Provides the value of 'id' in body",
24
- optional: true,
25
- args: ["id"],
26
- defaults: [""]
27
- },
28
- {
29
- name: "user_id",
30
- short: "",
31
- description: "Provides the value of 'user_id' in body",
32
- optional: true,
33
- args: ["user_id"],
34
- defaults: [""]
35
- },
36
20
  {
37
21
  name: "product_id",
38
22
  short: "",
@@ -80,22 +64,6 @@ class LogCreateCommand extends namirasoft_node_cli_1.BaseFinalCommand {
80
64
  optional: true,
81
65
  args: ["stack"],
82
66
  defaults: [""]
83
- },
84
- {
85
- name: "sent",
86
- short: "",
87
- description: "Provides the value of 'sent' in body",
88
- optional: true,
89
- args: ["sent"],
90
- defaults: [""]
91
- },
92
- {
93
- name: "result",
94
- short: "",
95
- description: "Provides the value of 'result' in body",
96
- optional: true,
97
- args: ["result"],
98
- defaults: [""]
99
67
  }
100
68
  ]);
101
69
  }
@@ -109,16 +77,12 @@ class LogCreateCommand extends namirasoft_node_cli_1.BaseFinalCommand {
109
77
  manager.setValue(token, false);
110
78
  let server = new NamirasoftLogServer_1.NamirasoftLogServer(manager, e => this.app.logger.error(e.message));
111
79
  let ans = yield server.log.Create({
112
- id: this.option_values.id,
113
- user_id: this.option_values.user_id,
114
80
  product_id: this.option_values.product_id,
115
81
  project_id: this.option_values.project_id,
116
82
  log_group_id: this.option_values.log_group_id,
117
83
  level: this.option_values.level,
118
84
  message: this.option_values.message,
119
- stack: this.option_values.stack,
120
- sent: this.option_values.sent,
121
- result: this.option_values.result
85
+ stack: this.option_values.stack
122
86
  });
123
87
  this.app.logger.success(JSON.stringify(ans));
124
88
  });
@@ -1 +1 @@
1
- {"version":3,"file":"LogCreateCommand.js","sourceRoot":"","sources":["../../src/command/LogCreateCommand.ts"],"names":[],"mappings":";;;;;;;;;;;;AAqBA,6DAAuD;AACvD,qDAAiD;AACjD,gEAA6D;AAC7D,2DAAkD;AAElD,MAAa,gBAAiB,SAAQ,sCAAgB;IAElD,YAAY,IAAc;QAEtB,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE;YACZ;gBACI,IAAI,EAAE,IAAI;gBACV,KAAK,EAAE,EAAE;gBACT,WAAW,EAAE,oCAAoC;gBACjD,QAAQ,EAAE,IAAI;gBACd,IAAI,EAAE,CAAC,IAAI,CAAC;gBACZ,QAAQ,EAAE,CAAC,EAAE,CAAC;aACjB;YACD;gBACI,IAAI,E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AAG,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC;gBAC9B,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC,UAAU;gBACzC,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC,UAAU;gBACzC,YAAY,EAAE,IAAI,CAAC,aAAa,CAAC,YAAY;gBAC7C,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,KAAK;gBAC/B,OAAO,EAAE,IAAI,CAAC,aAAa,CAAC,OAAO;gBACnC,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,KAAK;aAClC,CAAC,CAAC;YACH,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;QACjD,CAAC;KAAA;CACJ;AA1ED,4CA0EC;AAAA,CAAC"}
@@ -1,12 +1,8 @@
1
1
  export type LogRowInput = {
2
- id: (string | null);
3
- user_id: (string | null);
4
2
  product_id: (string | null);
5
3
  project_id: (string | null);
6
4
  log_group_id: (string | null);
7
5
  level: (string | null);
8
6
  message: (string | null);
9
7
  stack: (string | null);
10
- sent: (boolean | null);
11
- result: (string | null);
12
8
  };
@@ -1 +1,4 @@
1
- export type LogRowOutput = {};
1
+ export type LogRowOutput = {
2
+ id: (string | null);
3
+ user_id: (string | null);
4
+ };
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "framework": "npm",
9
9
  "application": "package",
10
10
  "private": false,
11
- "version": "1.3.7",
11
+ "version": "1.3.9",
12
12
  "author": "Amir Abolhasani",
13
13
  "license": "MIT",
14
14
  "main": "./dist/index.js",
@@ -1,14 +1,30 @@
1
1
  import { IStream } from "./IStream";
2
2
  import { Log } from "./Log";
3
+ import { NamirasoftLogServer } from "./NamirasoftLogServer";
3
4
 
4
5
  export class StreamNamirasoftLog implements IStream
5
6
  {
6
- token: string;
7
- constructor(token: string)
7
+ server: NamirasoftLogServer;
8
+ log_group_id: string;
9
+ product_id: (string | null);
10
+ project_id: (string | null);
11
+ constructor(server: NamirasoftLogServer, log_group_id: string, product_id: (string | null), project_id: (string | null))
8
12
  {
9
- this.token = token;
13
+ this.server = server;
14
+ this.log_group_id = log_group_id;
15
+ this.product_id = product_id;
16
+ this.project_id = project_id;
10
17
  }
11
- write(_: Log, __: { pre: string[], messages: string[], post: string[] }): void
18
+ write(log: Log, formated: { pre: string[], messages: string[], post: string[] }): void
12
19
  {
20
+ let message = [...formated.pre, ...formated.messages, ...formated.post].join("\n");
21
+ this.server.log.Create({
22
+ level: log.level.toString(),
23
+ log_group_id: this.log_group_id,
24
+ product_id: this.product_id,
25
+ project_id: this.project_id,
26
+ message,
27
+ stack: ""
28
+ });
13
29
  }
14
30
  }
@@ -29,22 +29,6 @@ export class LogCreateCommand extends BaseFinalCommand
29
29
  constructor(argv: string[])
30
30
  {
31
31
  super(argv, [], [
32
- {
33
- name: "id",
34
- short: "",
35
- description: "Provides the value of 'id' in body",
36
- optional: true,
37
- args: ["id"],
38
- defaults: [""]
39
- },
40
- {
41
- name: "user_id",
42
- short: "",
43
- description: "Provides the value of 'user_id' in body",
44
- optional: true,
45
- args: ["user_id"],
46
- defaults: [""]
47
- },
48
32
  {
49
33
  name: "product_id",
50
34
  short: "",
@@ -92,22 +76,6 @@ export class LogCreateCommand extends BaseFinalCommand
92
76
  optional: true,
93
77
  args: ["stack"],
94
78
  defaults: [""]
95
- },
96
- {
97
- name: "sent",
98
- short: "",
99
- description: "Provides the value of 'sent' in body",
100
- optional: true,
101
- args: ["sent"],
102
- defaults: [""]
103
- },
104
- {
105
- name: "result",
106
- short: "",
107
- description: "Provides the value of 'result' in body",
108
- optional: true,
109
- args: ["result"],
110
- defaults: [""]
111
79
  }
112
80
  ]);
113
81
  }
@@ -121,16 +89,12 @@ export class LogCreateCommand extends BaseFinalCommand
121
89
  manager.setValue(token, false);
122
90
  let server = new NamirasoftLogServer(manager, e => this.app.logger.error(e.message));
123
91
  let ans = await server.log.Create({
124
- id: this.option_values.id,
125
- user_id: this.option_values.user_id,
126
92
  product_id: this.option_values.product_id,
127
93
  project_id: this.option_values.project_id,
128
94
  log_group_id: this.option_values.log_group_id,
129
95
  level: this.option_values.level,
130
96
  message: this.option_values.message,
131
- stack: this.option_values.stack,
132
- sent: this.option_values.sent,
133
- result: this.option_values.result
97
+ stack: this.option_values.stack
134
98
  });
135
99
  this.app.logger.success(JSON.stringify(ans));
136
100
  }
@@ -21,14 +21,10 @@
21
21
 
22
22
  export type LogRowInput =
23
23
  {
24
- id: (string | null);
25
- user_id: (string | null);
26
24
  product_id: (string | null);
27
25
  project_id: (string | null);
28
26
  log_group_id: (string | null);
29
27
  level: (string | null);
30
28
  message: (string | null);
31
29
  stack: (string | null);
32
- sent: (boolean | null);
33
- result: (string | null);
34
30
  }
@@ -21,4 +21,6 @@
21
21
 
22
22
  export type LogRowOutput =
23
23
  {
24
+ id: (string | null);
25
+ user_id: (string | null);
24
26
  }