@h-ai/reach 1.0.0-beta.13 → 1.0.0-beta.14
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 +3 -2
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -308,6 +308,7 @@ var HaiReachError = core.error.buildHaiErrorsDef("reach", ReachErrorInfo);
|
|
|
308
308
|
// src/providers/reach-provider-aliyun-sms.ts
|
|
309
309
|
var logger = core.logger.child({ module: "reach", scope: "provider-aliyun-sms" });
|
|
310
310
|
var ISO_MILLISECONDS_SUFFIX_REGEX = /\.\d{3}Z$/;
|
|
311
|
+
var RFC3986_RESERVED_CHARACTERS_REGEX = /[!'()*]/g;
|
|
311
312
|
function toReachError(error) {
|
|
312
313
|
return {
|
|
313
314
|
code: HaiReachError.SEND_FAILED.code,
|
|
@@ -318,7 +319,7 @@ function toReachError(error) {
|
|
|
318
319
|
};
|
|
319
320
|
}
|
|
320
321
|
function percentEncode(str) {
|
|
321
|
-
return encodeURIComponent(str).replace(
|
|
322
|
+
return encodeURIComponent(str).replace(RFC3986_RESERVED_CHARACTERS_REGEX, (char) => `%${char.charCodeAt(0).toString(16).toUpperCase()}`);
|
|
322
323
|
}
|
|
323
324
|
function signRequest(params, accessKeySecret, method) {
|
|
324
325
|
const sortedKeys = Object.keys(params).sort();
|
|
@@ -383,7 +384,7 @@ function createAliyunSmsProvider() {
|
|
|
383
384
|
const response = await fetch(url);
|
|
384
385
|
const body = await response.json();
|
|
385
386
|
if (body.Code !== "OK") {
|
|
386
|
-
logger.warn("SMS send returned non-OK status", { code: body.Code
|
|
387
|
+
logger.warn("SMS send returned non-OK status", { code: body.Code });
|
|
387
388
|
return err(
|
|
388
389
|
HaiReachError.SEND_FAILED,
|
|
389
390
|
reachM("reach_smsSendFailed", { params: { error: body.Message } })
|