talizen 0.2.8 → 0.2.9

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/README.md CHANGED
@@ -119,6 +119,7 @@ import {
119
119
  loginWithOAuth,
120
120
  logout,
121
121
  register,
122
+ updateProfile,
122
123
  } from "talizen/auth";
123
124
 
124
125
  await register({
@@ -130,6 +131,9 @@ await register({
130
131
  await login({ account: "alice", password: "secret" });
131
132
 
132
133
  const user = await currentUser();
134
+ await updateProfile({
135
+ address: "No. 1 Example Road",
136
+ });
133
137
  await logout();
134
138
 
135
139
  const providers = await listAuthProviders();
package/auth.d.ts CHANGED
@@ -13,12 +13,13 @@ export interface AuthUser {
13
13
  name?: string;
14
14
  avatar?: string;
15
15
  status?: string;
16
- profile?: unknown;
16
+ profile?: AuthProfile;
17
17
  email_verified_at?: string | null;
18
18
  last_login_at?: string | null;
19
19
  created_at?: string;
20
20
  updated_at?: string;
21
21
  }
22
+ export type AuthProfile = Record<string, unknown>;
22
23
  export interface AuthPasswordInput {
23
24
  /**
24
25
  * Login identifier for register/login.
@@ -33,7 +34,7 @@ export interface AuthRegisterInput extends AuthPasswordInput {
33
34
  phone?: string;
34
35
  name?: string;
35
36
  avatar?: string;
36
- profile?: unknown;
37
+ profile?: AuthProfile;
37
38
  }
38
39
  export interface AuthProvider {
39
40
  key: string;
@@ -55,6 +56,7 @@ export declare function register(input: AuthRegisterInput, options?: TalizenRequ
55
56
  export declare function login(input: AuthPasswordInput, options?: TalizenRequestOptions): Promise<AuthUser>;
56
57
  export declare function logout(options?: TalizenRequestOptions): Promise<void>;
57
58
  export declare function currentUser(options?: TalizenRequestOptions): Promise<AuthUser | null>;
59
+ export declare function updateProfile(profile: AuthProfile, options?: TalizenRequestOptions): Promise<AuthUser>;
58
60
  export declare function requireUser(options?: TalizenRequestOptions): Promise<AuthUser>;
59
61
  export declare function listAuthProviders(options?: TalizenRequestOptions): Promise<AuthProvider[]>;
60
62
  export declare function getOAuthLoginUrl(provider: string, options?: AuthOAuthLoginURLOptions): Promise<string>;
package/auth.js CHANGED
@@ -26,6 +26,12 @@ export async function logout(options) {
26
26
  export async function currentUser(options) {
27
27
  return requestJson("/auth/me", { method: "GET" }, options);
28
28
  }
29
+ export async function updateProfile(profile, options) {
30
+ return requestJson("/auth/me/profile", {
31
+ method: "PUT",
32
+ body: JSON.stringify({ profile }),
33
+ }, options);
34
+ }
29
35
  export async function requireUser(options) {
30
36
  const user = await currentUser(options);
31
37
  if (!user) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "talizen",
3
- "version": "0.2.8",
3
+ "version": "0.2.9",
4
4
  "description": "Talizen frontend SDK types for cms, form and core.",
5
5
  "type": "module",
6
6
  "license": "MIT",