@hpcc-js/comms 2.89.0 → 2.91.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 +956 -128
  2. package/dist/index.es6.js.map +1 -1
  3. package/dist/index.js +948 -119
  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 +948 -119
  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/query.js +68 -0
  13. package/lib-es6/ecl/query.js.map +1 -1
  14. package/lib-es6/ecl/queryGraph.js +759 -0
  15. package/lib-es6/ecl/queryGraph.js.map +1 -0
  16. package/lib-es6/ecl/workunit.js +116 -102
  17. package/lib-es6/ecl/workunit.js.map +1 -1
  18. package/lib-es6/services/wsWorkunits.js +5 -1
  19. package/lib-es6/services/wsWorkunits.js.map +1 -1
  20. package/lib-es6/services/wsdl/WsWorkunits/v1.98/WsWorkunits.js +370 -0
  21. package/lib-es6/services/wsdl/WsWorkunits/v1.98/WsWorkunits.js.map +1 -0
  22. package/package.json +3 -3
  23. package/src/__package__.ts +2 -2
  24. package/src/ecl/query.ts +66 -1
  25. package/src/ecl/queryGraph.ts +809 -0
  26. package/src/ecl/workunit.ts +126 -103
  27. package/src/services/wsWorkunits.ts +8 -1
  28. package/src/services/wsdl/WsWorkunits/v1.98/WsWorkunits.ts +3182 -0
  29. package/types/__package__.d.ts +2 -2
  30. package/types/ecl/query.d.ts +12 -1
  31. package/types/ecl/query.d.ts.map +1 -1
  32. package/types/ecl/queryGraph.d.ts +101 -0
  33. package/types/ecl/queryGraph.d.ts.map +1 -0
  34. package/types/ecl/workunit.d.ts +8 -0
  35. package/types/ecl/workunit.d.ts.map +1 -1
  36. package/types/services/wsWorkunits.d.ts +3 -1
  37. package/types/services/wsWorkunits.d.ts.map +1 -1
  38. package/types/services/wsdl/WsWorkunits/v1.98/WsWorkunits.d.ts +2623 -0
  39. package/types/services/wsdl/WsWorkunits/v1.98/WsWorkunits.d.ts.map +1 -0
  40. package/types-3.4/__package__.d.ts +2 -2
  41. package/types-3.4/ecl/query.d.ts +12 -1
  42. package/types-3.4/ecl/queryGraph.d.ts +101 -0
  43. package/types-3.4/ecl/workunit.d.ts +8 -0
  44. package/types-3.4/services/wsWorkunits.d.ts +3 -1
  45. package/types-3.4/services/wsdl/WsWorkunits/v1.98/WsWorkunits.d.ts +2623 -0
@@ -22,6 +22,13 @@ function formatNum(num: number | string): string {
22
22
  }
23
23
  return num as string;
24
24
  }
25
+
26
+ function safeDelete(obj: { [id: string]: any; }, key: string, prop: string) {
27
+ if (obj[key] === undefined || obj[key][prop] === undefined) return;
28
+ if (key === "__proto__" || key === "constructor" || key === "prototype") return;
29
+ delete obj[key][prop];
30
+ }
31
+
25
32
  const DEFINITION_LIST = "DefinitionList";
26
33
  const definitionRegex = /([a-zA-Z]:)?(.*[\\\/])(.*)(\((\d+),(\d+)\))/;
27
34
 
@@ -642,116 +649,118 @@ export class Workunit extends StateObject<UWorkunitState, IWorkunitState> implem
642
649
  return this.WUDetails(request).then(response => response.Scopes.Scope);
643
650
  }
644
651
 
