abckit 0.0.72 → 0.0.74
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/runtime/components/ui/auto-form/AutoForm.d.vue.ts +4 -4
- package/dist/runtime/components/ui/auto-form/AutoForm.vue.d.ts +4 -4
- package/dist/runtime/components/ui/auto-form/dependencies.d.ts +25 -1
- package/dist/runtime/components/ui/auto-form/utils.d.ts +1 -1
- package/dist/runtime/plugins/capacitor/client.d.ts +23 -0
- package/dist/runtime/plugins/capacitor/client.js +31 -11
- package/dist/runtime/plugins/capacitor/index.d.ts +2 -2
- package/dist/runtime/plugins/capacitor/index.js +2 -0
- package/package.json +13 -14
|
@@ -10,19 +10,19 @@ declare const __VLS_export: <T extends ZodObjectOrWrapped>(__VLS_props: NonNulla
|
|
|
10
10
|
dependencies?: Dependency<z.infer<T>>[];
|
|
11
11
|
initialValues?: Partial<z.infer<T>>;
|
|
12
12
|
} & {
|
|
13
|
-
onSubmit?: ((event: z.
|
|
13
|
+
onSubmit?: ((event: z.TypeOf<T>) => any) | undefined;
|
|
14
14
|
}> & (typeof globalThis extends {
|
|
15
15
|
__VLS_PROPS_FALLBACK: infer P;
|
|
16
16
|
} ? P : {});
|
|
17
17
|
expose: (exposed: {}) => void;
|
|
18
18
|
attrs: any;
|
|
19
|
-
slots: { [K in NonNullable<keyof z.
|
|
19
|
+
slots: { [K in NonNullable<keyof z.TypeOf<T>>]?: ((props: {
|
|
20
20
|
shape: unknown;
|
|
21
21
|
fieldName: string;
|
|
22
22
|
config: ConfigItem;
|
|
23
23
|
}) => any) | undefined; } & {
|
|
24
24
|
customAutoForm?: (props: {
|
|
25
|
-
fields: { [key in keyof z.
|
|
25
|
+
fields: { [key in keyof z.TypeOf<T>]: {
|
|
26
26
|
shape: Shape;
|
|
27
27
|
fieldName: string;
|
|
28
28
|
config: ConfigItem;
|
|
@@ -33,7 +33,7 @@ declare const __VLS_export: <T extends ZodObjectOrWrapped>(__VLS_props: NonNulla
|
|
|
33
33
|
shapes: { [key in keyof T]: Shape; };
|
|
34
34
|
}) => any;
|
|
35
35
|
};
|
|
36
|
-
emit: (evt: "submit", event: z.
|
|
36
|
+
emit: (evt: "submit", event: z.TypeOf<T>) => void;
|
|
37
37
|
}>) => import("vue").VNode & {
|
|
38
38
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
39
39
|
};
|
|
@@ -10,19 +10,19 @@ declare const __VLS_export: <T extends ZodObjectOrWrapped>(__VLS_props: NonNulla
|
|
|
10
10
|
dependencies?: Dependency<z.infer<T>>[];
|
|
11
11
|
initialValues?: Partial<z.infer<T>>;
|
|
12
12
|
} & {
|
|
13
|
-
onSubmit?: ((event: z.
|
|
13
|
+
onSubmit?: ((event: z.TypeOf<T>) => any) | undefined;
|
|
14
14
|
}> & (typeof globalThis extends {
|
|
15
15
|
__VLS_PROPS_FALLBACK: infer P;
|
|
16
16
|
} ? P : {});
|
|
17
17
|
expose: (exposed: {}) => void;
|
|
18
18
|
attrs: any;
|
|
19
|
-
slots: { [K in NonNullable<keyof z.
|
|
19
|
+
slots: { [K in NonNullable<keyof z.TypeOf<T>>]?: ((props: {
|
|
20
20
|
shape: unknown;
|
|
21
21
|
fieldName: string;
|
|
22
22
|
config: ConfigItem;
|
|
23
23
|
}) => any) | undefined; } & {
|
|
24
24
|
customAutoForm?: (props: {
|
|
25
|
-
fields: { [key in keyof z.
|
|
25
|
+
fields: { [key in keyof z.TypeOf<T>]: {
|
|
26
26
|
shape: Shape;
|
|
27
27
|
fieldName: string;
|
|
28
28
|
config: ConfigItem;
|
|
@@ -33,7 +33,7 @@ declare const __VLS_export: <T extends ZodObjectOrWrapped>(__VLS_props: NonNulla
|
|
|
33
33
|
shapes: { [key in keyof T]: Shape; };
|
|
34
34
|
}) => any;
|
|
35
35
|
};
|
|
36
|
-
emit: (evt: "submit", event: z.
|
|
36
|
+
emit: (evt: "submit", event: z.TypeOf<T>) => void;
|
|
37
37
|
}>) => import("vue").VNode & {
|
|
38
38
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
39
39
|
};
|
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
import type { Ref } from 'vue';
|
|
2
2
|
import { type Dependency, type EnumValues } from './interface.js';
|
|
3
|
-
export declare const injectDependencies: <T extends Ref<Dependency<
|
|
3
|
+
export declare const injectDependencies: <T extends Ref<Dependency<{
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
}>[] | undefined, Dependency<{
|
|
6
|
+
[x: string]: any;
|
|
7
|
+
}>[] | undefined> | null | undefined = Ref<Dependency<{
|
|
8
|
+
[x: string]: any;
|
|
9
|
+
}>[] | undefined, Dependency<{
|
|
10
|
+
[x: string]: any;
|
|
11
|
+
}>[] | undefined>>(fallback?: T | undefined) => T extends null ? Ref<Dependency<{
|
|
12
|
+
[x: string]: any;
|
|
13
|
+
}>[] | undefined, Dependency<{
|
|
14
|
+
[x: string]: any;
|
|
15
|
+
}>[] | undefined> | null : Ref<Dependency<{
|
|
16
|
+
[x: string]: any;
|
|
17
|
+
}>[] | undefined, Dependency<{
|
|
18
|
+
[x: string]: any;
|
|
19
|
+
}>[] | undefined>, provideDependencies: (contextValue: Ref<Dependency<{
|
|
20
|
+
[x: string]: any;
|
|
21
|
+
}>[] | undefined, Dependency<{
|
|
22
|
+
[x: string]: any;
|
|
23
|
+
}>[] | undefined>) => Ref<Dependency<{
|
|
24
|
+
[x: string]: any;
|
|
25
|
+
}>[] | undefined, Dependency<{
|
|
26
|
+
[x: string]: any;
|
|
27
|
+
}>[] | undefined>;
|
|
4
28
|
export default function useDependencies(fieldName: string): {
|
|
5
29
|
isDisabled: Ref<boolean, boolean>;
|
|
6
30
|
isHidden: Ref<boolean, boolean>;
|
|
@@ -21,7 +21,7 @@ z.ZodEffects<ChildType>): ChildType | null;
|
|
|
21
21
|
* Get the type name of the lowest level Zod type.
|
|
22
22
|
* This will unpack optionals, refinements, etc.
|
|
23
23
|
*/
|
|
24
|
-
export declare function getBaseType(schema: z.ZodAny):
|
|
24
|
+
export declare function getBaseType(schema: z.ZodAny): "" | z.ZodFirstPartyTypeKind.ZodAny;
|
|
25
25
|
/**
|
|
26
26
|
* Search for a "ZodDefault" in the Zod stack and return its value.
|
|
27
27
|
*/
|
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
import type { BetterAuthClientPlugin } from 'better-auth';
|
|
2
|
+
/**
|
|
3
|
+
* Synchronous platform check using window.Capacitor global
|
|
4
|
+
* Safe to call at build time (returns false when window is undefined)
|
|
5
|
+
*/
|
|
6
|
+
export declare function isNativePlatform(): boolean;
|
|
7
|
+
export interface GetCapacitorAuthTokenOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Prefix for storage keys
|
|
10
|
+
* @default 'better-auth'
|
|
11
|
+
*/
|
|
12
|
+
storagePrefix?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Cookie prefix used by better-auth
|
|
15
|
+
* @default 'better-auth'
|
|
16
|
+
*/
|
|
17
|
+
cookiePrefix?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Get the bearer token from Capacitor Preferences storage
|
|
21
|
+
* Useful for adding Authorization header to fetch requests in native apps
|
|
22
|
+
* @returns The bearer token or null if not found/not native
|
|
23
|
+
*/
|
|
24
|
+
export declare function getCapacitorAuthToken(opts?: GetCapacitorAuthTokenOptions): Promise<string | null>;
|
|
2
25
|
export interface CapacitorClientOptions {
|
|
3
26
|
/**
|
|
4
27
|
* Prefix for storage keys
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { safeJSONParse } from "@better-auth/core/utils
|
|
1
|
+
import { safeJSONParse } from "@better-auth/core/utils";
|
|
2
2
|
import {
|
|
3
3
|
parseSetCookieHeader,
|
|
4
4
|
SECURE_COOKIE_PREFIX,
|
|
@@ -25,12 +25,30 @@ async function getAppMod() {
|
|
|
25
25
|
}
|
|
26
26
|
return _AppMod;
|
|
27
27
|
}
|
|
28
|
-
function isNativePlatform() {
|
|
28
|
+
export function isNativePlatform() {
|
|
29
29
|
if (typeof window === "undefined")
|
|
30
30
|
return false;
|
|
31
31
|
const win = window;
|
|
32
32
|
return win.Capacitor?.isNativePlatform?.() ?? false;
|
|
33
33
|
}
|
|
34
|
+
export async function getCapacitorAuthToken(opts) {
|
|
35
|
+
if (!isNativePlatform())
|
|
36
|
+
return null;
|
|
37
|
+
const storagePrefix = opts?.storagePrefix || "better-auth";
|
|
38
|
+
const cookiePrefix = opts?.cookiePrefix || "better-auth";
|
|
39
|
+
const cookieName = `${storagePrefix}_cookie`;
|
|
40
|
+
try {
|
|
41
|
+
const { Preferences } = await getPreferencesMod();
|
|
42
|
+
const storedCookie = (await Preferences.get({ key: normalizeCookieName(cookieName) }))?.value;
|
|
43
|
+
if (!storedCookie)
|
|
44
|
+
return null;
|
|
45
|
+
const cookieData = JSON.parse(storedCookie);
|
|
46
|
+
const tokenKey = cookieData[`${SECURE_COOKIE_PREFIX}${cookiePrefix}.session_token`] ? `${SECURE_COOKIE_PREFIX}${cookiePrefix}.session_token` : `${cookiePrefix}.session_token`;
|
|
47
|
+
return cookieData[tokenKey]?.value || null;
|
|
48
|
+
} catch {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
34
52
|
let managersInitialized = false;
|
|
35
53
|
async function initializeManagers() {
|
|
36
54
|
if (managersInitialized || !isNativePlatform())
|
|
@@ -77,13 +95,8 @@ export function getCookie(cookie) {
|
|
|
77
95
|
} catch {
|
|
78
96
|
return "";
|
|
79
97
|
}
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
return acc;
|
|
83
|
-
}
|
|
84
|
-
return `${acc}; ${key}=${value.value}`;
|
|
85
|
-
}, "");
|
|
86
|
-
return toSend;
|
|
98
|
+
const validCookies = Object.entries(parsed).filter(([, value]) => !value.expires || new Date(value.expires) >= /* @__PURE__ */ new Date()).map(([key, value]) => `${key}=${value.value}`);
|
|
99
|
+
return validCookies.join("; ");
|
|
87
100
|
}
|
|
88
101
|
export function hasBetterAuthCookies(setCookieHeader, cookiePrefix) {
|
|
89
102
|
const cookies = parseSetCookieHeader(setCookieHeader);
|
|
@@ -289,12 +302,19 @@ export function capacitorClient(opts) {
|
|
|
289
302
|
const { Preferences } = await getPreferencesMod();
|
|
290
303
|
const normalizedCookieName = normalizeCookieName(cookieName);
|
|
291
304
|
const storedCookie = (await Preferences.get({ key: normalizedCookieName }))?.value;
|
|
292
|
-
|
|
305
|
+
let bearerToken = null;
|
|
306
|
+
try {
|
|
307
|
+
const cookieData = JSON.parse(storedCookie || "{}");
|
|
308
|
+
const prefixStr = Array.isArray(cookiePrefix) ? cookiePrefix[0] : cookiePrefix;
|
|
309
|
+
const tokenKey = cookieData[`${SECURE_COOKIE_PREFIX}${prefixStr}.session_token`] ? `${SECURE_COOKIE_PREFIX}${prefixStr}.session_token` : `${prefixStr}.session_token`;
|
|
310
|
+
bearerToken = cookieData[tokenKey]?.value || null;
|
|
311
|
+
} catch {
|
|
312
|
+
}
|
|
293
313
|
options = options || {};
|
|
294
314
|
options.credentials = "omit";
|
|
295
315
|
options.headers = {
|
|
296
316
|
...options.headers,
|
|
297
|
-
|
|
317
|
+
...bearerToken ? { Authorization: `Bearer ${bearerToken}` } : {}
|
|
298
318
|
};
|
|
299
319
|
if (scheme) {
|
|
300
320
|
options.headers = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { capacitorClient, getCookie, getSetCookie, hasBetterAuthCookies, normalizeCookieName, parseSetCookieHeader, } from './client.js';
|
|
2
|
-
export type { CapacitorClientOptions } from './client.js';
|
|
1
|
+
export { capacitorClient, getCapacitorAuthToken, getCookie, getSetCookie, hasBetterAuthCookies, isNativePlatform, normalizeCookieName, parseSetCookieHeader, } from './client.js';
|
|
2
|
+
export type { CapacitorClientOptions, GetCapacitorAuthTokenOptions } from './client.js';
|
|
3
3
|
export { setupCapacitorFocusManager } from './focus-manager.js';
|
|
4
4
|
export { setupCapacitorOnlineManager } from './online-manager.js';
|
|
5
5
|
export * from './plugins/index.js';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "abckit",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.74",
|
|
5
5
|
"description": "Nuxt 4 module — UI components, auth, storage, GraphQL",
|
|
6
6
|
"author": "productdevbook",
|
|
7
7
|
"license": "MIT",
|
|
@@ -81,6 +81,7 @@
|
|
|
81
81
|
"dist"
|
|
82
82
|
],
|
|
83
83
|
"dependencies": {
|
|
84
|
+
"@better-auth/core": "^1.4.17",
|
|
84
85
|
"class-variance-authority": "^0.7.1",
|
|
85
86
|
"clsx": "^2.1.1",
|
|
86
87
|
"consola": "^3.4.2",
|
|
@@ -89,7 +90,6 @@
|
|
|
89
90
|
},
|
|
90
91
|
"peerDependencies": {
|
|
91
92
|
"@better-auth/oauth-provider": "^1.4.12",
|
|
92
|
-
"better-auth-nuxt": "^0.0.2-beta.24",
|
|
93
93
|
"@capacitor/android": "^8.0.1",
|
|
94
94
|
"@capacitor/app": "^8.0.0",
|
|
95
95
|
"@capacitor/browser": "^8.0.0",
|
|
@@ -132,6 +132,7 @@
|
|
|
132
132
|
"apiful": "^4.0.1",
|
|
133
133
|
"aws4fetch": "^1.0.20",
|
|
134
134
|
"better-auth": "^1.4.12",
|
|
135
|
+
"better-auth-nuxt": "^0.0.2-beta.24",
|
|
135
136
|
"capacitor-native-settings": "^7.0.2",
|
|
136
137
|
"dataloader": "^2.2.3",
|
|
137
138
|
"date-fns": "^4.1.0",
|
|
@@ -301,22 +302,22 @@
|
|
|
301
302
|
}
|
|
302
303
|
},
|
|
303
304
|
"devDependencies": {
|
|
304
|
-
"@antfu/eslint-config": "^7.
|
|
305
|
+
"@antfu/eslint-config": "^7.2.0",
|
|
305
306
|
"@nuxt/eslint": "latest",
|
|
306
307
|
"@nuxt/kit": "https://pkg.pr.new/@nuxt/kit@33005",
|
|
307
308
|
"@nuxt/module-builder": "^1.0.2",
|
|
308
309
|
"@nuxt/schema": "https://pkg.pr.new/@nuxt/schema@33005",
|
|
309
|
-
"@types/node": "^25.0.
|
|
310
|
+
"@types/node": "^25.0.10",
|
|
310
311
|
"@types/pg": "^8.16.0",
|
|
311
312
|
"eslint": "^9.39.2",
|
|
312
|
-
"nitro": "
|
|
313
|
+
"nitro": "3.0.1-alpha.2",
|
|
313
314
|
"nuxt": "https://pkg.pr.new/nuxt@33005",
|
|
314
|
-
"rolldown": "1.0.0-
|
|
315
|
+
"rolldown": "1.0.0-rc.1",
|
|
315
316
|
"shadcn-vue": "^2.4.3",
|
|
316
317
|
"typescript": "^5.9.3",
|
|
317
|
-
"vite-tsconfig-paths": "^6.0.
|
|
318
|
-
"vue": "^3.5.
|
|
319
|
-
"vue-tsc": "^3.2.
|
|
318
|
+
"vite-tsconfig-paths": "^6.0.5",
|
|
319
|
+
"vue": "^3.5.27",
|
|
320
|
+
"vue-tsc": "^3.2.4"
|
|
320
321
|
},
|
|
321
322
|
"resolutions": {
|
|
322
323
|
"abckit": "workspace:*"
|
|
@@ -325,11 +326,9 @@
|
|
|
325
326
|
"@nuxt/kit": "https://pkg.pr.new/@nuxt/kit@33005",
|
|
326
327
|
"@nuxt/schema": "https://pkg.pr.new/@nuxt/schema@33005",
|
|
327
328
|
"entities": "7.0.0",
|
|
328
|
-
"nuxt": "https://pkg.pr.new/nuxt@33005"
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
"entities@7.0.0": "patches/entities@7.0.0.patch",
|
|
332
|
-
"entities@7.0.0@7.0.0": "patches/entities@7.0.0.patch"
|
|
329
|
+
"nuxt": "https://pkg.pr.new/nuxt@33005",
|
|
330
|
+
"nitro": "3.0.1-alpha.2",
|
|
331
|
+
"vite": "8.0.0-beta.10"
|
|
333
332
|
},
|
|
334
333
|
"scripts": {
|
|
335
334
|
"build": "nuxt-module-build build",
|