@aliyun-obv/api 0.0.46 → 0.0.48

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.
package/dist/api.d.ts CHANGED
@@ -213,4 +213,26 @@ declare namespace workSpaceService {
213
213
  export {};
214
214
  }
215
215
 
216
- export { commonEasyFetch, metaService, obsEasyFetch, showAlertDialog, showAlertDialogWhenNeedLogin, slsEasyFetch, workSpaceService };
216
+ declare namespace indexService {
217
+ interface IndexParameters {
218
+ ProjectName: string;
219
+ LogStoreName: string;
220
+ }
221
+ interface GetProjectLogs {
222
+ ProjectName: string;
223
+ query: string;
224
+ }
225
+ function updateIndexInfo(params: IndexParameters, options?: {
226
+ forbidAlert: boolean;
227
+ }): Promise<IResponseData>;
228
+ function getIndexInfo(params: IndexParameters, options?: {
229
+ forbidAlert: boolean;
230
+ }): Promise<IResponseData>;
231
+ function getProjectLogs(params: GetProjectLogs): Promise<IResponseData>;
232
+ function getCloudMonitoringProjectLogs(params: GetProjectLogs, options?: {
233
+ forbidAlert: boolean;
234
+ }): Promise<IResponseData>;
235
+ function updateIndexDocVal(project: string, logstore: string): Promise<void>;
236
+ }
237
+
238
+ export { commonEasyFetch, indexService, metaService, obsEasyFetch, showAlertDialog, showAlertDialogWhenNeedLogin, slsEasyFetch, workSpaceService };
package/dist/api.es.js CHANGED
@@ -41,7 +41,7 @@ var __publicField = (obj, key, value) => {
41
41
  __defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
42
42
  return value;
43
43
  };
