@effectify/solid-query 0.5.11 → 0.5.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effectify/solid-query",
3
- "version": "0.5.11",
3
+ "version": "0.5.12",
4
4
  "description": "Integration of Effect with TanStack Query for Solid.js",
5
5
  "type": "module",
6
6
  "main": "./dist/src/index.js",
@@ -27,7 +27,7 @@
27
27
  "peerDependencies": {
28
28
  "@tanstack/query-core": "^5.90.20",
29
29
  "@tanstack/solid-query": "^5.90.23",
30
- "effect": "^3.19.16",
30
+ "effect": "^3.19.16 || ^4.0.0-beta",
31
31
  "solid-js": "^1.9.11"
32
32
  },
33
33
  "devDependencies": {
package/dist/src/index.js CHANGED
@@ -1,5 +1,6 @@
1
+ // Effect v4 Beta - Solid Query Integration
2
+ // @beta - Part of Effect v4 beta migration
3
+ // Published: 2026-03-15
1
4
  export * from "./lib/internal/query-data-helpers.js";
2
5
  export * from "./lib/tanstack-query-effect.jsx";
3
6
  export * from "./lib/types.js";
4
- // Testing release workflow with changelog generation
5
- // This should only affect solid-query package
@@ -11,11 +11,13 @@ export const makeUseEffectQuery = (createRunner) => ({ gcTime, staleTime, ...opt
11
11
  })();
12
12
  return useQuery(() => ({
13
13
  ...options,
14
- queryKey: options.queryKey, // Aseguramos que queryKey es no-undefined
14
+ queryKey: options.queryKey,
15
15
  queryFn: options.queryFn === skipToken ? skipToken : queryFn,
16
16
  ...(staleTime !== undefined && {
17
- staleTime: Duration.toMillis(staleTime),
17
+ staleTime: Duration.toMillis(Duration.millis(staleTime)),
18
+ }),
19
+ ...(gcTime !== undefined && {
20
+ gcTime: Duration.toMillis(Duration.millis(gcTime)),
18
21
  }),
19
- ...(gcTime !== undefined && { gcTime: Duration.toMillis(gcTime) }),
20
22
  }));
21
23
  };
@@ -1,6 +1,20 @@
1
- import * as Effect from "effect/Effect";
2
- import type * as ManagedRuntime from "effect/ManagedRuntime";
3
- import * as SubscriptionRef from "effect/SubscriptionRef";
4
1
  import { type Context } from "solid-js";
2
+ import type * as ManagedRuntime from "effect/ManagedRuntime";
5
3
  import type { Subscribable, SubscriptionOptions } from "../types.js";
