@hpcc-js/comms 2.78.2 → 2.79.0

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 (45) hide show
  1. package/dist/index.es6.js +450 -46
  2. package/dist/index.es6.js.map +1 -1
  3. package/dist/index.js +448 -43
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.min.js +1 -1
  6. package/dist/index.min.js.map +1 -1
  7. package/dist/index.node.js +450 -45
  8. package/dist/index.node.js.map +1 -1
  9. package/dist/index.node.min.js +1 -1
  10. package/dist/index.node.min.js.map +1 -1
  11. package/lib-es6/__package__.js +2 -2
  12. package/lib-es6/ecl/result.js +11 -10
  13. package/lib-es6/ecl/result.js.map +1 -1
  14. package/lib-es6/services/wsLogaccess.js +71 -27
  15. package/lib-es6/services/wsLogaccess.js.map +1 -1
  16. package/lib-es6/services/wsWorkunits.js +9 -0
  17. package/lib-es6/services/wsWorkunits.js.map +1 -1
  18. package/lib-es6/services/wsdl/WsWorkunits/v1.94/WsWorkunits.js +354 -0
  19. package/lib-es6/services/wsdl/WsWorkunits/v1.94/WsWorkunits.js.map +1 -0
  20. package/lib-es6/services/wsdl/ws_logaccess/v1.03/ws_logaccess.js +63 -0
  21. package/lib-es6/services/wsdl/ws_logaccess/v1.03/ws_logaccess.js.map +1 -0
  22. package/package.json +2 -2
  23. package/src/__package__.ts +2 -2
  24. package/src/ecl/result.ts +11 -10
  25. package/src/services/wsLogaccess.ts +91 -30
  26. package/src/services/wsWorkunits.ts +4 -0
  27. package/src/services/wsdl/WsWorkunits/v1.94/WsWorkunits.ts +3072 -0
  28. package/src/services/wsdl/ws_logaccess/v1.03/ws_logaccess.ts +190 -0
  29. package/types/__package__.d.ts +2 -2
  30. package/types/ecl/result.d.ts +2 -1
  31. package/types/ecl/result.d.ts.map +1 -1
  32. package/types/services/wsLogaccess.d.ts +17 -13
  33. package/types/services/wsLogaccess.d.ts.map +1 -1
  34. package/types/services/wsWorkunits.d.ts +3 -0
  35. package/types/services/wsWorkunits.d.ts.map +1 -1
  36. package/types/services/wsdl/WsWorkunits/v1.94/WsWorkunits.d.ts +2520 -0
  37. package/types/services/wsdl/WsWorkunits/v1.94/WsWorkunits.d.ts.map +1 -0
  38. package/types/services/wsdl/ws_logaccess/v1.03/ws_logaccess.d.ts +150 -0
  39. package/types/services/wsdl/ws_logaccess/v1.03/ws_logaccess.d.ts.map +1 -0
  40. package/types-3.4/__package__.d.ts +2 -2
  41. package/types-3.4/ecl/result.d.ts +2 -1
  42. package/types-3.4/services/wsLogaccess.d.ts +17 -13
  43. package/types-3.4/services/wsWorkunits.d.ts +3 -0
  44. package/types-3.4/services/wsdl/WsWorkunits/v1.94/WsWorkunits.d.ts +2520 -0
  45. package/types-3.4/services/wsdl/ws_logaccess/v1.03/ws_logaccess.d.ts +150 -0
@@ -1,5 +1,5 @@
1
1
  import { scopedLogger } from "@hpcc-js/util";
2
- import { LogaccessServiceBase, WsLogaccess } from "./wsdl/ws_logaccess/v1.02/ws_logaccess";
2
+ import { LogaccessServiceBase, WsLogaccess } from "./wsdl/ws_logaccess/v1.03/ws_logaccess";
3
3
 
4
4
  const logger = scopedLogger("@hpcc-js/comms/services/wsLogaccess.ts");
5
5
 
@@ -7,25 +7,6 @@ export {
7
7
  WsLogaccess
8
8
  };
