electron-incremental-update 2.0.0-beta.8 → 2.0.0-beta.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.
@@ -1,134 +0,0 @@
1
- import { EventEmitter } from 'node:events';
2
- import { a as UpdateJSON, U as UpdateInfo, D as DownloadingInfo, I as IProvider, c as URLHandler } from './types-CItP6bL-.cjs';
3
-
4
- declare const ErrorInfo: {
5
- readonly download: "Download failed";
6
- readonly validate: "Validate failed";
7
- readonly param: "Missing params";
8
- readonly network: "Network error";
9
- };
10
- declare class UpdaterError extends Error {
11
- code: keyof typeof ErrorInfo;
12
- constructor(msg: keyof typeof ErrorInfo, info: string);
13
- }
14
- type CheckResult<T extends UpdateJSON> = {
15
- success: true;
16
- data: Omit<T, 'beta'>;
17
- } | {
18
- success: false;
19
- /**
20
- * minimal version that can update
21
- */
22
- data: string;
23
- } | {
24
- success: false;
25
- data: UpdaterError;
26
- };
27
- type DownloadResult = {
28
- success: true;
29
- } | {
30
- success: false;
31
- data: UpdaterError;
32
- };
33
- interface Logger {
34
- info: (msg: string) => void;
35
- debug: (msg: string) => void;
36
- warn: (msg: string) => void;
37
- error: (msg: string, e?: unknown) => void;
38
- }
39
- interface UpdaterOption {
40
- /**
41
- * public key of signature, which will be auto generated by plugin,
42
- * generate by `selfsigned` if not set
43
- */
44
- SIGNATURE_CERT?: string;
45
- /**
46
- * whether to receive beta update
47
- */
48
- receiveBeta?: boolean;
49
- logger?: Logger;
50
- }
51
-
52
- declare class Updater extends EventEmitter<{
53
- 'checking': any;
54
- 'update-available': [data: UpdateInfo];
55
- 'update-unavailable': [reason: string];
56
- 'error': [error: UpdaterError];
57
- 'download-progress': [info: DownloadingInfo];
58
- 'update-downloaded': any;
59
- }> {
60
- private CERT;
61
- private info?;
62
- private provider;
63
- /**
64
- * updater logger
65
- */
66
- logger?: Logger;
67
- /**
68
- * whether to receive beta update
69
- */
70
- receiveBeta?: boolean;
71
- /**
72
- * whether force update in DEV
73
- */
74
- forceUpdate?: boolean;
75
- /**
76
- * initialize incremental updater
77
- * @param provider update provider
78
- * @param option UpdaterOption
79
- */
80
- constructor(provider: IProvider, option?: UpdaterOption);
81
- /**
82
- * this function is used to parse download data.
83
- * - if format is `'json'`
84
- * - if data is `UpdateJSON`, return it
85
- * - if data is string or absent, download URL data and return it
86
- * - if format is `'buffer'`
87
- * - if data is `Buffer`, return it
88
- * - if data is string or absent, download URL data and return it
89
- * @param format 'json' or 'buffer'
90
- * @param data download URL or update json or buffer
91
- */
92
- private fetch;
93
- /**
94
- * handle error message and emit error event
95
- */
96
- private err;
97
- /**
98
- * check update info using default options
99
- */
100
- checkUpdate(): Promise<boolean>;
101
- /**
102
- * check update info using existing update json
103
- * @param data existing update json
104
- */
105
- checkUpdate(data: UpdateJSON): Promise<boolean>;
106
- /**
107
- * download update using default options
108
- */
109
- downloadUpdate(): Promise<boolean>;
110
- /**
111
- * download update using existing `asar.gz` buffer and signature
112
- * @param data existing `asar.gz` buffer
113
- * @param info update info
114
- */
115
- downloadUpdate(data: Uint8Array, info: Omit<UpdateInfo, 'minimumVersion'>): Promise<boolean>;
116
- /**
117
- * quit App and install
118
- */
119
- quitAndInstall(): void;
120
- /**
121
- * setup provider URL handler
122
- *
123
- * @example
124
- * updater.setURLHandler((url, isDownloadingAsar) => {
125
- * if (isDownloadingAsar) {
126
- * url.hostname = 'https://cdn.jsdelivr.net/gh'
127
- * return url
128
- * }
129
- * })
130
- */
131
- setURLHandler(handler: URLHandler): void;
132
- }
133
-
134
- export { type CheckResult as C, type DownloadResult as D, ErrorInfo as E, type Logger as L, Updater as U, type UpdaterOption as a, UpdaterError as b };