Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .fallowrc.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"@tanstack/intent",
"effect",
// Fallow resolves workspace imports to source but misses the root package dependency.
"effect-api-query",
"@ueberbrot/effect-api-query",
"publint",
// React belongs to the private apps; Fallow attributes shared example sources to the root.
"react",
Expand Down
389 changes: 221 additions & 168 deletions .intent/review-state.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Your application controls transport, client lifetime, and cache policy.
Install the package and TanStack Query Core:

```sh
pnpm add effect-api-query @tanstack/query-core
pnpm add @ueberbrot/effect-api-query @tanstack/query-core
```

The package requires one exact Effect 4 release because its RPC and HTTP API modules are unstable.
Expand Down Expand Up @@ -42,7 +42,7 @@ Client integration in `client.ts`:

```ts
import { QueryClient } from '@tanstack/query-core'
import { createRpcQueryUtils } from 'effect-api-query'
import { createRpcQueryUtils } from '@ueberbrot/effect-api-query'
import type { RpcClient, RpcGroup } from 'effect/rpc'

import { usersRpc } from './rpc-contract.ts'
Expand Down Expand Up @@ -87,7 +87,7 @@ Client integration in `client.ts`:

```ts
import { QueryClient } from '@tanstack/query-core'
import { createHttpApiQueryUtils } from 'effect-api-query'
import { createHttpApiQueryUtils } from '@ueberbrot/effect-api-query'
import type { HttpApiClient } from 'effect/http-api'

import { usersApi } from './http-contract.ts'
Expand Down Expand Up @@ -137,10 +137,10 @@ npx skills add ueberBrot/effect-api-query --full-depth --skill effect-api-query
```

The npm package includes the same skill. After installing the library, run
`npx @tanstack/intent@latest install` and enable `effect-api-query`, then load it with:
`npx @tanstack/intent@latest install` and enable `@ueberbrot/effect-api-query`, then load it with:

```sh
npx @tanstack/intent@latest load effect-api-query#effect-api-query
npx @tanstack/intent@latest load @ueberbrot/effect-api-query#effect-api-query
```

Intent loads the skill from your installed library version. Update a skill installed from GitHub
Expand Down
8 changes: 4 additions & 4 deletions _artifacts/domain_map.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
library:
name: effect-api-query
name: '@ueberbrot/effect-api-query'
version: 0.1.0
repository: https://github.com/ueberBrot/effect-api-query
description: TanStack Query utilities derived from ready Effect RPC and HTTP clients.
Expand All @@ -16,7 +16,7 @@ skills:
consumers.
type: core
packages:
- effect-api-query
- '@ueberbrot/effect-api-query'
covers:
- RPC construction and canonical identity
- HTTP decoded requests, SSE, multipart mutations, and metadata
Expand Down Expand Up @@ -47,10 +47,10 @@ skills:
- Choose an application-owned transport within documented version and host boundaries.
subsystems:
- name: RPC
package: effect-api-query
package: '@ueberbrot/effect-api-query'
config_surface: Literal RpcGroup, flat ready client, prefix, key encoders, runner.
- name: HTTP
package: effect-api-query
package: '@ueberbrot/effect-api-query'
config_surface: Literal HttpApi, ready client, prefix, request encoders, runner.
reference_candidates:
- topic: Adapter inputs and capabilities
Expand Down
4 changes: 2 additions & 2 deletions _artifacts/skill_spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ The entry point contains shared rules and directs conditional tasks to six refer
| Hydration and SSR | Snapshots, paired view codecs, preparation and cleanup |
| Frameworks and hosts | Provider setup, Suspense, reactive accessors, transports and hosts |

Consumers load the guidance from their installed package without repository-local
authoring skills. Planning records remain outside the shipped package.
Consumers load the guidance from installed `@ueberbrot/effect-api-query` without
repository-local authoring skills. Planning records remain outside the shipped package.

## Sources and boundaries

Expand Down
2 changes: 1 addition & 1 deletion _artifacts/skill_tree.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
library:
name: effect-api-query
name: '@ueberbrot/effect-api-query'
version: 0.1.0
generated_from:
domain_map: _artifacts/domain_map.yaml
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/astro.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ export default defineConfig({
},
],
social: [{ icon: 'github', label: 'GitHub', href: repositoryUrl }],
title: packageManifest.name,
title: 'effect-api-query',
}),
],
site: 'https://ueberbrot.github.io',
Expand Down
4 changes: 2 additions & 2 deletions apps/docs/public/package-version.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
;(() => {
const packageUrl = 'https://www.npmjs.com/package/effect-api-query'
const packageManifestUrl = 'https://registry.npmjs.org/effect-api-query/latest'
const packageUrl = 'https://www.npmjs.com/package/@ueberbrot/effect-api-query'
const packageManifestUrl = 'https://registry.npmjs.org/@ueberbrot%2Feffect-api-query/latest'
const semanticVersion = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/

const updatePackageVersion = (version) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Compatibility and Stability
description: Check supported integrations, module format, and the release policy.
---

Import both factories from the `effect-api-query` package root. They use the same peer dependencies.
Import both factories from the `@ueberbrot/effect-api-query` package root. They use the same peer dependencies.
The package's [manifest](https://github.com/ueberBrot/effect-api-query/blob/main/package.json)
defines the peer requirements. The [workspace catalog](https://github.com/ueberBrot/effect-api-query/blob/main/pnpm-workspace.yaml)
lists the versions tested in this repository. See the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ Client integration in `client.ts`:

```ts
import { MutationObserver, QueryClient } from '@tanstack/query-core'
import { createHttpApiQueryUtils } from '@ueberbrot/effect-api-query'
import { ManagedRuntime } from 'effect'
import { createHttpApiQueryUtils } from 'effect-api-query'
import { FetchHttpClient } from 'effect/http'
import { HttpApiClient } from 'effect/http-api'

