@nsshunt/stsrunnerframework 1.0.52 → 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.
@@ -3927,7 +3927,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
3927
3927
  var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
3928
3928
  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);
3929
3929
  var __privateSet$1 = (obj, member, value2, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value2), value2);
3930
- var _options, _DUMMY_USER, _invokeMethods, _maxRetries, _sleepDuration, _NoRetryStatusCodes, _accessToken, _noRetries, _LogDebugMessage, _LogErrorMessage, _TestMode, ___InvokeResourceAPI, _axiosClient, _options2$1;
3930
+ var _options, _DUMMY_USER, _invokeMethods, _maxRetries, _sleepDuration, _NoRetryStatusCodes, _accessToken, _noRetries, _LogDebugMessage, _LogErrorMessage, _TestMode, ___InvokeResourceAPI, _axiosClient, _options2$1, _checkResName;
3931
3931
  function getDefaultExportFromCjs(x) {
3932
3932
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
3933
3933
  }
@@ -7665,6 +7665,18 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
7665
7665
  var _a;
7666
7666
  return ((_a = await this.PostResourceDBR(resource, errorCb)) == null ? void 0 : _a.resdesc) ?? null;
7667
7667
  });
7668
+ __publicField$1(this, "PutResourcesAR", async (resources, errorCb) => {
7669
+ const url = `${__privateGet$1(this, _options2$1).endpoint}${goptions$1.rest01apiroot}/resources`;
7670
+ return await __privateGet$1(this, _axiosClient).InvokeResourceAPI(url, "put", resources, null, null, errorCb);
7671
+ });
7672
+ __publicField$1(this, "PutResourcesDBR", async (resources, errorCb) => {
7673
+ var _a;
7674
+ return ((_a = await this.PutResourcesAR(resources, errorCb)) == null ? void 0 : _a.data.map((r) => r.detail)) ?? null;
7675
+ });
7676
+ __publicField$1(this, "PutResources", async (resources, errorCb) => {
7677
+ var _a;
7678
+ return ((_a = await this.PutResourcesDBR(resources, errorCb)) == null ? void 0 : _a.map((r) => r.resdesc)) ?? null;
7679
+ });
7668
7680
  __publicField$1(this, "PutResourceAR", async (resource, errorCb) => {
7669
7681
  const url = `${__privateGet$1(this, _options2$1).endpoint}${goptions$1.rest01apiroot}/resources/${resource.resname}`;
7670
7682
  return __privateGet$1(this, _axiosClient).InvokeResourceAPI(url, "put", resource, null, null, errorCb);
@@ -7677,6 +7689,18 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
7677
7689
  var _a;
7678
7690
  return ((_a = await this.PutResourceDBR(resource, errorCb)) == null ? void 0 : _a.resdesc) ?? null;
7679
7691
  });
7692
+ __publicField$1(this, "PatchResourcesAR", async (resources, errorCb) => {
7693
+ const url = `${__privateGet$1(this, _options2$1).endpoint}${goptions$1.rest01apiroot}/resources`;
7694
+ return await __privateGet$1(this, _axiosClient).InvokeResourceAPI(url, "patch", resources, null, null, errorCb);
7695
+ });
7696
+ __publicField$1(this, "PatchResourcesDBR", async (resources, errorCb) => {
7697
+ var _a;
7698
+ return ((_a = await this.PatchResourcesAR(resources, errorCb)) == null ? void 0 : _a.data.map((r) => r.detail)) ?? null;
7699
+ });
7700
+ __publicField$1(this, "PatchResources", async (resources, errorCb) => {
7701
+ var _a;
7702
+ return ((_a = await this.PatchResourcesDBR(resources, errorCb)) == null ? void 0 : _a.map((r) => r.resdesc)) ?? null;
7703
+ });
7680
7704
  __publicField$1(this, "PatchResourceAR", async (resource, errorCb) => {
7681
7705
  const url = `${__privateGet$1(this, _options2$1).endpoint}${goptions$1.rest01apiroot}/resources/${resource.resname}`;
7682
7706
  return __privateGet$1(this, _axiosClient).InvokeResourceAPI(url, "patch", resource, null, null, errorCb);
@@ -7689,6 +7713,18 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
7689
7713
  var _a;
7690
7714
  return ((_a = await this.PatchResourceDBR(resource, errorCb)) == null ? void 0 : _a.resdesc) ?? null;
7691
7715
  });
