balena-cli 22.0.3 → 22.0.4

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/CHANGELOG.md CHANGED
@@ -4,7 +4,12 @@ All notable changes to this project will be documented in this file
4
4
  automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY!
5
5
  This project adheres to [Semantic Versioning](http://semver.org/).
6
6
 
7
- ## 22.0.3 - 2025-05-28
7
+ ## 22.0.4 - 2025-05-29
8
+
9
+ * tests: Replace request with got [Otavio Jacobi]
10
+ * deploy-legacy: Replace request with got [Otavio Jacobi]
11
+
12
+ ## 22.0.3 - 2025-05-29
8
13
 
9
14
  * Bump sentry to v9 [Otavio Jacobi]
10
15
 
@@ -58,10 +58,10 @@ const uploadToPromise = (uploadRequest, logger) => new Promise(function (resolve
58
58
  }
59
59
  });
60
60
  });
61
- const uploadImage = function (imageStream, token, username, url, appName, logger) {
62
- const request = require('request');
63
- const progressStream = require('progress-stream');
64
- const zlib = require('zlib');
61
+ const uploadImage = async function (imageStream, token, username, url, appName, logger) {
62
+ const { default: got } = await Promise.resolve().then(() => require('got'));
63
+ const progressStream = await Promise.resolve().then(() => require('progress-stream'));
64
+ const zlib = await Promise.resolve().then(() => require('zlib'));
65
65
  const progressMessage = logger
66
66
  .formatMessage('info', 'Uploading')
67
67
  .slice(0, -1);
@@ -73,29 +73,27 @@ const uploadImage = function (imageStream, token, username, url, appName, logger
73
73
  percentage: Math.min(percentage, 100),
74
74
  eta,
75
75
  })));