Expand Down
2 changes: 1 addition & 1 deletion apps/docs/src/content/docs/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: Install effect-api-query and its peer dependencies.
Install the package and TanStack Query Core:

```sh
pnpm add effect-api-query @tanstack/query-core
pnpm add @ueberbrot/effect-api-query @tanstack/query-core
```

With pnpm's default peer installation enabled, this command also installs the exact Effect release that the package requires.
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/src/content/docs/getting-started/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ Client integration in `client.ts`:

```ts
import { MutationObserver, QueryClient } from '@tanstack/query-core'
import { createRpcQueryUtils } from '@ueberbrot/effect-api-query'
import { Effect, Exit, Layer, Scope } from 'effect'
import { createRpcQueryUtils } from 'effect-api-query'
import { FetchHttpClient } from 'effect/http'
import { RpcClient, RpcSerialization } from 'effect/rpc'

Expand Down
2 changes: 1 addition & 1 deletion apps/docs/src/content/docs/guides/cache-filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: Read typed entries and target native cache operations with generate

For typed `getQueryData` and `setQueryData`, use a generated concrete key. For native
`invalidateQueries`, `cancelQueries`, and query-state filters, use root, branch, leaf, or view prefixes.
To select one supported cache view, import `viewPrefix` from `effect-api-query`.
To select one supported cache view, import `viewPrefix` from `@ueberbrot/effect-api-query`.
Choose the scope before adding `type`, `stale`, `fetchStatus`, or `predicate` conditions:

| Scope | Key | Matches |
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/src/content/docs/guides/cancellation.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Cancel queries and request server-side cancellation for long-runnin
---

In your application client module, forward TanStack's `AbortSignal` to the runtime.
Import `RunPromiseExit` from `effect-api-query`:
Import `RunPromiseExit` from `@ueberbrot/effect-api-query`:

```ts
const runPromiseExit: RunPromiseExit = (effect, options) => runtime.runPromiseExit(effect, options)
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/src/content/docs/guides/conditional-queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use `{ input: skipToken }`. The builder still accepts TanStack options such as `
`select`, or `initialData`:

```ts
import { skipToken } from 'effect-api-query'
import { skipToken } from '@ueberbrot/effect-api-query'

