@mearie/vue 0.1.1 → 0.2.1
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/index.cjs +38 -49
- package/dist/index.d.cts +37 -4
- package/dist/{index.d.ts → index.d.mts} +37 -4
- package/dist/{index.js → index.mjs} +28 -14
- package/package.json +14 -9
package/dist/index.cjs
CHANGED
|
@@ -1,32 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
-
key = keys[i];
|
|
11
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
-
get: ((k) => from[k]).bind(null, key),
|
|
13
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
-
value: mod,
|
|
20
|
-
enumerable: true
|
|
21
|
-
}) : target, mod));
|
|
22
|
-
|
|
23
|
-
//#endregion
|
|
24
|
-
let __mearie_core = require("@mearie/core");
|
|
25
|
-
__mearie_core = __toESM(__mearie_core);
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
let _mearie_core = require("@mearie/core");
|
|
26
3
|
let vue = require("vue");
|
|
27
|
-
|
|
28
|
-
let __mearie_core_stream = require("@mearie/core/stream");
|
|
29
|
-
__mearie_core_stream = __toESM(__mearie_core_stream);
|
|
4
|
+
let _mearie_core_stream = require("@mearie/core/stream");
|
|
30
5
|
|
|
31
6
|
//#region src/client-plugin.ts
|
|
32
7
|
const ClientKey = Symbol("mearie-client");
|
|
@@ -41,20 +16,23 @@ const useClient = () => {
|
|
|
41
16
|
|
|
42
17
|
//#endregion
|
|
43
18
|
//#region src/use-query.ts
|
|
44
|
-
const useQuery = (query,
|
|
19
|
+
const useQuery = ((query, variables, options) => {
|
|
45
20
|
const client = useClient();
|
|
46
|
-
const
|
|
47
|
-
const
|
|
21
|
+
const initialOpts = (0, vue.toValue)(options);
|
|
22
|
+
const data = (0, vue.ref)(initialOpts?.initialData);
|
|
23
|
+
const loading = (0, vue.ref)(!initialOpts?.skip && !initialOpts?.initialData);
|
|
48
24
|
const error = (0, vue.ref)(void 0);
|
|
49
25
|
let unsubscribe = null;
|
|
26
|
+
let initialized = false;
|
|
50
27
|
const execute = () => {
|
|
51
28
|
unsubscribe?.();
|
|
52
29
|
if ((0, vue.toValue)(options)?.skip) return;
|
|
53
|
-
loading.value = true;
|
|
30
|
+
if (!initialized && initialOpts?.initialData) loading.value = true;
|
|
31
|
+
initialized = true;
|
|
54
32
|
error.value = void 0;
|
|
55
|
-
unsubscribe = (0,
|
|
33
|
+
unsubscribe = (0, _mearie_core_stream.pipe)(client.executeQuery(query, (0, vue.toValue)(variables), (0, vue.toValue)(options)), (0, _mearie_core_stream.subscribe)({ next: (result) => {
|
|
56
34
|
if (result.errors && result.errors.length > 0) {
|
|
57
|
-
error.value = new
|
|
35
|
+
error.value = new _mearie_core.AggregatedError(result.errors);
|
|
58
36
|
loading.value = false;
|
|
59
37
|
} else {
|
|
60
38
|
data.value = result.data;
|
|
@@ -75,7 +53,7 @@ const useQuery = (query, ...[variables, options]) => {
|
|
|
75
53
|
error,
|
|
76
54
|
refetch: execute
|
|
77
55
|
};
|
|
78
|
-
};
|
|
56
|
+
});
|
|
79
57
|
|
|
80
58
|
//#endregion
|
|
81
59
|
//#region src/use-subscription.ts
|
|
@@ -90,9 +68,9 @@ const useSubscription = (subscription, ...[variables, options]) => {
|
|
|
90
68
|
if ((0, vue.toValue)(options)?.skip) return;
|
|
91
69
|
loading.value = true;
|
|
92
70
|
error.value = void 0;
|
|
93
|
-
unsubscribe = (0,
|
|
71
|
+
unsubscribe = (0, _mearie_core_stream.pipe)(client.executeSubscription(subscription, (0, vue.toValue)(variables), (0, vue.toValue)(options)), (0, _mearie_core_stream.subscribe)({ next: (result) => {
|
|
94
72
|
if (result.errors && result.errors.length > 0) {
|
|
95
|
-
const err = new
|
|
73
|
+
const err = new _mearie_core.AggregatedError(result.errors);
|
|
96
74
|
error.value = err;
|
|
97
75
|
loading.value = false;
|
|
98
76
|
(0, vue.toValue)(options)?.onError?.(err);
|
|
@@ -128,9 +106,9 @@ const useMutation = (mutation) => {
|
|
|
128
106
|
loading.value = true;
|
|
129
107
|
error.value = void 0;
|
|
130
108
|
try {
|
|
131
|
-
const result = await (0,
|
|
109
|
+
const result = await (0, _mearie_core_stream.pipe)(client.executeMutation(mutation, variables, options), (0, _mearie_core_stream.take)(1), _mearie_core_stream.collect);
|
|
132
110
|
if (result.errors && result.errors.length > 0) {
|
|
133
|
-
const err = new
|
|
111
|
+
const err = new _mearie_core.AggregatedError(result.errors);
|
|
134
112
|
error.value = err;
|
|
135
113
|
loading.value = false;
|
|
136
114
|
throw err;
|
|
@@ -139,7 +117,7 @@ const useMutation = (mutation) => {
|
|
|
139
117
|
loading.value = false;
|
|
140
118
|
return result.data;
|
|
141
119
|
} catch (err) {
|
|
142
|
-
if (err instanceof
|
|
120
|
+
if (err instanceof _mearie_core.AggregatedError) error.value = err;
|
|
143
121
|
loading.value = false;
|
|
144
122
|
throw err;
|
|
145
123
|
}
|
|
@@ -153,21 +131,32 @@ const useMutation = (mutation) => {
|
|
|
153
131
|
|
|
154
132
|
//#endregion
|
|
155
133
|
//#region src/use-fragment.ts
|
|
156
|
-
const useFragment = (fragment, fragmentRef, ...[options]) => {
|
|
134
|
+
const useFragment = ((fragment, fragmentRef, ...[options]) => {
|
|
157
135
|
const client = useClient();
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
|
|
136
|
+
const initialRef = (0, vue.toValue)(fragmentRef);
|
|
137
|
+
let initialData;
|
|
138
|
+
if (initialRef == null) initialData = null;
|
|
139
|
+
else {
|
|
140
|
+
const result = (0, _mearie_core_stream.pipe)(client.executeFragment(fragment, initialRef, (0, vue.toValue)(options)), _mearie_core_stream.peek);
|
|
141
|
+
if (result.data === void 0) throw new Error("Fragment data not found");
|
|
142
|
+
initialData = result.data;
|
|
143
|
+
}
|
|
144
|
+
const data = (0, vue.ref)(initialData);
|
|
161
145
|
(0, vue.watchEffect)((onCleanup) => {
|
|
162
|
-
const
|
|
163
|
-
|
|
146
|
+
const currentRef = (0, vue.toValue)(fragmentRef);
|
|
147
|
+
if (currentRef == null) {
|
|
148
|
+
data.value = null;
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
const unsubscribe = (0, _mearie_core_stream.pipe)(client.executeFragment(fragment, currentRef, (0, vue.toValue)(options)), (0, _mearie_core_stream.subscribe)({ next: (result) => {
|
|
152
|
+
if (result.data !== void 0) data.value = result.data;
|
|
164
153
|
} }));
|
|
165
154
|
onCleanup(() => unsubscribe());
|
|
166
155
|
});
|
|
167
156
|
return { get data() {
|
|
168
157
|
return data.value;
|
|
169
158
|
} };
|
|
170
|
-
};
|
|
159
|
+
});
|
|
171
160
|
|
|
172
161
|
//#endregion
|
|
173
162
|
exports.ClientPlugin = ClientPlugin;
|
|
@@ -176,9 +165,9 @@ exports.useFragment = useFragment;
|
|
|
176
165
|
exports.useMutation = useMutation;
|
|
177
166
|
exports.useQuery = useQuery;
|
|
178
167
|
exports.useSubscription = useSubscription;
|
|
179
|
-
Object.keys(
|
|
168
|
+
Object.keys(_mearie_core).forEach(function (k) {
|
|
180
169
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
181
170
|
enumerable: true,
|
|
182
|
-
get: function () { return
|
|
171
|
+
get: function () { return _mearie_core[k]; }
|
|
183
172
|
});
|
|
184
173
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -12,7 +12,7 @@ declare const ClientPlugin: {
|
|
|
12
12
|
declare const useClient: <TMeta extends SchemaMeta = SchemaMeta>() => Client<TMeta>;
|
|
13
13
|
//#endregion
|
|
14
14
|
//#region src/use-query.d.ts
|
|
15
|
-
type UseQueryOptions = QueryOptions & {
|
|
15
|
+
type UseQueryOptions<T extends Artifact<'query'> = Artifact<'query'>> = QueryOptions<T> & {
|
|
16
16
|
skip?: boolean;
|
|
17
17
|
};
|
|
18
18
|
type Query<T extends Artifact<'query'>> = {
|
|
@@ -31,7 +31,29 @@ type Query<T extends Artifact<'query'>> = {
|
|
|
31
31
|
error: Ref<AggregatedError>;
|
|
32
32
|
refetch: () => void;
|
|
33
33
|
};
|
|
34
|
-
|
|
34
|
+
type DefinedQuery<T extends Artifact<'query'>> = {
|
|
35
|
+
data: Ref<DataOf<T>>;
|
|
36
|
+
loading: Ref<true>;
|
|
37
|
+
error: Ref<undefined>;
|
|
38
|
+
refetch: () => void;
|
|
39
|
+
} | {
|
|
40
|
+
data: Ref<DataOf<T>>;
|
|
41
|
+
loading: Ref<false>;
|
|
42
|
+
error: Ref<undefined>;
|
|
43
|
+
refetch: () => void;
|
|
44
|
+
} | {
|
|
45
|
+
data: Ref<DataOf<T>>;
|
|
46
|
+
loading: Ref<false>;
|
|
47
|
+
error: Ref<AggregatedError>;
|
|
48
|
+
refetch: () => void;
|
|
49
|
+
};
|
|
50
|
+
type UseQueryFn = {
|
|
51
|
+
<T extends Artifact<'query'>>(query: T, variables: MaybeRefOrGetter<VariablesOf<T>> | undefined, options: MaybeRefOrGetter<UseQueryOptions<T> & {
|
|
52
|
+
initialData: DataOf<T>;
|
|
53
|
+
}>): DefinedQuery<T>;
|
|
54
|
+
<T extends Artifact<'query'>>(query: T, ...[variables, options]: VariablesOf<T> extends Record<string, never> ? [undefined?, MaybeRefOrGetter<UseQueryOptions<T>>?] : [MaybeRefOrGetter<VariablesOf<T>>, MaybeRefOrGetter<UseQueryOptions<T>>?]): Query<T>;
|
|
55
|
+
};
|
|
56
|
+
declare const useQuery: UseQueryFn;
|
|
35
57
|
//#endregion
|
|
36
58
|
//#region src/use-subscription.d.ts
|
|
37
59
|
type Subscription<T extends Artifact<'subscription'>> = {
|
|
@@ -77,6 +99,17 @@ type UseFragmentOptions = FragmentOptions;
|
|
|
77
99
|
type Fragment<T extends Artifact<'fragment'>> = {
|
|
78
100
|
data: DataOf<T>;
|
|
79
101
|
};
|
|
80
|
-
|
|
102
|
+
type FragmentList<T extends Artifact<'fragment'>> = {
|
|
103
|
+
data: DataOf<T>[];
|
|
104
|
+
};
|
|
105
|
+
type OptionalFragment<T extends Artifact<'fragment'>> = {
|
|
106
|
+
data: DataOf<T> | null;
|
|
107
|
+
};
|
|
108
|
+
type UseFragmentFn = {
|
|
109
|
+
<T extends Artifact<'fragment'>>(fragment: T, fragmentRef: MaybeRefOrGetter<FragmentRefs<T['name']>[]>, ...options: [MaybeRefOrGetter<UseFragmentOptions>?]): FragmentList<T>;
|
|
110
|
+
<T extends Artifact<'fragment'>>(fragment: T, fragmentRef: MaybeRefOrGetter<FragmentRefs<T['name']>>, ...options: [MaybeRefOrGetter<UseFragmentOptions>?]): Fragment<T>;
|
|
111
|
+
<T extends Artifact<'fragment'>>(fragment: T, fragmentRef: MaybeRefOrGetter<FragmentRefs<T['name']> | null | undefined>, ...options: [MaybeRefOrGetter<UseFragmentOptions>?]): OptionalFragment<T>;
|
|
112
|
+
};
|
|
113
|
+
declare const useFragment: UseFragmentFn;
|
|
81
114
|
//#endregion
|
|
82
|
-
export { ClientPlugin, type ClientPluginOptions, type Fragment, type Mutation, type Query, type Subscription, type UseFragmentOptions, type UseMutationOptions, type UseQueryOptions, type UseSubscriptionOptions, useClient, useFragment, useMutation, useQuery, useSubscription };
|
|
115
|
+
export { ClientPlugin, type ClientPluginOptions, type DefinedQuery, type Fragment, type FragmentList, type Mutation, type OptionalFragment, type Query, type Subscription, type UseFragmentOptions, type UseMutationOptions, type UseQueryOptions, type UseSubscriptionOptions, useClient, useFragment, useMutation, useQuery, useSubscription };
|
|
@@ -12,7 +12,7 @@ declare const ClientPlugin: {
|
|
|
12
12
|
declare const useClient: <TMeta extends SchemaMeta = SchemaMeta>() => Client<TMeta>;
|
|
13
13
|
//#endregion
|
|
14
14
|
//#region src/use-query.d.ts
|
|
15
|
-
type UseQueryOptions = QueryOptions & {
|
|
15
|
+
type UseQueryOptions<T extends Artifact<'query'> = Artifact<'query'>> = QueryOptions<T> & {
|
|
16
16
|
skip?: boolean;
|
|
17
17
|
};
|
|
18
18
|
type Query<T extends Artifact<'query'>> = {
|
|
@@ -31,7 +31,29 @@ type Query<T extends Artifact<'query'>> = {
|
|
|
31
31
|
error: Ref<AggregatedError>;
|
|
32
32
|
refetch: () => void;
|
|
33
33
|
};
|
|
34
|
-
|
|
34
|
+
type DefinedQuery<T extends Artifact<'query'>> = {
|
|
35
|
+
data: Ref<DataOf<T>>;
|
|
36
|
+
loading: Ref<true>;
|
|
37
|
+
error: Ref<undefined>;
|
|
38
|
+
refetch: () => void;
|
|
39
|
+
} | {
|
|
40
|
+
data: Ref<DataOf<T>>;
|
|
41
|
+
loading: Ref<false>;
|
|
42
|
+
error: Ref<undefined>;
|
|
43
|
+
refetch: () => void;
|
|
44
|
+
} | {
|
|
45
|
+
data: Ref<DataOf<T>>;
|
|
46
|
+
loading: Ref<false>;
|
|
47
|
+
error: Ref<AggregatedError>;
|
|
48
|
+
refetch: () => void;
|
|
49
|
+
};
|
|
50
|
+
type UseQueryFn = {
|
|
51
|
+
<T extends Artifact<'query'>>(query: T, variables: MaybeRefOrGetter<VariablesOf<T>> | undefined, options: MaybeRefOrGetter<UseQueryOptions<T> & {
|
|
52
|
+
initialData: DataOf<T>;
|
|
53
|
+
}>): DefinedQuery<T>;
|
|
54
|
+
<T extends Artifact<'query'>>(query: T, ...[variables, options]: VariablesOf<T> extends Record<string, never> ? [undefined?, MaybeRefOrGetter<UseQueryOptions<T>>?] : [MaybeRefOrGetter<VariablesOf<T>>, MaybeRefOrGetter<UseQueryOptions<T>>?]): Query<T>;
|
|
55
|
+
};
|
|
56
|
+
declare const useQuery: UseQueryFn;
|
|
35
57
|
//#endregion
|
|
36
58
|
//#region src/use-subscription.d.ts
|
|
37
59
|
type Subscription<T extends Artifact<'subscription'>> = {
|
|
@@ -77,6 +99,17 @@ type UseFragmentOptions = FragmentOptions;
|
|
|
77
99
|
type Fragment<T extends Artifact<'fragment'>> = {
|
|
78
100
|
data: DataOf<T>;
|
|
79
101
|
};
|
|
80
|
-
|
|
102
|
+
type FragmentList<T extends Artifact<'fragment'>> = {
|
|
103
|
+
data: DataOf<T>[];
|
|
104
|
+
};
|
|
105
|
+
type OptionalFragment<T extends Artifact<'fragment'>> = {
|
|
106
|
+
data: DataOf<T> | null;
|
|
107
|
+
};
|
|
108
|
+
type UseFragmentFn = {
|
|
109
|
+
<T extends Artifact<'fragment'>>(fragment: T, fragmentRef: MaybeRefOrGetter<FragmentRefs<T['name']>[]>, ...options: [MaybeRefOrGetter<UseFragmentOptions>?]): FragmentList<T>;
|
|
110
|
+
<T extends Artifact<'fragment'>>(fragment: T, fragmentRef: MaybeRefOrGetter<FragmentRefs<T['name']>>, ...options: [MaybeRefOrGetter<UseFragmentOptions>?]): Fragment<T>;
|
|
111
|
+
<T extends Artifact<'fragment'>>(fragment: T, fragmentRef: MaybeRefOrGetter<FragmentRefs<T['name']> | null | undefined>, ...options: [MaybeRefOrGetter<UseFragmentOptions>?]): OptionalFragment<T>;
|
|
112
|
+
};
|
|
113
|
+
declare const useFragment: UseFragmentFn;
|
|
81
114
|
//#endregion
|
|
82
|
-
export { ClientPlugin, type ClientPluginOptions, type Fragment, type Mutation, type Query, type Subscription, type UseFragmentOptions, type UseMutationOptions, type UseQueryOptions, type UseSubscriptionOptions, useClient, useFragment, useMutation, useQuery, useSubscription };
|
|
115
|
+
export { ClientPlugin, type ClientPluginOptions, type DefinedQuery, type Fragment, type FragmentList, type Mutation, type OptionalFragment, type Query, type Subscription, type UseFragmentOptions, type UseMutationOptions, type UseQueryOptions, type UseSubscriptionOptions, useClient, useFragment, useMutation, useQuery, useSubscription };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AggregatedError } from "@mearie/core";
|
|
2
2
|
import { inject, ref, toValue, watchEffect } from "vue";
|
|
3
|
-
import { collect, peek, pipe, subscribe } from "@mearie/core/stream";
|
|
3
|
+
import { collect, peek, pipe, subscribe, take } from "@mearie/core/stream";
|
|
4
4
|
|
|
5
5
|
export * from "@mearie/core"
|
|
6
6
|
|
|
@@ -17,16 +17,19 @@ const useClient = () => {
|
|
|
17
17
|
|
|
18
18
|
//#endregion
|
|
19
19
|
//#region src/use-query.ts
|
|
20
|
-
const useQuery = (query,
|
|
20
|
+
const useQuery = ((query, variables, options) => {
|
|
21
21
|
const client = useClient();
|
|
22
|
-
const
|
|
23
|
-
const
|
|
22
|
+
const initialOpts = toValue(options);
|
|
23
|
+
const data = ref(initialOpts?.initialData);
|
|
24
|
+
const loading = ref(!initialOpts?.skip && !initialOpts?.initialData);
|
|
24
25
|
const error = ref(void 0);
|
|
25
26
|
let unsubscribe = null;
|
|
27
|
+
let initialized = false;
|
|
26
28
|
const execute = () => {
|
|
27
29
|
unsubscribe?.();
|
|
28
30
|
if (toValue(options)?.skip) return;
|
|
29
|
-
loading.value = true;
|
|
31
|
+
if (!initialized && initialOpts?.initialData) loading.value = true;
|
|
32
|
+
initialized = true;
|
|
30
33
|
error.value = void 0;
|
|
31
34
|
unsubscribe = pipe(client.executeQuery(query, toValue(variables), toValue(options)), subscribe({ next: (result) => {
|
|
32
35
|
if (result.errors && result.errors.length > 0) {
|
|
@@ -51,7 +54,7 @@ const useQuery = (query, ...[variables, options]) => {
|
|
|
51
54
|
error,
|
|
52
55
|
refetch: execute
|
|
53
56
|
};
|
|
54
|
-
};
|
|
57
|
+
});
|
|
55
58
|
|
|
56
59
|
//#endregion
|
|
57
60
|
//#region src/use-subscription.ts
|
|
@@ -104,7 +107,7 @@ const useMutation = (mutation) => {
|
|
|
104
107
|
loading.value = true;
|
|
105
108
|
error.value = void 0;
|
|
106
109
|
try {
|
|
107
|
-
const result = await pipe(client.executeMutation(mutation, variables, options), collect);
|
|
110
|
+
const result = await pipe(client.executeMutation(mutation, variables, options), take(1), collect);
|
|
108
111
|
if (result.errors && result.errors.length > 0) {
|
|
109
112
|
const err = new AggregatedError(result.errors);
|
|
110
113
|
error.value = err;
|
|
@@ -129,21 +132,32 @@ const useMutation = (mutation) => {
|
|
|
129
132
|
|
|
130
133
|
//#endregion
|
|
131
134
|
//#region src/use-fragment.ts
|
|
132
|
-
const useFragment = (fragment, fragmentRef, ...[options]) => {
|
|
135
|
+
const useFragment = ((fragment, fragmentRef, ...[options]) => {
|
|
133
136
|
const client = useClient();
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
|
|
137
|
+
const initialRef = toValue(fragmentRef);
|
|
138
|
+
let initialData;
|
|
139
|
+
if (initialRef == null) initialData = null;
|
|
140
|
+
else {
|
|
141
|
+
const result = pipe(client.executeFragment(fragment, initialRef, toValue(options)), peek);
|
|
142
|
+
if (result.data === void 0) throw new Error("Fragment data not found");
|
|
143
|
+
initialData = result.data;
|
|
144
|
+
}
|
|
145
|
+
const data = ref(initialData);
|
|
137
146
|
watchEffect((onCleanup) => {
|
|
138
|
-
const
|
|
139
|
-
|
|
147
|
+
const currentRef = toValue(fragmentRef);
|
|
148
|
+
if (currentRef == null) {
|
|
149
|
+
data.value = null;
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
const unsubscribe = pipe(client.executeFragment(fragment, currentRef, toValue(options)), subscribe({ next: (result) => {
|
|
153
|
+
if (result.data !== void 0) data.value = result.data;
|
|
140
154
|
} }));
|
|
141
155
|
onCleanup(() => unsubscribe());
|
|
142
156
|
});
|
|
143
157
|
return { get data() {
|
|
144
158
|
return data.value;
|
|
145
159
|
} };
|
|
146
|
-
};
|
|
160
|
+
});
|
|
147
161
|
|
|
148
162
|
//#endregion
|
|
149
163
|
export { ClientPlugin, useClient, useFragment, useMutation, useQuery, useSubscription };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mearie/vue",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Type-safe, zero-overhead GraphQL client",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"graphql",
|
|
@@ -28,9 +28,14 @@
|
|
|
28
28
|
"type": "module",
|
|
29
29
|
"exports": {
|
|
30
30
|
".": {
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
"import": {
|
|
32
|
+
"types": "./dist/index.d.mts",
|
|
33
|
+
"default": "./dist/index.mjs"
|
|
34
|
+
},
|
|
35
|
+
"require": {
|
|
36
|
+
"types": "./dist/index.d.cts",
|
|
37
|
+
"default": "./dist/index.cjs"
|
|
38
|
+
}
|
|
34
39
|
},
|
|
35
40
|
"./package.json": "./package.json"
|
|
36
41
|
},
|
|
@@ -40,12 +45,12 @@
|
|
|
40
45
|
"README.md"
|
|
41
46
|
],
|
|
42
47
|
"dependencies": {
|
|
43
|
-
"@mearie/core": "0.1
|
|
48
|
+
"@mearie/core": "0.2.1"
|
|
44
49
|
},
|
|
45
50
|
"devDependencies": {
|
|
46
|
-
"tsdown": "^0.
|
|
51
|
+
"tsdown": "^0.20.3",
|
|
47
52
|
"typescript": "^5.9.3",
|
|
48
|
-
"vue": "^3.5.
|
|
53
|
+
"vue": "^3.5.29"
|
|
49
54
|
},
|
|
50
55
|
"peerDependencies": {
|
|
51
56
|
"vue": "^3.3.0"
|
|
@@ -63,6 +68,6 @@
|
|
|
63
68
|
"typecheck": "tsc"
|
|
64
69
|
},
|
|
65
70
|
"main": "./dist/index.cjs",
|
|
66
|
-
"module": "./dist/index.
|
|
67
|
-
"types": "./dist/index.d.
|
|
71
|
+
"module": "./dist/index.mjs",
|
|
72
|
+
"types": "./dist/index.d.mts"
|
|
68
73
|
}
|