electron-updater 4.3.5 → 4.3.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.
Files changed (70) hide show
  1. package/LICENSE +22 -0
  2. package/out/AppAdapter.js +19 -28
  3. package/out/AppAdapter.js.map +1 -1
  4. package/out/AppImageUpdater.js +103 -173
  5. package/out/AppImageUpdater.js.map +1 -1
  6. package/out/AppUpdater.d.ts +1 -3
  7. package/out/AppUpdater.js +517 -773
  8. package/out/AppUpdater.js.map +1 -1
  9. package/out/BaseUpdater.js +79 -103
  10. package/out/BaseUpdater.js.map +1 -1
  11. package/out/DownloadedUpdateHelper.js +150 -224
  12. package/out/DownloadedUpdateHelper.js.map +1 -1
  13. package/out/ElectronAppAdapter.js +35 -63
  14. package/out/ElectronAppAdapter.js.map +1 -1
  15. package/out/MacUpdater.d.ts +1 -1
  16. package/out/MacUpdater.js +132 -182
  17. package/out/MacUpdater.js.map +1 -1
  18. package/out/NoOpLogger.d.ts +6 -0
  19. package/out/NoOpLogger.js +19 -0
  20. package/out/NoOpLogger.js.map +1 -0
  21. package/out/NsisUpdater.js +199 -331
  22. package/out/NsisUpdater.js.map +1 -1
  23. package/out/differentialDownloader/DataSplitter.js +180 -252
  24. package/out/differentialDownloader/DataSplitter.js.map +1 -1
  25. package/out/differentialDownloader/DifferentialDownloader.d.ts +3 -0
  26. package/out/differentialDownloader/DifferentialDownloader.js +243 -308
  27. package/out/differentialDownloader/DifferentialDownloader.js.map +1 -1
  28. package/out/differentialDownloader/FileWithEmbeddedBlockMapDifferentialDownloader.js +29 -65
  29. package/out/differentialDownloader/FileWithEmbeddedBlockMapDifferentialDownloader.js.map +1 -1
  30. package/out/differentialDownloader/GenericDifferentialDownloader.js +7 -21
  31. package/out/differentialDownloader/GenericDifferentialDownloader.js.map +1 -1
  32. package/out/differentialDownloader/ProgressDifferentialDownloadCallbackTransform.d.ts +32 -0
  33. package/out/differentialDownloader/ProgressDifferentialDownloadCallbackTransform.js +90 -0
  34. package/out/differentialDownloader/ProgressDifferentialDownloadCallbackTransform.js.map +1 -0
  35. package/out/differentialDownloader/downloadPlanBuilder.js +99 -124
  36. package/out/differentialDownloader/downloadPlanBuilder.js.map +1 -1
  37. package/out/differentialDownloader/multipleRangeDownloader.js +99 -148
  38. package/out/differentialDownloader/multipleRangeDownloader.js.map +1 -1
  39. package/out/electronHttpExecutor.js +73 -106
  40. package/out/electronHttpExecutor.js.map +1 -1
  41. package/out/event.d.ts +35 -0
  42. package/out/event.js +39 -0
  43. package/out/event.js.map +1 -0
  44. package/out/log.d.ts +11 -0
  45. package/out/log.js +19 -0
  46. package/out/log.js.map +1 -0
  47. package/out/main.d.ts +1 -4
  48. package/out/main.js +60 -212
  49. package/out/main.js.map +1 -1
  50. package/out/providerFactory.js +49 -105
  51. package/out/providerFactory.js.map +1 -1
  52. package/out/providers/BintrayProvider.d.ts +2 -2
  53. package/out/providers/BintrayProvider.js +40 -95
  54. package/out/providers/BintrayProvider.js.map +1 -1
  55. package/out/providers/GenericProvider.d.ts +2 -2
  56. package/out/providers/GenericProvider.js +46 -80
  57. package/out/providers/GenericProvider.js.map +1 -1
  58. package/out/providers/GitHubProvider.d.ts +2 -2
  59. package/out/providers/GitHubProvider.js +122 -201
  60. package/out/providers/GitHubProvider.js.map +1 -1
  61. package/out/providers/PrivateGitHubProvider.js +87 -165
  62. package/out/providers/PrivateGitHubProvider.js.map +1 -1
  63. package/out/providers/Provider.js +122 -173
  64. package/out/providers/Provider.js.map +1 -1
  65. package/out/util.d.ts +5 -0
  66. package/out/util.js +42 -0
  67. package/out/util.js.map +1 -0
  68. package/out/windowsExecutableCodeSignatureVerifier.js +99 -139
  69. package/out/windowsExecutableCodeSignatureVerifier.js.map +1 -1
  70. package/package.json +33 -31
