@palettelab/sdk 0.1.6 → 0.1.8
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 +103 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,6 +12,109 @@ npm install @palettelab/sdk react react-dom
|
|
|
12
12
|
|
|
13
13
|
`react` and `react-dom` are peer dependencies. Plugin bundles should externalize React and `@palettelab/sdk`; the Palette CLI handles this for standard templates.
|
|
14
14
|
|
|
15
|
+
## Recommended Developer Flow
|
|
16
|
+
|
|
17
|
+
Create apps with the Palette CLI and use this SDK from the generated frontend.
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npx --yes @palettelab/cli@latest init simple-todo --template database
|
|
21
|
+
cd simple-todo
|
|
22
|
+
npm install
|
|
23
|
+
npx --yes @palettelab/cli@latest dev
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
`pltt dev` starts the local SDK simulator. It provides mock platform context,
|
|
27
|
+
authenticated API helpers, local backend routing, and a local database when the
|
|
28
|
+
app declares database support. This is the fastest loop for building UI,
|
|
29
|
+
calling backend routes, and checking SDK behavior.
|
|
30
|
+
|
|
31
|
+
For real Palette OS testing without Docker, configure a hosted sandbox and run:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npx --yes @palettelab/cli@latest login \
|
|
35
|
+
--env staging \
|
|
36
|
+
--url https://YOUR-PALETTE-STAGING-URL \
|
|
37
|
+
--token pltt_xxxxx
|
|
38
|
+
|
|
39
|
+
npx --yes @palettelab/cli@latest dev --sandbox --env staging
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
The hosted sandbox publishes a preview into the configured Palette environment
|
|
43
|
+
and returns an OS preview URL. Use that URL when the app must be tested with
|
|
44
|
+
real login context, organization context, Data Room APIs, storage, install
|
|
45
|
+
state, review/publish state, logs, permissions, and platform APIs.
|
|
46
|
+
|
|
47
|
+
## Staging URL And Token
|
|
48
|
+
|
|
49
|
+
The staging URL is the base URL of the Palette backend/API environment used by
|
|
50
|
+
the CLI. It must serve backend API paths such as:
|
|
51
|
+
|
|
52
|
+
```text
|
|
53
|
+
/api/v1/health
|
|
54
|
+
/api/v1/appstore/sign-upload
|
|
55
|
+
/api/v1/appstore/publish
|
|
56
|
+
/api/v1/developer/publish-tokens
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Validate it before configuring the CLI:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
curl https://YOUR-PALETTE-STAGING-URL/api/v1/health
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
If this returns backend health JSON, the URL is correct. If it returns the
|
|
66
|
+
frontend app HTML, use the backend domain instead or configure your reverse
|
|
67
|
+
proxy so `/api/v1/*` and `/api/superadmin/*` are routed to the backend.
|
|
68
|
+
|
|
69
|
+
Publish tokens start with `pltt_`. Developers can create one after logging in:
|
|
70
|
+
|
|
71
|
+
1. Open Palette OS.
|
|
72
|
+
2. Open Settings.
|
|
73
|
+
3. Open Developer.
|
|
74
|
+
4. Create a developer publish token.
|
|
75
|
+
5. Copy it immediately. The raw token is shown only once.
|
|
76
|
+
|
|
77
|
+
Then save it locally:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
npx --yes @palettelab/cli@latest login \
|
|
81
|
+
--env staging \
|
|
82
|
+
--url https://YOUR-PALETTE-STAGING-URL \
|
|
83
|
+
--token pltt_xxxxx
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
The CLI stores this in `~/.palette/config.json` with restricted file
|
|
87
|
+
permissions. You can also use environment variables:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
export PALETTE_STAGING_URL=https://YOUR-PALETTE-STAGING-URL
|
|
91
|
+
export PALETTE_STAGING_TOKEN=pltt_xxxxx
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Local Simulator Versus Hosted OS
|
|
95
|
+
|
|
96
|
+
Use the local simulator for everyday development:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
npx --yes @palettelab/cli@latest dev
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Use hosted sandbox for full OS behavior:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
npx --yes @palettelab/cli@latest dev --sandbox --env staging
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
For internal sandbox environments where manual approval should not block app
|
|
109
|
+
testing, run the Palette backend with:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
APPSTORE_AUTO_APPROVE_SANDBOX_PREVIEWS=true
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
When enabled, passing sandbox preview publishes become active automatically, so
|
|
116
|
+
the developer can immediately test the app inside the OS preview URL.
|
|
117
|
+
|
|
15
118
|
## Exports
|
|
16
119
|
|
|
17
120
|
```ts
|