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.
Files changed (39) hide show
  1. package/dist/module.mjs +1 -1
  2. package/dist/runtime/app/components/BlobImage.vue +1 -0
  3. package/dist/runtime/app/components/CMSImage.vue +1 -0
  4. package/dist/runtime/app/components/CMSLocaleSwitcher.vue +1 -0
  5. package/dist/runtime/app/components/CMSPreviewBanner.vue +1 -0
  6. package/dist/runtime/app/components/CMSVersionBanner.vue +1 -0
  7. package/dist/runtime/app/components/CMSVersionSwitcher.vue +1 -0
  8. package/dist/runtime/app/components/ContentRenderer.vue +1 -0
  9. package/dist/runtime/app/components/FileUpload.vue +1 -0
  10. package/dist/runtime/app/components/ImpersonationBanner.vue +2 -0
  11. package/dist/runtime/app/components/SignedIn.vue +1 -0
  12. package/dist/runtime/app/components/SignedOut.vue +1 -0
  13. package/dist/runtime/app/composables/api-tokens.mjs +1 -0
  14. package/dist/runtime/app/composables/auth.d.ts +12 -4
  15. package/dist/runtime/app/composables/auth.mjs +42 -0
  16. package/dist/runtime/app/composables/cms-preview.d.ts +1 -1
  17. package/dist/runtime/app/composables/cms-preview.mjs +1 -0
  18. package/dist/runtime/app/composables/cms.mjs +1 -0
  19. package/dist/runtime/app/composables/docs-version.mjs +1 -0
  20. package/dist/runtime/app/composables/impersonation.mjs +2 -0
  21. package/dist/runtime/app/composables/notifications.d.ts +5 -5
  22. package/dist/runtime/app/composables/notifications.mjs +2 -1
  23. package/dist/runtime/app/composables/organization.mjs +2 -0
  24. package/dist/runtime/app/composables/passkey.mjs +1 -0
  25. package/dist/runtime/app/composables/passwordless.mjs +1 -0
  26. package/dist/runtime/app/composables/payments.mjs +1 -0
  27. package/dist/runtime/app/composables/site.mjs +1 -0
  28. package/dist/runtime/app/composables/storage.mjs +1 -0
  29. package/dist/runtime/app/composables/turnstile.mjs +1 -0
  30. package/dist/runtime/app/composables/two-factor.mjs +1 -0
  31. package/dist/runtime/app/middleware/auth.global.d.ts +1 -1
  32. package/dist/runtime/app/middleware/auth.global.mjs +2 -3
  33. package/dist/runtime/app/plugins/seo.d.ts +1 -1
  34. package/dist/runtime/app/plugins/seo.mjs +1 -1
  35. package/dist/runtime/app/plugins/shortcuts.client.d.ts +1 -1
  36. package/dist/runtime/app/plugins/shortcuts.client.mjs +1 -1
  37. package/dist/runtime/index.d.ts +0 -1
  38. package/dist/runtime/index.mjs +0 -1
  39. package/package.json +5 -5
package/dist/module.mjs CHANGED
@@ -16,7 +16,7 @@ import 'drizzle-orm/node-sqlite';
16
16
  import 'node:process';
17
17
  import 'node:readline/promises';
18
18
 
19
- const version = "0.0.0-alpha.1";
19
+ const version = "0.1.0";
20
20
 
