@fabriktor/client 0.0.6 → 0.0.7
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/core/err.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
// Copyright (C) Fabriktor, Inc. 2025-present.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
4
|
+
// not use this file except in compliance with the License. You may obtain
|
|
5
|
+
// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
1
6
|
export class ClientErr extends Error {
|
|
2
7
|
code;
|
|
3
8
|
app_err;
|
package/dist/src/core/http.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
// Copyright (C) Fabriktor, Inc. 2025-present.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
4
|
+
// not use this file except in compliance with the License. You may obtain
|
|
5
|
+
// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
1
6
|
import { MimeJSON, } from "@fabriktor/schema";
|
|
2
7
|
import { newClientErrFromHTTP } from "./err";
|
|
3
8
|
const headerAuthorization = "authorization";
|
package/dist/src/core/path.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
// Copyright (C) Fabriktor, Inc. 2025-present.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
4
|
+
// not use this file except in compliance with the License. You may obtain
|
|
5
|
+
// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
1
6
|
import { PathActions } from "@fabriktor/schema";
|
|
2
7
|
const pathSep = "/";
|
|
3
8
|
function clean(v) {
|
|
@@ -7,10 +7,15 @@ export type AuthOptions = {
|
|
|
7
7
|
export type BootstrapOptions = AuthOptions & {
|
|
8
8
|
in: InUser;
|
|
9
9
|
};
|
|
10
|
+
export type ResolveUsernameOptions = {
|
|
11
|
+
base_url: string;
|
|
12
|
+
username: string;
|
|
13
|
+
};
|
|
10
14
|
export interface UsersOperator {
|
|
11
15
|
bootstrap(opts: BootstrapOptions): Promise<Op<UpsertResult>>;
|
|
12
16
|
sync(opts: AuthOptions): Promise<OperationResult>;
|
|
13
17
|
sendEmailVerification(opts: AuthOptions): Promise<void>;
|
|
18
|
+
resolveUsername(opts: ResolveUsernameOptions): Promise<Op<string>>;
|
|
14
19
|
}
|
|
15
20
|
export type UsersClientOptions = {
|
|
16
21
|
http: HTTPDoer;
|
|
@@ -21,5 +26,6 @@ export declare class UsersClient implements UsersOperator {
|
|
|
21
26
|
bootstrap(opts: BootstrapOptions): Promise<Op<UpsertResult>>;
|
|
22
27
|
sync(opts: AuthOptions): Promise<OperationResult>;
|
|
23
28
|
sendEmailVerification(opts: AuthOptions): Promise<void>;
|
|
29
|
+
resolveUsername(opts: ResolveUsernameOptions): Promise<Op<string>>;
|
|
24
30
|
}
|
|
25
31
|
export declare function newUsersClient(opts: UsersClientOptions): UsersClient;
|
package/dist/src/users/users.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
// Copyright (C) Fabriktor, Inc. 2025-present.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
4
|
+
// not use this file except in compliance with the License. You may obtain
|
|
5
|
+
// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
import { ColUsersUsers, HTTPMethodPost, PathUsersBootstrap, PathUsersResolveUsername, PathUsersSendEmailVerification, PathUsersSync, SvcUsers, } from "@fabriktor/schema";
|
|
2
7
|
import { buildPath } from "../core/path";
|
|
3
8
|
export class UsersClient {
|
|
4
9
|
http;
|
|
@@ -30,6 +35,16 @@ export class UsersClient {
|
|
|
30
35
|
token: opts.token,
|
|
31
36
|
});
|
|
32
37
|
}
|
|
38
|
+
async resolveUsername(opts) {
|
|
39
|
+
return await this.http.do({
|
|
40
|
+
base_url: opts.base_url,
|
|
41
|
+
path: userPath(PathUsersResolveUsername),
|
|
42
|
+
method: HTTPMethodPost,
|
|
43
|
+
body: {
|
|
44
|
+
username: opts.username,
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
}
|
|
33
48
|
}
|
|
34
49
|
export function newUsersClient(opts) {
|
|
35
50
|
return new UsersClient(opts);
|