talizen 0.2.6 → 0.2.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/README.md +11 -5
- package/auth.d.ts +14 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -114,8 +114,13 @@ When a `File` object appears in the payload, `submitForm()` will:
|
|
|
114
114
|
```ts
|
|
115
115
|
import { currentUser, login, logout, register } from "talizen/auth";
|
|
116
116
|
|
|
117
|
-
await register({
|
|
118
|
-
|
|
117
|
+
await register({
|
|
118
|
+
account: "alice",
|
|
119
|
+
password: "secret",
|
|
120
|
+
name: "Alice",
|
|
121
|
+
email: "hi@talizen.com",
|
|
122
|
+
});
|
|
123
|
+
await login({ account: "alice", password: "secret" });
|
|
119
124
|
|
|
120
125
|
const user = await currentUser();
|
|
121
126
|
await logout();
|
|
@@ -126,16 +131,17 @@ await logout();
|
|
|
126
131
|
```ts
|
|
127
132
|
import { invoke } from "talizen/func";
|
|
128
133
|
|
|
129
|
-
const result = await invoke<{
|
|
134
|
+
const result = await invoke<{ ok: boolean; id: string }>("booking.create", {
|
|
130
135
|
email: "hi@talizen.com",
|
|
131
|
-
|
|
136
|
+
date: "2026-07-04",
|
|
137
|
+
time: "10:00",
|
|
132
138
|
});
|
|
133
139
|
```
|
|
134
140
|
|
|
135
141
|
`invoke("<fileKey>.<method>", input)` calls the method exported by the script file. If `.method` is omitted, Talizen calls `main`:
|
|
136
142
|
|
|
137
143
|
```ts
|
|
138
|
-
await invoke("
|
|
144
|
+
await invoke("booking", { email: "hi@talizen.com" });
|
|
139
145
|
```
|
|
140
146
|
|
|
141
147
|
### Write function runtime code
|
package/auth.d.ts
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import { type TalizenRequestOptions } from "./core.js";
|
|
2
2
|
export interface AuthUser {
|
|
3
3
|
id: string;
|
|
4
|
+
/**
|
|
5
|
+
* Login identifier for this project user.
|
|
6
|
+
* This does not need to be an email address or phone number.
|
|
7
|
+
*/
|
|
8
|
+
account?: string;
|
|
9
|
+
/** Optional contact email/profile field, not the primary login identifier. */
|
|
4
10
|
email?: string;
|
|
11
|
+
/** Optional contact phone/profile field, not the primary login identifier. */
|
|
5
12
|
phone?: string;
|
|
6
13
|
name?: string;
|
|
7
14
|
avatar?: string;
|
|
@@ -13,10 +20,16 @@ export interface AuthUser {
|
|
|
13
20
|
updated_at?: string;
|
|
14
21
|
}
|
|
15
22
|
export interface AuthPasswordInput {
|
|
16
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Login identifier for register/login.
|
|
25
|
+
* Do not substitute email or phone unless the user intentionally uses that
|
|
26
|
+
* value as their account.
|
|
27
|
+
*/
|
|
28
|
+
account: string;
|
|
17
29
|
password: string;
|
|
18
30
|
}
|
|
19
31
|
export interface AuthRegisterInput extends AuthPasswordInput {
|
|
32
|
+
email?: string;
|
|
20
33
|
phone?: string;
|
|
21
34
|
name?: string;
|
|
22
35
|
avatar?: string;
|