@squadbase/server 0.1.0 → 0.2.1-beta.0
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 +6 -6
- package/dist/index.cjs +8 -4067
- package/dist/index.js +1 -4060
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -16,11 +16,12 @@ pnpm add @squadbase/server
|
|
|
16
16
|
|
|
17
17
|
### User Session
|
|
18
18
|
|
|
19
|
+
User info is automatically available in apps deployed to Squadbase or running in Squadbase Editor.
|
|
20
|
+
|
|
19
21
|
```typescript
|
|
20
22
|
import { createServerClient } from "@squadbase/server";
|
|
21
23
|
|
|
22
24
|
const client = createServerClient({
|
|
23
|
-
projectId: "your-project-id",
|
|
24
25
|
cookieOptions: {
|
|
25
26
|
getCookie: () => {
|
|
26
27
|
// Implement your cookie retrieval logic here
|
|
@@ -31,7 +32,6 @@ const client = createServerClient({
|
|
|
31
32
|
|
|
32
33
|
// Get the current authenticated user
|
|
33
34
|
const user = await client.getUser();
|
|
34
|
-
console.log(user);
|
|
35
35
|
// {
|
|
36
36
|
// username: string,
|
|
37
37
|
// email: string,
|
|
@@ -42,9 +42,9 @@ console.log(user);
|
|
|
42
42
|
// }
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
###
|
|
45
|
+
### Outside Squadbase Environments
|
|
46
46
|
|
|
47
|
-
For local development, you
|
|
47
|
+
For use outside Squadbase environments (e.g., local development), you must set the `projectId` and `mockUser` options. These settings are not needed in Squadbase Editor or deployed environments.
|
|
48
48
|
|
|
49
49
|
```typescript
|
|
50
50
|
const client = createServerClient({
|
|
@@ -71,10 +71,10 @@ Creates a new server client instance.
|
|
|
71
71
|
|
|
72
72
|
#### Options
|
|
73
73
|
|
|
74
|
-
- `projectId` (
|
|
74
|
+
- `projectId` (optional): Your Squadbase project ID. Required outside Squadbase environments.
|
|
75
75
|
- `cookieOptions` (object):
|
|
76
76
|
- `getCookie`: Function that returns the session cookie string
|
|
77
|
-
- `mockUser` (optional): Mock user object for
|
|
77
|
+
- `mockUser` (optional): Mock user object for use outside Squadbase environments
|
|
78
78
|
|
|
79
79
|
### `ServerClient`
|
|
80
80
|
|