@searchfe/openclaw-baiduapp 0.1.10 → 0.1.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.
- package/dist/index.js +204 -166
- package/dist/index.js.map +1 -1
- package/openclaw.plugin.json +1 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import os, { tmpdir } from 'os';
|
|
3
3
|
import path2 from 'path';
|
|
4
|
+
import readline from 'readline';
|
|
4
5
|
import { fileURLToPath } from 'url';
|
|
5
6
|
import crypto from 'crypto';
|
|
6
7
|
import { createRequire } from 'module';
|
|
7
8
|
import { lookup } from 'dns/promises';
|
|
8
9
|
import fs2 from 'fs/promises';
|
|
9
10
|
import net from 'net';
|
|
10
|
-
import fs from 'fs';
|
|
11
|
-
import { tmpdir } from 'os';
|
|
12
11
|
|
|
13
12
|
var __create = Object.create;
|
|
14
13
|
var __defProp = Object.defineProperty;
|
|
@@ -1359,7 +1358,7 @@ var require_package = __commonJS({
|
|
|
1359
1358
|
// node_modules/.pnpm/@baiducloud+sdk@1.0.7/node_modules/@baiducloud/sdk/src/crypto.js
|
|
1360
1359
|
var require_crypto = __commonJS({
|
|
1361
1360
|
"node_modules/.pnpm/@baiducloud+sdk@1.0.7/node_modules/@baiducloud/sdk/src/crypto.js"(exports$1) {
|
|
1362
|
-
var
|
|
1361
|
+
var fs4 = __require("fs");
|
|
1363
1362
|
var crypto3 = __require("crypto");
|
|
1364
1363
|
var Q = require_q();
|
|
1365
1364
|
exports$1.md5sum = function(data, enc, digest) {
|
|
@@ -1385,7 +1384,7 @@ var require_crypto = __commonJS({
|
|
|
1385
1384
|
return deferred.promise;
|
|
1386
1385
|
};
|
|
1387
1386
|
exports$1.md5file = function(filename, digest) {
|
|
1388
|
-
return exports$1.md5stream(
|
|
1387
|
+
return exports$1.md5stream(fs4.createReadStream(filename), digest);
|
|
1389
1388
|
};
|
|
1390
1389
|
exports$1.md5blob = function(blob, digest) {
|
|
1391
1390
|
var deferred = Q.defer();
|
|
@@ -2314,8 +2313,8 @@ var init_tap = __esm({
|
|
|
2314
2313
|
});
|
|
2315
2314
|
|
|
2316
2315
|
// node_modules/.pnpm/underscore@1.13.8/node_modules/underscore/modules/toPath.js
|
|
2317
|
-
function toPath(
|
|
2318
|
-
return isArray_default(
|
|
2316
|
+
function toPath(path5) {
|
|
2317
|
+
return isArray_default(path5) ? path5 : [path5];
|
|
2319
2318
|
}
|
|
2320
2319
|
var init_toPath = __esm({
|
|
2321
2320
|
"node_modules/.pnpm/underscore@1.13.8/node_modules/underscore/modules/toPath.js"() {
|
|
@@ -2326,8 +2325,8 @@ var init_toPath = __esm({
|
|
|
2326
2325
|
});
|
|
2327
2326
|
|
|
2328
2327
|
// node_modules/.pnpm/underscore@1.13.8/node_modules/underscore/modules/_toPath.js
|
|
2329
|
-
function toPath2(
|
|
2330
|
-
return _.toPath(
|
|
2328
|
+
function toPath2(path5) {
|
|
2329
|
+
return _.toPath(path5);
|
|
2331
2330
|
}
|
|
2332
2331
|
var init_toPath2 = __esm({
|
|
2333
2332
|
"node_modules/.pnpm/underscore@1.13.8/node_modules/underscore/modules/_toPath.js"() {
|
|
@@ -2337,11 +2336,11 @@ var init_toPath2 = __esm({
|
|
|
2337
2336
|
});
|
|
2338
2337
|
|
|
2339
2338
|
// node_modules/.pnpm/underscore@1.13.8/node_modules/underscore/modules/_deepGet.js
|
|
2340
|
-
function deepGet(obj,
|
|
2341
|
-
var length =
|
|
2339
|
+
function deepGet(obj, path5) {
|
|
2340
|
+
var length = path5.length;
|
|
2342
2341
|
for (var i = 0; i < length; i++) {
|
|
2343
2342
|
if (obj == null) return void 0;
|
|
2344
|
-
obj = obj[
|
|
2343
|
+
obj = obj[path5[i]];
|
|
2345
2344
|
}
|
|
2346
2345
|
return length ? obj : void 0;
|
|
2347
2346
|
}
|
|
@@ -2351,8 +2350,8 @@ var init_deepGet = __esm({
|
|
|
2351
2350
|
});
|
|
2352
2351
|
|
|
2353
2352
|
// node_modules/.pnpm/underscore@1.13.8/node_modules/underscore/modules/get.js
|
|
2354
|
-
function get(object2,
|
|
2355
|
-
var value = deepGet(object2, toPath2(
|
|
2353
|
+
function get(object2, path5, defaultValue) {
|
|
2354
|
+
var value = deepGet(object2, toPath2(path5));
|
|
2356
2355
|
return isUndefined(value) ? defaultValue : value;
|
|
2357
2356
|
}
|
|
2358
2357
|
var init_get = __esm({
|
|
@@ -2364,11 +2363,11 @@ var init_get = __esm({
|
|
|
2364
2363
|
});
|
|
2365
2364
|
|
|
2366
2365
|
// node_modules/.pnpm/underscore@1.13.8/node_modules/underscore/modules/has.js
|
|
2367
|
-
function has2(obj,
|
|
2368
|
-
|
|
2369
|
-
var length =
|
|
2366
|
+
function has2(obj, path5) {
|
|
2367
|
+
path5 = toPath2(path5);
|
|
2368
|
+
var length = path5.length;
|
|
2370
2369
|
for (var i = 0; i < length; i++) {
|
|
2371
|
-
var key =
|
|
2370
|
+
var key = path5[i];
|
|
2372
2371
|
if (!has(obj, key)) return false;
|
|
2373
2372
|
obj = obj[key];
|
|
2374
2373
|
}
|
|
@@ -2405,10 +2404,10 @@ var init_matcher = __esm({
|
|
|
2405
2404
|
});
|
|
2406
2405
|
|
|
2407
2406
|
// node_modules/.pnpm/underscore@1.13.8/node_modules/underscore/modules/property.js
|
|
2408
|
-
function property(
|
|
2409
|
-
|
|
2407
|
+
function property(path5) {
|
|
2408
|
+
path5 = toPath2(path5);
|
|
2410
2409
|
return function(obj) {
|
|
2411
|
-
return deepGet(obj,
|
|
2410
|
+
return deepGet(obj, path5);
|
|
2412
2411
|
};
|
|
2413
2412
|
}
|
|
2414
2413
|
var init_property = __esm({
|
|
@@ -2517,8 +2516,8 @@ var init_noop = __esm({
|
|
|
2517
2516
|
// node_modules/.pnpm/underscore@1.13.8/node_modules/underscore/modules/propertyOf.js
|
|
2518
2517
|
function propertyOf(obj) {
|
|
2519
2518
|
if (obj == null) return noop;
|
|
2520
|
-
return function(
|
|
2521
|
-
return get(obj,
|
|
2519
|
+
return function(path5) {
|
|
2520
|
+
return get(obj, path5);
|
|
2522
2521
|
};
|
|
2523
2522
|
}
|
|
2524
2523
|
var init_propertyOf = __esm({
|
|
@@ -2712,14 +2711,14 @@ var init_template = __esm({
|
|
|
2712
2711
|
});
|
|
2713
2712
|
|
|
2714
2713
|
// node_modules/.pnpm/underscore@1.13.8/node_modules/underscore/modules/result.js
|
|
2715
|
-
function result(obj,
|
|
2716
|
-
|
|
2717
|
-
var length =
|
|
2714
|
+
function result(obj, path5, fallback2) {
|
|
2715
|
+
path5 = toPath2(path5);
|
|
2716
|
+
var length = path5.length;
|
|
2718
2717
|
if (!length) {
|
|
2719
2718
|
return isFunction_default(fallback2) ? fallback2.call(obj) : fallback2;
|
|
2720
2719
|
}
|
|
2721
2720
|
for (var i = 0; i < length; i++) {
|
|
2722
|
-
var prop = obj == null ? void 0 : obj[
|
|
2721
|
+
var prop = obj == null ? void 0 : obj[path5[i]];
|
|
2723
2722
|
if (prop === void 0) {
|
|
2724
2723
|
prop = fallback2;
|
|
2725
2724
|
i = length;
|
|
@@ -3402,14 +3401,14 @@ var init_invoke = __esm({
|
|
|
3402
3401
|
init_map();
|
|
3403
3402
|
init_deepGet();
|
|
3404
3403
|
init_toPath2();
|
|
3405
|
-
invoke_default = restArguments(function(obj,
|
|
3404
|
+
invoke_default = restArguments(function(obj, path5, args) {
|
|
3406
3405
|
var contextPath, func;
|
|
3407
|
-
if (isFunction_default(
|
|
3408
|
-
func =
|
|
3406
|
+
if (isFunction_default(path5)) {
|
|
3407
|
+
func = path5;
|
|
3409
3408
|
} else {
|
|
3410
|
-
|
|
3411
|
-
contextPath =
|
|
3412
|
-
|
|
3409
|
+
path5 = toPath2(path5);
|
|
3410
|
+
contextPath = path5.slice(0, -1);
|
|
3411
|
+
path5 = path5[path5.length - 1];
|
|
3413
3412
|
}
|
|
3414
3413
|
return map(obj, function(context) {
|
|
3415
3414
|
var method = func;
|
|
@@ -3418,7 +3417,7 @@ var init_invoke = __esm({
|
|
|
3418
3417
|
context = deepGet(context, contextPath);
|
|
3419
3418
|
}
|
|
3420
3419
|
if (context == null) return void 0;
|
|
3421
|
-
method = context[
|
|
3420
|
+
method = context[path5];
|
|
3422
3421
|
}
|
|
3423
3422
|
return method == null ? method : method.apply(context, args);
|
|
3424
3423
|
});
|
|
@@ -6367,8 +6366,8 @@ var require_http_client = __commonJS({
|
|
|
6367
6366
|
this._req = null;
|
|
6368
6367
|
}
|
|
6369
6368
|
util2.inherits(HttpClient, EventEmitter);
|
|
6370
|
-
HttpClient.prototype.updateConfigByPath = function(
|
|
6371
|
-
const pathArr =
|
|
6369
|
+
HttpClient.prototype.updateConfigByPath = function(path5, value) {
|
|
6370
|
+
const pathArr = path5.split(".");
|
|
6372
6371
|
function traverseAndUpdate(currentObj, index2) {
|
|
6373
6372
|
if (index2 >= pathArr.length - 1) {
|
|
6374
6373
|
currentObj[pathArr[index2]] = value;
|
|
@@ -6382,9 +6381,9 @@ var require_http_client = __commonJS({
|
|
|
6382
6381
|
traverseAndUpdate(this.config, 0);
|
|
6383
6382
|
return this.config;
|
|
6384
6383
|
};
|
|
6385
|
-
HttpClient.prototype.sendRequest = function(httpMethod,
|
|
6384
|
+
HttpClient.prototype.sendRequest = function(httpMethod, path5, body, headers, params, signFunction, outputStream) {
|
|
6386
6385
|
httpMethod = httpMethod.toUpperCase();
|
|
6387
|
-
var requestUrl = this._getRequestUrl(
|
|
6386
|
+
var requestUrl = this._getRequestUrl(path5, params);
|
|
6388
6387
|
var options = __require("url").parse(requestUrl);
|
|
6389
6388
|
debug("httpMethod = %s, requestUrl = %s, options = %j", httpMethod, requestUrl, options);
|
|
6390
6389
|
var defaultHeaders = {};
|
|
@@ -6431,7 +6430,7 @@ var require_http_client = __commonJS({
|
|
|
6431
6430
|
}
|
|
6432
6431
|
}
|
|
6433
6432
|
if (typeof signFunction === "function") {
|
|
6434
|
-
var promise = signFunction(this.config.credentials, httpMethod,
|
|
6433
|
+
var promise = signFunction(this.config.credentials, httpMethod, path5, params, headers, this);
|
|
6435
6434
|
if (isPromise(promise)) {
|
|
6436
6435
|
return promise.then(function(authorization, xbceDate) {
|
|
6437
6436
|
headers[H.AUTHORIZATION] = authorization;
|
|
@@ -6447,14 +6446,14 @@ var require_http_client = __commonJS({
|
|
|
6447
6446
|
throw new Error("Invalid signature = (" + promise + ")");
|
|
6448
6447
|
}
|
|
6449
6448
|
} else {
|
|
6450
|
-
headers[H.AUTHORIZATION] = createSignature(this.config.credentials, httpMethod,
|
|
6449
|
+
headers[H.AUTHORIZATION] = createSignature(this.config.credentials, httpMethod, path5, params, headers);
|
|
6451
6450
|
}
|
|
6452
6451
|
debug("options = %j", options);
|
|
6453
6452
|
return client._doRequest(options, body, outputStream);
|
|
6454
6453
|
};
|
|
6455
|
-
function createSignature(credentials, httpMethod,
|
|
6454
|
+
function createSignature(credentials, httpMethod, path5, params, headers) {
|
|
6456
6455
|
var auth = new Auth(credentials.ak, credentials.sk);
|
|
6457
|
-
return auth.generateAuthorization(httpMethod,
|
|
6456
|
+
return auth.generateAuthorization(httpMethod, path5, params, headers);
|
|
6458
6457
|
}
|
|
6459
6458
|
function isPromise(obj) {
|
|
6460
6459
|
return obj && (typeof obj === "object" || typeof obj === "function") && typeof obj.then === "function";
|
|
@@ -6636,8 +6635,8 @@ var require_http_client = __commonJS({
|
|
|
6636
6635
|
return "%" + char.charCodeAt().toString(16);
|
|
6637
6636
|
});
|
|
6638
6637
|
};
|
|
6639
|
-
HttpClient.prototype._getRequestUrl = function(
|
|
6640
|
-
var uri =
|
|
6638
|
+
HttpClient.prototype._getRequestUrl = function(path5, params) {
|
|
6639
|
+
var uri = path5;
|
|
6641
6640
|
var qs = this.buildQueryString(params);
|
|
6642
6641
|
if (qs) {
|
|
6643
6642
|
uri += "?" + qs;
|
|
@@ -6719,12 +6718,12 @@ var require_bce_base_client = __commonJS({
|
|
|
6719
6718
|
config.DEFAULT_SERVICE_DOMAIN
|
|
6720
6719
|
);
|
|
6721
6720
|
};
|
|
6722
|
-
BceBaseClient.prototype.createSignature = function(credentials, httpMethod,
|
|
6721
|
+
BceBaseClient.prototype.createSignature = function(credentials, httpMethod, path5, params, headers) {
|
|
6723
6722
|
var revisionTimestamp = Date.now() + (this.timeOffset || 0);
|
|
6724
6723
|
headers[H.X_BCE_DATE] = new Date(revisionTimestamp).toISOString().replace(/\.\d+Z$/, "Z");
|
|
6725
6724
|
return Q.fcall(function() {
|
|
6726
6725
|
var auth = new Auth(credentials.ak, credentials.sk);
|
|
6727
|
-
return auth.generateAuthorization(httpMethod,
|
|
6726
|
+
return auth.generateAuthorization(httpMethod, path5, params, headers, revisionTimestamp / 1e3);
|
|
6728
6727
|
});
|
|
6729
6728
|
};
|
|
6730
6729
|
BceBaseClient.prototype.sendRequest = function(httpMethod, resource, varArgs) {
|
|
@@ -9774,7 +9773,7 @@ var init_async = __esm({
|
|
|
9774
9773
|
// node_modules/.pnpm/@baiducloud+sdk@1.0.7/node_modules/@baiducloud/sdk/src/helper.js
|
|
9775
9774
|
var require_helper = __commonJS({
|
|
9776
9775
|
"node_modules/.pnpm/@baiducloud+sdk@1.0.7/node_modules/@baiducloud/sdk/src/helper.js"(exports$1) {
|
|
9777
|
-
var
|
|
9776
|
+
var fs4 = __require("fs");
|
|
9778
9777
|
var stream = __require("stream");
|
|
9779
9778
|
var async = (init_async(), __toCommonJS(async_exports));
|
|
9780
9779
|
var u = (init_index_all(), __toCommonJS(index_all_exports));
|
|
@@ -9798,7 +9797,7 @@ var require_helper = __commonJS({
|
|
|
9798
9797
|
var contentLength = 0;
|
|
9799
9798
|
var dataType = -1;
|
|
9800
9799
|
if (typeof data === "string") {
|
|
9801
|
-
contentLength =
|
|
9800
|
+
contentLength = fs4.lstatSync(data).size;
|
|
9802
9801
|
dataType = DATA_TYPE_FILE;
|
|
9803
9802
|
} else if (Buffer.isBuffer(data)) {
|
|
9804
9803
|
contentLength = data.length;
|
|
@@ -10902,11 +10901,11 @@ var require_baseGet = __commonJS({
|
|
|
10902
10901
|
"node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/_baseGet.js"(exports$1, module) {
|
|
10903
10902
|
var castPath = require_castPath();
|
|
10904
10903
|
var toKey = require_toKey();
|
|
10905
|
-
function baseGet(object2,
|
|
10906
|
-
|
|
10907
|
-
var index2 = 0, length =
|
|
10904
|
+
function baseGet(object2, path5) {
|
|
10905
|
+
path5 = castPath(path5, object2);
|
|
10906
|
+
var index2 = 0, length = path5.length;
|
|
10908
10907
|
while (object2 != null && index2 < length) {
|
|
10909
|
-
object2 = object2[toKey(
|
|
10908
|
+
object2 = object2[toKey(path5[index2++])];
|
|
10910
10909
|
}
|
|
10911
10910
|
return index2 && index2 == length ? object2 : void 0;
|
|
10912
10911
|
}
|
|
@@ -11889,8 +11888,8 @@ var require_baseMatches = __commonJS({
|
|
|
11889
11888
|
var require_get = __commonJS({
|
|
11890
11889
|
"node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/get.js"(exports$1, module) {
|
|
11891
11890
|
var baseGet = require_baseGet();
|
|
11892
|
-
function get2(object2,
|
|
11893
|
-
var result2 = object2 == null ? void 0 : baseGet(object2,
|
|
11891
|
+
function get2(object2, path5, defaultValue) {
|
|
11892
|
+
var result2 = object2 == null ? void 0 : baseGet(object2, path5);
|
|
11894
11893
|
return result2 === void 0 ? defaultValue : result2;
|
|
11895
11894
|
}
|
|
11896
11895
|
module.exports = get2;
|
|
@@ -11916,11 +11915,11 @@ var require_hasPath = __commonJS({
|
|
|
11916
11915
|
var isIndex = require_isIndex();
|
|
11917
11916
|
var isLength = require_isLength();
|
|
11918
11917
|
var toKey = require_toKey();
|
|
11919
|
-
function hasPath(object2,
|
|
11920
|
-
|
|
11921
|
-
var index2 = -1, length =
|
|
11918
|
+
function hasPath(object2, path5, hasFunc) {
|
|
11919
|
+
path5 = castPath(path5, object2);
|
|
11920
|
+
var index2 = -1, length = path5.length, result2 = false;
|
|
11922
11921
|
while (++index2 < length) {
|
|
11923
|
-
var key = toKey(
|
|
11922
|
+
var key = toKey(path5[index2]);
|
|
11924
11923
|
if (!(result2 = object2 != null && hasFunc(object2, key))) {
|
|
11925
11924
|
break;
|
|
11926
11925
|
}
|
|
@@ -11941,8 +11940,8 @@ var require_hasIn = __commonJS({
|
|
|
11941
11940
|
"node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/hasIn.js"(exports$1, module) {
|
|
11942
11941
|
var baseHasIn = require_baseHasIn();
|
|
11943
11942
|
var hasPath = require_hasPath();
|
|
11944
|
-
function hasIn(object2,
|
|
11945
|
-
return object2 != null && hasPath(object2,
|
|
11943
|
+
function hasIn(object2, path5) {
|
|
11944
|
+
return object2 != null && hasPath(object2, path5, baseHasIn);
|
|
11946
11945
|
}
|
|
11947
11946
|
module.exports = hasIn;
|
|
11948
11947
|
}
|
|
@@ -11960,13 +11959,13 @@ var require_baseMatchesProperty = __commonJS({
|
|
|
11960
11959
|
var toKey = require_toKey();
|
|
11961
11960
|
var COMPARE_PARTIAL_FLAG = 1;
|
|
11962
11961
|
var COMPARE_UNORDERED_FLAG = 2;
|
|
11963
|
-
function baseMatchesProperty(
|
|
11964
|
-
if (isKey(
|
|
11965
|
-
return matchesStrictComparable(toKey(
|
|
11962
|
+
function baseMatchesProperty(path5, srcValue) {
|
|
11963
|
+
if (isKey(path5) && isStrictComparable(srcValue)) {
|
|
11964
|
+
return matchesStrictComparable(toKey(path5), srcValue);
|
|
11966
11965
|
}
|
|
11967
11966
|
return function(object2) {
|
|
11968
|
-
var objValue = get2(object2,
|
|
11969
|
-
return objValue === void 0 && objValue === srcValue ? hasIn(object2,
|
|
11967
|
+
var objValue = get2(object2, path5);
|
|
11968
|
+
return objValue === void 0 && objValue === srcValue ? hasIn(object2, path5) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
|
|
11970
11969
|
};
|
|
11971
11970
|
}
|
|
11972
11971
|
module.exports = baseMatchesProperty;
|
|
@@ -11999,9 +11998,9 @@ var require_baseProperty = __commonJS({
|
|
|
11999
11998
|
var require_basePropertyDeep = __commonJS({
|
|
12000
11999
|
"node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/_basePropertyDeep.js"(exports$1, module) {
|
|
12001
12000
|
var baseGet = require_baseGet();
|
|
12002
|
-
function basePropertyDeep(
|
|
12001
|
+
function basePropertyDeep(path5) {
|
|
12003
12002
|
return function(object2) {
|
|
12004
|
-
return baseGet(object2,
|
|
12003
|
+
return baseGet(object2, path5);
|
|
12005
12004
|
};
|
|
12006
12005
|
}
|
|
12007
12006
|
module.exports = basePropertyDeep;
|
|
@@ -12015,8 +12014,8 @@ var require_property = __commonJS({
|
|
|
12015
12014
|
var basePropertyDeep = require_basePropertyDeep();
|
|
12016
12015
|
var isKey = require_isKey();
|
|
12017
12016
|
var toKey = require_toKey();
|
|
12018
|
-
function property2(
|
|
12019
|
-
return isKey(
|
|
12017
|
+
function property2(path5) {
|
|
12018
|
+
return isKey(path5) ? baseProperty(toKey(path5)) : basePropertyDeep(path5);
|
|
12020
12019
|
}
|
|
12021
12020
|
module.exports = property2;
|
|
12022
12021
|
}
|
|
@@ -13071,8 +13070,8 @@ var require_parent = __commonJS({
|
|
|
13071
13070
|
"node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/_parent.js"(exports$1, module) {
|
|
13072
13071
|
var baseGet = require_baseGet();
|
|
13073
13072
|
var baseSlice = require_baseSlice();
|
|
13074
|
-
function parent2(object2,
|
|
13075
|
-
return
|
|
13073
|
+
function parent2(object2, path5) {
|
|
13074
|
+
return path5.length < 2 ? object2 : baseGet(object2, baseSlice(path5, 0, -1));
|
|
13076
13075
|
}
|
|
13077
13076
|
module.exports = parent2;
|
|
13078
13077
|
}
|
|
@@ -13087,30 +13086,30 @@ var require_baseUnset = __commonJS({
|
|
|
13087
13086
|
var toKey = require_toKey();
|
|
13088
13087
|
var objectProto = Object.prototype;
|
|
13089
13088
|
var hasOwnProperty2 = objectProto.hasOwnProperty;
|
|
13090
|
-
function baseUnset(object2,
|
|
13091
|
-
|
|
13092
|
-
var index2 = -1, length =
|
|
13089
|
+
function baseUnset(object2, path5) {
|
|
13090
|
+
path5 = castPath(path5, object2);
|
|
13091
|
+
var index2 = -1, length = path5.length;
|
|
13093
13092
|
if (!length) {
|
|
13094
13093
|
return true;
|
|
13095
13094
|
}
|
|
13096
13095
|
var isRootPrimitive = object2 == null || typeof object2 !== "object" && typeof object2 !== "function";
|
|
13097
13096
|
while (++index2 < length) {
|
|
13098
|
-
var key =
|
|
13097
|
+
var key = path5[index2];
|
|
13099
13098
|
if (typeof key !== "string") {
|
|
13100
13099
|
continue;
|
|
13101
13100
|
}
|
|
13102
13101
|
if (key === "__proto__" && !hasOwnProperty2.call(object2, "__proto__")) {
|
|
13103
13102
|
return false;
|
|
13104
13103
|
}
|
|
13105
|
-
if (key === "constructor" && index2 + 1 < length && typeof
|
|
13104
|
+
if (key === "constructor" && index2 + 1 < length && typeof path5[index2 + 1] === "string" && path5[index2 + 1] === "prototype") {
|
|
13106
13105
|
if (isRootPrimitive && index2 === 0) {
|
|
13107
13106
|
continue;
|
|
13108
13107
|
}
|
|
13109
13108
|
return false;
|
|
13110
13109
|
}
|
|
13111
13110
|
}
|
|
13112
|
-
var obj = parent2(object2,
|
|
13113
|
-
return obj == null || delete obj[toKey(last2(
|
|
13111
|
+
var obj = parent2(object2, path5);
|
|
13112
|
+
return obj == null || delete obj[toKey(last2(path5))];
|
|
13114
13113
|
}
|
|
13115
13114
|
module.exports = baseUnset;
|
|
13116
13115
|
}
|
|
@@ -13199,10 +13198,10 @@ var require_omit = __commonJS({
|
|
|
13199
13198
|
return result2;
|
|
13200
13199
|
}
|
|
13201
13200
|
var isDeep = false;
|
|
13202
|
-
paths = arrayMap(paths, function(
|
|
13203
|
-
|
|
13204
|
-
isDeep || (isDeep =
|
|
13205
|
-
return
|
|
13201
|
+
paths = arrayMap(paths, function(path5) {
|
|
13202
|
+
path5 = castPath(path5, object2);
|
|
13203
|
+
isDeep || (isDeep = path5.length > 1);
|
|
13204
|
+
return path5;
|
|
13206
13205
|
});
|
|
13207
13206
|
copyObject(object2, getAllKeysIn(object2), result2);
|
|
13208
13207
|
if (isDeep) {
|
|
@@ -14391,8 +14390,8 @@ var require_super_upload = __commonJS({
|
|
|
14391
14390
|
var require_bos_client = __commonJS({
|
|
14392
14391
|
"node_modules/.pnpm/@baiducloud+sdk@1.0.7/node_modules/@baiducloud/sdk/src/bos_client.js"(exports$1, module) {
|
|
14393
14392
|
var util2 = __require("util");
|
|
14394
|
-
var
|
|
14395
|
-
var
|
|
14393
|
+
var path5 = __require("path");
|
|
14394
|
+
var fs4 = __require("fs");
|
|
14396
14395
|
var qs = __require("querystring");
|
|
14397
14396
|
var u = (init_index_all(), __toCommonJS(index_all_exports));
|
|
14398
14397
|
var Q = require_q();
|
|
@@ -14459,8 +14458,8 @@ var require_bos_client = __commonJS({
|
|
|
14459
14458
|
customGenerateUrl: config.customGenerateUrl
|
|
14460
14459
|
});
|
|
14461
14460
|
params = params || {};
|
|
14462
|
-
var resource =
|
|
14463
|
-
|
|
14461
|
+
var resource = path5.normalize(
|
|
14462
|
+
path5.join(
|
|
14464
14463
|
config.removeVersionPrefix ? "/" : "/v1",
|
|
14465
14464
|
!pathStyleEnable ? "" : strings.normalize(bucketName || ""),
|
|
14466
14465
|
strings.normalize(key || "", false)
|
|
@@ -14488,8 +14487,8 @@ var require_bos_client = __commonJS({
|
|
|
14488
14487
|
BosClient.prototype.generateUrl = function(bucketName, key, pipeline, cdn, config) {
|
|
14489
14488
|
config = u.extend({}, this.config, config);
|
|
14490
14489
|
bucketName = config.cname_enabled ? "" : bucketName;
|
|
14491
|
-
var resource =
|
|
14492
|
-
|
|
14490
|
+
var resource = path5.normalize(
|
|
14491
|
+
path5.join(
|
|
14493
14492
|
config.removeVersionPrefix ? "/" : "/v1",
|
|
14494
14493
|
strings.normalize(bucketName || ""),
|
|
14495
14494
|
strings.normalize(key || "", false)
|
|
@@ -14513,9 +14512,9 @@ var require_bos_client = __commonJS({
|
|
|
14513
14512
|
}
|
|
14514
14513
|
if (command) {
|
|
14515
14514
|
if (cdn) {
|
|
14516
|
-
return util2.format("http://%s/%s%s", cdn,
|
|
14515
|
+
return util2.format("http://%s/%s%s", cdn, path5.normalize(key), command);
|
|
14517
14516
|
}
|
|
14518
|
-
return util2.format("http://%s.%s/%s%s",
|
|
14517
|
+
return util2.format("http://%s.%s/%s%s", path5.normalize(bucketName), IMAGE_DOMAIN, path5.normalize(key), command);
|
|
14519
14518
|
}
|
|
14520
14519
|
return util2.format("%s%s%s", this.config.endpoint, resource, command);
|
|
14521
14520
|
};
|
|
@@ -15015,7 +15014,7 @@ var require_bos_client = __commonJS({
|
|
|
15015
15014
|
options = options || {};
|
|
15016
15015
|
var headers = {};
|
|
15017
15016
|
headers[H.CONTENT_LENGTH] = Buffer.byteLength(data);
|
|
15018
|
-
headers[H.CONTENT_TYPE] = options[H.CONTENT_TYPE] || MimeType.guess(
|
|
15017
|
+
headers[H.CONTENT_TYPE] = options[H.CONTENT_TYPE] || MimeType.guess(path5.extname(key));
|
|
15019
15018
|
headers[H.CONTENT_MD5] = crypto3.md5sum(data);
|
|
15020
15019
|
options = u.extend(headers, options);
|
|
15021
15020
|
return this.putObject(bucketName, key, data, options);
|
|
@@ -15023,13 +15022,13 @@ var require_bos_client = __commonJS({
|
|
|
15023
15022
|
BosClient.prototype.putObjectFromFile = function(bucketName, key, filename, options) {
|
|
15024
15023
|
options = options || {};
|
|
15025
15024
|
var headers = {};
|
|
15026
|
-
var fileSize =
|
|
15025
|
+
var fileSize = fs4.statSync(filename).size;
|
|
15027
15026
|
var contentLength = u.has(options, H.CONTENT_LENGTH) ? options[H.CONTENT_LENGTH] : fileSize;
|
|
15028
15027
|
if (contentLength > fileSize) {
|
|
15029
15028
|
throw new Error("options['Content-Length'] should less than " + fileSize);
|
|
15030
15029
|
}
|
|
15031
15030
|
headers[H.CONTENT_LENGTH] = contentLength;
|
|
15032
|
-
headers[H.CONTENT_TYPE] = options[H.CONTENT_TYPE] || MimeType.guess(
|
|
15031
|
+
headers[H.CONTENT_TYPE] = options[H.CONTENT_TYPE] || MimeType.guess(path5.extname(filename));
|
|
15033
15032
|
options = u.extend(headers, options);
|
|
15034
15033
|
var streamOptions = {
|
|
15035
15034
|
start: 0,
|
|
@@ -15037,7 +15036,7 @@ var require_bos_client = __commonJS({
|
|
|
15037
15036
|
};
|
|
15038
15037
|
var me = this;
|
|
15039
15038
|
function putObjectWithRetry(lastRetryTimes) {
|
|
15040
|
-
return me.putObject(bucketName, key,
|
|
15039
|
+
return me.putObject(bucketName, key, fs4.createReadStream(filename, streamOptions), options).catch(function(err) {
|
|
15041
15040
|
var serverTimestamp = new Date(err[H.X_BCE_DATE]).getTime();
|
|
15042
15041
|
BceBaseClient.prototype.timeOffset = serverTimestamp - Date.now();
|
|
15043
15042
|
if (err[H.X_STATUS_CODE] === 400 && err[H.X_CODE] === "Http400" && lastRetryTimes > 0) {
|
|
@@ -15047,7 +15046,7 @@ var require_bos_client = __commonJS({
|
|
|
15047
15046
|
});
|
|
15048
15047
|
}
|
|
15049
15048
|
if (!u.has(options, H.CONTENT_MD5)) {
|
|
15050
|
-
var fp2 =
|
|
15049
|
+
var fp2 = fs4.createReadStream(filename, streamOptions);
|
|
15051
15050
|
return crypto3.md5stream(fp2).then(function(md5sum) {
|
|
15052
15051
|
options[H.CONTENT_MD5] = md5sum;
|
|
15053
15052
|
return putObjectWithRetry(options.retryCount || MAX_RETRY_COUNT);
|
|
@@ -15126,7 +15125,7 @@ var require_bos_client = __commonJS({
|
|
|
15126
15125
|
Range: range3 ? util2.format("bytes=%s", range3) : ""
|
|
15127
15126
|
},
|
|
15128
15127
|
config: options.config,
|
|
15129
|
-
outputStream:
|
|
15128
|
+
outputStream: fs4.createWriteStream(filename)
|
|
15130
15129
|
});
|
|
15131
15130
|
};
|
|
15132
15131
|
BosClient.prototype.copyObject = function(sourceBucketName, sourceKey, targetBucketName, targetKey, options) {
|
|
@@ -15168,7 +15167,7 @@ var require_bos_client = __commonJS({
|
|
|
15168
15167
|
BosClient.prototype.initiateMultipartUpload = function(bucketName, key, options) {
|
|
15169
15168
|
options = options || {};
|
|
15170
15169
|
var headers = {};
|
|
15171
|
-
headers[H.CONTENT_TYPE] = MimeType.guess(
|
|
15170
|
+
headers[H.CONTENT_TYPE] = MimeType.guess(path5.extname(key));
|
|
15172
15171
|
options = this._checkOptions(u.extend(headers, options));
|
|
15173
15172
|
return this.sendRequest("POST", {
|
|
15174
15173
|
bucketName,
|
|
@@ -15203,7 +15202,7 @@ var require_bos_client = __commonJS({
|
|
|
15203
15202
|
BosClient.prototype.uploadPartFromFile = function(bucketName, key, uploadId, partNumber, partSize, filename, offset, options) {
|
|
15204
15203
|
var start = offset;
|
|
15205
15204
|
var end = offset + partSize - 1;
|
|
15206
|
-
var partFp =
|
|
15205
|
+
var partFp = fs4.createReadStream(filename, {
|
|
15207
15206
|
start,
|
|
15208
15207
|
end
|
|
15209
15208
|
});
|
|
@@ -15268,7 +15267,7 @@ var require_bos_client = __commonJS({
|
|
|
15268
15267
|
);
|
|
15269
15268
|
}
|
|
15270
15269
|
var client = this;
|
|
15271
|
-
var clonedPartFp =
|
|
15270
|
+
var clonedPartFp = fs4.createReadStream(partFp.path, {
|
|
15272
15271
|
start: partFp.start,
|
|
15273
15272
|
end: partFp.end
|
|
15274
15273
|
});
|
|
@@ -15382,7 +15381,7 @@ var require_bos_client = __commonJS({
|
|
|
15382
15381
|
options = options || {};
|
|
15383
15382
|
var headers = {};
|
|
15384
15383
|
headers[H.CONTENT_LENGTH] = Buffer.byteLength(data);
|
|
15385
|
-
headers[H.CONTENT_TYPE] = options[H.CONTENT_TYPE] || MimeType.guess(
|
|
15384
|
+
headers[H.CONTENT_TYPE] = options[H.CONTENT_TYPE] || MimeType.guess(path5.extname(key));
|
|
15386
15385
|
headers[H.CONTENT_MD5] = crypto3.md5sum(data);
|
|
15387
15386
|
options = u.extend(headers, options);
|
|
15388
15387
|
return this.appendObject(bucketName, key, data, offset, options);
|
|
@@ -15393,21 +15392,21 @@ var require_bos_client = __commonJS({
|
|
|
15393
15392
|
return this.appendObjectFromString(bucketName, key, "", offset, options);
|
|
15394
15393
|
}
|
|
15395
15394
|
var headers = {};
|
|
15396
|
-
var fileSize =
|
|
15395
|
+
var fileSize = fs4.statSync(filename).size;
|
|
15397
15396
|
if (size2 + offset > fileSize) {
|
|
15398
15397
|
throw new Error("Can't read the content beyond the end of file.");
|
|
15399
15398
|
}
|
|
15400
15399
|
headers[H.CONTENT_LENGTH] = size2;
|
|
15401
|
-
headers[H.CONTENT_TYPE] = options[H.CONTENT_TYPE] || MimeType.guess(
|
|
15400
|
+
headers[H.CONTENT_TYPE] = options[H.CONTENT_TYPE] || MimeType.guess(path5.extname(filename));
|
|
15402
15401
|
options = u.extend(headers, options);
|
|
15403
15402
|
var streamOptions = {
|
|
15404
15403
|
start: offset || 0,
|
|
15405
15404
|
end: (offset || 0) + size2 - 1
|
|
15406
15405
|
};
|
|
15407
|
-
var fp =
|
|
15406
|
+
var fp = fs4.createReadStream(filename, streamOptions);
|
|
15408
15407
|
if (!u.has(options, H.CONTENT_MD5)) {
|
|
15409
15408
|
var me = this;
|
|
15410
|
-
var fp2 =
|
|
15409
|
+
var fp2 = fs4.createReadStream(filename, streamOptions);
|
|
15411
15410
|
return crypto3.md5stream(fp2).then(function(md5sum) {
|
|
15412
15411
|
options[H.CONTENT_MD5] = md5sum;
|
|
15413
15412
|
return me.appendObject(bucketName, key, fp, offset, options);
|
|
@@ -15429,7 +15428,7 @@ var require_bos_client = __commonJS({
|
|
|
15429
15428
|
var boundary = "MM8964" + (Math.random() * Math.pow(2, 63)).toString(36);
|
|
15430
15429
|
var contentType = "multipart/form-data; boundary=" + boundary;
|
|
15431
15430
|
if (u.isString(data)) {
|
|
15432
|
-
data =
|
|
15431
|
+
data = fs4.readFileSync(data);
|
|
15433
15432
|
} else if (!Buffer.isBuffer(data)) {
|
|
15434
15433
|
throw new Error("Invalid data type.");
|
|
15435
15434
|
}
|
|
@@ -15636,7 +15635,7 @@ var require_bos_client = __commonJS({
|
|
|
15636
15635
|
var pathStyleEnable = !!domainUtils.isIpHost(endpoint) || this.config.pathStyleEnable;
|
|
15637
15636
|
if (typeof customGenerateUrl === "function") {
|
|
15638
15637
|
endpoint = customGenerateUrl(bucketName, region);
|
|
15639
|
-
var resource = requestUrl ||
|
|
15638
|
+
var resource = requestUrl || path5.normalize(path5.join(versionPrefix, strings.normalize(varArgs.key || "", false))).replace(/\\/g, "/");
|
|
15640
15639
|
} else {
|
|
15641
15640
|
endpoint = domainUtils.handleEndpoint({
|
|
15642
15641
|
bucketName,
|
|
@@ -15646,8 +15645,8 @@ var require_bos_client = __commonJS({
|
|
|
15646
15645
|
cname_enabled: this.config.cname_enabled,
|
|
15647
15646
|
pathStyleEnable
|
|
15648
15647
|
});
|
|
15649
|
-
var resource = requestUrl ||
|
|
15650
|
-
|
|
15648
|
+
var resource = requestUrl || path5.normalize(
|
|
15649
|
+
path5.join(
|
|
15651
15650
|
"/" ,
|
|
15652
15651
|
// if pathStyleEnable is true
|
|
15653
15652
|
!pathStyleEnable ? "" : strings.normalize(varArgs.bucketName || ""),
|
|
@@ -15853,11 +15852,11 @@ var require_bos_client = __commonJS({
|
|
|
15853
15852
|
params = params || {};
|
|
15854
15853
|
const { objectName, data } = params;
|
|
15855
15854
|
const MAX_UPLOAD_FILE_SIZE = 48.8 * 1024 ** 4;
|
|
15856
|
-
const ContentType = params.ContentType || MimeType.guess(
|
|
15855
|
+
const ContentType = params.ContentType || MimeType.guess(path5.extname(objectName));
|
|
15857
15856
|
let ContentLength = params.ContentLength;
|
|
15858
15857
|
let dataType = "";
|
|
15859
15858
|
if (typeof data === "string") {
|
|
15860
|
-
ContentLength =
|
|
15859
|
+
ContentLength = fs4.lstatSync(data).size;
|
|
15861
15860
|
dataType = "File";
|
|
15862
15861
|
} else if (Buffer.isBuffer(data)) {
|
|
15863
15862
|
ContentLength = data.length;
|
|
@@ -15991,8 +15990,8 @@ var require_bcs_client = __commonJS({
|
|
|
15991
15990
|
"node_modules/.pnpm/@baiducloud+sdk@1.0.7/node_modules/@baiducloud/sdk/src/bcs_client.js"(exports$1, module) {
|
|
15992
15991
|
var crypto3 = __require("crypto");
|
|
15993
15992
|
var util2 = __require("util");
|
|
15994
|
-
var
|
|
15995
|
-
var
|
|
15993
|
+
var path5 = __require("path");
|
|
15994
|
+
var fs4 = __require("fs");
|
|
15996
15995
|
var u = (init_index_all(), __toCommonJS(index_all_exports));
|
|
15997
15996
|
var H = require_headers();
|
|
15998
15997
|
var HttpClient = require_http_client();
|
|
@@ -16107,10 +16106,10 @@ var require_bcs_client = __commonJS({
|
|
|
16107
16106
|
BcsClient.prototype.putObjectFromFile = function(bucketName, key, filename, options) {
|
|
16108
16107
|
options = options || {};
|
|
16109
16108
|
var headers = {};
|
|
16110
|
-
headers[H.CONTENT_LENGTH] =
|
|
16111
|
-
headers[H.CONTENT_TYPE] = options[H.CONTENT_TYPE] || MimeType.guess(
|
|
16109
|
+
headers[H.CONTENT_LENGTH] = fs4.statSync(filename).size;
|
|
16110
|
+
headers[H.CONTENT_TYPE] = options[H.CONTENT_TYPE] || MimeType.guess(path5.extname(filename));
|
|
16112
16111
|
options = u.extend(headers, options);
|
|
16113
|
-
var fp =
|
|
16112
|
+
var fp = fs4.createReadStream(filename);
|
|
16114
16113
|
if (!u.has(options, H.CONTENT_MD5)) {
|
|
16115
16114
|
var me = this;
|
|
16116
16115
|
return require_crypto().md5file(filename, "hex").then(function(md5sum) {
|
|
@@ -16358,8 +16357,8 @@ var require_bcc_client = __commonJS({
|
|
|
16358
16357
|
// node_modules/.pnpm/@baiducloud+sdk@1.0.7/node_modules/@baiducloud/sdk/src/ses_client.js
|
|
16359
16358
|
var require_ses_client = __commonJS({
|
|
16360
16359
|
"node_modules/.pnpm/@baiducloud+sdk@1.0.7/node_modules/@baiducloud/sdk/src/ses_client.js"(exports$1, module) {
|
|
16361
|
-
var
|
|
16362
|
-
var
|
|
16360
|
+
var fs4 = __require("fs");
|
|
16361
|
+
var path5 = __require("path");
|
|
16363
16362
|
var util2 = __require("util");
|
|
16364
16363
|
var BceBaseClient = require_bce_base_client();
|
|
16365
16364
|
function SesClient(config) {
|
|
@@ -16425,9 +16424,9 @@ var require_ses_client = __commonJS({
|
|
|
16425
16424
|
if (typeof item === "string") {
|
|
16426
16425
|
return {
|
|
16427
16426
|
/* eslint-disable */
|
|
16428
|
-
file_name:
|
|
16427
|
+
file_name: path5.basename(item),
|
|
16429
16428
|
file_data: {
|
|
16430
|
-
data:
|
|
16429
|
+
data: fs4.readFileSync(item).toString("base64")
|
|
16431
16430
|
}
|
|
16432
16431
|
/* eslint-enable */
|
|
16433
16432
|
};
|
|
@@ -17446,10 +17445,10 @@ var require_media_client = __commonJS({
|
|
|
17446
17445
|
var url = "/v3/statistic/job/realtime";
|
|
17447
17446
|
return this.sendRequest("GET", url);
|
|
17448
17447
|
};
|
|
17449
|
-
MediaClient.prototype.createSignature = function(credentials, httpMethod,
|
|
17448
|
+
MediaClient.prototype.createSignature = function(credentials, httpMethod, path5, params, headers) {
|
|
17450
17449
|
var auth = new Auth(credentials.ak, credentials.sk);
|
|
17451
17450
|
var headersToSign = ["host"];
|
|
17452
|
-
return auth.generateAuthorization(httpMethod,
|
|
17451
|
+
return auth.generateAuthorization(httpMethod, path5, params, headers, 0, 0, headersToSign);
|
|
17453
17452
|
};
|
|
17454
17453
|
MediaClient.prototype.sendRequest = function(httpMethod, resource, varArgs) {
|
|
17455
17454
|
var defaultArgs = {
|
|
@@ -17959,8 +17958,8 @@ var require_vod_client = __commonJS({
|
|
|
17959
17958
|
// node_modules/.pnpm/@baiducloud+sdk@1.0.7/node_modules/@baiducloud/sdk/src/doc_client.js
|
|
17960
17959
|
var require_doc_client = __commonJS({
|
|
17961
17960
|
"node_modules/.pnpm/@baiducloud+sdk@1.0.7/node_modules/@baiducloud/sdk/src/doc_client.js"(exports$1) {
|
|
17962
|
-
var
|
|
17963
|
-
var
|
|
17961
|
+
var fs4 = __require("fs");
|
|
17962
|
+
var path5 = __require("path");
|
|
17964
17963
|
var util2 = __require("util");
|
|
17965
17964
|
var builtinUrl = __require("url");
|
|
17966
17965
|
var Q = require_q();
|
|
@@ -18004,8 +18003,8 @@ var require_doc_client = __commonJS({
|
|
|
18004
18003
|
var bucket = parsed.host;
|
|
18005
18004
|
var object2 = parsed.pathname.substr(1);
|
|
18006
18005
|
options = u.extend(options, parsed.query);
|
|
18007
|
-
var title = options.title ||
|
|
18008
|
-
var format = options.format ||
|
|
18006
|
+
var title = options.title || path5.basename(object2);
|
|
18007
|
+
var format = options.format || path5.extname(object2).substr(1);
|
|
18009
18008
|
var notification = options.notification;
|
|
18010
18009
|
return this.createFromBos(
|
|
18011
18010
|
bucket,
|
|
@@ -18019,8 +18018,8 @@ var require_doc_client = __commonJS({
|
|
|
18019
18018
|
}
|
|
18020
18019
|
}
|
|
18021
18020
|
dataType = DATA_TYPE_FILE;
|
|
18022
|
-
options.format = options.format ||
|
|
18023
|
-
options.title = options.title ||
|
|
18021
|
+
options.format = options.format || path5.extname(data).substr(1);
|
|
18022
|
+
options.title = options.title || path5.basename(data, path5.extname(data));
|
|
18024
18023
|
} else if (Buffer.isBuffer(data)) {
|
|
18025
18024
|
if (options.format == null || options.title == null) {
|
|
18026
18025
|
return Q.reject(new Error("buffer type required options.format and options.title"));
|
|
@@ -18028,8 +18027,8 @@ var require_doc_client = __commonJS({
|
|
|
18028
18027
|
dataType = DATA_TYPE_BUFFER;
|
|
18029
18028
|
} else if (typeof Blob !== "undefined" && data instanceof Blob) {
|
|
18030
18029
|
dataType = DATA_TYPE_BLOB;
|
|
18031
|
-
options.format = options.format ||
|
|
18032
|
-
options.title = options.title ||
|
|
18030
|
+
options.format = options.format || path5.extname(data.name).substr(1);
|
|
18031
|
+
options.title = options.title || path5.basename(data.name, path5.extname(data.name));
|
|
18033
18032
|
} else {
|
|
18034
18033
|
return Q.reject(new Error("Unsupported dataType."));
|
|
18035
18034
|
}
|
|
@@ -18041,7 +18040,7 @@ var require_doc_client = __commonJS({
|
|
|
18041
18040
|
}
|
|
18042
18041
|
var self2 = this;
|
|
18043
18042
|
if (dataType === DATA_TYPE_FILE) {
|
|
18044
|
-
return crypto3.md5stream(
|
|
18043
|
+
return crypto3.md5stream(fs4.createReadStream(data), "hex").then(function(md5) {
|
|
18045
18044
|
options.meta.md5 = md5;
|
|
18046
18045
|
return self2._doCreate(data, options);
|
|
18047
18046
|
});
|
|
@@ -18124,7 +18123,7 @@ var require_doc_client = __commonJS({
|
|
|
18124
18123
|
object: object2,
|
|
18125
18124
|
title
|
|
18126
18125
|
};
|
|
18127
|
-
var format = opt_format ||
|
|
18126
|
+
var format = opt_format || path5.extname(object2).substr(1);
|
|
18128
18127
|
if (!format) {
|
|
18129
18128
|
throw new Error("Document format parameter required");
|
|
18130
18129
|
}
|
|
@@ -18364,10 +18363,10 @@ var require_tsdb_data_client = __commonJS({
|
|
|
18364
18363
|
params.authorization = authorization;
|
|
18365
18364
|
return util2.format("%s%s?%s", config.endpoint, resource, qs.encode(params));
|
|
18366
18365
|
};
|
|
18367
|
-
TsdbDataClient.prototype.createSignature = function(credentials, httpMethod,
|
|
18366
|
+
TsdbDataClient.prototype.createSignature = function(credentials, httpMethod, path5, params, headers) {
|
|
18368
18367
|
var auth = new Auth(credentials.ak, credentials.sk);
|
|
18369
18368
|
var headersToSign = ["host"];
|
|
18370
|
-
return auth.generateAuthorization(httpMethod,
|
|
18369
|
+
return auth.generateAuthorization(httpMethod, path5, params, headers, 0, 0, headersToSign);
|
|
18371
18370
|
};
|
|
18372
18371
|
TsdbDataClient.prototype.sendRequest = function(httpMethod, resource, varArgs) {
|
|
18373
18372
|
var defaultArgs = {
|
|
@@ -22688,7 +22687,7 @@ var require_bts_client = __commonJS({
|
|
|
22688
22687
|
var require_iot_client = __commonJS({
|
|
22689
22688
|
"node_modules/.pnpm/@baiducloud+sdk@1.0.7/node_modules/@baiducloud/sdk/src/iot_client.js"(exports$1, module) {
|
|
22690
22689
|
var util2 = __require("util");
|
|
22691
|
-
var
|
|
22690
|
+
var path5 = __require("path");
|
|
22692
22691
|
var u = (init_index_all(), __toCommonJS(index_all_exports));
|
|
22693
22692
|
var strings = require_strings();
|
|
22694
22693
|
var BceBaseClient = require_bce_base_client();
|
|
@@ -22750,7 +22749,7 @@ var require_iot_client = __commonJS({
|
|
|
22750
22749
|
};
|
|
22751
22750
|
IoTClient.prototype._buildUrl = function() {
|
|
22752
22751
|
var extraPaths = u.toArray(arguments);
|
|
22753
|
-
return
|
|
22752
|
+
return path5.normalize(extraPaths.join("/")).replace(/\\/g, "/");
|
|
22754
22753
|
};
|
|
22755
22754
|
module.exports = IoTClient;
|
|
22756
22755
|
}
|
|
@@ -22845,17 +22844,63 @@ function redactValue(value, opts) {
|
|
|
22845
22844
|
}
|
|
22846
22845
|
return `${value.slice(0, keepStart)}***${value.slice(-keepEnd)}`;
|
|
22847
22846
|
}
|
|
22848
|
-
function
|
|
22849
|
-
const
|
|
22850
|
-
|
|
22851
|
-
|
|
22852
|
-
encoding: "utf8",
|
|
22853
|
-
timeout: 15e3
|
|
22854
|
-
});
|
|
22855
|
-
if (result2.status !== 0) {
|
|
22856
|
-
const stderr = (result2.stderr ?? "").trim();
|
|
22857
|
-
throw new Error(`openclaw config set failed: ${stderr || `exit code ${result2.status}`}`);
|
|
22847
|
+
function resolveOpenclawConfigPath() {
|
|
22848
|
+
const override = process.env["OPENCLAW_CONFIG_PATH"]?.trim();
|
|
22849
|
+
if (override) {
|
|
22850
|
+
return override;
|
|
22858
22851
|
}
|
|
22852
|
+
const stateDir = process.env["OPENCLAW_STATE_DIR"]?.trim() ?? path2.join(os.homedir(), ".openclaw");
|
|
22853
|
+
return path2.join(stateDir, "openclaw.json");
|
|
22854
|
+
}
|
|
22855
|
+
function readOpenclawConfig(configPath) {
|
|
22856
|
+
try {
|
|
22857
|
+
const raw = fs.readFileSync(configPath, "utf8");
|
|
22858
|
+
const parsed = JSON.parse(raw);
|
|
22859
|
+
if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
22860
|
+
return parsed;
|
|
22861
|
+
}
|
|
22862
|
+
return {};
|
|
22863
|
+
} catch (err) {
|
|
22864
|
+
if (err instanceof Error && "code" in err && err.code === "ENOENT") {
|
|
22865
|
+
return {};
|
|
22866
|
+
}
|
|
22867
|
+
throw err;
|
|
22868
|
+
}
|
|
22869
|
+
}
|
|
22870
|
+
function writeOpenclawConfig(configPath, config) {
|
|
22871
|
+
const dir2 = path2.dirname(configPath);
|
|
22872
|
+
fs.mkdirSync(dir2, { recursive: true });
|
|
22873
|
+
const tmpPath = `${configPath}.tmp.${process.pid}`;
|
|
22874
|
+
const content = `${JSON.stringify(config, null, 2)}
|
|
22875
|
+
`;
|
|
22876
|
+
fs.writeFileSync(tmpPath, content, "utf8");
|
|
22877
|
+
fs.renameSync(tmpPath, configPath);
|
|
22878
|
+
}
|
|
22879
|
+
function setAccountConfig(params) {
|
|
22880
|
+
const config = readOpenclawConfig(params.configPath);
|
|
22881
|
+
const channels = config["channels"] !== null && typeof config["channels"] === "object" && !Array.isArray(config["channels"]) ? config["channels"] : {};
|
|
22882
|
+
const channelKey = "openclaw-baiduapp";
|
|
22883
|
+
const channelConfig = channels[channelKey] !== null && typeof channels[channelKey] === "object" && !Array.isArray(channels[channelKey]) ? channels[channelKey] : {};
|
|
22884
|
+
const accounts = channelConfig["accounts"] !== null && typeof channelConfig["accounts"] === "object" && !Array.isArray(channelConfig["accounts"]) ? channelConfig["accounts"] : {};
|
|
22885
|
+
const existingAccount = accounts[params.accountId] !== null && typeof accounts[params.accountId] === "object" && !Array.isArray(accounts[params.accountId]) ? accounts[params.accountId] : {};
|
|
22886
|
+
writeOpenclawConfig(params.configPath, {
|
|
22887
|
+
...config,
|
|
22888
|
+
channels: {
|
|
22889
|
+
...channels,
|
|
22890
|
+
[channelKey]: {
|
|
22891
|
+
...channelConfig,
|
|
22892
|
+
accounts: {
|
|
22893
|
+
...accounts,
|
|
22894
|
+
[params.accountId]: {
|
|
22895
|
+
...existingAccount,
|
|
22896
|
+
appKey: params.appKey,
|
|
22897
|
+
appSecret: params.appSecret,
|
|
22898
|
+
enabled: true
|
|
22899
|
+
}
|
|
22900
|
+
}
|
|
22901
|
+
}
|
|
22902
|
+
}
|
|
22903
|
+
});
|
|
22859
22904
|
}
|
|
22860
22905
|
async function loginBaiduApp(params) {
|
|
22861
22906
|
void params.cfg;
|
|
@@ -22874,13 +22919,12 @@ async function loginBaiduApp(params) {
|
|
|
22874
22919
|
}
|
|
22875
22920
|
const appKey = await prompter.text("App Key", { required: true });
|
|
22876
22921
|
const appSecret = await prompter.text("App Secret", { required: true });
|
|
22877
|
-
const
|
|
22878
|
-
|
|
22879
|
-
setConfigValue(`${accountKeyPrefix}.appSecret`, appSecret);
|
|
22880
|
-
setConfigValue(`${accountKeyPrefix}.enabled`, true);
|
|
22922
|
+
const configPath = resolveOpenclawConfigPath();
|
|
22923
|
+
setAccountConfig({ configPath, accountId: agentId, appKey, appSecret });
|
|
22881
22924
|
params.runtime.log(`\u2705 openclaw-baiduapp \u5DF2\u5B8C\u6210\u914D\u7F6E\uFF08account: ${agentId}\uFF09`);
|
|
22882
22925
|
params.runtime.log(`- appKey: ${redactValue(appKey, { keepStart: 3, keepEnd: 3 })}`);
|
|
22883
22926
|
params.runtime.log(`- appSecret: ${redactValue(appSecret, { keepStart: 3, keepEnd: 3 })}`);
|
|
22927
|
+
params.runtime.log(`- \u914D\u7F6E\u5DF2\u5199\u5165: ${configPath}`);
|
|
22884
22928
|
} catch (error) {
|
|
22885
22929
|
const message = error instanceof Error ? error.message : String(error);
|
|
22886
22930
|
params.runtime.error(`openclaw-baiduapp \u767B\u5F55\u914D\u7F6E\u5931\u8D25\uFF1A${message}`);
|
|
@@ -23372,8 +23416,8 @@ function getErrorMap() {
|
|
|
23372
23416
|
|
|
23373
23417
|
// node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js
|
|
23374
23418
|
var makeIssue = (params) => {
|
|
23375
|
-
const { data, path:
|
|
23376
|
-
const fullPath = [...
|
|
23419
|
+
const { data, path: path5, errorMaps, issueData } = params;
|
|
23420
|
+
const fullPath = [...path5, ...issueData.path || []];
|
|
23377
23421
|
const fullIssue = {
|
|
23378
23422
|
...issueData,
|
|
23379
23423
|
path: fullPath
|
|
@@ -23489,11 +23533,11 @@ var errorUtil;
|
|
|
23489
23533
|
|
|
23490
23534
|
// node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js
|
|
23491
23535
|
var ParseInputLazyPath = class {
|
|
23492
|
-
constructor(parent2, value,
|
|
23536
|
+
constructor(parent2, value, path5, key) {
|
|
23493
23537
|
this._cachedPath = [];
|
|
23494
23538
|
this.parent = parent2;
|
|
23495
23539
|
this.data = value;
|
|
23496
|
-
this._path =
|
|
23540
|
+
this._path = path5;
|
|
23497
23541
|
this._key = key;
|
|
23498
23542
|
}
|
|
23499
23543
|
get path() {
|
|
@@ -26941,7 +26985,6 @@ var DEFAULT_API_BASE = "https://claw.baidu.com";
|
|
|
26941
26985
|
var BaiduAppAccountSchema = external_exports.object({
|
|
26942
26986
|
name: external_exports.string().optional(),
|
|
26943
26987
|
enabled: external_exports.boolean().optional(),
|
|
26944
|
-
pollingEnabled: external_exports.boolean().optional(),
|
|
26945
26988
|
webhookPath: external_exports.string().optional(),
|
|
26946
26989
|
appKey: external_exports.string().optional(),
|
|
26947
26990
|
appSecret: external_exports.string().optional(),
|
|
@@ -26959,7 +27002,6 @@ var BaiduAppConfigJsonSchema = {
|
|
|
26959
27002
|
properties: {
|
|
26960
27003
|
name: { type: "string" },
|
|
26961
27004
|
enabled: { type: "boolean" },
|
|
26962
|
-
pollingEnabled: { type: "boolean" },
|
|
26963
27005
|
webhookPath: { type: "string" },
|
|
26964
27006
|
appKey: { type: "string" },
|
|
26965
27007
|
appSecret: { type: "string" },
|
|
@@ -26974,7 +27016,6 @@ var BaiduAppConfigJsonSchema = {
|
|
|
26974
27016
|
properties: {
|
|
26975
27017
|
name: { type: "string" },
|
|
26976
27018
|
enabled: { type: "boolean" },
|
|
26977
|
-
pollingEnabled: { type: "boolean" },
|
|
26978
27019
|
webhookPath: { type: "string" },
|
|
26979
27020
|
appKey: { type: "string" },
|
|
26980
27021
|
appSecret: { type: "string" },
|
|
@@ -28349,8 +28390,8 @@ function registerBaiduAppWebhookTarget(target) {
|
|
|
28349
28390
|
};
|
|
28350
28391
|
}
|
|
28351
28392
|
async function handleBaiduAppWebhookRequest(req, res) {
|
|
28352
|
-
const
|
|
28353
|
-
const targets = webhookTargets.get(
|
|
28393
|
+
const path5 = resolvePath(req);
|
|
28394
|
+
const targets = webhookTargets.get(path5);
|
|
28354
28395
|
if (!targets || targets.length === 0) {
|
|
28355
28396
|
return false;
|
|
28356
28397
|
}
|
|
@@ -28474,14 +28515,12 @@ function parseTextAndFilesFromList(list) {
|
|
|
28474
28515
|
return { content, files };
|
|
28475
28516
|
}
|
|
28476
28517
|
async function dispatchPendingPollingMessages(data, target) {
|
|
28477
|
-
console.log(data);
|
|
28478
28518
|
if (!target || data.length === 0) {
|
|
28479
28519
|
return;
|
|
28480
28520
|
}
|
|
28481
28521
|
for (const item of data) {
|
|
28482
28522
|
const list = Array.isArray(item.list) ? item.list : [];
|
|
28483
28523
|
const { content, files } = parseTextAndFilesFromList(list);
|
|
28484
|
-
console.log({ content, files });
|
|
28485
28524
|
if (typeof content !== "string" && files.length === 0) {
|
|
28486
28525
|
continue;
|
|
28487
28526
|
}
|
|
@@ -28569,7 +28608,6 @@ async function pollBaiduAppChatlistOnce(account, loggerOptions, requestOptions)
|
|
|
28569
28608
|
version: PLUGIN_VERSION
|
|
28570
28609
|
};
|
|
28571
28610
|
const body = JSON.stringify(payload);
|
|
28572
|
-
console.log("start poll", url);
|
|
28573
28611
|
const requestSignal = createAbortSignalController({
|
|
28574
28612
|
signal: requestOptions?.signal,
|
|
28575
28613
|
timeoutMs: requestOptions?.timeoutMs
|
|
@@ -29159,7 +29197,7 @@ var baiduAppPlugin = {
|
|
|
29159
29197
|
ctx.setStatus?.({ accountId: ctx.accountId, running: false, configured: false });
|
|
29160
29198
|
return;
|
|
29161
29199
|
}
|
|
29162
|
-
const
|
|
29200
|
+
const path5 = (account.config.webhookPath ?? "/openclaw-baiduapp").trim();
|
|
29163
29201
|
const runtime2 = {
|
|
29164
29202
|
log: ctx.log?.info ?? console.log,
|
|
29165
29203
|
error: ctx.log?.error ?? console.error
|
|
@@ -29168,7 +29206,7 @@ var baiduAppPlugin = {
|
|
|
29168
29206
|
account,
|
|
29169
29207
|
config: ctx.cfg ?? {},
|
|
29170
29208
|
runtime: runtime2,
|
|
29171
|
-
path:
|
|
29209
|
+
path: path5,
|
|
29172
29210
|
statusSink: (patch) => ctx.setStatus?.({ accountId: ctx.accountId, ...patch })
|
|
29173
29211
|
});
|
|
29174
29212
|
try {
|
|
@@ -29195,14 +29233,14 @@ var baiduAppPlugin = {
|
|
|
29195
29233
|
}
|
|
29196
29234
|
});
|
|
29197
29235
|
ctx.log?.info(
|
|
29198
|
-
`[openclaw-baiduapp] webhook registered at ${
|
|
29236
|
+
`[openclaw-baiduapp] webhook registered at ${path5} for account ${ctx.accountId} (canSendActive=${account.canSendActive})`
|
|
29199
29237
|
);
|
|
29200
29238
|
ctx.setStatus?.({
|
|
29201
29239
|
accountId: ctx.accountId,
|
|
29202
29240
|
running: true,
|
|
29203
29241
|
configured: true,
|
|
29204
29242
|
canSendActive: account.canSendActive,
|
|
29205
|
-
webhookPath:
|
|
29243
|
+
webhookPath: path5,
|
|
29206
29244
|
lastStartAt: Date.now()
|
|
29207
29245
|
});
|
|
29208
29246
|
if (ctx.abortSignal) {
|