@nsshunt/stsrest01client 1.0.10 → 1.0.11

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.
@@ -8,7 +8,7 @@ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot
8
8
  var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
9
9
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
10
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
11
- var _options, _DUMMY_USER, _invokeMethods, _maxRetries, _sleepDuration, _NoRetryStatusCodes, _accessToken, _noRetries, _LogDebugMessage, _LogErrorMessage, _TestMode, ___InvokeResourceAPI, _axiosClient, _options2;
11
+ var _options, _DUMMY_USER, _invokeMethods, _maxRetries, _sleepDuration, _NoRetryStatusCodes, _accessToken, _noRetries, _LogDebugMessage, _LogErrorMessage, _TestMode, ___InvokeResourceAPI, _axiosClient, _options2, _checkResName;
12
12
  import { accessSync, constants, readFileSync } from "node:fs";
13
13
  import require$$1 from "path";
14
14
  import require$$2 from "os";
@@ -3758,6 +3758,19 @@ class STSRest01Client {
3758
3758
  var _a;
3759
3759
  return ((_a = await this.PostResourceDBR(resource, errorCb)) == null ? void 0 : _a.resdesc) ?? null;
3760
3760
  });
3761
+ // --- [ PUT.Resources ] ------------------------------------------------------------------------------------------------------------------
3762
+ __publicField(this, "PutResourcesAR", async (resources, errorCb) => {
3763
+ const url = `${__privateGet(this, _options2).endpoint}${goptions.rest01apiroot}/resources`;
3764
+ return await __privateGet(this, _axiosClient).InvokeResourceAPI(url, "put", resources, null, null, errorCb);
3765
+ });
3766
+ __publicField(this, "PutResourcesDBR", async (resources, errorCb) => {
3767
+ var _a;
3768
+ return ((_a = await this.PutResourcesAR(resources, errorCb)) == null ? void 0 : _a.data.map((r) => r.detail)) ?? null;
3769
+ });
3770
+ __publicField(this, "PutResources", async (resources, errorCb) => {
3771
+ var _a;
3772
+ return ((_a = await this.PutResourcesDBR(resources, errorCb)) == null ? void 0 : _a.map((r) => r.resdesc)) ?? null;
3773
+ });
3761
3774
  // --- [ PUT.Resource ] -------------------------------------------------------------------------------------------------------------------