7716
+ __publicField$1(this, "DeleteResourcesAR", async (resources, errorCb) => {
7717
+ const url = `${__privateGet$1(this, _options2$1).endpoint}${goptions$1.rest01apiroot}/resources`;
7718
+ return await __privateGet$1(this, _axiosClient).InvokeResourceAPI(url, "delete", resources, null, null, errorCb);
7719
+ });
7720
+ __publicField$1(this, "DeleteResourcesDBR", async (resources, errorCb) => {
7721
+ var _a;
7722
+ return ((_a = await this.DeleteResourcesAR(resources, errorCb)) == null ? void 0 : _a.data.map((r) => r.detail)) ?? null;
7723
+ });
7724
+ __publicField$1(this, "DeleteResources", async (resources, errorCb) => {
7725
+ var _a;
7726
+ return ((_a = await this.DeleteResourcesDBR(resources, errorCb)) == null ? void 0 : _a.map((r) => r.resdesc)) ?? null;
7727
+ });
7692
7728
  __publicField$1(this, "DeleteResourceAR", async (resource, errorCb) => {
7693
7729
  const url = `${__privateGet$1(this, _options2$1).endpoint}${goptions$1.rest01apiroot}/resources/${resource.resname}`;
7694
7730
  return __privateGet$1(this, _axiosClient).InvokeResourceAPI(url, "delete", resource, null, null, errorCb);
@@ -7731,6 +7767,18 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
7731
7767
  var _a;
7732
7768
  return ((_a = await this.GetResourcesDBR(filters, errorCb)) == null ? void 0 : _a.map((r) => r.resdesc)) ?? null;
7733
7769
  });
7770
+ __privateAdd$1(this, _checkResName, (resourceEntities) => {
7771
+ let resName = "";
7772
+ resourceEntities.forEach((re2) => {
7773
+ resName = resName.localeCompare("") === 0 ? re2.resname : resName;
7774
+ if (resName.localeCompare(re2.resname) !== 0) {
7775
+ throw new Error(`Invalid batch provided. resname not all equal. Previous checked value: [${resName}, current value: [${re2.resname}]`);
7776
+ } else {
7777
+ resName = re2.resname;
7778
+ }
7779
+ });
7780
+ return resName;
7781
+ });
7734
7782
  __publicField$1(this, "PostEntityAR", async (resourceEntity, errorCb) => {
7735
7783
  const url = `${__privateGet$1(this, _options2$1).endpoint}${goptions$1.rest01apiroot}/resources/${resourceEntity.resname}/entities`;
7736
7784
  return __privateGet$1(this, _axiosClient).InvokeResourceAPI(url, "post", resourceEntity, null, null, errorCb);
@@ -7743,6 +7791,18 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
7743
7791
  var _a;
7744
7792
  return ((_a = await this.PostEntityDBR(resourceEntity, errorCb)) == null ? void 0 : _a.entvalue) ?? null;
7745
7793
  });
7794
+ __publicField$1(this, "PutEntitiesAR", async (resourceEntities, errorCb) => {
7795
+ const url = `${__privateGet$1(this, _options2$1).endpoint}${goptions$1.rest01apiroot}/resources/${__privateGet$1(this, _checkResName).call(this, resourceEntities)}/entities`;
7796
+ return __privateGet$1(this, _axiosClient).InvokeResourceAPI(url, "put", resourceEntities, null, null, errorCb);
7797
+ });
7798
+ __publicField$1(this, "PutEntitiesDBR", async (resourceEntities, errorCb) => {
7799
+ var _a;
7800
+ return ((_a = await this.PutEntitiesAR(resourceEntities, errorCb)) == null ? void 0 : _a.data.map((r) => r.detail)) ?? null;
7801
+ });
7802
+ __publicField$1(this, "PutEntities", async (resourceEntities, errorCb) => {
7803
+ var _a;
7804
+ return ((_a = await this.PutEntitiesDBR(resourceEntities, errorCb)) == null ? void 0 : _a.map((r) => r.entvalue)) ?? null;
7805
+ });
7746
7806
  __publicField$1(this, "PutEntityAR", async (entity, errorCb) => {
7747
7807
  const url = `${__privateGet$1(this, _options2$1).endpoint}${goptions$1.rest01apiroot}/resources/${entity.resname}/entities/${entity.entname}`;
7748
7808
  return __privateGet$1(this, _axiosClient).InvokeResourceAPI(url, "put", entity, null, null, errorCb);
@@ -7755,6 +7815,18 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
7755
7815
  var _a;
7756
7816
  return ((_a = await this.PutEntityDBR(resourceEntity, errorCb)) == null ? void 0 : _a.entvalue) ?? null;
7757
7817
  });
