ddan-js 4.1.5 → 4.1.7
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/bin/ddan-browser.js +1 -1
- package/bin/ddan-browser.mjs +1 -1
- package/bin/ddan-js.js +1 -1
- package/bin/ddan-js.mjs +1 -1
- package/bin/ddan-upload.js +1 -1
- package/bin/ddan-upload.mjs +1 -1
- package/bin/modules/cipher.d.ts +3 -0
- package/bin/modules/crypto/cipher.d.ts +3 -0
- package/bin/modules/node/cipher-web.d.ts +3 -0
- package/bin/modules/node/index.d.ts +3 -0
- package/bin/tiny/node.d.ts +3 -0
- package/bin/tiny/web.d.ts +3 -0
- package/package.json +6 -22
package/bin/ddan-upload.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("ali-oss"),require("@alicloud/pop-core")):"function"==typeof define&&define.amd?define(["exports","ali-oss","@alicloud/pop-core"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).dUpload=e.dUpload||{},e.OSS,e.aliCore)}(this,(function(e,t,r){"use strict";function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=s(t),n=s(r);e.Aliyun=class{
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("ali-oss"),require("@alicloud/pop-core")):"function"==typeof define&&define.amd?define(["exports","ali-oss","@alicloud/pop-core"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).dUpload=e.dUpload||{},e.OSS,e.aliCore)}(this,(function(e,t,r){"use strict";function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=s(t),n=s(r);e.Aliyun=class{constructor(e){let{bucket:t,accessKeyId:r,accessKeySecret:s,region:c,...n}=e;this.bucket=t,this.accessKeyId=r,this.accessKeySecret=s,this.region=c,this.extra=n}get client(){return this.__oss||(this.__oss=this._getOSS()),this.__oss}_getOSS(){return new c.default({region:this.region,accessKeyId:this.accessKeyId,accessKeySecret:this.accessKeySecret,bucket:this.bucket,...this.extra||{}})}async read(e){try{if(!await this.exist(e))return"";const t=await this.client.get(e);return t.content?.toString()||""}catch(t){return void console.log(`aliyun read ${e} error`,t)}}async delete(e){try{return await this.client.delete(e),!0}catch(t){return console.log(`aliyun delete ${e} error`,t),!1}}async exist(e,t){void 0===t&&(t={});try{return await this.client.head(e,t),!0}catch(e){return!1}}async upload(e,t){try{return!(!e||!t)&&(await this.client.put(e,t),!0)}catch(e){return console.log(`aliyun upload ${t} error`,e),!1}}async put(e,t){try{return!(!e||!t)&&(await this.client.put(e,Buffer.from(t)),!0)}catch(t){return console.log(`aliyun put content ${e} error`,t),!1}}async putSymlink(e,t){try{if(!e||!t)return!1;return await this.client.putSymlink(e,t)}catch(e){return!1}}async browse(e,t){let r,s=!1;const c=e.endsWith("/")?e:`${e}/`;try{do{const e=await this.client.listV2({prefix:c,"continuation-token":r,"max-keys":"50"},{timeout:3e5});for(let r of e.objects||[])t&&await t(r.name);r=e.nextContinuationToken,s=e.isTruncated}while(s);return!0}catch(t){return console.log(`aliyun browse ${e} error`,t),!1}}get cdn(){return this.__cdn||(this.__cdn=new n.default({accessKeyId:this.accessKeyId,accessKeySecret:this.accessKeySecret,endpoint:"https://cdn.aliyuncs.com",apiVersion:"2018-05-10"})),this.__cdn}async refreshCDN(e,t){void 0===t&&(t="File");try{let r={ObjectPath:e,ObjectType:t};const s={method:"POST",formatParams:!1};return await this.cdn.request("RefreshObjectCaches",r,s),!0}catch(t){return console.log(`aliyun refreshCDN ${e} err`,t),!1}}},Object.defineProperty(e,"__esModule",{value:!0})}));
|
package/bin/ddan-upload.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import t from"ali-oss";import e from"@alicloud/pop-core";class r{constructor(t){let{bucket:e,accessKeyId:r,accessKeySecret:s,region:c,...n}=t;this.bucket=e,this.accessKeyId=r,this.accessKeySecret=s,this.region=c,this.extra=n}get client(){return this.__oss||(this.__oss=this._getOSS()),this.__oss}_getOSS(){return new t({region:this.region,accessKeyId:this.accessKeyId,accessKeySecret:this.accessKeySecret,bucket:this.bucket,...this.extra||{}})}async read(t){try{if(!await this.exist(t))return"";const e=await this.client.get(t);return e.content?.toString()||""}catch(e){return void console.log(`aliyun read ${t} error`,e)}}async delete(t){try{return await this.client.delete(t),!0}catch(e){return console.log(`aliyun delete ${t} error`,e),!1}}async exist(t,e){void 0===e&&(e={});try{return await this.client.head(t,e),!0}catch(t){return!1}}async upload(t,e){try{return!(!t||!e)&&(await this.client.put(t,e),!0)}catch(t){return console.log(`aliyun upload ${e} error`,t),!1}}async put(t,e){try{return!(!t||!e)&&(await this.client.put(t,Buffer.from(e)),!0)}catch(e){return console.log(`aliyun put content ${t} error`,e),!1}}async putSymlink(t,e){try{if(!t||!e)return!1;return await this.client.putSymlink(t,e)}catch(t){return!1}}async browse(t,e){let r,s=!1;const c=t.endsWith("/")?t:`${t}/`;try{do{const t=await this.client.listV2({prefix:c,"continuation-token":r,"max-keys":"50"},{timeout:3e5});for(let r of t.objects||[])e&&await e(r.name);r=t.nextContinuationToken,s=t.isTruncated}while(s);return!0}catch(e){return console.log(`aliyun browse ${t} error`,e),!1}}get cdn(){return this.__cdn||(this.__cdn=new e({accessKeyId:this.accessKeyId,accessKeySecret:this.accessKeySecret,endpoint:"https://cdn.aliyuncs.com",apiVersion:"2018-05-10"})),this.__cdn}async refreshCDN(t,e){void 0===e&&(e="File");try{let r={ObjectPath:t,ObjectType:e};const s={method:"POST",formatParams:!1};return await this.cdn.request("RefreshObjectCaches",r,s),!0}catch(e){return console.log(`aliyun refreshCDN ${t} err`,e),!1}}}export{r as Aliyun};
|
package/bin/modules/cipher.d.ts
CHANGED
|
@@ -3,5 +3,8 @@ declare const _default: {
|
|
|
3
3
|
aesGcmDecrypt: (encryptedBase64: string, aesKey: CryptoKey, ivFirst?: boolean) => Promise<string>;
|
|
4
4
|
aesCryptoKey: (sharedBase64: string) => Promise<CryptoKey | null>;
|
|
5
5
|
aesCryptoKeyFromHkdf: (sharedBase64: string, saltBase64: string, infoBase64: string) => Promise<CryptoKey | null>;
|
|
6
|
+
aesGcmKey: (rawData: BufferSource) => Promise<CryptoKey | null>;
|
|
7
|
+
rawKeyHex: (cryptoKey: CryptoKey) => Promise<string>;
|
|
8
|
+
rawKeyBytes: (cryptoKey: CryptoKey) => Promise<Uint8Array | null>;
|
|
6
9
|
};
|
|
7
10
|
export default _default;
|
|
@@ -3,5 +3,8 @@ declare const _default: {
|
|
|
3
3
|
aesGcmDecrypt: (subtle: any, encryptedBase64: string, aesKey: CryptoKey, ivFirst?: boolean) => Promise<string>;
|
|
4
4
|
aesCryptoKey: (subtle: any, sharedBase64: string) => Promise<CryptoKey | null>;
|
|
5
5
|
aesCryptoKeyFromHkdf: (subtle: any, sharedBase64: string, saltBase64: string, infoBase64: string) => Promise<CryptoKey | null>;
|
|
6
|
+
aesGcmKey: (subtle: any, rawData: BufferSource) => Promise<CryptoKey | null>;
|
|
7
|
+
rawKeyHex: (subtle: any, cryptoKey: CryptoKey) => Promise<string>;
|
|
8
|
+
rawKeyBytes: (subtle: any, cryptoKey: CryptoKey) => Promise<Uint8Array | null>;
|
|
6
9
|
};
|
|
7
10
|
export default _default;
|
|
@@ -3,5 +3,8 @@ declare const _default: {
|
|
|
3
3
|
aesGcmDecrypt: (encryptedBase64: string, aesKey: CryptoKey, ivFirst?: boolean) => Promise<string>;
|
|
4
4
|
aesCryptoKey: (sharedBase64: string) => Promise<CryptoKey | null>;
|
|
5
5
|
aesCryptoKeyFromHkdf: (sharedBase64: string, saltBase64: string, infoBase64: string) => Promise<CryptoKey | null>;
|
|
6
|
+
aesGcmKey: (rawData: BufferSource) => Promise<CryptoKey | null>;
|
|
7
|
+
rawKeyHex: (cryptoKey: CryptoKey) => Promise<string>;
|
|
8
|
+
rawKeyBytes: (cryptoKey: CryptoKey) => Promise<Uint8Array | null>;
|
|
6
9
|
};
|
|
7
10
|
export default _default;
|
|
@@ -22,6 +22,9 @@ declare const _default: {
|
|
|
22
22
|
aesGcmDecrypt: (encryptedBase64: string, aesKey: CryptoKey, ivFirst?: boolean) => Promise<string>;
|
|
23
23
|
aesCryptoKey: (sharedBase64: string) => Promise<CryptoKey | null>;
|
|
24
24
|
aesCryptoKeyFromHkdf: (sharedBase64: string, saltBase64: string, infoBase64: string) => Promise<CryptoKey | null>;
|
|
25
|
+
aesGcmKey: (rawData: BufferSource) => Promise<CryptoKey | null>;
|
|
26
|
+
rawKeyHex: (cryptoKey: CryptoKey) => Promise<string>;
|
|
27
|
+
rawKeyBytes: (cryptoKey: CryptoKey) => Promise<Uint8Array | null>;
|
|
25
28
|
};
|
|
26
29
|
findFreePort: (startPort: number, maxRetries?: number) => Promise<number>;
|
|
27
30
|
getSystemProxy: () => Promise<{
|
package/bin/tiny/node.d.ts
CHANGED
|
@@ -19,6 +19,9 @@ declare const dNode: {
|
|
|
19
19
|
aesGcmDecrypt: (encryptedBase64: string, aesKey: CryptoKey, ivFirst?: boolean) => Promise<string>;
|
|
20
20
|
aesCryptoKey: (sharedBase64: string) => Promise<CryptoKey | null>;
|
|
21
21
|
aesCryptoKeyFromHkdf: (sharedBase64: string, saltBase64: string, infoBase64: string) => Promise<CryptoKey | null>;
|
|
22
|
+
aesGcmKey: (rawData: BufferSource) => Promise<CryptoKey | null>;
|
|
23
|
+
rawKeyHex: (cryptoKey: CryptoKey) => Promise<string>;
|
|
24
|
+
rawKeyBytes: (cryptoKey: CryptoKey) => Promise<Uint8Array | null>;
|
|
22
25
|
};
|
|
23
26
|
findFreePort: (startPort: number, maxRetries?: number) => Promise<number>;
|
|
24
27
|
getSystemProxy: () => Promise<{
|
package/bin/tiny/web.d.ts
CHANGED
|
@@ -186,6 +186,9 @@ declare const dWeb: {
|
|
|
186
186
|
aesGcmDecrypt: (encryptedBase64: string, aesKey: CryptoKey, ivFirst?: boolean) => Promise<string>;
|
|
187
187
|
aesCryptoKey: (sharedBase64: string) => Promise<CryptoKey | null>;
|
|
188
188
|
aesCryptoKeyFromHkdf: (sharedBase64: string, saltBase64: string, infoBase64: string) => Promise<CryptoKey | null>;
|
|
189
|
+
aesGcmKey: (rawData: BufferSource) => Promise<CryptoKey | null>;
|
|
190
|
+
rawKeyHex: (cryptoKey: CryptoKey) => Promise<string>;
|
|
191
|
+
rawKeyBytes: (cryptoKey: CryptoKey) => Promise<Uint8Array | null>;
|
|
189
192
|
};
|
|
190
193
|
};
|
|
191
194
|
export default dWeb;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ddan-js",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.7",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ddan-js",
|
|
@@ -24,8 +24,6 @@
|
|
|
24
24
|
"exports": {
|
|
25
25
|
".": {
|
|
26
26
|
"types": "./bin/index.d.ts",
|
|
27
|
-
"import": "./bin/ddan-js.mjs",
|
|
28
|
-
"require": "./bin/ddan-js.js",
|
|
29
27
|
"node": {
|
|
30
28
|
"import": "./bin/ddan-js.mjs",
|
|
31
29
|
"require": "./bin/ddan-js.js"
|
|
@@ -33,7 +31,9 @@
|
|
|
33
31
|
"browser": {
|
|
34
32
|
"import": "./bin/ddan-browser.mjs",
|
|
35
33
|
"require": "./bin/ddan-browser.js"
|
|
36
|
-
}
|
|
34
|
+
},
|
|
35
|
+
"import": "./bin/ddan-js.mjs",
|
|
36
|
+
"require": "./bin/ddan-js.js"
|
|
37
37
|
},
|
|
38
38
|
"./upload": {
|
|
39
39
|
"types": "./bin/upload.d.ts",
|
|
@@ -124,42 +124,26 @@
|
|
|
124
124
|
"@babel/preset-typescript": "^7.26.0",
|
|
125
125
|
"@rollup/plugin-node-resolve": "^15.1.0",
|
|
126
126
|
"@types/ali-oss": "^6.16.7",
|
|
127
|
-
"@types/
|
|
128
|
-
"@types/babel__traverse": "7.17.1",
|
|
129
|
-
"@types/jest": "^23.3.2",
|
|
130
|
-
"@types/lodash": "^4.17.13",
|
|
127
|
+
"@types/jest": "^29.5.12",
|
|
131
128
|
"@types/node": "^16.18.0",
|
|
132
129
|
"ali-oss": "^6.17.1",
|
|
133
|
-
"colors": "^1.4.0",
|
|
134
|
-
"commitizen": "^4.3.0",
|
|
135
|
-
"cross-env": "^7.0.3",
|
|
136
|
-
"gulp": "^4.0.2",
|
|
137
|
-
"gulp-uglify": "^3.0.2",
|
|
138
130
|
"jest": "^29.1.0",
|
|
139
|
-
"jest-config": "^29.1.0",
|
|
140
131
|
"lint-staged": "^13.2.1",
|
|
141
|
-
"lodash": "^4.17.21",
|
|
142
132
|
"prettier": "^2.8.8",
|
|
143
|
-
"
|
|
144
|
-
"rimraf": "^5.0.0",
|
|
133
|
+
"rimraf": "^5.0.10",
|
|
145
134
|
"rollup": "^2.79.1",
|
|
146
135
|
"rollup-plugin-babel": "^4.4.0",
|
|
147
|
-
"rollup-plugin-commonjs": "^10.1.0",
|
|
148
136
|
"rollup-plugin-copy": "^3.5.0",
|
|
149
137
|
"rollup-plugin-json": "^4.0.0",
|
|
150
|
-
"rollup-plugin-node-resolve": "^5.2.0",
|
|
151
138
|
"rollup-plugin-sourcemaps": "^0.6.3",
|
|
152
139
|
"rollup-plugin-terser": "^7.0.2",
|
|
153
140
|
"rollup-plugin-typescript2": "^0.34.1",
|
|
154
|
-
"semantic-release": "^21.0.1",
|
|
155
|
-
"shelljs": "^0.8.5",
|
|
156
141
|
"ts-jest": "^29.1.0",
|
|
157
142
|
"ts-node": "^10.9.1",
|
|
158
143
|
"tslib": "^2.5.0",
|
|
159
144
|
"tslint": "^5.20.1",
|
|
160
145
|
"tslint-config-prettier": "^1.18.0",
|
|
161
146
|
"tslint-config-standard": "^9.0.0",
|
|
162
|
-
"typedoc": "^0.24.0",
|
|
163
147
|
"typescript": "^5.0.4"
|
|
164
148
|
},
|
|
165
149
|
"dependencies": {
|