ddan-js 3.8.7 → 3.9.1

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.
@@ -19,20 +19,27 @@ declare class Fetch {
19
19
  cache?: RequestCache;
20
20
  }): Promise<string>;
21
21
  formatError(response: Response | null, responseText: string | null, networkError?: any): any;
22
+ ask(url: string, args?: {
23
+ params?: Record<string, any>;
24
+ method?: 'POST' | 'GET';
25
+ baseURL?: string;
26
+ headers?: Record<string, string>;
27
+ cache?: RequestCache;
28
+ }): Promise<[null, any] | [any, undefined]>;
22
29
  }
23
30
  declare const _default: {
24
- getDataURL: (url: string, cache?: RequestCache | undefined) => Promise<[null, {
31
+ getDataURL: (url: string, init?: RequestInit | undefined) => Promise<[any, undefined] | [null, {
25
32
  contentType: string;
26
33
  dataUrl: string;
27
- }] | [any, undefined]>;
28
- getArrayBuffer: (url: string, cache?: RequestCache | undefined) => Promise<[any, undefined] | [null, ArrayBuffer]>;
29
- getJson: (url: string, cache?: RequestCache | undefined) => Promise<[any, undefined] | [null, any]>;
34
+ }]>;
35
+ getArrayBuffer: (url: string, init?: RequestInit | undefined) => Promise<[any, undefined] | [null, ArrayBuffer]>;
36
+ getJson: (url: string, init?: RequestInit | undefined) => Promise<[null, any] | [any, undefined]>;
30
37
  download: (url: string, opts?: {
31
38
  success?: ((buffer: Uint8Array) => void) | undefined;
32
39
  progress?: ((percentage: number, current: number, total: number) => void) | undefined;
33
40
  fail?: ((error: Error) => void) | undefined;
34
41
  }) => Promise<Uint8Array | undefined>;
35
- getText: (url: string, cache?: RequestCache | undefined) => Promise<[any, undefined] | [null, string]>;
42
+ getText: (url: string, init?: RequestInit | undefined) => Promise<[any, undefined] | [null, string]>;
36
43
  cache: (url: string, cache?: RequestCache) => Promise<[any, undefined] | [null, boolean]>;
37
44
  Fetch: typeof Fetch;
38
45
  };
@@ -10,5 +10,6 @@ declare const _default: {
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
12
  compareVersion: (ver1: string, ver2: string) => 0 | 1 | -1;
13
+ toOpen: (content: string, defaultOpen?: boolean) => boolean;
13
14
  };
14
15
  export default _default;
@@ -52,5 +52,6 @@ declare const _default: {
52
52
  getValueIf: <T_5 = any, F = any>(condition: boolean | (() => boolean), trueValue: T_5 | (() => T_5), falseValue?: F | (() => F) | undefined) => T_5 | F | undefined;
53
53
  resolveValue: <T_6 = any>(value: T_6 | (() => T_6)) => T_6;
54
54
  compareVersion: (ver1: string, ver2: string) => 0 | 1 | -1;
55
+ toOpen: (content: string, defaultOpen?: boolean) => boolean;
55
56
  };
56
57
  export default _default;
@@ -3,7 +3,7 @@ declare const _default: {
3
3
  readDirectory: (dir: string, callback?: Ddan.Func1<string, any> | undefined) => Promise<unknown>;
4
4
  readFiles: (dir: string, files: string[], callback?: Ddan.Func1<string, any> | undefined) => Promise<void>;
5
5
  access: (filePath: string, mode?: number) => Promise<boolean>;
6
- chmodFile: (path: string, mode?: string | number) => void;
6
+ chmodFile: (path: string, mode?: string | number) => Promise<any>;
7
7
  chmod755: (path: string) => Promise<[any, undefined] | [null, boolean]>;
8
8
  };
9
9
  export default _default;
@@ -47,7 +47,7 @@ declare const _default: {
47
47
  readDirectory: (dir: string, callback?: import("../..").Ddan.Func1<string, any> | undefined) => Promise<unknown>;
48
48
  readFiles: (dir: string, files: string[], callback?: import("../..").Ddan.Func1<string, any> | undefined) => Promise<void>;
49
49
  access: (filePath: string, mode?: number) => Promise<boolean>;
50
- chmodFile: (path: string, mode?: string | number) => void;
50
+ chmodFile: (path: string, mode?: string | number) => Promise<any>;
51
51
  chmod755: (path: string) => Promise<[any, undefined] | [null, boolean]>;
52
52
  };
53
53
  export default _default;
@@ -34,11 +34,13 @@ declare const _default: {
34
34
  name: string;
35
35
  withoutExtension: string;
36
36
  extname: string;
37
+ hash: string;
37
38
  href: string;
38
39
  url: string;
39
40
  origin: string;
40
41
  host: string;
41
42
  protocol: string;
43
+ hostname: string;
42
44
  port: string;
43
45
  query: string;
44
46
  };
@@ -27,11 +27,13 @@ declare const dHook: {
27
27
  name: string;
28
28
  withoutExtension: string;
29
29
  extname: string;
30
+ hash: string;
30
31
  href: string;
31
32
  url: string;
32
33
  origin: string;
33
34
  host: string;
34
35
  protocol: string;
36
+ hostname: string;
35
37
  port: string;
36
38
  query: string;
37
39
  };