type User = { id: number; name: string }

Expand Down
4 changes: 2 additions & 2 deletions apps/docs/src/content/docs/guides/handle-failures.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ A failed RPC `Exit` becomes `EffectRpcQueryError`. The error records the RPC tag
operation, and the complete Effect `Cause`. Inspect the error in your application handler:

```ts
import { isEffectRpcQueryError } from '@ueberbrot/effect-api-query'
import { Cause } from 'effect'
import { isEffectRpcQueryError } from 'effect-api-query'

const logRpcError = (error: unknown) => {
if (isEffectRpcQueryError(error)) {
Expand Down Expand Up @@ -36,7 +36,7 @@ bounded attempt counts, and synchronous preparation errors.

## Inspect HTTP failures

Import `isEffectHttpApiQueryError` from `effect-api-query` to recognize a failed HTTP execution.
Import `isEffectHttpApiQueryError` from `@ueberbrot/effect-api-query` to recognize a failed HTTP execution.
The wrapper records `apiId`, `groupId`, `endpoint`, `method`, and `operation`. Its `cause`
retains the complete original Effect Cause. Use `Cause.findError` to inspect declared endpoint
errors, middleware errors, Schema errors, and HTTP client errors. Use `Cause.hasDies` and
Expand Down
6 changes: 3 additions & 3 deletions apps/docs/src/content/docs/guides/query-defaults.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ builder's inference. The library supplies the generated keys and execution funct
## Register native defaults

In the cache module, import `QueryClient` from `@tanstack/query-core` and `viewPrefix` from
`effect-api-query`:
`@ueberbrot/effect-api-query`:

```ts
const queryClient = new QueryClient({
Expand Down Expand Up @@ -61,7 +61,7 @@ the cache owner's lifetime. Builders reject per-call hashing overrides. See

If a policy belongs to one leaf and view, use `withQueryPolicy`. `QueryPolicy` types reusable
objects with that leaf's native options. Retry and refetch callbacks retain its data and error types.
Import both from `effect-api-query`:
Import both from `@ueberbrot/effect-api-query`:

```ts
const policy = {
Expand Down Expand Up @@ -90,7 +90,7 @@ use a value such as `staleTime: 0` or `retry: false`.

## Bind mutation invalidation

Import `withMutationPolicy` from `effect-api-query`. Seed the returned user and invalidate affected
Import `withMutationPolicy` from `@ueberbrot/effect-api-query`. Seed the returned user and invalidate affected
reads once for every use of the creation builder:

```ts
Expand Down
4 changes: 2 additions & 2 deletions apps/docs/src/content/docs/guides/react-query.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ Client integration in `client.ts`:

```ts
import { QueryClient } from '@tanstack/react-query'
import { createHttpApiQueryUtils } from '@ueberbrot/effect-api-query'
import type { RunPromiseExit } from '@ueberbrot/effect-api-query'
import { ManagedRuntime } from 'effect'
import { createHttpApiQueryUtils } from 'effect-api-query'
import type { RunPromiseExit } from 'effect-api-query'
import { FetchHttpClient } from 'effect/http'
import { HttpApiClient } from 'effect/http-api'

Expand Down
4 changes: 2 additions & 2 deletions apps/docs/src/content/docs/guides/retry-queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ unknown values safely. The adapter guard rejects custom runner failures that pas
## Bind a typed RPC policy

Import `withQueryPolicy`, `isEffectRpcQueryError`, and the type `InferQueryError` from
`effect-api-query`, plus `RpcClientError` from `effect/rpc`. After acquiring your ready client and
`@ueberbrot/effect-api-query`, plus `RpcClientError` from `effect/rpc`. After acquiring your ready client and
creating `rpc`, bind the profile read:

```ts
Expand All @@ -82,7 +82,7 @@ belongs to the application that owns those transports.

## Bind the same decision to HTTP

Import `isEffectHttpApiQueryError` from `effect-api-query` and `HttpClientError` from `effect/http`.
Import `isEffectHttpApiQueryError` from `@ueberbrot/effect-api-query` and `HttpClientError` from `effect/http`.
Reuse the shared retry logic with HTTP's transport classifier:

```ts
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/src/content/docs/guides/solid-query.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ with `name`:

```ts
import { useQuery } from '@tanstack/solid-query'
import { skipToken } from 'effect-api-query'
import { skipToken } from '@ueberbrot/effect-api-query'
import { createSignal } from 'solid-js'

import { rpc } from './queries.ts'
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/src/content/docs/guides/stream-snapshots.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ query and awaits local iterator cleanup. Ordinary `queryClient.query` waits for

## Capture data before dehydration

Import `fetchStreamSnapshot` from `effect-api-query`. In the request loader or server snapshot
Import `fetchStreamSnapshot` from `@ueberbrot/effect-api-query`. In the request loader or server snapshot
module, use your existing `rpc`, request-local `queryClient` and abort `signal`. Keep the ready
client and runner alive until capture settles. For the declared `updates.watch` stream:

Expand Down
4 changes: 2 additions & 2 deletions apps/docs/src/content/docs/guides/suspense-and-recovery.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ import {
useSuspenseQueries,
useSuspenseQuery,
} from '@tanstack/react-query'
import { createRpcQueryUtils, isEffectRpcQueryError } from '@ueberbrot/effect-api-query'
import type { InferQueryData, InferQueryError } from '@ueberbrot/effect-api-query'
import { Cause, Result, Schema } from 'effect'
import { createRpcQueryUtils, isEffectRpcQueryError } from 'effect-api-query'
import type { InferQueryData, InferQueryError } from 'effect-api-query'
import { Rpc, RpcGroup } from 'effect/rpc'
import type { RpcClient } from 'effect/rpc'
import { Component, Suspense } from 'react'
Expand Down
4 changes: 2 additions & 2 deletions apps/docs/src/content/docs/guides/trace-streams.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ Client tracing in `trace-feed.ts`:

```ts
import { QueryClient } from '@tanstack/query-core'
import { createHttpApiQueryUtils, fetchStreamSnapshot } from '@ueberbrot/effect-api-query'
import type { RunPromiseExit } from '@ueberbrot/effect-api-query'
import { Effect, Layer, ManagedRuntime, Stream, Tracer } from 'effect'
import { createHttpApiQueryUtils, fetchStreamSnapshot } from 'effect-api-query'
import type { RunPromiseExit } from 'effect-api-query'
import { FetchHttpClient } from 'effect/http'
import { HttpApiClient } from 'effect/http-api'
import { OtlpSerialization, OtlpTracer } from 'effect/observability'
Expand Down
4 changes: 2 additions & 2 deletions apps/docs/src/content/docs/guides/vue-query.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ Here `users.read` returns a user with a `name`:

```ts
import { useQuery } from '@tanstack/vue-query'
import { skipToken } from 'effect-api-query'
import type { InferQueryData, InferQueryError } from 'effect-api-query'
import { skipToken } from '@ueberbrot/effect-api-query'
import type { InferQueryData, InferQueryError } from '@ueberbrot/effect-api-query'
import { computed, ref } from 'vue'

import { rpc } from './queries.ts'
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/src/content/docs/reference/http-factory.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: HTTP factory options, decoded request input, response data, and cac

`createHttpApiQueryUtils(api, options)` builds and freezes an HTTP utility tree from an Effect
HttpApi and a ready HttpApiClient. The application manages the client's lifetime.
The factory is exported from `effect-api-query`.
The factory is exported from `@ueberbrot/effect-api-query`.

The [HTTP Quick Start](/effect-api-query/getting-started/http-quick-start/) shows factory setup.
[HTTP Builders](/effect-api-query/reference/http-builders/) defines each generated option and key.
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/src/content/docs/reference/public-exports.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Public Exports
description: Package-root values and types.
---

The package root, `effect-api-query`, exports all supported values and types.
The package root, `@ueberbrot/effect-api-query`, exports all supported values and types.

| Export | Purpose |
| ----------------------------------------- | ------------------------------------------------------------------------------ |
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/src/content/docs/reference/type-inference.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Type Inference
description: Derive operation inputs, cached data, mutation results, and failures from generated leaves.
---

These types are exported from `effect-api-query`. Each describes a generated leaf's contract:
These types are exported from `@ueberbrot/effect-api-query`. Each describes a generated leaf's contract:

| Type | Result |
| ----------------------------- | --------------------------------------------------------- |
Expand Down
4 changes: 2 additions & 2 deletions e2e-docs/docs.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { expect, test } from '@playwright/test'

const docsBase = '/effect-api-query/'
const registryUrl = 'https://registry.npmjs.org/effect-api-query/latest'
const packageUrl = 'https://www.npmjs.com/package/effect-api-query'
const registryUrl = 'https://registry.npmjs.org/@ueberbrot%2Feffect-api-query/latest'
const packageUrl = 'https://www.npmjs.com/package/@ueberbrot/effect-api-query'
const repositoryUrl = 'https://github.com/ueberBrot/effect-api-query'

test('opens tutorials and feature guides and searches the production index', async ({
Expand Down
2 changes: 1 addition & 1 deletion examples/shared/error-description.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { isEffectHttpApiQueryError, isEffectRpcQueryError } from '@ueberbrot/effect-api-query'
import { Cause } from 'effect'
import { isEffectHttpApiQueryError, isEffectRpcQueryError } from 'effect-api-query'

// oxlint-disable-next-line anti-slop/no-unknown-parameters
export const describeEffectError = (error: unknown) => {
Expand Down
2 changes: 1 addition & 1 deletion examples/tanstack-start/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"@tanstack/react-router": "catalog:",
"@tanstack/react-router-ssr-query": "catalog:",
"@tanstack/react-start": "catalog:",
"@ueberbrot/effect-api-query": "workspace:*",
"effect": "catalog:",
"effect-api-query": "workspace:*",
"react": "catalog:",
"react-dom": "catalog:"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { User } from '@effect-api-query/contracts'
import { useQuery } from '@tanstack/react-query'
import { skipToken } from 'effect-api-query'
import { skipToken } from '@ueberbrot/effect-api-query'
import { useState } from 'react'

import type { TanStackStartApplication } from '../lib/application.ts'
Expand Down
8 changes: 6 additions & 2 deletions examples/tanstack-start/src/lib/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ import { exampleHttpApi, exampleRpcGroup } from '@effect-api-query/contracts'
import { startExampleRpcClient } from '@effect-api-query/contracts/client'
import type { ExampleRpcClient, StartedExampleRpcClient } from '@effect-api-query/contracts/client'
import { QueryClient } from '@tanstack/react-query'
import {
createHttpApiQueryUtils,
createRpcQueryUtils,
fetchStreamSnapshot,
} from '@ueberbrot/effect-api-query'
import type { RunPromiseExit } from '@ueberbrot/effect-api-query'
import { Effect, Layer, ManagedRuntime } from 'effect'
import { createHttpApiQueryUtils, createRpcQueryUtils, fetchStreamSnapshot } from 'effect-api-query'
import type { RunPromiseExit } from 'effect-api-query'
import { FetchHttpClient, HttpClient, HttpClientRequest } from 'effect/http'
import { HttpApiClient } from 'effect/http-api'

Expand Down
2 changes: 1 addition & 1 deletion examples/tanstack-start/tests/server-render.test.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { startExampleRpcServer } from '@effect-api-query/server'
import { QueryClient } from '@tanstack/react-query'
import { createMemoryHistory, RouterProvider } from '@tanstack/react-router'
import { createRpcQueryUtils, fetchStreamSnapshot } from '@ueberbrot/effect-api-query'
import { Deferred, Effect, Exit, Schema, Scope, Stream } from 'effect'
import { createRpcQueryUtils, fetchStreamSnapshot } from 'effect-api-query'
import { Rpc, RpcGroup } from 'effect/rpc'
import type { RpcClient } from 'effect/rpc'
import { renderToString } from 'react-dom/server'
Expand Down
Loading
Loading