6
- export declare const makeUseRxSubscriptionRef: <R, E>(RuntimeContext: Context<ManagedRuntime.ManagedRuntime<R, E> | null>) => <A, E2>(subscribable: Subscribable<A, E2> | Effect.Effect<Subscribable<A, E2>, never, R> | Effect.Effect<SubscriptionRef.SubscriptionRef<A>, never, R>, onNext: (value: A) => void, opts?: SubscriptionOptions) => A;
4
+ import type * as Effect from "effect/Effect";
5
+ /**
6
+ * ⚠️ TEMPORARILY DISABLED - Effect v4 Migration
7
+ *
8
+ * This hook is temporarily disabled due to significant API changes in Effect v4:
9
+ * - SubscriptionRef.SubscriptionRefTypeId was removed
10
+ * - Stream APIs reorganized under effect/unstable/*
11
+ * - Migration documentation is incomplete (see Effect-TS/effect-smol#1378)
12
+ *
13
+ * The core functionality (useEffectQuery, useEffectMutation) works with v4.
14
+ * This advanced subscription feature will be revisited when v4 documentation
15
+ * is complete or when the beta stabilizes.
16
+ *
17
+ * TODO: Re-enable after Effect v4 stable release and documentation update
18
+ * @deprecated Temporarily disabled during Effect v4 beta migration
19
+ */
20
+ export declare const makeUseRxSubscriptionRef: <R, E>(RuntimeContext: Context<ManagedRuntime.ManagedRuntime<R, E> | null>) => <A, E2>(_subscribable: Subscribable<A, E2> | Effect.Effect<Subscribable<A, E2>, never, R> | Effect.Effect<unknown, never, R>, _onNext: (value: A) => void, _opts?: SubscriptionOptions) => () => A;
@@ -1,55 +1,27 @@
1
- import * as Effect from "effect/Effect";
2
- import * as Fiber from "effect/Fiber";
3
- import * as Stream from "effect/Stream";
4
- import * as SubscriptionRef from "effect/SubscriptionRef";
5
- import { createEffect, createSignal, onCleanup, useContext } from "solid-js";
6
- export const makeUseRxSubscriptionRef = (RuntimeContext) => (subscribable, onNext, opts) => {
7
- const options = {
8
- skipInitial: opts?.skipInitial ?? true,
9
- };
1
+ import { useContext } from "solid-js";
2
+ /**
3
+ * ⚠️ TEMPORARILY DISABLED - Effect v4 Migration
4
+ *
5
+ * This hook is temporarily disabled due to significant API changes in Effect v4:
6
+ * - SubscriptionRef.SubscriptionRefTypeId was removed
7
+ * - Stream APIs reorganized under effect/unstable/*
8
+ * - Migration documentation is incomplete (see Effect-TS/effect-smol#1378)
9
+ *
10
+ * The core functionality (useEffectQuery, useEffectMutation) works with v4.
11
+ * This advanced subscription feature will be revisited when v4 documentation
12
+ * is complete or when the beta stabilizes.
13
+ *
14
+ * TODO: Re-enable after Effect v4 stable release and documentation update
15
+ * @deprecated Temporarily disabled during Effect v4 beta migration
16
+ */
17
+ export const makeUseRxSubscriptionRef = (RuntimeContext) => (_subscribable, _onNext, _opts) => {
10
18
  const runtime = useContext(RuntimeContext);
11
19
  if (!runtime) {
12
20
  throw new Error("Runtime context not found. Make sure to wrap your app with RuntimeProvider");
13
21
  }
14
- const setInitialValue = () => {
15
- const initialValue = Effect.gen(function* () {
16
- const resolved = Effect.isEffect(subscribable) ? yield* subscribable : subscribable;
17
- const resolvedValue = SubscriptionRef.SubscriptionRefTypeId in resolved
18
- ? yield* SubscriptionRef.get(resolved)
19
- : resolved.get();
20
- if (!options?.skipInitial) {
21
- onNext(resolvedValue);
22
- }
23
- return resolvedValue;
24
- });
25
- const newVal = runtime.runSync(initialValue);
26
- return newVal;
22
+ return () => {
23
+ throw new Error("useRxSubscriptionRef is temporarily disabled during Effect v4 beta migration. " +
24
+ "Please use useEffectQuery or useEffectMutation instead, or wait for v4 stable release. " +
25
+ "See: https://github.com/Effect-TS/effect-smol/issues/1378");
27
26
  };
28
- const [value, setValue] = createSignal(setInitialValue());
29
- createEffect(() => {
30
- const fiber = Effect.gen(function* () {
31
- const resolved = Effect.isEffect(subscribable) ? yield* subscribable : subscribable;
32
- const adaptedSubscribable = SubscriptionRef.SubscriptionRefTypeId in resolved
33
- ? {
34
- changes: resolved.changes,
35
- get: () => runtime.runSync(SubscriptionRef.get(resolved)),
36
- }
37
- : resolved;
38
- const currentValue = adaptedSubscribable.get();
39
- setValue(() => currentValue);
40
- let hasEmittedInitial = false;
41
- return yield* adaptedSubscribable.changes.pipe(Stream.tap((val) => Effect.sync(() => {
42
- setValue(() => val);
43
- if (options?.skipInitial && !hasEmittedInitial) {
44
- hasEmittedInitial = true;
45
- return;
46
- }
47
- onNext(val);
48
- })), Stream.runDrain, Effect.forever, Effect.forkDaemon);
49
- }).pipe(runtime.runSync);
50
- onCleanup(() => {
51
- runtime.runCallback(Fiber.interrupt(fiber));
52
- });
53
- });
54
- return value();
55
27
  };
@@ -11,14 +11,16 @@ export const makeUseRxSubscribe = (RuntimeContext) => {
11
11
  }
12
12
  const [value, setValue] = createSignal(initialValue);
13
13
  const [fiberRef, setFiberRef] = createSignal(null);
14
- const finalStream = Effect.isEffect(stream) ? Stream.unwrap(stream) : stream;
14
+ const finalStream = Effect.isEffect(stream)
15
+ ? Stream.unwrap(stream)
16
+ : stream;
15
17
  const subscription = finalStream.pipe(Stream.tap((a) => Effect.sync(() => {
16
18
  setValue(() => a);
17
19
  onNext(a);
18
- })), Stream.catchAll((e) => Stream.fromEffect(Effect.sync(() => {
20
+ })), Stream.catch((e) => Stream.fromEffect(Effect.sync(() => {
19
21
  onError?.(e);
20
22
  return;
21
- }))), Stream.runDrain, Effect.forever, Effect.forkDaemon);
23
+ }))), Stream.runDrain, Effect.forever, Effect.forkDetach);
22
24
  runtime.runCallback(subscription, {
23
25
  onExit: (exit) => {
24
26
  if (Exit.isSuccess(exit)) {
@@ -1,6 +1,6 @@
1
1
  import { type QueryClient } from "@tanstack/solid-query";
2
2
  import * as Effect from "effect/Effect";
3
- import type * as Layer from "effect/Layer";
3
+ import * as Layer from "effect/Layer";
4
4
  import * as ManagedRuntime from "effect/ManagedRuntime";
5
5
  import { type Component, type JSX } from "solid-js";
6
6
  export declare const tanstackQueryEffect: <R, E>({ layer, queryClient, }: {
@@ -15,7 +15,7 @@ export declare const tanstackQueryEffect: <R, E>({ layer, queryClient, }: {
15
15
  useEffectQuery: <TData, TError extends import("./types.js").EffectfulError, TQueryKey extends import("./types.js").QueryKey = import("./types.js").QueryKey>({ gcTime, staleTime, ...options }: import("./types.js").EffectfulQueryOptions<TData, TError, R, TQueryKey>) => import("@tanstack/solid-query").UseQueryResult<TData, Error>;
16
16
  useEffectMutation: <TData, TError_1 extends import("./types.js").EffectfulError, TVariables>(options: import("./types.js").EffectfulMutationOptions<TData, TError_1, TVariables, R>) => import("@tanstack/solid-query").UseMutationResult<TData, Error, TVariables>;
17
17
  useRxSubscribe: <E2_1, A>(stream: import("effect/Stream").Stream<A, E2_1, R> | Effect.Effect<import("effect/Stream").Stream<A, E2_1, R>, E2_1, R>, initialValue: A, onNext: (value: A) => void, onError?: ((error: E2_1) => void) | undefined) => import("solid-js").Accessor<A | undefined>;
18
- useRxSubscriptionRef: <A_1, E2_1>(subscribable: import("./types.js").Subscribable<A_1, E2_1> | Effect.Effect<import("./types.js").Subscribable<A_1, E2_1>, never, R> | Effect.Effect<import("effect/SubscriptionRef").SubscriptionRef<A_1>, never, R>, onNext: (value: A_1) => void, opts?: import("./types.js").SubscriptionOptions) => A_1;
18
+ useRxSubscriptionRef: <A_1, E2_1>(_subscribable: import("./types.js").Subscribable<A_1, E2_1> | Effect.Effect<import("./types.js").Subscribable<A_1, E2_1>, never, R> | Effect.Effect<unknown, never, R>, _onNext: (value: A_1) => void, _opts?: import("./types.js").SubscriptionOptions) => () => A_1;
19
19
  createQueryDataHelpers: <TData, TVariables_1 = void>(queryKey: (variables: TVariables_1) => readonly [string, ...unknown[]]) => {
20
20
  removeQuery: (variables: TVariables_1) => void;
21
21
  removeAllQueries: () => void;
@@ -14,7 +14,7 @@ export const tanstackQueryEffect = ({ layer, queryClient, }) => {
14
14
  if (!runtime) {
15
15
  throw new Error("Runtime context not found. Make sure to wrap your app with RuntimeProvider");
16
16
  }
17
- return createMemo(() => (span) => (effect) => effect.pipe(Effect.withSpan(span), Effect.tapErrorCause(Effect.logError), runtime.runPromise));
17
+ return createMemo(() => (span) => (effect) => runtime.runPromise(effect.pipe(Effect.withSpan(span))));
18
18
  };
19
19
  const RuntimeProvider = (props) => {
20
20
  const runtime = ManagedRuntime.make(layer);
@@ -22,7 +22,9 @@ export const tanstackQueryEffect = ({ layer, queryClient, }) => {
22
22
  runtime.dispose();
23
23
  });
24
24
  return (<RuntimeContext.Provider value={runtime}>
25
- <QueryClientProvider client={queryClient}>{props.children}</QueryClientProvider>
25
+ <QueryClientProvider client={queryClient}>
26
+ {props.children}
27
+ </QueryClientProvider>
26
28
  </RuntimeContext.Provider>);
27
29
  };
28
30
  const useRuntime = () => {
@@ -1,17 +1,13 @@
1
1
  import type { QueryFunctionContext, skipToken } from "@tanstack/query-core";
2
2
  import type { UseMutationOptions, UseQueryOptions } from "@tanstack/solid-query";
3
- import type { DurationInput } from "effect/Duration";
4
3
  import type * as Effect from "effect/Effect";
5
- import type * as Stream from "effect/Stream";
6
4
  import type { Accessor } from "solid-js";
7
5
  export type QueryKey = readonly [string, Record<string, unknown>?];
8
6
  export type EffectfulError = {
9
7
  _tag: string;
10
8
  };
11
9
  export type Runner<R> = () => Accessor<(<A, E>(span: string) => (effect: Effect.Effect<A, E, R>) => Promise<A>)>;
12
- export type EffectfulMutationOptions<TData, TError extends EffectfulError, TVariables, R> = Omit<UseMutationOptions<TData, Error, TVariables>, // Actualizado a UseMutationOptions
13
- // Actualizado a UseMutationOptions
14
- "mutationFn" | "onSuccess" | "onError" | "onSettled" | "onMutate" | "retry" | "retryDelay"> & {
10
+ export type EffectfulMutationOptions<TData, TError extends EffectfulError, TVariables, R> = Omit<UseMutationOptions<TData, Error, TVariables>, "mutationFn" | "onSuccess" | "onError" | "onSettled" | "onMutate" | "retry" | "retryDelay"> & {
15
11
  mutationKey: QueryKey;
16
12
  mutationFn: (variables: TVariables) => Effect.Effect<TData, TError, R>;
17
13
  };
@@ -19,11 +15,11 @@ export type EffectfulQueryFunction<TData, TError, TQueryKey extends QueryKey = Q
19
15
  export type EffectfulQueryOptions<TData, TError, R, TQueryKey extends QueryKey = QueryKey, TPageParam = never> = Omit<UseQueryOptions<TData, Error, TData, TQueryKey>, "queryKey" | "queryFn" | "retry" | "retryDelay" | "staleTime" | "gcTime"> & {
20
16
  queryKey: TQueryKey;
21
17
  queryFn: EffectfulQueryFunction<TData, TError, TQueryKey, R, TPageParam> | typeof skipToken;
22
- staleTime?: DurationInput;
23
- gcTime?: DurationInput;
18
+ staleTime?: number;
19
+ gcTime?: number;
24
20
  };
25
21
  export interface Subscribable<A, E = never> {
26
- readonly changes: Stream.Stream<A, E>;
22
+ readonly changes: unknown;
27
23
  readonly get: () => A;
28
24
  }
29
25
  export interface SubscriptionOptions {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effectify/solid-query",
3
- "version": "0.5.11",
3
+ "version": "0.5.12",
4
4
  "description": "Integration of Effect with TanStack Query for Solid.js",
5
5
  "type": "module",
6
6
  "main": "./dist/src/index.js",
@@ -27,13 +27,13 @@
27
27
  "peerDependencies": {
28
28
  "@tanstack/query-core": "^5.90.20",
29
29
  "@tanstack/solid-query": "^5.90.23",
30
- "effect": "^3.19.16",
30
+ "effect": "^3.19.16 || ^4.0.0-beta",
31
31
  "solid-js": "^1.9.11"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@tanstack/query-core": "5.90.20",
35
35
  "@tanstack/solid-query": "5.90.23",
36
- "effect": "3.19.16",
36
+ "effect": "4.0.0-beta.31",
37
37
  "solid-js": "^1.9.9",
38
38
  "typescript": "5.9.3"
39
39
  }