21
21
  function ensureDevEnv(rootDir) {
22
22
  const envPath = join(rootDir, ".env");
@@ -1,4 +1,5 @@
1
1
  <script lang="ts" setup>
2
+ import { computed } from "vue"
2
3
  import { useStorage } from "../composables/storage"
3
4
 
4
5
  /**
@@ -1,4 +1,5 @@
1
1
  <script lang="ts" setup>
2
+ import { computed } from "vue"
2
3
  import { useStorage } from "../composables/storage"
3
4
 
4
5
  /**
@@ -1,4 +1,5 @@
1
1
  <script lang="ts" setup>
2
+ import { computed } from "vue"
2
3
  import { useCMSLocale } from "../composables/cms"
3
4
 
4
5
  /**
@@ -1,4 +1,5 @@
1
1
  <script lang="ts" setup>
2
+ import { computed } from "vue"
2
3
  import { useCMSPreview } from "../composables/cms-preview"
3
4
 
4
5
  /**
@@ -1,4 +1,5 @@
1
1
  <script lang="ts" setup>
2
+ import { computed } from "vue"
2
3
  import { useDocsVersion } from "../composables/docs-version"
3
4
 
4
5
  /**
@@ -1,4 +1,5 @@
1
1
  <script lang="ts" setup>
2
+ import { computed } from "vue"
2
3
  import { useDocsVersion } from "../composables/docs-version"
3
4
 
4
5
  /**
@@ -1,4 +1,5 @@
1
1
  <script lang="ts" setup>
2
+ import { computed, shallowRef, watchEffect } from "vue"
2
3
  import { MarkdownDocument } from "@comark/vue"
3
4
  import { isMarkdownDocument } from "comark/utils"
4
5
  import { createSerializedMarkdownParser } from "comark"
@@ -1,4 +1,5 @@
1
1
  <script lang="ts" setup>
2
+ import { ref, computed } from "vue"
2
3
  import { useUpload, type UploadedFile } from "../composables/storage"
3
4
 
4
5
  /**
@@ -1,4 +1,6 @@
1
1
  <script lang="ts" setup>
2
+ import { computed } from "vue"
3
+ import { useUserSession } from "../composables/auth"
2
4
  import type { QarpeoUser, QarpeoSession } from "../../types/auth"
3
5
 
4
6
  /**
@@ -1,4 +1,5 @@
1
1
  <script lang="ts" setup>
2
+ import { useAuth } from "../composables/auth"
2
3
  const { loggedIn, ready } = useAuth()
3
4
  </script>
4
5
 
@@ -1,4 +1,5 @@
1
1
  <script lang="ts" setup>
2
+ import { useAuth } from "../composables/auth"
2
3
  const { loggedIn, ready } = useAuth()
3
4
  </script>
4
5
 
@@ -1,4 +1,5 @@
1
1
  import { ref } from "vue";
2
+ import { useRuntimeConfig } from "nuxt/app";
2
3
  export function useApiTokens() {
3
4
  const runtimeConfig = useRuntimeConfig();
4
5
  const authConfig = runtimeConfig.public?.qarpeo?.auth || {};
@@ -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: any;
20
+ loggedIn: import("vue").ComputedRef<boolean>;
13
21
  user: import("vue").ComputedRef<QarpeoUser | null>;
14
22
  session: import("vue").ComputedRef<QarpeoSession | null>;
15
- ready: any;
16
- fetch: any;
17
- clear: any;
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();
@@ -29,5 +29,5 @@ export declare function useCMSPreview(): {
29
29
  collection?: string;
30
30
  slug?: string;
31
31
  }) => void;
32
- disable: () => Promise<any> | void;
32
+ disable: () => any;
33
33
  };
@@ -1,4 +1,5 @@
1
1
  import { computed } from "vue";
2
+ import { useRoute, useCookie, navigateTo } from "nuxt/app";
2
3
  export function useCMSPreview() {
3
4
  let route;
4
5
  let cookie;
@@ -1,4 +1,5 @@
1
1
  import { ref, computed } from "vue";
2
+ import { useRuntimeConfig } from "nuxt/app";
2
3
  import { useCMSPreview } from "./cms-preview.mjs";
3
4
  export function useCMS(collectionId) {
4
5
  const runtimeConfig = useRuntimeConfig();
@@ -1,4 +1,5 @@
1
1
  import { ref, computed } from "vue";
2
+ import { useRoute, useRouter, useRuntimeConfig, navigateTo } from "nuxt/app";
2
3
  export function useDocsVersion(options) {
3
4
  let route;
4
5
  let router;
@@ -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 { computed, ref } from "#imports";
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: ReturnType<typeof ref<NotificationRecord[]>>;
5
+ notifications: Ref<NotificationRecord[]>;
6
6
  /** Count of unread notifications */
7
- unreadCount: ReturnType<typeof computed<number>>;
7
+ unreadCount: ComputedRef<number>;
8
8
  /** Whether the initial fetch is in progress */
9
- pending: ReturnType<typeof ref<boolean>>;
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: ReturnType<typeof ref<boolean>>;
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, useRuntimeConfig } from "#imports";
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 } from "vue";
2
+ import { useRuntimeConfig } from "nuxt/app";
2
3
  import { useAuth } from "./auth.mjs";
