create-feltkit 0.3.13 → 0.3.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-feltkit",
3
- "version": "0.3.13",
3
+ "version": "0.3.15",
4
4
  "description": "Create a FeltKit application: npm create feltkit@latest my-app (add -- --template managed for Managed FeltDB)",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -2,4 +2,11 @@ node_modules/
2
2
  dist/
3
3
  .feltkit/
4
4
  .feltkit-platform/
5
+ # Credentials and local deployment state: environment files (FELTKIT_*, FELTDB_* keys), and what
6
+ # `feltdb init-managed` / `feltdb managed keys` write if this app later moves to Managed FeltDB.
7
+ # Never commit.
8
+ .env
9
+ .env.*
10
+ !.env.example
11
+ .feltdb/
5
12
  *.app/
@@ -13,7 +13,7 @@
13
13
  "typecheck": "tsc --noEmit"
14
14
  },
15
15
  "dependencies": {
16
- "@feltdb/feltkit": "0.3.13",
16
+ "@feltdb/feltkit": "0.3.15",
17
17
  "react": "19.2.0",
18
18
  "react-dom": "19.2.0"
19
19
  },
@@ -161,16 +161,55 @@ function SignedOut(props: {
161
161
  ) : props.accounts ? (
162
162
  <AccountForm signUpOpen={props.accounts.signUp} email={Boolean(props.accounts.email)} providers={props.accounts.providers ?? []} onSignIn={props.onSignIn} onSignUp={props.onSignUp} />
163
163
  ) : (
164
- <>
165
- <h1>Sign in</h1>
166
- <p className="muted">Sign-in isn't available for this app yet.</p>
167
- </>
164
+ <SessionForm />
168
165
  )}
169
166
  </div>
170
167
  </div>
171
168
  );
172
169
  }
173
170
 
171
+ /**
172
+ * No dev users and no accounts: access is given by whoever operates the deployment (on AppBoundry,
173
+ * `appboundry admin sessions issue --user <id>`). The session they hand over is pasted here; the
174
+ * server decides whether it is valid, and what it may do.
175
+ */
176
+ function SessionForm() {
177
+ const client = useFeltKit();
178
+ const [token, setToken] = useState("");
179
+ const [error, setError] = useState<string | null>(null);
180
+ const [busy, setBusy] = useState(false);
181
+ const submit = async (e: FormEvent) => {
182
+ e.preventDefault();
183
+ setError(null);
184
+ setBusy(true);
185
+ try {
186
+ client.setToken(token.trim());
187
+ const session = await client.session();
188
+ if (!session.principal) {
189
+ client.setToken(null);
190
+ setError("That session isn't valid, or it has expired or been revoked. Ask your operator for a new one.");
191
+ }
192
+ } catch (err) {
193
+ client.setToken(null);
194
+ setError(describe(err));
195
+ } finally {
196
+ setBusy(false);
197
+ }
198
+ };
199
+ return (
200
+ <form className="stack" onSubmit={submit}>
201
+ <h1>Sign in</h1>
202
+ <p className="muted">Access to this app is given by its operator. Paste the session they issued you.</p>
203
+ <label className="field">
204
+ <span>Session</span>
205
+ <input type="password" autoComplete="off" spellCheck={false} value={token} onChange={(e) => setToken(e.target.value)} placeholder="abs_…" required autoFocus />
206
+ </label>
207
+ {error && <p className="error-text" role="alert">{error}</p>}
208
+ <button className="wide" type="submit" disabled={busy || !token.trim()}>{busy ? "Signing in…" : "Sign in"}</button>
209
+ </form>
210
+ );
211
+ }
212
+
174
213
  /** Sign in to an existing account, or create one (auth.accounts in feltkit/app.ts). */
175
214
  function AccountForm(props: {
176
215
  signUpOpen: boolean;
@@ -5,5 +5,6 @@ dist/
5
5
  # Written by `feltdb init-managed` / `feltdb managed keys`: keys and local deployment state. Never commit.
6
6
  .env
7
7
  .env.*
8
+ !.env.example
8
9
  .feltdb/
9
10
  *.app/
@@ -20,7 +20,7 @@
20
20
  "deploy:fly": "node scripts/deploy-fly.mjs"
21
21
  },
22
22
  "dependencies": {
23
- "@feltdb/feltkit": "0.3.13"
23
+ "@feltdb/feltkit": "0.3.15"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@feltdb/core": ">=0.21.0 <1.0.0",