@nsshunt/stsrunnerframework 1.0.53 → 1.0.54

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.
@@ -3938,7 +3938,7 @@ var __accessCheck$1 = (obj, member, msg) => member.has(obj) || __typeError$1("Ca
3938
3938
  var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
3939
3939
  var __privateAdd$1 = (obj, member, value2) => member.has(obj) ? __typeError$1("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value2);
3940
3940
  var __privateSet$1 = (obj, member, value2, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value2), value2);
3941
- var _options, _DUMMY_USER, _invokeMethods, _maxRetries, _sleepDuration, _NoRetryStatusCodes, _accessToken, _noRetries, _LogDebugMessage, _LogErrorMessage, _TestMode, ___InvokeResourceAPI, _axiosClient, _options2$1;
3941
+ var _options, _DUMMY_USER, _invokeMethods, _maxRetries, _sleepDuration, _NoRetryStatusCodes, _accessToken, _noRetries, _LogDebugMessage, _LogErrorMessage, _TestMode, ___InvokeResourceAPI, _axiosClient, _options2$1, _checkResName;
3942
3942
  function getDefaultExportFromCjs(x) {
3943
3943
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
3944
3944
  }
@@ -7676,6 +7676,18 @@ class STSRest01Client {
7676
7676
  var _a;
7677
7677
  return ((_a = await this.PostResourceDBR(resource, errorCb)) == null ? void 0 : _a.resdesc) ?? null;
7678
7678
  });
