@jskit-ai/agent-docs 0.1.62 → 0.1.64
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/guide/agent/app-setup/authentication.md +101 -155
- package/guide/agent/app-setup/database-layer.md +24 -34
- package/guide/agent/app-setup/initial-scaffolding.md +4 -8
- package/guide/agent/app-setup/quickstart.md +5 -9
- package/guide/agent/app-setup/users.md +39 -30
- package/guide/agent/app-setup/working-with-the-jskit-cli.md +27 -31
- package/package.json +1 -1
- package/reference/autogen/README.md +1 -0
- package/reference/autogen/packages/auth-core.md +74 -0
- package/reference/autogen/packages/auth-provider-local-core.md +112 -0
- package/reference/autogen/packages/auth-provider-supabase-core.md +3 -12
- package/reference/autogen/packages/auth-web.md +30 -1
- package/reference/autogen/tooling/jskit-cli.md +5 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Database layer
|
|
4
4
|
|
|
5
|
-
At the end of the previous chapter, the app could already authenticate real users through
|
|
5
|
+
At the end of the previous chapter, the app could already authenticate real users through the local auth provider, without requiring Supabase or a database. In this chapter, we install the MySQL database runtime, add the migration tooling, and explain what that changes immediately and what it still does **not** change yet.
|
|
6
6
|
|
|
7
7
|
This chapter is more infrastructural than the previous ones. That is intentional. There is no dramatic new screen in the browser. The important change is that the app gains a real database layer that later packages can depend on.
|
|
8
8
|
|
|
@@ -484,32 +484,31 @@ But the app still does **not** have:
|
|
|
484
484
|
- workspace tables
|
|
485
485
|
- CRUD tables of its own
|
|
486
486
|
|
|
487
|
-
That means
|
|
487
|
+
That means the app's account model still is not database-backed.
|
|
488
488
|
|
|
489
|
-
-
|
|
489
|
+
- local auth is still the real source of truth for auth users and sessions.
|
|
490
490
|
- JSKIT still has a database runtime available.
|
|
491
|
-
- But JSKIT still has **no installed package yet** that
|
|
491
|
+
- But JSKIT still has **no installed package yet** that projects auth identities into persistent users/account tables.
|
|
492
492
|
|
|
493
493
|
So this chapter is an infrastructure step. It makes the database layer available, but it does not yet install the package that uses that layer for persistent JSKIT-side user data.
|
|
494
494
|
|
|
495
|
-
**Important: Auth Is
|
|
495
|
+
**Important: Auth Is Not Users-Backed Yet**
|
|
496
496
|
|
|
497
497
|
This is the most important thing to keep straight:
|
|
498
498
|
|
|
499
|
-
- adding `database-runtime-mysql` does **not** automatically
|
|
499
|
+
- adding `database-runtime-mysql` does **not** automatically change where auth stores credentials or sessions
|
|
500
500
|
- it also does **not** create JSKIT user rows yet
|
|
501
501
|
|
|
502
|
-
That only changes later, when a package such as `users-core` is installed and
|
|
502
|
+
That only changes later, when a package such as `users-core` is installed and registers the persistent users-backed `auth.profile.projector`.
|
|
503
503
|
|
|
504
504
|
So after this chapter the app has a database layer, but authentication still behaves like:
|
|
505
505
|
|
|
506
|
-
- real
|
|
507
|
-
-
|
|
506
|
+
- real local auth
|
|
507
|
+
- provider identity in the auth session
|
|
508
508
|
|
|
509
509
|
not yet:
|
|
510
510
|
|
|
511
|
-
- real
|
|
512
|
-
- persistent JSKIT-side users layer
|
|
511
|
+
- real local auth plus a persistent JSKIT-side users layer
|
|
513
512
|
|
|
514
513
|
## Under the hood
|
|
515
514
|
|
|
@@ -702,43 +701,34 @@ Right now:
|
|
|
702
701
|
|
|
703
702
|
- `shell-web` is still a shell/layout package
|
|
704
703
|
- `auth-web` is still a web auth package
|
|
705
|
-
- `auth-provider-
|
|
704
|
+
- `auth-provider-local-core` is still handling credentials and sessions through `auth.local.backend`
|
|
706
705
|
|
|
707
706
|
So the app has gained a new capability, but no visible part of the UI depends on that capability yet.
|
|
708
707
|
|
|
709
|
-
### Why auth
|
|
708
|
+
### Why auth is not users-backed yet
|
|
710
709
|
|
|
711
710
|
This is the most important code path to read in this chapter.
|
|
712
711
|
|
|
713
|
-
Inside
|
|
712
|
+
Inside the local provider, auth only projects provider identities into the app users layer when something registers the provider-neutral `auth.profile.projector` token:
|
|
714
713
|
|
|
715
714
|
```js
|
|
716
|
-
const
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
if (authProfileMode === PROFILE_MODE_USERS) {
|
|
720
|
-
if (!scope.has("users.profile.sync.service")) {
|
|
721
|
-
throw new Error(
|
|
722
|
-
"AuthSupabaseServiceProvider requires users.profile.sync.service when config.auth.profileMode is \"users\"."
|
|
723
|
-
);
|
|
724
|
-
}
|
|
725
|
-
userProfileSyncService = scope.make("users.profile.sync.service");
|
|
726
|
-
}
|
|
715
|
+
const profileProjector = scope.has("auth.profile.projector")
|
|
716
|
+
? scope.make("auth.profile.projector")
|
|
717
|
+
: null;
|
|
727
718
|
```
|
|
728
719
|
|
|
729
720
|
That snippet explains the whole consequence of this chapter.
|
|
730
721
|
|
|
731
|
-
- The auth provider
|
|
732
|
-
-
|
|
733
|
-
- The fallback service is still the in-memory profile sync service from the previous chapter.
|
|
734
|
-
- Nothing in `database-runtime-mysql` changes `config.auth.profileMode`.
|
|
722
|
+
- The auth provider can authenticate users without an app database.
|
|
723
|
+
- Nothing in `database-runtime-mysql` registers `auth.profile.projector`.
|
|
735
724
|
- Nothing in `database-runtime-mysql` provides `users.profile.sync.service`.
|
|
725
|
+
- The database runtime only provides the database foundation that later packages can use.
|
|
736
726
|
|
|
737
727
|
So the auth layer keeps behaving the same way it did before:
|
|
738
728
|
|
|
739
|
-
-
|
|
740
|
-
- JSKIT still
|
|
741
|
-
-
|
|
729
|
+
- local auth still owns the auth user and session
|
|
730
|
+
- JSKIT can still display the provider identity from the auth session
|
|
731
|
+
- there is still no persistent JSKIT users/account model yet
|
|
742
732
|
|
|
743
733
|
The database runtime is ready, but the users layer that will actually use it has not been installed yet.
|
|
744
734
|
|
|
@@ -765,12 +755,12 @@ This chapter did not make the app feel dramatically different in the browser, bu
|
|
|
765
755
|
|
|
766
756
|
But just as importantly, this chapter also defined what has **not** changed yet:
|
|
767
757
|
|
|
768
|
-
- auth still uses the
|
|
758
|
+
- auth still uses the local provider's own backend
|
|
769
759
|
- JSKIT still has no persistent users layer of its own
|
|
770
760
|
- no feature package has started storing real app data yet
|
|
771
761
|
|
|
772
762
|
So the right mental model at the end of this chapter is:
|
|
773
763
|
|
|
774
|
-
-
|
|
764
|
+
- local auth already handles real authentication
|
|
775
765
|
- MySQL is wired up and ready
|
|
776
766
|
- the persistent JSKIT-side user model arrives in the next chapter
|
|
@@ -43,8 +43,6 @@ Minimal apps can still install the standard shell later with `npx jskit add pack
|
|
|
43
43
|
If you already know you want a small non-workspace baseline right after the scaffold, this is the shortest reproducible path:
|
|
44
44
|
|
|
45
45
|
```bash
|
|
46
|
-
SUPABASE_URL=...
|
|
47
|
-
SUPABASE_KEY=...
|
|
48
46
|
DB_HOST=127.0.0.1
|
|
49
47
|
DB_PORT=3306
|
|
50
48
|
DB_NAME=exampleapp
|
|
@@ -55,12 +53,8 @@ npx @jskit-ai/create-app exampleapp --tenancy-mode none
|
|
|
55
53
|
cd exampleapp
|
|
56
54
|
npm install
|
|
57
55
|
|
|
58
|
-
npx jskit add package auth-provider-
|
|
59
|
-
|
|
60
|
-
--auth-supabase-publishable-key "$SUPABASE_KEY" \
|
|
61
|
-
--app-public-url "http://localhost:5173"
|
|
62
|
-
|
|
63
|
-
npx jskit add bundle auth-base
|
|
56
|
+
npx jskit add package auth-provider-local-core
|
|
57
|
+
npx jskit add package auth-web
|
|
64
58
|
|
|
65
59
|
npx jskit add package database-runtime-mysql \
|
|
66
60
|
--db-host "$DB_HOST" \
|
|
@@ -76,6 +70,8 @@ npm install
|
|
|
76
70
|
npm run db:migrate
|
|
77
71
|
```
|
|
78
72
|
|
|
73
|
+
The default auth install is intentionally local and simple. Do not start a new app by adding Supabase, OAuth, OTP, provider linking, or a users/profile projection unless that complexity is already part of the app you are building.
|
|
74
|
+
|
|
79
75
|
If you want the larger workspace-enabled stack with the first assistant already configured, use [Quickstart](/guide/app-setup/quickstart) instead.
|
|
80
76
|
|
|
81
77
|
**Try Bash Completion!**
|
|
@@ -15,7 +15,7 @@ The base flow below gives you:
|
|
|
15
15
|
- users
|
|
16
16
|
- console
|
|
17
17
|
- MySQL
|
|
18
|
-
-
|
|
18
|
+
- local auth with no external auth service
|
|
19
19
|
- one `admin` assistant configured from `console`
|
|
20
20
|
|
|
21
21
|
It also shows the first page-extension moves most apps need:
|
|
@@ -32,8 +32,6 @@ Set these values first:
|
|
|
32
32
|
|
|
33
33
|
```bash
|
|
34
34
|
OPENAI_API_KEY=...
|
|
35
|
-
SUPABASE_URL=...
|
|
36
|
-
SUPABASE_KEY=...
|
|
37
35
|
DB_HOST=127.0.0.1
|
|
38
36
|
DB_PORT=3306
|
|
39
37
|
DB_NAME=testapp
|
|
@@ -50,12 +48,8 @@ npx @jskit-ai/create-app testapp --tenancy-mode personal
|
|
|
50
48
|
cd testapp
|
|
51
49
|
npm install
|
|
52
50
|
|
|
53
|
-
npx jskit add package auth-provider-
|
|
54
|
-
|
|
55
|
-
--auth-supabase-publishable-key "$SUPABASE_KEY" \
|
|
56
|
-
--app-public-url "http://localhost:5173"
|
|
57
|
-
|
|
58
|
-
npx jskit add bundle auth-base
|
|
51
|
+
npx jskit add package auth-provider-local-core
|
|
52
|
+
npx jskit add package auth-web
|
|
59
53
|
|
|
60
54
|
npx jskit add package database-runtime-mysql \
|
|
61
55
|
--db-host "$DB_HOST" \
|
|
@@ -89,6 +83,8 @@ npm install
|
|
|
89
83
|
npm run db:migrate
|
|
90
84
|
```
|
|
91
85
|
|
|
86
|
+
Keep authentication deliberately basic while the product is still taking shape. Start with the local provider and `auth-web`, build the app's core workflows, then add Supabase, OAuth, OTP, provider linking, app-user projection, or workspace/account complexity when the product actually needs those features.
|
|
87
|
+
|
|
92
88
|
At this point you have:
|
|
93
89
|
|
|
94
90
|
- a workspace-enabled app with `tenancyMode = "personal"`
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
# Users
|
|
4
4
|
|
|
5
|
-
At the end of the previous chapter, the app had a real database runtime, but it still did not have JSKIT's own persistent users layer. Authentication worked, but
|
|
5
|
+
At the end of the previous chapter, the app had a real database runtime, but it still did not have JSKIT's own persistent users layer. Authentication worked, but signed-in people were still only provider identities from the auth layer.
|
|
6
6
|
|
|
7
|
-
This chapter is where that changes. We install `users-web`, run the new migrations, and let JSKIT start treating authenticated people as persistent app users rather than only as
|
|
7
|
+
This chapter is where that changes. We install `users-web`, run the new migrations, and let JSKIT start treating authenticated people as persistent app users rather than only as auth-provider identities.
|
|
8
8
|
|
|
9
9
|
`users-web` sounds like a UI package, but it is actually the point where several layers arrive together:
|
|
10
10
|
|
|
11
11
|
- the persistent users/account data model from `users-core`
|
|
12
12
|
- the account surface and account settings UI
|
|
13
|
-
- the switch from
|
|
13
|
+
- the switch from provider-only auth profiles to users-backed auth profile projection
|
|
14
14
|
|
|
15
15
|
This is also the first chapter where the difference between "JSKIT wrote migration files into the app" and "Knex applied those files to the database" becomes important in practice.
|
|
16
16
|
|
|
@@ -39,10 +39,11 @@ This is the first chapter where the migration step is not just "nice to have."
|
|
|
39
39
|
|
|
40
40
|
`users-core` writes:
|
|
41
41
|
|
|
42
|
+
- the provider-neutral `auth.profile.projector` service binding through its runtime provider
|
|
42
43
|
- `config.auth.profileMode = "users"` into `config/server.js`
|
|
43
44
|
- real users/account schema migrations into `migrations/`
|
|
44
45
|
|
|
45
|
-
That means the app is expected to
|
|
46
|
+
That means the app is expected to project authenticated identities into the persistent users-backed profile sync service. If you skip `npm run db:migrate`, the code and routes are installed, but the required tables are still missing.
|
|
46
47
|
|
|
47
48
|
So the correct flow is:
|
|
48
49
|
|
|
@@ -63,14 +64,14 @@ This chapter is the real transition from "authentication exists" to "the app kno
|
|
|
63
64
|
|
|
64
65
|
### Authentication becomes users-backed
|
|
65
66
|
|
|
66
|
-
In the database chapter, JSKIT
|
|
67
|
+
In the database chapter, JSKIT still treated the signed-in person as an auth-provider identity. After installing `users-web`, JSKIT expects to synchronize authenticated users into real JSKIT tables.
|
|
67
68
|
|
|
68
69
|
That is the biggest architectural change in this chapter.
|
|
69
70
|
|
|
70
|
-
-
|
|
71
|
+
- the selected auth provider still owns the auth identity and session
|
|
71
72
|
- JSKIT owns a persistent users/account data model in MySQL
|
|
72
73
|
|
|
73
|
-
So after this chapter, a signed-in user is not only "someone
|
|
74
|
+
So after this chapter, a signed-in user is not only "someone the auth provider knows about." They are also a persistent JSKIT-side user with settings and profile state in the app database.
|
|
74
75
|
|
|
75
76
|
### The app gets an authenticated account surface
|
|
76
77
|
|
|
@@ -119,20 +120,28 @@ This is the first chapter where the app starts to feel like it has a real user m
|
|
|
119
120
|
|
|
120
121
|
The most interesting files are spread across config, migrations, routing, and the app-owned account UI.
|
|
121
122
|
|
|
122
|
-
### `
|
|
123
|
+
### `users-core` projects auth identities into app users
|
|
123
124
|
|
|
124
|
-
The most important
|
|
125
|
+
The most important server-side change is the provider-neutral projector binding from `users-core`:
|
|
125
126
|
|
|
126
127
|
```js
|
|
127
|
-
|
|
128
|
-
|
|
128
|
+
if (!app.has("auth.profile.projector")) {
|
|
129
|
+
app.singleton("auth.profile.projector", (scope) => scope.make("users.profile.sync.service"));
|
|
130
|
+
}
|
|
129
131
|
```
|
|
130
132
|
|
|
131
|
-
That one
|
|
133
|
+
That one binding explains the deepest change in the chapter.
|
|
132
134
|
|
|
133
|
-
Before this chapter, auth
|
|
135
|
+
Before this chapter, auth could authenticate a user without creating a persistent app-owned user row. After this chapter, auth providers can call `auth.profile.projector.syncIdentityProfile(...)` and get back a persistent users-backed profile.
|
|
134
136
|
|
|
135
|
-
|
|
137
|
+
`users-core` also writes this server-only config line for Supabase compatibility:
|
|
138
|
+
|
|
139
|
+
```js
|
|
140
|
+
config.auth ||= {};
|
|
141
|
+
config.auth.profileMode = "users";
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
The local provider uses the token directly. The Supabase provider also understands `config.auth.profileMode = "users"` and resolves the same users-backed sync service. In both cases, this only works because `users-core` installs the required repositories, services, and tables.
|
|
136
145
|
|
|
137
146
|
### `migrations/` stops being mostly empty
|
|
138
147
|
|
|
@@ -253,19 +262,19 @@ That is worth noticing because this is a higher level of scaffolding:
|
|
|
253
262
|
|
|
254
263
|
### Why auth uses the users layer
|
|
255
264
|
|
|
256
|
-
In the previous chapter, auth
|
|
265
|
+
In the previous chapter, auth did not have a users-backed projector. The core logic in `registerUsersCore()` looks like this:
|
|
257
266
|
|
|
258
267
|
```js
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
268
|
+
app.singleton("users.profile.sync.service", (scope) => {
|
|
269
|
+
return createAuthProfileSyncService({
|
|
270
|
+
userProfilesRepository: scope.make("internal.repository.user-profiles"),
|
|
271
|
+
userSettingsRepository: scope.make("internal.repository.user-settings"),
|
|
272
|
+
lifecycleContributors: resolveProfileSyncLifecycleContributors(scope)
|
|
273
|
+
});
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
if (!app.has("auth.profile.projector")) {
|
|
277
|
+
app.singleton("auth.profile.projector", (scope) => scope.make("users.profile.sync.service"));
|
|
269
278
|
}
|
|
270
279
|
```
|
|
271
280
|
|
|
@@ -273,11 +282,11 @@ The important part is concrete.
|
|
|
273
282
|
|
|
274
283
|
After `users-web`:
|
|
275
284
|
|
|
276
|
-
- `
|
|
277
|
-
- `users-core`
|
|
285
|
+
- `users-core` supplies `users.profile.sync.service`
|
|
286
|
+
- `users-core` aliases that service as `auth.profile.projector`
|
|
278
287
|
- the migrations supply the required tables
|
|
279
288
|
|
|
280
|
-
So auth has everything it needs to stop
|
|
289
|
+
So auth has everything it needs to stop returning only provider-owned profile data and start using the persistent users-backed profile.
|
|
281
290
|
|
|
282
291
|
That is the true point of this chapter. The app is not just authenticated. It has a real users layer.
|
|
283
292
|
|
|
@@ -354,11 +363,11 @@ That is not only a workspace-package concern. The generated `packages/users/...`
|
|
|
354
363
|
|
|
355
364
|
## Summary
|
|
356
365
|
|
|
357
|
-
This chapter is where the app stopped treating signed-in people as only
|
|
366
|
+
This chapter is where the app stopped treating signed-in people as only auth-provider identities and started treating them as real JSKIT users.
|
|
358
367
|
|
|
359
368
|
- `users-core` installed the persistent users/account schema and server layer
|
|
360
369
|
- `users-web` installed the first real account surface and account settings UI
|
|
361
|
-
- auth switched from
|
|
370
|
+
- auth switched from provider-only profile data to the users-backed projection flow
|
|
362
371
|
|
|
363
372
|
That is why this chapter feels bigger than a normal page install. It changes both the browser experience and the server-side meaning of "a signed-in user."
|
|
364
373
|
|
|
@@ -9,7 +9,7 @@ This chapter steps back and treats the CLI as a subject in its own right.
|
|
|
9
9
|
That matters because `jskit` is not just "the thing that installs packages". It is the tool that helps you:
|
|
10
10
|
|
|
11
11
|
- discover what JSKIT can do
|
|
12
|
-
- inspect
|
|
12
|
+
- inspect packages, generators, and any catalog shortcuts before using them
|
|
13
13
|
- apply and re-apply JSKIT-managed mutations to your app
|
|
14
14
|
- keep managed files and lock state healthy
|
|
15
15
|
- create your own app-local runtime packages
|
|
@@ -28,7 +28,7 @@ The easiest way to understand `jskit` is to separate it from the other tools in
|
|
|
28
28
|
|
|
29
29
|
That separation is crucial.
|
|
30
30
|
|
|
31
|
-
When you run a command such as `npx jskit add package auth-provider-
|
|
31
|
+
When you run a command such as `npx jskit add package auth-provider-local-core`, JSKIT updates app-owned files and records what it changed. It does **not** replace npm, Vite, or Knex.
|
|
32
32
|
|
|
33
33
|
The most important record of that managed state lives here:
|
|
34
34
|
|
|
@@ -151,9 +151,7 @@ That distinction matters.
|
|
|
151
151
|
|
|
152
152
|
#### Bundles
|
|
153
153
|
|
|
154
|
-
A bundle is a curated install shortcut for several runtime packages that are meant to go together.
|
|
155
|
-
|
|
156
|
-
In the current catalog, `auth-base` is the obvious example. It is a single bundle id, but it expands to several real runtime packages.
|
|
154
|
+
A bundle is a curated install shortcut for several runtime packages that are meant to go together. Bundles can still appear in the catalog for compatibility and quick inspection, but the guide uses explicit package installs so the real runtime packages stay visible.
|
|
157
155
|
|
|
158
156
|
#### Runtime packages
|
|
159
157
|
|
|
@@ -188,7 +186,7 @@ npx jskit list generators
|
|
|
188
186
|
|
|
189
187
|
Those two commands are especially useful later in the guide, once you already know roughly what kind of thing you are looking for.
|
|
190
188
|
|
|
191
|
-
If you want bundle members printed inline too, `npx jskit list --full` expands the bundle view. That is useful when you
|
|
189
|
+
If you want bundle members printed inline too, `npx jskit list --full` expands the bundle view. That is useful when you are auditing a shortcut, but package ids are still the normal install vocabulary in this guide.
|
|
192
190
|
|
|
193
191
|
One more detail is worth noticing. In repos that contain local package descriptors, `list packages` can also show app-local or repo-local packages in addition to the published catalog. So `list` is not only a remote catalog browser. It is also a view of what this app can currently see.
|
|
194
192
|
|
|
@@ -208,7 +206,7 @@ And the more useful inspection form is:
|
|
|
208
206
|
npx jskit show <id> --details
|
|
209
207
|
```
|
|
210
208
|
|
|
211
|
-
This command is unusually valuable in JSKIT because packages and
|
|
209
|
+
This command is unusually valuable in JSKIT because packages and catalog shortcuts do more than "add a dependency". They can:
|
|
212
210
|
|
|
213
211
|
- provide or require capabilities
|
|
214
212
|
- register runtime providers
|
|
@@ -230,37 +228,42 @@ The plain form is useful when you only want to identify something quickly. `--de
|
|
|
230
228
|
|
|
231
229
|
There are two especially common cases:
|
|
232
230
|
|
|
233
|
-
- you found a
|
|
231
|
+
- you found a package or shortcut in `jskit list` and want to know what it really does before you install it
|
|
234
232
|
- you already know a package changed the shell, the runtime graph, or the app tree, and you want to see *how*
|
|
235
233
|
|
|
236
234
|
That second case matters just as much as the first one. Later in the guide, chapters explain package behavior one feature at a time. `show --details` is the generic command that lets you inspect those same package contracts directly.
|
|
237
235
|
|
|
238
|
-
### A first example:
|
|
236
|
+
### A first example: inspect the local auth provider
|
|
239
237
|
|
|
240
238
|
Run:
|
|
241
239
|
|
|
242
240
|
```bash
|
|
243
|
-
npx jskit show auth-
|
|
241
|
+
npx jskit show auth-provider-local-core --details
|
|
244
242
|
```
|
|
245
243
|
|
|
246
244
|
This output is short, but it already teaches something important:
|
|
247
245
|
|
|
248
|
-
- `auth-
|
|
249
|
-
- it
|
|
246
|
+
- `auth-provider-local-core` is a **runtime package**
|
|
247
|
+
- it selects the local auth provider
|
|
248
|
+
- it depends on the provider-neutral `auth-core`
|
|
250
249
|
|
|
251
|
-
|
|
250
|
+
The default local auth install uses two direct package commands:
|
|
252
251
|
|
|
253
|
-
|
|
254
|
-
|
|
252
|
+
```bash
|
|
253
|
+
npx jskit add package auth-provider-local-core
|
|
254
|
+
npx jskit add package auth-web
|
|
255
|
+
```
|
|
255
256
|
|
|
256
|
-
That is exactly the kind of thing you want to know before you mutate the app
|
|
257
|
+
That is exactly the kind of thing you want to know before you mutate the app:
|
|
257
258
|
|
|
258
|
-
-
|
|
259
|
+
- which package selects the active provider?
|
|
260
|
+
- which package adds the web auth routes and login UI?
|
|
259
261
|
|
|
260
|
-
|
|
262
|
+
It also helps you keep the mental model straight:
|
|
261
263
|
|
|
262
|
-
- bundles are install shortcuts
|
|
263
264
|
- runtime packages are the things that actually provide capabilities
|
|
265
|
+
- `auth-provider-local-core` provides the selected `auth.provider`
|
|
266
|
+
- `auth-web` consumes the selected provider and adds the web surface
|
|
264
267
|
|
|
265
268
|
### A richer example: what does `workspaces-web` contribute?
|
|
266
269
|
|
|
@@ -473,14 +476,13 @@ This is not required, but it is genuinely useful once you start using commands s
|
|
|
473
476
|
|
|
474
477
|
## Installing runtime capability: `add`
|
|
475
478
|
|
|
476
|
-
The install command
|
|
479
|
+
The install command you will use most often is:
|
|
477
480
|
|
|
478
481
|
```bash
|
|
479
|
-
npx jskit add package
|
|
480
|
-
npx jskit add bundle auth-base
|
|
482
|
+
npx jskit add package users-web
|
|
481
483
|
```
|
|
482
484
|
|
|
483
|
-
|
|
485
|
+
That command installs one runtime package and its dependency chain.
|
|
484
486
|
|
|
485
487
|
### `add package`
|
|
486
488
|
|
|
@@ -516,15 +518,9 @@ npm run devlinks
|
|
|
516
518
|
|
|
517
519
|
### `add bundle`
|
|
518
520
|
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
```bash
|
|
522
|
-
npx jskit add bundle auth-base
|
|
523
|
-
```
|
|
524
|
-
|
|
525
|
-
Bundles are a convenience layer. They save you from having to remember and install several related runtime packages one by one.
|
|
521
|
+
Bundles are a convenience layer for catalog shortcuts. Prefer package commands in setup docs and normal app work, especially for auth, because provider ownership is clearer when the selected provider package is installed explicitly.
|
|
526
522
|
|
|
527
|
-
|
|
523
|
+
If you do use a bundle shortcut, inspect it first with `npx jskit show <bundle-id> --details` so you can see the real packages and capabilities it will install.
|
|
528
524
|
|
|
529
525
|
### Generator packages are different
|
|
530
526
|
|
package/package.json
CHANGED
|
@@ -12,6 +12,7 @@ Startup navigation stays in `KERNEL_MAP.md`.
|
|
|
12
12
|
- [assistant-core](/packages/agent-docs/reference/autogen/packages/assistant-core.md)
|
|
13
13
|
- [assistant-runtime](/packages/agent-docs/reference/autogen/packages/assistant-runtime.md)
|
|
14
14
|
- [auth-core](/packages/agent-docs/reference/autogen/packages/auth-core.md)
|
|
15
|
+
- [auth-provider-local-core](/packages/agent-docs/reference/autogen/packages/auth-provider-local-core.md)
|
|
15
16
|
- [auth-provider-supabase-core](/packages/agent-docs/reference/autogen/packages/auth-provider-supabase-core.md)
|
|
16
17
|
- [auth-web](/packages/agent-docs/reference/autogen/packages/auth-web.md)
|
|
17
18
|
- [console-core](/packages/agent-docs/reference/autogen/packages/console-core.md)
|
|
@@ -35,6 +35,22 @@ Exports
|
|
|
35
35
|
Exports
|
|
36
36
|
- `runAuthSignOutFlow`
|
|
37
37
|
|
|
38
|
+
### `src/server/actions/auth.contributor.js`
|
|
39
|
+
Exports
|
|
40
|
+
- `baseAuthActions`
|
|
41
|
+
- `buildAuthActions()`
|
|
42
|
+
- `requireRequestContext(context, actionId)`
|
|
43
|
+
|
|
44
|
+
### `src/server/authActor.js`
|
|
45
|
+
Exports
|
|
46
|
+
- `createAuthIdentityId(provider, providerUserId)`
|
|
47
|
+
- `normalizeAuthActor(value = {}, options = {})`
|
|
48
|
+
- `buildLegacyProfileFromActor(actorLike)`
|
|
49
|
+
- `normalizeAuthResult(value = {}, options = {})`
|
|
50
|
+
Local functions
|
|
51
|
+
- `normalizeDisplayName(value, email = "")`
|
|
52
|
+
- `normalizeProviderUserId(value)`
|
|
53
|
+
|
|
38
54
|
### `src/server/authPolicyContextResolverRegistry.js`
|
|
39
55
|
Exports
|
|
40
56
|
- `AUTH_POLICY_CONTEXT_RESOLVER_TAG`
|
|
@@ -86,6 +102,14 @@ Exports
|
|
|
86
102
|
- `authPolicyPlugin`
|
|
87
103
|
- `withAuthPolicy`
|
|
88
104
|
- `mergeAuthPolicy`
|
|
105
|
+
- `createAuthIdentityId`
|
|
106
|
+
- `normalizeAuthActor`
|
|
107
|
+
- `buildLegacyProfileFromActor`
|
|
108
|
+
- `normalizeAuthResult`
|
|
109
|
+
- `AUTH_OPERATION_UNSUPPORTED_CODE`
|
|
110
|
+
- `createUnsupportedAuthOperationError`
|
|
111
|
+
- `throwUnsupportedAuthOperation`
|
|
112
|
+
- `isUnsupportedAuthOperationError`
|
|
89
113
|
|
|
90
114
|
### `src/server/lib/objectUtils.js`
|
|
91
115
|
Exports
|
|
@@ -129,6 +153,10 @@ Exports
|
|
|
129
153
|
Exports
|
|
130
154
|
- `AccessCoreServiceProvider`
|
|
131
155
|
|
|
156
|
+
### `src/server/providers/AuthActionsServiceProvider.js`
|
|
157
|
+
Exports
|
|
158
|
+
- `AuthActionsServiceProvider`
|
|
159
|
+
|
|
132
160
|
### `src/server/providers/FastifyAuthPolicyServiceProvider.js`
|
|
133
161
|
Exports
|
|
134
162
|
- `FastifyAuthPolicyServiceProvider`
|
|
@@ -137,6 +165,19 @@ Local functions
|
|
|
137
165
|
- `parseList(value)`
|
|
138
166
|
- `defaultHasPermission({ permission, permissions = [] } = {})`
|
|
139
167
|
|
|
168
|
+
### `src/server/services/authSessionEventsService.js`
|
|
169
|
+
Exports
|
|
170
|
+
- `createAuthSessionEventsService()`
|
|
171
|
+
Local functions
|
|
172
|
+
- `resolveActorId(context = {})`
|
|
173
|
+
|
|
174
|
+
### `src/server/unsupportedOperation.js`
|
|
175
|
+
Exports
|
|
176
|
+
- `AUTH_OPERATION_UNSUPPORTED_CODE`
|
|
177
|
+
- `createUnsupportedAuthOperationError(operation, message = "")`
|
|
178
|
+
- `throwUnsupportedAuthOperation(operation, message = "")`
|
|
179
|
+
- `isUnsupportedAuthOperationError(error)`
|
|
180
|
+
|
|
140
181
|
### `src/server/utils.js`
|
|
141
182
|
Exports
|
|
142
183
|
- `normalizeEmail(value)`
|
|
@@ -163,6 +204,20 @@ Local functions
|
|
|
163
204
|
Exports
|
|
164
205
|
- `createApi({ request })`
|
|
165
206
|
|
|
207
|
+
### `src/shared/authCapabilities.js`
|
|
208
|
+
Exports
|
|
209
|
+
- `AUTH_PASSWORD_RECOVERY_DELIVERIES`
|
|
210
|
+
- `AUTH_OPTIONAL_OPERATION_FEATURES`
|
|
211
|
+
- `normalizeAuthProviderId(value, { fallback = "unknown" } = {})`
|
|
212
|
+
- `normalizeAuthCapabilities(value = {})`
|
|
213
|
+
- `getCapabilityFeature(capabilities, path)`
|
|
214
|
+
- `isAuthOperationSupported(capabilities, operationName)`
|
|
215
|
+
Local functions
|
|
216
|
+
- `normalizeBoolean(value, fallback = false)`
|
|
217
|
+
- `normalizeProviderLabel(value, providerId)`
|
|
218
|
+
- `normalizeOAuthProviderEntries(value)`
|
|
219
|
+
- `normalizeRecoveryDelivery(value, { request = false, complete = false } = {})`
|
|
220
|
+
|
|
166
221
|
### `src/shared/authConstraints.js`
|
|
167
222
|
Exports
|
|
168
223
|
- `AUTH_EMAIL_PATTERN`
|
|
@@ -215,6 +270,16 @@ Exports
|
|
|
215
270
|
- `AUTH_PATHS`
|
|
216
271
|
- `buildAuthOauthStartPath(provider)`
|
|
217
272
|
|
|
273
|
+
### `src/shared/authSecurityStatus.js`
|
|
274
|
+
Exports
|
|
275
|
+
- `normalizeAuthSecurityStatus(value = {})`
|
|
276
|
+
- `buildSecurityStatusFromAuthMethodsStatus(authMethodsStatus, { actions = {} } = {})`
|
|
277
|
+
Local functions
|
|
278
|
+
- `normalizeBoolean(value, fallback = false)`
|
|
279
|
+
- `countEnabledMethods(methods)`
|
|
280
|
+
- `normalizeAuthMethodStatus(entry)`
|
|
281
|
+
- `normalizeSecurityActions(value = {})`
|
|
282
|
+
|
|
218
283
|
### `src/shared/commands/authCommandValidators.js`
|
|
219
284
|
Exports
|
|
220
285
|
- `authEmailFieldDefinition`
|
|
@@ -247,6 +312,7 @@ Exports
|
|
|
247
312
|
- `logoutOutputValidator`
|
|
248
313
|
- `oauthProviderCatalogEntryOutputValidator`
|
|
249
314
|
- `authDeniedOutputSchema`
|
|
315
|
+
- `authCapabilitiesOutputSchema`
|
|
250
316
|
- `sessionOutputValidator`
|
|
251
317
|
- `sessionUnavailableOutputValidator`
|
|
252
318
|
- `createCommandMessages({ fields = {}, defaultMessage = "Invalid value." } = {})`
|
|
@@ -367,6 +433,14 @@ Exports
|
|
|
367
433
|
- `resolveAuthDeniedLoginMessage`
|
|
368
434
|
- `AUTH_PATHS`
|
|
369
435
|
- `buildAuthOauthStartPath`
|
|
436
|
+
- `AUTH_PASSWORD_RECOVERY_DELIVERIES`
|
|
437
|
+
- `AUTH_OPTIONAL_OPERATION_FEATURES`
|
|
438
|
+
- `normalizeAuthProviderId`
|
|
439
|
+
- `normalizeAuthCapabilities`
|
|
440
|
+
- `getCapabilityFeature`
|
|
441
|
+
- `isAuthOperationSupported`
|
|
442
|
+
- `normalizeAuthSecurityStatus`
|
|
443
|
+
- `buildSecurityStatusFromAuthMethodsStatus`
|
|
370
444
|
|
|
371
445
|
### `src/shared/inputNormalization.js`
|
|
372
446
|
Exports
|