@@ -154,6 +156,7 @@ declare const dHook: {
154
156
  getValueIf: <T_9 = any, F = any>(condition: boolean | (() => boolean), trueValue: T_9 | (() => T_9), falseValue?: F | (() => F) | undefined) => T_9 | F | undefined;
155
157
  resolveValue: <T_10 = any>(value: T_10 | (() => T_10)) => T_10;
156
158
  compareVersion: (ver1: string, ver2: string) => 0 | 1 | -1;
159
+ toOpen: (content: string, defaultOpen?: boolean) => boolean;
157
160
  base64: {
158
161
  encode: (input: string) => string;
159
162
  decode: (base64Str: string) => string;
@@ -46,11 +46,13 @@ declare const dMini: {
46
46
  name: string;
47
47
  withoutExtension: string;
48
48
  extname: string;
49
+ hash: string;
49
50
  href: string;
50
51
  url: string;
51
52
  origin: string;
52
53
  host: string;
53
54
  protocol: string;
55
+ hostname: string;
54
56
  port: string;
55
57
  query: string;
56
58
  };
@@ -44,7 +44,7 @@ declare const dNode: {
44
44
  readDirectory: (dir: string, callback?: import("..").Ddan.Func1<string, any> | undefined) => Promise<unknown>;
45
45
  readFiles: (dir: string, files: string[], callback?: import("..").Ddan.Func1<string, any> | undefined) => Promise<void>;
46
46
  access: (filePath: string, mode?: number) => Promise<boolean>;
47
- chmodFile: (path: string, mode?: string | number) => void;
47
+ chmodFile: (path: string, mode?: string | number) => Promise<any>;
48
48
  chmod755: (path: string) => Promise<[any, undefined] | [null, boolean]>;
49
49
  };
50
50
  export default dNode;
package/bin/tiny/web.d.ts CHANGED
@@ -2,18 +2,18 @@ import Http from '../modules/http';
2
2
  declare const dWeb: {
3
3
  Ecdh: typeof import("../modules/browser/ecdh").default;
4
4
  fetch: {
5
- getDataURL: (url: string, cache?: RequestCache | undefined) => Promise<[null, {
5
+ getDataURL: (url: string, init?: RequestInit | undefined) => Promise<[null, {
6
6
  contentType: string;
7
7
  dataUrl: string;
8
8
  }] | [any, undefined]>;
9
- getArrayBuffer: (url: string, cache?: RequestCache | undefined) => Promise<[any, undefined] | [null, ArrayBuffer]>;
10
- getJson: (url: string, cache?: RequestCache | undefined) => Promise<[any, undefined] | [null, any]>;
9
+ getArrayBuffer: (url: string, init?: RequestInit | undefined) => Promise<[any, undefined] | [null, ArrayBuffer]>;
10
+ getJson: (url: string, init?: RequestInit | undefined) => Promise<[any, undefined] | [null, any]>;
11
11
  download: (url: string, opts?: {
12
12
  success?: ((buffer: Uint8Array) => void) | undefined;
13
13
  progress?: ((percentage: number, current: number, total: number) => void) | undefined;
14
14
  fail?: ((error: Error) => void) | undefined;
15
15
  }) => Promise<Uint8Array | undefined>;
16
- getText: (url: string, cache?: RequestCache | undefined) => Promise<[any, undefined] | [null, string]>;
16
+ getText: (url: string, init?: RequestInit | undefined) => Promise<[any, undefined] | [null, string]>;
17
17
  cache: (url: string, cache?: RequestCache) => Promise<[any, undefined] | [null, boolean]>;
18
18
  Fetch: {
19
19
  new (config?: {
@@ -36,6 +36,13 @@ declare const dWeb: {
36
36
  cache?: RequestCache | undefined;
37
37
  }): Promise<string>;
38
38
  formatError(response: Response | null, responseText: string | null, networkError?: any): any;
39
+ ask(url: string, args?: {
40
+ params?: Record<string, any> | undefined;
41
+ method?: "POST" | "GET" | undefined;
42
+ baseURL?: string | undefined;
43
+ headers?: Record<string, string> | undefined;
44
+ cache?: RequestCache | undefined;
45
+ }): Promise<[any, undefined] | [null, any]>;
39
46
  };
40
47
  };
41
48
  };
@@ -78,11 +85,13 @@ declare const dWeb: {
78
85
  name: string;
79
86
  withoutExtension: string;
80
87
  extname: string;
88
+ hash: string;
81
89
  href: string;
82
90
  url: string;
83
91
  origin: string;
84
92
  host: string;
85
93
  protocol: string;
94
+ hostname: string;
86
95
  port: string;
87
96
  query: string;
88
97
  };
@@ -40,11 +40,13 @@ export declare namespace Ddan {
40
40
  [P in keyof T as T[P] extends Required<T>[P] ? never : P]: T[P];
41
41
  };
42
42
  interface IHttpHost {
43
+ hash: string;
43
44
  href: string;
44
45
  url: string;
45
46
  origin: string;
46
47
  host: string;
47
48
  protocol: string;
49
+ hostname: string;
48
50
  port: string;
49
51
  query: string;
50
52
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ddan-js",
3
- "version": "3.8.7",
3
+ "version": "3.9.1",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "ddan-js",