76
- const uploadRequest = request.post({
77
- url: getBuilderPushEndpoint(url, username, appName),
76
+ const uploadRequest = got.stream.post(getBuilderPushEndpoint(url, username, appName), {
78
77
  headers: {
79
78
  'Content-Encoding': 'gzip',
80
- },
81
- auth: {
82
- bearer: token,
79
+ Authorization: `Bearer ${token}`,
83
80
  },
84
81
  body: streamWithProgress.pipe(zlib.createGzip({
85
82
  level: 6,
86
83
  })),
84
+ throwHttpErrors: false,
87
85
  });
88
86
  return uploadToPromise(uploadRequest, logger);
89
87
  };
90
- const uploadLogs = function (logs, token, url, buildId, username, appName) {
91
- const request = require('request');
92
- return request.post({
93
- json: true,
94
- url: getBuilderLogPushEndpoint(url, buildId, username, appName),
95
- auth: {
96
- bearer: token,
88
+ const uploadLogs = async function (logs, token, url, buildId, username, appName) {
89
+ const { default: got } = await Promise.resolve().then(() => require('got'));
90
+ return got.post(getBuilderLogPushEndpoint(url, buildId, username, appName), {
91
+ headers: {
92
+ Authorization: `Bearer ${token}`,
97
93
  },
98
94
  body: Buffer.from(logs),
95
+ responseType: 'json',
96
+ throwHttpErrors: false,
99
97
  });
100
98
  };
101
99
  const deployLegacy = async function (docker, logger, token, username, url, opts) {
@@ -121,7 +119,7 @@ const deployLegacy = async function (docker, logger, token, username, url, opts)
121
119
  username,
122
120
  appName,
123
121
  ]);
124
- uploadLogs(...args);
122
+ await uploadLogs(...args);
125
123
  }
126
124
  return buildId;
127
125
  };
@@ -1 +1 @@
1
- {"version":3,"file":"deploy-legacy.js","sourceRoot":"","sources":["../../src/utils/deploy-legacy.ts"],"names":[],"mappings":";;;AAiBA,iCAAoC;AACpC,+BAAiC;AAKjC,MAAM,sBAAsB,GAAG,UAC9B,OAAe,EACf,KAAa,EACb,GAAW;IAEX,MAAM,WAAW,GAAG,OAAO,CAAC,aAAa,CAAiC,CAAC;IAC3E,MAAM,IAAI,GAAG,WAAW,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;IACnD,OAAO,mBAAmB,OAAO,YAAY,IAAI,EAAE,CAAC;AACrD,CAAC,CAAC;AAEF,MAAM,yBAAyB,GAAG,UACjC,OAAe,EACf,OAAe,EACf,KAAa,EACb,GAAW;IAEX,MAAM,WAAW,GAAG,OAAO,CAAC,aAAa,CAAiC,CAAC;IAC3E,MAAM,IAAI,GAAG,WAAW,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC;IAC5D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U,CAAC;SAClE,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAChB,WAAW,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,CAAC,CAC1D;SACA,OAAO,CAAC,GAAG,EAAE,CAKZ,OAAO,CAAC,IAAI,CAAyB,CAAC,QAAQ;SAC7C,MAAM,CAAC,UAAU,CAAC;SAClB,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CACxB,CAAC;IAEH,IAAI,gBAAgB,EAAE,CAAC;QACtB,MAAM,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;QACpC,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YAC9B,IAAI;YACJ,KAAK;YACL,GAAG;YACH,OAAO;YACP,QAAQ;YACR,OAAO;SACP,CAAC,CAAC;QACH,MAAM,UAAU,CAAC,GAAG,IAAI,CAAC,CAAC;IAC3B,CAAC;IAED,OAAO,OAAO,CAAC;AAChB,CAAC,CAAC;AArDW,QAAA,YAAY,gBAqDvB"}
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "balena-cli",
3
- "version": "22.0.3",
3
+ "version": "22.0.4",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "balena-cli",
9
- "version": "22.0.3",
9
+ "version": "22.0.4",
10
10
  "hasInstallScript": true,
11
11
  "license": "Apache-2.0",
12
12
  "dependencies": {
@@ -113,25 +113,25 @@
113
113
  "revoke.js"
114
114
  ]
115
115
  },
116
- "app:create": {
116
+ "block:create": {
117
117
  "aliases": [],
118
118
  "args": {
119
119
  "name": {
120
- "description": "app name",
120
+ "description": "block name",
121
121
  "name": "name",
122
122
  "required": true
123
123
  }
124
124
  },
125
- "description": "Create an app.\n\nCreate a new balena app.\n\nYou can specify the organization the app should belong to using\nthe `--organization` option. The organization's handle, not its name,\nshould be provided. Organization handles can be listed with the\n`balena organization list` command.\n\nThe app's default device type is specified with the `--type` option.\nThe `balena device-type list` command can be used to list the available\ndevice types.\n\nInteractive dropdowns will be shown for selection if no device type or\norganization is specified and there are multiple options to choose from.\nIf there is a single option to choose from, it will be chosen automatically.\nThis interactive behavior can be disabled by explicitly specifying a device\ntype and organization.",
125
+ "description": "Create an block.\n\nCreate a new balena block.\n\nYou can specify the organization the block should belong to using\nthe `--organization` option. The organization's handle, not its name,\nshould be provided. Organization handles can be listed with the\n`balena organization list` command.\n\nThe block's default device type is specified with the `--type` option.\nThe `balena device-type list` command can be used to list the available\ndevice types.\n\nInteractive dropdowns will be shown for selection if no device type or\norganization is specified and there are multiple options to choose from.\nIf there is a single option to choose from, it will be chosen automatically.\nThis interactive behavior can be disabled by explicitly specifying a device\ntype and organization.",
126
126
  "examples": [
127
- "$ balena app create MyApp",
128
- "$ balena app create MyApp --organization mmyorg",
129
- "$ balena app create MyApp -o myorg --type raspberry-pi"
127
+ "$ balena block create MyBlock",
128
+ "$ balena block create MyBlock --organization mmyorg",
129
+ "$ balena block create MyBlock -o myorg --type raspberry-pi"
130
130
  ],
131
131
  "flags": {
132
132
  "organization": {
133
133
  "char": "o",
134
- "description": "handle of the organization the app should belong to",
134
+ "description": "handle of the organization the block should belong to",
135
135
  "name": "organization",
136
136
  "hasDynamicHelp": false,
137
137
  "multiple": false,
@@ -139,7 +139,7 @@
139
139
  },
140
140
  "type": {
141
141
  "char": "t",
142
- "description": "app device type (Check available types with `balena device-type list`)",
142
+ "description": "block device type (Check available types with `balena device-type list`)",
143
143
  "name": "type",
144
144
  "hasDynamicHelp": false,
145
145
  "multiple": false,
@@ -148,7 +148,7 @@
148
148
  },
149
149
  "hasDynamicHelp": false,
150
150
  "hiddenAliases": [],
151
- "id": "app:create",
151
+ "id": "block:create",
152
152
  "pluginAlias": "balena-cli",
153
153
  "pluginName": "balena-cli",
154
154
  "pluginType": "core",
@@ -159,29 +159,29 @@
159
159
  "relativePath": [
160
160
  "build",
161
161
  "commands",
162
- "app",
162
+ "block",
163
163
  "create.js"
164
164
  ]
165
165
  },
166
- "block:create": {
166
+ "app:create": {
167
167
  "aliases": [],
168
168
  "args": {
169
169
  "name": {
170
- "description": "block name",
170
+ "description": "app name",
171
171
  "name": "name",
172
172
  "required": true
173
173
  }
174
174
  },
175
- "description": "Create an block.\n\nCreate a new balena block.\n\nYou can specify the organization the block should belong to using\nthe `--organization` option. The organization's handle, not its name,\nshould be provided. Organization handles can be listed with the\n`balena organization list` command.\n\nThe block's default device type is specified with the `--type` option.\nThe `balena device-type list` command can be used to list the available\ndevice types.\n\nInteractive dropdowns will be shown for selection if no device type or\norganization is specified and there are multiple options to choose from.\nIf there is a single option to choose from, it will be chosen automatically.\nThis interactive behavior can be disabled by explicitly specifying a device\ntype and organization.",
175
+ "description": "Create an app.\n\nCreate a new balena app.\n\nYou can specify the organization the app should belong to using\nthe `--organization` option. The organization's handle, not its name,\nshould be provided. Organization handles can be listed with the\n`balena organization list` command.\n\nThe app's default device type is specified with the `--type` option.\nThe `balena device-type list` command can be used to list the available\ndevice types.\n\nInteractive dropdowns will be shown for selection if no device type or\norganization is specified and there are multiple options to choose from.\nIf there is a single option to choose from, it will be chosen automatically.\nThis interactive behavior can be disabled by explicitly specifying a device\ntype and organization.",
176
176
  "examples": [
177
- "$ balena block create MyBlock",
178
- "$ balena block create MyBlock --organization mmyorg",
179
- "$ balena block create MyBlock -o myorg --type raspberry-pi"
177
+ "$ balena app create MyApp",
178
+ "$ balena app create MyApp --organization mmyorg",
179
+ "$ balena app create MyApp -o myorg --type raspberry-pi"
180
180
  ],
181
181
  "flags": {
182
182
  "organization": {
183
183
  "char": "o",
184
- "description": "handle of the organization the block should belong to",
184
+ "description": "handle of the organization the app should belong to",
185
185
  "name": "organization",
186
186
  "hasDynamicHelp": false,
187
187
  "multiple": false,
@@ -189,7 +189,7 @@
189
189
  },
190
190
  "type": {
191
191
  "char": "t",
192
- "description": "block device type (Check available types with `balena device-type list`)",
192
+ "description": "app device type (Check available types with `balena device-type list`)",
193
193
  "name": "type",
194
194
  "hasDynamicHelp": false,
195
195
  "multiple": false,
@@ -198,7 +198,7 @@
198
198
  },
199
199
  "hasDynamicHelp": false,
200
200
  "hiddenAliases": [],
201
- "id": "block:create",
201
+ "id": "app:create",
202
202
  "pluginAlias": "balena-cli",
203
203
  "pluginName": "balena-cli",
204
204
  "pluginType": "core",
@@ -209,7 +209,7 @@
209
209
  "relativePath": [
210
210
  "build",
211
211
  "commands",
212
- "block",
212
+ "app",
213
213
  "create.js"
214
214
  ]
215
215
  },
@@ -982,49 +982,6 @@
982
982
  "index.js"
983
983
  ]
984
984
  },
985
- "device-type:list": {
986
- "aliases": [
987
- "devices supported"
988
- ],
989
- "args": {},
990
- "deprecateAliases": true,
991
- "description": "List the device types supported by balena (like 'raspberrypi3' or 'intel-nuc').\n\nList the device types supported by balena (like 'raspberrypi3' or 'intel-nuc').\n\nBy default, only actively supported device types are listed.\nThe --all option can be used to list all device types, including those that are\nno longer supported by balena.\n\nThe --json option is recommended when scripting the output of this command,\nbecause the JSON format is less likely to change and it better represents data\ntypes like lists and empty strings (for example, the ALIASES column contains a\nlist of zero or more values). The 'jq' utility may be helpful in shell scripts\n(https://stedolan.github.io/jq/manual/).",
992
- "examples": [
993
- "$ balena device-type list",
994
- "$ balena device-type list --all",
995
- "$ balena device-type list --json"
996
- ],
997
- "flags": {
998
- "json": {
999
- "char": "j",
1000
- "description": "produce JSON output instead of tabular output",
1001
- "name": "json",
1002
- "allowNo": false,
1003
- "type": "boolean"
1004
- },
1005
- "all": {
1006
- "description": "include device types no longer supported by balena",
1007
- "name": "all",
1008
- "allowNo": false,
1009
- "type": "boolean"
1010
- }
1011
- },
1012
- "hasDynamicHelp": false,
1013
- "hiddenAliases": [],
1014
- "id": "device-type:list",
1015
- "pluginAlias": "balena-cli",
1016
- "pluginName": "balena-cli",
1017
- "pluginType": "core",
1018
- "strict": true,
1019
- "enableJsonFlag": false,
1020
- "isESM": false,
1021
- "relativePath": [
1022
- "build",
1023
- "commands",
1024
- "device-type",
1025
- "list.js"
1026
- ]
1027
- },
1028
985
  "device:deactivate": {
1029
986
  "aliases": [],
1030
987
  "args": {
@@ -2267,6 +2224,49 @@
2267
2224
  "tunnel.js"
2268
2225
  ]
2269
2226
  },
2227
+ "device-type:list": {
2228
+ "aliases": [
2229
+ "devices supported"
2230
+ ],
2231
+ "args": {},
2232
+ "deprecateAliases": true,
2233
+ "description": "List the device types supported by balena (like 'raspberrypi3' or 'intel-nuc').\n\nList the device types supported by balena (like 'raspberrypi3' or 'intel-nuc').\n\nBy default, only actively supported device types are listed.\nThe --all option can be used to list all device types, including those that are\nno longer supported by balena.\n\nThe --json option is recommended when scripting the output of this command,\nbecause the JSON format is less likely to change and it better represents data\ntypes like lists and empty strings (for example, the ALIASES column contains a\nlist of zero or more values). The 'jq' utility may be helpful in shell scripts\n(https://stedolan.github.io/jq/manual/).",
2234
+ "examples": [
2235
+ "$ balena device-type list",
2236
+ "$ balena device-type list --all",
2237
+ "$ balena device-type list --json"
2238
+ ],
2239
+ "flags": {
2240
+ "json": {
2241
+ "char": "j",
2242
+ "description": "produce JSON output instead of tabular output",
2243
+ "name": "json",
2244
+ "allowNo": false,
2245
+ "type": "boolean"
2246
+ },
2247
+ "all": {
2248
+ "description": "include device types no longer supported by balena",
2249
+ "name": "all",
2250
+ "allowNo": false,
2251
+ "type": "boolean"
2252
+ }
2253
+ },
2254
+ "hasDynamicHelp": false,
2255
+ "hiddenAliases": [],
2256
+ "id": "device-type:list",
2257
+ "pluginAlias": "balena-cli",
2258
+ "pluginName": "balena-cli",
2259
+ "pluginType": "core",
2260
+ "strict": true,
2261
+ "enableJsonFlag": false,
2262
+ "isESM": false,
2263
+ "relativePath": [
2264
+ "build",
2265
+ "commands",
2266
+ "device-type",
2267
+ "list.js"
2268
+ ]
2269
+ },
2270
2270
  "env:list": {
2271
2271
  "aliases": [
2272
2272
  "envs"
@@ -4716,5 +4716,5 @@
4716
4716
  ]
4717
4717
  }
4718
4718
  },
4719
- "version": "22.0.3"
4719
+ "version": "22.0.4"
4720
4720
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "balena-cli",
3
- "version": "22.0.3",
3
+ "version": "22.0.4",
4
4
  "description": "The official balena Command Line Interface",
5
5
  "main": "./build/app.js",
6
6
  "homepage": "https://github.com/balena-io/balena-cli",
@@ -250,6 +250,6 @@
250
250
  }
251
251
  },