3
4
  export function usePasskey() {
4
5
  const runtimeConfig = useRuntimeConfig();
@@ -1,4 +1,5 @@
1
1
  import { ref } from "vue";
2
+ import { useRuntimeConfig } from "nuxt/app";
2
3
  import { useAuth } from "./auth.mjs";
3
4
  export function usePasswordless() {
4
5
  const runtimeConfig = useRuntimeConfig();
@@ -1,4 +1,5 @@
1
1
  import { computed } from "vue";
2
+ import { useRuntimeConfig, useAsyncData } from "nuxt/app";
2
3
  export function useSubscription() {
3
4
  const runtimeConfig = useRuntimeConfig();
4
5
  const paymentsConfig = runtimeConfig.public?.qarpeo?.payments || {};
@@ -1,4 +1,5 @@
1
1
  import { computed } from "vue";
2
+ import { useRuntimeConfig, useRoute, useHead } from "nuxt/app";
2
3
  export function useSite() {
3
4
  const runtimeConfig = useRuntimeConfig();
4
5
  return runtimeConfig.public?.qarpeo?.site || {};
@@ -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,4 +1,5 @@
1
1
  import { computed } from "vue";
2
+ import { useRuntimeConfig } from "nuxt/app";
2
3
  export function useTurnstile() {
3
4
  const runtimeConfig = useRuntimeConfig();
4
5
  const siteKey = computed(() => {
@@ -1,4 +1,5 @@
1
1
  import { ref } from "vue";
2
+ import { useRuntimeConfig } from "nuxt/app";
2
3
  export function useTwoFactor() {
3
4
  const runtimeConfig = useRuntimeConfig();
4
5
  const authConfig = runtimeConfig.public?.qarpeo?.auth || {};
@@ -1,2 +1,2 @@
1
- declare const _default: any;
1
+ declare const _default: import("nuxt/app").RouteMiddleware;
2
2
  export default _default;
@@ -1,4 +1,4 @@
1
- import { defineNuxtRouteMiddleware, useRuntimeConfig, navigateTo, useUserSession } from "#imports";
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: any;
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 "#imports";
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: any;
5
+ declare const _default: import("nuxt/app").Plugin<Record<string, unknown>> & import("nuxt/app").ObjectPlugin<Record<string, unknown>>;
6
6
  export default _default;
@@ -1,4 +1,4 @@
1
- import { defineNuxtPlugin, useRouter } from "#imports";
1
+ import { defineNuxtPlugin, useRouter } from "nuxt/app";
2
2
  export default defineNuxtPlugin(() => {
3
3
  if (import.meta.server) return;
4
4
  const router = useRouter();
@@ -20,4 +20,3 @@ export * from "./payments";
20
20
  export * from "./storage";
21
21
  export * from "./bots";
22
22
  export * from "./rag";
23
- export * from "./app/composables/site";
@@ -20,4 +20,3 @@ export * from "./payments.mjs";
20
20
  export * from "./storage.mjs";
21
21
  export * from "./bots.mjs";
22
22
  export * from "./rag.mjs";
23
- export * from "./app/composables/site.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qarpeo",
3
- "version": "0.0.0-alpha.9",
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-2611041456-7ae6258",
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.157.0",
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-2611041456-7ae6258",
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.5.44",
88
+ "vue": "^3.6.0-rc.14",
89
89
  "vue-sfc-transformer": "^0.3.1"
90
90
  },
91
91
  "devEngines": {