@edgeiq/edgeiq-api-js 1.3.59 → 1.3.61
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/__tests__/auth.test.js +19 -3
- package/dist/auth/index.d.ts +1 -0
- package/dist/auth/index.js +25 -0
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +1 -0
- package/dist/devices/models.d.ts +2 -0
- package/dist/escrowDevices/models.d.ts +2 -0
- package/dist/files/index.js +2 -2
- package/dist/users/models.d.ts +1 -0
- package/package.json +1 -1
|
@@ -84,13 +84,13 @@ describe('Authentication', function () {
|
|
|
84
84
|
});
|
|
85
85
|
}); });
|
|
86
86
|
it('Correct user and password', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
87
|
-
var
|
|
87
|
+
var loggedUser;
|
|
88
88
|
return __generator(this, function (_a) {
|
|
89
89
|
switch (_a.label) {
|
|
90
90
|
case 0: return [4, __2.Authentication.login(testConstants_1.TestAuth.username, testConstants_1.TestAuth.pass)];
|
|
91
91
|
case 1:
|
|
92
|
-
|
|
93
|
-
expect(
|
|
92
|
+
loggedUser = _a.sent();
|
|
93
|
+
expect(loggedUser.session_token).not.toBeNull();
|
|
94
94
|
return [2];
|
|
95
95
|
}
|
|
96
96
|
});
|
|
@@ -140,4 +140,20 @@ describe('Authentication', function () {
|
|
|
140
140
|
}
|
|
141
141
|
});
|
|
142
142
|
}); });
|
|
143
|
+
it('Resets user API token', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
144
|
+
var loggedUser, result;
|
|
145
|
+
return __generator(this, function (_a) {
|
|
146
|
+
switch (_a.label) {
|
|
147
|
+
case 0: return [4, __2.Authentication.login(testConstants_1.TestAuth.username, testConstants_1.TestAuth.pass)];
|
|
148
|
+
case 1:
|
|
149
|
+
loggedUser = _a.sent();
|
|
150
|
+
expect(loggedUser.session_token).not.toBeNull();
|
|
151
|
+
return [4, __2.Authentication.tokenReset(testConstants_1.TestAuth.username, testConstants_1.TestAuth.pass)];
|
|
152
|
+
case 2:
|
|
153
|
+
result = _a.sent();
|
|
154
|
+
expect(result.api_token).not.toEqual(loggedUser.session_token);
|
|
155
|
+
return [2];
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
}); });
|
|
143
159
|
});
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -4,5 +4,6 @@ declare const Authentication: {
|
|
|
4
4
|
me: () => Promise<User>;
|
|
5
5
|
passwordResetRequest: (email: string, url: string, subject: string, greeting: string) => Promise<boolean>;
|
|
6
6
|
passwordReset: (token: string, password: string, password_confirmation: string) => Promise<boolean>;
|
|
7
|
+
tokenReset: (email: string, password: string) => Promise<EIQLoginUser>;
|
|
7
8
|
};
|
|
8
9
|
export { Authentication };
|
package/dist/auth/index.js
CHANGED
|
@@ -154,5 +154,30 @@ var Authentication = {
|
|
|
154
154
|
}
|
|
155
155
|
});
|
|
156
156
|
}); },
|
|
157
|
+
tokenReset: function (email, password) { return __awaiter(void 0, void 0, void 0, function () {
|
|
158
|
+
var axios, result, error_5;
|
|
159
|
+
return __generator(this, function (_a) {
|
|
160
|
+
switch (_a.label) {
|
|
161
|
+
case 0:
|
|
162
|
+
_a.trys.push([0, 2, , 3]);
|
|
163
|
+
__1.EdgeIQAPI.logAction("Reset API token");
|
|
164
|
+
axios = __1.EdgeIQAPI.getAxios();
|
|
165
|
+
return [4, axios.post("" + constants_1.Endpoints.tokenResetRequest, JSON.stringify({
|
|
166
|
+
email: email,
|
|
167
|
+
password: password,
|
|
168
|
+
}))];
|
|
169
|
+
case 1:
|
|
170
|
+
result = _a.sent();
|
|
171
|
+
return [2, result === null || result === void 0 ? void 0 : result.data];
|
|
172
|
+
case 2:
|
|
173
|
+
error_5 = _a.sent();
|
|
174
|
+
if ((0, helpers_1.isApiError)(error_5)) {
|
|
175
|
+
throw error_5;
|
|
176
|
+
}
|
|
177
|
+
throw error_5;
|
|
178
|
+
case 3: return [2];
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
}); },
|
|
157
182
|
};
|
|
158
183
|
exports.Authentication = Authentication;
|
package/dist/constants.d.ts
CHANGED
package/dist/constants.js
CHANGED
|
@@ -113,6 +113,7 @@ exports.Endpoints = {
|
|
|
113
113
|
login: exports.BaseEndpoints.auth + "/authenticate",
|
|
114
114
|
apiTokenReset: exports.BaseEndpoints.auth + "/api_token_reset",
|
|
115
115
|
passwordResetRequest: exports.BaseEndpoints.auth + "/password_reset_request",
|
|
116
|
+
tokenResetRequest: exports.BaseEndpoints.auth + "/api_token_reset",
|
|
116
117
|
passwordReset: exports.BaseEndpoints.auth + "/password_reset",
|
|
117
118
|
bulkResponse: "" + exports.BaseEndpoints.bulkResponse,
|
|
118
119
|
notification: "" + exports.BaseEndpoints.notification,
|
package/dist/devices/models.d.ts
CHANGED
|
@@ -79,6 +79,8 @@ export interface Device extends DeviceInput, Base {
|
|
|
79
79
|
cell_signal?: number;
|
|
80
80
|
lwm2m_bootstrap_psk_secret_id?: string;
|
|
81
81
|
lwm2m_server_psk_secret_id?: string;
|
|
82
|
+
lwm2m_bootstrap_psk_hash?: string;
|
|
83
|
+
lwm2m_server_psk_hash?: string;
|
|
82
84
|
}
|
|
83
85
|
export interface DevicesFilters extends Filters {
|
|
84
86
|
device_online?: Filter;
|
|
@@ -19,6 +19,8 @@ export interface EscrowDeviceInput {
|
|
|
19
19
|
export interface EscrowDevice extends EscrowDeviceInput, Base {
|
|
20
20
|
lwm2m_bootstrap_psk_secret_id?: string;
|
|
21
21
|
lwm2m_server_psk_secret_id?: string;
|
|
22
|
+
lwm2m_bootstrap_psk_hash?: string;
|
|
23
|
+
lwm2m_server_psk_hash?: string;
|
|
22
24
|
}
|
|
23
25
|
export interface EscrowDevicesFilters extends Filters {
|
|
24
26
|
unique_id?: Filter;
|
package/dist/files/index.js
CHANGED
|
@@ -94,10 +94,10 @@ exports.EIQFiles = (function (_super) {
|
|
|
94
94
|
switch (_a.label) {
|
|
95
95
|
case 0:
|
|
96
96
|
_a.trys.push([0, 2, , 3]);
|
|
97
|
-
this.logAction("Updating file with ID: " + file.
|
|
97
|
+
this.logAction("Updating file with ID: " + file.id);
|
|
98
98
|
axios = __1.EdgeIQAPI.getAxios();
|
|
99
99
|
data = JSON.stringify(file);
|
|
100
|
-
return [4, axios.put(constants_1.Endpoints.file + "/" + file.
|
|
100
|
+
return [4, axios.put(constants_1.Endpoints.file + "/" + file.id, data)];
|
|
101
101
|
case 1:
|
|
102
102
|
result = _a.sent();
|
|
103
103
|
return [2, result === null || result === void 0 ? void 0 : result.data];
|
package/dist/users/models.d.ts
CHANGED