252
252
  "versionist": {
253
- "publishedAt": "2025-05-28T23:30:59.367Z"
253
+ "publishedAt": "2025-05-29T12:37:10.943Z"
254
254
  }
255
255
  }
@@ -19,7 +19,7 @@ import { getVisuals } from './lazy';
19
19
  import { promisify } from 'util';
20
20
  import type * as Dockerode from 'dockerode';
21
21
  import type Logger = require('./logger');
22
- import type { Request } from 'request';
22
+ import type got from 'got';
23
23
 
24
24
  const getBuilderPushEndpoint = function (
25
25
  baseUrl: string,
@@ -75,7 +75,10 @@ const showPushProgress = function (message: string) {
75
75
  return progressBar;
76
76
  };
77
77
 
78
- const uploadToPromise = (uploadRequest: Request, logger: Logger) =>
78
+ const uploadToPromise = (
79
+ uploadRequest: ReturnType<typeof got.stream.post>,
80
+ logger: Logger,
81
+ ) =>
79
82
  new Promise<{ buildId: number }>(function (resolve, reject) {
80
83
  uploadRequest.on('error', reject).on('data', function handleMessage(data) {
81
84
  let obj;
@@ -106,10 +109,7 @@ const uploadToPromise = (uploadRequest: Request, logger: Logger) =>
106
109
  });
107
110
  });
108
111
 
109
- /**
110
- * @returns {Promise<{ buildId: number }>}
111
- */
112
- const uploadImage = function (
112
+ const uploadImage = async function (
113
113
  imageStream: NodeJS.ReadableStream & { length: number },
114
114
  token: string,
115
115
  username: string,
@@ -117,10 +117,9 @@ const uploadImage = function (
117
117
  appName: string,
118
118
  logger: Logger,
119
119
  ): Promise<{ buildId: number }> {
120
- const request = require('request') as typeof import('request');
121
- const progressStream =
122
- require('progress-stream') as typeof import('progress-stream');
123
- const zlib = require('zlib') as typeof import('zlib');
120
+ const { default: got } = await import('got');
121
+ const progressStream = await import('progress-stream');
122
+ const zlib = await import('zlib');
124
123
 
125
124
  // Need to strip off the newline
126
125
  const progressMessage = logger
@@ -141,25 +140,26 @@ const uploadImage = function (
141
140
  ),
142
141
  );
143
142
 
144
- const uploadRequest = request.post({
145
- url: getBuilderPushEndpoint(url, username, appName),
146
- headers: {
147
- 'Content-Encoding': 'gzip',
148
- },
149
- auth: {
150
- bearer: token,
143
+ const uploadRequest = got.stream.post(
144
+ getBuilderPushEndpoint(url, username, appName),
145
+ {
146
+ headers: {
147
+ 'Content-Encoding': 'gzip',
148
+ Authorization: `Bearer ${token}`,
149
+ },
150
+ body: streamWithProgress.pipe(
151
+ zlib.createGzip({
152
+ level: 6,
153
+ }),
154
+ ),
155
+ throwHttpErrors: false,
151
156
  },
152
- body: streamWithProgress.pipe(
153
- zlib.createGzip({
154
- level: 6,
155
- }),
156
- ),
157
- });
157
+ );
158
158
 
159
159
  return uploadToPromise(uploadRequest, logger);
160
160
  };
161
161
 
162
- const uploadLogs = function (
162
+ const uploadLogs = async function (
163
163
  logs: string,
164
164
  token: string,
165
165
  url: string,
@@ -167,14 +167,14 @@ const uploadLogs = function (
167
167
  username: string,
168
168
  appName: string,
169
169
  ) {
170
- const request = require('request') as typeof import('request');
171
- return request.post({
172
- json: true,
173
- url: getBuilderLogPushEndpoint(url, buildId, username, appName),
174
- auth: {
175
- bearer: token,
170
+ const { default: got } = await import('got');
171
+ return got.post(getBuilderLogPushEndpoint(url, buildId, username, appName), {
172
+ headers: {
173
+ Authorization: `Bearer ${token}`,
176
174
  },
177
175
  body: Buffer.from(logs),
176
+ responseType: 'json',
177
+ throwHttpErrors: false,
178
178
  });
179
179
  };
180
180
 
@@ -232,7 +232,7 @@ export const deployLegacy = async function (
232
232
  username,
233
233
  appName,
234
234
  ]);
235
- uploadLogs(...args);
235
+ await uploadLogs(...args);
236
236
  }
237
237
 
238
238
  return buildId;