diff --git a/packages/comms/src/ecl/activity.ts b/packages/comms/src/ecl/activity.ts index c81089559c..5a34e0b818 100644 --- a/packages/comms/src/ecl/activity.ts +++ b/packages/comms/src/ecl/activity.ts @@ -41,9 +41,7 @@ export class Activity extends StateObject implem _activity = new Activity(optsConnection); } if (state) { - _activity.set({ - ...state - }); + _activity.set(state); } return _activity; } diff --git a/packages/comms/src/ecl/logicalFile.ts b/packages/comms/src/ecl/logicalFile.ts index 14743e403a..1485fad585 100644 --- a/packages/comms/src/ecl/logicalFile.ts +++ b/packages/comms/src/ecl/logicalFile.ts @@ -91,10 +91,13 @@ export class LogicalFile extends StateObject impleme get properties(): FileDetailEx { return this.get(); } - static attach(optsConnection: IOptions | IConnection | DFUService, Cluster: string, Name: string): LogicalFile { + static attach(optsConnection: IOptions | IConnection | DFUService, Cluster: string, Name: string, state?: FileDetailEx): LogicalFile { const retVal: LogicalFile = _store.get({ BaseUrl: optsConnection.baseUrl, Cluster, Name }, () => { return new LogicalFile(optsConnection, Cluster, Name); }); + if (state) { + retVal.set(state); + } return retVal; } diff --git a/packages/comms/src/ecl/query.ts b/packages/comms/src/ecl/query.ts index 9aaa0689d5..0097f2708d 100644 --- a/packages/comms/src/ecl/query.ts +++ b/packages/comms/src/ecl/query.ts @@ -78,10 +78,13 @@ export class Query extends StateObject implements QueryEx { } as QueryEx); } - static attach(optsConnection: IOptions | IConnection, querySet: string, queryId: string): Query { + static attach(optsConnection: IOptions | IConnection, querySet: string, queryId: string, state?: QueryEx): Query { const retVal: Query = _queries.get({ BaseUrl: optsConnection.baseUrl, QuerySet: querySet, QueryId: queryId } as QueryEx, () => { return new Query(optsConnection, querySet, queryId); }); + if (state) { + retVal.set(state); + } return retVal; } diff --git a/packages/comms/src/ecl/targetCluster.ts b/packages/comms/src/ecl/targetCluster.ts index d212e628ed..7414297147 100644 --- a/packages/comms/src/ecl/targetCluster.ts +++ b/packages/comms/src/ecl/targetCluster.ts @@ -43,9 +43,7 @@ export class TargetCluster extends StateObject impl get LogicalClusters(): WsTopology.TpLogicalCluster[] { return this.get("LogicalClusters"); } get Services(): WsTopology.ServiceList { return this.get("Services"); } - static attach(optsConnection: IOptions | IConnection | TopologyService) { + static attach(optsConnection: IOptions | IConnection | TopologyService, state?: TopologyStateEx): Topology { const retVal: Topology = _topology.get({ BaseUrl: optsConnection.baseUrl }, () => { return new Topology(optsConnection); }); + if (state) { + retVal.set(state); + } return retVal; } diff --git a/packages/comms/src/espConnection.ts b/packages/comms/src/espConnection.ts index f2c4505f56..1d59584ee7 100644 --- a/packages/comms/src/espConnection.ts +++ b/packages/comms/src/espConnection.ts @@ -161,4 +161,12 @@ export class Service { constructor(optsConnection: IOptions | IConnection, service: string, version: string) { this._connection = new ESPConnection(optsConnection, service, version); } + + opts() { + return this._connection.opts(); + } + + connection(): ESPConnection { + return this._connection.clone(); + } } diff --git a/packages/comms/src/services/wsWorkunits.ts b/packages/comms/src/services/wsWorkunits.ts index 0ca2a7938b..fa268946c8 100644 --- a/packages/comms/src/services/wsWorkunits.ts +++ b/packages/comms/src/services/wsWorkunits.ts @@ -1,7 +1,6 @@ import { deepMixin, xml2json, XMLNode } from "@hpcc-js/util"; import { WsWorkunits, WorkunitsServiceBase } from "./wsdl/WsWorkunits/v2/WsWorkunits"; import { IConnection, IOptions } from "../connection"; -import { ESPConnection } from "../espConnection"; /* Response structures generated via: @@ -67,14 +66,6 @@ export class WorkunitsService extends WorkunitsServiceBase { super(optsConnection); } - opts() { - return this._connection.opts(); - } - - connection(): ESPConnection { - return this._connection.clone(); - } - Ping(): Promise { return this._connection.send("Ping", {}, "json", false, undefined, "WsWorkunitsPingResponse").then((response) => { return { result: true };