balena-sdk 16.9.1 → 16.9.2

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.
@@ -805,7 +805,7 @@ const getAuth = function (deps, opts) {
805
805
  };
806
806
  exports.default = getAuth;
807
807
 
808
- },{"./2fa":1,"./util/callbacks":31,"balena-errors":58,"memoizee":332,"tslib":470}],3:[function(require,module,exports){
808
+ },{"./2fa":1,"./util/callbacks":32,"balena-errors":59,"memoizee":332,"tslib":470}],3:[function(require,module,exports){
809
809
  "use strict";
810
810
  /*
811
811
  Copyright 2016 Balena
@@ -887,7 +887,7 @@ const getSdk = function ($opts) {
887
887
  const { getRequest } = require('balena-request');
888
888
  const BalenaAuth = require('balena-auth')
889
889
  .default;
890
- const { BalenaPine } = require('balena-pine');
890
+ const { createPinejsClient } = require('./pine');
891
891
  const errors = require('balena-errors');
892
892
  const { PubSub } = require('./util/pubsub');
893
893
  /**
@@ -929,7 +929,7 @@ const getSdk = function ($opts) {
929
929
  }
930
930
  const auth = new BalenaAuth(opts);
931
931
  const request = getRequest(Object.assign(Object.assign({}, opts), { auth }));
932
- const pine = new BalenaPine({}, Object.assign(Object.assign({}, opts), { auth, request }));
932
+ const pine = createPinejsClient({}, Object.assign(Object.assign({}, opts), { auth, request }));
933
933
  const pubsub = new PubSub();
934
934
  const sdk = {};
935
935
  const deps = {
@@ -1047,7 +1047,7 @@ const getSdk = function ($opts) {
1047
1047
  * @memberof balena
1048
1048
  *
1049
1049
  * @description
1050
- * The balena-pine instance used internally. This should not be necessary
1050
+ * The pinejs-client instance used internally. This should not be necessary
1051
1051
  * in normal usage, but can be useful if you want to directly make pine
1052
1052
  * queries to the api for some resource that isn't directly supported
1053
1053
  * in the SDK.
@@ -1148,7 +1148,7 @@ const fromSharedOptions = function () {
1148
1148
  };
1149
1149
  exports.fromSharedOptions = fromSharedOptions;
1150
1150
 
1151
- },{"./auth":2,"./logs":4,"./models":15,"./settings":23,"./types/contract":24,"./types/jwt":27,"./types/models":28,"./util":42,"./util/callbacks":31,"./util/global-env":41,"./util/pubsub":44,"./util/sdk-version":45,"balena-auth":55,"balena-errors":58,"balena-pine":62,"balena-request":65,"balena-settings-client":undefined,"tslib":470}],4:[function(require,module,exports){
1151
+ },{"./auth":2,"./logs":4,"./models":15,"./pine":23,"./settings":24,"./types/contract":25,"./types/jwt":28,"./types/models":29,"./util":43,"./util/callbacks":32,"./util/global-env":42,"./util/pubsub":45,"./util/sdk-version":46,"balena-auth":56,"balena-errors":59,"balena-request":65,"balena-settings-client":undefined,"tslib":470}],4:[function(require,module,exports){
1152
1152
  "use strict";
1153
1153
  /*
1154
1154
  Copyright 2016 Balena
@@ -1366,7 +1366,7 @@ const getLogs = function (deps, opts) {
1366
1366
  };
1367
1367
  exports.default = getLogs;
1368
1368
 
1369
- },{"./models/device":12,"./util/global-env":41,"abortcontroller-polyfill/dist/cjs-ponyfill":49,"events":76,"ndjson":345,"tslib":470}],5:[function(require,module,exports){
1369
+ },{"./models/device":12,"./util/global-env":42,"abortcontroller-polyfill/dist/cjs-ponyfill":50,"events":76,"ndjson":345,"tslib":470}],5:[function(require,module,exports){
1370
1370
  "use strict";
1371
1371
  Object.defineProperty(exports, "__esModule", { value: true });
1372
1372
  const tslib_1 = require("tslib");
@@ -1666,7 +1666,7 @@ const getApiKeysModel = function (deps, opts) {
1666
1666
  };
1667
1667
  exports.default = getApiKeysModel;
1668
1668
 
1669
- },{"../util":42,"./application":8,"./device":12,"balena-errors":58,"lodash/once":314,"tslib":470}],6:[function(require,module,exports){
1669
+ },{"../util":43,"./application":8,"./device":12,"balena-errors":59,"lodash/once":314,"tslib":470}],6:[function(require,module,exports){
1670
1670
  "use strict";
1671
1671
  /*
1672
1672
  Copyright 2020 Balena
@@ -1891,7 +1891,7 @@ const getApplicationInviteModel = function (deps, opts, getApplication) {
1891
1891
  };
1892
1892
  exports.default = getApplicationInviteModel;
1893
1893
 
1894
- },{"../util":42,"balena-errors":58,"tslib":470}],7:[function(require,module,exports){
1894
+ },{"../util":43,"balena-errors":59,"tslib":470}],7:[function(require,module,exports){
1895
1895
  "use strict";
1896
1896
  /*
1897
1897
  Copyright 2020 Balena
@@ -2167,7 +2167,7 @@ const getApplicationMembershipModel = function (deps, getApplication) {
2167
2167
  };
2168
2168
  exports.default = getApplicationMembershipModel;
2169
2169
 
2170
- },{"../util":42,"balena-errors":58,"tslib":470}],8:[function(require,module,exports){
2170
+ },{"../util":43,"balena-errors":59,"tslib":470}],8:[function(require,module,exports){
2171
2171
  "use strict";
2172
2172
  /*
2173
2173
  Copyright 2016 Balena
@@ -3969,7 +3969,7 @@ const getApplicationModel = function (deps, opts) {
3969
3969
  };
3970
3970
  exports.default = getApplicationModel;
3971
3971
 
3972
- },{"../util":42,"../util/callbacks":31,"../util/dependent-resource":33,"../util/device-os-version":37,"../util/device-service-details":38,"./application-invite":6,"./application-membership":7,"./device":12,"./release":21,"balena-errors":58,"lodash/once":314,"tslib":470,"url":477}],9:[function(require,module,exports){
3972
+ },{"../util":43,"../util/callbacks":32,"../util/dependent-resource":34,"../util/device-os-version":38,"../util/device-service-details":39,"./application-invite":6,"./application-membership":7,"./device":12,"./release":21,"balena-errors":59,"lodash/once":314,"tslib":470,"url":477}],9:[function(require,module,exports){
3973
3973
  "use strict";
3974
3974
  /*
3975
3975
  Copyright 2016 Balena
@@ -4673,7 +4673,7 @@ const getDeviceTypeModel = function (deps) {
4673
4673
  };
4674
4674
  exports.default = getDeviceTypeModel;
4675
4675
 
4676
- },{"../util":42,"balena-errors":58,"tslib":470}],12:[function(require,module,exports){
4676
+ },{"../util":43,"balena-errors":59,"tslib":470}],12:[function(require,module,exports){
4677
4677
  "use strict";
4678
4678
  /*
4679
4679
  Copyright 2016 Balena
@@ -7640,7 +7640,7 @@ const getDeviceModel = function (deps, opts) {
7640
7640
  };
7641
7641
  exports.default = getDeviceModel;
7642
7642
 
7643
- },{"../types/device-overall-status":25,"../types/device-state":26,"../util":42,"../util/callbacks":31,"../util/date":32,"../util/dependent-resource":33,"../util/device-actions/os-update":35,"../util/device-actions/os-update/utils":36,"../util/device-os-version":37,"../util/device-service-details":38,"../util/device-types":39,"../util/local-mode":43,"../util/types":46,"./application":8,"./config":10,"./device.supervisor-api.partial":13,"./os":20,"./release":21,"balena-errors":58,"balena-register-device":63,"balena-semver":67,"lodash/chunk":290,"lodash/flatten":294,"lodash/groupBy":296,"lodash/once":314,"memoizee":332,"tslib":470,"url":477}],13:[function(require,module,exports){
7643
+ },{"../types/device-overall-status":26,"../types/device-state":27,"../util":43,"../util/callbacks":32,"../util/date":33,"../util/dependent-resource":34,"../util/device-actions/os-update":36,"../util/device-actions/os-update/utils":37,"../util/device-os-version":38,"../util/device-service-details":39,"../util/device-types":40,"../util/local-mode":44,"../util/types":47,"./application":8,"./config":10,"./device.supervisor-api.partial":13,"./os":20,"./release":21,"balena-errors":59,"balena-register-device":63,"balena-semver":67,"lodash/chunk":290,"lodash/flatten":294,"lodash/groupBy":296,"lodash/once":314,"memoizee":332,"tslib":470,"url":477}],13:[function(require,module,exports){
7644
7644
  "use strict";
7645
7645
  /*
7646
7646
  Copyright 2016 Balena
@@ -8295,7 +8295,7 @@ const getSupervisorApiHelper = function (deps, opts) {
8295
8295
  };
8296
8296
  exports.getSupervisorApiHelper = getSupervisorApiHelper;
8297
8297
 
8298
- },{"../util":42,"../util/device-os-version":37,"../util/types":46,"tslib":470}],14:[function(require,module,exports){
8298
+ },{"../util":43,"../util/device-os-version":38,"../util/types":47,"tslib":470}],14:[function(require,module,exports){
8299
8299
  "use strict";
8300
8300
  /*
8301
8301
  Copyright 2017 Balena
@@ -8404,7 +8404,7 @@ const getImageModel = function (deps, _opts) {
8404
8404
  };
8405
8405
  exports.default = getImageModel;
8406
8406
 
8407
- },{"../util":42,"../util/types":46,"balena-errors":58,"tslib":470}],15:[function(require,module,exports){
8407
+ },{"../util":43,"../util/types":47,"balena-errors":59,"tslib":470}],15:[function(require,module,exports){
8408
8408
  "use strict";
8409
8409
  /*
8410
8410
  Copyright 2016 Balena
@@ -8503,7 +8503,7 @@ module.exports = (deps, opts) => {
8503
8503
  return models;
8504
8504
  };
8505
8505
 
8506
- },{"../util/callbacks":31,"./api-key":5,"./application":8,"./billing":9,"./config":10,"./device":12,"./device-type":11,"./image":14,"./key":16,"./organization":19,"./os":20,"./release":21,"./service":22}],16:[function(require,module,exports){
8506
+ },{"../util/callbacks":32,"./api-key":5,"./application":8,"./billing":9,"./config":10,"./device":12,"./device-type":11,"./image":14,"./key":16,"./organization":19,"./os":20,"./release":21,"./service":22}],16:[function(require,module,exports){
8507
8507
  "use strict";
8508
8508
  /*
8509
8509
  Copyright 2016 Balena
@@ -8662,7 +8662,7 @@ const getKeyModel = function (deps, _opts) {
8662
8662
  };
8663
8663
  exports.default = getKeyModel;
8664
8664
 
8665
- },{"../util":42,"balena-errors":58,"tslib":470}],17:[function(require,module,exports){
8665
+ },{"../util":43,"balena-errors":59,"tslib":470}],17:[function(require,module,exports){
8666
8666
  "use strict";
8667
8667
  /*
8668
8668
  Copyright 2020 Balena
@@ -8887,7 +8887,7 @@ const getOrganizationInviteModel = function (deps, opts, getOrganization) {
8887
8887
  };
8888
8888
  exports.default = getOrganizationInviteModel;
8889
8889
 
8890
- },{"../util":42,"balena-errors":58,"tslib":470}],18:[function(require,module,exports){
8890
+ },{"../util":43,"balena-errors":59,"tslib":470}],18:[function(require,module,exports){
8891
8891
  "use strict";
8892
8892
  /*
8893
8893
  Copyright 2020 Balena
@@ -9320,7 +9320,7 @@ const getOrganizationMembershipModel = function (deps, getOrganization) {
9320
9320
  };
9321
9321
  exports.default = getOrganizationMembershipModel;
9322
9322
 
9323
- },{"../util":42,"../util/callbacks":31,"../util/dependent-resource":33,"balena-errors":58,"tslib":470}],19:[function(require,module,exports){
9323
+ },{"../util":43,"../util/callbacks":32,"../util/dependent-resource":34,"balena-errors":59,"tslib":470}],19:[function(require,module,exports){
9324
9324
  "use strict";
9325
9325
  /*
9326
9326
  Copyright 2020 Balena
@@ -9511,7 +9511,7 @@ const getOrganizationModel = function (deps, opts) {
9511
9511
  };
9512
9512
  exports.default = getOrganizationModel;
9513
9513
 
9514
- },{"../util":42,"../util/callbacks":31,"./organization-invite":17,"./organization-membership":18,"balena-errors":58,"tslib":470}],20:[function(require,module,exports){
9514
+ },{"../util":43,"../util/callbacks":32,"./organization-invite":17,"./organization-membership":18,"balena-errors":59,"tslib":470}],20:[function(require,module,exports){
9515
9515
  "use strict";
9516
9516
  /*
9517
9517
  Copyright 2016 Balena
@@ -10271,7 +10271,7 @@ const getOsModel = function (deps, opts) {
10271
10271
  };
10272
10272
  exports.default = getOsModel;
10273
10273
 
10274
- },{"../util":42,"../util/cache":30,"../util/device-actions/os-update/utils":36,"../util/device-types":39,"../util/types":46,"./application":8,"./config":10,"balena-semver":67,"lodash/once":314,"tslib":470}],21:[function(require,module,exports){
10274
+ },{"../util":43,"../util/cache":31,"../util/device-actions/os-update/utils":37,"../util/device-types":40,"../util/types":47,"./application":8,"./config":10,"balena-semver":67,"lodash/once":314,"tslib":470}],21:[function(require,module,exports){
10275
10275
  "use strict";
10276
10276
  /*
10277
10277
  Copyright 2016 Balena
@@ -10868,7 +10868,7 @@ const getReleaseModel = function (deps, opts) {
10868
10868
  };
10869
10869
  exports.default = getReleaseModel;
10870
10870
 
10871
- },{"../util":42,"../util/builder":29,"../util/callbacks":31,"../util/dependent-resource":33,"../util/types":46,"./application":8,"balena-errors":58,"lodash/once":314,"tslib":470}],22:[function(require,module,exports){
10871
+ },{"../util":43,"../util/builder":30,"../util/callbacks":32,"../util/dependent-resource":34,"../util/types":47,"./application":8,"balena-errors":59,"lodash/once":314,"tslib":470}],22:[function(require,module,exports){
10872
10872
  "use strict";
10873
10873
  /*
10874
10874
  Copyright 2018 Balena
@@ -11110,7 +11110,77 @@ const getServiceModel = (deps, opts) => {
11110
11110
  };
11111
11111
  exports.default = getServiceModel;
11112
11112
 
11113
- },{"../util":42,"../util/callbacks":31,"../util/dependent-resource":33,"./application":8,"balena-errors":58,"lodash/once":314,"tslib":470}],23:[function(require,module,exports){
11113
+ },{"../util":43,"../util/callbacks":32,"../util/dependent-resource":34,"./application":8,"balena-errors":59,"lodash/once":314,"tslib":470}],23:[function(require,module,exports){
11114
+ "use strict";
11115
+ Object.defineProperty(exports, "__esModule", { value: true });
11116
+ exports.createPinejsClient = void 0;
11117
+ const tslib_1 = require("tslib");
11118
+ const url = require("url");
11119
+ const errors = require("balena-errors");
11120
+ const pinejs_client_core_1 = require("pinejs-client-core");
11121
+ /**
11122
+ * @class
11123
+ * @classdesc A PineJS Client subclass to communicate with balena.
11124
+ * @private
11125
+ *
11126
+ * @description
11127
+ * This subclass makes use of the [balena-request](https://github.com/balena-io-modules/balena-request) project.
11128
+ */
11129
+ class PinejsClient extends pinejs_client_core_1.PinejsClientCore {
11130
+ constructor(params, backendParams) {
11131
+ super(Object.assign(Object.assign({}, params), { apiPrefix: url.resolve(backendParams.apiUrl, `/${backendParams.apiVersion}/`) }));
11132
+ this.backendParams = backendParams;
11133
+ this.backendParams = backendParams;
11134
+ this.API_URL = backendParams.apiUrl;
11135
+ this.API_VERSION = backendParams.apiVersion;
11136
+ }
11137
+ /**
11138
+ * @summary Perform a network request to balena.
11139
+ * @method
11140
+ * @private
11141
+ *
11142
+ * @param {Object} options - request options
11143
+ * @returns {Promise<*>} response body
11144
+ *
11145
+ * @todo Implement caching support.
11146
+ */
11147
+ _request(options) {
11148
+ return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
11149
+ const { apiKey, apiUrl, auth, request } = this.backendParams;
11150
+ const hasKey = yield auth.hasKey();
11151
+ const authenticated = hasKey || (apiKey != null && apiKey.length > 0);
11152
+ options = Object.assign({ apiKey, baseUrl: apiUrl, sendToken: authenticated && !options.anonymous }, options);
11153
+ try {
11154
+ const { body } = yield request.send(options);
11155
+ return body;
11156
+ }
11157
+ catch (err) {
11158
+ if (err.statusCode !== 401) {
11159
+ throw err;
11160
+ }
11161
+ // Always return the API error when the anonymous flag is used.
11162
+ if (options.anonymous) {
11163
+ throw err;
11164
+ }
11165
+ // We want to allow unauthenticated users to make requests
11166
+ // to public resources, but still reject with a NotLoggedIn
11167
+ // error if the response ends up being a 401.
11168
+ if (!authenticated) {
11169
+ throw new errors.BalenaNotLoggedIn();
11170
+ }
11171
+ throw err;
11172
+ }
11173
+ });
11174
+ }
11175
+ }
11176
+ const createPinejsClient = (...args) => {
11177
+ const pine = new PinejsClient(...args);
11178
+ // @ts-expect-error
11179
+ return pine;
11180
+ };
11181
+ exports.createPinejsClient = createPinejsClient;
11182
+
11183
+ },{"balena-errors":59,"pinejs-client-core":377,"tslib":470,"url":477}],24:[function(require,module,exports){
11114
11184
  "use strict";
11115
11185
  /*
11116
11186
  Copyright 2016 Balena
@@ -11181,11 +11251,11 @@ const getSettings = function ({ settings }) {
11181
11251
  };
11182
11252
  exports.default = getSettings;
11183
11253
 
11184
- },{"tslib":470}],24:[function(require,module,exports){
11254
+ },{"tslib":470}],25:[function(require,module,exports){
11185
11255
  "use strict";
11186
11256
  Object.defineProperty(exports, "__esModule", { value: true });
11187
11257
 
11188
- },{}],25:[function(require,module,exports){
11258
+ },{}],26:[function(require,module,exports){
11189
11259
  "use strict";
11190
11260
  Object.defineProperty(exports, "__esModule", { value: true });
11191
11261
  exports.DeviceOverallStatus = void 0;
@@ -11202,13 +11272,13 @@ var DeviceOverallStatus;
11202
11272
  DeviceOverallStatus["SHIPPED"] = "shipped";
11203
11273
  })(DeviceOverallStatus = exports.DeviceOverallStatus || (exports.DeviceOverallStatus = {}));
11204
11274
 
11205
- },{}],26:[function(require,module,exports){
11206
- arguments[4][24][0].apply(exports,arguments)
11207
- },{"dup":24}],27:[function(require,module,exports){
11208
- arguments[4][24][0].apply(exports,arguments)
11209
- },{"dup":24}],28:[function(require,module,exports){
11210
- arguments[4][24][0].apply(exports,arguments)
11211
- },{"dup":24}],29:[function(require,module,exports){
11275
+ },{}],27:[function(require,module,exports){
11276
+ arguments[4][25][0].apply(exports,arguments)
11277
+ },{"dup":25}],28:[function(require,module,exports){
11278
+ arguments[4][25][0].apply(exports,arguments)
11279
+ },{"dup":25}],29:[function(require,module,exports){
11280
+ arguments[4][25][0].apply(exports,arguments)
11281
+ },{"dup":25}],30:[function(require,module,exports){
11212
11282
  "use strict";
11213
11283
  Object.defineProperty(exports, "__esModule", { value: true });
11214
11284
  exports.BuilderHelper = void 0;
@@ -11250,7 +11320,7 @@ class BuilderHelper {
11250
11320
  }
11251
11321
  exports.BuilderHelper = BuilderHelper;
11252
11322
 
11253
- },{"balena-errors":58,"tslib":470}],30:[function(require,module,exports){
11323
+ },{"balena-errors":59,"tslib":470}],31:[function(require,module,exports){
11254
11324
  "use strict";
11255
11325
  Object.defineProperty(exports, "__esModule", { value: true });
11256
11326
  exports.getAuthDependentMemoize = void 0;
@@ -11269,7 +11339,7 @@ const getAuthDependentMemoize = (pubsub, cacheInterval = DEFAULT_CACHING_INTERVA
11269
11339
  };
11270
11340
  exports.getAuthDependentMemoize = getAuthDependentMemoize;
11271
11341
 
11272
- },{"memoizee":332}],31:[function(require,module,exports){
11342
+ },{"memoizee":332}],32:[function(require,module,exports){
11273
11343
  "use strict";
11274
11344
  Object.defineProperty(exports, "__esModule", { value: true });
11275
11345
  exports.addCallbackSupportToModuleFactory = exports.addCallbackSupportToModule = void 0;
@@ -11316,7 +11386,7 @@ const addCallbackSupportToModuleFactory = (moduleFactory) => {
11316
11386
  };
11317
11387
  exports.addCallbackSupportToModuleFactory = addCallbackSupportToModuleFactory;
11318
11388
 
11319
- },{}],32:[function(require,module,exports){
11389
+ },{}],33:[function(require,module,exports){
11320
11390
  "use strict";
11321
11391
  Object.defineProperty(exports, "__esModule", { value: true });
11322
11392
  exports.timeSince = void 0;
@@ -11343,7 +11413,7 @@ const timeSince = (input, suffix = true) => {
11343
11413
  };
11344
11414
  exports.timeSince = timeSince;
11345
11415
 
11346
- },{"lodash/throttle":318,"memoizee":332,"moment":344}],33:[function(require,module,exports){
11416
+ },{"lodash/throttle":318,"memoizee":332,"moment":344}],34:[function(require,module,exports){
11347
11417
  "use strict";
11348
11418
  /*
11349
11419
  Copyright 2017 Balena
@@ -11463,7 +11533,7 @@ function buildDependentResource({ pine }, { resourceName, resourceKeyField, pare
11463
11533
  }
11464
11534
  exports.buildDependentResource = buildDependentResource;
11465
11535
 
11466
- },{"../util":42,"tslib":470}],34:[function(require,module,exports){
11536
+ },{"../util":43,"tslib":470}],35:[function(require,module,exports){
11467
11537
  "use strict";
11468
11538
  Object.defineProperty(exports, "__esModule", { value: true });
11469
11539
  exports.DeviceActionsService = void 0;
@@ -11495,7 +11565,7 @@ class DeviceActionsService {
11495
11565
  }
11496
11566
  exports.DeviceActionsService = DeviceActionsService;
11497
11567
 
11498
- },{"tslib":470}],35:[function(require,module,exports){
11568
+ },{"tslib":470}],36:[function(require,module,exports){
11499
11569
  "use strict";
11500
11570
  Object.defineProperty(exports, "__esModule", { value: true });
11501
11571
  exports.getOsUpdateHelper = void 0;
@@ -11526,14 +11596,14 @@ const getOsUpdateHelper = function (deviceUrlsBase, request) {
11526
11596
  };
11527
11597
  exports.getOsUpdateHelper = getOsUpdateHelper;
11528
11598
 
11529
- },{"../device-actions-service":34}],36:[function(require,module,exports){
11599
+ },{"../device-actions-service":35}],37:[function(require,module,exports){
11530
11600
  "use strict";
11531
11601
  Object.defineProperty(exports, "__esModule", { value: true });
11532
11602
  exports.hupActionHelper = void 0;
11533
11603
  const balena_hup_action_utils_1 = require("balena-hup-action-utils");
11534
11604
  exports.hupActionHelper = new balena_hup_action_utils_1.HUPActionHelper();
11535
11605
 
11536
- },{"balena-hup-action-utils":60}],37:[function(require,module,exports){
11606
+ },{"balena-hup-action-utils":61}],38:[function(require,module,exports){
11537
11607
  "use strict";
11538
11608
  Object.defineProperty(exports, "__esModule", { value: true });
11539
11609
  exports.ensureVersionCompatibility = exports.getDeviceOsSemverWithVariant = exports.normalizeDeviceOsVersion = void 0;
@@ -11590,7 +11660,7 @@ const ensureVersionCompatibility = function (version, minVersion, versionType) {
11590
11660
  };
11591
11661
  exports.ensureVersionCompatibility = ensureVersionCompatibility;
11592
11662
 
11593
- },{"./device":40,"balena-semver":67}],38:[function(require,module,exports){
11663
+ },{"./device":41,"balena-semver":67}],39:[function(require,module,exports){
11594
11664
  "use strict";
11595
11665
  Object.defineProperty(exports, "__esModule", { value: true });
11596
11666
  exports.generateCurrentServiceDetails = exports.getCurrentServiceDetailsPineExpand = void 0;
@@ -11700,7 +11770,7 @@ const generateCurrentServiceDetails = (rawDevice) => {
11700
11770
  };
11701
11771
  exports.generateCurrentServiceDetails = generateCurrentServiceDetails;
11702
11772
 
11703
- },{}],39:[function(require,module,exports){
11773
+ },{}],40:[function(require,module,exports){
11704
11774
  "use strict";
11705
11775
  Object.defineProperty(exports, "__esModule", { value: true });
11706
11776
  exports.isDeviceTypeCompatibleWith = exports.isOsArchitectureCompatibleWith = exports.normalizeDeviceType = exports.getBySlug = exports.findBySlug = void 0;
@@ -11750,7 +11820,7 @@ const isDeviceTypeCompatibleWith = (osDeviceType, targetAppDeviceType) => (0, ex
11750
11820
  !!osDeviceType.isDependent === !!targetAppDeviceType.isDependent;
11751
11821
  exports.isDeviceTypeCompatibleWith = isDeviceTypeCompatibleWith;
11752
11822
 
11753
- },{"balena-errors":58}],40:[function(require,module,exports){
11823
+ },{"balena-errors":59}],41:[function(require,module,exports){
11754
11824
  "use strict";
11755
11825
  Object.defineProperty(exports, "__esModule", { value: true });
11756
11826
  exports.isProvisioned = void 0;
@@ -11761,7 +11831,7 @@ const isProvisioned = (device) => {
11761
11831
  };
11762
11832
  exports.isProvisioned = isProvisioned;
11763
11833
 
11764
- },{}],41:[function(require,module,exports){
11834
+ },{}],42:[function(require,module,exports){
11765
11835
  (function (global){(function (){
11766
11836
  "use strict";
11767
11837
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -11784,7 +11854,7 @@ else {
11784
11854
  }
11785
11855
 
11786
11856
  }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
11787
- },{}],42:[function(require,module,exports){
11857
+ },{}],43:[function(require,module,exports){
11788
11858
  "use strict";
11789
11859
  Object.defineProperty(exports, "__esModule", { value: true });
11790
11860
  exports.mergePineOptions = exports.mergePineOptionsTyped = exports.treatAsMissingDevice = exports.treatAsMissingApplication = exports.treatAsMissingOrganization = exports.isNoApplicationForKeyResponse = exports.isNoDeviceForKeyResponse = exports.isNotFoundResponse = exports.isUnauthorizedResponse = exports.withSupervisorLockedError = exports.isId = exports.onlyIf = exports.notImplemented = void 0;
@@ -11959,7 +12029,7 @@ const convertExpandToObject = (expandOption, cloneIfNeeded = false) => {
11959
12029
  return expandOption;
11960
12030
  };
11961
12031
 
11962
- },{"balena-errors":58,"tslib":470}],43:[function(require,module,exports){
12032
+ },{"balena-errors":59,"tslib":470}],44:[function(require,module,exports){
11963
12033
  "use strict";
11964
12034
  Object.defineProperty(exports, "__esModule", { value: true });
11965
12035
  exports.getLocalModeSupport = exports.checkLocalModeSupported = exports.LOCAL_MODE_SUPPORT_PROPERTIES = exports.LOCAL_MODE_ENV_VAR = void 0;
@@ -12006,7 +12076,7 @@ const getLocalModeSupport = (device) => {
12006
12076
  };
12007
12077
  exports.getLocalModeSupport = getLocalModeSupport;
12008
12078
 
12009
- },{"./device":40,"balena-semver":67}],44:[function(require,module,exports){
12079
+ },{"./device":41,"balena-semver":67}],45:[function(require,module,exports){
12010
12080
  "use strict";
12011
12081
  Object.defineProperty(exports, "__esModule", { value: true });
12012
12082
  exports.PubSub = void 0;
@@ -12036,7 +12106,7 @@ class PubSub {
12036
12106
  }
12037
12107
  exports.PubSub = PubSub;
12038
12108
 
12039
- },{}],45:[function(require,module,exports){
12109
+ },{}],46:[function(require,module,exports){
12040
12110
  "use strict";
12041
12111
  Object.defineProperty(exports, "__esModule", { value: true });
12042
12112
  // This gets replaced on build time.
@@ -12045,17 +12115,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
12045
12115
  // being embedded in the dist of the consumer project
12046
12116
  // which we want to avoid, both b/c of the dist size increase &
12047
12117
  // the security concerns of including the versions of the dependencies
12048
- const sdkVersion = '16.9.1';
12118
+ const sdkVersion = '16.9.2';
12049
12119
  exports.default = sdkVersion;
12050
12120
 
12051
- },{}],46:[function(require,module,exports){
12121
+ },{}],47:[function(require,module,exports){
12052
12122
  "use strict";
12053
12123
  Object.defineProperty(exports, "__esModule", { value: true });
12054
12124
  exports.toWritable = void 0;
12055
12125
  const toWritable = (obj) => obj;
12056
12126
  exports.toWritable = toWritable;
12057
12127
 
12058
- },{}],47:[function(require,module,exports){
12128
+ },{}],48:[function(require,module,exports){
12059
12129
  (function (Buffer){(function (){
12060
12130
  'use strict';
12061
12131
  const nodeStream = require('stream');
@@ -12101,7 +12171,7 @@ module.exports.toWebReadableStream = function(stream) {
12101
12171
  };
12102
12172
 
12103
12173
  }).call(this)}).call(this,{"isBuffer":require("../../is-buffer/index.js")})
12104
- },{"../../is-buffer/index.js":157,"./lib/conversions":48,"is-stream":159,"stream":465,"web-streams-polyfill":495}],48:[function(require,module,exports){
12174
+ },{"../../is-buffer/index.js":157,"./lib/conversions":49,"is-stream":159,"stream":465,"web-streams-polyfill":495}],49:[function(require,module,exports){
12105
12175
  'use strict';
12106
12176
 
12107
12177
  const Readable = require('stream').Readable;
@@ -12199,7 +12269,7 @@ module.exports = {
12199
12269
  // let roundTrippedReader = readableWebToNode(webReader);
12200
12270
  // roundTrippedReader.pipe(process.stdout);
12201
12271
 
12202
- },{"stream":465,"web-streams-polyfill":495}],49:[function(require,module,exports){
12272
+ },{"stream":465,"web-streams-polyfill":495}],50:[function(require,module,exports){
12203
12273
  'use strict';
12204
12274
 
12205
12275
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -12684,7 +12754,7 @@ exports.AbortController = AbortController;
12684
12754
  exports.AbortSignal = AbortSignal;
12685
12755
  exports.abortableFetch = abortableFetchDecorator;
12686
12756
 
12687
- },{}],50:[function(require,module,exports){
12757
+ },{}],51:[function(require,module,exports){
12688
12758
  (function (global){(function (){
12689
12759
  'use strict';
12690
12760
 
@@ -13194,7 +13264,7 @@ var objectKeys = Object.keys || function (obj) {
13194
13264
  };
13195
13265
 
13196
13266
  }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
13197
- },{"object-assign":363,"util/":53}],51:[function(require,module,exports){
13267
+ },{"object-assign":363,"util/":54}],52:[function(require,module,exports){
13198
13268
  if (typeof Object.create === 'function') {
13199
13269
  // implementation from standard node.js 'util' module
13200
13270
  module.exports = function inherits(ctor, superCtor) {
@@ -13219,14 +13289,14 @@ if (typeof Object.create === 'function') {
13219
13289
  }
13220
13290
  }
13221
13291
 
13222
- },{}],52:[function(require,module,exports){
13292
+ },{}],53:[function(require,module,exports){
13223
13293
  module.exports = function isBuffer(arg) {
13224
13294
  return arg && typeof arg === 'object'
13225
13295
  && typeof arg.copy === 'function'
13226
13296
  && typeof arg.fill === 'function'
13227
13297
  && typeof arg.readUInt8 === 'function';
13228
13298
  }
13229
- },{}],53:[function(require,module,exports){
13299
+ },{}],54:[function(require,module,exports){
13230
13300
  (function (process,global){(function (){
13231
13301
  // Copyright Joyent, Inc. and other Node contributors.
13232
13302
  //
@@ -13816,7 +13886,7 @@ function hasOwnProperty(obj, prop) {
13816
13886
  }
13817
13887
 
13818
13888
  }).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
13819
- },{"./support/isBuffer":52,"_process":379,"inherits":51}],54:[function(require,module,exports){
13889
+ },{"./support/isBuffer":53,"_process":379,"inherits":52}],55:[function(require,module,exports){
13820
13890
  "use strict";
13821
13891
  /*
13822
13892
  Copyright 2016-17 Balena
@@ -13905,7 +13975,7 @@ class APIKey {
13905
13975
  }
13906
13976
  exports.APIKey = APIKey;
13907
13977
 
13908
- },{"./token":57}],55:[function(require,module,exports){
13978
+ },{"./token":58}],56:[function(require,module,exports){
13909
13979
  "use strict";
13910
13980
  /*
13911
13981
  Copyright 2016-17 Balena
@@ -14100,7 +14170,7 @@ class BalenaAuth {
14100
14170
  }
14101
14171
  exports.default = BalenaAuth;
14102
14172
 
14103
- },{"./api-key":54,"./jwt":56,"balena-errors":58,"balena-settings-storage":70,"tslib":470}],56:[function(require,module,exports){
14173
+ },{"./api-key":55,"./jwt":57,"balena-errors":59,"balena-settings-storage":70,"tslib":470}],57:[function(require,module,exports){
14104
14174
  "use strict";
14105
14175
  /*
14106
14176
  Copyright 2016-17 Balena
@@ -14208,7 +14278,7 @@ class JWT {
14208
14278
  }
14209
14279
  exports.JWT = JWT;
14210
14280
 
14211
- },{"./token":57,"jwt-decode":164}],57:[function(require,module,exports){
14281
+ },{"./token":58,"jwt-decode":164}],58:[function(require,module,exports){
14212
14282
  "use strict";
14213
14283
  /*
14214
14284
  Copyright 2016-17 Balena
@@ -14233,7 +14303,7 @@ var TokenType;
14233
14303
  TokenType[TokenType["APIKey"] = 1] = "APIKey";
14234
14304
  })(TokenType = exports.TokenType || (exports.TokenType = {}));
14235
14305
 
14236
- },{}],58:[function(require,module,exports){
14306
+ },{}],59:[function(require,module,exports){
14237
14307
  "use strict";
14238
14308
  /*
14239
14309
  Copyright 2016 Balena
@@ -14704,7 +14774,7 @@ class BalenaInvalidParameterError extends BalenaError {
14704
14774
  exports.BalenaInvalidParameterError = BalenaInvalidParameterError;
14705
14775
  BalenaInvalidParameterError.prototype.code = 'BalenaInvalidParameterError';
14706
14776
 
14707
- },{"typed-error":476}],59:[function(require,module,exports){
14777
+ },{"typed-error":476}],60:[function(require,module,exports){
14708
14778
  "use strict";
14709
14779
  /*
14710
14780
  Copyright 2017 Balena Ltd.
@@ -14812,7 +14882,7 @@ exports.actionsConfig = {
14812
14882
  },
14813
14883
  };
14814
14884
 
14815
- },{}],60:[function(require,module,exports){
14885
+ },{}],61:[function(require,module,exports){
14816
14886
  "use strict";
14817
14887
  /*
14818
14888
  Copyright 2017 Balena Ltd.
@@ -14973,7 +15043,7 @@ var HUPActionHelper = /** @class */ (function () {
14973
15043
  }());
14974
15044
  exports.HUPActionHelper = HUPActionHelper;
14975
15045
 
14976
- },{"./config":59,"./types":61,"balena-semver":67,"tslib":470}],61:[function(require,module,exports){
15046
+ },{"./config":60,"./types":62,"balena-semver":67,"tslib":470}],62:[function(require,module,exports){
14977
15047
  "use strict";
14978
15048
  /*
14979
15049
  Copyright 2017 Balena Ltd.
@@ -14992,50 +15062,7 @@ exports.HUPActionHelper = HUPActionHelper;
14992
15062
  */
14993
15063
  Object.defineProperty(exports, "__esModule", { value: true });
14994
15064
 
14995
- },{}],62:[function(require,module,exports){
14996
- "use strict";
14997
- Object.defineProperty(exports, "__esModule", { value: true });
14998
- exports.BalenaPine = void 0;
14999
- const tslib_1 = require("tslib");
15000
- const url = require("url");
15001
- const errors = require("balena-errors");
15002
- const pinejs_client_core_1 = require("pinejs-client-core");
15003
- class BalenaPine extends pinejs_client_core_1.PinejsClientCore {
15004
- constructor(params, backendParams) {
15005
- super(Object.assign(Object.assign({}, params), { apiPrefix: url.resolve(backendParams.apiUrl, `/${backendParams.apiVersion}/`) }));
15006
- this.backendParams = backendParams;
15007
- this.backendParams = backendParams;
15008
- this.API_URL = backendParams.apiUrl;
15009
- this.API_VERSION = backendParams.apiVersion;
15010
- }
15011
- _request(options) {
15012
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
15013
- const { apiKey, apiUrl, auth, request } = this.backendParams;
15014
- const hasKey = yield auth.hasKey();
15015
- const authenticated = hasKey || (apiKey != null && apiKey.length > 0);
15016
- options = Object.assign({ apiKey, baseUrl: apiUrl, sendToken: authenticated && !options.anonymous }, options);
15017
- try {
15018
- const { body } = yield request.send(options);
15019
- return body;
15020
- }
15021
- catch (err) {
15022
- if (err.statusCode !== 401) {
15023
- throw err;
15024
- }
15025
- if (options.anonymous) {
15026
- throw err;
15027
- }
15028
- if (!authenticated) {
15029
- throw new errors.BalenaNotLoggedIn();
15030
- }
15031
- throw err;
15032
- }
15033
- });
15034
- }
15035
- }
15036
- exports.BalenaPine = BalenaPine;
15037
-
15038
- },{"balena-errors":58,"pinejs-client-core":377,"tslib":470,"url":477}],63:[function(require,module,exports){
15065
+ },{}],63:[function(require,module,exports){
15039
15066
  "use strict";
15040
15067
  /*
15041
15068
  Copyright 2016-2020 Balena Ltd.
@@ -15323,7 +15350,7 @@ function estimate(requestAsync, isBrowser) {
15323
15350
  exports.estimate = estimate;
15324
15351
 
15325
15352
  }).call(this)}).call(this,require('_process'))
15326
- },{"./utils":66,"@balena/node-web-streams":47,"_process":379,"progress-stream":380,"stream":465,"tslib":470,"zlib":74}],65:[function(require,module,exports){
15353
+ },{"./utils":66,"@balena/node-web-streams":48,"_process":379,"progress-stream":380,"stream":465,"tslib":470,"zlib":74}],65:[function(require,module,exports){
15327
15354
  "use strict";
15328
15355
  /*
15329
15356
  Copyright 2016-2020 Balena Ltd.
@@ -15692,7 +15719,7 @@ function getRequest({ auth, debug = false, retries = 0, isBrowser = false, inter
15692
15719
  }
15693
15720
  exports.getRequest = getRequest;
15694
15721
 
15695
- },{"./progress":64,"./utils":66,"balena-errors":58,"fetch-readablestream":144,"tslib":470,"url":477}],66:[function(require,module,exports){
15722
+ },{"./progress":64,"./utils":66,"balena-errors":59,"fetch-readablestream":144,"tslib":470,"url":477}],66:[function(require,module,exports){
15696
15723
  "use strict";
15697
15724
  /*
15698
15725
  Copyright 2016-2020 Balena Ltd.
@@ -16101,7 +16128,7 @@ function getRequestAsync($fetch = normalFetch) {
16101
16128
  }
16102
16129
  exports.getRequestAsync = getRequestAsync;
16103
16130
 
16104
- },{"balena-auth/build/token":57,"balena-errors":58,"fetch-ponyfill":142,"qs":382,"tslib":470,"url":477}],67:[function(require,module,exports){
16131
+ },{"balena-auth/build/token":58,"balena-errors":59,"fetch-ponyfill":142,"qs":382,"tslib":470,"url":477}],67:[function(require,module,exports){
16105
16132
  "use strict";
16106
16133
  Object.defineProperty(exports, "__esModule", { value: true });
16107
16134
  var memoize = require("lodash/memoize");
@@ -16852,7 +16879,7 @@ const getStorage = ({ dataDirectory, } = {}) => {
16852
16879
  };
16853
16880
  module.exports = getStorage;
16854
16881
 
16855
- },{"./local-storage":68,"balena-errors":58,"tslib":470}],71:[function(require,module,exports){
16882
+ },{"./local-storage":68,"balena-errors":59,"tslib":470}],71:[function(require,module,exports){
16856
16883
  'use strict'
16857
16884
 
16858
16885
  exports.byteLength = byteLength
@@ -17418,7 +17445,7 @@ Zlib.prototype._reset = function () {
17418
17445
 
17419
17446
  exports.Zlib = Zlib;
17420
17447
  }).call(this)}).call(this,require('_process'),require("buffer").Buffer)
17421
- },{"_process":379,"assert":50,"buffer":75,"pako/lib/zlib/constants":368,"pako/lib/zlib/deflate.js":370,"pako/lib/zlib/inflate.js":372,"pako/lib/zlib/zstream":376}],74:[function(require,module,exports){
17448
+ },{"_process":379,"assert":51,"buffer":75,"pako/lib/zlib/constants":368,"pako/lib/zlib/deflate.js":370,"pako/lib/zlib/inflate.js":372,"pako/lib/zlib/zstream":376}],74:[function(require,module,exports){
17422
17449
  (function (process){(function (){
17423
17450
  'use strict';
17424
17451
 
@@ -18030,7 +18057,7 @@ util.inherits(DeflateRaw, Zlib);
18030
18057
  util.inherits(InflateRaw, Zlib);
18031
18058
  util.inherits(Unzip, Zlib);
18032
18059
  }).call(this)}).call(this,require('_process'))
18033
- },{"./binding":73,"_process":379,"assert":50,"buffer":75,"stream":465,"util":82}],75:[function(require,module,exports){
18060
+ },{"./binding":73,"_process":379,"assert":51,"buffer":75,"stream":465,"util":82}],75:[function(require,module,exports){
18034
18061
  (function (Buffer){(function (){
18035
18062
  /*!
18036
18063
  * The buffer module from node.js, for the browser.
@@ -21045,12 +21072,12 @@ exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate :
21045
21072
  };
21046
21073
  }).call(this)}).call(this,require("timers").setImmediate,require("timers").clearImmediate)
21047
21074
  },{"process/browser.js":379,"timers":79}],80:[function(require,module,exports){
21048
- arguments[4][51][0].apply(exports,arguments)
21049
- },{"dup":51}],81:[function(require,module,exports){
21050
21075
  arguments[4][52][0].apply(exports,arguments)
21051
- },{"dup":52}],82:[function(require,module,exports){
21076
+ },{"dup":52}],81:[function(require,module,exports){
21052
21077
  arguments[4][53][0].apply(exports,arguments)
21053
- },{"./support/isBuffer":81,"_process":379,"dup":53,"inherits":80}],83:[function(require,module,exports){
21078
+ },{"dup":53}],82:[function(require,module,exports){
21079
+ arguments[4][54][0].apply(exports,arguments)
21080
+ },{"./support/isBuffer":81,"_process":379,"dup":54,"inherits":80}],83:[function(require,module,exports){
21054
21081
  'use strict';
21055
21082
 
21056
21083
  var GetIntrinsic = require('get-intrinsic');