@fabriktor/fx 0.0.43 → 0.0.45
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/users/users.d.ts +7 -1
- package/dist/src/users/users.js +11 -0
- package/package.json +2 -2
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import type { OperationResultOf, TmpPhonesOperator, TmpUsernamesOperator, UsernameVerification, UsersOperator } from "@fabriktor/client";
|
|
1
|
+
import type { GetByUIDOptions, OperationResultOf, TmpPhonesOperator, TmpUsernamesOperator, UsernameVerification, UsersOperator } from "@fabriktor/client";
|
|
2
|
+
import type { User } from "@fabriktor/schema";
|
|
3
|
+
import { type RunSearchOptions, type SearchPage } from "../core/search.js";
|
|
2
4
|
export type ResolveUsernameOptions = Parameters<UsersOperator["resolveUsername"]>[0];
|
|
3
5
|
export type VerifyUsernameOptions = Parameters<TmpUsernamesOperator["verify"]>[0];
|
|
4
6
|
export type GenerateUsernamesOptions = VerifyUsernameOptions;
|
|
7
|
+
export type SearchUsersOptions = GetByUIDOptions & Omit<RunSearchOptions<User>, "search">;
|
|
8
|
+
export type SearchUsersPage = SearchPage<User>;
|
|
5
9
|
export type SendPhoneCodeOptions = Parameters<TmpPhonesOperator["send"]>[0];
|
|
6
10
|
export type VerifyPhoneCodeOptions = Parameters<TmpPhonesOperator["verify"]>[0];
|
|
7
11
|
export type UsersFXOptions = {
|
|
@@ -10,6 +14,7 @@ export type UsersFXOptions = {
|
|
|
10
14
|
tmp_phones: TmpPhonesOperator;
|
|
11
15
|
};
|
|
12
16
|
export interface UsersFXOperator {
|
|
17
|
+
searchUsers(opts: SearchUsersOptions): Promise<SearchUsersPage>;
|
|
13
18
|
resolveUsername(opts: ResolveUsernameOptions): Promise<string>;
|
|
14
19
|
verifyUsername(opts: VerifyUsernameOptions): Promise<OperationResultOf<UsernameVerification>>;
|
|
15
20
|
generateUsernames(opts: GenerateUsernamesOptions): Promise<OperationResultOf<UsernameVerification>>;
|
|
@@ -21,6 +26,7 @@ export declare class UsersFX implements UsersFXOperator {
|
|
|
21
26
|
private tmp_usernames;
|
|
22
27
|
private tmp_phones;
|
|
23
28
|
constructor(opts: UsersFXOptions);
|
|
29
|
+
searchUsers(opts: SearchUsersOptions): Promise<SearchUsersPage>;
|
|
24
30
|
resolveUsername(opts: ResolveUsernameOptions): Promise<string>;
|
|
25
31
|
verifyUsername(opts: VerifyUsernameOptions): Promise<OperationResultOf<UsernameVerification>>;
|
|
26
32
|
generateUsernames(opts: GenerateUsernamesOptions): Promise<OperationResultOf<UsernameVerification>>;
|
package/dist/src/users/users.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
// not use this file except in compliance with the License. You may obtain
|
|
5
5
|
// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
6
|
import { errRequired, errResolveFailed, errValidation, } from "../core/err.js";
|
|
7
|
+
import { runSearch, } from "../core/search.js";
|
|
7
8
|
import { normalizePhone, normalizePhoneCode, validatePhone, validatePhoneCode, } from "./phone.js";
|
|
8
9
|
import { normalizeUsername, validateUsernameFormat } from "./username.js";
|
|
9
10
|
const msgUnableToResolveUsername = "Unable to resolve username.";
|
|
@@ -19,6 +20,16 @@ export class UsersFX {
|
|
|
19
20
|
this.tmp_usernames = opts.tmp_usernames;
|
|
20
21
|
this.tmp_phones = opts.tmp_phones;
|
|
21
22
|
}
|
|
23
|
+
async searchUsers(opts) {
|
|
24
|
+
const { uid, ...searchOpts } = opts;
|
|
25
|
+
return await runSearch({
|
|
26
|
+
...searchOpts,
|
|
27
|
+
search: async (opts) => await this.users.searchManyUsers({
|
|
28
|
+
...opts,
|
|
29
|
+
uid,
|
|
30
|
+
}),
|
|
31
|
+
});
|
|
32
|
+
}
|
|
22
33
|
async resolveUsername(opts) {
|
|
23
34
|
const username = normalizeUsername(opts.username);
|
|
24
35
|
const out = await this.users.resolveUsername({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fabriktor/fx",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.45",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"typescript": "^6.0.3"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@fabriktor/client": "0.0.
|
|
20
|
+
"@fabriktor/client": "0.0.50",
|
|
21
21
|
"@fabriktor/schema": "0.0.32"
|
|
22
22
|
}
|
|
23
23
|
}
|