qarpeo 0.0.0-alpha.9 → 0.1.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/dist/module.mjs +1 -1
- package/dist/runtime/app/components/BlobImage.vue +1 -0
- package/dist/runtime/app/components/CMSImage.vue +1 -0
- package/dist/runtime/app/components/CMSLocaleSwitcher.vue +1 -0
- package/dist/runtime/app/components/CMSPreviewBanner.vue +1 -0
- package/dist/runtime/app/components/CMSVersionBanner.vue +1 -0
- package/dist/runtime/app/components/CMSVersionSwitcher.vue +1 -0
- package/dist/runtime/app/components/ContentRenderer.vue +1 -0
- package/dist/runtime/app/components/FileUpload.vue +1 -0
- package/dist/runtime/app/components/ImpersonationBanner.vue +2 -0
- package/dist/runtime/app/components/SignedIn.vue +1 -0
- package/dist/runtime/app/components/SignedOut.vue +1 -0
- package/dist/runtime/app/composables/api-tokens.mjs +1 -0
- package/dist/runtime/app/composables/auth.d.ts +12 -4
- package/dist/runtime/app/composables/auth.mjs +42 -0
- package/dist/runtime/app/composables/cms-preview.d.ts +1 -1
- package/dist/runtime/app/composables/cms-preview.mjs +1 -0
- package/dist/runtime/app/composables/cms.mjs +1 -0
- package/dist/runtime/app/composables/docs-version.mjs +1 -0
- package/dist/runtime/app/composables/impersonation.mjs +2 -0
- package/dist/runtime/app/composables/notifications.d.ts +5 -5
- package/dist/runtime/app/composables/notifications.mjs +2 -1
- package/dist/runtime/app/composables/organization.mjs +2 -0
- package/dist/runtime/app/composables/passkey.mjs +1 -0
- package/dist/runtime/app/composables/passwordless.mjs +1 -0
- package/dist/runtime/app/composables/payments.mjs +1 -0
- package/dist/runtime/app/composables/site.mjs +1 -0
- package/dist/runtime/app/composables/storage.mjs +1 -0
- package/dist/runtime/app/composables/turnstile.mjs +1 -0
- package/dist/runtime/app/composables/two-factor.mjs +1 -0
- package/dist/runtime/app/middleware/auth.global.d.ts +1 -1
- package/dist/runtime/app/middleware/auth.global.mjs +2 -3
- package/dist/runtime/app/plugins/seo.d.ts +1 -1
- package/dist/runtime/app/plugins/seo.mjs +1 -1
- package/dist/runtime/app/plugins/shortcuts.client.d.ts +1 -1
- package/dist/runtime/app/plugins/shortcuts.client.mjs +1 -1
- package/dist/runtime/index.d.ts +0 -1
- package/dist/runtime/index.mjs +0 -1
- package/package.json +5 -5
package/dist/module.mjs
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import type { QarpeoUser, QarpeoSession, DeleteAccountOptions } from "../../types/auth";
|
|
2
|
+
export declare function useUserSession(): {
|
|
3
|
+
ready: import("vue").ComputedRef<boolean>;
|
|
4
|
+
loggedIn: import("vue").ComputedRef<boolean>;
|
|
5
|
+
user: import("vue").ComputedRef<any>;
|
|
6
|
+
session: import("vue").Ref<any, any>;
|
|
7
|
+
fetch: () => Promise<void>;
|
|
8
|
+
clear: () => Promise<void>;
|
|
9
|
+
};
|
|
2
10
|
export interface QarpeoDeviceSession {
|
|
3
11
|
id: string;
|
|
4
12
|
clientType: string;
|
|
@@ -9,12 +17,12 @@ export interface QarpeoDeviceSession {
|
|
|
9
17
|
isCurrent: boolean;
|
|
10
18
|
}
|
|
11
19
|
export declare function useAuth(): {
|
|
12
|
-
loggedIn:
|
|
20
|
+
loggedIn: import("vue").ComputedRef<boolean>;
|
|
13
21
|
user: import("vue").ComputedRef<QarpeoUser | null>;
|
|
14
22
|
session: import("vue").ComputedRef<QarpeoSession | null>;
|
|
15
|
-
ready:
|
|
16
|
-
fetch:
|
|
17
|
-
clear:
|
|
23
|
+
ready: import("vue").ComputedRef<boolean>;
|
|
24
|
+
fetch: () => Promise<void>;
|
|
25
|
+
clear: () => Promise<void>;
|
|
18
26
|
logout: (redirect?: string) => Promise<void>;
|
|
19
27
|
logoutAll: (redirect?: string) => Promise<void>;
|
|
20
28
|
mfaRequired: import("vue").ComputedRef<boolean>;
|
|
@@ -1,4 +1,46 @@
|
|
|
1
1
|
import { ref, computed } from "vue";
|
|
2
|
+
import { useRuntimeConfig, navigateTo, useState, useRequestFetch, useRequestEvent } from "nuxt/app";
|
|
3
|
+
export function useUserSession() {
|
|
4
|
+
const serverEvent = import.meta.server ? useRequestEvent() : null;
|
|
5
|
+
const sessionState = useState("nuxt-session", () => null);
|
|
6
|
+
const authReadyState = useState("nuxt-auth-ready", () => false);
|
|
7
|
+
const requestFetch = useRequestFetch();
|
|
8
|
+
const clear = async () => {
|
|
9
|
+
await requestFetch("/api/_auth/session", {
|
|
10
|
+
method: "DELETE",
|
|
11
|
+
onResponse({ response }) {
|
|
12
|
+
if (import.meta.server && serverEvent) {
|
|
13
|
+
const res = serverEvent.res;
|
|
14
|
+
const getCookies = response.headers?.getSetCookie;
|
|
15
|
+
if (typeof getCookies === "function") {
|
|
16
|
+
for (const setCookie of getCookies.call(response.headers)) {
|
|
17
|
+
if (res?.headers) res.headers.append("set-cookie", setCookie);
|
|
18
|
+
else res?.appendHeader?.("set-cookie", setCookie);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
sessionState.value = null;
|
|
25
|
+
};
|
|
26
|
+
const fetch = async () => {
|
|
27
|
+
sessionState.value = await requestFetch("/api/_auth/session", {
|
|
28
|
+
headers: { accept: "application/json" },
|
|
29
|
+
retry: false
|
|
30
|
+
}).catch(() => null);
|
|
31
|
+
if (!authReadyState.value) {
|
|
32
|
+
authReadyState.value = true;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
return {
|
|
36
|
+
ready: computed(() => authReadyState.value),
|
|
37
|
+
loggedIn: computed(() => Boolean(sessionState.value?.user)),
|
|
38
|
+
user: computed(() => sessionState.value?.user || null),
|
|
39
|
+
session: sessionState,
|
|
40
|
+
fetch,
|
|
41
|
+
clear
|
|
42
|
+
};
|
|
43
|
+
}
|
|
2
44
|
export function useAuth() {
|
|
3
45
|
const { loggedIn, user, session, clear, fetch, ready } = useUserSession();
|
|
4
46
|
const runtimeConfig = useRuntimeConfig();
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { computed } from "vue";
|
|
2
|
+
import { useRuntimeConfig } from "nuxt/app";
|
|
3
|
+
import { useUserSession } from "./auth.mjs";
|
|
2
4
|
export function useImpersonation() {
|
|
3
5
|
const { session, fetch: refreshSession } = useUserSession();
|
|
4
6
|
const runtimeConfig = useRuntimeConfig();
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type ComputedRef, type Ref } from "vue";
|
|
2
2
|
import type { NotificationRecord } from "../../../types";
|
|
3
3
|
export interface UseNotificationsReturn {
|
|
4
4
|
/** All fetched notifications */
|
|
5
|
-
notifications:
|
|
5
|
+
notifications: Ref<NotificationRecord[]>;
|
|
6
6
|
/** Count of unread notifications */
|
|
7
|
-
unreadCount:
|
|
7
|
+
unreadCount: ComputedRef<number>;
|
|
8
8
|
/** Whether the initial fetch is in progress */
|
|
9
|
-
pending:
|
|
9
|
+
pending: Ref<boolean>;
|
|
10
10
|
/** Mark a single notification as read */
|
|
11
11
|
markAsRead: (id: string) => Promise<void>;
|
|
12
12
|
/** Mark all notifications as read */
|
|
@@ -18,7 +18,7 @@ export interface UseNotificationsReturn {
|
|
|
18
18
|
/** Unsubscribe from browser Web Push notifications */
|
|
19
19
|
unsubscribeFromWebPush: () => Promise<boolean>;
|
|
20
20
|
/** Whether browser Web Push is currently subscribed */
|
|
21
|
-
isPushSubscribed:
|
|
21
|
+
isPushSubscribed: Ref<boolean>;
|
|
22
22
|
/** Refresh the notifications list */
|
|
23
23
|
refresh: () => Promise<void>;
|
|
24
24
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { computed, onMounted, onUnmounted, ref
|
|
1
|
+
import { computed, onMounted, onUnmounted, ref } from "vue";
|
|
2
|
+
import { useRuntimeConfig } from "nuxt/app";
|
|
2
3
|
export function useNotifications() {
|
|
3
4
|
const config = useRuntimeConfig();
|
|
4
5
|
const vapidPublicKey = config.public?.qarpeo?.notifications?.vapidPublicKey || "";
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { ref, computed } from "vue";
|
|
2
|
+
import { useRuntimeConfig } from "nuxt/app";
|
|
3
|
+
import { useUserSession } from "./auth.mjs";
|
|
2
4
|
export function useOrganization() {
|
|
3
5
|
const { session, fetch: refreshSession } = useUserSession();
|
|
4
6
|
const runtimeConfig = useRuntimeConfig();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ref, computed, toValue } from "vue";
|
|
2
|
+
import { useRuntimeConfig } from "nuxt/app";
|
|
2
3
|
export function useStorage() {
|
|
3
4
|
const runtimeConfig = useRuntimeConfig();
|
|
4
5
|
const storageConfig = runtimeConfig.public?.qarpeo?.storage || runtimeConfig.public?.qarpeo?.blob || {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default:
|
|
1
|
+
declare const _default: import("nuxt/app").RouteMiddleware;
|
|
2
2
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineNuxtRouteMiddleware, useRuntimeConfig, navigateTo
|
|
1
|
+
import { defineNuxtRouteMiddleware, useRuntimeConfig, navigateTo } from "nuxt/app";
|
|
2
2
|
import { useAuth } from "../composables/auth.mjs";
|
|
3
3
|
function matchRouteRule(path, rules) {
|
|
4
4
|
for (const [pattern, rule] of Object.entries(rules)) {
|
|
@@ -16,12 +16,11 @@ export default defineNuxtRouteMiddleware((to) => {
|
|
|
16
16
|
const rules = authConfig.rules || {};
|
|
17
17
|
const rule = matchRouteRule(to.path, rules);
|
|
18
18
|
if (!rule) return;
|
|
19
|
-
const { loggedIn, user } = useAuth();
|
|
19
|
+
const { loggedIn, user, session } = useAuth();
|
|
20
20
|
if (!loggedIn.value) {
|
|
21
21
|
const loginPath = rule.redirect || authConfig.redirect?.login || "/login";
|
|
22
22
|
return navigateTo(`${loginPath}?redirect=${encodeURIComponent(to.fullPath)}`);
|
|
23
23
|
}
|
|
24
|
-
const { session } = useUserSession();
|
|
25
24
|
const typedSession = session.value;
|
|
26
25
|
const mfaRedirect = authConfig.mfa?.redirect || "/auth/2fa/verify";
|
|
27
26
|
if (typedSession?.mfaRequired && !typedSession?.mfaVerified && to.path !== mfaRedirect && !to.path.startsWith("/auth/2fa")) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default:
|
|
1
|
+
declare const _default: import("nuxt/app").Plugin<Record<string, unknown>> & import("nuxt/app").ObjectPlugin<Record<string, unknown>>;
|
|
2
2
|
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { computed } from "vue";
|
|
2
|
-
import { defineNuxtPlugin, useHead, useRoute, useRuntimeConfig, useSeoMeta } from "
|
|
2
|
+
import { defineNuxtPlugin, useHead, useRoute, useRuntimeConfig, useSeoMeta } from "nuxt/app";
|
|
3
3
|
export default defineNuxtPlugin(() => {
|
|
4
4
|
const runtimeConfig = useRuntimeConfig();
|
|
5
5
|
const site = runtimeConfig.public?.qarpeo?.site || {};
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
* Qarpeo keyboard shortcuts plugin. Alt+Q -> Open /_qarpeo/devtools (Qarpeo DevTools) Alt+C ->
|
|
3
3
|
* Navigate to /cms (CMS)
|
|
4
4
|
*/
|
|
5
|
-
declare const _default:
|
|
5
|
+
declare const _default: import("nuxt/app").Plugin<Record<string, unknown>> & import("nuxt/app").ObjectPlugin<Record<string, unknown>>;
|
|
6
6
|
export default _default;
|
package/dist/runtime/index.d.ts
CHANGED
package/dist/runtime/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qarpeo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Zero-config Cloudflare Edge Platform for Nuxt",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"analytics-engine",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@comark/nuxt": "^0.8.1",
|
|
57
57
|
"@comark/vue": "^0.8.1",
|
|
58
58
|
"@nuxt/devtools-kit": "^4.1.0",
|
|
59
|
-
"@nuxt/kit": "npm:@nuxt/kit-nightly@^5.0.0-
|
|
59
|
+
"@nuxt/kit": "npm:@nuxt/kit-nightly@^5.0.0-2611051431-8a89118",
|
|
60
60
|
"@simplewebauthn/browser": "14.0.0",
|
|
61
61
|
"@simplewebauthn/server": "14.0.3",
|
|
62
62
|
"citty": "^0.2.2",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"pathe": "^2.0.3",
|
|
72
72
|
"shiki": "^4.6.0",
|
|
73
73
|
"uqr": "0.1.3",
|
|
74
|
-
"wrangler": "^4.
|
|
74
|
+
"wrangler": "^4.158.0",
|
|
75
75
|
"yaml": "^2.9.1",
|
|
76
76
|
"zod": "^4.6.7"
|
|
77
77
|
},
|
|
@@ -81,11 +81,11 @@
|
|
|
81
81
|
"@typescript/typescript6": "^6.0.2",
|
|
82
82
|
"h3": "^2.0.8",
|
|
83
83
|
"nitro": "3.0.261103-rc",
|
|
84
|
-
"nuxt": "npm:nuxt-nightly@^5.0.0-
|
|
84
|
+
"nuxt": "npm:nuxt-nightly@^5.0.0-2611051431-8a89118",
|
|
85
85
|
"typescript": "^7.0.2",
|
|
86
86
|
"unbuild": "^3.6.1",
|
|
87
87
|
"vite-plus": "1.5.0",
|
|
88
|
-
"vue": "^3.
|
|
88
|
+
"vue": "^3.6.0-rc.14",
|
|
89
89
|
"vue-sfc-transformer": "^0.3.1"
|
|
90
90
|
},
|
|
91
91
|
"devEngines": {
|