@certd/lib-huawei 1.31.8 → 1.31.9

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/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.31.9](https://github.com/certd/certd/compare/v1.31.8...v1.31.9) (2025-03-28)
7
+
8
+ ### Bug Fixes
9
+
10
+ * 修复华为云dns接口请求出错的bug ([caa15b4](https://github.com/certd/certd/commit/caa15b47355363cbb8847f415ff12363cd53eeda))
11
+
6
12
  ## [1.31.8](https://github.com/certd/certd/compare/v1.31.7...v1.31.8) (2025-03-26)
7
13
 
8
14
  **Note:** Version bump only for package @certd/lib-huawei
package/dist/bundle.js CHANGED
@@ -1 +1 @@
1
- "use strict";var t=require("crypto"),e=require("axios");function s(e){return t.createHash("SHA256").update(e).digest().toString("hex")}const n="SDK-HMAC-SHA256",r="X-Sdk-Date",o=new Array(256);for(let t=0;t<256;++t)o[t]="%"+((t<16?"0":"")+t.toString(16)).toUpperCase();const i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,0];function c(t){"string"!=typeof t&&("object"==typeof t?t=String(t):t+="");let e="",s=0;for(let n=0;n<t.length;++n){let r=t.charCodeAt(n);if(r<128){if(1===i[r])continue;s<n&&(e+=t.slice(s,n)),s=n+1,e+=o[r];continue}if(s<n&&(e+=t.slice(s,n)),r<2048){s=n+1,e+=o[192|r>>6]+o[128|63&r];continue}if(r<55296||r>=57344){s=n+1,e+=o[224|r>>12]+o[128|r>>6&63]+o[128|63&r];continue}if(++n,n>=t.length)throw new Error("ERR_INVALID_URI");s=n+1,r=65536+((1023&r)<<10|1023&t.charCodeAt(n)),e+=o[240|r>>18]+o[128|r>>12&63]+o[128|r>>6&63]+o[128|63&r]}return 0===s?t:s<t.length?e+t.slice(s):e}function u(t,e){for(const s in t.headers)if(s.toLowerCase()===e.toLowerCase())return t.headers[s];return null}function h(t,e){let n=u(t,"x-sdk-content-sha256");if(null===n){const e=function(t){return t.body}(t);n=s(e)}return t.method+"\n"+function(t){const e=t.uri.split("/"),s=[];for(const t in e){const n=e[t];s.push(c(n))}let n=s.join("/");"/"!==n[n.length-1]&&(n+="/");return n}(t)+"\n"+a(t)+"\n"+function(t,e){const s={};for(const e in t.headers)s[e.toLowerCase()]=t.headers[e];const n=[];for(const t in e){const r=s[e[t]];n.push(e[t]+":"+r.trim())}return n.join("\n")+"\n"}(t,e)+"\n"+e.join(";")+"\n"+n}function a(t){const e=[];for(const s in t.query)e.push(s);e.sort();const s=[];for(const n in e){const r=c(e[n]),o=t.query[e[n]];if(Array.isArray(o)){o.sort();for(const t in o)s.push(r+"="+c(o[t]))}else s.push(r+"="+c(o))}return s.join("&")}function d(e,s){return n=s,r=e,t.createHmac("SHA256",n).update(r).digest().toString("hex");var n,r}function f(t){return t>=10?""+t:"0"+t}class l{method="";host="";uri="";query={};headers={};body="";constructor(t,e,s,n){if(this.method=void 0===t?"":t,void 0===e)this.host="",this.uri="",this.query={};else{let t,s;this.query={};let n=e.indexOf("://");if(-1!==n&&(e=e.substr(n+3)),n=e.indexOf("?"),-1!==n){const t=e.substr(n+1);e=e.substr(0,n);const s=t.split("&");for(const t in s){const e=s[t],n=e.indexOf("=");let r,o;n>=0?(r=e.substr(0,n),o=e.substr(n+1)):(r=e,o=""),""!==r&&(r=decodeURI(r),o=decodeURI(o),void 0===this.query[r]?this.query[r]=[o]:this.query[r].push(o))}}n=e.indexOf("/"),-1===n?(t=e,s="/"):(t=e.substr(0,n),s=e.substr(n)),this.host=t,this.uri=decodeURI(s)}this.headers=void 0===s?{}:s,this.body=void 0===n?"":n}}class y{Key="";Secret="";constructor(t,e){this.Key=t,this.Secret=e}Sign(t){let e=u(t,r);null===e&&(e=function(){const t=new Date;return""+t.getUTCFullYear()+f(t.getUTCMonth()+1)+f(t.getUTCDate())+"T"+f(t.getUTCHours())+f(t.getUTCMinutes())+f(t.getUTCSeconds())+"Z"}(),t.headers[r]=e),"PUT"!==t.method&&"PATCH"!==t.method&&"POST"!==t.method&&(t.body="");let o=a(t);""!==o&&(o="?"+o);const i={hostname:t.host,path:encodeURI(t.uri)+o,method:t.method,headers:t.headers};null===u(t,"host")&&(t.headers.host=t.host);const c=function(t){const e=[];for(const s in t.headers)e.push(s.toLowerCase());return e.sort(),e}(t),l=function(t,e){const r=s(t);return n+"\n"+e+"\n"+r}(h(t,c),e),y=d(l,this.Secret);return i.headers.Authorization=function(t,e,s){return n+" Access="+e+", SignedHeaders="+s.join(";")+", Signature="+t}(y,this.Key,c),i}}exports.HuaweiYunClient=class{access;constructor(t,e){this.access=t}async request(t){const s=new y(this.access.accessKeyId,this.access.accessKeySecret);let n;t.data&&(n=JSON.stringify(t.data));const r=new l(t.method,t.url,t.headers,n);r.headers={"Content-Type":"application/json"};const o=s.Sign(r);try{return(await e.request({url:t.url,method:t.method,headers:o.headers,data:n})).data}catch(t){this.logger.error("华为云接口请求出错:",t?.response?.data);const e=new Error(t?.response?.data.message);throw e.code=t?.response?.code,e}}};
1
+ "use strict";var t=require("crypto"),e=require("axios");function s(e){return t.createHash("SHA256").update(e).digest().toString("hex")}const n="SDK-HMAC-SHA256",r="X-Sdk-Date",o=new Array(256);for(let t=0;t<256;++t)o[t]="%"+((t<16?"0":"")+t.toString(16)).toUpperCase();const i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,0];function c(t){"string"!=typeof t&&("object"==typeof t?t=String(t):t+="");let e="",s=0;for(let n=0;n<t.length;++n){let r=t.charCodeAt(n);if(r<128){if(1===i[r])continue;s<n&&(e+=t.slice(s,n)),s=n+1,e+=o[r];continue}if(s<n&&(e+=t.slice(s,n)),r<2048){s=n+1,e+=o[192|r>>6]+o[128|63&r];continue}if(r<55296||r>=57344){s=n+1,e+=o[224|r>>12]+o[128|r>>6&63]+o[128|63&r];continue}if(++n,n>=t.length)throw new Error("ERR_INVALID_URI");s=n+1,r=65536+((1023&r)<<10|1023&t.charCodeAt(n)),e+=o[240|r>>18]+o[128|r>>12&63]+o[128|r>>6&63]+o[128|63&r]}return 0===s?t:s<t.length?e+t.slice(s):e}function u(t,e){for(const s in t.headers)if(s.toLowerCase()===e.toLowerCase())return t.headers[s];return null}function h(t,e){let n=u(t,"x-sdk-content-sha256");if(null===n){const e=function(t){return t.body}(t);n=s(e)}return t.method+"\n"+function(t){const e=t.uri.split("/"),s=[];for(const t in e){const n=e[t];s.push(c(n))}let n=s.join("/");"/"!==n[n.length-1]&&(n+="/");return n}(t)+"\n"+a(t)+"\n"+function(t,e){const s={};for(const e in t.headers)s[e.toLowerCase()]=t.headers[e];const n=[];for(const t in e){const r=s[e[t]];n.push(e[t]+":"+r.trim())}return n.join("\n")+"\n"}(t,e)+"\n"+e.join(";")+"\n"+n}function a(t){const e=[];for(const s in t.query)e.push(s);e.sort();const s=[];for(const n in e){const r=c(e[n]),o=t.query[e[n]];if(Array.isArray(o)){o.sort();for(const t in o)s.push(r+"="+c(o[t]))}else s.push(r+"="+c(o))}return s.join("&")}function d(e,s){return n=s,r=e,t.createHmac("SHA256",n).update(r).digest().toString("hex");var n,r}function l(t){return t>=10?""+t:"0"+t}class f{method="";host="";uri="";query={};headers={};body="";constructor(t,e,s,n){if(this.method=void 0===t?"":t,void 0===e)this.host="",this.uri="",this.query={};else{let t,s;this.query={};let n=e.indexOf("://");if(-1!==n&&(e=e.substr(n+3)),n=e.indexOf("?"),-1!==n){const t=e.substr(n+1);e=e.substr(0,n);const s=t.split("&");for(const t in s){const e=s[t],n=e.indexOf("=");let r,o;n>=0?(r=e.substr(0,n),o=e.substr(n+1)):(r=e,o=""),""!==r&&(r=decodeURI(r),o=decodeURI(o),void 0===this.query[r]?this.query[r]=[o]:this.query[r].push(o))}}n=e.indexOf("/"),-1===n?(t=e,s="/"):(t=e.substr(0,n),s=e.substr(n)),this.host=t,this.uri=decodeURI(s)}this.headers=void 0===s?{}:s,this.body=void 0===n?"":n}}class g{Key="";Secret="";constructor(t,e){this.Key=t,this.Secret=e}Sign(t){let e=u(t,r);null===e&&(e=function(){const t=new Date;return""+t.getUTCFullYear()+l(t.getUTCMonth()+1)+l(t.getUTCDate())+"T"+l(t.getUTCHours())+l(t.getUTCMinutes())+l(t.getUTCSeconds())+"Z"}(),t.headers[r]=e),"PUT"!==t.method&&"PATCH"!==t.method&&"POST"!==t.method&&(t.body="");let o=a(t);""!==o&&(o="?"+o);const i={hostname:t.host,path:encodeURI(t.uri)+o,method:t.method,headers:t.headers};null===u(t,"host")&&(t.headers.host=t.host);const c=function(t){const e=[];for(const s in t.headers)e.push(s.toLowerCase());return e.sort(),e}(t),f=function(t,e){const r=s(t);return n+"\n"+e+"\n"+r}(h(t,c),e),g=d(f,this.Secret);return i.headers.Authorization=function(t,e,s){return n+" Access="+e+", SignedHeaders="+s.join(";")+", Signature="+t}(g,this.Key,c),i}}exports.HuaweiYunClient=class{access;logger;constructor(t,e){this.access=t,this.logger=e}async request(t){const s=new g(this.access.accessKeyId,this.access.accessKeySecret);let n;t.data&&(n=JSON.stringify(t.data));const r=new f(t.method,t.url,t.headers,n);r.headers={"Content-Type":"application/json"};const o=s.Sign(r);try{return(await e.request({url:t.url,method:t.method,headers:o.headers,data:n})).data}catch(t){this.logger.error("华为云接口请求出错:",t?.response?.data);const e=new Error(t?.response?.data.message);throw e.code=t?.response?.code,e}}};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@certd/lib-huawei",
3
3
  "private": false,
4
- "version": "1.31.8",
4
+ "version": "1.31.9",
5
5
  "main": "./dist/bundle.js",
6
6
  "module": "./dist/bundle.js",
7
7
  "types": "./dist/d/index.d.ts",
@@ -23,5 +23,5 @@
23
23
  "prettier": "^2.8.8",
24
24
  "tslib": "^2.8.1"
25
25
  },
26
- "gitHead": "2acaa66635f91b8c169b7e68e08907f233c67c6e"
26
+ "gitHead": "be58e3084bbcd86d9fcd10950aadf542191a6949"
27
27
  }