@internetderdinge/api 1.229.2 → 1.229.3
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/src/accounts/accounts.service.js +4 -4
- package/dist/src/accounts/auth0.service.js +12 -13
- package/dist/src/utils/buildRouterAndDocs.js +0 -1
- package/package.json +1 -1
- package/src/accounts/accounts.service.ts +4 -4
- package/src/accounts/auth0.service.ts +12 -12
- package/src/utils/buildRouterAndDocs.ts +0 -2
|
@@ -6,7 +6,7 @@ import { auth0, mfaDisableAccount, mfaEnrollAccount } from "./auth0.service.js";
|
|
|
6
6
|
* @returns {Promise<Stock>}
|
|
7
7
|
*/
|
|
8
8
|
export const getAccountById = async (id) => {
|
|
9
|
-
return auth0.users.get(
|
|
9
|
+
return auth0.users.get(id);
|
|
10
10
|
};
|
|
11
11
|
/**
|
|
12
12
|
* Get user by email
|
|
@@ -39,20 +39,20 @@ export const mfaDisable = async (userId) => {
|
|
|
39
39
|
*/
|
|
40
40
|
export const updateMetaDataById = async (id, updateBody) => {
|
|
41
41
|
// now use the generic update and pass app_metadata
|
|
42
|
-
return auth0.users.update(
|
|
42
|
+
return auth0.users.update(id, { app_metadata: updateBody });
|
|
43
43
|
};
|
|
44
44
|
/**
|
|
45
45
|
* Update user by id
|
|
46
46
|
*/
|
|
47
47
|
export const updateUserById = async (id, updateBody) => {
|
|
48
48
|
// switch to the v3 ManagementClient users.update
|
|
49
|
-
return auth0.users.update(
|
|
49
|
+
return auth0.users.update(id, updateBody);
|
|
50
50
|
};
|
|
51
51
|
/**
|
|
52
52
|
* Delete user by id
|
|
53
53
|
*/
|
|
54
54
|
export const deleteById = async (userId) => {
|
|
55
|
-
return auth0.users.delete(
|
|
55
|
+
return auth0.users.delete(userId);
|
|
56
56
|
};
|
|
57
57
|
export default {
|
|
58
58
|
getAccountById,
|
|
@@ -139,42 +139,41 @@ export const auth0 = new ManagementClient({
|
|
|
139
139
|
token: getAuth0ManagementToken,
|
|
140
140
|
});
|
|
141
141
|
export const getUserIdByEmail = async (email) => {
|
|
142
|
-
|
|
143
|
-
return auth0.usersByEmail.getByEmail({ email });
|
|
142
|
+
return auth0.users.listUsersByEmail({ email });
|
|
144
143
|
};
|
|
145
144
|
export const sendVerificationEmail = async (userID) => {
|
|
146
|
-
return auth0.
|
|
145
|
+
return auth0.tickets.verifyEmail({ user_id: userID });
|
|
147
146
|
};
|
|
148
147
|
export const getUserById = async (userId) => {
|
|
149
|
-
return auth0.users.get(
|
|
148
|
+
return auth0.users.get(userId);
|
|
150
149
|
};
|
|
151
150
|
export const avatar = async (userId) => {
|
|
152
|
-
return auth0.users.get(
|
|
151
|
+
return auth0.users.get(userId);
|
|
153
152
|
};
|
|
154
153
|
export const mfaEnrollAccount = async (userId, mfaToken) => {
|
|
155
|
-
const ticketResponse = await auth0.guardian.
|
|
154
|
+
const ticketResponse = await auth0.guardian.enrollments.createTicket({
|
|
156
155
|
user_id: userId,
|
|
157
156
|
send_mail: false,
|
|
158
157
|
});
|
|
159
158
|
return ticketResponse;
|
|
160
159
|
};
|
|
161
160
|
export const mfaDisableAccount = async (userId) => {
|
|
162
|
-
await auth0.users.
|
|
161
|
+
await auth0.users.authenticationMethods.deleteAll(userId);
|
|
163
162
|
return { success: true };
|
|
164
163
|
};
|
|
165
164
|
export const getUsersByIds = async (postIDs) => {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
});
|
|
165
|
+
const userIds = postIDs.filter(Boolean);
|
|
166
|
+
if (!userIds.length)
|
|
167
|
+
return [];
|
|
168
|
+
const q = userIds.map((id) => `user_id:"${id}"`).join(" OR ");
|
|
171
169
|
const params = {
|
|
172
170
|
search_engine: "v3",
|
|
173
171
|
q,
|
|
174
172
|
per_page: 100,
|
|
175
173
|
page: 0,
|
|
176
174
|
};
|
|
177
|
-
|
|
175
|
+
const page = await auth0.users.list(params);
|
|
176
|
+
return page.data || [];
|
|
178
177
|
};
|
|
179
178
|
export default {
|
|
180
179
|
auth0,
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@ type Stock = any; // Replace with the actual Stock type if available
|
|
|
10
10
|
* @returns {Promise<Stock>}
|
|
11
11
|
*/
|
|
12
12
|
export const getAccountById = async (id: ObjectId): Promise<Stock> => {
|
|
13
|
-
return auth0.users.get(
|
|
13
|
+
return auth0.users.get(id);
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
/**
|
|
@@ -54,7 +54,7 @@ export const updateMetaDataById = async (
|
|
|
54
54
|
updateBody: Record<string, any>,
|
|
55
55
|
): Promise<Stock> => {
|
|
56
56
|
// now use the generic update and pass app_metadata
|
|
57
|
-
return auth0.users.update(
|
|
57
|
+
return auth0.users.update(id, { app_metadata: updateBody });
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
/**
|
|
@@ -65,14 +65,14 @@ export const updateUserById = async (
|
|
|
65
65
|
updateBody: Record<string, any>,
|
|
66
66
|
): Promise<Stock> => {
|
|
67
67
|
// switch to the v3 ManagementClient users.update
|
|
68
|
-
return auth0.users.update(
|
|
68
|
+
return auth0.users.update(id, updateBody);
|
|
69
69
|
};
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
72
|
* Delete user by id
|
|
73
73
|
*/
|
|
74
74
|
export const deleteById = async (userId: ObjectId): Promise<Stock> => {
|
|
75
|
-
return auth0.users.delete(
|
|
75
|
+
return auth0.users.delete(userId);
|
|
76
76
|
};
|
|
77
77
|
|
|
78
78
|
export default {
|
|
@@ -192,27 +192,26 @@ export const auth0 = new ManagementClient({
|
|
|
192
192
|
});
|
|
193
193
|
|
|
194
194
|
export const getUserIdByEmail = async (email: string): Promise<User[]> => {
|
|
195
|
-
|
|
196
|
-
return auth0.usersByEmail.getByEmail({ email });
|
|
195
|
+
return auth0.users.listUsersByEmail({ email });
|
|
197
196
|
};
|
|
198
197
|
|
|
199
198
|
export const sendVerificationEmail = async (userID: string): Promise<any> => {
|
|
200
|
-
return auth0.
|
|
199
|
+
return auth0.tickets.verifyEmail({ user_id: userID });
|
|
201
200
|
};
|
|
202
201
|
|
|
203
202
|
export const getUserById = async (userId: string): Promise<User> => {
|
|
204
|
-
return auth0.users.get(
|
|
203
|
+
return auth0.users.get(userId);
|
|
205
204
|
};
|
|
206
205
|
|
|
207
206
|
export const avatar = async (userId: string): Promise<User> => {
|
|
208
|
-
return auth0.users.get(
|
|
207
|
+
return auth0.users.get(userId);
|
|
209
208
|
};
|
|
210
209
|
|
|
211
210
|
export const mfaEnrollAccount = async (
|
|
212
211
|
userId: string,
|
|
213
212
|
mfaToken: string,
|
|
214
213
|
): Promise<any> => {
|
|
215
|
-
const ticketResponse = await auth0.guardian.
|
|
214
|
+
const ticketResponse = await auth0.guardian.enrollments.createTicket({
|
|
216
215
|
user_id: userId,
|
|
217
216
|
send_mail: false,
|
|
218
217
|
});
|
|
@@ -221,15 +220,15 @@ export const mfaEnrollAccount = async (
|
|
|
221
220
|
};
|
|
222
221
|
|
|
223
222
|
export const mfaDisableAccount = async (userId: string): Promise<any> => {
|
|
224
|
-
await auth0.users.
|
|
223
|
+
await auth0.users.authenticationMethods.deleteAll(userId);
|
|
225
224
|
return { success: true };
|
|
226
225
|
};
|
|
227
226
|
|
|
228
227
|
export const getUsersByIds = async (postIDs: string[]): Promise<User[]> => {
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
});
|
|
228
|
+
const userIds = postIDs.filter(Boolean);
|
|
229
|
+
if (!userIds.length) return [];
|
|
230
|
+
|
|
231
|
+
const q = userIds.map((id) => `user_id:"${id}"`).join(" OR ");
|
|
233
232
|
|
|
234
233
|
const params = {
|
|
235
234
|
search_engine: "v3",
|
|
@@ -238,7 +237,8 @@ export const getUsersByIds = async (postIDs: string[]): Promise<User[]> => {
|
|
|
238
237
|
page: 0,
|
|
239
238
|
};
|
|
240
239
|
|
|
241
|
-
|
|
240
|
+
const page = await auth0.users.list(params);
|
|
241
|
+
return page.data || [];
|
|
242
242
|
};
|
|
243
243
|
|
|
244
244
|
export default {
|