@supatype/solid 0.1.0-alpha.9

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.
@@ -0,0 +1,4 @@
1
+
2
+ > @supatype/solid@0.1.0-alpha.9 build /home/runner/work/supatype/supatype/packages/solid
3
+ > tsc --project tsconfig.json
4
+
@@ -0,0 +1,4 @@
1
+
2
+ > @supatype/solid@0.1.0-alpha.9 typecheck /home/runner/work/supatype/supatype/packages/solid
3
+ > tsc --project tsconfig.json --noEmit
4
+
@@ -0,0 +1,4 @@
1
+ import type { SupatypeClient, AnyDatabase } from "@supatype/client";
2
+ export declare const SupatypeContext: import("solid-js").Context<SupatypeClient<import("@supatype/client").AugmentedDatabase> | undefined>;
3
+ export declare function useSupatype<TDatabase extends AnyDatabase = AnyDatabase>(): SupatypeClient<TDatabase>;
4
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAEnE,eAAO,MAAM,eAAe,sGAAkC,CAAA;AAE9D,wBAAgB,WAAW,CAAC,SAAS,SAAS,WAAW,GAAG,WAAW,KAAK,cAAc,CAAC,SAAS,CAAC,CAMpG"}
@@ -0,0 +1,10 @@
1
+ import { createContext, useContext } from "solid-js";
2
+ export const SupatypeContext = createContext();
3
+ export function useSupatype() {
4
+ const client = useContext(SupatypeContext);
5
+ if (!client) {
6
+ throw new Error("useSupatype() requires a <SupatypeContext.Provider> ancestor.");
7
+ }
8
+ return client;
9
+ }
10
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAGpD,MAAM,CAAC,MAAM,eAAe,GAAG,aAAa,EAAkB,CAAA;AAE9D,MAAM,UAAU,WAAW;IACzB,MAAM,MAAM,GAAG,UAAU,CAAC,eAAe,CAAC,CAAA;IAC1C,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAA;IAClF,CAAC;IACD,OAAO,MAAmC,CAAA;AAC5C,CAAC"}
@@ -0,0 +1,24 @@
1
+ import type { Accessor } from "solid-js";
2
+ import type { AnyDatabase, SupatypeError, User, Session } from "@supatype/client";
3
+ export interface AuthResult {
4
+ user: Accessor<User | null>;
5
+ session: Accessor<Session | null>;
6
+ loading: Accessor<boolean>;
7
+ signIn: (email: string, password: string) => Promise<{
8
+ error: SupatypeError | null;
9
+ }>;
10
+ signUp: (email: string, password: string) => Promise<{
11
+ error: SupatypeError | null;
12
+ }>;
13
+ signOut: () => Promise<{
14
+ error: SupatypeError | null;
15
+ }>;
16
+ signInWithOAuth: (provider: string) => Promise<{
17
+ error: SupatypeError | null;
18
+ }>;
19
+ resetPassword: (email: string) => Promise<{
20
+ error: SupatypeError | null;
21
+ }>;
22
+ }
23
+ export declare function createAuth<TDatabase extends AnyDatabase = AnyDatabase>(): AuthResult;
24
+ //# sourceMappingURL=createAuth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createAuth.d.ts","sourceRoot":"","sources":["../src/createAuth.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,IAAI,EAAE,OAAO,EAAmB,MAAM,kBAAkB,CAAA;AAGlG,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC,CAAA;IAC3B,OAAO,EAAE,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC,CAAA;IACjC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAA;IAC1B,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,KAAK,EAAE,aAAa,GAAG,IAAI,CAAA;KAAE,CAAC,CAAA;IACrF,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,KAAK,EAAE,aAAa,GAAG,IAAI,CAAA;KAAE,CAAC,CAAA;IACrF,OAAO,EAAE,MAAM,OAAO,CAAC;QAAE,KAAK,EAAE,aAAa,GAAG,IAAI,CAAA;KAAE,CAAC,CAAA;IACvD,eAAe,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,KAAK,EAAE,aAAa,GAAG,IAAI,CAAA;KAAE,CAAC,CAAA;IAC/E,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,KAAK,EAAE,aAAa,GAAG,IAAI,CAAA;KAAE,CAAC,CAAA;CAC3E;AAED,wBAAgB,UAAU,CAAC,SAAS,SAAS,WAAW,GAAG,WAAW,KAAK,UAAU,CAyDpF"}
@@ -0,0 +1,52 @@
1
+ import { createSignal, onMount, onCleanup } from "solid-js";
2
+ import { useSupatype } from "./context.js";
3
+ export function createAuth() {
4
+ const client = useSupatype();
5
+ const [user, setUser] = createSignal(null);
6
+ const [session, setSession] = createSignal(null);
7
+ const [loading, setLoading] = createSignal(true);
8
+ let unsubscribe = null;
9
+ onMount(async () => {
10
+ try {
11
+ const { data } = await client.auth.getSession();
12
+ if (data.session) {
13
+ setSession(() => data.session);
14
+ setUser(() => data.session.user);
15
+ }
16
+ }
17
+ catch {
18
+ // Ignore — user is not authenticated
19
+ }
20
+ setLoading(false);
21
+ const { data: { subscription } } = client.auth.onAuthStateChange((_event, newSession) => {
22
+ setSession(() => newSession);
23
+ setUser(() => newSession?.user ?? null);
24
+ });
25
+ unsubscribe = () => subscription.unsubscribe();
26
+ });
27
+ onCleanup(() => {
28
+ unsubscribe?.();
29
+ });
30
+ const signIn = async (email, password) => {
31
+ const { error } = await client.auth.signInWithPassword({ email, password });
32
+ return { error };
33
+ };
34
+ const signUp = async (email, password) => {
35
+ const { error } = await client.auth.signUp({ email, password });
36
+ return { error };
37
+ };
38
+ const signOut = async () => {
39
+ const { error } = await client.auth.signOut();
40
+ return { error };
41
+ };
42
+ const signInWithOAuth = async (provider) => {
43
+ const { error } = await client.auth.signInWithOAuth({ provider });
44
+ return { error };
45
+ };
46
+ const resetPassword = async (email) => {
47
+ const { error } = await client.auth.resetPasswordForEmail(email);
48
+ return { error };
49
+ };
50
+ return { user, session, loading, signIn, signUp, signOut, signInWithOAuth, resetPassword };
51
+ }
52
+ //# sourceMappingURL=createAuth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createAuth.js","sourceRoot":"","sources":["../src/createAuth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAG3D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAa1C,MAAM,UAAU,UAAU;IACxB,MAAM,MAAM,GAAG,WAAW,EAAa,CAAA;IACvC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,YAAY,CAAc,IAAI,CAAC,CAAA;IACvD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,YAAY,CAAiB,IAAI,CAAC,CAAA;IAChE,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,YAAY,CAAC,IAAI,CAAC,CAAA;IAEhD,IAAI,WAAW,GAAwB,IAAI,CAAA;IAE3C,OAAO,CAAC,KAAK,IAAI,EAAE;QACjB,IAAI,CAAC;YACH,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,CAAA;YAC/C,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;gBACjB,UAAU,CAAC,GAAG,EAAE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AAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAA;QAC7C,OAAO,EAAE,KAAK,EAAE,CAAA;IAClB,CAAC,CAAA;IAED,MAAM,eAAe,GAAG,KAAK,EAAE,QAAgB,EAAE,EAAE;QACjD,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAA;QACjE,OAAO,EAAE,KAAK,EAAE,CAAA;IAClB,CAAC,CAAA;IAED,MAAM,aAAa,GAAG,KAAK,EAAE,KAAa,EAAE,EAAE;QAC5C,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAA;QAChE,OAAO,EAAE,KAAK,EAAE,CAAA;IAClB,CAAC,CAAA;IAED,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,CAAA;AAC5F,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { Accessor } from "solid-js";
2
+ import type { AnyDatabase, SupatypeError } from "@supatype/client";
3
+ export interface FunctionResult<TResponse> {
4
+ invoke: (body?: unknown) => Promise<{
5
+ data: TResponse | null;
6
+ error: SupatypeError | null;
7
+ }>;
8
+ data: Accessor<TResponse | null>;
9
+ error: Accessor<SupatypeError | null>;
10
+ loading: Accessor<boolean>;
11
+ }
12
+ export declare function createFunction<TResponse = unknown, TDatabase extends AnyDatabase = AnyDatabase>(functionName: string): FunctionResult<TResponse>;
13
+ //# sourceMappingURL=createFunction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createFunction.d.ts","sourceRoot":"","sources":["../src/createFunction.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAGlE,MAAM,WAAW,cAAc,CAAC,SAAS;IACvC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,SAAS,GAAG,IAAI,CAAC;QAAC,KAAK,EAAE,aAAa,GAAG,IAAI,CAAA;KAAE,CAAC,CAAA;IAC5F,IAAI,EAAE,QAAQ,CAAC,SAAS,GAAG,IAAI,CAAC,CAAA;IAChC,KAAK,EAAE,QAAQ,CAAC,aAAa,GAAG,IAAI,CAAC,CAAA;IACrC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAA;CAC3B;AAED,wBAAgB,cAAc,CAC5B,SAAS,GAAG,OAAO,EACnB,SAAS,SAAS,WAAW,GAAG,WAAW,EAE3C,YAAY,EAAE,MAAM,GACnB,cAAc,CAAC,SAAS,CAAC,CAqB3B"}
@@ -0,0 +1,22 @@
1
+ import { createSignal } from "solid-js";
2
+ import { useSupatype } from "./context.js";
3
+ export function createFunction(functionName) {
4
+ const client = useSupatype();
5
+ const [data, setData] = createSignal(null);
6
+ const [error, setError] = createSignal(null);
7
+ const [loading, setLoading] = createSignal(false);
8
+ const invoke = async (body) => {
9
+ setLoading(true);
10
+ setError(null);
11
+ const result = await client.functions.invoke(functionName, {
12
+ ...(body !== undefined ? { body } : {}),
13
+ });
14
+ setLoading(false);
15
+ setData(() => result.data);
16
+ if (result.error)
17
+ setError(result.error);
18
+ return result;
19
+ };
20
+ return { invoke, data, error, loading };
21
+ }
22
+ //# sourceMappingURL=createFunction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createFunction.js","sourceRoot":"","sources":["../src/createFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAGvC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAS1C,MAAM,UAAU,cAAc,CAI5B,YAAoB;IAEpB,MAAM,MAAM,GAAG,WAAW,EAAa,CAAA;IACvC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,YAAY,CAAmB,IAAI,CAAC,CAAA;IAC5D,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,YAAY,CAAuB,IAAI,CAAC,CAAA;IAClE,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC,CAAA;IAEjD,MAAM,MAAM,GAAG,KAAK,EAAE,IAAc,EAAE,EAAE;QACtC,UAAU,CAAC,IAAI,CAAC,CAAA;QAChB,QAAQ,CAAC,IAAI,CAAC,CAAA;QAEd,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,YAAY,EAAE;YACzD,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACxC,CAAC,CAAA;QAEF,UAAU,CAAC,KAAK,CAAC,CAAA;QACjB,OAAO,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAwB,CAAC,CAAA;QAC9C,IAAI,MAAM,CAAC,KAAK;YAAE,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QACxC,OAAO,MAAiE,CAAA;IAC1E,CAAC,CAAA;IAED,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,CAAA;AACzC,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { Accessor } from "solid-js";
2
+ import type { AnyDatabase, SupatypeError } from "@supatype/client";
3
+ export type MutationOperation = "insert" | "update" | "delete" | "upsert";
4
+ export interface MutationOptions {
5
+ filter?: Record<string, unknown> | undefined;
6
+ }
7
+ export interface MutationResult<TRow> {
8
+ mutate: (data?: Record<string, unknown> | Record<string, unknown>[] | undefined, options?: MutationOptions | undefined) => Promise<{
9
+ data: TRow[] | null;
10
+ error: SupatypeError | null;
11
+ }>;
12
+ loading: Accessor<boolean>;
13
+ error: Accessor<SupatypeError | null>;
14
+ }
15
+ export declare function createMutation<TDatabase extends AnyDatabase = AnyDatabase, TTable extends keyof TDatabase["public"]["Tables"] & string = keyof TDatabase["public"]["Tables"] & string, TRow = TDatabase["public"]["Tables"][TTable]["Row"]>(table: TTable, operation: MutationOperation): MutationResult<TRow>;
16
+ //# sourceMappingURL=createMutation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createMutation.d.ts","sourceRoot":"","sources":["../src/createMutation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAGlE,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAEzE,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAA;CAC7C;AAED,MAAM,WAAW,cAAc,CAAC,IAAI;IAClC,MAAM,EAAE,CACN,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,SAAS,EACtE,OAAO,CAAC,EAAE,eAAe,GAAG,SAAS,KAClC,OAAO,CAAC;QAAE,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;QAAC,KAAK,EAAE,aAAa,GAAG,IAAI,CAAA;KAAE,CAAC,CAAA;IAClE,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAA;IAC1B,KAAK,EAAE,QAAQ,CAAC,aAAa,GAAG,IAAI,CAAC,CAAA;CACtC;AAED,wBAAgB,cAAc,CAC5B,SAAS,SAAS,WAAW,GAAG,WAAW,EAC3C,MAAM,SAAS,MAAM,SAAS,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,GAAG,MAAM,GAAG,MAAM,SAAS,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,GAAG,MAAM,EAC1G,IAAI,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,EAEnD,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,iBAAiB,GAC3B,cAAc,CAAC,IAAI,CAAC,CAmDtB"}
@@ -0,0 +1,53 @@
1
+ import { createSignal } from "solid-js";
2
+ import { useSupatype } from "./context.js";
3
+ export function createMutation(table, operation) {
4
+ const client = useSupatype();
5
+ const [loading, setLoading] = createSignal(false);
6
+ const [error, setError] = createSignal(null);
7
+ const mutate = async (data, options) => {
8
+ setLoading(true);
9
+ setError(null);
10
+ try {
11
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
12
+ const tableClient = client.from(table);
13
+ let result;
14
+ if (operation === "insert") {
15
+ result = await tableClient.insert(data);
16
+ }
17
+ else if (operation === "upsert") {
18
+ result = await tableClient.upsert(data);
19
+ }
20
+ else if (operation === "update") {
21
+ let q = tableClient.update(data);
22
+ if (options?.filter) {
23
+ for (const [col, val] of Object.entries(options.filter)) {
24
+ q = q.eq(col, val);
25
+ }
26
+ }
27
+ result = await q;
28
+ }
29
+ else {
30
+ let q = tableClient.delete();
31
+ if (options?.filter) {
32
+ for (const [col, val] of Object.entries(options.filter)) {
33
+ q = q.eq(col, val);
34
+ }
35
+ }
36
+ result = await q;
37
+ }
38
+ if (result.error)
39
+ setError(result.error);
40
+ return result;
41
+ }
42
+ catch (e) {
43
+ const err = { message: e instanceof Error ? e.message : "Unknown error" };
44
+ setError(err);
45
+ return { data: null, error: err };
46
+ }
47
+ finally {
48
+ setLoading(false);
49
+ }
50
+ };
51
+ return { mutate, loading, error };
52
+ }
53
+ //# sourceMappingURL=createMutation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createMutation.js","sourceRoot":"","sources":["../src/createMutation.ts"],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CAAC;gBACH,CAAC;gBACD,MAAM,GAAG,MAAM,CAAC,CAAA;YAClB,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAA;gBAC5B,IAAI,OAAO,EAAE,MAAM,EAAE,CAAC;oBACpB,KAAK,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;wBACxD,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;oBACpB,CAAC;gBACH,CAAC;gBACD,MAAM,GAAG,MAAM,CAAC,CAAA;YAClB,CAAC;YAED,IAAI,MAAM,CAAC,KAAK;gBAAE,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;YACxC,OAAO,MAAM,CAAA;QACf,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,GAAG,GAAG,EAAE,OAAO,EAAE,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,CAAA;YACzE,QAAQ,CAAC,GAAG,CAAC,CAAA;YACb,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,CAAA;QACnC,CAAC;gBAAS,CAAC;YACT,UAAU,CAAC,KAAK,CAAC,CAAA;QACnB,CAAC;IACH,CAAC,CAAA;IAED,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,CAAA;AACnC,CAAC"}
@@ -0,0 +1,21 @@
1
+ import type { Accessor } from "solid-js";
2
+ import type { AnyDatabase, SupatypeError } from "@supatype/client";
3
+ export interface QueryOptions {
4
+ columns?: string | undefined;
5
+ filter?: Record<string, unknown> | undefined;
6
+ order?: {
7
+ column: string;
8
+ ascending?: boolean;
9
+ } | undefined;
10
+ limit?: number | undefined;
11
+ offset?: number | undefined;
12
+ enabled?: boolean | undefined;
13
+ }
14
+ export interface QueryResult<TRow> {
15
+ data: Accessor<TRow[] | null>;
16
+ error: Accessor<SupatypeError | null>;
17
+ loading: Accessor<boolean>;
18
+ refetch: () => Promise<void>;
19
+ }
20
+ export declare function createQuery<TDatabase extends AnyDatabase = AnyDatabase, TTable extends keyof TDatabase["public"]["Tables"] & string = keyof TDatabase["public"]["Tables"] & string, TRow = TDatabase["public"]["Tables"][TTable]["Row"]>(table: TTable, options?: QueryOptions | undefined): QueryResult<TRow>;
21
+ //# sourceMappingURL=createQuery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createQuery.d.ts","sourceRoot":"","sources":["../src/createQuery.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAGlE,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAA;IAC5C,KAAK,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,SAAS,CAAA;IAC3D,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAC9B;AAED,MAAM,WAAW,WAAW,CAAC,IAAI;IAC/B,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAAA;IAC7B,KAAK,EAAE,QAAQ,CAAC,aAAa,GAAG,IAAI,CAAC,CAAA;IACrC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAA;IAC1B,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAC7B;AAED,wBAAgB,WAAW,CACzB,SAAS,SAAS,WAAW,GAAG,WAAW,EAC3C,MAAM,SAAS,MAAM,SAAS,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,GAAG,MAAM,GAAG,MAAM,SAAS,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,GAAG,MAAM,EAC1G,IAAI,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,EAEnD,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,YAAY,GAAG,SAAS,GACjC,WAAW,CAAC,IAAI,CAAC,CAqDnB"}
@@ -0,0 +1,50 @@
1
+ import { createSignal, onMount } from "solid-js";
2
+ import { useSupatype } from "./context.js";
3
+ export function createQuery(table, options) {
4
+ const client = useSupatype();
5
+ const [data, setData] = createSignal(null);
6
+ const [error, setError] = createSignal(null);
7
+ const [loading, setLoading] = createSignal(false);
8
+ const fetchData = async () => {
9
+ if (options?.enabled === false)
10
+ return;
11
+ setLoading(true);
12
+ setError(null);
13
+ try {
14
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
+ let query = client.from(table).select(options?.columns);
16
+ if (options?.filter) {
17
+ for (const [col, val] of Object.entries(options.filter)) {
18
+ query = query.eq(col, val);
19
+ }
20
+ }
21
+ if (options?.order) {
22
+ query = query.order(options.order.column, {
23
+ ascending: options.order.ascending ?? true,
24
+ });
25
+ }
26
+ if (options?.limit !== undefined) {
27
+ query = query.limit(options.limit);
28
+ }
29
+ if (options?.offset !== undefined) {
30
+ query = query.range(options.offset, options.offset + (options.limit ?? 100) - 1);
31
+ }
32
+ const result = await query;
33
+ setData(() => result.data);
34
+ if (result.error) {
35
+ setError(result.error);
36
+ }
37
+ }
38
+ catch (e) {
39
+ setError({ message: e instanceof Error ? e.message : "Unknown error" });
40
+ }
41
+ finally {
42
+ setLoading(false);
43
+ }
44
+ };
45
+ onMount(() => {
46
+ fetchData();
47
+ });
48
+ return { data, error, loading, refetch: fetchData };
49
+ }
50
+ //# sourceMappingURL=createQuery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createQuery.js","sourceRoot":"","sources":["../src/createQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAGhD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAkB1C,MAAM,UAAU,WAAW,CAKzB,KAAa,EACb,OAAkC;IAElC,MAAM,MAAM,GAAG,WAAW,EAAa,CAAA;IACvC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,YAAY,CAAgB,IAAI,CAAC,CAAA;IACzD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,YAAY,CAAuB,IAAI,CAAC,CAAA;IAClE,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC,CAAA;IAEjD,MAAM,SAAS,GAAG,KAAK,IAAI,EAAE;QAC3B,IAAI,OAAO,EAAE,OAAO,KAAK,KAAK;YAAE,OAAM;QAEtC,UAAU,CAAC,IAAI,CAAC,CAAA;QAChB,QAAQ,CAAC,IAAI,CAAC,CAAA;QAEd,IAAI,CAAC;YACH,8DAA8D;YAC9D,IAAI,KAAK,GAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAS,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;YAEhE,IAAI,OAAO,EAAE,MAAM,EAAE,CAAC;gBACpB,KAAK,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;oBACxD,KAAK,GAAG,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;gBAC5B,CAAC;YACH,CAAC;YAED,IAAI,OAAO,EAAE,KAAK,EAAE,CAAC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+ import type { AnyDatabase, SupatypeError, RealtimeEvent } from "@supatype/client";
3
+ export interface SubscriptionOptions {
4
+ event?: RealtimeEvent | undefined;
5
+ filter?: string | undefined;
6
+ }
7
+ export interface SubscriptionResult<TRow> {
8
+ data: Accessor<TRow[] | null>;
9
+ error: Accessor<SupatypeError | null>;
10
+ status: Accessor<"connecting" | "connected" | "disconnected" | "error">;
11
+ }
12
+ export declare function createSubscription<TDatabase extends AnyDatabase = AnyDatabase, TTable extends keyof TDatabase["public"]["Tables"] & string = keyof TDatabase["public"]["Tables"] & string, TRow = TDatabase["public"]["Tables"][TTable]["Row"]>(table: TTable, options?: SubscriptionOptions | undefined): SubscriptionResult<TRow>;
13
+ //# sourceMappingURL=createSubscription.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createSubscription.d.ts","sourceRoot":"","sources":["../src/createSubscription.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAmB,aAAa,EAAiB,MAAM,kBAAkB,CAAA;AAGjH,MAAM,WAAW,mBAAmB;IAClC,KAAK,CAAC,EAAE,aAAa,GAAG,SAAS,CAAA;IACjC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC5B;AAED,MAAM,WAAW,kBAAkB,CAAC,IAAI;IACtC,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAAA;IAC7B,KAAK,EAAE,QAAQ,CAAC,aAAa,GAAG,IAAI,CAAC,CAAA;IACrC,MAAM,EAAE,QAAQ,CAAC,YAAY,GAAG,WAAW,GAAG,cAAc,GAAG,OAAO,CAAC,CAAA;CACxE;AAED,wBAAgB,kBAAkB,CAChC,SAAS,SAAS,WAAW,GAAG,WAAW,EAC3C,MAAM,SAAS,MAAM,SAAS,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,GAAG,MAAM,GAAG,MAAM,SAAS,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,GAAG,MAAM,EAC1G,IAAI,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,EAEnD,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,mBAAmB,GAAG,SAAS,GACxC,kBAAkB,CAAC,IAAI,CAAC,CA+D1B"}
@@ -0,0 +1,58 @@
1
+ import { createSignal, onMount, onCleanup } from "solid-js";
2
+ import { useSupatype } from "./context.js";
3
+ export function createSubscription(table, options) {
4
+ const client = useSupatype();
5
+ const [data, setData] = createSignal(null);
6
+ const [error, setError] = createSignal(null);
7
+ const [status, setStatus] = createSignal("connecting");
8
+ let channel = null;
9
+ onMount(() => {
10
+ const event = options?.event ?? "*";
11
+ const channelOpts = {
12
+ event,
13
+ schema: "public",
14
+ table,
15
+ };
16
+ if (options?.filter) {
17
+ channelOpts.filter = options.filter;
18
+ }
19
+ channel = client.realtime.channel(`public:${table}`);
20
+ channel.on("postgres_changes", channelOpts, (payload) => {
21
+ setData((current) => {
22
+ const rows = current ?? [];
23
+ if (payload.eventType === "INSERT") {
24
+ return [...rows, payload.new];
25
+ }
26
+ else if (payload.eventType === "UPDATE") {
27
+ return rows.map((row) => {
28
+ const r = row;
29
+ const n = payload.new;
30
+ return r["id"] === n["id"] ? payload.new : row;
31
+ });
32
+ }
33
+ else if (payload.eventType === "DELETE") {
34
+ const old = payload.old;
35
+ return rows.filter((row) => row["id"] !== old["id"]);
36
+ }
37
+ return rows;
38
+ });
39
+ });
40
+ channel.subscribe((newStatus) => {
41
+ if (newStatus === "SUBSCRIBED") {
42
+ setStatus("connected");
43
+ }
44
+ else if (newStatus === "CHANNEL_ERROR") {
45
+ setStatus("error");
46
+ setError({ message: "Subscription error" });
47
+ }
48
+ else if (newStatus === "CLOSED") {
49
+ setStatus("disconnected");
50
+ }
51
+ });
52
+ });
53
+ onCleanup(() => {
54
+ channel?.unsubscribe();
55
+ });
56
+ return { data, error, status };
57
+ }
58
+ //# sourceMappingURL=createSubscription.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createSubscription.js","sourceRoot":"","sources":["../src/createSubscription.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAG3D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAa1C,MAAM,UAAU,kBAAkB,CAKhC,KAAa,EACb,OAAyC;IAEzC,MAAM,MAAM,GAAG,WAAW,EAAa,CAAA;IACvC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,YAAY,CAAgB,IAAI,CAAC,CAAA;IACzD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,YAAY,CAAuB,IAAI,CAAC,CAAA;IAClE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,YAAY,CAAwD,YAAY,CAAC,CAAA;IAE7G,IAAI,OAAO,GAA4D,IAAI,CAAA;IAE3E,OAAO,CAAC,GAAG,EAAE;QACX,MAAM,KAAK,GAAmB,OAAO,EAAE,KAAuB,IAAI,GAAG,CAAA;QACrE,MAAM,WAAW,GAKb;YACF,KAAK;YACL,MAAM,EAAE,QAAQ;YAChB,KAAK;SACN,CAAA;QACD,IAAI,OAAO,EAAE,MAAM,EAAE,CAAC;YACpB,WAAW,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA;QACrC,CAAC;QAED,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAO,UAAU,KAAK,EAAE,CAAC,CAAA;QAE1D,OAAO,CAAC,EAAE,CAAC,kBAAkB,EAAE,WAAW,EAAE,CAAC,OAA8B,EAAE,EAAE;YAC7E,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;gBAClB,MAAM,IAAI,GAAG,OAAO,IAAI,EAAE,CAAA;gBAE1B,IAAI,OAAO,CAAC,SAAS,KAAK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AA;IACJ,CAAC,CAAC,CAAA;IAEF,SAAS,CAAC,GAAG,EAAE;QACb,OAAO,EAAE,WAAW,EAAE,CAAA;IACxB,CAAC,CAAC,CAAA;IAEF,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,CAAA;AAChC,CAAC"}
@@ -0,0 +1,12 @@
1
+ export { SupatypeContext, useSupatype } from "./context.js";
2
+ export { createQuery } from "./createQuery.js";
3
+ export type { QueryOptions, QueryResult } from "./createQuery.js";
4
+ export { createMutation } from "./createMutation.js";
5
+ export type { MutationResult, MutationOperation, MutationOptions } from "./createMutation.js";
6
+ export { createAuth } from "./createAuth.js";
7
+ export type { AuthResult } from "./createAuth.js";
8
+ export { createSubscription } from "./createSubscription.js";
9
+ export type { SubscriptionOptions, SubscriptionResult } from "./createSubscription.js";
10
+ export { createFunction } from "./createFunction.js";
11
+ export type { FunctionResult } from "./createFunction.js";
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE3D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAEjE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,YAAY,EAAE,cAAc,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAE7F,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAC5D,YAAY,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAEtF,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,YAAY,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,8 @@
1
+ // @supatype/solid — Solid.js primitives for Supatype
2
+ export { SupatypeContext, useSupatype } from "./context.js";
3
+ export { createQuery } from "./createQuery.js";
4
+ export { createMutation } from "./createMutation.js";
5
+ export { createAuth } from "./createAuth.js";
6
+ export { createSubscription } from "./createSubscription.js";
7
+ export { createFunction } from "./createFunction.js";
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qDAAqD;AAErD,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE3D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAG9C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAGpD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAG5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAG5D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA"}
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "@supatype/solid",
3
+ "version": "0.1.0-alpha.9",
4
+ "description": "Solid.js primitives for Supatype — createQuery, createMutation, createAuth, createSubscription",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.js",
11
+ "types": "./dist/index.d.ts"
12
+ }
13
+ },
14
+ "peerDependencies": {
15
+ "solid-js": "^1.8.0",
16
+ "@supatype/client": "0.1.0-alpha.9"
17
+ },
18
+ "devDependencies": {
19
+ "typescript": "^5",
20
+ "solid-js": "^1.9.0",
21
+ "@supatype/client": "0.1.0-alpha.9"
22
+ },
23
+ "scripts": {
24
+ "build": "tsc --project tsconfig.json",
25
+ "typecheck": "tsc --project tsconfig.json --noEmit",
26
+ "clean": "rm -rf dist *.tsbuildinfo"
27
+ }
28
+ }
package/src/context.ts ADDED
@@ -0,0 +1,12 @@
1
+ import { createContext, useContext } from "solid-js"
2
+ import type { SupatypeClient, AnyDatabase } from "@supatype/client"
3
+
4
+ export const SupatypeContext = createContext<SupatypeClient>()
5
+
6
+ export function useSupatype<TDatabase extends AnyDatabase = AnyDatabase>(): SupatypeClient<TDatabase> {
7
+ const client = useContext(SupatypeContext)
8
+ if (!client) {
9
+ throw new Error("useSupatype() requires a <SupatypeContext.Provider> ancestor.")
10
+ }
11
+ return client as SupatypeClient<TDatabase>
12
+ }
@@ -0,0 +1,74 @@
1
+ import { createSignal, onMount, onCleanup } from "solid-js"
2
+ import type { Accessor } from "solid-js"
3
+ import type { AnyDatabase, SupatypeError, User, Session, AuthChangeEvent } from "@supatype/client"
4
+ import { useSupatype } from "./context.js"
5
+
6
+ export interface AuthResult {
7
+ user: Accessor<User | null>
8
+ session: Accessor<Session | null>
9
+ loading: Accessor<boolean>
10
+ signIn: (email: string, password: string) => Promise<{ error: SupatypeError | null }>
11
+ signUp: (email: string, password: string) => Promise<{ error: SupatypeError | null }>
12
+ signOut: () => Promise<{ error: SupatypeError | null }>
13
+ signInWithOAuth: (provider: string) => Promise<{ error: SupatypeError | null }>
14
+ resetPassword: (email: string) => Promise<{ error: SupatypeError | null }>
15
+ }
16
+
17
+ export function createAuth<TDatabase extends AnyDatabase = AnyDatabase>(): AuthResult {
18
+ const client = useSupatype<TDatabase>()
19
+ const [user, setUser] = createSignal<User | null>(null)
20
+ const [session, setSession] = createSignal<Session | null>(null)
21
+ const [loading, setLoading] = createSignal(true)
22
+
23
+ let unsubscribe: (() => void) | null = null
24
+
25
+ onMount(async () => {
26
+ try {
27
+ const { data } = await client.auth.getSession()
28
+ if (data.session) {
29
+ setSession(() => data.session)
30
+ setUser(() => data.session!.user)
31
+ }
32
+ } catch {
33
+ // Ignore — user is not authenticated
34
+ }
35
+ setLoading(false)
36
+
37
+ const { data: { subscription } } = client.auth.onAuthStateChange((_event: AuthChangeEvent, newSession: Session | null) => {
38
+ setSession(() => newSession)
39
+ setUser(() => newSession?.user ?? null)
40
+ })
41
+ unsubscribe = () => subscription.unsubscribe()
42
+ })
43
+
44
+ onCleanup(() => {
45
+ unsubscribe?.()
46
+ })
47
+
48
+ const signIn = async (email: string, password: string) => {
49
+ const { error } = await client.auth.signInWithPassword({ email, password })
50
+ return { error }
51
+ }
52
+
53
+ const signUp = async (email: string, password: string) => {
54
+ const { error } = await client.auth.signUp({ email, password })
55
+ return { error }
56
+ }
57
+
58
+ const signOut = async () => {
59
+ const { error } = await client.auth.signOut()
60
+ return { error }
61
+ }
62
+
63
+ const signInWithOAuth = async (provider: string) => {
64
+ const { error } = await client.auth.signInWithOAuth({ provider })
65
+ return { error }
66
+ }
67
+
68
+ const resetPassword = async (email: string) => {
69
+ const { error } = await client.auth.resetPasswordForEmail(email)
70
+ return { error }
71
+ }
72
+
73
+ return { user, session, loading, signIn, signUp, signOut, signInWithOAuth, resetPassword }
74
+ }
@@ -0,0 +1,39 @@
1
+ import { createSignal } from "solid-js"
2
+ import type { Accessor } from "solid-js"
3
+ import type { AnyDatabase, SupatypeError } from "@supatype/client"
4
+ import { useSupatype } from "./context.js"
5
+
6
+ export interface FunctionResult<TResponse> {
7
+ invoke: (body?: unknown) => Promise<{ data: TResponse | null; error: SupatypeError | null }>
8
+ data: Accessor<TResponse | null>
9
+ error: Accessor<SupatypeError | null>
10
+ loading: Accessor<boolean>
11
+ }
12
+
13
+ export function createFunction<
14
+ TResponse = unknown,
15
+ TDatabase extends AnyDatabase = AnyDatabase,
16
+ >(
17
+ functionName: string,
18
+ ): FunctionResult<TResponse> {
19
+ const client = useSupatype<TDatabase>()
20
+ const [data, setData] = createSignal<TResponse | null>(null)
21
+ const [error, setError] = createSignal<SupatypeError | null>(null)
22
+ const [loading, setLoading] = createSignal(false)
23
+
24
+ const invoke = async (body?: unknown) => {
25
+ setLoading(true)
26
+ setError(null)
27
+
28
+ const result = await client.functions.invoke(functionName, {
29
+ ...(body !== undefined ? { body } : {}),
30
+ })
31
+
32
+ setLoading(false)
33
+ setData(() => result.data as TResponse | null)
34
+ if (result.error) setError(result.error)
35
+ return result as { data: TResponse | null; error: SupatypeError | null }
36
+ }
37
+
38
+ return { invoke, data, error, loading }
39
+ }
@@ -0,0 +1,79 @@
1
+ import { createSignal } from "solid-js"
2
+ import type { Accessor } from "solid-js"
3
+ import type { AnyDatabase, SupatypeError } from "@supatype/client"
4
+ import { useSupatype } from "./context.js"
5
+
6
+ export type MutationOperation = "insert" | "update" | "delete" | "upsert"
7
+
8
+ export interface MutationOptions {
9
+ filter?: Record<string, unknown> | undefined
10
+ }
11
+
12
+ export interface MutationResult<TRow> {
13
+ mutate: (
14
+ data?: Record<string, unknown> | Record<string, unknown>[] | undefined,
15
+ options?: MutationOptions | undefined,
16
+ ) => Promise<{ data: TRow[] | null; error: SupatypeError | null }>
17
+ loading: Accessor<boolean>
18
+ error: Accessor<SupatypeError | null>
19
+ }
20
+
21
+ export function createMutation<
22
+ TDatabase extends AnyDatabase = AnyDatabase,
23
+ TTable extends keyof TDatabase["public"]["Tables"] & string = keyof TDatabase["public"]["Tables"] & string,
24
+ TRow = TDatabase["public"]["Tables"][TTable]["Row"],
25
+ >(
26
+ table: TTable,
27
+ operation: MutationOperation,
28
+ ): MutationResult<TRow> {
29
+ const client = useSupatype<TDatabase>()
30
+ const [loading, setLoading] = createSignal(false)
31
+ const [error, setError] = createSignal<SupatypeError | null>(null)
32
+
33
+ const mutate = async (
34
+ data?: Record<string, unknown> | Record<string, unknown>[] | undefined,
35
+ options?: MutationOptions | undefined,
36
+ ) => {
37
+ setLoading(true)
38
+ setError(null)
39
+
40
+ try {
41
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
42
+ const tableClient = client.from(table) as any
43
+ let result: { data: TRow[] | null; error: SupatypeError | null }
44
+
45
+ if (operation === "insert") {
46
+ result = await tableClient.insert(data)
47
+ } else if (operation === "upsert") {
48
+ result = await tableClient.upsert(data)
49
+ } else if (operation === "update") {
50
+ let q = tableClient.update(data)
51
+ if (options?.filter) {
52
+ for (const [col, val] of Object.entries(options.filter)) {
53
+ q = q.eq(col, val)
54
+ }
55
+ }
56
+ result = await q
57
+ } else {
58
+ let q = tableClient.delete()
59
+ if (options?.filter) {
60
+ for (const [col, val] of Object.entries(options.filter)) {
61
+ q = q.eq(col, val)
62
+ }
63
+ }
64
+ result = await q
65
+ }
66
+
67
+ if (result.error) setError(result.error)
68
+ return result
69
+ } catch (e) {
70
+ const err = { message: e instanceof Error ? e.message : "Unknown error" }
71
+ setError(err)
72
+ return { data: null, error: err }
73
+ } finally {
74
+ setLoading(false)
75
+ }
76
+ }
77
+
78
+ return { mutate, loading, error }
79
+ }
@@ -0,0 +1,82 @@
1
+ import { createSignal, onMount } from "solid-js"
2
+ import type { Accessor } from "solid-js"
3
+ import type { AnyDatabase, SupatypeError } from "@supatype/client"
4
+ import { useSupatype } from "./context.js"
5
+
6
+ export interface QueryOptions {
7
+ columns?: string | undefined
8
+ filter?: Record<string, unknown> | undefined
9
+ order?: { column: string; ascending?: boolean } | undefined
10
+ limit?: number | undefined
11
+ offset?: number | undefined
12
+ enabled?: boolean | undefined
13
+ }
14
+
15
+ export interface QueryResult<TRow> {
16
+ data: Accessor<TRow[] | null>
17
+ error: Accessor<SupatypeError | null>
18
+ loading: Accessor<boolean>
19
+ refetch: () => Promise<void>
20
+ }
21
+
22
+ export function createQuery<
23
+ TDatabase extends AnyDatabase = AnyDatabase,
24
+ TTable extends keyof TDatabase["public"]["Tables"] & string = keyof TDatabase["public"]["Tables"] & string,
25
+ TRow = TDatabase["public"]["Tables"][TTable]["Row"],
26
+ >(
27
+ table: TTable,
28
+ options?: QueryOptions | undefined,
29
+ ): QueryResult<TRow> {
30
+ const client = useSupatype<TDatabase>()
31
+ const [data, setData] = createSignal<TRow[] | null>(null)
32
+ const [error, setError] = createSignal<SupatypeError | null>(null)
33
+ const [loading, setLoading] = createSignal(false)
34
+
35
+ const fetchData = async () => {
36
+ if (options?.enabled === false) return
37
+
38
+ setLoading(true)
39
+ setError(null)
40
+
41
+ try {
42
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
43
+ let query = (client.from(table) as any).select(options?.columns)
44
+
45
+ if (options?.filter) {
46
+ for (const [col, val] of Object.entries(options.filter)) {
47
+ query = query.eq(col, val)
48
+ }
49
+ }
50
+
51
+ if (options?.order) {
52
+ query = query.order(options.order.column, {
53
+ ascending: options.order.ascending ?? true,
54
+ })
55
+ }
56
+
57
+ if (options?.limit !== undefined) {
58
+ query = query.limit(options.limit)
59
+ }
60
+
61
+ if (options?.offset !== undefined) {
62
+ query = query.range(options.offset, options.offset + (options.limit ?? 100) - 1)
63
+ }
64
+
65
+ const result = await query
66
+ setData(() => result.data as TRow[] | null)
67
+ if (result.error) {
68
+ setError(result.error)
69
+ }
70
+ } catch (e) {
71
+ setError({ message: e instanceof Error ? e.message : "Unknown error" })
72
+ } finally {
73
+ setLoading(false)
74
+ }
75
+ }
76
+
77
+ onMount(() => {
78
+ fetchData()
79
+ })
80
+
81
+ return { data, error, loading, refetch: fetchData }
82
+ }
@@ -0,0 +1,87 @@
1
+ import { createSignal, onMount, onCleanup } from "solid-js"
2
+ import type { Accessor } from "solid-js"
3
+ import type { AnyDatabase, SupatypeError, RealtimePayload, RealtimeEvent, ChannelStatus } from "@supatype/client"
4
+ import { useSupatype } from "./context.js"
5
+
6
+ export interface SubscriptionOptions {
7
+ event?: RealtimeEvent | undefined
8
+ filter?: string | undefined
9
+ }
10
+
11
+ export interface SubscriptionResult<TRow> {
12
+ data: Accessor<TRow[] | null>
13
+ error: Accessor<SupatypeError | null>
14
+ status: Accessor<"connecting" | "connected" | "disconnected" | "error">
15
+ }
16
+
17
+ export function createSubscription<
18
+ TDatabase extends AnyDatabase = AnyDatabase,
19
+ TTable extends keyof TDatabase["public"]["Tables"] & string = keyof TDatabase["public"]["Tables"] & string,
20
+ TRow = TDatabase["public"]["Tables"][TTable]["Row"],
21
+ >(
22
+ table: TTable,
23
+ options?: SubscriptionOptions | undefined,
24
+ ): SubscriptionResult<TRow> {
25
+ const client = useSupatype<TDatabase>()
26
+ const [data, setData] = createSignal<TRow[] | null>(null)
27
+ const [error, setError] = createSignal<SupatypeError | null>(null)
28
+ const [status, setStatus] = createSignal<"connecting" | "connected" | "disconnected" | "error">("connecting")
29
+
30
+ let channel: ReturnType<typeof client.realtime.channel<TRow>> | null = null
31
+
32
+ onMount(() => {
33
+ const event: RealtimeEvent = (options?.event as RealtimeEvent) ?? "*"
34
+ const channelOpts: {
35
+ event: RealtimeEvent
36
+ schema: string
37
+ table: string
38
+ filter?: string | undefined
39
+ } = {
40
+ event,
41
+ schema: "public",
42
+ table,
43
+ }
44
+ if (options?.filter) {
45
+ channelOpts.filter = options.filter
46
+ }
47
+
48
+ channel = client.realtime.channel<TRow>(`public:${table}`)
49
+
50
+ channel.on("postgres_changes", channelOpts, (payload: RealtimePayload<TRow>) => {
51
+ setData((current) => {
52
+ const rows = current ?? []
53
+
54
+ if (payload.eventType === "INSERT") {
55
+ return [...rows, payload.new as TRow]
56
+ } else if (payload.eventType === "UPDATE") {
57
+ return rows.map((row) => {
58
+ const r = row as Record<string, unknown>
59
+ const n = payload.new as Record<string, unknown>
60
+ return r["id"] === n["id"] ? (payload.new as TRow) : row
61
+ })
62
+ } else if (payload.eventType === "DELETE") {
63
+ const old = payload.old as Record<string, unknown>
64
+ return rows.filter((row) => (row as Record<string, unknown>)["id"] !== old["id"])
65
+ }
66
+ return rows
67
+ })
68
+ })
69
+
70
+ channel.subscribe((newStatus: ChannelStatus) => {
71
+ if (newStatus === "SUBSCRIBED") {
72
+ setStatus("connected")
73
+ } else if (newStatus === "CHANNEL_ERROR") {
74
+ setStatus("error")
75
+ setError({ message: "Subscription error" })
76
+ } else if (newStatus === "CLOSED") {
77
+ setStatus("disconnected")
78
+ }
79
+ })
80
+ })
81
+
82
+ onCleanup(() => {
83
+ channel?.unsubscribe()
84
+ })
85
+
86
+ return { data, error, status }
87
+ }
package/src/index.ts ADDED
@@ -0,0 +1,18 @@
1
+ // @supatype/solid — Solid.js primitives for Supatype
2
+
3
+ export { SupatypeContext, useSupatype } from "./context.js"
4
+
5
+ export { createQuery } from "./createQuery.js"
6
+ export type { QueryOptions, QueryResult } from "./createQuery.js"
7
+
8
+ export { createMutation } from "./createMutation.js"
9
+ export type { MutationResult, MutationOperation, MutationOptions } from "./createMutation.js"
10
+
11
+ export { createAuth } from "./createAuth.js"
12
+ export type { AuthResult } from "./createAuth.js"
13
+
14
+ export { createSubscription } from "./createSubscription.js"
15
+ export type { SubscriptionOptions, SubscriptionResult } from "./createSubscription.js"
16
+
17
+ export { createFunction } from "./createFunction.js"
18
+ export type { FunctionResult } from "./createFunction.js"
package/tsconfig.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "outDir": "dist",
5
+ "rootDir": "src",
6
+ "composite": true,
7
+ "jsx": "preserve",
8
+ "jsxImportSource": "solid-js",
9
+ "lib": ["ES2022", "DOM"]
10
+ },
11
+ "include": ["src"],
12
+ "references": [
13
+ { "path": "../client" }
14
+ ]
15
+ }
@@ -0,0 +1 @@
1
+ {"fileNames":["../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.date.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.date.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.string.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.number.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.promise.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.string.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.intl.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.array.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.error.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.intl.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.object.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.string.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.decorators.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../node_modules/.pnpm/csstype@3.2.3/node_modules/csstype/index.d.ts","../../node_modules/.pnpm/solid-js@1.9.11/node_modules/solid-js/types/jsx.d.ts","../../node_modules/.pnpm/solid-js@1.9.11/node_modules/solid-js/types/reactive/scheduler.d.ts","../../node_modules/.pnpm/solid-js@1.9.11/node_modules/solid-js/types/render/component.d.ts","../../node_modules/.pnpm/solid-js@1.9.11/node_modules/solid-js/types/render/flow.d.ts","../../node_modules/.pnpm/solid-js@1.9.11/node_modules/solid-js/types/render/Suspense.d.ts","../../node_modules/.pnpm/solid-js@1.9.11/node_modules/solid-js/types/render/hydration.d.ts","../../node_modules/.pnpm/solid-js@1.9.11/node_modules/solid-js/types/render/index.d.ts","../../node_modules/.pnpm/solid-js@1.9.11/node_modules/solid-js/types/reactive/signal.d.ts","../../node_modules/.pnpm/solid-js@1.9.11/node_modules/solid-js/types/reactive/observable.d.ts","../../node_modules/.pnpm/solid-js@1.9.11/node_modules/solid-js/types/reactive/array.d.ts","../../node_modules/.pnpm/solid-js@1.9.11/node_modules/solid-js/types/index.d.ts","../client/dist/types.d.ts","../client/dist/auth.d.ts","../client/dist/query.d.ts","../client/dist/storage.d.ts","../client/dist/realtime.d.ts","../client/dist/errors.d.ts","../client/dist/fetch-with-retry.d.ts","../client/dist/retry.d.ts","../client/dist/error-codes-doc.d.ts","../client/dist/serverless-docs.d.ts","../client/dist/index.d.ts","./src/context.ts","./src/createAuth.ts","./src/createFunction.ts","./src/createMutation.ts","./src/createQuery.ts","./src/createSubscription.ts","./src/index.ts"],"fileIdsList":[[60,61,66,67,68,69],[59],[67],[60,61,66],[60],[60,67],[62,63,64,65],[71],[71,72,73,74,75,76,77,78,79,80],[77],[60,70,81],[60,70,81,82],[60,82,83,84,85,86,87]],"fileInfos":[{"version":"c430d44666289dae81f30fa7b2edebf186ecc91a2d4c71266ea6ae76388792e1","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","impliedFormat":1},{"version":"ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2","impliedFormat":1},{"version":"080941d9f9ff9307f7e27a83bcd888b7c8270716c39af943532438932ec1d0b9","affectsGlobalScope":true,"impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"fb0f136d372979348d59b3f5020b4cdb81b5504192b1cacff5d1fbba29378aa1","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"a680117f487a4d2f30ea46f1b4b7f58bef1480456e18ba53ee85c2746eeca012","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true,"impliedFormat":1},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true,"impliedFormat":1},{"version":"959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a","affectsGlobalScope":true,"impliedFormat":1},{"version":"965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d","affectsGlobalScope":true,"impliedFormat":1},{"version":"3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005","affectsGlobalScope":true,"impliedFormat":1},{"version":"8cdf8847677ac7d20486e54dd3fcf09eda95812ac8ace44b4418da1bbbab6eb8","affectsGlobalScope":true,"impliedFormat":1},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true,"impliedFormat":1},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true,"impliedFormat":1},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac51dd7d31333793807a6abaa5ae168512b6131bd41d9c5b98477fc3b7800f9f","impliedFormat":1},{"version":"5ad3e58181b335ff8794bcc3161a1506dbe8cebbce71a15b3dc7bfe56f076679","impliedFormat":99},{"version":"a6d2eb77f390448a229ca63b4adadbcc549d203b8c038f1f7627a118f732969d","impliedFormat":99},{"version":"b886cc0d907b31ae7484a85da375bc8ac42f9986ec1e49c9c7c854956b0a928b","impliedFormat":99},{"version":"46b432f55912daaf98d11b81c5d06f8b78231c9ef101306ca5b3ef2cc7b6e9f0","impliedFormat":99},{"version":"8ab288ca80e5f2a9dab19955fcd9e81a244432cd7d256fdb5ea198ed5a44f0a4","impliedFormat":99},{"version":"0caadd121b8965f24d5c647a2ed01f5fc352772e4cea4bbca2ab78adedfdd921","impliedFormat":99},{"version":"b642b6a4b9b670338bc50281a6dd192fb7cc0b2f9d63d38c250bb1f02e828bbc","impliedFormat":99},{"version":"8e6b36766cbd3eed84e874fa9d1205f7b5e987fdf90d2574436be65040b2db91","impliedFormat":99},{"version":"c2e65a549ac9d227a9002d077af67bb1c77557a72bf39a85c4354831879078ed","affectsGlobalScope":true,"impliedFormat":99},{"version":"38f11ad59dfc38750b789f9f250742d0ce0da44e28f790a032cd15665b70f239","impliedFormat":99},{"version":"6e70da1429948b2ca8201ccc248bd2cb77cd6bbc4cf33f639c4b0f8f6a35cbd1","affectsGlobalScope":true,"impliedFormat":99},{"version":"d3ed160939e7f93a97a35a37c42cad50799885f564a7b3957c9e9f1221ced9e7","impliedFormat":99},{"version":"d58e244c6d3aa676939aaa26e7bc5c6de22e408c195f69ee118eddd68377d17c","impliedFormat":99},{"version":"20fac2f073582881eeccdd3b04819084684fd296f3d6a0fa53e48ed3de83d35a","impliedFormat":99},{"version":"e5363db20ce3327d96a0e8c9a326259764eaf94e2b34eee3c74e5e6a988e5532","impliedFormat":99},{"version":"00f9fbcf8c7f9957b087eb4922fc153085c112d7f386c2cc211995a47fe7e07e","impliedFormat":99},{"version":"1600ade5611547c843e1da83f4180fa9d63e76f86503ac94e10ae55d87bfda02","impliedFormat":99},{"version":"ccbb4f957666793ea28e67b0748ba838841e641330b661bae31a5974612c73fd","impliedFormat":99},{"version":"9143a4409f10ae9f6362706e00e3b7ed082d4b2af0125aab31ecd30a6fefab13","impliedFormat":99},{"version":"6c9f37788061375db19a85ad684e2e08c5d0517200fae8479226ed1e82034ed1","impliedFormat":99},{"version":"e0856e33bfa821d4ab90b555ec6311122f178620eceb8effcaf6344abdb0bb75","impliedFormat":99},{"version":"509349be18cb0f2a92947dca43f5cd0af31ba579ebf8c75d2d2abb48a82f9042","impliedFormat":99},{"version":"0a4884385778be35812a24502f6ea5083fdad8e122efe6db090af805bb5d3f24","signature":"619d400b367d0f2cb23b7af7638e8f4a7d9f58d13483b5d5621f0ec1f0bca706","impliedFormat":99},{"version":"8f9b599311dfcd56bb55bfe6e51dc9d9b7eb187cdde4ad87ed392359caf97537","signature":"fd5d4962945fc9eabba0f8248bb40fe93a41b4d4388de1d6236a029a7bcdf328","impliedFormat":99},{"version":"46cea573210df39b5fa23afafef6afd67bff2782bfbe2a4cf078d90755a76c3f","signature":"41634254c7f5c6650982c6ffa6e04bab0f9425222e07e0e35d8be48df1328e94","impliedFormat":99},{"version":"eb0284f86dd9e5f765a6539aaace02cff8b9c542cd071c308a18872399ee75ca","signature":"6a88680b4c0943533b42dc274e5496d0bf86042dbdad15299ae33a37a3c45af5","impliedFormat":99},{"version":"33d3ee6e52d276b3772e606e0b22151b4d9eceff618423fea233da902abb7a79","signature":"d1c1772a8ab7ec280ad6ab860407245bf9c571ef725710e921401bd7061ca23f","impliedFormat":99},{"version":"2956ba9bed64902735eb9b38bfb9a1602ef7e3d2716586cc607ab0b4c69686dc","signature":"1c350947e7e15b0cec08e0d35e8e7931e016bac6e53f96d7d74a5cd1b845279f","impliedFormat":99},{"version":"ba2f9a2d9735408838a7210b8effccc18f0d09e2e1a016230bc47204384074cd","signature":"a99a8244faf6420af9e811d4a5c57493e071d391d7ec9b8b288cbc6184327652","impliedFormat":99}],"root":[[82,88]],"options":{"composite":true,"declaration":true,"declarationMap":true,"esModuleInterop":true,"exactOptionalPropertyTypes":true,"jsx":1,"jsxImportSource":"solid-js","module":199,"noUncheckedIndexedAccess":true,"outDir":"./dist","rootDir":"./src","skipLibCheck":true,"sourceMap":true,"strict":true,"target":9},"referencedMap":[[70,1],[60,2],[69,3],[68,3],[67,4],[64,5],[62,5],[63,6],[65,3],[66,7],[72,8],[81,9],[73,8],[78,10],[74,8],[82,11],[83,12],[84,12],[85,12],[86,12],[87,12],[88,13]],"latestChangedDtsFile":"./dist/index.d.ts","version":"5.9.3"}