@mearie/solid 0.0.1-next.4 → 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/README.md +4 -2
- package/dist/index.d.cts +8 -8
- package/dist/index.d.ts +8 -8
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -22,10 +22,12 @@ First, create a client and wrap your app with the provider:
|
|
|
22
22
|
```tsx
|
|
23
23
|
// src/App.tsx
|
|
24
24
|
import { type Component } from 'solid-js';
|
|
25
|
-
import { createClient,
|
|
25
|
+
import { createClient, httpExchange, cacheExchange, dedupExchange, ClientProvider } from '@mearie/solid';
|
|
26
|
+
import { schema } from '$mearie';
|
|
26
27
|
|
|
27
28
|
const client = createClient({
|
|
28
|
-
|
|
29
|
+
schema,
|
|
30
|
+
exchanges: [dedupExchange(), cacheExchange(), httpExchange({ url: 'https://api.example.com/graphql' })],
|
|
29
31
|
});
|
|
30
32
|
|
|
31
33
|
const App: Component = () => {
|
package/dist/index.d.cts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { AggregatedError, Artifact, Client, DataOf, FragmentOptions, FragmentRefs, MutationOptions, QueryOptions, SubscriptionOptions, VariablesOf } from "@mearie/core";
|
|
1
|
+
import { AggregatedError, Artifact, Client, DataOf, FragmentOptions, FragmentRefs, MutationOptions, QueryOptions, SchemaMeta, SubscriptionOptions, VariablesOf } from "@mearie/core";
|
|
2
2
|
import { Accessor, JSX } from "solid-js";
|
|
3
3
|
export * from "@mearie/core";
|
|
4
4
|
|
|
5
5
|
//#region src/client-provider.d.ts
|
|
6
|
-
type ClientProviderProps = {
|
|
7
|
-
client: Client
|
|
6
|
+
type ClientProviderProps<TMeta extends SchemaMeta = SchemaMeta> = {
|
|
7
|
+
client: Client<TMeta>;
|
|
8
8
|
children: JSX.Element;
|
|
9
9
|
};
|
|
10
|
-
declare const ClientProvider: (props: ClientProviderProps) => JSX.Element;
|
|
11
|
-
declare const useClient: () => Client
|
|
10
|
+
declare const ClientProvider: <TMeta extends SchemaMeta = SchemaMeta>(props: ClientProviderProps<TMeta>) => JSX.Element;
|
|
11
|
+
declare const useClient: <TMeta extends SchemaMeta = SchemaMeta>() => Client<TMeta>;
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region src/create-query.d.ts
|
|
14
14
|
type CreateQueryOptions = QueryOptions & {
|
|
@@ -30,7 +30,7 @@ type Query<T extends Artifact<'query'>> = {
|
|
|
30
30
|
error: AggregatedError;
|
|
31
31
|
refetch: () => void;
|
|
32
32
|
};
|
|
33
|
-
declare const createQuery: <T extends Artifact<"query">>(query: T, ...[variables, options]: VariablesOf<T> extends
|
|
33
|
+
declare const createQuery: <T extends Artifact<"query">>(query: T, ...[variables, options]: VariablesOf<T> extends Record<string, never> ? [undefined?, Accessor<CreateQueryOptions>?] : [Accessor<VariablesOf<T>>, Accessor<CreateQueryOptions>?]) => Query<T>;
|
|
34
34
|
//#endregion
|
|
35
35
|
//#region src/create-subscription.d.ts
|
|
36
36
|
type Subscription<T extends Artifact<'subscription'>> = {
|
|
@@ -51,7 +51,7 @@ type CreateSubscriptionOptions<T extends Artifact<'subscription'>> = Subscriptio
|
|
|
51
51
|
onData?: (data: DataOf<T>) => void;
|
|
52
52
|
onError?: (error: AggregatedError) => void;
|
|
53
53
|
};
|
|
54
|
-
declare const createSubscription: <T extends Artifact<"subscription">>(subscription: T, ...[variables, options]: VariablesOf<T> extends
|
|
54
|
+
declare const createSubscription: <T extends Artifact<"subscription">>(subscription: T, ...[variables, options]: VariablesOf<T> extends Record<string, never> ? [undefined?, Accessor<CreateSubscriptionOptions<T>>?] : [Accessor<VariablesOf<T>>, Accessor<CreateSubscriptionOptions<T>>?]) => Subscription<T>;
|
|
55
55
|
//#endregion
|
|
56
56
|
//#region src/create-mutation.d.ts
|
|
57
57
|
type MutationResult<T extends Artifact<'mutation'>> = {
|
|
@@ -68,7 +68,7 @@ type MutationResult<T extends Artifact<'mutation'>> = {
|
|
|
68
68
|
error: AggregatedError;
|
|
69
69
|
};
|
|
70
70
|
type CreateMutationOptions = MutationOptions;
|
|
71
|
-
type Mutation<T extends Artifact<'mutation'>> = [(...[variables, options]: VariablesOf<T> extends
|
|
71
|
+
type Mutation<T extends Artifact<'mutation'>> = [(...[variables, options]: VariablesOf<T> extends Record<string, never> ? [undefined?, CreateMutationOptions?] : [VariablesOf<T>, CreateMutationOptions?]) => Promise<DataOf<T>>, MutationResult<T>];
|
|
72
72
|
declare const createMutation: <T extends Artifact<"mutation">>(mutation: T) => Mutation<T>;
|
|
73
73
|
//#endregion
|
|
74
74
|
//#region src/create-fragment.d.ts
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { AggregatedError, Artifact, Client, DataOf, FragmentOptions, FragmentRefs, MutationOptions, QueryOptions, SubscriptionOptions, VariablesOf } from "@mearie/core";
|
|
1
|
+
import { AggregatedError, Artifact, Client, DataOf, FragmentOptions, FragmentRefs, MutationOptions, QueryOptions, SchemaMeta, SubscriptionOptions, VariablesOf } from "@mearie/core";
|
|
2
2
|
import { Accessor, JSX } from "solid-js";
|
|
3
3
|
export * from "@mearie/core";
|
|
4
4
|
|
|
5
5
|
//#region src/client-provider.d.ts
|
|
6
|
-
type ClientProviderProps = {
|
|
7
|
-
client: Client
|
|
6
|
+
type ClientProviderProps<TMeta extends SchemaMeta = SchemaMeta> = {
|
|
7
|
+
client: Client<TMeta>;
|
|
8
8
|
children: JSX.Element;
|
|
9
9
|
};
|
|
10
|
-
declare const ClientProvider: (props: ClientProviderProps) => JSX.Element;
|
|
11
|
-
declare const useClient: () => Client
|
|
10
|
+
declare const ClientProvider: <TMeta extends SchemaMeta = SchemaMeta>(props: ClientProviderProps<TMeta>) => JSX.Element;
|
|
11
|
+
declare const useClient: <TMeta extends SchemaMeta = SchemaMeta>() => Client<TMeta>;
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region src/create-query.d.ts
|
|
14
14
|
type CreateQueryOptions = QueryOptions & {
|
|
@@ -30,7 +30,7 @@ type Query<T extends Artifact<'query'>> = {
|
|
|
30
30
|
error: AggregatedError;
|
|
31
31
|
refetch: () => void;
|
|
32
32
|
};
|
|
33
|
-
declare const createQuery: <T extends Artifact<"query">>(query: T, ...[variables, options]: VariablesOf<T> extends
|
|
33
|
+
declare const createQuery: <T extends Artifact<"query">>(query: T, ...[variables, options]: VariablesOf<T> extends Record<string, never> ? [undefined?, Accessor<CreateQueryOptions>?] : [Accessor<VariablesOf<T>>, Accessor<CreateQueryOptions>?]) => Query<T>;
|
|
34
34
|
//#endregion
|
|
35
35
|
//#region src/create-subscription.d.ts
|
|
36
36
|
type Subscription<T extends Artifact<'subscription'>> = {
|
|
@@ -51,7 +51,7 @@ type CreateSubscriptionOptions<T extends Artifact<'subscription'>> = Subscriptio
|
|
|
51
51
|
onData?: (data: DataOf<T>) => void;
|
|
52
52
|
onError?: (error: AggregatedError) => void;
|
|
53
53
|
};
|
|
54
|
-
declare const createSubscription: <T extends Artifact<"subscription">>(subscription: T, ...[variables, options]: VariablesOf<T> extends
|
|
54
|
+
declare const createSubscription: <T extends Artifact<"subscription">>(subscription: T, ...[variables, options]: VariablesOf<T> extends Record<string, never> ? [undefined?, Accessor<CreateSubscriptionOptions<T>>?] : [Accessor<VariablesOf<T>>, Accessor<CreateSubscriptionOptions<T>>?]) => Subscription<T>;
|
|
55
55
|
//#endregion
|
|
56
56
|
//#region src/create-mutation.d.ts
|
|
57
57
|
type MutationResult<T extends Artifact<'mutation'>> = {
|
|
@@ -68,7 +68,7 @@ type MutationResult<T extends Artifact<'mutation'>> = {
|
|
|
68
68
|
error: AggregatedError;
|
|
69
69
|
};
|
|
70
70
|
type CreateMutationOptions = MutationOptions;
|
|
71
|
-
type Mutation<T extends Artifact<'mutation'>> = [(...[variables, options]: VariablesOf<T> extends
|
|
71
|
+
type Mutation<T extends Artifact<'mutation'>> = [(...[variables, options]: VariablesOf<T> extends Record<string, never> ? [undefined?, CreateMutationOptions?] : [VariablesOf<T>, CreateMutationOptions?]) => Promise<DataOf<T>>, MutationResult<T>];
|
|
72
72
|
declare const createMutation: <T extends Artifact<"mutation">>(mutation: T) => Mutation<T>;
|
|
73
73
|
//#endregion
|
|
74
74
|
//#region src/create-fragment.d.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mearie/solid",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Type-safe, zero-overhead GraphQL client",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"graphql",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"README.md"
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@mearie/core": "0.
|
|
43
|
+
"@mearie/core": "0.1.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"solid-js": "^1.9.10",
|