44
- var __async$5 = (__this, __arguments, generator) => {
44
+ var __async$6 = (__this, __arguments, generator) => {
45
45
  return new Promise((resolve, reject) => {
46
46
  var fulfilled = (value) => {
47
47
  try {
@@ -103,7 +103,7 @@ class BaseFetch {
103
103
  return { url, init: newInit };
104
104
  }
105
105
  callFetch(_0, _1) {
106
- return __async$5(this, arguments, function* (api, init, options = {}) {
106
+ return __async$6(this, arguments, function* (api, init, options = {}) {
107
107
  let headers = init == null ? void 0 : init.headers;
108
108
  if (options.headers) {
109
109
  headers = Object.assign({}, init == null ? void 0 : init.headers, options.headers);
@@ -115,7 +115,7 @@ class BaseFetch {
115
115
  });
116
116
  }
117
117
  get(_0) {
118
- return __async$5(this, arguments, function* (api, params = {}, options = {}) {
118
+ return __async$6(this, arguments, function* (api, params = {}, options = {}) {
119
119
  if (isTest)
120
120
  return Promise.resolve({ res: void 0 });
121
121
  try {
@@ -144,7 +144,7 @@ class BaseFetch {
144
144
  });
145
145
  }
146
146
  _post(_0) {
147
- return __async$5(this, arguments, function* (api, params = {}, options = {}, defaultInit) {
147
+ return __async$6(this, arguments, function* (api, params = {}, options = {}, defaultInit) {
148
148
  var _a;
149
149
  if (isTest)
150
150
  return Promise.resolve({ res: void 0 });
@@ -168,12 +168,12 @@ class BaseFetch {
168
168
  });
169
169
  }
170
170
  post(_0) {
171
- return __async$5(this, arguments, function* (api, params = {}, options = {}) {
171
+ return __async$6(this, arguments, function* (api, params = {}, options = {}) {
172
172
  return this._post(api, params, options, this.defaults.postDefaultInit);
173
173
  });
174
174
  }
175
175
  put(_0) {
176
- return __async$5(this, arguments, function* (api, params = {}, options = {}) {
176
+ return __async$6(this, arguments, function* (api, params = {}, options = {}) {
177
177
  return this._post(api, params, options, this.defaults.putDefaultInit);
178
178
  });
179
179
  }
@@ -255,7 +255,7 @@ var __spreadValues$3 = (a, b) => {
255
255
  return a;
256
256
  };
257
257
  var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
258
- var __async$4 = (__this, __arguments, generator) => {
258
+ var __async$5 = (__this, __arguments, generator) => {
259
259
  return new Promise((resolve, reject) => {
260
260
  var fulfilled = (value) => {
261
261
  try {
@@ -278,7 +278,7 @@ var __async$4 = (__this, __arguments, generator) => {
278
278
  const commonEasyFetch = new BaseFetch();
279
279
  commonEasyFetch.defaults.postDefaultInit.headers["Content-Type"] = "application/x-www-form-urlencoded";
280
280
  commonEasyFetch.defaults.postDefaultInit.headers["Accept"] = "application/json";
281
- commonEasyFetch.defaults.afterResponse = (response) => __async$4(void 0, null, function* () {
281
+ commonEasyFetch.defaults.afterResponse = (response) => __async$5(void 0, null, function* () {
282
282
  if (response.status >= 200 && response.status < 300) {
283
283
  const data = yield response.json();
284
284
  return __spreadProps$3(__spreadValues$3({}, data != null ? data : {}), {
@@ -537,7 +537,7 @@ var __spreadValues$2 = (a, b) => {
537
537
  return a;
538
538
  };
539
539
  var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
540
- var __async$3 = (__this, __arguments, generator) => {
540
+ var __async$4 = (__this, __arguments, generator) => {
541
541
  return new Promise((resolve, reject) => {
542
542
  var fulfilled = (value) => {
543
543
  try {
@@ -604,7 +604,7 @@ function waitRefreshToken() {
604
604
  });
605
605
  }
606
606
  function _finalFetch(api, fetchOptions, deep = 0) {
607
- return __async$3(this, null, function* () {
607
+ return __async$4(this, null, function* () {
608
608
  const requestApi = api;
609
609
  if (tokenRefreshing) {
610
610
  yield waitRefreshToken();
@@ -633,7 +633,7 @@ function _finalFetch(api, fetchOptions, deep = 0) {
633
633
  });
634
634
  }
635
635
  function finalFetch(api, fetchOptions, options) {
636
- return __async$3(this, null, function* () {
636
+ return __async$4(this, null, function* () {
637
637
  let finalOption = fetchOptions;
638
638
  const parseQuery = urijs(decodeURIComponent(location.search)).escapeQuerySpace(false).query(true);
639
639
  if (parseQuery.slsRegion && options.ingoreSlsRegion) {
@@ -673,7 +673,7 @@ var __spreadValues$1 = (a, b) => {
673
673
  return a;
674
674
  };
675
675
  var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
676
- var __async$2 = (__this, __arguments, generator) => {
676
+ var __async$3 = (__this, __arguments, generator) => {
677
677
  return new Promise((resolve, reject) => {
678
678
  var fulfilled = (value) => {
679
679
  try {
@@ -697,7 +697,7 @@ const slsEasyFetch = new BaseFetch(finalFetch);
697
697
  slsEasyFetch.defaults.postDefaultInit.headers["Content-Type"] = "application/x-www-form-urlencoded";
698
698
  slsEasyFetch.defaults.postDefaultInit.headers["Accept"] = "application/json";
699
699
  slsEasyFetch.defaults.errorHandler = errorHandler;
700
- slsEasyFetch.defaults.beforeRequest = (url, params, init, options) => __async$2(void 0, null, function* () {
700
+ slsEasyFetch.defaults.beforeRequest = (url, params, init, options) => __async$3(void 0, null, function* () {
701
701
  var _a;
702
702
  const method = (_a = init.method) == null ? void 0 : _a.toLowerCase();
703
703
  if (method === "post" || method === "put") {
@@ -728,7 +728,7 @@ slsEasyFetch.defaults.beforeRequest = (url, params, init, options) => __async$2(
728
728
  };
729
729
  }
730
730
  });
731
- slsEasyFetch.defaults.afterResponse = (r, options) => __async$2(void 0, null, function* () {
731
+ slsEasyFetch.defaults.afterResponse = (r, options) => __async$3(void 0, null, function* () {
732
732
  const { response, data } = r;
733
733
  let composedData = typeof data === "string" || typeof data === "number" || Array.isArray(data) ? data : __spreadProps$1(__spreadValues$1({}, data), {
734
734
  response
@@ -782,7 +782,7 @@ var __spreadValues = (a, b) => {
782
782
  return a;
783
783
  };
784
784
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
785
- var __async$1 = (__this, __arguments, generator) => {
785
+ var __async$2 = (__this, __arguments, generator) => {
786
786
  return new Promise((resolve, reject) => {
787
787
  var fulfilled = (value) => {
788
788
  try {
@@ -805,13 +805,13 @@ var __async$1 = (__this, __arguments, generator) => {
805
805
  var metaService;
806
806
  ((metaService2) => {
807
807
  function getMetaRecord(params) {
808
- return __async$1(this, null, function* () {
808
+ return __async$2(this, null, function* () {
809
809
  return slsEasyFetch.get("/console/metaRecordAjax/get.json", params);
810
810
  });
811
811
  }
812
812
  metaService2.getMetaRecord = getMetaRecord;
813
813
  function listMetaRecord(params, forbidAlert = false) {
814
- return __async$1(this, null, function* () {
814
+ return __async$2(this, null, function* () {
815
815
  return slsEasyFetch.get(
816
816
  "/console/metaRecordAjax/list.json",
817
817
  __spreadProps(__spreadValues({}, params), {
@@ -824,13 +824,13 @@ var metaService;
824
824
  }
825
825
  metaService2.listMetaRecord = listMetaRecord;
826
826
  function createMetaResource(params) {
827
- return __async$1(this, null, function* () {
827
+ return __async$2(this, null, function* () {
828
828
  return slsEasyFetch.post("/console/metaResourceAjax/create.json", params);
829
829
  });
830
830
  }
831
831
  metaService2.createMetaResource = createMetaResource;
832
832
  function createMetaRecord(_0) {
833
- return __async$1(this, arguments, function* ({ name, record }, forbidAlert = false) {
833
+ return __async$2(this, arguments, function* ({ name, record }, forbidAlert = false) {
834
834
  const recordObj = __spreadProps(__spreadValues({}, record), {
835
835
  value: JSON.stringify(record.value)
836
836
  });
@@ -846,7 +846,7 @@ var metaService;
846
846
  }
847
847
  metaService2.createMetaRecord = createMetaRecord;
848
848
  function updataMetaRecord(_0) {
849
- return __async$1(this, arguments, function* ({ name, record }, forbidAlert = false) {
849
+ return __async$2(this, arguments, function* ({ name, record }, forbidAlert = false) {
850
850
  const recordObj = __spreadProps(__spreadValues({}, record), {
851
851
  value: JSON.stringify(record.value)
852
852
  });
@@ -862,7 +862,7 @@ var metaService;
862
862
  }
863
863
  metaService2.updataMetaRecord = updataMetaRecord;
864
864
  function listMetaRecordWithIdentity(params, forbidAlert = false) {
865
- return __async$1(this, null, function* () {
865
+ return __async$2(this, null, function* () {
866
866
  return slsEasyFetch.get(
867
867
  "/console/metaRecordAjax/listWithIdentity.json",
868
868
  __spreadProps(__spreadValues({}, params), {
@@ -875,13 +875,13 @@ var metaService;
875
875
  }
876
876
  metaService2.listMetaRecordWithIdentity = listMetaRecordWithIdentity;
877
877
  function getMetaRecordWithIdentity(params) {
878
- return __async$1(this, null, function* () {
878
+ return __async$2(this, null, function* () {
879
879
  return slsEasyFetch.get("/console/metaRecordAjax/getWithIdentity.json", params);
880
880
  });
881
881
  }
882
882
  metaService2.getMetaRecordWithIdentity = getMetaRecordWithIdentity;
883
883
  function updataMetaRecordWithIdentity(_0) {
884
- return __async$1(this, arguments, function* ({ name, record }, forbidAlert = false) {
884
+ return __async$2(this, arguments, function* ({ name, record }, forbidAlert = false) {
885
885
  const recordObj = __spreadProps(__spreadValues({}, record), {
886
886
  value: JSON.stringify(record.value)
887
887
  });
@@ -897,7 +897,7 @@ var metaService;
897
897
  }
898
898
  metaService2.updataMetaRecordWithIdentity = updataMetaRecordWithIdentity;
899
899
  function deleteRecords() {
900
- return __async$1(this, arguments, function* (config = {
900
+ return __async$2(this, arguments, function* (config = {
901
901
  name: "",
902
902
  recordIds: ""
903
903
  // 1,2
@@ -907,7 +907,7 @@ var metaService;
907
907
  }
908
908
  metaService2.deleteRecords = deleteRecords;
909
909
  function deleteRecordsWithIdentity() {
910
- return __async$1(this, arguments, function* (config = {
910
+ return __async$2(this, arguments, function* (config = {
911
911
  name: "",
912
912
  recordIds: ""
913
913
  // 1,2
@@ -919,13 +919,13 @@ var metaService;
919
919
  }
920
920
  metaService2.deleteRecordsWithIdentity = deleteRecordsWithIdentity;
921
921
  function deleteResource(params) {
922
- return __async$1(this, null, function* () {
922
+ return __async$2(this, null, function* () {
923
923
  return slsEasyFetch.post("/console/metaResourceAjax/delete.json", params);
924
924
  });
925
925
  }
926
926
  metaService2.deleteResource = deleteResource;
927
927
  function createSomeMetaRecordsWithIdentity(_0) {
928
- return __async$1(this, arguments, function* ({ name, records }, forbidAlert = false) {
928
+ return __async$2(this, arguments, function* ({ name, records }, forbidAlert = false) {
929
929
  return slsEasyFetch.post(
930
930
  "/console/metaRecordAjax/batchUpsertWithIdentity.json",
931
931
  {
@@ -938,7 +938,7 @@ var metaService;
938
938
  }
939
939
  metaService2.createSomeMetaRecordsWithIdentity = createSomeMetaRecordsWithIdentity;
940
940
  function createSomeMetaRecords(_0) {
941
- return __async$1(this, arguments, function* ({ name, records }, forbidAlert = false) {
941
+ return __async$2(this, arguments, function* ({ name, records }, forbidAlert = false) {
942
942
  return slsEasyFetch.post(
943
943
  "/console/metaRecordAjax/batchUpsert.json",
944
944
  {
@@ -951,7 +951,7 @@ var metaService;
951
951
  }
952
952
  metaService2.createSomeMetaRecords = createSomeMetaRecords;
953
953
  function getNewDashboardList(_0) {
954
- return __async$1(this, arguments, function* ({ name, jsonPath, jsonPathValue, page, size }, forbidAlert = false) {
954
+ return __async$2(this, arguments, function* ({ name, jsonPath, jsonPathValue, page, size }, forbidAlert = false) {
955
955
  return slsEasyFetch.post(
956
956
  `/console/metaRecordAjax/list.json`,
957
957
  {
@@ -967,7 +967,7 @@ var metaService;
967
967
  }
968
968
  metaService2.getNewDashboardList = getNewDashboardList;
969
969
  function getNewDashboardListWithIdentity(_0) {
970
- return __async$1(this, arguments, function* ({ name, jsonPath, jsonPathValue, page, size }, forbidAlert = false) {
970
+ return __async$2(this, arguments, function* ({ name, jsonPath, jsonPathValue, page, size }, forbidAlert = false) {
971
971
  return slsEasyFetch.post(
972
972
  `/console/metaRecordAjax/listWithIdentity.json`,
973
973
  {
@@ -983,7 +983,7 @@ var metaService;
983
983
  }
984
984
  metaService2.getNewDashboardListWithIdentity = getNewDashboardListWithIdentity;
985
985
  function deleteVersionRecords(_0) {
986
- return __async$1(this, arguments, function* ({ name, recordIds }, forbidAlert = false) {
986
+ return __async$2(this, arguments, function* ({ name, recordIds }, forbidAlert = false) {
987
987
  return slsEasyFetch.post(
988
988
  "/console/metaRecordAjax/delete.json",
989
989
  {
@@ -995,7 +995,7 @@ var metaService;
995
995
  });
996
996
  }
997
997
  metaService2.deleteVersionRecords = deleteVersionRecords;
998
- metaService2.ckeckPermissionForList = (resourceName) => __async$1(void 0, null, function* () {
998
+ metaService2.ckeckPermissionForList = (resourceName) => __async$2(void 0, null, function* () {
999
999
  const res = yield slsEasyFetch.get(
1000
1000
  "/console/metaRecordAjax/checkList.json",
1001
1001
  {
@@ -1010,7 +1010,7 @@ var metaService;
1010
1010
  });
1011
1011
  })(metaService || (metaService = {}));
1012
1012
 
1013
- var __async = (__this, __arguments, generator) => {
1013
+ var __async$1 = (__this, __arguments, generator) => {
1014
1014
  return new Promise((resolve, reject) => {
1015
1015
  var fulfilled = (value) => {
1016
1016
  try {
@@ -1033,42 +1033,128 @@ var __async = (__this, __arguments, generator) => {
1033
1033
  var workSpaceService;
1034
1034
  ((workSpaceService2) => {
1035
1035
  function getWorkspaceRecord(params) {
1036
- return __async(this, null, function* () {
1036
+ return __async$1(this, null, function* () {
1037
1037
  return slsEasyFetch.get("/console/workspace/list_app.json", params);
1038
1038
  });
1039
1039
  }
1040
1040
  workSpaceService2.getWorkspaceRecord = getWorkspaceRecord;
1041
1041
  function getWorkspacelist(params) {
1042
- return __async(this, null, function* () {
1042
+ return __async$1(this, null, function* () {
1043
1043
  return slsEasyFetch.get("/console/workspace/list.json", params);
1044
1044
  });
1045
1045
  }
1046
1046
  workSpaceService2.getWorkspacelist = getWorkspacelist;
1047
1047
  function getWorkspaceInfor(params) {
1048
- return __async(this, null, function* () {
1048
+ return __async$1(this, null, function* () {
1049
1049
  return slsEasyFetch.get("/console/workspace/get.json", params);
1050
1050
  });
1051
1051
  }
1052
1052
  workSpaceService2.getWorkspaceInfor = getWorkspaceInfor;
1053
1053
  function createInstance(params) {
1054
- return __async(this, null, function* () {
1054
+ return __async$1(this, null, function* () {
1055
1055
  return slsEasyFetch.post("/observability/createInstance.json", params);
1056
1056
  });
1057
1057
  }
1058
1058
  workSpaceService2.createInstance = createInstance;
1059
1059
  function updataAppInstance(params) {
1060
- return __async(this, null, function* () {
1060
+ return __async$1(this, null, function* () {
1061
1061
  return slsEasyFetch.post("/console/workspace/update_app.json", params);
1062
1062
  });
1063
1063
  }
1064
1064
  workSpaceService2.updataAppInstance = updataAppInstance;
1065
1065
  function getWorkspaceForITOM(params) {
1066
- return __async(this, null, function* () {
1066
+ return __async$1(this, null, function* () {
1067
1067
  return slsEasyFetch.get("/console/workspace/getWorkspaceForITOM.json", params);
1068
1068
  });
1069
1069
  }
1070
1070
  workSpaceService2.getWorkspaceForITOM = getWorkspaceForITOM;
1071
1071
  })(workSpaceService || (workSpaceService = {}));
1072
1072
 
1073
- export { commonEasyFetch, metaService, obsEasyFetch, showAlertDialog, showAlertDialogWhenNeedLogin, slsEasyFetch, workSpaceService };
1073
+ var __async = (__this, __arguments, generator) => {
1074
+ return new Promise((resolve, reject) => {
1075
+ var fulfilled = (value) => {
1076
+ try {
1077
+ step(generator.next(value));
1078
+ } catch (e) {
1079
+ reject(e);
1080
+ }
1081
+ };
1082
+ var rejected = (value) => {
1083
+ try {
1084
+ step(generator.throw(value));
1085
+ } catch (e) {
1086
+ reject(e);
1087
+ }
1088
+ };
1089
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
1090
+ step((generator = generator.apply(__this, __arguments)).next());
1091
+ });
1092
+ };
1093
+ var indexService;
1094
+ ((indexService2) => {
1095
+ function updateIndexInfo(_0) {
1096
+ return __async(this, arguments, function* (params, options = {
1097
+ forbidAlert: true
1098
+ }) {
1099
+ return slsEasyFetch.post("/console/logstoreindex/update.json", params, options);
1100
+ });
1101
+ }
1102
+ indexService2.updateIndexInfo = updateIndexInfo;
1103
+ function getIndexInfo(_0) {
1104
+ return __async(this, arguments, function* (params, options = {
1105
+ forbidAlert: true
1106
+ }) {
1107
+ return slsEasyFetch.get("/console/logstoreindex/getString.json", params, options);
1108
+ });
1109
+ }
1110
+ indexService2.getIndexInfo = getIndexInfo;
1111
+ function getProjectLogs(params) {
1112
+ return __async(this, null, function* () {
1113
+ return slsEasyFetch.get("/console/logstoreindex/getProjectLogs.json", params);
1114
+ });
1115
+ }
1116
+ indexService2.getProjectLogs = getProjectLogs;
1117
+ function getCloudMonitoringProjectLogs(_0) {
1118
+ return __async(this, arguments, function* (params, options = {
1119
+ forbidAlert: true
1120
+ }) {
1121
+ return slsEasyFetch.get("/console/logstoreindex/getProjectLogs.json", params, options);
1122
+ });
1123
+ }
1124
+ indexService2.getCloudMonitoringProjectLogs = getCloudMonitoringProjectLogs;
1125
+ function updateIndexDocVal(project, logstore) {
1126
+ return __async(this, null, function* () {
1127
+ const openDocVal = (obj) => {
1128
+ Object.keys(obj).forEach((key) => {
1129
+ obj[key].doc_value = true;
1130
+ if (obj[key].type === "json") {
1131
+ openDocVal(obj[key].json_keys);
1132
+ }
1133
+ });
1134
+ };
1135
+ const res = yield indexService2.getIndexInfo({ ProjectName: project, LogStoreName: logstore });
1136
+ if (res && res.code === "200" && res.data) {
1137
+ const config = JSON.parse(res.data);
1138
+ const { keys, max_text_len, ttl, log_reduce, line } = config;
1139
+ openDocVal(keys || {});
1140
+ const params = {
1141
+ ProjectName: project,
1142
+ LogStoreName: logstore,
1143
+ TTL: config.ttl,
1144
+ indexDetail: JSON.stringify({
1145
+ max_text_len,
1146
+ ttl,
1147
+ log_reduce,
1148
+ line,
1149
+ keys
1150
+ })
1151
+ };
1152
+ yield updateIndexInfo(params);
1153
+ }
1154
+ });
1155
+ }
1156
+ indexService2.updateIndexDocVal = updateIndexDocVal;
1157
+ })(indexService || (indexService = {}));
1158
+
1159
+ export { commonEasyFetch, indexService, metaService, obsEasyFetch, showAlertDialog, showAlertDialogWhenNeedLogin, slsEasyFetch, workSpaceService };
1074
1160
  //# sourceMappingURL=api.es.js.map
package/package.json CHANGED
@@ -10,11 +10,11 @@
10
10
  "urijs": "^1.19.1",
11
11
  "lodash": "^4.17.21",
12
12
  "@alicloud/console-base-error-prompt-proxy": "^1.9.12",
13
- "@aliyun-obv/i18n": "0.0.46",
14
- "@aliyun-obv/utils": "0.0.46",
13
+ "@aliyun-obv/i18n": "0.0.48",
14
+ "@aliyun-obv/utils": "0.0.48",
15
15
  "@alifd/next": "^1.27.11",
16
16
  "styled-components": "^5.2.0"
17
17
  },
18
18
  "devDependencies": {},
19
- "version": "0.0.46"
19
+ "version": "0.0.48"
20
20
  }