@@ -1,99 +1,44 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
2
+ Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.BintrayProvider = void 0;
7
-
8
- function _builderUtilRuntime() {
9
- const data = require("builder-util-runtime");
10
-
11
- _builderUtilRuntime = function () {
12
- return data;
13
- };
14
-
15
- return data;
16
- }
17
-
18
- function _bintray() {
19
- const data = require("builder-util-runtime/out/bintray");
20
-
21
- _bintray = function () {
22
- return data;
23
- };
24
-
25
- return data;
26
- }
27
-
28
- function _url() {
29
- const data = require("url");
30
-
31
- _url = function () {
32
- return data;
33
- };
34
-
35
- return data;
36
- }
37
-
38
- function _main() {
39
- const data = require("../main");
40
-
41
- _main = function () {
42
- return data;
43
- };
44
-
45
- return data;
46
- }
47
-
48
- function _Provider() {
49
- const data = require("./Provider");
50
-
51
- _Provider = function () {
52
- return data;
53
- };
54
-
55
- return data;
56
- }
57
-
58
- class BintrayProvider extends _main().Provider {
59
- constructor(configuration, runtimeOptions) {
60
- super(runtimeOptions);
61
- this.client = new (_bintray().BintrayClient)(configuration, runtimeOptions.executor, new (_builderUtilRuntime().CancellationToken)());
62
- this.baseUrl = (0, _main().newBaseUrl)(`https://dl.bintray.com/${this.client.owner}/${this.client.repo}`);
63
- }
64
-
65
- setRequestHeaders(value) {
66
- super.setRequestHeaders(value);
67
- this.client.setRequestHeaders(value);
68
- }
69
-
70
- async getLatestVersion() {
71
- try {
72
- const data = await this.client.getVersion("_latest");
73
- const channelFilename = (0, _main().getChannelFilename)(this.getDefaultChannelName());
74
- const files = await this.client.getVersionFiles(data.name);
75
- const channelFile = files.find(it => it.name.endsWith(`_${channelFilename}`) || it.name.endsWith(`-${channelFilename}`));
76
-
77
- if (channelFile == null) {
78
- // noinspection ExceptionCaughtLocallyJS
79
- throw (0, _builderUtilRuntime().newError)(`Cannot find channel file "${channelFilename}", existing files:\n${files.map(it => JSON.stringify(it, null, 2)).join(",\n")}`, "ERR_UPDATER_CHANNEL_FILE_NOT_FOUND");
80
- }
81
-
82
- const channelFileUrl = new (_url().URL)(`https://dl.bintray.com/${this.client.owner}/${this.client.repo}/${channelFile.name}`);
83
- return (0, _Provider().parseUpdateInfo)((await this.httpRequest(channelFileUrl)), channelFilename, channelFileUrl);
84
- } catch (e) {
85
- if ("statusCode" in e && e.statusCode === 404) {
86
- throw (0, _builderUtilRuntime().newError)(`No latest version, please ensure that user, package and repository correctly configured. Or at least one version is published. ${e.stack || e.message}`, "ERR_UPDATER_LATEST_VERSION_NOT_FOUND");
87
- }
88
-
89
- throw e;
4
+ const builder_util_runtime_1 = require("builder-util-runtime");
5
+ const bintray_1 = require("builder-util-runtime/out/bintray");
6
+ const url_1 = require("url");
7
+ const util_1 = require("../util");
8
+ const Provider_1 = require("./Provider");
9
+ class BintrayProvider extends Provider_1.Provider {
10
+ constructor(configuration, runtimeOptions) {
11
+ super(runtimeOptions);
12
+ this.client = new bintray_1.BintrayClient(configuration, runtimeOptions.executor, new builder_util_runtime_1.CancellationToken());
13
+ this.baseUrl = util_1.newBaseUrl(`https://dl.bintray.com/${this.client.owner}/${this.client.repo}`);
90
14
  }
91
- }
92
-
93
- resolveFiles(updateInfo) {
94
- return (0, _Provider().resolveFiles)(updateInfo, this.baseUrl);
95
- }
96
-
97
- } exports.BintrayProvider = BintrayProvider;
98
- // __ts-babel@6.0.4
15
+ setRequestHeaders(value) {
16
+ super.setRequestHeaders(value);
17
+ this.client.setRequestHeaders(value);
18
+ }
19
+ async getLatestVersion() {
20
+ try {
21
+ const data = await this.client.getVersion("_latest");
22
+ const channelFilename = util_1.getChannelFilename(this.getDefaultChannelName());
23
+ const files = await this.client.getVersionFiles(data.name);
24
+ const channelFile = files.find(it => it.name.endsWith(`_${channelFilename}`) || it.name.endsWith(`-${channelFilename}`));
25
+ if (channelFile == null) {
26
+ // noinspection ExceptionCaughtLocallyJS
27
+ throw builder_util_runtime_1.newError(`Cannot find channel file "${channelFilename}", existing files:\n${files.map(it => JSON.stringify(it, null, 2)).join(",\n")}`, "ERR_UPDATER_CHANNEL_FILE_NOT_FOUND");
28
+ }
29
+ const channelFileUrl = new url_1.URL(`https://dl.bintray.com/${this.client.owner}/${this.client.repo}/${channelFile.name}`);
30
+ return Provider_1.parseUpdateInfo(await this.httpRequest(channelFileUrl), channelFilename, channelFileUrl);
31
+ }
32
+ catch (e) {
33
+ if ("statusCode" in e && e.statusCode === 404) {
34
+ throw builder_util_runtime_1.newError(`No latest version, please ensure that user, package and repository correctly configured. Or at least one version is published. ${e.stack || e.message}`, "ERR_UPDATER_LATEST_VERSION_NOT_FOUND");
35
+ }
36
+ throw e;
37
+ }
38
+ }
39
+ resolveFiles(updateInfo) {
40
+ return Provider_1.resolveFiles(updateInfo, this.baseUrl);
41
+ }
42
+ }
43
+ exports.BintrayProvider = BintrayProvider;
99
44
  //# sourceMappingURL=BintrayProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/providers/BintrayProvider.ts"],"names":[],"mappings":";;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEM,MAAO,eAAP,SAA+B,gBAA/B,CAAmD;AAIvD,EAAA,WAAA,CAAY,aAAZ,EAA2C,cAA3C,EAAiF;AAC/E,UAAM,cAAN;AAEA,SAAK,MAAL,GAAc,KAAI,wBAAJ,EAAkB,aAAlB,EAAiC,cAAc,CAAC,QAAhD,EAA0D,KAAI,uCAAJ,GAA1D,CAAd;AACA,SAAK,OAAL,GAAe,wBAAW,0BAA0B,KAAK,MAAL,CAAY,KAAK,IAAI,KAAK,MAAL,CAAY,IAAI,EAA1E,CAAf;AACD;;AAED,EAAA,iBAAiB,CAAC,KAAD,EAAW;AAC1B,UAAM,iBAAN,CAAwB,KAAxB;AACA,SAAK,MAAL,CAAY,iBAAZ,CAA8B,KAA9B;AACD;;AAED,QAAM,gBAAN,GAAsB;AACpB,QAAI;AACF,YAAM,IAAI,GAAG,MAAM,KAAK,MAAL,CAAY,UAAZ,CAAuB,SAAvB,CAAnB;AACA,YAAM,eAAe,GAAG,gCAAmB,KAAK,qBAAL,EAAnB,CAAxB;AACA,YAAM,KAAK,GAAG,MAAM,KAAK,MAAL,CAAY,eAAZ,CAA4B,IAAI,CAAC,IAAjC,CAApB;AACA,YAAM,WAAW,GAAG,KAAK,CAAC,IAAN,CAAW,EAAE,IAAI,EAAE,CAAC,IAAH,CAAQ,QAAR,CAAiB,IAAI,eAAe,EAApC,KAA2C,EAAE,CAAC,IAAH,CAAQ,QAAR,CAAiB,IAAI,eAAe,EAApC,CAA5D,CAApB;;AACA,UAAI,WAAW,IAAI,IAAnB,EAAyB;AACvB;AACA,cAAM,oCAAS,6BAA6B,eAAe,uBAAuB,KAAK,CAAC,GAAN,CAAU,EAAE,IAAI,IAAI,CAAC,SAAL,CAAe,EAAf,EAAmB,IAAnB,EAAyB,CAAzB,CAAhB,EAA6C,IAA7C,CAAkD,KAAlD,CAAwD,EAApI,EAAwI,oCAAxI,CAAN;AACD;;AAED,YAAM,cAAc,GAAG,KAAI,UAAJ,EAAQ,0BAA0B,KAAK,MAAL,CAAY,KAAK,IAAI,KAAK,MAAL,CAAY,IAAI,IAAI,WAAW,CAAC,IAAI,EAA3F,CAAvB;AACA,aAAO,kCAAgB,MAAM,KAAK,WAAL,CAAiB,cAAjB,CAAtB,GAAwD,eAAxD,EAAyE,cAAzE,CAAP;AACD,KAZD,CAaA,OAAO,CAAP,EAAU;AACR,UAAI,gBAAgB,CAAhB,IAAqB,CAAC,CAAC,UAAF,KAAiB,GAA1C,EAA+C;AAC7C,cAAM,oCAAS,kIAAkI,CAAC,CAAC,KAAF,IAAW,CAAC,CAAC,OAAO,EAA/J,EAAmK,sCAAnK,CAAN;AACD;;AACD,YAAM,CAAN;AACD;AACF;;AAED,EAAA,YAAY,CAAC,UAAD,EAAuB;AACjC,WAAO,8BAAa,UAAb,EAAyB,KAAK,OAA9B,CAAP;AACD;;AAxCsD,C","sourcesContent":["import { BintrayOptions, CancellationToken, newError, UpdateInfo } from \"builder-util-runtime\"\nimport { BintrayClient } from \"builder-util-runtime/out/bintray\"\nimport { URL } from \"url\"\nimport { getChannelFilename, newBaseUrl, Provider, ResolvedUpdateFileInfo } from \"../main\"\nimport { parseUpdateInfo, ProviderRuntimeOptions, resolveFiles } from \"./Provider\"\n\nexport class BintrayProvider extends Provider<UpdateInfo> {\n private client: BintrayClient\n private readonly baseUrl: URL\n\n constructor(configuration: BintrayOptions, runtimeOptions: ProviderRuntimeOptions) {\n super(runtimeOptions)\n\n this.client = new BintrayClient(configuration, runtimeOptions.executor, new CancellationToken())\n this.baseUrl = newBaseUrl(`https://dl.bintray.com/${this.client.owner}/${this.client.repo}`)\n }\n\n setRequestHeaders(value: any): void {\n super.setRequestHeaders(value)\n this.client.setRequestHeaders(value)\n }\n\n async getLatestVersion(): Promise<UpdateInfo> {\n try {\n const data = await this.client.getVersion(\"_latest\")\n const channelFilename = getChannelFilename(this.getDefaultChannelName())\n const files = await this.client.getVersionFiles(data.name)\n const channelFile = files.find(it => it.name.endsWith(`_${channelFilename}`) || it.name.endsWith(`-${channelFilename}`))\n if (channelFile == null) {\n // noinspection ExceptionCaughtLocallyJS\n throw newError(`Cannot find channel file \"${channelFilename}\", existing files:\\n${files.map(it => JSON.stringify(it, null, 2)).join(\",\\n\")}`, \"ERR_UPDATER_CHANNEL_FILE_NOT_FOUND\")\n }\n\n const channelFileUrl = new URL(`https://dl.bintray.com/${this.client.owner}/${this.client.repo}/${channelFile.name}`)\n return parseUpdateInfo(await this.httpRequest(channelFileUrl), channelFilename, channelFileUrl)\n }\n catch (e) {\n if (\"statusCode\" in e && e.statusCode === 404) {\n throw newError(`No latest version, please ensure that user, package and repository correctly configured. Or at least one version is published. ${e.stack || e.message}`, \"ERR_UPDATER_LATEST_VERSION_NOT_FOUND\")\n }\n throw e\n }\n }\n\n resolveFiles(updateInfo: UpdateInfo): Array<ResolvedUpdateFileInfo> {\n return resolveFiles(updateInfo, this.baseUrl)\n }\n}"],"sourceRoot":""}
1
+ {"version":3,"file":"BintrayProvider.js","sourceRoot":"","sources":["../../src/providers/BintrayProvider.ts"],"names":[],"mappings":";;;AAAA,+DAA8F;AAC9F,8DAAgE;AAChE,6BAAyB;AAEzB,kCAAwD;AACxD,yCAA4F;AAE5F,MAAa,eAAgB,SAAQ,mBAAoB;IAIvD,YAAY,aAA6B,EAAE,cAAsC;QAC/E,KAAK,CAAC,cAAc,CAAC,CAAA;QAErB,IAAI,CAAC,MAAM,GAAG,IAAI,uBAAa,CAAC,aAAa,EAAE,cAAc,CAAC,QAAQ,EAAE,IAAI,wCAAiB,EAAE,CAAC,CAAA;QAChG,IAAI,CAAC,OAAO,GAAG,iBAAU,CAAC,0BAA0B,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAA;IAC9F,CAAC;IAED,iBAAiB,CAAC,KAAU;QAC1B,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAA;QAC9B,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAA;IACtC,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,IAAI;YACF,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAA;YACpD,MAAM,eAAe,GAAG,yBAAkB,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC,CAAA;YACxE,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YAC1D,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,eAAe,EAAE,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,eAAe,EAAE,CAAC,CAAC,CAAA;YACxH,IAAI,WAAW,IAAI,IAAI,EAAE;gBACvB,wCAAwC;gBACxC,MAAM,+BAAQ,CACZ,6BAA6B,eAAe,uBAAuB,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,EAC7H,oCAAoC,CACrC,CAAA;aACF;YAED,MAAM,cAAc,GAAG,IAAI,SAAG,CAAC,0BAA0B,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,WAAW,CAAC,IAAI,EAAE,CAAC,CAAA;YACrH,OAAO,0BAAe,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,EAAE,eAAe,EAAE,cAAc,CAAC,CAAA;SAChG;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,YAAY,IAAI,CAAC,IAAI,CAAC,CAAC,UAAU,KAAK,GAAG,EAAE;gBAC7C,MAAM,+BAAQ,CACZ,kIAAkI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,OAAO,EAAE,EACxJ,sCAAsC,CACvC,CAAA;aACF;YACD,MAAM,CAAC,CAAA;SACR;IACH,CAAC;IAED,YAAY,CAAC,UAAsB;QACjC,OAAO,uBAAY,CAAC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;IAC/C,CAAC;CACF;AA9CD,0CA8CC","sourcesContent":["import { BintrayOptions, CancellationToken, newError, UpdateInfo } from \"builder-util-runtime\"\nimport { BintrayClient } from \"builder-util-runtime/out/bintray\"\nimport { URL } from \"url\"\nimport { ResolvedUpdateFileInfo } from \"../main\"\nimport { getChannelFilename, newBaseUrl } from \"../util\"\nimport { parseUpdateInfo, Provider, ProviderRuntimeOptions, resolveFiles } from \"./Provider\"\n\nexport class BintrayProvider extends Provider<UpdateInfo> {\n private client: BintrayClient\n private readonly baseUrl: URL\n\n constructor(configuration: BintrayOptions, runtimeOptions: ProviderRuntimeOptions) {\n super(runtimeOptions)\n\n this.client = new BintrayClient(configuration, runtimeOptions.executor, new CancellationToken())\n this.baseUrl = newBaseUrl(`https://dl.bintray.com/${this.client.owner}/${this.client.repo}`)\n }\n\n setRequestHeaders(value: any): void {\n super.setRequestHeaders(value)\n this.client.setRequestHeaders(value)\n }\n\n async getLatestVersion(): Promise<UpdateInfo> {\n try {\n const data = await this.client.getVersion(\"_latest\")\n const channelFilename = getChannelFilename(this.getDefaultChannelName())\n const files = await this.client.getVersionFiles(data.name)\n const channelFile = files.find(it => it.name.endsWith(`_${channelFilename}`) || it.name.endsWith(`-${channelFilename}`))\n if (channelFile == null) {\n // noinspection ExceptionCaughtLocallyJS\n throw newError(\n `Cannot find channel file \"${channelFilename}\", existing files:\\n${files.map(it => JSON.stringify(it, null, 2)).join(\",\\n\")}`,\n \"ERR_UPDATER_CHANNEL_FILE_NOT_FOUND\"\n )\n }\n\n const channelFileUrl = new URL(`https://dl.bintray.com/${this.client.owner}/${this.client.repo}/${channelFile.name}`)\n return parseUpdateInfo(await this.httpRequest(channelFileUrl), channelFilename, channelFileUrl)\n } catch (e) {\n if (\"statusCode\" in e && e.statusCode === 404) {\n throw newError(\n `No latest version, please ensure that user, package and repository correctly configured. Or at least one version is published. ${e.stack || e.message}`,\n \"ERR_UPDATER_LATEST_VERSION_NOT_FOUND\"\n )\n }\n throw e\n }\n }\n\n resolveFiles(updateInfo: UpdateInfo): Array<ResolvedUpdateFileInfo> {\n return resolveFiles(updateInfo, this.baseUrl)\n }\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  import { GenericServerOptions, UpdateInfo } from "builder-util-runtime";
2
2
  import { AppUpdater } from "../AppUpdater";
3
- import { Provider, ResolvedUpdateFileInfo } from "../main";
4
- import { ProviderRuntimeOptions } from "./Provider";
3
+ import { ResolvedUpdateFileInfo } from "../main";
4
+ import { Provider, ProviderRuntimeOptions } from "./Provider";
5
5
  export declare class GenericProvider extends Provider<UpdateInfo> {
6
6
  private readonly configuration;
7
7
  private readonly updater;
@@ -1,85 +1,51 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
2
+ Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.GenericProvider = void 0;
7
-
8
- function _builderUtilRuntime() {
9
- const data = require("builder-util-runtime");
10
-
11
- _builderUtilRuntime = function () {
12
- return data;
13
- };
14
-
15
- return data;
16
- }
17
-
18
- function _main() {
19
- const data = require("../main");
20
-
21
- _main = function () {
22
- return data;
23
- };
24
-
25
- return data;
26
- }
27
-
28
- function _Provider() {
29
- const data = require("./Provider");
30
-
31
- _Provider = function () {
32
- return data;
33
- };
34
-
35
- return data;
36
- }
37
-
38
- class GenericProvider extends _main().Provider {
39
- constructor(configuration, updater, runtimeOptions) {
40
- super(runtimeOptions);
41
- this.configuration = configuration;
42
- this.updater = updater;
43
- this.baseUrl = (0, _main().newBaseUrl)(this.configuration.url);
44
- }
45
-
46
- get channel() {
47
- const result = this.updater.channel || this.configuration.channel;
48
- return result == null ? this.getDefaultChannelName() : this.getCustomChannelName(result);
49
- }
50
-
51
- async getLatestVersion() {
52
- const channelFile = (0, _main().getChannelFilename)(this.channel);
53
- const channelUrl = (0, _main().newUrlFromBase)(channelFile, this.baseUrl, this.updater.isAddNoCacheQuery);
54
-
55
- for (let attemptNumber = 0;; attemptNumber++) {
56
- try {
57
- return (0, _Provider().parseUpdateInfo)((await this.httpRequest(channelUrl)), channelFile, channelUrl);
58
- } catch (e) {
59
- if (e instanceof _builderUtilRuntime().HttpError && e.statusCode === 404) {
60
- throw (0, _builderUtilRuntime().newError)(`Cannot find channel "${channelFile}" update info: ${e.stack || e.message}`, "ERR_UPDATER_CHANNEL_FILE_NOT_FOUND");
61
- } else if (e.code === "ECONNREFUSED") {
62
- if (attemptNumber < 3) {
63
- await new Promise((resolve, reject) => {
64
- try {
65
- setTimeout(resolve, 1000 * attemptNumber);
66
- } catch (e) {
67
- reject(e);
68
- }
69
- });
70
- continue;
71
- }
4
+ const builder_util_runtime_1 = require("builder-util-runtime");
5
+ const util_1 = require("../util");
6
+ const Provider_1 = require("./Provider");
7
+ class GenericProvider extends Provider_1.Provider {
8
+ constructor(configuration, updater, runtimeOptions) {
9
+ super(runtimeOptions);
10
+ this.configuration = configuration;
11
+ this.updater = updater;
12
+ this.baseUrl = util_1.newBaseUrl(this.configuration.url);
13
+ }
14
+ get channel() {
15
+ const result = this.updater.channel || this.configuration.channel;
16
+ return result == null ? this.getDefaultChannelName() : this.getCustomChannelName(result);
17
+ }
18
+ async getLatestVersion() {
19
+ const channelFile = util_1.getChannelFilename(this.channel);
20
+ const channelUrl = util_1.newUrlFromBase(channelFile, this.baseUrl, this.updater.isAddNoCacheQuery);
21
+ for (let attemptNumber = 0;; attemptNumber++) {
22
+ try {
23
+ return Provider_1.parseUpdateInfo(await this.httpRequest(channelUrl), channelFile, channelUrl);
24
+ }
25
+ catch (e) {
26
+ if (e instanceof builder_util_runtime_1.HttpError && e.statusCode === 404) {
27
+ throw builder_util_runtime_1.newError(`Cannot find channel "${channelFile}" update info: ${e.stack || e.message}`, "ERR_UPDATER_CHANNEL_FILE_NOT_FOUND");
28
+ }
29
+ else if (e.code === "ECONNREFUSED") {
30
+ if (attemptNumber < 3) {
31
+ await new Promise((resolve, reject) => {
32
+ try {
33
+ setTimeout(resolve, 1000 * attemptNumber);
34
+ }
35
+ catch (e) {
36
+ reject(e);
37
+ }
38
+ });
39
+ continue;
40
+ }
41
+ }
42
+ throw e;
43
+ }
72
44
  }
73
-
74
- throw e;
75
- }
76
45
  }
77
- }
78
-
79
- resolveFiles(updateInfo) {
80
- return (0, _Provider().resolveFiles)(updateInfo, this.baseUrl);
81
- }
82
-
83
- } exports.GenericProvider = GenericProvider;
84
- // __ts-babel@6.0.4
46
+ resolveFiles(updateInfo) {
47
+ return Provider_1.resolveFiles(updateInfo, this.baseUrl);
48
+ }
49
+ }
50
+ exports.GenericProvider = GenericProvider;
85
51
  //# sourceMappingURL=GenericProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/providers/GenericProvider.ts"],"names":[],"mappings":";;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEM,MAAO,eAAP,SAA+B,gBAA/B,CAAmD;AAGvD,EAAA,WAAA,CAA6B,aAA7B,EAAmF,OAAnF,EAAwG,cAAxG,EAA8I;AAC5I,UAAM,cAAN;AAD2B,SAAA,aAAA,GAAA,aAAA;AAAsD,SAAA,OAAA,GAAA,OAAA;AAFlE,SAAA,OAAA,GAAU,wBAAW,KAAK,aAAL,CAAmB,GAA9B,CAAV;AAIhB;;AAED,MAAY,OAAZ,GAAmB;AACjB,UAAM,MAAM,GAAG,KAAK,OAAL,CAAa,OAAb,IAAwB,KAAK,aAAL,CAAmB,OAA1D;AACA,WAAO,MAAM,IAAI,IAAV,GAAiB,KAAK,qBAAL,EAAjB,GAAgD,KAAK,oBAAL,CAA0B,MAA1B,CAAvD;AACD;;AAED,QAAM,gBAAN,GAAsB;AACpB,UAAM,WAAW,GAAG,gCAAmB,KAAK,OAAxB,CAApB;AACA,UAAM,UAAU,GAAG,4BAAe,WAAf,EAA4B,KAAK,OAAjC,EAA0C,KAAK,OAAL,CAAa,iBAAvD,CAAnB;;AACA,SAAK,IAAI,aAAa,GAAG,CAAzB,GAA8B,aAAa,EAA3C,EAA+C;AAC7C,UAAI;AACF,eAAO,kCAAgB,MAAM,KAAK,WAAL,CAAiB,UAAjB,CAAtB,GAAoD,WAApD,EAAiE,UAAjE,CAAP;AACD,OAFD,CAGA,OAAO,CAAP,EAAU;AACR,YAAI,CAAC,YAAY,+BAAb,IAA0B,CAAC,CAAC,UAAF,KAAiB,GAA/C,EAAoD;AAClD,gBAAM,oCAAS,wBAAwB,WAAW,kBAAkB,CAAC,CAAC,KAAF,IAAW,CAAC,CAAC,OAAO,EAAlF,EAAsF,oCAAtF,CAAN;AACD,SAFD,MAGK,IAAI,CAAC,CAAC,IAAF,KAAW,cAAf,EAA+B;AAClC,cAAI,aAAa,GAAG,CAApB,EAAuB;AACrB,kBAAM,IAAI,OAAJ,CAAY,CAAC,OAAD,EAAU,MAAV,KAAoB;AACpC,kBAAI;AACF,gBAAA,UAAU,CAAC,OAAD,EAAU,OAAO,aAAjB,CAAV;AACD,eAFD,CAGA,OAAO,CAAP,EAAU;AACR,gBAAA,MAAM,CAAC,CAAD,CAAN;AACD;AACF,aAPK,CAAN;AAQA;AACD;AACF;;AACD,cAAM,CAAN;AACD;AACF;AACF;;AAED,EAAA,YAAY,CAAC,UAAD,EAAuB;AACjC,WAAO,8BAAa,UAAb,EAAyB,KAAK,OAA9B,CAAP;AACD;;AA3CsD,C","sourcesContent":["import { GenericServerOptions, HttpError, newError, UpdateInfo } from \"builder-util-runtime\"\nimport { AppUpdater } from \"../AppUpdater\"\nimport { getChannelFilename, newBaseUrl, newUrlFromBase, Provider, ResolvedUpdateFileInfo } from \"../main\"\nimport { parseUpdateInfo, ProviderRuntimeOptions, resolveFiles } from \"./Provider\"\n\nexport class GenericProvider extends Provider<UpdateInfo> {\n private readonly baseUrl = newBaseUrl(this.configuration.url)\n\n constructor(private readonly configuration: GenericServerOptions, private readonly updater: AppUpdater, runtimeOptions: ProviderRuntimeOptions) {\n super(runtimeOptions)\n }\n\n private get channel(): string {\n const result = this.updater.channel || this.configuration.channel\n return result == null ? this.getDefaultChannelName() : this.getCustomChannelName(result)\n }\n\n async getLatestVersion(): Promise<UpdateInfo> {\n const channelFile = getChannelFilename(this.channel)\n const channelUrl = newUrlFromBase(channelFile, this.baseUrl, this.updater.isAddNoCacheQuery)\n for (let attemptNumber = 0; ; attemptNumber++) {\n try {\n return parseUpdateInfo(await this.httpRequest(channelUrl), channelFile, channelUrl)\n }\n catch (e) {\n if (e instanceof HttpError && e.statusCode === 404) {\n throw newError(`Cannot find channel \"${channelFile}\" update info: ${e.stack || e.message}`, \"ERR_UPDATER_CHANNEL_FILE_NOT_FOUND\")\n }\n else if (e.code === \"ECONNREFUSED\") {\n if (attemptNumber < 3) {\n await new Promise((resolve, reject) => {\n try {\n setTimeout(resolve, 1000 * attemptNumber)\n }\n catch (e) {\n reject(e)\n }\n })\n continue\n }\n }\n throw e\n }\n }\n }\n\n resolveFiles(updateInfo: UpdateInfo): Array<ResolvedUpdateFileInfo> {\n return resolveFiles(updateInfo, this.baseUrl)\n }\n}"],"sourceRoot":""}
1
+ {"version":3,"file":"GenericProvider.js","sourceRoot":"","sources":["../../src/providers/GenericProvider.ts"],"names":[],"mappings":";;;AAAA,+DAA4F;AAG5F,kCAAwE;AACxE,yCAA4F;AAE5F,MAAa,eAAgB,SAAQ,mBAAoB;IAGvD,YAA6B,aAAmC,EAAmB,OAAmB,EAAE,cAAsC;QAC5I,KAAK,CAAC,cAAc,CAAC,CAAA;QADM,kBAAa,GAAb,aAAa,CAAsB;QAAmB,YAAO,GAAP,OAAO,CAAY;QAFrF,YAAO,GAAG,iBAAU,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAA;IAI7D,CAAC;IAED,IAAY,OAAO;QACjB,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,IAAI,CAAC,aAAa,CAAC,OAAO,CAAA;QACjE,OAAO,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAA;IAC1F,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,MAAM,WAAW,GAAG,yBAAkB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QACpD,MAAM,UAAU,GAAG,qBAAc,CAAC,WAAW,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAA;QAC5F,KAAK,IAAI,aAAa,GAAG,CAAC,GAAI,aAAa,EAAE,EAAE;YAC7C,IAAI;gBACF,OAAO,0BAAe,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,WAAW,EAAE,UAAU,CAAC,CAAA;aACpF;YAAC,OAAO,CAAC,EAAE;gBACV,IAAI,CAAC,YAAY,gCAAS,IAAI,CAAC,CAAC,UAAU,KAAK,GAAG,EAAE;oBAClD,MAAM,+BAAQ,CAAC,wBAAwB,WAAW,kBAAkB,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,oCAAoC,CAAC,CAAA;iBAClI;qBAAM,IAAI,CAAC,CAAC,IAAI,KAAK,cAAc,EAAE;oBACpC,IAAI,aAAa,GAAG,CAAC,EAAE;wBACrB,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;4BACpC,IAAI;gCACF,UAAU,CAAC,OAAO,EAAE,IAAI,GAAG,aAAa,CAAC,CAAA;6BAC1C;4BAAC,OAAO,CAAC,EAAE;gCACV,MAAM,CAAC,CAAC,CAAC,CAAA;6BACV;wBACH,CAAC,CAAC,CAAA;wBACF,SAAQ;qBACT;iBACF;gBACD,MAAM,CAAC,CAAA;aACR;SACF;IACH,CAAC;IAED,YAAY,CAAC,UAAsB;QACjC,OAAO,uBAAY,CAAC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;IAC/C,CAAC;CACF;AAzCD,0CAyCC","sourcesContent":["import { GenericServerOptions, HttpError, newError, UpdateInfo } from \"builder-util-runtime\"\nimport { AppUpdater } from \"../AppUpdater\"\nimport { ResolvedUpdateFileInfo } from \"../main\"\nimport { getChannelFilename, newBaseUrl, newUrlFromBase } from \"../util\"\nimport { parseUpdateInfo, Provider, ProviderRuntimeOptions, resolveFiles } from \"./Provider\"\n\nexport class GenericProvider extends Provider<UpdateInfo> {\n private readonly baseUrl = newBaseUrl(this.configuration.url)\n\n constructor(private readonly configuration: GenericServerOptions, private readonly updater: AppUpdater, runtimeOptions: ProviderRuntimeOptions) {\n super(runtimeOptions)\n }\n\n private get channel(): string {\n const result = this.updater.channel || this.configuration.channel\n return result == null ? this.getDefaultChannelName() : this.getCustomChannelName(result)\n }\n\n async getLatestVersion(): Promise<UpdateInfo> {\n const channelFile = getChannelFilename(this.channel)\n const channelUrl = newUrlFromBase(channelFile, this.baseUrl, this.updater.isAddNoCacheQuery)\n for (let attemptNumber = 0; ; attemptNumber++) {\n try {\n return parseUpdateInfo(await this.httpRequest(channelUrl), channelFile, channelUrl)\n } catch (e) {\n if (e instanceof HttpError && e.statusCode === 404) {\n throw newError(`Cannot find channel \"${channelFile}\" update info: ${e.stack || e.message}`, \"ERR_UPDATER_CHANNEL_FILE_NOT_FOUND\")\n } else if (e.code === \"ECONNREFUSED\") {\n if (attemptNumber < 3) {\n await new Promise((resolve, reject) => {\n try {\n setTimeout(resolve, 1000 * attemptNumber)\n } catch (e) {\n reject(e)\n }\n })\n continue\n }\n }\n throw e\n }\n }\n }\n\n resolveFiles(updateInfo: UpdateInfo): Array<ResolvedUpdateFileInfo> {\n return resolveFiles(updateInfo, this.baseUrl)\n }\n}\n"]}
@@ -3,8 +3,8 @@ import { GithubOptions, ReleaseNoteInfo, UpdateInfo, XElement } from "builder-ut
3
3
  import * as semver from "semver";
4
4
  import { URL } from "url";
5
5
  import { AppUpdater } from "../AppUpdater";
6
- import { Provider, ResolvedUpdateFileInfo } from "../main";
7
- import { ProviderRuntimeOptions } from "./Provider";
6
+ import { ResolvedUpdateFileInfo } from "../main";
7
+ import { Provider, ProviderRuntimeOptions } from "./Provider";
8
8
  export declare abstract class BaseGitHubProvider<T extends UpdateInfo> extends Provider<T> {
9
9
  protected readonly options: GithubOptions;
10
10
  protected readonly baseUrl: URL;