9
9
 
10
- export enum KnownColumns {
11
- audience = "hpcc.log.audience",
12
- class = "hpcc.log.class",
13
- jobId = "hpcc.log.jobid",
14
- message = "hpcc.log.message",
15
- procId = "hpcc.log.procid",
16
- sequence = "hpcc.log.sequence",
17
- threadId = "hpcc.log.threadid",
18
- timestamp = "hpcc.log.timestamp",
19
- containerName = "kubernetes.container.name"
20
- }
21
-
22
- const RKnownColumns: { [key: string]: string } = {};
23
- for (const key in KnownColumns) {
24
- if (KnownColumns.hasOwnProperty(key)) {
25
- RKnownColumns[KnownColumns[key]] = key;
26
- }
27
- }
28
-
29
10
  export interface GetLogsExRequest {
30
11
  audience?: string;
31
12
  class?: string;
@@ -42,6 +23,22 @@ export interface GetLogsExRequest {
42
23
  LogLineLimit: number
43
24
  }
44
25
 
26
+ export const enum LogType {
27
+ Disaster = "DIS",
28
+ Error = "ERR",
29
+ Warning = "WRN",
30
+ Information = "INF",
31
+ Progress = "PRO",
32
+ Metric = "MET"
33
+ }
34
+
35
+ export const enum TargetAudience {
36
+ Operator = "OPR",
37
+ User = "USR",
38
+ Programmer = "PRO",
39
+ Audit = "ADT"
40
+ }
41
+
45
42
  export interface LogLine {
46
43
  audience?: string;
47
44
  class?: string;
@@ -54,10 +51,57 @@ export interface LogLine {
54
51
  containerName?: string;
55
52
  }
56
53
 
57
- const defaultToLogLine = (line?: any): LogLine => {
54
+ enum ElasticKnownColumns {
55
+ audience = "hpcc.log.audience",
56
+ class = "hpcc.log.class",
57
+ containerName = "kubernetes.container.name",
58
+ jobId = "hpcc.log.jobid",
59
+ message = "hpcc.log.message",
60
+ procId = "hpcc.log.procid",
61
+ sequence = "hpcc.log.sequence",
62
+ threadId = "hpcc.log.threadid",
63
+ timestamp = "hpcc.log.timestamp",
64
+ }
65
+
66
+ const RElasticKnownColumns: { [key: string]: string } = {};
67
+ for (const key in ElasticKnownColumns) {
68
+ if (ElasticKnownColumns.hasOwnProperty(key)) {
69
+ RElasticKnownColumns[ElasticKnownColumns[key]] = key;
70
+ }
71
+ }
72
+
73
+ const elasticToLogLine = (line?: any): LogLine => {
58
74
  const retVal: LogLine = {};
59
- for (const key in RKnownColumns) {
60
- retVal[RKnownColumns[key]] = line?.fields[0][key];
75
+ for (const key in RElasticKnownColumns) {
76
+ retVal[RElasticKnownColumns[key]] = line?.fields[0][key];
77
+ }
78
+ return retVal;
79
+ };
80
+
81
+ enum AzureKnownColumns {
82
+ audience = "hpcc_log_audience", // #Target Audience
83
+ class = "hpcc_log_class", // #Log Entry type
84
+ containerID = "ContainerID",
85
+ containerName = "ContainerID",
86
+ jobId = "hpcc_log_jobid",
87
+ message = "hpcc_log_message", // #The log message
88
+ procId = "",
89
+ sequence = "hpcc_log_sequence",
90
+ threadId = "hpcc_log_threadid",
91
+ timestamp = "hpcc_log_timestamp"
92
+ }
93
+
94
+ const RAzureKnownColumns: { [key: string]: string } = {};
95
+ for (const key in AzureKnownColumns) {
96
+ if (AzureKnownColumns.hasOwnProperty(key)) {
97
+ RAzureKnownColumns[AzureKnownColumns[key]] = key;
98
+ }
99
+ }
100
+
101
+ const azureToLogLine = (line?: any): LogLine => {
102
+ const retVal: LogLine = {};
103
+ for (const key in RAzureKnownColumns) {
104
+ retVal[RAzureKnownColumns[key]] = line?.fields[0][key] ?? "";
61
105
  }
62
106
  return retVal;
63
107
  };
@@ -69,8 +113,13 @@ export interface GetLogsExResponse {
69
113
 
70
114
  export class LogaccessService extends LogaccessServiceBase {
71
115
 
72
- GetLogAccessInfo(request: WsLogaccess.GetLogAccessInfoRequest): Promise<WsLogaccess.GetLogAccessInfoResponse> {
73
- return super.GetLogAccessInfo(request);
116
+ protected _logAccessInfo: Promise<WsLogaccess.GetLogAccessInfoResponse>;
117
+
118
+ GetLogAccessInfo(request: WsLogaccess.GetLogAccessInfoRequest = {}): Promise<WsLogaccess.GetLogAccessInfoResponse> {
119
+ if (!this._logAccessInfo) {
120
+ this._logAccessInfo = super.GetLogAccessInfo(request);
121
+ }
122
+ return this._logAccessInfo;
74
123
  }
75
124
 
76
125
  GetLogs(request: WsLogaccess.GetLogsRequest): Promise<WsLogaccess.GetLogsResponse> {
@@ -99,10 +148,10 @@ export class LogaccessService extends LogaccessServiceBase {
99
148
 
100
149
  const filters: WsLogaccess.leftFilter[] = [];
101
150
  for (const key in request) {
102
- if (key in KnownColumns) {
151
+ if (key in ElasticKnownColumns) {
103
152
  filters.push({
104
153
  LogCategory: WsLogaccess.LogAccessType.ByFieldName,
105
- SearchField: KnownColumns[key],
154
+ SearchField: ElasticKnownColumns[key],
106
155
  SearchByValue: request[key]
107
156
  });
108
157
  }
@@ -131,12 +180,24 @@ export class LogaccessService extends LogaccessServiceBase {
131
180
  getLogsRequest.Range.EndDate = request.EndDate.toISOString();
132
181
  }
133
182
 
134
- return this.GetLogs(getLogsRequest).then(response => {
183
+ return Promise.all([this.GetLogAccessInfo(), this.GetLogs(getLogsRequest)]).then(([info, response]) => {
135
184
  try {
136
185
  const logLines = JSON.parse(response.LogLines);
186
+ let lines = [];
187
+ switch (info.RemoteLogManagerType) {
188
+ case "azureloganalyticscurl":
189
+ lines = logLines.lines?.map(azureToLogLine) ?? [];
190
+ break;
191
+ case "elasticstack":
192
+ lines = logLines.lines?.map(elasticToLogLine) ?? [];
193
+ break;
194
+ default:
195
+ logger.warning(`Unknown RemoteLogManagerType: ${info.RemoteLogManagerType}`);
196
+ lines = [];
197
+ }
137
198
  return {
138
- lines: logLines.lines?.map(defaultToLogLine) ?? [],
139
- total: response.TotalLogLinesAvailable ?? 10000
199
+ lines: lines,
200
+ total: response.TotalLogLinesAvailable || 10000
140
201
  };
141
202
  } catch (e) {
142
203
  logger.error(e);
@@ -1,4 +1,5 @@
1
1
  import { deepMixin, xml2json, XMLNode } from "@hpcc-js/util";
2
+ import { WorkunitsServiceBase } from "./wsdl/WsWorkunits/v1.94/WsWorkunits";
2
3
  import { IConnection, IOptions } from "../connection";
3
4
  import { ESPConnection, Service } from "../espConnection";
4
5
 
@@ -2772,3 +2773,6 @@ export class WorkunitsService extends Service {
2772
2773
  });
2773
2774
  }
2774
2775
  }
2776
+
2777
+ export class WorkunitsServiceEx extends WorkunitsServiceBase {
2778
+ }