@nordicsemiconductor/nrf-jlink-js 0.0.7 → 0.0.8

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/dist/common.js CHANGED
@@ -49,17 +49,22 @@ var fetchJSON = function (url) { return __awaiter(void 0, void 0, void 0, functi
49
49
  var _a, status, data;
50
50
  return __generator(this, function (_b) {
51
51
  switch (_b.label) {
52
- case 0: return [4 /*yield*/, axios_1.default.get(url, { responseType: 'json' })];
52
+ case 0: return [4 /*yield*/, axios_1.default.get(url, {
53
+ responseType: 'json',
54
+ headers: {
55
+ Range: 'bytes=0-',
56
+ },
57
+ })];
53
58
  case 1:
54
59
  _a = _b.sent(), status = _a.status, data = _a.data;
55
- if (status !== 200) {
60
+ if (status !== 200 && status !== 206) {
56
61
  throw new Error("Unable to fetch file from ".concat(indexUrl, ". Got status code ").concat(status, "."));
57
62
  }
58
63
  return [2 /*return*/, data];
59
64
  }
60
65
  });
61
66
  }); };
62
- var indexUrl = 'https://files.nordicsemi.com/artifactory/swtools/external/ncd/jlink/index.json';
67
+ var indexUrl = 'https://files.nordicsemi.com/ui/api/v1/download?isNativeBrowsing=true&repoKey=swtools&path=external/ncd/jlink/index.json';
63
68
  var fetchIndex = function () { return __awaiter(void 0, void 0, void 0, function () {
64
69
  var res;
65
70
  return __generator(this, function (_a) {
package/dist/jlink.js CHANGED
@@ -122,6 +122,9 @@ var downloadJLink = function (_a, onUpdate_1, destinationFilePath_1) { return __
122
122
  }
123
123
  return [4 /*yield*/, axios_1.default.get(url, {
124
124
  responseType: 'stream',
125
+ headers: {
126
+ Range: 'bytes=0-',
127
+ },
125
128
  onDownloadProgress: function (_a) {
126
129
  var loaded = _a.loaded, total = _a.total;
127
130
  return loaded &&
@@ -134,7 +137,7 @@ var downloadJLink = function (_a, onUpdate_1, destinationFilePath_1) { return __
134
137
  })];
135
138
  case 1:
136
139
  _c = _e.sent(), status = _c.status, stream = _c.data;
137
- if (status !== 200) {
140
+ if (status !== 200 && status !== 206) {
138
141
  throw new Error("Unable to download ".concat(url, ". Got status code ").concat(status, "."));
139
142
  }
140
143
  return [4 /*yield*/, (0, common_1.saveToFile)(stream, destinationFilePath || path_1.default.join(os_1.default.tmpdir(), path_1.default.basename(url)))];
@@ -211,11 +214,7 @@ var getVersionToInstall = function (fallbackVersion) { return __awaiter(void 0,
211
214
  });
212
215
  }); };
213
216
  exports.getVersionToInstall = getVersionToInstall;
214
- var downloadAndSaveJLink = function (destination, onUpdate) {
215
- return (0, common_1.fetchIndex)().then(function (v) {
216
- return downloadJLink(v, onUpdate, destination);
217
- });
218
- };
217
+ var downloadAndSaveJLink = function (destination, onUpdate) { return (0, common_1.fetchIndex)().then(function (v) { return downloadJLink(v, onUpdate, destination); }); };
219
218
  exports.downloadAndSaveJLink = downloadAndSaveJLink;
220
219
  var downloadAndInstallJLink = function (onUpdate) {
221
220
  return (0, common_1.fetchIndex)()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nordicsemiconductor/nrf-jlink-js",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "main": "dist",
5
5
  "types": "dist",
6
6
  "files": [