645
- fetchDetailsNormalized(request: Partial<WsWorkunits.WUDetails.Request> = {}): Promise<{ meta: WsWorkunits.WUDetailsMeta.Response, columns: { [id: string]: any }, data: IScope[] }> {
646
- return Promise.all([this.fetchDetailsMeta(), this.fetchDetailsRaw(request)]).then(promises => {
647
- const meta = promises[0];
648
- const scopes = promises[1];
649
- const columns: { [id: string]: any } = {
650
- id: {
651
- Measure: "label"
652
- },
653
- name: {
654
- Measure: "label"
655
- },
656
- type: {
657
- Measure: "label"
658
- }
659
- };
660
- const data: IScope[] = [];
661
- for (const scope of scopes) {
662
- const props = {};
663
- const formattedProps = {};
664
- if (scope && scope.Id && scope.Properties && scope.Properties.Property) {
665
- for (const key in scope.Properties.Property) {
666
- const scopeProperty = scope.Properties.Property[key];
667
- if (scopeProperty.Measure === "ns") {
668
- scopeProperty.Measure = "s";
669
- }
670
- columns[scopeProperty.Name] = { ...scopeProperty };
671
- delete columns[scopeProperty.Name].RawValue;
672
- delete columns[scopeProperty.Name].Formatted;
673
- switch (scopeProperty.Measure) {
674
- case "bool":
675
- props[scopeProperty.Name] = !!+scopeProperty.RawValue;
676
- break;
677
- case "sz":
678
- props[scopeProperty.Name] = +scopeProperty.RawValue;
679
- break;
680
- case "s":
681
- props[scopeProperty.Name] = +scopeProperty.RawValue / 1000000000;
682
- break;
683
- case "ns":
684
- props[scopeProperty.Name] = +scopeProperty.RawValue;
685
- break;
686
- case "ts":
687
- props[scopeProperty.Name] = new Date(+scopeProperty.RawValue / 1000).toISOString();
688
- break;
689
- case "cnt":
690
- props[scopeProperty.Name] = +scopeProperty.RawValue;
691
- break;
692
- case "cost":
693
- props[scopeProperty.Name] = +scopeProperty.RawValue / 1000000;
694
- break;
695
- case "cpu":
696
- case "skw":
697
- case "node":
698
- case "ppm":
699
- case "ip":
700
- case "cy":
701
- case "en":
702
- case "txt":
703
- case "id":
704
- case "fname":
705
- default:
706
- props[scopeProperty.Name] = scopeProperty.RawValue;
707
- }
708
- formattedProps[scopeProperty.Name] = formatNum(scopeProperty.Formatted ?? props[scopeProperty.Name]);
652
+ normalizeDetails(meta: WsWorkunits.WUDetailsMeta.Response, scopes: WsWorkunits.WUDetails.Scope[]): { meta: WsWorkunits.WUDetailsMeta.Response, columns: { [id: string]: any }, data: IScope[] } {
653
+ const columns: { [id: string]: any } = {
654
+ id: {
655
+ Measure: "label"
656
+ },
657
+ name: {
658
+ Measure: "label"
659
+ },
660
+ type: {
661
+ Measure: "label"
662
+ }
663
+ };
664
+ const data: IScope[] = [];
665
+ for (const scope of scopes) {
666
+ const props = {};
667
+ const formattedProps = {};
668
+ if (scope && scope.Id && scope.Properties && scope.Properties.Property) {
669
+ for (const key in scope.Properties.Property) {
670
+ const scopeProperty = scope.Properties.Property[key];
671
+ if (scopeProperty.Measure === "ns") {
672
+ scopeProperty.Measure = "s";
709
673
  }
710
- // Other properties ---
711
- }
712
- const normalizedScope: IScope = {
713
- id: scope.Id,
714
- name: scope.ScopeName,
715
- type: scope.ScopeType,
716
- Kind: scope["Kind"],
717
- Label: scope["Label"],
718
- __formattedProps: formattedProps,
719
- __groupedProps: {},
720
- ...props
721
- };
722
- if (normalizedScope[DEFINITION_LIST]) {
723
- try {
724
- const definitionList = JSON.parse(normalizedScope[DEFINITION_LIST].split("\\").join("\\\\"));
725
- normalizedScope[DEFINITION_LIST] = [];
726
- definitionList.forEach((definition, idx) => {
727
- const matches = definition.match(definitionRegex);
728
- if (matches) {
729
- const filePath = (matches[1] ?? "") + matches[2] + matches[3];
730
- const line = parseInt(matches[5]);
731
- const col = parseInt(matches[6]);
732
- normalizedScope[DEFINITION_LIST].push({ filePath, line, col });
733
- }
734
- });
735
- } catch (e) {
736
- logger.error(`Unexpected "DefinitionList": ${normalizedScope[DEFINITION_LIST]}`);
674
+ columns[scopeProperty.Name] = { ...scopeProperty };
675
+ safeDelete(columns, scopeProperty.Name, "RawValue");
676
+ safeDelete(columns, scopeProperty.Name, "Formatted");
677
+ switch (scopeProperty.Measure) {
678
+ case "bool":
679
+ props[scopeProperty.Name] = !!+scopeProperty.RawValue;
680
+ break;
681
+ case "sz":
682
+ props[scopeProperty.Name] = +scopeProperty.RawValue;
683
+ break;
684
+ case "s":
685
+ props[scopeProperty.Name] = +scopeProperty.RawValue / 1000000000;
686
+ break;
687
+ case "ns":
688
+ props[scopeProperty.Name] = +scopeProperty.RawValue;
689
+ break;
690
+ case "ts":
691
+ props[scopeProperty.Name] = new Date(+scopeProperty.RawValue / 1000).toISOString();
692
+ break;
693
+ case "cnt":
694
+ props[scopeProperty.Name] = +scopeProperty.RawValue;
695
+ break;
696
+ case "cost":
697
+ props[scopeProperty.Name] = +scopeProperty.RawValue / 1000000;
698
+ break;
699
+ case "cpu":
700
+ case "skw":
701
+ case "node":
702
+ case "ppm":
703
+ case "ip":
704
+ case "cy":
705
+ case "en":
706
+ case "txt":
707
+ case "id":
708
+ case "fname":
709
+ default:
710
+ props[scopeProperty.Name] = scopeProperty.RawValue;
737
711
  }
712
+ formattedProps[scopeProperty.Name] = formatNum(scopeProperty.Formatted ?? props[scopeProperty.Name]);
738
713
  }
739
- const dedup: DedupProperties = {};
740
- for (const key in normalizedScope) {
741
- if (key.indexOf("__") !== 0) {
742
- const row = formatValues(normalizedScope, key, dedup);
743
- if (row) {
744
- normalizedScope.__groupedProps[row.Key] = row;
714
+ // Other properties ---
715
+ }
716
+ const normalizedScope: IScope = {
717
+ id: scope.Id,
718
+ name: scope.ScopeName,
719
+ type: scope.ScopeType,
720
+ Kind: scope["Kind"],
721
+ Label: scope["Label"],
722
+ __formattedProps: formattedProps,
723
+ __groupedProps: {},
724
+ ...props
725
+ };
726
+ if (normalizedScope[DEFINITION_LIST]) {
727
+ try {
728
+ const definitionList = JSON.parse(normalizedScope[DEFINITION_LIST].split("\\").join("\\\\"));
729
+ normalizedScope[DEFINITION_LIST] = [];
730
+ definitionList.forEach((definition, idx) => {
731
+ const matches = definition.match(definitionRegex);
732
+ if (matches) {
733
+ const filePath = (matches[1] ?? "") + matches[2] + matches[3];
734
+ const line = parseInt(matches[5]);
735
+ const col = parseInt(matches[6]);
736
+ normalizedScope[DEFINITION_LIST].push({ filePath, line, col });
745
737
  }
738
+ });
739
+ } catch (e) {
740
+ logger.error(`Unexpected "DefinitionList": ${normalizedScope[DEFINITION_LIST]}`);
741
+ }
742
+ }
743
+ const dedup: DedupProperties = {};
744
+ for (const key in normalizedScope) {
745
+ if (key.indexOf("__") !== 0) {
746
+ const row = formatValues(normalizedScope, key, dedup);
747
+ if (row) {
748
+ normalizedScope.__groupedProps[row.Key] = row;
746
749
  }
747
750
  }
748
- data.push(normalizedScope);
749
751
  }
750
- return {
751
- meta,
752
- columns,
753
- data
754
- };
752
+ data.push(normalizedScope);
753
+ }
754
+ return {
755
+ meta,
756
+ columns,
757
+ data
758
+ };
759
+ }
760
+
761
+ fetchDetailsNormalized(request: Partial<WsWorkunits.WUDetails.Request> = {}): Promise<{ meta: WsWorkunits.WUDetailsMeta.Response, columns: { [id: string]: any }, data: IScope[] }> {
762
+ return Promise.all([this.fetchDetailsMeta(), this.fetchDetailsRaw(request)]).then(promises => {
763
+ return this.normalizeDetails(promises[0], promises[1]);
755
764
  });
756
765
  }
757
766
 
@@ -1087,6 +1096,20 @@ export class Workunit extends StateObject<UWorkunitState, IWorkunitState> implem
1087
1096
  });
1088
1097
  }
1089
1098
 
1099
+ publishEx(request: Partial<WsWorkunits.WsWorkunits.WUPublishWorkunit>) {
1100
+ const service = new WsWorkunits.WorkunitsServiceEx({ baseUrl: "" });
1101
+ const publishRequest = {
1102
+ Wuid: this.Wuid,
1103
+ Cluster: this.Cluster,
1104
+ JobName: this.Jobname,
1105
+ AllowForeignFiles: true,
1106
+ Activate: 1,
1107
+ Wait: 5000,
1108
+ ...request
1109
+ };
1110
+ return service.WUPublishWorkunitEx(publishRequest);
1111
+ }
1112
+
1090
1113
  protected WUCDebug(command: string, opts: any = {}): Promise<XMLNode | null> {
1091
1114
  let optsStr = "";
1092
1115
  for (const key in opts) {
@@ -1,5 +1,5 @@
1
1
  import { deepMixin, xml2json, XMLNode } from "@hpcc-js/util";
2
- import { WorkunitsServiceBase } from "./wsdl/WsWorkunits/v1.95/WsWorkunits";
2
+ import { WsWorkunits, WorkunitsServiceBase } from "./wsdl/WsWorkunits/v1.98/WsWorkunits";
3
3
  import { IConnection, IOptions } from "../connection";
4
4
  import { ESPConnection, Service } from "../espConnection";
5
5
 
@@ -10,6 +10,10 @@ import { ESPConnection, Service } from "../espConnection";
10
10
  * http://json2ts.com/
11
11
  */
12
12
 
13
+ export {
14
+ WsWorkunits
15
+ };
16
+
13
17
  export enum WUStateID {
14
18
  Unknown = 0,
15
19
  Compiled,
@@ -2779,4 +2783,7 @@ export class WorkunitsService extends Service {
2779
2783
  }
2780
2784
 
2781
2785
  export class WorkunitsServiceEx extends WorkunitsServiceBase {
2786
+ WUPublishWorkunitEx(request: Partial<WsWorkunits.WUPublishWorkunit>): Promise<WsWorkunits.WUPublishWorkunitResponse> {
2787
+ return this._connection.send("WUPublishWorkunit", request);
2788
+ }
2782
2789
  }