3762
3775
  __publicField(this, "PutResourceAR", async (resource, errorCb) => {
3763
3776
  const url = `${__privateGet(this, _options2).endpoint}${goptions.rest01apiroot}/resources/${resource.resname}`;
@@ -3771,6 +3784,19 @@ class STSRest01Client {
3771
3784
  var _a;
3772
3785
  return ((_a = await this.PutResourceDBR(resource, errorCb)) == null ? void 0 : _a.resdesc) ?? null;
3773
3786
  });
3787
+ // --- [ PATCH.Resources ] ------------------------------------------------------------------------------------------------------------------
3788
+ __publicField(this, "PatchResourcesAR", async (resources, errorCb) => {
3789
+ const url = `${__privateGet(this, _options2).endpoint}${goptions.rest01apiroot}/resources`;
3790
+ return await __privateGet(this, _axiosClient).InvokeResourceAPI(url, "patch", resources, null, null, errorCb);
3791
+ });
3792
+ __publicField(this, "PatchResourcesDBR", async (resources, errorCb) => {
3793
+ var _a;
3794
+ return ((_a = await this.PatchResourcesAR(resources, errorCb)) == null ? void 0 : _a.data.map((r) => r.detail)) ?? null;
3795
+ });
3796
+ __publicField(this, "PatchResources", async (resources, errorCb) => {
3797
+ var _a;
3798
+ return ((_a = await this.PatchResourcesDBR(resources, errorCb)) == null ? void 0 : _a.map((r) => r.resdesc)) ?? null;
3799
+ });
3774
3800
  // --- [ PATCH.Resource ] -------------------------------------------------------------------------------------------------------------------
3775
3801
  __publicField(this, "PatchResourceAR", async (resource, errorCb) => {
3776
3802
  const url = `${__privateGet(this, _options2).endpoint}${goptions.rest01apiroot}/resources/${resource.resname}`;
@@ -3784,6 +3810,19 @@ class STSRest01Client {
3784
3810
  var _a;
3785
3811
  return ((_a = await this.PatchResourceDBR(resource, errorCb)) == null ? void 0 : _a.resdesc) ?? null;
3786
3812
  });
3813
+ // --- [ DELETE.Resources ] -------------------------------------------------------------------------------------------------------------------
3814
+ __publicField(this, "DeleteResourcesAR", async (resources, errorCb) => {
3815
+ const url = `${__privateGet(this, _options2).endpoint}${goptions.rest01apiroot}/resources`;
3816
+ return await __privateGet(this, _axiosClient).InvokeResourceAPI(url, "delete", resources, null, null, errorCb);
3817
+ });
3818
+ __publicField(this, "DeleteResourcesDBR", async (resources, errorCb) => {
3819
+ var _a;
3820
+ return ((_a = await this.DeleteResourcesAR(resources, errorCb)) == null ? void 0 : _a.data.map((r) => r.detail)) ?? null;
3821
+ });
3822
+ __publicField(this, "DeleteResources", async (resources, errorCb) => {
3823
+ var _a;
3824
+ return ((_a = await this.DeleteResourcesDBR(resources, errorCb)) == null ? void 0 : _a.map((r) => r.resdesc)) ?? null;
3825
+ });
3787
3826
  // --- [ DELETE.Resource ] -------------------------------------------------------------------------------------------------------------------
3788
3827
  __publicField(this, "DeleteResourceAR", async (resource, errorCb) => {
3789
3828
  const url = `${__privateGet(this, _options2).endpoint}${goptions.rest01apiroot}/resources/${resource.resname}`;
@@ -3830,6 +3869,18 @@ class STSRest01Client {
3830
3869
  return ((_a = await this.GetResourcesDBR(filters, errorCb)) == null ? void 0 : _a.map((r) => r.resdesc)) ?? null;
3831
3870
  });
3832
3871
  // --- [ Entity ] -------------------------------------------------------------------------------------------------------------------
3872
+ __privateAdd(this, _checkResName, (resourceEntities) => {
3873
+ let resName = "";
3874
+ resourceEntities.forEach((re) => {
3875
+ resName = resName.localeCompare("") === 0 ? re.resname : resName;
3876
+ if (resName.localeCompare(re.resname) !== 0) {
3877
+ throw new Error(`Invalid batch provided. resname not all equal. Previous checked value: [${resName}, current value: [${re.resname}]`);
3878
+ } else {
3879
+ resName = re.resname;
3880
+ }
3881
+ });
3882
+ return resName;
3883
+ });
3833
3884
  // --- [ POST.Entitiy ] -------------------------------------------------------------------------------------------------------------------
3834
3885
  __publicField(this, "PostEntityAR", async (resourceEntity, errorCb) => {
3835
3886
  const url = `${__privateGet(this, _options2).endpoint}${goptions.rest01apiroot}/resources/${resourceEntity.resname}/entities`;
@@ -3843,6 +3894,19 @@ class STSRest01Client {
3843
3894
  var _a;
3844
3895
  return ((_a = await this.PostEntityDBR(resourceEntity, errorCb)) == null ? void 0 : _a.entvalue) ?? null;
3845
3896
  });
3897
+ // --- [ PUT.Entities ] -----------------------------------------------------------------------------------------------------------------
3898
+ __publicField(this, "PutEntitiesAR", async (resourceEntities, errorCb) => {
3899
+ const url = `${__privateGet(this, _options2).endpoint}${goptions.rest01apiroot}/resources/${__privateGet(this, _checkResName).call(this, resourceEntities)}/entities`;
3900
+ return __privateGet(this, _axiosClient).InvokeResourceAPI(url, "put", resourceEntities, null, null, errorCb);
3901
+ });
3902
+ __publicField(this, "PutEntitiesDBR", async (resourceEntities, errorCb) => {
3903
+ var _a;
3904
+ return ((_a = await this.PutEntitiesAR(resourceEntities, errorCb)) == null ? void 0 : _a.data.map((r) => r.detail)) ?? null;
3905
+ });
3906
+ __publicField(this, "PutEntities", async (resourceEntities, errorCb) => {
3907
+ var _a;
3908
+ return ((_a = await this.PutEntitiesDBR(resourceEntities, errorCb)) == null ? void 0 : _a.map((r) => r.entvalue)) ?? null;
3909
+ });
3846
3910
  // --- [ PUT.Entity ] -------------------------------------------------------------------------------------------------------------------
3847
3911
  __publicField(this, "PutEntityAR", async (entity, errorCb) => {
3848
3912
  const url = `${__privateGet(this, _options2).endpoint}${goptions.rest01apiroot}/resources/${entity.resname}/entities/${entity.entname}`;
@@ -3856,6 +3920,19 @@ class STSRest01Client {
3856
3920
  var _a;
3857
3921
  return ((_a = await this.PutEntityDBR(resourceEntity, errorCb)) == null ? void 0 : _a.entvalue) ?? null;
3858
3922
  });
3923
+ // --- [ PATCH.Entities ] -----------------------------------------------------------------------------------------------------------------
3924
+ __publicField(this, "PatchEntitiesAR", async (resourceEntities, errorCb) => {
3925
+ const url = `${__privateGet(this, _options2).endpoint}${goptions.rest01apiroot}/resources/${__privateGet(this, _checkResName).call(this, resourceEntities)}/entities`;
3926
+ return __privateGet(this, _axiosClient).InvokeResourceAPI(url, "patch", resourceEntities, null, null, errorCb);
3927
+ });
3928
+ __publicField(this, "PatchEntitiesDBR", async (resourceEntities, errorCb) => {
3929
+ var _a;
3930
+ return ((_a = await this.PatchEntitiesAR(resourceEntities, errorCb)) == null ? void 0 : _a.data.map((r) => r.detail)) ?? null;
3931
+ });
3932
+ __publicField(this, "PatchEntities", async (resourceEntities, errorCb) => {
3933
+ var _a;
3934
+ return ((_a = await this.PatchEntitiesDBR(resourceEntities, errorCb)) == null ? void 0 : _a.map((r) => r.entvalue)) ?? null;
3935
+ });
3859
3936
  // --- [ PATCH.Entity ] -------------------------------------------------------------------------------------------------------------------
3860
3937
  __publicField(this, "PatchEntityAR", async (resourceEntity, errorCb) => {
3861
3938
  const url = `${__privateGet(this, _options2).endpoint}${goptions.rest01apiroot}/resources/${resourceEntity.resname}/entities/${resourceEntity.entname}`;
@@ -3870,6 +3947,19 @@ class STSRest01Client {
3870
3947
  return ((_a = await this.PatchEntityDBR(resourceEntity, errorCb)) == null ? void 0 : _a.entvalue) ?? null;
3871
3948
  });
3872
3949
  // --- [ DELETE.Entity ] -------------------------------------------------------------------------------------------------------------------
3950
+ __publicField(this, "DeleteEntitiesAR", async (resourceEntities, errorCb) => {
3951
+ const url = `${__privateGet(this, _options2).endpoint}${goptions.rest01apiroot}/resources/${__privateGet(this, _checkResName).call(this, resourceEntities)}/entities`;
3952
+ return __privateGet(this, _axiosClient).InvokeResourceAPI(url, "delete", resourceEntities, null, null, errorCb);
3953
+ });
3954
+ __publicField(this, "DeleteEntitiesDBR", async (resourceEntities, errorCb) => {
3955
+ var _a;
3956
+ return ((_a = await this.DeleteEntitiesAR(resourceEntities, errorCb)) == null ? void 0 : _a.data.map((r) => r.detail)) ?? null;
3957
+ });
3958
+ __publicField(this, "DeleteEntities", async (resourceEntities, errorCb) => {
3959
+ var _a;
3960
+ return ((_a = await this.DeleteEntitiesDBR(resourceEntities, errorCb)) == null ? void 0 : _a.map((r) => r.entvalue)) ?? null;
3961
+ });
3962
+ // --- [ DELETE.Entity ] -------------------------------------------------------------------------------------------------------------------
3873
3963
  __publicField(this, "DeleteEntityAR", async (resourceEntity, errorCb) => {
3874
3964
  const url = `${__privateGet(this, _options2).endpoint}${goptions.rest01apiroot}/resources/${resourceEntity.resname}/entities/${resourceEntity.entname}`;
3875
3965
  return __privateGet(this, _axiosClient).InvokeResourceAPI(url, "delete", resourceEntity, null, null, errorCb);
@@ -3927,6 +4017,7 @@ class STSRest01Client {
3927
4017
  }
3928
4018
  _axiosClient = new WeakMap();
3929
4019
  _options2 = new WeakMap();
4020
+ _checkResName = new WeakMap();
3930
4021
  export {
3931
4022
  AxiosClient,
3932
4023
  STSRest01Client