7818
+ __publicField$1(this, "PatchEntitiesAR", async (resourceEntities, errorCb) => {
7819
+ const url = `${__privateGet$1(this, _options2$1).endpoint}${goptions$1.rest01apiroot}/resources/${__privateGet$1(this, _checkResName).call(this, resourceEntities)}/entities`;
7820
+ return __privateGet$1(this, _axiosClient).InvokeResourceAPI(url, "patch", resourceEntities, null, null, errorCb);
7821
+ });
7822
+ __publicField$1(this, "PatchEntitiesDBR", async (resourceEntities, errorCb) => {
7823
+ var _a;
7824
+ return ((_a = await this.PatchEntitiesAR(resourceEntities, errorCb)) == null ? void 0 : _a.data.map((r) => r.detail)) ?? null;
7825
+ });
7826
+ __publicField$1(this, "PatchEntities", async (resourceEntities, errorCb) => {
7827
+ var _a;
7828
+ return ((_a = await this.PatchEntitiesDBR(resourceEntities, errorCb)) == null ? void 0 : _a.map((r) => r.entvalue)) ?? null;
7829
+ });
7758
7830
  __publicField$1(this, "PatchEntityAR", async (resourceEntity, errorCb) => {
7759
7831
  const url = `${__privateGet$1(this, _options2$1).endpoint}${goptions$1.rest01apiroot}/resources/${resourceEntity.resname}/entities/${resourceEntity.entname}`;
7760
7832
  return __privateGet$1(this, _axiosClient).InvokeResourceAPI(url, "patch", resourceEntity, null, null, errorCb);
@@ -7767,6 +7839,18 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
7767
7839
  var _a;
7768
7840
  return ((_a = await this.PatchEntityDBR(resourceEntity, errorCb)) == null ? void 0 : _a.entvalue) ?? null;
7769
7841
  });
7842
+ __publicField$1(this, "DeleteEntitiesAR", async (resourceEntities, errorCb) => {
7843
+ const url = `${__privateGet$1(this, _options2$1).endpoint}${goptions$1.rest01apiroot}/resources/${__privateGet$1(this, _checkResName).call(this, resourceEntities)}/entities`;
7844
+ return __privateGet$1(this, _axiosClient).InvokeResourceAPI(url, "delete", resourceEntities, null, null, errorCb);
7845
+ });
7846
+ __publicField$1(this, "DeleteEntitiesDBR", async (resourceEntities, errorCb) => {
7847
+ var _a;
7848
+ return ((_a = await this.DeleteEntitiesAR(resourceEntities, errorCb)) == null ? void 0 : _a.data.map((r) => r.detail)) ?? null;
7849
+ });
7850
+ __publicField$1(this, "DeleteEntities", async (resourceEntities, errorCb) => {
7851
+ var _a;
7852
+ return ((_a = await this.DeleteEntitiesDBR(resourceEntities, errorCb)) == null ? void 0 : _a.map((r) => r.entvalue)) ?? null;
7853
+ });
7770
7854
  __publicField$1(this, "DeleteEntityAR", async (resourceEntity, errorCb) => {
7771
7855
  const url = `${__privateGet$1(this, _options2$1).endpoint}${goptions$1.rest01apiroot}/resources/${resourceEntity.resname}/entities/${resourceEntity.entname}`;
7772
7856
  return __privateGet$1(this, _axiosClient).InvokeResourceAPI(url, "delete", resourceEntity, null, null, errorCb);
@@ -7822,6 +7906,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
7822
7906
  }
7823
7907
  _axiosClient = /* @__PURE__ */ new WeakMap();
7824
7908
  _options2$1 = /* @__PURE__ */ new WeakMap();
7909
+ _checkResName = /* @__PURE__ */ new WeakMap();
7825
7910
  var cookie$1 = {};
7826
7911
  var memstore = {};
7827
7912
  var pathMatch = {};
@@ -22949,9 +23034,11 @@ ${newlined}
22949
23034
  });
