@fabriktor/client 0.0.23 → 0.0.25

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.
@@ -43,7 +43,7 @@ export class HTTPClient {
43
43
  catch (err) {
44
44
  throw errHTTPRequestFailed(err);
45
45
  }
46
- if (res.ok && idempotencyToken !== undefined) {
46
+ if (idempotencyToken !== undefined) {
47
47
  this.idempotency.reset(opts.method, opts.path);
48
48
  }
49
49
  if (!res.ok) {
@@ -1,4 +1,4 @@
1
- import type { InUser, OperationResult, PLUsersContactList, PLUsersForgotPassword, PLUsersResolveUsername, PLUsersSignInLink, UpsertResult, User } from "@fabriktor/schema";
1
+ import type { InUser, OperationResult, PLUsersContactList, PLUsersForgotPassword, PLUsersResolveUsername, PLUsersVerifyEmail, PLUsersSignInLink, UpsertResult, User } from "@fabriktor/schema";
2
2
  import type { TokenProvider } from "../core/auth.js";
3
3
  import type { HTTPDoer, Op } from "../core/http.js";
4
4
  export type BootstrapOptions = {
@@ -7,6 +7,7 @@ export type BootstrapOptions = {
7
7
  export type ResolveUsernameOptions = PLUsersResolveUsername;
8
8
  export type ForgotPasswordOptions = PLUsersForgotPassword;
9
9
  export type SendSignInLinkOptions = PLUsersSignInLink;
10
+ export type SendEmailVerificationOptions = PLUsersVerifyEmail;
10
11
  export type MatchOptions = PLUsersContactList;
11
12
  export type SearchOptions = {
12
13
  q: string;
@@ -18,7 +19,7 @@ export type GetByUIDOptions = {
18
19
  export interface UsersOperator {
19
20
  bootstrap(opts: BootstrapOptions): Promise<Op<UpsertResult>>;
20
21
  sync(): Promise<OperationResult>;
21
- sendEmailVerification(): Promise<void>;
22
+ sendEmailVerification(opts: SendEmailVerificationOptions): Promise<void>;
22
23
  forgotPassword(opts: ForgotPasswordOptions): Promise<void>;
23
24
  sendSignInLink(opts: SendSignInLinkOptions): Promise<void>;
24
25
  resolveUsername(opts: ResolveUsernameOptions): Promise<Op<string>>;
@@ -38,7 +39,7 @@ export declare class UsersClient implements UsersOperator {
38
39
  constructor(opts: UsersClientOptions);
39
40
  bootstrap(opts: BootstrapOptions): Promise<Op<UpsertResult>>;
40
41
  sync(): Promise<OperationResult>;
41
- sendEmailVerification(): Promise<void>;
42
+ sendEmailVerification(opts: SendEmailVerificationOptions): Promise<void>;
42
43
  forgotPassword(opts: ForgotPasswordOptions): Promise<void>;
43
44
  sendSignInLink(opts: SendSignInLinkOptions): Promise<void>;
44
45
  resolveUsername(opts: ResolveUsernameOptions): Promise<Op<string>>;
@@ -34,13 +34,16 @@ export class UsersClient {
34
34
  token,
35
35
  });
36
36
  }
37
- async sendEmailVerification() {
37
+ async sendEmailVerification(opts) {
38
38
  const token = await requiredToken(this.get_token);
39
39
  return await this.http.do({
40
40
  base_url: this.base_url,
41
41
  path: userPath(PathUsersSendEmailVerification),
42
42
  method: HTTPMethodPost,
43
43
  token,
44
+ body: {
45
+ language: opts.language,
46
+ },
44
47
  });
45
48
  }
46
49
  async forgotPassword(opts) {
@@ -63,34 +66,15 @@ export class UsersClient {
63
66
  },
64
67
  });
65
68
  }
66
- // public async resolveUsername(
67
- // opts: ResolveUsernameOptions,
68
- // ): Promise<Op<string>> {
69
- // return await this.http.do<PLUsersResolveUsername, Op<string>>({
70
- // base_url: this.base_url,
71
- // path: userPath(PathUsersResolveUsername),
72
- // method: HTTPMethodPost,
73
- // body: {
74
- // username: opts.username,
75
- // },
76
- // });
77
- // }
78
69
  async resolveUsername(opts) {
79
- const body = {
80
- username: opts.username,
81
- };
82
- console.log("[client/users.resolveUsername] request", {
83
- path: userPath(PathUsersResolveUsername),
84
- body,
85
- });
86
- const out = await this.http.do({
70
+ return await this.http.do({
87
71
  base_url: this.base_url,
88
72
  path: userPath(PathUsersResolveUsername),
89
73
  method: HTTPMethodPost,
90
- body,
74
+ body: {
75
+ username: opts.username,
76
+ },
91
77
  });
92
- console.log("[client/users.resolveUsername] response", out);
93
- return out;
94
78
  }
95
79
  async match(opts) {
96
80
  const token = await requiredToken(this.get_token);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fabriktor/client",
3
- "version": "0.0.23",
3
+ "version": "0.0.25",
4
4
  "description": "![Fabriktor Logo](./img/fabriktor-character.gif)",
5
5
  "type": "module",
6
6
  "exports": {
@@ -17,6 +17,6 @@
17
17
  "typescript": "^6.0.3"
18
18
  },
19
19
  "dependencies": {
20
- "@fabriktor/schema": "^0.0.16"
20
+ "@fabriktor/schema": "^0.0.18"
21
21
  }
22
22
  }