ddan-js 3.1.4 → 3.1.6

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.
@@ -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{bucket;accessKeyId;accessKeySecret;region;extra;__oss;__cdn;constructor({bucket:e,accessKeyId:t,accessKeySecret:r,region:s,...c}){this.bucket=e,this.accessKeyId=t,this.accessKeySecret=r,this.region=s,this.extra=c}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={}){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"},{});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="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})}));
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{bucket;accessKeyId;accessKeySecret;region;extra;__oss;__cdn;constructor({bucket:e,accessKeyId:t,accessKeySecret:r,region:s,...c}){this.bucket=e,this.accessKeyId=t,this.accessKeySecret=r,this.region=s,this.extra=c}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={}){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="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})}));
@@ -1 +1 @@
1
- import e from"ali-oss";import t from"@alicloud/pop-core";class r{bucket;accessKeyId;accessKeySecret;region;extra;__oss;__cdn;constructor({bucket:e,accessKeyId:t,accessKeySecret:r,region:c,...s}){this.bucket=e,this.accessKeyId=t,this.accessKeySecret=r,this.region=c,this.extra=s}get client(){return this.__oss||(this.__oss=this._getOSS()),this.__oss}_getOSS(){return new e({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={}){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,c=!1;const s=e.endsWith("/")?e:`${e}/`;try{do{const e=await this.client.listV2({prefix:s,"continuation-token":r,"max-keys":"50"},{});for(let r of e.objects||[])t&&await t(r.name);r=e.nextContinuationToken,c=e.isTruncated}while(c);return!0}catch(t){return console.log(`aliyun browse ${e} error`,t),!1}}get cdn(){return this.__cdn||(this.__cdn=new t({accessKeyId:this.accessKeyId,accessKeySecret:this.accessKeySecret,endpoint:"https://cdn.aliyuncs.com",apiVersion:"2018-05-10"})),this.__cdn}async refreshCDN(e,t="File"){try{let r={ObjectPath:e,ObjectType:t};const c={method:"POST",formatParams:!1};return await this.cdn.request("RefreshObjectCaches",r,c),!0}catch(t){return console.log(`aliyun refreshCDN ${e} err`,t),!1}}}export{r as Aliyun};
1
+ import e from"ali-oss";import t from"@alicloud/pop-core";class r{bucket;accessKeyId;accessKeySecret;region;extra;__oss;__cdn;constructor({bucket:e,accessKeyId:t,accessKeySecret:r,region:c,...s}){this.bucket=e,this.accessKeyId=t,this.accessKeySecret=r,this.region=c,this.extra=s}get client(){return this.__oss||(this.__oss=this._getOSS()),this.__oss}_getOSS(){return new e({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={}){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,c=!1;const s=e.endsWith("/")?e:`${e}/`;try{do{const e=await this.client.listV2({prefix:s,"continuation-token":r,"max-keys":"50"},{timeout:3e5});for(let r of e.objects||[])t&&await t(r.name);r=e.nextContinuationToken,c=e.isTruncated}while(c);return!0}catch(t){return console.log(`aliyun browse ${e} error`,t),!1}}get cdn(){return this.__cdn||(this.__cdn=new t({accessKeyId:this.accessKeyId,accessKeySecret:this.accessKeySecret,endpoint:"https://cdn.aliyuncs.com",apiVersion:"2018-05-10"})),this.__cdn}async refreshCDN(e,t="File"){try{let r={ObjectPath:e,ObjectType:t};const c={method:"POST",formatParams:!1};return await this.cdn.request("RefreshObjectCaches",r,c),!0}catch(t){return console.log(`aliyun refreshCDN ${e} err`,t),!1}}}export{r as Aliyun};
@@ -9,5 +9,6 @@ declare const _default: {
9
9
  timeout: <T_2 = any>(task?: Ddan.PFunction<T_2> | undefined, ms?: number, desc?: string) => Promise<[any, undefined] | [null, T_2]>;
10
10
  getValueIf: <T_3 = any, F = any>(condition: boolean | (() => boolean), trueValue: T_3 | (() => T_3), falseValue?: F | (() => F) | undefined) => T_3 | F | undefined;
11
11
  resolveValue: <T_4 = any>(value: T_4 | (() => T_4)) => T_4;
12
+ runAsync: <T_5 = any>(func: any) => Promise<T_5 | undefined>;
12
13
  };
13
14
  export default _default;
@@ -45,5 +45,6 @@ declare const _default: {
45
45
  timeout: <T_3 = any>(task?: Ddan.PFunction<T_3> | undefined, ms?: number, desc?: string) => Promise<[any, undefined] | [null, T_3]>;
46
46
  getValueIf: <T_4 = any, F = any>(condition: boolean | (() => boolean), trueValue: T_4 | (() => T_4), falseValue?: F | (() => F) | undefined) => T_4 | F | undefined;
47
47
  resolveValue: <T_5 = any>(value: T_5 | (() => T_5)) => T_5;
48
+ runAsync: <T_6 = any>(func: any) => Promise<T_6 | undefined>;
48
49
  };
49
50
  export default _default;
@@ -131,6 +131,7 @@ declare const dHook: {
131
131
  timeout: <T_6 = any>(task?: import("..").Ddan.PFunction<T_6> | undefined, ms?: number, desc?: string) => Promise<[any, undefined] | [null, T_6]>;
132
132
  getValueIf: <T_7 = any, F = any>(condition: boolean | (() => boolean), trueValue: T_7 | (() => T_7), falseValue?: F | (() => F) | undefined) => T_7 | F | undefined;
133
133
  resolveValue: <T_8 = any>(value: T_8 | (() => T_8)) => T_8;
134
+ runAsync: <T_9 = any>(func: any) => Promise<T_9 | undefined>;
134
135
  base64: {
135
136
  encode: (input: string) => string;
136
137
  decode: (base64Str: string) => string;
@@ -184,7 +185,7 @@ declare const dHook: {
184
185
  bytes2hex: (bytes: Uint8Array) => string;
185
186
  toUint32: (str: string) => Uint32Array;
186
187
  fromUint32: (uint32: Uint32Array) => string;
187
- flatten: <T_9>(data: T_9[], recursive?: boolean, list?: T_9[]) => T_9[];
188
+ flatten: <T_10>(data: T_10[], recursive?: boolean, list?: T_10[]) => T_10[];
188
189
  flattenPath: (data: Record<string, any>) => Record<string, any>;
189
190
  normalizeStructure: (data: any, prevData: any) => void;
190
191
  diffPath: (data: Record<string, any>, prevData: Record<string, any>) => Record<string, any>;
@@ -200,12 +201,12 @@ declare const dHook: {
200
201
  ignoreEmptyString?: boolean | undefined;
201
202
  }) => any;
202
203
  clone: (source: any, weakMap?: WeakMap<object, any>) => any;
203
- cloneClass: <T_10>(source: T_10) => T_10;
204
- isEqual: <T_11 = any>(value: T_11, other: T_11, depth?: number) => boolean;
204
+ cloneClass: <T_11>(source: T_11) => T_11;
205
+ isEqual: <T_12 = any>(value: T_12, other: T_12, depth?: number) => boolean;
205
206
  isEqualArray: (value: any[], other: any[], depth?: number) => boolean;
206
207
  isEqualObject: (value: Record<string, any>, other: Record<string, any>, depth?: number) => boolean;
207
- isEqualValue: <T_12>(value: T_12, other: T_12, type: string) => boolean;
208
+ isEqualValue: <T_13>(value: T_13, other: T_13, type: string) => boolean;
208
209
  isEqualAB: (value: ArrayBuffer, other: ArrayBuffer) => boolean;
209
- isEqualDeep: <T_13>(value: T_13, other: T_13) => boolean;
210
+ isEqualDeep: <T_14>(value: T_14, other: T_14) => boolean;
210
211
  };
211
212
  export default dHook;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ddan-js",
3
- "version": "3.1.4",
3
+ "version": "3.1.6",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "ddan-js",