22950
23035
  __publicField(this, "AddResource", async (worker) => {
22951
23036
  const resourceTestRunnerMetadata = {
23037
+ id: worker.id,
22952
23038
  lastRefresh: Math.floor(Date.now() / 1e3),
22953
23039
  resname: `${STS_RF_RES_PREFIX}${worker.id}`,
22954
- data: worker.workerThreadWorkerOptions
23040
+ data: worker.workerThreadWorkerOptions,
23041
+ state: "started"
22955
23042
  };
22956
23043
  return await __privateGet(this, _rest01Client).PostResource(resourceTestRunnerMetadata, (error) => {
22957
23044
  stsutils.defaultLogger.error(`Rest01Client:AddResource.PostResource.Error(): [${error}]`);
@@ -22959,15 +23046,32 @@ ${newlined}
22959
23046
  });
22960
23047
  __publicField(this, "AddResourceEntity", async (workerId, runner) => {
22961
23048
  const resourceEntityTestRunnerMetadata = {
23049
+ id: runner.id,
22962
23050
  lastRefresh: Math.floor(Date.now() / 1e3),
22963
23051
  resname: `${STS_RF_RES_PREFIX}${workerId}`,
22964
23052
  entname: `${STS_RF_RES_ENT_PREFIX}${runner.id}`,
22965
- data: runner.asyncRunnerContext
23053
+ data: runner.asyncRunnerContext,
23054
+ runnerTelemetry: runner.instrumentData,
23055
+ state: "started"
22966
23056
  };
22967
23057
  return await __privateGet(this, _rest01Client).PostEntity(resourceEntityTestRunnerMetadata, (error) => {
22968
23058
  stsutils.defaultLogger.error(`WorkerInstance: #AddRunner.PostEntity.Error(): [${error}]`);
22969
23059
  });
22970
23060
  });
23061
+ __publicField(this, "UpdateResourceEntity", async (workerId, runner, state) => {
23062
+ const resourceEntityTestRunnerMetadata = {
23063
+ id: runner.id,
23064
+ lastRefresh: Math.floor(Date.now() / 1e3),
23065
+ resname: `${STS_RF_RES_PREFIX}${workerId}`,
23066
+ entname: `${STS_RF_RES_ENT_PREFIX}${runner.id}`,
23067
+ data: runner.asyncRunnerContext,
23068
+ runnerTelemetry: runner.instrumentData,
23069
+ state
23070
+ };
23071
+ return await __privateGet(this, _rest01Client).PutEntity(resourceEntityTestRunnerMetadata, (error) => {
23072
+ stsutils.defaultLogger.error(`WorkerInstance: #AddRunner.PutEntity.Error(): [${error}]`);
23073
+ });
23074
+ });
22971
23075
  __publicField(this, "GetResource", async (resourceTestRunnerMetadata) => {
22972
23076
  return await __privateGet(this, _rest01Client).GetResource(resourceTestRunnerMetadata, "", (error) => {
22973
23077
  stsutils.defaultLogger.error(`Rest01Client: GetResource.Error(): [${error}]`);
@@ -23617,7 +23721,10 @@ ${newlined}
23617
23721
  } else {
23618
23722
  runnerEx.instrumentData.message = [];
23619
23723
  }
23620
- __privateGet(this, _telemetryProcessor).ProcessTelemetry(runnerEx.publishInstrumentController, runnerEx.instrumentData);
23724
+ const update = __privateGet(this, _telemetryProcessor).ProcessTelemetry(runnerEx.publishInstrumentController, runnerEx.instrumentData);
23725
+ if (update) {
23726
+ __privateGet(this, _rest01Client3).UpdateResourceEntity(workerEx.id, runnerEx, "running");
23727
+ }
23621
23728
  if (workerEx.runnersEvents[runner.id]) {
23622
23729
  const runnersEvents = workerEx.runnersEvents[runner.id];
23623
23730
  runnersEvents.forEach((ev) => {
@@ -23637,6 +23744,7 @@ ${newlined}
23637
23744
  ev.cb(workerEx.runnersEx[runner.id].instrumentData);
23638
23745
  }
23639
23746
  });
23747
+ __privateGet(this, _rest01Client3).UpdateResourceEntity(workerEx.id, runner, "completed");
23640
23748
  }
23641
23749
  console.log(chalk$1.green(`ProcessCompleted: [${JSON.stringify(runner)}]`));
23642
23750
  });