ronds-metadata 1.3.18 → 1.3.19

Sign up to get free protection for your applications and to get access to all the features.
package/es/api/index.d.ts CHANGED
@@ -25,4 +25,5 @@ export default class Api implements IAPI {
25
25
  StopGraphRun(data: any): Promise<{
26
26
  success: boolean;
27
27
  }>;
28
+ getKafkaInfo(): Promise<any>;
28
29
  }
package/es/api/index.js CHANGED
@@ -5,7 +5,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
5
5
  /*
6
6
  * @Author:wangxian
7
7
  * @Date: 2021-09-18 14:15:04
8
- * @LastEditTime: 2023-08-30 09:08:24
8
+ * @LastEditTime: 2023-09-25 17:13:26
9
9
  */
10
10
  import { guid, md5 } from '../utils';
11
11
  import { addInterceptor, HttpHelper } from '../framework/http';
@@ -252,6 +252,36 @@ var Api = /*#__PURE__*/function () {
252
252
  return _StopGraphRun.apply(this, arguments);
253
253
  }
254
254
  return StopGraphRun;
255
+ }() // 通过扩展规则获取枚举类型的值
256
+ }, {
257
+ key: "getKafkaInfo",
258
+ value: function () {
259
+ var _getKafkaInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
260
+ var url, res;
261
+ return _regeneratorRuntime.wrap(function _callee8$(_context8) {
262
+ while (1) switch (_context8.prev = _context8.next) {
263
+ case 0:
264
+ url = '/wx/dataset-web/source/kafka/queue:Kafka:通信平台-kafka:MQTT.TimeScaleData/message/byte';
265
+ _context8.next = 3;
266
+ return http.post(encodeURI(url), {}, {}, {
267
+ responseType: 'arraybuffer',
268
+ headers: {
269
+ 'Content-Type': 'application/protobuf'
270
+ }
271
+ });
272
+ case 3:
273
+ res = _context8.sent;
274
+ return _context8.abrupt("return", res.successed ? res.data : []);
275
+ case 5:
276
+ case "end":
277
+ return _context8.stop();
278
+ }
279
+ }, _callee8);
280
+ }));
281
+ function getKafkaInfo() {
282
+ return _getKafkaInfo.apply(this, arguments);
283
+ }
284
+ return getKafkaInfo;
255
285
  }()
256
286
  }]);
257
287
  return Api;
@@ -0,0 +1,7 @@
1
+ declare const protobuf: any;
2
+ declare const data: {
3
+ name: string;
4
+ age: number;
5
+ sexEnum: number;
6
+ };
7
+ declare function setMessage(data: any): void;
@@ -0,0 +1,27 @@
1
+ /*
2
+ * @Author: wangxian
3
+ * @Date: 2023-09-22 11:28:45
4
+ * @LastEditTime: 2023-09-22 13:55:58
5
+ */
6
+ var protobuf = require('protobufjs');
7
+ var data = {
8
+ name: '狍狍',
9
+ age: 1,
10
+ sexEnum: 1
11
+ };
12
+ function setMessage(data) {
13
+ protobuf.load('./transfer.proto').then(function (root) {
14
+ // 根据proto文件中的内容对message进行实例化
15
+ var transferMessage = root.lookupType('transferData.transferMessage');
16
+ // 验证
17
+ var errMsg = transferMessage.verify(data);
18
+ if (errMsg) {
19
+ throw new Error(errMsg);
20
+ }
21
+ // 转换为message实例
22
+ var messageFromObj = transferMessage.fromObject(data);
23
+ // 编码
24
+ var buffer = transferMessage.encode(messageFromObj).finish();
25
+ }).catch(function () {});
26
+ }
27
+ setMessage(data);
@@ -0,0 +1,12 @@
1
+ syntax = "proto2"
2
+ package transferData;
3
+
4
+ message transferMessage {
5
+ required string name = 1;
6
+ required int32 age = 2;
7
+ enum SexEnum {
8
+ Boy = 0;
9
+ Girl = 1;
10
+ }
11
+ optional SexEnum SexEnum = 3;
12
+ }
package/es/utils.js CHANGED
@@ -6,7 +6,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
6
6
  /*
7
7
  * @Author: wangxian
8
8
  * @Date: 2021-09-18 14:15:04
9
- * @LastEditTime: 2023-09-14 16:28:26
9
+ * @LastEditTime: 2023-09-27 08:03:46
10
10
  */
11
11
  import saveAs from 'file-saver';
12
12
  import { asBlob } from 'html-docx-js-typescript';
@@ -192,7 +192,6 @@ function _handleMd2Doc() {
192
192
  // 修改图片路径;
193
193
  token.attrs[token.attrIndex('src')][1] = "".concat(window.location.origin, "/").concat(src);
194
194
  }
195
- token.attrs[token.attrIndex('src')][1] = 'https://images.app.goo.gl/fxbwKFuGSmgXPZ6a8';
196
195
  var width = '620'; // 自定义宽度
197
196
  var height = 'auto'; // 自适应高度
198
197
  // 添加自定义宽高属性
@@ -272,4 +271,16 @@ function convertImagePathToBase64(imagePath) {
272
271
  };
273
272
  img.src = imagePath;
274
273
  });
274
+ function transBase642byte(base64String) {
275
+ // 解码 Base64 字符串为原始二进制数据
276
+ var decodedData = window.atob(base64String);
277
+ // 将解码后的字符串转换为 Uint8Array
278
+ var uint8Array = new Uint8Array(decodedData.length);
279
+ for (var i = 0; i < decodedData.length; ++i) {
280
+ uint8Array[i] = decodedData.charCodeAt(i);
281
+ }
282
+ // 打印解码结果
283
+
284
+ return uint8Array;
285
+ }
275
286
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "public": true,
3
3
  "name": "ronds-metadata",
4
- "version": "1.3.18",
4
+ "version": "1.3.19",
5
5
  "scripts": {
6
6
  "start": "dumi dev",
7
7
  "docs:build": "dumi build",
@@ -65,6 +65,7 @@
65
65
  "markdown-it": "^13.0.1",
66
66
  "markdown-navbar": "^1.4.3",
67
67
  "monaco-editor": "^0.41.0",
68
+ "protobufjs": "^7.2.5",
68
69
  "qs": "^6.10.1",
69
70
  "react": "^17.0.2",
70
71
  "react-contenteditable": "^3.3.7",
@@ -111,4 +112,4 @@
111
112
  "webpack-cli": "^3.3.12",
112
113
  "yorkie": "^2.0.0"
113
114
  }
114
- }
115
+ }