suanpan_node_sdk 2.2.4 → 2.2.5
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/index.d.ts +10 -10
- package/dist/api/index.js +56 -52
- package/dist/api/index.js.map +1 -1
- package/dist/core/common/constant.d.ts +6 -6
- package/dist/core/common/constant.js +50 -50
- package/dist/core/common/exec.d.ts +1 -1
- package/dist/core/common/exec.js +53 -53
- package/dist/core/common/log.d.ts +3 -3
- package/dist/core/common/log.js +15 -15
- package/dist/core/event/index.d.ts +6 -6
- package/dist/core/event/index.js +10 -10
- package/dist/core/logkit/index.d.ts +33 -33
- package/dist/core/logkit/index.js +125 -125
- package/dist/core/logkit/index.js.map +1 -1
- package/dist/core/message/channel.d.ts +7 -7
- package/dist/core/message/channel.js +2 -2
- package/dist/core/message/channelFactory.d.ts +4 -4
- package/dist/core/message/channelFactory.js +10 -10
- package/dist/core/message/index.d.ts +6 -6
- package/dist/core/message/index.js +22 -18
- package/dist/core/message/index.js.map +1 -1
- package/dist/core/message/message.d.ts +19 -19
- package/dist/core/message/message.js +59 -59
- package/dist/core/message/message.js.map +1 -1
- package/dist/core/message/messageBuilder.d.ts +12 -12
- package/dist/core/message/messageBuilder.js +50 -50
- package/dist/core/message/messageBuilder.js.map +1 -1
- package/dist/core/message/messageChain.d.ts +9 -9
- package/dist/core/message/messageChain.js +29 -29
- package/dist/core/message/messageListener.d.ts +4 -4
- package/dist/core/message/messageListener.js +11 -11
- package/dist/core/message/mq/index.d.ts +9 -9
- package/dist/core/message/mq/index.js +50 -50
- package/dist/core/message/mq/redis.d.ts +12 -12
- package/dist/core/message/mq/redis.js +101 -97
- package/dist/core/message/mq/redis.js.map +1 -1
- package/dist/core/parameter/commandArgs.d.ts +2 -2
- package/dist/core/parameter/commandArgs.js +22 -22
- package/dist/core/parameter/commandArgs.js.map +1 -1
- package/dist/core/parameter/environment.d.ts +86 -86
- package/dist/core/parameter/environment.js +103 -103
- package/dist/core/parameter/index.d.ts +7 -7
- package/dist/core/parameter/index.js +33 -33
- package/dist/core/script/script-babel/babel.d.ts +1 -1
- package/dist/core/script/script-babel/babel.js +23 -23
- package/dist/core/script/script-babel/plugin.d.ts +7 -7
- package/dist/core/script/script-babel/plugin.js +16 -16
- package/dist/core/script/script-constant.d.ts +36 -36
- package/dist/core/script/script-constant.js +70 -70
- package/dist/core/script/script-context.d.ts +1 -1
- package/dist/core/script/script-context.js +295 -295
- package/dist/core/script/script-front.d.ts +1 -1
- package/dist/core/script/script-front.js +201 -201
- package/dist/core/script/script-insert.d.ts +18 -18
- package/dist/core/script/script-insert.js +43 -43
- package/dist/core/script/script-manager.d.ts +74 -74
- package/dist/core/script/script-manager.js +261 -261
- package/dist/core/script/script-storage.d.ts +22 -22
- package/dist/core/script/script-storage.js +241 -241
- package/dist/core/script/script-support.d.ts +11 -11
- package/dist/core/script/script-support.js +140 -140
- package/dist/core/script/script-template.d.ts +1 -1
- package/dist/core/script/script-template.js +6 -6
- package/dist/core/service/port.d.ts +5 -5
- package/dist/core/service/port.js +53 -53
- package/dist/core/service/port.js.map +1 -1
- package/dist/core/storage/index.d.ts +5 -5
- package/dist/core/storage/index.js +21 -17
- package/dist/core/storage/index.js.map +1 -1
- package/dist/core/storage/minioStorage.d.ts +31 -28
- package/dist/core/storage/minioStorage.js +224 -209
- package/dist/core/storage/minioStorage.js.map +1 -1
- package/dist/core/storage/objectStorage.d.ts +23 -19
- package/dist/core/storage/objectStorage.js +3 -3
- package/dist/core/storage/ossStorage.d.ts +29 -26
- package/dist/core/storage/ossStorage.js +215 -193
- package/dist/core/storage/ossStorage.js.map +1 -1
- package/dist/core/storage/storageFlusher.d.ts +14 -14
- package/dist/core/storage/storageFlusher.js +54 -54
- package/dist/core/storage/storageLogger.d.ts +16 -16
- package/dist/core/storage/storageLogger.js +100 -100
- package/dist/core/storage/storageLogger.js.map +1 -1
- package/dist/core/storage/storagePath.d.ts +16 -16
- package/dist/core/storage/storagePath.js +49 -49
- package/dist/core/storage/wrapperStorage.d.ts +17 -17
- package/dist/core/storage/wrapperStorage.js +47 -47
- package/dist/core/storage/wrapperStorage.js.map +1 -1
- package/dist/core/utils/flusher.d.ts +18 -18
- package/dist/core/utils/flusher.js +66 -62
- package/dist/core/utils/flusher.js.map +1 -1
- package/dist/core/utils/http.d.ts +3 -3
- package/dist/core/utils/http.js +35 -35
- package/dist/core/utils/http.js.map +1 -1
- package/dist/core/utils/index.d.ts +57 -56
- package/dist/core/utils/index.js +247 -243
- package/dist/core/utils/index.js.map +1 -1
- package/dist/core/utils/number.d.ts +2 -2
- package/dist/core/utils/number.js +19 -19
- package/dist/core/utils/retry.d.ts +1 -1
- package/dist/core/utils/retry.js +34 -34
- package/dist/core/utils/retry.js.map +1 -1
- package/dist/core/utils/suanpan.d.ts +21 -20
- package/dist/core/utils/suanpan.js +103 -92
- package/dist/core/utils/suanpan.js.map +1 -1
- package/dist/core/web/app.d.ts +2 -2
- package/dist/core/web/app.js +38 -38
- package/dist/core/web/app.js.map +1 -1
- package/dist/core/web/server.d.ts +3 -3
- package/dist/core/web/server.js +64 -60
- package/dist/core/web/server.js.map +1 -1
- package/dist/main.d.ts +5 -5
- package/dist/main.js +28 -24
- package/dist/main.js.map +1 -1
- package/dist/types/conmonTypes.d.ts +21 -21
- package/dist/types/conmonTypes.js +16 -16
- package/dist/types/index.d.ts +3 -3
- package/dist/types/index.js +19 -15
- package/dist/types/index.js.map +1 -1
- package/dist/types/storageTypes.d.ts +59 -58
- package/dist/types/storageTypes.js +9 -9
- package/dist/types/streamTypes.d.ts +21 -21
- package/dist/types/streamTypes.js +2 -2
- package/package.json +1 -1
|
@@ -1,63 +1,67 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.BufferFlusher = void 0;
|
|
27
|
+
const events = __importStar(require("events"));
|
|
28
|
+
class BufferFlusher extends events.EventEmitter {
|
|
29
|
+
constructor(options = {}) {
|
|
30
|
+
super();
|
|
31
|
+
this._buffer = [];
|
|
32
|
+
this._maxItems = options.maxItems || 1;
|
|
33
|
+
this._flushInterval = options.flushInterval === undefined ? 0 : options.flushInterval;
|
|
34
|
+
this.flush();
|
|
35
|
+
}
|
|
36
|
+
get() { return this._buffer; }
|
|
37
|
+
clear() { this._buffer = []; }
|
|
38
|
+
stop() { clearTimeout(this._flushTimeoutId); }
|
|
39
|
+
add(data) {
|
|
40
|
+
if (data) {
|
|
41
|
+
this._buffer.push(data);
|
|
42
|
+
if (this._buffer.length >= this._maxItems) {
|
|
43
|
+
this.flush();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
flush() {
|
|
48
|
+
this.stop();
|
|
49
|
+
// The timer is the only action that would hold the node-process open.
|
|
50
|
+
// By unref-ing it, the process will exit prior to the timeout callback execution
|
|
51
|
+
this._flushTimeoutId = setTimeout(() => this.flush(), this._flushInterval).unref();
|
|
52
|
+
if (!this._buffer.length) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
this.emit('flush', this._buffer);
|
|
57
|
+
}
|
|
58
|
+
catch (err) {
|
|
59
|
+
// 当事件被触发时,如果没有与该事件绑定的函数的话,该事件会被静默忽略掉
|
|
60
|
+
// 但是如果事件的名称是 error 的话,没有与此相关的事件处理的话,程序就会 crash 退出
|
|
61
|
+
this.emit('error', err);
|
|
62
|
+
}
|
|
63
|
+
this._buffer = [];
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.BufferFlusher = BufferFlusher;
|
|
63
67
|
//# sourceMappingURL=flusher.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flusher.js","sourceRoot":"","sources":["../../../src/core/utils/flusher.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"flusher.js","sourceRoot":"","sources":["../../../src/core/utils/flusher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;AAMjC,MAAa,aAAc,SAAQ,MAAM,CAAC,YAAY;IAOpD,YAAY,UAAwB,EAAE;QACpC,KAAK,EAAE,CAAC;QANF,YAAO,GAAa,EAAE,CAAC;QAO7B,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,QAAQ,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC;QACtF,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;IAED,GAAG,KAAK,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAC9B,KAAK,KAAK,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC,CAAC,CAAC;IAC9B,IAAI,KAAK,YAAY,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IAE9C,GAAG,CAAC,IAAY;QACd,IAAI,IAAI,EAAE;YACR,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACxB,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,IAAI,CAAC,SAAS,EAAE;gBACzC,IAAI,CAAC,KAAK,EAAE,CAAC;aACd;SACF;IACH,CAAC;IAED,KAAK;QACH,IAAI,CAAC,IAAI,EAAE,CAAC;QACZ,uEAAuE;QACvE,iFAAiF;QACjF,IAAI,CAAC,eAAe,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC,KAAK,EAAE,CAAC;QAEnF,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;YAAE,OAAO;SAAE;QAErC,IAAI;YACF,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;SAClC;QAAC,OAAO,GAAG,EAAE;YACZ,qCAAqC;YACrC,kDAAkD;YAClD,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;SACzB;QAED,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;IACpB,CAAC;CACF;AA7CD,sCA6CC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { AxiosRequestConfig } from 'axios';
|
|
2
|
-
export
|
|
3
|
-
export declare function httpRequest<T>(options: RequestConfig): Promise<T>;
|
|
1
|
+
import { AxiosRequestConfig } from 'axios';
|
|
2
|
+
export type RequestConfig = AxiosRequestConfig;
|
|
3
|
+
export declare function httpRequest<T>(options: RequestConfig): Promise<T>;
|
package/dist/core/utils/http.js
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.httpRequest = void 0;
|
|
16
|
-
const log_1 = __importDefault(require("../common/log"));
|
|
17
|
-
const axios_1 = __importDefault(require("axios"));
|
|
18
|
-
const utils_1 = require("../utils");
|
|
19
|
-
function httpRequest(options) {
|
|
20
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
-
let res;
|
|
22
|
-
yield utils_1.promiseRetry((retry, times) => __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
try {
|
|
24
|
-
res = yield axios_1.default.request(options);
|
|
25
|
-
}
|
|
26
|
-
catch (ex) {
|
|
27
|
-
log_1.default.error('http request error is : \n%O', ex);
|
|
28
|
-
log_1.default.info(`retry ${times} times`);
|
|
29
|
-
retry(ex);
|
|
30
|
-
}
|
|
31
|
-
}));
|
|
32
|
-
return res.data;
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
exports.httpRequest = httpRequest;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.httpRequest = void 0;
|
|
16
|
+
const log_1 = __importDefault(require("../common/log"));
|
|
17
|
+
const axios_1 = __importDefault(require("axios"));
|
|
18
|
+
const utils_1 = require("../utils");
|
|
19
|
+
function httpRequest(options) {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
let res;
|
|
22
|
+
yield (0, utils_1.promiseRetry)((retry, times) => __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
try {
|
|
24
|
+
res = yield axios_1.default.request(options);
|
|
25
|
+
}
|
|
26
|
+
catch (ex) {
|
|
27
|
+
log_1.default.error('http request error is : \n%O', ex);
|
|
28
|
+
log_1.default.info(`retry ${times} times`);
|
|
29
|
+
retry(ex);
|
|
30
|
+
}
|
|
31
|
+
}));
|
|
32
|
+
return res.data;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
exports.httpRequest = httpRequest;
|
|
36
36
|
//# sourceMappingURL=http.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../../src/core/utils/http.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,wDAAmC;AACnC,kDAAiE;AACjE,oCAAwC;AAIxC,SAAsB,WAAW,CAAI,OAAsB;;QACzD,IAAI,GAAsB,CAAC;QAC3B,MAAM,oBAAY,
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../../src/core/utils/http.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,wDAAmC;AACnC,kDAAiE;AACjE,oCAAwC;AAIxC,SAAsB,WAAW,CAAI,OAAsB;;QACzD,IAAI,GAAsB,CAAC;QAC3B,MAAM,IAAA,oBAAY,EAAC,CAAO,KAAK,EAAE,KAAa,EAAE,EAAE;YAChD,IAAI;gBACF,GAAG,GAAG,MAAM,eAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;aACpC;YAAC,OAAO,EAAE,EAAE;gBACX,aAAM,CAAC,KAAK,CAAC,8BAA8B,EAAE,EAAE,CAAC,CAAC;gBACjD,aAAM,CAAC,IAAI,CAAC,SAAS,KAAK,QAAQ,CAAC,CAAC;gBACpC,KAAK,CAAC,EAAE,CAAC,CAAC;aACX;QACH,CAAC,CAAA,CAAC,CAAC;QACH,OAAO,GAAG,CAAC,IAAI,CAAC;IAClB,CAAC;CAAA;AAZD,kCAYC"}
|
|
@@ -1,56 +1,57 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export declare function
|
|
8
|
-
export declare function
|
|
9
|
-
export declare function
|
|
10
|
-
export declare function
|
|
11
|
-
export declare
|
|
12
|
-
export declare
|
|
13
|
-
export declare function
|
|
14
|
-
export declare function
|
|
15
|
-
export declare function
|
|
16
|
-
export declare function
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* @param {*}
|
|
27
|
-
* @param {*}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
*
|
|
38
|
-
* @param {*}
|
|
39
|
-
* @param {*}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
*
|
|
45
|
-
* @param {*}
|
|
46
|
-
* @param {*}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
export declare function
|
|
50
|
-
export declare function
|
|
51
|
-
export declare function
|
|
52
|
-
export declare function
|
|
53
|
-
export declare function
|
|
54
|
-
declare
|
|
55
|
-
|
|
56
|
-
export declare function
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
export * from './flusher';
|
|
4
|
+
export * from './number';
|
|
5
|
+
export * from './retry';
|
|
6
|
+
import { Readable as ReadableStream, Stream } from 'stream';
|
|
7
|
+
export declare function generateUUID(): string;
|
|
8
|
+
export declare function getConfig(setting: any): any;
|
|
9
|
+
export declare function tryJSONParse(text: string, fallback?: any): any;
|
|
10
|
+
export declare function isTrue(value: unknown): boolean;
|
|
11
|
+
export declare function isDesktop(): boolean;
|
|
12
|
+
export declare const isUseMaster: () => boolean;
|
|
13
|
+
export declare function isDesktopMaster(): boolean;
|
|
14
|
+
export declare function stringifyIfNecessary(data: any): any;
|
|
15
|
+
export declare function pathEndWith(csvFilePath: any, fileSuffix: any): boolean;
|
|
16
|
+
export declare function readableToString(readable: ReadableStream): Promise<unknown>;
|
|
17
|
+
export declare function leftMerge(leftObj?: {}, rightObj?: {}): {};
|
|
18
|
+
/**
|
|
19
|
+
* insert a string at a specific index
|
|
20
|
+
*
|
|
21
|
+
* @param leftInsert and @param replace cannot be true at the same time
|
|
22
|
+
*
|
|
23
|
+
* by default, @param insertStr will be inserted between index and index + 1,
|
|
24
|
+
* you can set @param leftInsert: true to insert @param insertStr between index-1 and index
|
|
25
|
+
*
|
|
26
|
+
* @param {*} originString
|
|
27
|
+
* @param {*} index
|
|
28
|
+
* @param {*} insertStr
|
|
29
|
+
*/
|
|
30
|
+
export declare function insertbyIndex(originString: string, { index, insertStr, leftInsert, replace }: {
|
|
31
|
+
index: any;
|
|
32
|
+
insertStr: any;
|
|
33
|
+
leftInsert?: boolean | undefined;
|
|
34
|
+
replace?: boolean | undefined;
|
|
35
|
+
}): string;
|
|
36
|
+
/**
|
|
37
|
+
* find the nth occurrence of the specified character
|
|
38
|
+
* @param {*} str
|
|
39
|
+
* @param {*} char
|
|
40
|
+
* @param {*} num
|
|
41
|
+
*/
|
|
42
|
+
export declare function indexOfNthCharacters(str: string, char: any, num: any): number;
|
|
43
|
+
/**
|
|
44
|
+
* find the nth occurrence of the specified character
|
|
45
|
+
* @param {*} str
|
|
46
|
+
* @param {*} char
|
|
47
|
+
* @param {*} num
|
|
48
|
+
*/
|
|
49
|
+
export declare function lastIndexOfNthCharacters(str: string, char: any, num: any): number;
|
|
50
|
+
export declare function signatureV1(secret?: string, data?: string): string;
|
|
51
|
+
export declare function fileExists(path: any): boolean;
|
|
52
|
+
export declare function writeBufToFile(dstPath: any, buf: any): Promise<unknown>;
|
|
53
|
+
export declare function sleep(ms: number): Promise<unknown>;
|
|
54
|
+
export declare function convertStreamToBuffer(stream: Stream): Promise<Buffer>;
|
|
55
|
+
type BufferEncoding = 'ascii' | 'utf8' | 'utf-8' | 'utf16le' | 'ucs2' | 'ucs-2' | 'base64' | 'latin1' | 'binary' | 'hex';
|
|
56
|
+
export declare function convertStreamToString(stream: Stream, encoding?: BufferEncoding): Promise<string>;
|
|
57
|
+
export declare function convertBufferToStream(buffer: Buffer): Stream;
|