balena-sdk 17.1.0 → 17.1.1
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/es2015/2fa.js +0 -47
- package/es2015/auth.d.ts +15 -0
- package/es2015/auth.js +0 -77
- package/es2015/balena-browser.min.js +1 -1
- package/es2015/index.d.ts +4 -0
- package/es2015/logs.d.ts +0 -18
- package/es2015/logs.js +0 -18
- package/es2015/models/api-key.d.ts +0 -47
- package/es2015/models/api-key.js +0 -47
- package/es2015/models/application-invite.d.ts +0 -27
- package/es2015/models/application-invite.js +0 -27
- package/es2015/models/application-membership.d.ts +0 -26
- package/es2015/models/application-membership.js +0 -26
- package/es2015/models/application.d.ts +0 -214
- package/es2015/models/application.js +0 -214
- package/es2015/models/billing.d.ts +0 -30
- package/es2015/models/billing.js +0 -30
- package/es2015/models/config.d.ts +0 -30
- package/es2015/models/config.js +0 -30
- package/es2015/models/device-type.d.ts +0 -38
- package/es2015/models/device-type.js +0 -38
- package/es2015/models/device.d.ts +0 -367
- package/es2015/models/device.js +0 -367
- package/es2015/models/device.supervisor-api.partial.d.ts +0 -79
- package/es2015/models/device.supervisor-api.partial.js +0 -79
- package/es2015/models/image.d.ts +0 -12
- package/es2015/models/image.js +0 -12
- package/es2015/models/key.js +0 -23
- package/es2015/models/organization-invite.d.ts +0 -27
- package/es2015/models/organization-invite.js +0 -27
- package/es2015/models/organization-membership.d.ts +0 -48
- package/es2015/models/organization-membership.js +0 -48
- package/es2015/models/organization.js +0 -23
- package/es2015/models/os.js +0 -30
- package/es2015/models/release.d.ts +0 -22
- package/es2015/models/release.js +0 -52
- package/es2015/models/service.d.ts +0 -36
- package/es2015/models/service.js +0 -36
- package/es2015/settings.d.ts +0 -12
- package/es2015/settings.js +0 -12
- package/es2015/util/sdk-version.js +1 -1
- package/es2018/2fa.js +0 -47
- package/es2018/auth.d.ts +15 -0
- package/es2018/auth.js +0 -77
- package/es2018/balena-browser.min.js +1 -1
- package/es2018/index.d.ts +4 -0
- package/es2018/logs.d.ts +0 -18
- package/es2018/logs.js +0 -18
- package/es2018/models/api-key.d.ts +0 -47
- package/es2018/models/api-key.js +0 -47
- package/es2018/models/application-invite.d.ts +0 -27
- package/es2018/models/application-invite.js +0 -27
- package/es2018/models/application-membership.d.ts +0 -26
- package/es2018/models/application-membership.js +0 -26
- package/es2018/models/application.d.ts +0 -214
- package/es2018/models/application.js +0 -214
- package/es2018/models/billing.d.ts +0 -30
- package/es2018/models/billing.js +0 -30
- package/es2018/models/config.d.ts +0 -30
- package/es2018/models/config.js +0 -30
- package/es2018/models/device-type.d.ts +0 -38
- package/es2018/models/device-type.js +0 -38
- package/es2018/models/device.d.ts +0 -367
- package/es2018/models/device.js +0 -367
- package/es2018/models/device.supervisor-api.partial.d.ts +0 -79
- package/es2018/models/device.supervisor-api.partial.js +0 -79
- package/es2018/models/image.d.ts +0 -12
- package/es2018/models/image.js +0 -12
- package/es2018/models/key.js +0 -23
- package/es2018/models/organization-invite.d.ts +0 -27
- package/es2018/models/organization-invite.js +0 -27
- package/es2018/models/organization-membership.d.ts +0 -48
- package/es2018/models/organization-membership.js +0 -48
- package/es2018/models/organization.js +0 -23
- package/es2018/models/os.js +0 -30
- package/es2018/models/release.d.ts +0 -22
- package/es2018/models/release.js +0 -52
- package/es2018/models/service.d.ts +0 -36
- package/es2018/models/service.js +0 -36
- package/es2018/settings.d.ts +0 -12
- package/es2018/settings.js +0 -12
- package/es2018/util/sdk-version.js +1 -1
- package/package.json +2 -2
package/es2015/2fa.js
CHANGED
|
@@ -35,15 +35,6 @@ const get2fa = function (deps, opts) {
|
|
|
35
35
|
* console.log('2FA is enabled for this account');
|
|
36
36
|
* }
|
|
37
37
|
* });
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
* balena.auth.twoFactor.isEnabled(function(error, isEnabled) {
|
|
41
|
-
* if (error) throw error;
|
|
42
|
-
*
|
|
43
|
-
* if (isEnabled) {
|
|
44
|
-
* console.log('2FA is enabled for this account');
|
|
45
|
-
* }
|
|
46
|
-
* });
|
|
47
38
|
*/
|
|
48
39
|
function isEnabled() {
|
|
49
40
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -67,15 +58,6 @@ const get2fa = function (deps, opts) {
|
|
|
67
58
|
* console.log('2FA challenge passed');
|
|
68
59
|
* }
|
|
69
60
|
* });
|
|
70
|
-
*
|
|
71
|
-
* @example
|
|
72
|
-
* balena.auth.twoFactor.isPassed(function(error, isPassed) {
|
|
73
|
-
* if (error) throw error;
|
|
74
|
-
*
|
|
75
|
-
* if (isPassed) {
|
|
76
|
-
* console.log('2FA challenge passed');
|
|
77
|
-
* }
|
|
78
|
-
* });
|
|
79
61
|
*/
|
|
80
62
|
function isPassed() {
|
|
81
63
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -102,12 +84,6 @@ const get2fa = function (deps, opts) {
|
|
|
102
84
|
* @example
|
|
103
85
|
* const token = balena.auth.twoFactor.verify('1234');
|
|
104
86
|
* balena.auth.loginWithToken(token);
|
|
105
|
-
*
|
|
106
|
-
* @example
|
|
107
|
-
* balena.auth.twoFactor.verify('1234', function(error, token) {
|
|
108
|
-
* if (error) throw error;
|
|
109
|
-
* console.log(token);
|
|
110
|
-
* });
|
|
111
87
|
*/
|
|
112
88
|
function verify(code) {
|
|
113
89
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -135,12 +111,6 @@ const get2fa = function (deps, opts) {
|
|
|
135
111
|
* @example
|
|
136
112
|
* const setupKey = balena.auth.twoFactor.getSetupKey();
|
|
137
113
|
* console.log(setupKey);
|
|
138
|
-
*
|
|
139
|
-
* @example
|
|
140
|
-
* balena.auth.twoFactor.getSetupKey(function(error, setupKey) {
|
|
141
|
-
* if (error) throw error;
|
|
142
|
-
* console.log(setupKey);
|
|
143
|
-
* });
|
|
144
114
|
*/
|
|
145
115
|
function getSetupKey() {
|
|
146
116
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -168,12 +138,6 @@ const get2fa = function (deps, opts) {
|
|
|
168
138
|
* @example
|
|
169
139
|
* const token = balena.auth.twoFactor.enable('1234');
|
|
170
140
|
* balena.auth.loginWithToken(token);
|
|
171
|
-
*
|
|
172
|
-
* @example
|
|
173
|
-
* balena.auth.twoFactor.enable('1234', function(error, token) {
|
|
174
|
-
* if (error) throw error;
|
|
175
|
-
* console.log(token);
|
|
176
|
-
* });
|
|
177
141
|
*/
|
|
178
142
|
const enable = (code) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
179
143
|
const token = yield verify(code);
|
|
@@ -195,11 +159,6 @@ const get2fa = function (deps, opts) {
|
|
|
195
159
|
*
|
|
196
160
|
* @example
|
|
197
161
|
* balena.auth.twoFactor.challenge('1234');
|
|
198
|
-
*
|
|
199
|
-
* @example
|
|
200
|
-
* balena.auth.twoFactor.challenge('1234', function(error) {
|
|
201
|
-
* if (error) throw error;
|
|
202
|
-
* });
|
|
203
162
|
*/
|
|
204
163
|
function challenge(code) {
|
|
205
164
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -223,12 +182,6 @@ const get2fa = function (deps, opts) {
|
|
|
223
182
|
* @example
|
|
224
183
|
* const token = balena.auth.twoFactor.disable('1234');
|
|
225
184
|
* balena.auth.loginWithToken(token);
|
|
226
|
-
*
|
|
227
|
-
* @example
|
|
228
|
-
* balena.auth.twoFactor.disable('1234', function(error, token) {
|
|
229
|
-
* if (error) throw error;
|
|
230
|
-
* console.log(token);
|
|
231
|
-
* });
|
|
232
185
|
*/
|
|
233
186
|
function disable(password) {
|
|
234
187
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
package/es2015/auth.d.ts
CHANGED
|
@@ -6,6 +6,21 @@ declare const getAuth: (deps: InjectedDependenciesParam, opts: InjectedOptionsPa
|
|
|
6
6
|
getSetupKey: () => Promise<string>;
|
|
7
7
|
enable: (code: string) => Promise<string>;
|
|
8
8
|
verify: (code: string) => Promise<string>;
|
|
9
|
+
/**
|
|
10
|
+
* @summary Login with a token or api key
|
|
11
|
+
* @name loginWithToken
|
|
12
|
+
* @public
|
|
13
|
+
* @function
|
|
14
|
+
* @memberof balena.auth
|
|
15
|
+
*
|
|
16
|
+
* @description Login to balena with a session token or api key instead of with credentials.
|
|
17
|
+
*
|
|
18
|
+
* @param {String} authToken - the auth token
|
|
19
|
+
* @returns {Promise}
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* balena.auth.loginWithToken(authToken);
|
|
23
|
+
*/
|
|
9
24
|
challenge: (code: string) => Promise<void>;
|
|
10
25
|
disable: (password: string) => Promise<string>;
|
|
11
26
|
};
|
package/es2015/auth.js
CHANGED
|
@@ -91,17 +91,6 @@ const getAuth = function (deps, opts) {
|
|
|
91
91
|
* console.log('My username is:', username);
|
|
92
92
|
* }
|
|
93
93
|
* });
|
|
94
|
-
*
|
|
95
|
-
* @example
|
|
96
|
-
* balena.auth.whoami(function(error, username) {
|
|
97
|
-
* if (error) throw error;
|
|
98
|
-
*
|
|
99
|
-
* if (!username) {
|
|
100
|
-
* console.log('I\'m not logged in!');
|
|
101
|
-
* } else {
|
|
102
|
-
* console.log('My username is:', username);
|
|
103
|
-
* }
|
|
104
|
-
* });
|
|
105
94
|
*/
|
|
106
95
|
function whoami() {
|
|
107
96
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -141,12 +130,6 @@ const getAuth = function (deps, opts) {
|
|
|
141
130
|
* balena.auth.authenticate(credentials).then(function(token) {
|
|
142
131
|
* console.log('My token is:', token);
|
|
143
132
|
* });
|
|
144
|
-
*
|
|
145
|
-
* @example
|
|
146
|
-
* balena.auth.authenticate(credentials, function(error, token) {
|
|
147
|
-
* if (error) throw error;
|
|
148
|
-
* console.log('My token is:', token);
|
|
149
|
-
* });
|
|
150
133
|
*/
|
|
151
134
|
function authenticate(credentials) {
|
|
152
135
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -191,11 +174,6 @@ const getAuth = function (deps, opts) {
|
|
|
191
174
|
*
|
|
192
175
|
* @example
|
|
193
176
|
* balena.auth.login(credentials);
|
|
194
|
-
*
|
|
195
|
-
* @example
|
|
196
|
-
* balena.auth.login(credentials, function(error) {
|
|
197
|
-
* if (error) throw error;
|
|
198
|
-
* });
|
|
199
177
|
*/
|
|
200
178
|
function login(credentials) {
|
|
201
179
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -218,11 +196,6 @@ const getAuth = function (deps, opts) {
|
|
|
218
196
|
*
|
|
219
197
|
* @example
|
|
220
198
|
* balena.auth.loginWithToken(authToken);
|
|
221
|
-
*
|
|
222
|
-
* @example
|
|
223
|
-
* balena.auth.loginWithToken(authToken, function(error) {
|
|
224
|
-
* if (error) throw error;
|
|
225
|
-
* });
|
|
226
199
|
*/
|
|
227
200
|
function loginWithToken(authToken) {
|
|
228
201
|
memoizedUserWhoami.clear();
|
|
@@ -246,17 +219,6 @@ const getAuth = function (deps, opts) {
|
|
|
246
219
|
* console.log('Too bad!');
|
|
247
220
|
* }
|
|
248
221
|
* });
|
|
249
|
-
*
|
|
250
|
-
* @example
|
|
251
|
-
* balena.auth.isLoggedIn(function(error, isLoggedIn) {
|
|
252
|
-
* if (error) throw error;
|
|
253
|
-
*
|
|
254
|
-
* if (isLoggedIn) {
|
|
255
|
-
* console.log('I\'m in!');
|
|
256
|
-
* } else {
|
|
257
|
-
* console.log('Too bad!');
|
|
258
|
-
* }
|
|
259
|
-
* });
|
|
260
222
|
*/
|
|
261
223
|
function isLoggedIn() {
|
|
262
224
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -289,12 +251,6 @@ const getAuth = function (deps, opts) {
|
|
|
289
251
|
* balena.auth.getToken().then(function(token) {
|
|
290
252
|
* console.log(token);
|
|
291
253
|
* });
|
|
292
|
-
*
|
|
293
|
-
* @example
|
|
294
|
-
* balena.auth.getToken(function(error, token) {
|
|
295
|
-
* if (error) throw error;
|
|
296
|
-
* console.log(token);
|
|
297
|
-
* });
|
|
298
254
|
*/
|
|
299
255
|
function getToken() {
|
|
300
256
|
return auth.getKey().catch(function (err) {
|
|
@@ -317,12 +273,6 @@ const getAuth = function (deps, opts) {
|
|
|
317
273
|
* balena.auth.getUserId().then(function(userId) {
|
|
318
274
|
* console.log(userId);
|
|
319
275
|
* });
|
|
320
|
-
*
|
|
321
|
-
* @example
|
|
322
|
-
* balena.auth.getUserId(function(error, userId) {
|
|
323
|
-
* if (error) throw error;
|
|
324
|
-
* console.log(userId);
|
|
325
|
-
* });
|
|
326
276
|
*/
|
|
327
277
|
function getUserId() {
|
|
328
278
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -346,12 +296,6 @@ const getAuth = function (deps, opts) {
|
|
|
346
296
|
* balena.auth.getUserActorId().then(function(userActorId) {
|
|
347
297
|
* console.log(userActorId);
|
|
348
298
|
* });
|
|
349
|
-
*
|
|
350
|
-
* @example
|
|
351
|
-
* balena.auth.getUserActorId(function(error, userActorId) {
|
|
352
|
-
* if (error) throw error;
|
|
353
|
-
* console.log(userActorId);
|
|
354
|
-
* });
|
|
355
299
|
*/
|
|
356
300
|
function getUserActorId() {
|
|
357
301
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -381,12 +325,6 @@ const getAuth = function (deps, opts) {
|
|
|
381
325
|
* balena.auth.getEmail().then(function(email) {
|
|
382
326
|
* console.log(email);
|
|
383
327
|
* });
|
|
384
|
-
*
|
|
385
|
-
* @example
|
|
386
|
-
* balena.auth.getEmail(function(error, email) {
|
|
387
|
-
* if (error) throw error;
|
|
388
|
-
* console.log(email);
|
|
389
|
-
* });
|
|
390
328
|
*/
|
|
391
329
|
function getEmail() {
|
|
392
330
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -405,11 +343,6 @@ const getAuth = function (deps, opts) {
|
|
|
405
343
|
*
|
|
406
344
|
* @example
|
|
407
345
|
* balena.auth.logout();
|
|
408
|
-
*
|
|
409
|
-
* @example
|
|
410
|
-
* balena.auth.logout(function(error) {
|
|
411
|
-
* if (error) throw error;
|
|
412
|
-
* });
|
|
413
346
|
*/
|
|
414
347
|
function logout() {
|
|
415
348
|
memoizedUserWhoami.clear();
|
|
@@ -437,16 +370,6 @@ const getAuth = function (deps, opts) {
|
|
|
437
370
|
* }).then(function(token) {
|
|
438
371
|
* console.log(token);
|
|
439
372
|
* });
|
|
440
|
-
*
|
|
441
|
-
* @example
|
|
442
|
-
* balena.auth.register({
|
|
443
|
-
* email: 'johndoe@gmail.com',
|
|
444
|
-
* password: 'secret'
|
|
445
|
-
* }, function(error, token) {
|
|
446
|
-
* if (error) throw error;
|
|
447
|
-
* console.log(token);
|
|
448
|
-
* });
|
|
449
|
-
*
|
|
450
373
|
*/
|
|
451
374
|
function register(credentials) {
|
|
452
375
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|