@jskit-ai/auth-web 0.1.18 → 0.1.19
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.descriptor.mjs +6 -5
- package/package.json +5 -5
- package/src/client/composables/loginView/rememberedAccountStorage.js +3 -5
- package/src/client/providers/AuthWebClientProvider.js +11 -23
- package/src/client/runtime/inject.js +1 -2
- package/src/server/providers/AuthRouteServiceProvider.js +1 -2
- package/src/client/runtime/tokens.js +0 -7
package/package.descriptor.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export default Object.freeze({
|
|
2
2
|
"packageVersion": 1,
|
|
3
3
|
"packageId": "@jskit-ai/auth-web",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.19",
|
|
5
|
+
"kind": "runtime",
|
|
5
6
|
"description": "Auth web module: Fastify auth routes plus web login/sign-out scaffolds.",
|
|
6
7
|
"dependsOn": [
|
|
7
8
|
"@jskit-ai/auth-core",
|
|
@@ -222,10 +223,10 @@ export default Object.freeze({
|
|
|
222
223
|
"@tanstack/vue-query": "5.92.12",
|
|
223
224
|
"@mdi/js": "^7.4.47",
|
|
224
225
|
"@fastify/type-provider-typebox": "^6.1.0",
|
|
225
|
-
"@jskit-ai/auth-core": "0.1.
|
|
226
|
-
"@jskit-ai/http-runtime": "0.1.
|
|
227
|
-
"@jskit-ai/kernel": "0.1.
|
|
228
|
-
"@jskit-ai/shell-web": "0.1.
|
|
226
|
+
"@jskit-ai/auth-core": "0.1.17",
|
|
227
|
+
"@jskit-ai/http-runtime": "0.1.17",
|
|
228
|
+
"@jskit-ai/kernel": "0.1.18",
|
|
229
|
+
"@jskit-ai/shell-web": "0.1.17",
|
|
229
230
|
"vuetify": "^4.0.0"
|
|
230
231
|
},
|
|
231
232
|
"dev": {}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jskit-ai/auth-web",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.19",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "node --test"
|
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@tanstack/vue-query": "^5.90.5",
|
|
21
|
-
"@jskit-ai/auth-core": "0.1.
|
|
21
|
+
"@jskit-ai/auth-core": "0.1.17",
|
|
22
22
|
"@mdi/js": "^7.4.47",
|
|
23
23
|
"@fastify/type-provider-typebox": "^6.1.0",
|
|
24
|
-
"@jskit-ai/kernel": "0.1.
|
|
25
|
-
"@jskit-ai/shell-web": "0.1.
|
|
24
|
+
"@jskit-ai/kernel": "0.1.18",
|
|
25
|
+
"@jskit-ai/shell-web": "0.1.17",
|
|
26
26
|
"vuetify": "^4.0.0",
|
|
27
|
-
"@jskit-ai/http-runtime": "0.1.
|
|
27
|
+
"@jskit-ai/http-runtime": "0.1.17"
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { normalizeEmailAddress, maskEmail } from "./identityHelpers.js";
|
|
2
2
|
|
|
3
|
-
const REMEMBERED_ACCOUNT_STORAGE_KEY = "auth.rememberedAccount";
|
|
4
|
-
|
|
5
3
|
function resolveLocalStorage() {
|
|
6
4
|
if (typeof window === "undefined" || !window.localStorage) {
|
|
7
5
|
return null;
|
|
@@ -42,7 +40,7 @@ function readRememberedAccountHint() {
|
|
|
42
40
|
}
|
|
43
41
|
|
|
44
42
|
try {
|
|
45
|
-
const rawValue = storage.getItem(
|
|
43
|
+
const rawValue = storage.getItem("auth.rememberedAccount");
|
|
46
44
|
if (!rawValue) {
|
|
47
45
|
return null;
|
|
48
46
|
}
|
|
@@ -61,7 +59,7 @@ function writeRememberedAccountHint(hint) {
|
|
|
61
59
|
|
|
62
60
|
try {
|
|
63
61
|
storage.setItem(
|
|
64
|
-
|
|
62
|
+
"auth.rememberedAccount",
|
|
65
63
|
JSON.stringify({
|
|
66
64
|
email: hint.email,
|
|
67
65
|
displayName: hint.displayName,
|
|
@@ -81,7 +79,7 @@ function clearRememberedAccountHint() {
|
|
|
81
79
|
}
|
|
82
80
|
|
|
83
81
|
try {
|
|
84
|
-
storage.removeItem(
|
|
82
|
+
storage.removeItem("auth.rememberedAccount");
|
|
85
83
|
} catch {
|
|
86
84
|
// best effort only
|
|
87
85
|
}
|
|
@@ -1,21 +1,9 @@
|
|
|
1
1
|
import DefaultLoginView from "../views/DefaultLoginView.vue";
|
|
2
2
|
import AuthProfileWidget from "../views/AuthProfileWidget.vue";
|
|
3
3
|
import AuthProfileMenuLinkItem from "../views/AuthProfileMenuLinkItem.vue";
|
|
4
|
-
import { CLIENT_MODULE_VUE_APP_TOKEN } from "@jskit-ai/kernel/client/moduleBootstrap";
|
|
5
4
|
import { createAuthGuardRuntime } from "../runtime/authGuardRuntime.js";
|
|
6
5
|
import { useLoginView } from "../runtime/useLoginView.js";
|
|
7
|
-
import {
|
|
8
|
-
WEB_PLACEMENT_RUNTIME_CLIENT_TOKEN,
|
|
9
|
-
resolveSurfaceNavigationTargetFromPlacementContext
|
|
10
|
-
} from "@jskit-ai/shell-web/client/placement";
|
|
11
|
-
import {
|
|
12
|
-
AUTH_GUARD_RUNTIME_CLIENT_TOKEN,
|
|
13
|
-
AUTH_GUARD_RUNTIME_INJECTION_KEY
|
|
14
|
-
} from "../runtime/tokens.js";
|
|
15
|
-
|
|
16
|
-
const AUTH_WEB_PROFILE_WIDGET_COMPONENT_TOKEN = "auth.web.profile.widget";
|
|
17
|
-
const AUTH_WEB_PROFILE_MENU_LINK_ITEM_COMPONENT_TOKEN = "auth.web.profile.menu.link-item";
|
|
18
|
-
const REALTIME_SOCKET_CLIENT_TOKEN = "runtime.realtime.client.socket";
|
|
6
|
+
import { resolveSurfaceNavigationTargetFromPlacementContext } from "@jskit-ai/shell-web/client/placement";
|
|
19
7
|
|
|
20
8
|
class AuthWebClientProvider {
|
|
21
9
|
static id = "auth.web.client";
|
|
@@ -27,15 +15,15 @@ class AuthWebClientProvider {
|
|
|
27
15
|
|
|
28
16
|
app.singleton("auth.login.component", () => DefaultLoginView);
|
|
29
17
|
app.singleton("auth.login.useLoginView", () => useLoginView);
|
|
30
|
-
app.singleton(
|
|
31
|
-
app.singleton(
|
|
32
|
-
app.singleton(
|
|
33
|
-
if (!app.has(
|
|
18
|
+
app.singleton("auth.web.profile.widget", () => AuthProfileWidget);
|
|
19
|
+
app.singleton("auth.web.profile.menu.link-item", () => AuthProfileMenuLinkItem);
|
|
20
|
+
app.singleton("runtime.auth-guard.client", () => {
|
|
21
|
+
if (!app.has("runtime.web-placement.client")) {
|
|
34
22
|
throw new Error("AuthWebClientProvider requires shell-web placement runtime.");
|
|
35
23
|
}
|
|
36
24
|
|
|
37
|
-
const placementRuntime = app.make(
|
|
38
|
-
const realtimeSocket = app.has(
|
|
25
|
+
const placementRuntime = app.make("runtime.web-placement.client");
|
|
26
|
+
const realtimeSocket = app.has("runtime.realtime.client.socket") ? app.make("runtime.realtime.client.socket") : null;
|
|
39
27
|
const loginRouteTarget = resolveSurfaceNavigationTargetFromPlacementContext(placementRuntime.getContext(), {
|
|
40
28
|
path: "/auth/login",
|
|
41
29
|
surfaceId: "auth"
|
|
@@ -53,19 +41,19 @@ class AuthWebClientProvider {
|
|
|
53
41
|
throw new Error("AuthWebClientProvider requires application make().");
|
|
54
42
|
}
|
|
55
43
|
|
|
56
|
-
const authGuardRuntime = app.make(
|
|
44
|
+
const authGuardRuntime = app.make("runtime.auth-guard.client");
|
|
57
45
|
await authGuardRuntime.initialize();
|
|
58
46
|
|
|
59
|
-
if (!app.has(
|
|
47
|
+
if (!app.has("jskit.client.vue.app")) {
|
|
60
48
|
return;
|
|
61
49
|
}
|
|
62
50
|
|
|
63
|
-
const vueApp = app.make(
|
|
51
|
+
const vueApp = app.make("jskit.client.vue.app");
|
|
64
52
|
if (!vueApp || typeof vueApp.provide !== "function") {
|
|
65
53
|
return;
|
|
66
54
|
}
|
|
67
55
|
|
|
68
|
-
vueApp.provide(
|
|
56
|
+
vueApp.provide("jskit.auth-web.runtime.auth-guard.client", authGuardRuntime);
|
|
69
57
|
}
|
|
70
58
|
}
|
|
71
59
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { inject } from "vue";
|
|
2
2
|
import { isAuthGuardRuntime } from "./authGuardRuntime.js";
|
|
3
|
-
import { AUTH_GUARD_RUNTIME_INJECTION_KEY } from "./tokens.js";
|
|
4
3
|
|
|
5
4
|
const EMPTY_AUTH_GUARD_STATE = Object.freeze({
|
|
6
5
|
authenticated: false,
|
|
@@ -25,7 +24,7 @@ const EMPTY_AUTH_GUARD_RUNTIME = Object.freeze({
|
|
|
25
24
|
});
|
|
26
25
|
|
|
27
26
|
function useAuthGuardRuntime({ required = false } = {}) {
|
|
28
|
-
const runtime = inject(
|
|
27
|
+
const runtime = inject("jskit.auth-web.runtime.auth-guard.client", null);
|
|
29
28
|
if (isAuthGuardRuntime(runtime)) {
|
|
30
29
|
return runtime;
|
|
31
30
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { KERNEL_TOKENS } from "@jskit-ai/kernel/shared/support/tokens";
|
|
2
1
|
import { AuthController } from "../controllers/AuthController.js";
|
|
3
2
|
import { buildRoutes } from "../routes/authRoutes.js";
|
|
4
3
|
|
|
@@ -18,7 +17,7 @@ class AuthRouteServiceProvider {
|
|
|
18
17
|
throw new Error("AuthRouteServiceProvider requires application make().");
|
|
19
18
|
}
|
|
20
19
|
|
|
21
|
-
const router = app.make(
|
|
20
|
+
const router = app.make("jskit.http.router");
|
|
22
21
|
const authWebService = app.make("auth.web.service");
|
|
23
22
|
const controller = new AuthController({ service: authWebService });
|
|
24
23
|
const routes = buildRoutes(controller);
|