7679
+ __publicField$1(this, "PutResourcesAR", async (resources, errorCb) => {
7680
+ const url = `${__privateGet$1(this, _options2$1).endpoint}${goptions$1.rest01apiroot}/resources`;
7681
+ return await __privateGet$1(this, _axiosClient).InvokeResourceAPI(url, "put", resources, null, null, errorCb);
7682
+ });
7683
+ __publicField$1(this, "PutResourcesDBR", async (resources, errorCb) => {
7684
+ var _a;
7685
+ return ((_a = await this.PutResourcesAR(resources, errorCb)) == null ? void 0 : _a.data.map((r) => r.detail)) ?? null;
7686
+ });
7687
+ __publicField$1(this, "PutResources", async (resources, errorCb) => {
7688
+ var _a;
7689
+ return ((_a = await this.PutResourcesDBR(resources, errorCb)) == null ? void 0 : _a.map((r) => r.resdesc)) ?? null;
7690
+ });
7679
7691
  __publicField$1(this, "PutResourceAR", async (resource, errorCb) => {
7680
7692
  const url = `${__privateGet$1(this, _options2$1).endpoint}${goptions$1.rest01apiroot}/resources/${resource.resname}`;
7681
7693
  return __privateGet$1(this, _axiosClient).InvokeResourceAPI(url, "put", resource, null, null, errorCb);
@@ -7688,6 +7700,18 @@ class STSRest01Client {
7688
7700
  var _a;
7689
7701
  return ((_a = await this.PutResourceDBR(resource, errorCb)) == null ? void 0 : _a.resdesc) ?? null;
7690
7702
  });
7703
+ __publicField$1(this, "PatchResourcesAR", async (resources, errorCb) => {
7704
+ const url = `${__privateGet$1(this, _options2$1).endpoint}${goptions$1.rest01apiroot}/resources`;
7705
+ return await __privateGet$1(this, _axiosClient).InvokeResourceAPI(url, "patch", resources, null, null, errorCb);
7706
+ });
7707
+ __publicField$1(this, "PatchResourcesDBR", async (resources, errorCb) => {
7708
+ var _a;
7709
+ return ((_a = await this.PatchResourcesAR(resources, errorCb)) == null ? void 0 : _a.data.map((r) => r.detail)) ?? null;
7710
+ });
7711
+ __publicField$1(this, "PatchResources", async (resources, errorCb) => {
7712
+ var _a;
7713
+ return ((_a = await this.PatchResourcesDBR(resources, errorCb)) == null ? void 0 : _a.map((r) => r.resdesc)) ?? null;
7714
+ });
7691
7715
  __publicField$1(this, "PatchResourceAR", async (resource, errorCb) => {
7692
7716
  const url = `${__privateGet$1(this, _options2$1).endpoint}${goptions$1.rest01apiroot}/resources/${resource.resname}`;
7693
7717
  return __privateGet$1(this, _axiosClient).InvokeResourceAPI(url, "patch", resource, null, null, errorCb);
@@ -7700,6 +7724,18 @@ class STSRest01Client {
7700
7724
  var _a;
7701
7725
  return ((_a = await this.PatchResourceDBR(resource, errorCb)) == null ? void 0 : _a.resdesc) ?? null;
7702
7726
  });
7727
+ __publicField$1(this, "DeleteResourcesAR", async (resources, errorCb) => {
7728
+ const url = `${__privateGet$1(this, _options2$1).endpoint}${goptions$1.rest01apiroot}/resources`;
7729
+ return await __privateGet$1(this, _axiosClient).InvokeResourceAPI(url, "delete", resources, null, null, errorCb);
7730
+ });
7731
+ __publicField$1(this, "DeleteResourcesDBR", async (resources, errorCb) => {
7732
+ var _a;
7733
+ return ((_a = await this.DeleteResourcesAR(resources, errorCb)) == null ? void 0 : _a.data.map((r) => r.detail)) ?? null;
7734
+ });
7735
+ __publicField$1(this, "DeleteResources", async (resources, errorCb) => {
7736
+ var _a;
7737
+ return ((_a = await this.DeleteResourcesDBR(resources, errorCb)) == null ? void 0 : _a.map((r) => r.resdesc)) ?? null;
7738
+ });
7703
7739
  __publicField$1(this, "DeleteResourceAR", async (resource, errorCb) => {
7704
7740
  const url = `${__privateGet$1(this, _options2$1).endpoint}${goptions$1.rest01apiroot}/resources/${resource.resname}`;
7705
7741
  return __privateGet$1(this, _axiosClient).InvokeResourceAPI(url, "delete", resource, null, null, errorCb);
@@ -7742,6 +7778,18 @@ class STSRest01Client {
7742
7778
  var _a;
7743
7779
  return ((_a = await this.GetResourcesDBR(filters, errorCb)) == null ? void 0 : _a.map((r) => r.resdesc)) ?? null;
7744
7780
  });
7781
+ __privateAdd$1(this, _checkResName, (resourceEntities) => {
7782
+ let resName = "";
7783
+ resourceEntities.forEach((re2) => {
7784
+ resName = resName.localeCompare("") === 0 ? re2.resname : resName;
7785
+ if (resName.localeCompare(re2.resname) !== 0) {
7786
+ throw new Error(`Invalid batch provided. resname not all equal. Previous checked value: [${resName}, current value: [${re2.resname}]`);
7787
+ } else {
7788
+ resName = re2.resname;
7789
+ }
7790
+ });
7791
+ return resName;
7792
+ });
7745
7793
  __publicField$1(this, "PostEntityAR", async (resourceEntity, errorCb) => {
7746
7794
  const url = `${__privateGet$1(this, _options2$1).endpoint}${goptions$1.rest01apiroot}/resources/${resourceEntity.resname}/entities`;
7747
7795
  return __privateGet$1(this, _axiosClient).InvokeResourceAPI(url, "post", resourceEntity, null, null, errorCb);
@@ -7754,6 +7802,18 @@ class STSRest01Client {
7754
7802
  var _a;
7755
7803
  return ((_a = await this.PostEntityDBR(resourceEntity, errorCb)) == null ? void 0 : _a.entvalue) ?? null;
7756
7804
  });
7805
+ __publicField$1(this, "PutEntitiesAR", async (resourceEntities, errorCb) => {
7806
+ const url = `${__privateGet$1(this, _options2$1).endpoint}${goptions$1.rest01apiroot}/resources/${__privateGet$1(this, _checkResName).call(this, resourceEntities)}/entities`;
7807
+ return __privateGet$1(this, _axiosClient).InvokeResourceAPI(url, "put", resourceEntities, null, null, errorCb);
7808
+ });
7809
+ __publicField$1(this, "PutEntitiesDBR", async (resourceEntities, errorCb) => {
7810
+ var _a;
7811
+ return ((_a = await this.PutEntitiesAR(resourceEntities, errorCb)) == null ? void 0 : _a.data.map((r) => r.detail)) ?? null;
7812
+ });
7813
+ __publicField$1(this, "PutEntities", async (resourceEntities, errorCb) => {
7814
+ var _a;
7815
+ return ((_a = await this.PutEntitiesDBR(resourceEntities, errorCb)) == null ? void 0 : _a.map((r) => r.entvalue)) ?? null;
7816
+ });
7757
7817
  __publicField$1(this, "PutEntityAR", async (entity, errorCb) => {
7758
7818
  const url = `${__privateGet$1(this, _options2$1).endpoint}${goptions$1.rest01apiroot}/resources/${entity.resname}/entities/${entity.entname}`;
7759
7819
  return __privateGet$1(this, _axiosClient).InvokeResourceAPI(url, "put", entity, null, null, errorCb);
@@ -7766,6 +7826,18 @@ class STSRest01Client {
7766
7826
  var _a;
7767
7827
  return ((_a = await this.PutEntityDBR(resourceEntity, errorCb)) == null ? void 0 : _a.entvalue) ?? null;
7768
7828
  });
7829
+ __publicField$1(this, "PatchEntitiesAR", async (resourceEntities, errorCb) => {
7830
+ const url = `${__privateGet$1(this, _options2$1).endpoint}${goptions$1.rest01apiroot}/resources/${__privateGet$1(this, _checkResName).call(this, resourceEntities)}/entities`;
7831
+ return __privateGet$1(this, _axiosClient).InvokeResourceAPI(url, "patch", resourceEntities, null, null, errorCb);
7832
+ });
7833
+ __publicField$1(this, "PatchEntitiesDBR", async (resourceEntities, errorCb) => {
7834
+ var _a;
7835
+ return ((_a = await this.PatchEntitiesAR(resourceEntities, errorCb)) == null ? void 0 : _a.data.map((r) => r.detail)) ?? null;
7836
+ });
7837
+ __publicField$1(this, "PatchEntities", async (resourceEntities, errorCb) => {
7838
+ var _a;
7839
+ return ((_a = await this.PatchEntitiesDBR(resourceEntities, errorCb)) == null ? void 0 : _a.map((r) => r.entvalue)) ?? null;
7840
+ });
7769
7841
  __publicField$1(this, "PatchEntityAR", async (resourceEntity, errorCb) => {
7770
7842
  const url = `${__privateGet$1(this, _options2$1).endpoint}${goptions$1.rest01apiroot}/resources/${resourceEntity.resname}/entities/${resourceEntity.entname}`;
7771
7843
  return __privateGet$1(this, _axiosClient).InvokeResourceAPI(url, "patch", resourceEntity, null, null, errorCb);
@@ -7778,6 +7850,18 @@ class STSRest01Client {
7778
7850
  var _a;
7779
7851
  return ((_a = await this.PatchEntityDBR(resourceEntity, errorCb)) == null ? void 0 : _a.entvalue) ?? null;
7780
7852
  });
7853
+ __publicField$1(this, "DeleteEntitiesAR", async (resourceEntities, errorCb) => {
7854
+ const url = `${__privateGet$1(this, _options2$1).endpoint}${goptions$1.rest01apiroot}/resources/${__privateGet$1(this, _checkResName).call(this, resourceEntities)}/entities`;
7855
+ return __privateGet$1(this, _axiosClient).InvokeResourceAPI(url, "delete", resourceEntities, null, null, errorCb);
7856
+ });
7857
+ __publicField$1(this, "DeleteEntitiesDBR", async (resourceEntities, errorCb) => {
7858
+ var _a;
7859
+ return ((_a = await this.DeleteEntitiesAR(resourceEntities, errorCb)) == null ? void 0 : _a.data.map((r) => r.detail)) ?? null;
7860
+ });
7861
+ __publicField$1(this, "DeleteEntities", async (resourceEntities, errorCb) => {
7862
+ var _a;
7863
+ return ((_a = await this.DeleteEntitiesDBR(resourceEntities, errorCb)) == null ? void 0 : _a.map((r) => r.entvalue)) ?? null;
7864
+ });
7781
7865
  __publicField$1(this, "DeleteEntityAR", async (resourceEntity, errorCb) => {
7782
7866
  const url = `${__privateGet$1(this, _options2$1).endpoint}${goptions$1.rest01apiroot}/resources/${resourceEntity.resname}/entities/${resourceEntity.entname}`;
7783
7867
  return __privateGet$1(this, _axiosClient).InvokeResourceAPI(url, "delete", resourceEntity, null, null, errorCb);
@@ -7833,6 +7917,7 @@ class STSRest01Client {
7833
7917
  }
7834
7918
  _axiosClient = /* @__PURE__ */ new WeakMap();
7835
7919
  _options2$1 = /* @__PURE__ */ new WeakMap();
7920
+ _checkResName = /* @__PURE__ */ new WeakMap();
7836
7921
  var cookie$1 = {};
7837
7922
  var memstore = {};
7838
7923
  var pathMatch = {};
@@ -22960,9 +23045,11 @@ class Rest01Client {
22960
23045
  });
22961
23046
  __publicField(this, "AddResource", async (worker) => {
22962
23047
  const resourceTestRunnerMetadata = {
23048
+ id: worker.id,
22963
23049
  lastRefresh: Math.floor(Date.now() / 1e3),
22964
23050
  resname: `${STS_RF_RES_PREFIX}${worker.id}`,
22965
- data: worker.workerThreadWorkerOptions
23051
+ data: worker.workerThreadWorkerOptions,
23052
+ state: "started"
22966
23053
  };
22967
23054
  return await __privateGet(this, _rest01Client).PostResource(resourceTestRunnerMetadata, (error) => {
22968
23055
  defaultLogger.error(`Rest01Client:AddResource.PostResource.Error(): [${error}]`);
@@ -22970,15 +23057,32 @@ class Rest01Client {
22970
23057
  });
22971
23058
  __publicField(this, "AddResourceEntity", async (workerId, runner) => {
22972
23059
  const resourceEntityTestRunnerMetadata = {
23060
+ id: runner.id,
22973
23061
  lastRefresh: Math.floor(Date.now() / 1e3),
22974
23062
  resname: `${STS_RF_RES_PREFIX}${workerId}`,
22975
23063
  entname: `${STS_RF_RES_ENT_PREFIX}${runner.id}`,
22976
- data: runner.asyncRunnerContext
23064
+ data: runner.asyncRunnerContext,
23065
+ runnerTelemetry: runner.instrumentData,
23066
+ state: "started"
22977
23067
  };
22978
23068
  return await __privateGet(this, _rest01Client).PostEntity(resourceEntityTestRunnerMetadata, (error) => {
22979
23069
  defaultLogger.error(`WorkerInstance: #AddRunner.PostEntity.Error(): [${error}]`);
22980
23070
  });
22981
23071
  });
23072
+ __publicField(this, "UpdateResourceEntity", async (workerId, runner, state) => {
23073
+ const resourceEntityTestRunnerMetadata = {
23074
+ id: runner.id,
23075
+ lastRefresh: Math.floor(Date.now() / 1e3),
23076
+ resname: `${STS_RF_RES_PREFIX}${workerId}`,
23077
+ entname: `${STS_RF_RES_ENT_PREFIX}${runner.id}`,
23078
+ data: runner.asyncRunnerContext,
23079
+ runnerTelemetry: runner.instrumentData,
23080
+ state
23081
+ };
23082
+ return await __privateGet(this, _rest01Client).PutEntity(resourceEntityTestRunnerMetadata, (error) => {
23083
+ defaultLogger.error(`WorkerInstance: #AddRunner.PutEntity.Error(): [${error}]`);
23084
+ });
23085
+ });
22982
23086
  __publicField(this, "GetResource", async (resourceTestRunnerMetadata) => {
22983
23087
  return await __privateGet(this, _rest01Client).GetResource(resourceTestRunnerMetadata, "", (error) => {
22984
23088
  defaultLogger.error(`Rest01Client: GetResource.Error(): [${error}]`);
@@ -23628,7 +23732,10 @@ class STSWorkerManager {
23628
23732
  } else {
23629
23733
  runnerEx.instrumentData.message = [];
23630
23734
  }
23631
- __privateGet(this, _telemetryProcessor).ProcessTelemetry(runnerEx.publishInstrumentController, runnerEx.instrumentData);
23735
+ const update = __privateGet(this, _telemetryProcessor).ProcessTelemetry(runnerEx.publishInstrumentController, runnerEx.instrumentData);
23736
+ if (update) {
23737
+ __privateGet(this, _rest01Client3).UpdateResourceEntity(workerEx.id, runnerEx, "running");
23738
+ }
23632
23739
  if (workerEx.runnersEvents[runner.id]) {
23633
23740
  const runnersEvents = workerEx.runnersEvents[runner.id];
23634
23741
  runnersEvents.forEach((ev) => {
@@ -23648,6 +23755,7 @@ class STSWorkerManager {
23648
23755
  ev.cb(workerEx.runnersEx[runner.id].instrumentData);
23649
23756
  }
23650
23757
  });
23758
+ __privateGet(this, _rest01Client3).UpdateResourceEntity(workerEx.id, runner, "completed");
23651
23759
  }
23652
23760
  console.log(chalk$1.green(`ProcessCompleted: [${JSON.stringify(runner)}]`));
23653
23761
  });