@sjcx/vorma 0.0.0-pre.2 → 0.0.0-pre.3
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/build/assemble-artifacts.d.ts +1 -1
- package/dist/build/bundle-client.d.ts +1 -1
- package/dist/build/cli.js +27 -37
- package/dist/build/compile-application.d.ts +2 -2
- package/dist/build/development-artifacts.d.ts +1 -1
- package/dist/build/development-build.d.ts +3 -6
- package/dist/build/development-work.d.ts +2 -3
- package/dist/build/generate-application.d.ts +2 -2
- package/dist/build/index.d.ts +2 -3
- package/dist/build/index.js +1 -1
- package/dist/build/inspect-projects.d.ts +3 -3
- package/dist/build/load-config.d.ts +0 -2
- package/dist/build/publish-artifacts.d.ts +1 -4
- package/dist/build/render-client-transport.d.ts +1 -1
- package/dist/build/render-server-generated.d.ts +1 -12
- package/dist/build/render-types.d.ts +1 -1
- package/dist/build/resolve-config.d.ts +2 -4
- package/dist/build/source-layout.d.ts +1 -1
- package/dist/{build-DcP5_DUV.js → build-sHSh5zaX.js} +67 -282
- package/package.json +5 -36
- package/dist/build/compile-server.d.ts +0 -42
- package/dist/client/assembly.d.ts +0 -40
- package/dist/client/browser-http-client.d.ts +0 -10
- package/dist/client/client-loaders.d.ts +0 -93
- package/dist/client/commit.d.ts +0 -41
- package/dist/client/contracts.d.ts +0 -192
- package/dist/client/core.d.ts +0 -45
- package/dist/client/development.d.ts +0 -16
- package/dist/client/document-recovery.d.ts +0 -4
- package/dist/client/endpoints.d.ts +0 -54
- package/dist/client/errors.d.ts +0 -87
- package/dist/client/freshness.d.ts +0 -51
- package/dist/client/head.d.ts +0 -14
- package/dist/client/history.d.ts +0 -25
- package/dist/client/index.d.ts +0 -80
- package/dist/client/index.js +0 -150
- package/dist/client/links.d.ts +0 -48
- package/dist/client/materialize.d.ts +0 -21
- package/dist/client/modules.d.ts +0 -2
- package/dist/client/navigation.d.ts +0 -47
- package/dist/client/payload.d.ts +0 -54
- package/dist/client/prefetch.d.ts +0 -28
- package/dist/client/prepare.d.ts +0 -47
- package/dist/client/projections.d.ts +0 -26
- package/dist/client/queries.d.ts +0 -33
- package/dist/client/react/application.d.ts +0 -87
- package/dist/client/react/hooks.d.ts +0 -36
- package/dist/client/react/index.d.ts +0 -5
- package/dist/client/react/index.js +0 -3237
- package/dist/client/react/link.d.ts +0 -27
- package/dist/client/react/view.d.ts +0 -86
- package/dist/client/request.d.ts +0 -16
- package/dist/client/route-context.d.ts +0 -31
- package/dist/client/route-matching.d.ts +0 -22
- package/dist/client/route-synchronization.d.ts +0 -30
- package/dist/client/route-url.d.ts +0 -5
- package/dist/client/runtime.d.ts +0 -82
- package/dist/client/scroll.d.ts +0 -16
- package/dist/client/services.d.ts +0 -34
- package/dist/client/state.d.ts +0 -102
- package/dist/client/static-assets.d.ts +0 -3
- package/dist/client/stylesheets.d.ts +0 -7
- package/dist/client/transport-type-entries.d.ts +0 -2
- package/dist/client/types.d.ts +0 -152
- package/dist/client/view-definition.d.ts +0 -24
- package/dist/client/work-indicator.d.ts +0 -18
- package/dist/compile-Me8EOyMK.js +0 -870
- package/dist/development-B_rxuwY7.js +0 -128
- package/dist/hash-set-BPx3iXec.js +0 -141
- package/dist/href-Cqyax8Y0.js +0 -357
- package/dist/materialize-DZ7VSLFk.js +0 -739
- package/dist/metadata-BoPKo-G2.js +0 -32
- package/dist/primitives/tasks/index.d.ts +0 -1
- package/dist/primitives/tasks/index.js +0 -1
- package/dist/route-context-CtY_9U_W.js +0 -559
- package/dist/route-matching-D_uSG2P9.js +0 -33
- package/dist/search-parse-0f7oqVsG.js +0 -375
- package/dist/server/config/index.d.ts +0 -36
- package/dist/server/config/index.js +0 -30
- package/dist/server/development/metadata.d.ts +0 -11
- package/dist/server/document.d.ts +0 -37
- package/dist/server/form-data.d.ts +0 -21
- package/dist/server/graph/compile.d.ts +0 -118
- package/dist/server/graph/declarations.d.ts +0 -117
- package/dist/server/graph/literal-error-tag.d.ts +0 -14
- package/dist/server/graph/pattern-conflicts.d.ts +0 -36
- package/dist/server/graph/search-schema.d.ts +0 -13
- package/dist/server/graph/transport-schema.d.ts +0 -11
- package/dist/server/index.d.ts +0 -310
- package/dist/server/index.js +0 -2311
- package/dist/server/public-assets.d.ts +0 -18
- package/dist/server/runtime/application.d.ts +0 -15
- package/dist/server/runtime/assets.d.ts +0 -15
- package/dist/server/runtime/context.d.ts +0 -96
- package/dist/server/runtime/domain-errors.d.ts +0 -11
- package/dist/server/runtime/effects.d.ts +0 -83
- package/dist/server/runtime/execute.d.ts +0 -13
- package/dist/server/runtime/finalize.d.ts +0 -44
- package/dist/server/runtime/handler.d.ts +0 -106
- package/dist/server/runtime/head.d.ts +0 -22
- package/dist/server/runtime/payload.d.ts +0 -50
- package/dist/server/runtime/pipeline.d.ts +0 -27
- package/dist/server/runtime/plan.d.ts +0 -98
- package/dist/server/runtime/render-document.d.ts +0 -16
- package/dist/server/runtime/startup-error.d.ts +0 -11
- package/dist/server/runtime/transport-type-entries.d.ts +0 -2
- package/dist/server/runtime/vercel-deployment.d.ts +0 -2
- package/dist/server/url-pathname.d.ts +0 -13
- package/dist/static-assets-BrH3O0M8.js +0 -199
- package/dist/universal/generated-types.d.ts +0 -9
- package/dist/universal/href.d.ts +0 -17
- package/dist/universal/http-method.d.ts +0 -4
- package/dist/universal/json-transport.d.ts +0 -14
- package/dist/universal/null-prototype-record.d.ts +0 -7
- package/dist/universal/path-wire.d.ts +0 -71
- package/dist/universal/pattern-language.d.ts +0 -4
- package/dist/universal/protocol-schemas.d.ts +0 -99
- package/dist/universal/protocol.d.ts +0 -162
- package/dist/universal/search-grammar.d.ts +0 -7
- package/dist/universal/search-parse.d.ts +0 -22
- package/dist/universal/search-serialize.d.ts +0 -16
- package/dist/universal/search-shape.d.ts +0 -32
- package/dist/universal/static-assets.d.ts +0 -2
- package/dist/universal/transport-types/big-decimal.d.ts +0 -13
- package/dist/universal/transport-types/chunk.d.ts +0 -8
- package/dist/universal/transport-types/date-time-utc.d.ts +0 -13
- package/dist/universal/transport-types/date-time-zoned.d.ts +0 -13
- package/dist/universal/transport-types/duration.d.ts +0 -13
- package/dist/universal/transport-types/hash-map.d.ts +0 -8
- package/dist/universal/transport-types/hash-set.d.ts +0 -8
- package/dist/universal/transport-types/option.d.ts +0 -10
- package/dist/universal/transport-types/redacted.d.ts +0 -9
- package/dist/universal/value-transport.d.ts +0 -117
- package/dist/value-transport-Bst4Hk-n.js +0 -864
- /package/dist/{universal → build}/content-digest.d.ts +0 -0
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { Effect, Exit, Layer } from "effect";
|
|
2
|
-
import type { Duration, Schedule } from "effect";
|
|
3
|
-
import type { ClientCore } from "./core.ts";
|
|
4
|
-
import type { RevalidationError } from "./errors.ts";
|
|
5
|
-
import { type NavigationOwner } from "./navigation.ts";
|
|
6
|
-
import { type PrefetchOwner } from "./prefetch.ts";
|
|
7
|
-
import { type PrepareRequestFn } from "./request.ts";
|
|
8
|
-
import { type ClientCoordinatorService } from "./runtime.ts";
|
|
9
|
-
import type { ClientBootError } from "./types.ts";
|
|
10
|
-
import { type WorkIndicatorOptions } from "./work-indicator.ts";
|
|
11
|
-
export type ClientApplicationOptions = {
|
|
12
|
-
readonly workIndicator?: WorkIndicatorOptions;
|
|
13
|
-
readonly clientOnlyServices?: Layer.Layer<unknown, unknown, unknown>;
|
|
14
|
-
readonly universalServices?: Layer.Layer<unknown, unknown>;
|
|
15
|
-
readonly browserProgram?: Effect.Effect<unknown, unknown, unknown>;
|
|
16
|
-
readonly prepareRequestFn?: PrepareRequestFn<unknown>;
|
|
17
|
-
readonly revalidateOnWindowFocus?: {
|
|
18
|
-
readonly staleTime: Duration.Input;
|
|
19
|
-
readonly skipWorkIndicator?: boolean;
|
|
20
|
-
};
|
|
21
|
-
readonly enableViewTransitions?: boolean;
|
|
22
|
-
/** Runs a failed refresh attempt again under this schedule; without one a failed refresh fails once. */
|
|
23
|
-
readonly refreshRetrySchedule?: Schedule.Schedule<unknown, RevalidationError>;
|
|
24
|
-
};
|
|
25
|
-
export type ClientApplication = {
|
|
26
|
-
readonly core: ClientCore;
|
|
27
|
-
readonly coordinator: ClientCoordinatorService;
|
|
28
|
-
readonly navigation: NavigationOwner;
|
|
29
|
-
readonly prefetch: PrefetchOwner;
|
|
30
|
-
/** Remains readable after disposal closes the atom registry. */
|
|
31
|
-
checkDisposed(): boolean;
|
|
32
|
-
boot(): Promise<Exit.Exit<void, ClientBootError>>;
|
|
33
|
-
dispose(): Promise<void>;
|
|
34
|
-
};
|
|
35
|
-
export declare function createClientApplication(input: {
|
|
36
|
-
readonly options: ClientApplicationOptions;
|
|
37
|
-
readonly scheduleTaskFn: (task: () => void) => () => void;
|
|
38
|
-
readonly renderFn: (rootElement: HTMLElement) => void;
|
|
39
|
-
readonly disposeRendererFn: () => void;
|
|
40
|
-
}): ClientApplication;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Effect } from "effect";
|
|
2
|
-
import type { Scope } from "effect";
|
|
3
|
-
import { type HttpClientRequest, type HttpClientResponse, type HttpClientError } from "effect/unstable/http";
|
|
4
|
-
/** Executes a framework request with native Fetch controls and its caller's scope. */
|
|
5
|
-
export declare function executeBrowserRequest(request: HttpClientRequest.HttpClientRequest): Effect.Effect<{
|
|
6
|
-
readonly response: HttpClientResponse.HttpClientResponse;
|
|
7
|
-
readonly followedUrl: string | undefined;
|
|
8
|
-
}, HttpClientError.HttpClientError, Scope.Scope>;
|
|
9
|
-
/** The observed redirect destination, excluding Vorma's route query keys. */
|
|
10
|
-
export declare function findFollowedRedirect(followedUrl: string | undefined, requested: URL): string | null;
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { Cause, Deferred, Effect, Fiber, Option, type Scope } from "effect";
|
|
2
|
-
import { AsyncResult } from "effect/unstable/reactivity";
|
|
3
|
-
import type { ClientCore } from "./core.ts";
|
|
4
|
-
import type { MaterializedRoute } from "./materialize.ts";
|
|
5
|
-
import type { DecodedRoute } from "./payload.ts";
|
|
6
|
-
import type { createLearnedMatcher, parseSearch } from "./route-matching.ts";
|
|
7
|
-
import type { RouteActivation } from "./services.ts";
|
|
8
|
-
import type { ViewDefinition } from "./view-definition.ts";
|
|
9
|
-
export type ClientLoaderTrigger = "boot" | "navigation" | "revalidation" | "prefetch";
|
|
10
|
-
export type KnownMatch = {
|
|
11
|
-
readonly pattern: string;
|
|
12
|
-
readonly params: Readonly<Record<string, string>>;
|
|
13
|
-
readonly splatValues: ReadonlyArray<string>;
|
|
14
|
-
readonly input: unknown;
|
|
15
|
-
};
|
|
16
|
-
export type EligibleMatch = {
|
|
17
|
-
readonly match: KnownMatch;
|
|
18
|
-
readonly view: ViewDefinition | undefined;
|
|
19
|
-
};
|
|
20
|
-
/** The one server result every client loader of a candidate selects from. */
|
|
21
|
-
export type ServerConfirmation = ReadonlyArray<DecodedRoute>;
|
|
22
|
-
export declare function toKnownMatch(route: DecodedRoute): KnownMatch;
|
|
23
|
-
export type ClientLoaderContext = {
|
|
24
|
-
readonly trigger: ClientLoaderTrigger;
|
|
25
|
-
readonly href: string;
|
|
26
|
-
readonly historyState: unknown;
|
|
27
|
-
readonly pattern: string;
|
|
28
|
-
readonly params: Readonly<Record<string, string>>;
|
|
29
|
-
readonly splatValues: ReadonlyArray<string>;
|
|
30
|
-
readonly input: unknown;
|
|
31
|
-
readonly knownRouteMatches: ReadonlyArray<KnownMatch>;
|
|
32
|
-
readonly serverConfirmedRouteMatches: Effect.Effect<ReadonlyArray<KnownMatch>>;
|
|
33
|
-
readonly loaderData: Effect.Effect<unknown>;
|
|
34
|
-
readonly getLoaderData: (pattern: string) => Effect.Effect<Option.Option<unknown>>;
|
|
35
|
-
};
|
|
36
|
-
export type ClientLoaderFn = (context: ClientLoaderContext) => Effect.Effect<unknown, unknown, unknown>;
|
|
37
|
-
export type StartedClientLoader = {
|
|
38
|
-
readonly pattern: string;
|
|
39
|
-
readonly fiber: Fiber.Fiber<unknown, unknown>;
|
|
40
|
-
};
|
|
41
|
-
/** The functions of `route-matching.ts` that the registry calls once the module has loaded. */
|
|
42
|
-
export type RouteMatchingModule = {
|
|
43
|
-
readonly createLearnedMatcher: typeof createLearnedMatcher;
|
|
44
|
-
readonly parseSearch: typeof parseSearch;
|
|
45
|
-
};
|
|
46
|
-
export type ClientLoaderRegistry = {
|
|
47
|
-
readonly replaceViewsFn: (replacements: ReadonlyMap<unknown, unknown>) => void;
|
|
48
|
-
readonly recordConfirmedChain: (input: {
|
|
49
|
-
readonly url: URL;
|
|
50
|
-
readonly routes: ReadonlyArray<MaterializedRoute>;
|
|
51
|
-
}) => void;
|
|
52
|
-
/** Installs the matching module once it has loaded; until then nothing starts early. */
|
|
53
|
-
readonly installMatching: (module: RouteMatchingModule) => void;
|
|
54
|
-
/** The proven chain prefix for `url`, with each position's search input parsed but not validated. */
|
|
55
|
-
readonly findEligibleMatches: (url: URL) => ReadonlyArray<EligibleMatch>;
|
|
56
|
-
};
|
|
57
|
-
export declare function createClientLoaderRegistry(): ClientLoaderRegistry;
|
|
58
|
-
/** Forks one client loader into the current scope, joined to its candidate's server result. */
|
|
59
|
-
export declare function startClientLoader(provideClientFn: ClientCore["provideClient"], input: {
|
|
60
|
-
readonly clientLoader: ClientLoaderFn;
|
|
61
|
-
readonly trigger: ClientLoaderTrigger;
|
|
62
|
-
readonly href: string;
|
|
63
|
-
readonly historyState: unknown;
|
|
64
|
-
readonly match: KnownMatch;
|
|
65
|
-
readonly known: ReadonlyArray<KnownMatch>;
|
|
66
|
-
readonly confirmation: Deferred.Deferred<ServerConfirmation>;
|
|
67
|
-
readonly activation: RouteActivation | undefined;
|
|
68
|
-
}): Effect.Effect<StartedClientLoader, never, Scope.Scope>;
|
|
69
|
-
export type ClientLoaderOutcome = {
|
|
70
|
-
/** Each settled client loader's result by route position; a position whose loader did not settle has no entry. */
|
|
71
|
-
readonly results: ReadonlyMap<number, AsyncResult.AsyncResult<unknown, unknown>>;
|
|
72
|
-
readonly failure: {
|
|
73
|
-
readonly index: number;
|
|
74
|
-
readonly pattern: string;
|
|
75
|
-
readonly cause: Cause.Cause<unknown>;
|
|
76
|
-
} | null;
|
|
77
|
-
};
|
|
78
|
-
export type RunningClientLoader = {
|
|
79
|
-
readonly index: number;
|
|
80
|
-
readonly pattern: string;
|
|
81
|
-
readonly fiber: Fiber.Fiber<unknown, unknown>;
|
|
82
|
-
};
|
|
83
|
-
/** One route of a candidate with the activation its client loader runs under. */
|
|
84
|
-
export type ClientLoaderPosition = {
|
|
85
|
-
readonly route: MaterializedRoute;
|
|
86
|
-
readonly activation: RouteActivation | undefined;
|
|
87
|
-
};
|
|
88
|
-
/**
|
|
89
|
-
* Collects loader outcomes and reports the earliest failure in route order.
|
|
90
|
-
* The preparation owner observes failures and interrupts later work as soon
|
|
91
|
-
* as each loader starts, including before this collection begins.
|
|
92
|
-
*/
|
|
93
|
-
export declare function awaitClientLoaders(publishEventFn: ClientCore["publishEvent"], running: ReadonlyArray<RunningClientLoader>): Effect.Effect<ClientLoaderOutcome>;
|
package/dist/client/commit.d.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { Result, Scope } from "effect";
|
|
2
|
-
import type { ClientCore } from "./core.ts";
|
|
3
|
-
import { NavigationError } from "./errors.ts";
|
|
4
|
-
import { type HeadSections } from "./head.ts";
|
|
5
|
-
import { type BrowserPosition } from "./history.ts";
|
|
6
|
-
import type { ScrollTarget } from "./scroll.ts";
|
|
7
|
-
import type { Frame, RouteEntry, RouteErrorState } from "./state.ts";
|
|
8
|
-
import type { RouteUpdateReason } from "./types.ts";
|
|
9
|
-
export type ScrollIntent = {
|
|
10
|
-
readonly target: ScrollTarget;
|
|
11
|
-
/** The entry whose render must exist before the scroll applies. */
|
|
12
|
-
readonly entryIndex: number;
|
|
13
|
-
};
|
|
14
|
-
export type CommitPosition = {
|
|
15
|
-
readonly kind: "write";
|
|
16
|
-
readonly href: string;
|
|
17
|
-
readonly replace: boolean;
|
|
18
|
-
readonly userState: unknown;
|
|
19
|
-
readonly key: string;
|
|
20
|
-
} | {
|
|
21
|
-
readonly kind: "adopt";
|
|
22
|
-
readonly position: BrowserPosition;
|
|
23
|
-
};
|
|
24
|
-
export type CommitInput = {
|
|
25
|
-
readonly reason: RouteUpdateReason;
|
|
26
|
-
readonly entries: ReadonlyArray<RouteEntry>;
|
|
27
|
-
readonly error: RouteErrorState | null;
|
|
28
|
-
readonly head: HeadSections;
|
|
29
|
-
readonly cssBundles: ReadonlyArray<string>;
|
|
30
|
-
/** Whether this commit updates the document or adopts its server-rendered state. */
|
|
31
|
-
readonly documentUpdate: "apply" | "adopt";
|
|
32
|
-
readonly position: CommitPosition;
|
|
33
|
-
readonly scrollIntent: ScrollIntent | undefined;
|
|
34
|
-
/** When the entries' data was read; a commit that reuses data keeps that time. */
|
|
35
|
-
readonly committedAt: number | undefined;
|
|
36
|
-
/** The scope that holds the entries' activations. */
|
|
37
|
-
readonly scope: Scope.Closeable;
|
|
38
|
-
};
|
|
39
|
-
export type CommitDependencies = Pick<ClientCore, "getState" | "updateState" | "publishEvent" | "getClientBuildId" | "forkFiber">;
|
|
40
|
-
/** Accepts a prepared route as the committed frame. Callers hold the uninterruptible region. */
|
|
41
|
-
export declare function commitFrame(core: CommitDependencies, input: CommitInput): Result.Result<Frame, NavigationError>;
|
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
import type { Effect, Option } from "effect";
|
|
2
|
-
import type { AsyncResult } from "effect/unstable/reactivity";
|
|
3
|
-
import type { MissingGeneratedApplicationKey } from "../universal/generated-types.ts";
|
|
4
|
-
import type { ClientApplicationContracts } from "./index.ts";
|
|
5
|
-
type UiContract = {
|
|
6
|
-
readonly input: unknown;
|
|
7
|
-
readonly output: unknown;
|
|
8
|
-
readonly search: unknown;
|
|
9
|
-
readonly clientLoader: {
|
|
10
|
-
readonly success: unknown;
|
|
11
|
-
readonly error: unknown;
|
|
12
|
-
readonly requirements: unknown;
|
|
13
|
-
} | undefined;
|
|
14
|
-
};
|
|
15
|
-
type EndpointContract = {
|
|
16
|
-
readonly kind: "query" | "mutation" | "stream";
|
|
17
|
-
readonly input: unknown;
|
|
18
|
-
readonly output: unknown;
|
|
19
|
-
readonly errors: unknown;
|
|
20
|
-
};
|
|
21
|
-
type RegisteredUiContracts = ClientApplicationContracts extends {
|
|
22
|
-
readonly ui: infer Contracts;
|
|
23
|
-
} ? Contracts : Readonly<Record<MissingGeneratedApplicationKey, UiContract>>;
|
|
24
|
-
type RegisteredEndpointContracts = ClientApplicationContracts extends {
|
|
25
|
-
readonly endpoints: infer Contracts;
|
|
26
|
-
} ? Contracts : Readonly<Record<MissingGeneratedApplicationKey, EndpointContract>>;
|
|
27
|
-
export type RoutePattern = Extract<keyof RegisteredUiContracts, string>;
|
|
28
|
-
type PatternParameterName<Pattern extends string> = Pattern extends `${infer Segment}/${infer Rest}` ? SegmentParameterName<Segment> | PatternParameterName<Rest> : SegmentParameterName<Pattern>;
|
|
29
|
-
type SegmentParameterName<Segment extends string> = Segment extends `:${infer Name}` ? Name : never;
|
|
30
|
-
export type PatternParams<Pattern extends string> = [
|
|
31
|
-
PatternParameterName<Pattern>
|
|
32
|
-
] extends [never] ? {
|
|
33
|
-
readonly params?: never;
|
|
34
|
-
} : {
|
|
35
|
-
readonly params: Readonly<Record<PatternParameterName<Pattern>, string>>;
|
|
36
|
-
};
|
|
37
|
-
export type PatternSplat<Pattern extends string> = Pattern extends `${string}/*` ? {
|
|
38
|
-
readonly splatValues: ReadonlyArray<string>;
|
|
39
|
-
} : {
|
|
40
|
-
readonly splatValues?: never;
|
|
41
|
-
};
|
|
42
|
-
export type LoaderRoutePattern = {
|
|
43
|
-
[Pattern in RoutePattern]: RegisteredUiContracts[Pattern] extends {
|
|
44
|
-
readonly output: infer Output;
|
|
45
|
-
} ? [Output] extends [undefined] ? never : Pattern : never;
|
|
46
|
-
}[RoutePattern];
|
|
47
|
-
/** The decoded server loader output of a route; `undefined` for a route without a loader. */
|
|
48
|
-
export type LoaderData<Pattern extends RoutePattern> = RegisteredUiContracts[Pattern] extends {
|
|
49
|
-
readonly output: infer Output;
|
|
50
|
-
} ? Output : never;
|
|
51
|
-
export type RouteInput<Pattern extends RoutePattern> = RegisteredUiContracts[Pattern] extends {
|
|
52
|
-
readonly input: infer Input;
|
|
53
|
-
} ? Input : undefined;
|
|
54
|
-
export type RouteMatch<Pattern extends RoutePattern> = {
|
|
55
|
-
readonly pattern: Pattern;
|
|
56
|
-
readonly params: Readonly<Record<PatternParameterName<Pattern>, string>>;
|
|
57
|
-
readonly splatValues: ReadonlyArray<string>;
|
|
58
|
-
readonly input: RouteInput<Pattern>;
|
|
59
|
-
};
|
|
60
|
-
export type AnyRouteMatch = {
|
|
61
|
-
[Pattern in RoutePattern]: RouteMatch<Pattern>;
|
|
62
|
-
}[RoutePattern];
|
|
63
|
-
export type ClientLoaderRoutePattern = {
|
|
64
|
-
[Pattern in RoutePattern]: RegisteredUiContracts[Pattern] extends {
|
|
65
|
-
readonly clientLoader: {
|
|
66
|
-
readonly success: unknown;
|
|
67
|
-
readonly error: unknown;
|
|
68
|
-
readonly requirements: unknown;
|
|
69
|
-
};
|
|
70
|
-
} ? Pattern : never;
|
|
71
|
-
}[RoutePattern];
|
|
72
|
-
export type ClientLoaderData<Pattern extends ClientLoaderRoutePattern> = RegisteredUiContracts[Pattern] extends {
|
|
73
|
-
readonly clientLoader: {
|
|
74
|
-
readonly success: infer Success;
|
|
75
|
-
};
|
|
76
|
-
} ? Success : never;
|
|
77
|
-
export type ClientLoaderState<Pattern extends ClientLoaderRoutePattern> = RegisteredUiContracts[Pattern] extends {
|
|
78
|
-
readonly clientLoader: {
|
|
79
|
-
readonly success: infer Success;
|
|
80
|
-
readonly error: infer Error;
|
|
81
|
-
readonly requirements: unknown;
|
|
82
|
-
};
|
|
83
|
-
} ? AsyncResult.AsyncResult<Success, Error> : never;
|
|
84
|
-
type RequiredKeys<Value> = Value extends object ? {
|
|
85
|
-
[Key in keyof Value]-?: {} extends Pick<Value, Key> ? never : Key;
|
|
86
|
-
}[keyof Value] : never;
|
|
87
|
-
type RouteInputField<Pattern extends RoutePattern> = RegisteredUiContracts[Pattern] extends {
|
|
88
|
-
readonly search: infer Search;
|
|
89
|
-
} ? [Search] extends [undefined] ? {
|
|
90
|
-
readonly input?: never;
|
|
91
|
-
} : RequiredKeys<Search> extends never ? {
|
|
92
|
-
readonly input?: Search;
|
|
93
|
-
} : {
|
|
94
|
-
readonly input: Search;
|
|
95
|
-
} : {
|
|
96
|
-
readonly input?: never;
|
|
97
|
-
};
|
|
98
|
-
type DestinationPattern<Pattern extends string> = Pattern extends `${infer Prefix}/_index` ? Pattern | (Prefix extends "" ? "/" : Prefix) : Pattern;
|
|
99
|
-
type PatternRouteTarget<Pattern extends RoutePattern> = Pattern extends string ? {
|
|
100
|
-
readonly href?: never;
|
|
101
|
-
readonly pattern: DestinationPattern<Pattern>;
|
|
102
|
-
readonly hash?: string;
|
|
103
|
-
} & PatternParams<Pattern> & PatternSplat<Pattern> & RouteInputField<Pattern> : never;
|
|
104
|
-
export type RawHrefTarget = {
|
|
105
|
-
readonly href: string;
|
|
106
|
-
readonly pattern?: never;
|
|
107
|
-
readonly params?: never;
|
|
108
|
-
readonly splatValues?: never;
|
|
109
|
-
readonly input?: never;
|
|
110
|
-
readonly hash?: never;
|
|
111
|
-
};
|
|
112
|
-
/** A generated pattern target, or a raw href when no pattern is selected. */
|
|
113
|
-
export type RouteTarget<Pattern extends RoutePattern | undefined = undefined> = Pattern extends RoutePattern ? PatternRouteTarget<Pattern> : PatternRouteTarget<RoutePattern> | RawHrefTarget;
|
|
114
|
-
export type RouteUrlInput = PatternRouteTarget<RoutePattern>;
|
|
115
|
-
/** A target as a command receives it: a pattern target or a raw href. */
|
|
116
|
-
export type NavigationTargetInput = RouteUrlInput | RawHrefTarget;
|
|
117
|
-
export type EndpointRequestOptions = Omit<RequestInit, "method" | "body" | "signal">;
|
|
118
|
-
/** The runtime representation of an endpoint call after its public contract is checked. */
|
|
119
|
-
export type EndpointCallInput = {
|
|
120
|
-
readonly method: string;
|
|
121
|
-
readonly pattern: string;
|
|
122
|
-
readonly params?: Readonly<Record<string, string>>;
|
|
123
|
-
readonly splatValues?: ReadonlyArray<string>;
|
|
124
|
-
readonly input?: unknown;
|
|
125
|
-
readonly body?: never;
|
|
126
|
-
readonly skipWorkIndicator?: boolean;
|
|
127
|
-
readonly skipAutoRevalidate?: boolean;
|
|
128
|
-
readonly requestOptions?: EndpointRequestOptions;
|
|
129
|
-
/** A later call with the same key cancels this call's request while it is unfinished. */
|
|
130
|
-
readonly dedupeKey?: string;
|
|
131
|
-
};
|
|
132
|
-
type EndpointInput<Contract, Method extends string> = Contract extends {
|
|
133
|
-
readonly input: infer Input;
|
|
134
|
-
} ? [Input] extends [undefined] ? {
|
|
135
|
-
readonly input?: never;
|
|
136
|
-
} : {
|
|
137
|
-
readonly input: Input | (Method extends "GET" ? FormData : never);
|
|
138
|
-
} : {
|
|
139
|
-
readonly input?: never;
|
|
140
|
-
};
|
|
141
|
-
type RegisteredEndpointCallInput<Kind extends "query" | "mutation"> = {
|
|
142
|
-
[Identity in Extract<keyof RegisteredEndpointContracts, string>]: RegisteredEndpointContracts[Identity] extends {
|
|
143
|
-
readonly kind: Kind;
|
|
144
|
-
} ? Identity extends `${infer Method} ${infer Pattern}` ? {
|
|
145
|
-
readonly method: Method;
|
|
146
|
-
readonly body?: never;
|
|
147
|
-
readonly pattern: Pattern;
|
|
148
|
-
readonly skipWorkIndicator?: boolean;
|
|
149
|
-
readonly requestOptions?: EndpointRequestOptions;
|
|
150
|
-
/** A later call with the same key cancels this call's request while it is unfinished. */
|
|
151
|
-
readonly dedupeKey?: string;
|
|
152
|
-
} & (Kind extends "mutation" ? {
|
|
153
|
-
readonly skipAutoRevalidate?: boolean;
|
|
154
|
-
} : {}) & PatternParams<Pattern> & PatternSplat<Pattern> & EndpointInput<RegisteredEndpointContracts[Identity], Method> : never : never;
|
|
155
|
-
}[Extract<keyof RegisteredEndpointContracts, string>];
|
|
156
|
-
type EndpointCallInputFor<Kind extends "query" | "mutation"> = ClientApplicationContracts extends {
|
|
157
|
-
readonly endpoints: unknown;
|
|
158
|
-
} ? RegisteredEndpointCallInput<Kind> : EndpointCallInput & {
|
|
159
|
-
readonly pattern: MissingGeneratedApplicationKey;
|
|
160
|
-
};
|
|
161
|
-
export type QueryEndpointCallInput = EndpointCallInputFor<"query">;
|
|
162
|
-
export type MutationEndpointCallInput = EndpointCallInputFor<"mutation">;
|
|
163
|
-
export type EndpointCallOutput<Input extends EndpointCallInput> = ClientApplicationContracts extends {
|
|
164
|
-
readonly endpoints: infer Contracts;
|
|
165
|
-
} ? `${Input["method"]} ${Input["pattern"]}` extends infer Identity extends keyof Contracts ? Contracts[Identity] extends {
|
|
166
|
-
readonly output: infer Output;
|
|
167
|
-
} ? Output : never : never : never;
|
|
168
|
-
/**
|
|
169
|
-
* An operation's complete failure channel: the given framework failures plus
|
|
170
|
-
* the operation's declared domain errors, each as the record of its fields
|
|
171
|
-
* the server transported.
|
|
172
|
-
*/
|
|
173
|
-
export type EndpointCallFailure<Input extends EndpointCallInput, Base> = ClientApplicationContracts extends {
|
|
174
|
-
readonly endpoints: infer Contracts;
|
|
175
|
-
} ? `${Input["method"]} ${Input["pattern"]}` extends infer Identity extends keyof Contracts ? Contracts[Identity] extends {
|
|
176
|
-
readonly errors: infer Errors;
|
|
177
|
-
} ? Base | Errors[keyof Errors] : Base : Base : Base;
|
|
178
|
-
/** What a client loader receives: candidate facts now, server results as Effects joined to the candidate. */
|
|
179
|
-
export type ClientLoaderContext<Pattern extends RoutePattern> = {
|
|
180
|
-
readonly trigger: "boot" | "navigation" | "revalidation" | "prefetch";
|
|
181
|
-
readonly href: string;
|
|
182
|
-
readonly historyState: unknown;
|
|
183
|
-
readonly pattern: Pattern;
|
|
184
|
-
readonly params: RouteMatch<Pattern>["params"];
|
|
185
|
-
readonly splatValues: RouteMatch<Pattern>["splatValues"];
|
|
186
|
-
readonly input: RouteInput<Pattern>;
|
|
187
|
-
readonly knownRouteMatches: ReadonlyArray<AnyRouteMatch>;
|
|
188
|
-
readonly serverConfirmedRouteMatches: Effect.Effect<ReadonlyArray<AnyRouteMatch>>;
|
|
189
|
-
readonly loaderData: Effect.Effect<LoaderData<Pattern>>;
|
|
190
|
-
readonly getLoaderData: <Target extends LoaderRoutePattern>(pattern: Target) => Effect.Effect<Option.Option<LoaderData<Target>>>;
|
|
191
|
-
};
|
|
192
|
-
export {};
|
package/dist/client/core.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { Deferred, Effect, Fiber, FiberSet, Layer, Scope, Stream } from "effect";
|
|
2
|
-
import type { HttpClientRequest } from "effect/unstable/http";
|
|
3
|
-
import type { AtomRegistry } from "effect/unstable/reactivity";
|
|
4
|
-
import type { ClientLoaderRegistry } from "./client-loaders.ts";
|
|
5
|
-
import type { ClientRequestContext } from "./request.ts";
|
|
6
|
-
import type { ClientUnavailableError } from "./runtime.ts";
|
|
7
|
-
import type { ActivationMap } from "./services.ts";
|
|
8
|
-
import type { ClientState } from "./state.ts";
|
|
9
|
-
import type { BuildMismatch, ClientEvent } from "./types.ts";
|
|
10
|
-
/**
|
|
11
|
-
* The application's owned facilities, built once by the assembly. Command
|
|
12
|
-
* modules receive the facilities that their operations require.
|
|
13
|
-
*/
|
|
14
|
-
export type ClientCore = {
|
|
15
|
-
readonly registry: AtomRegistry.AtomRegistry;
|
|
16
|
-
readonly scope: Scope.Closeable;
|
|
17
|
-
readonly memoMap: Layer.MemoMap;
|
|
18
|
-
/** Tracks dispatched mutations for application disposal; each caller also retains native cancellation. */
|
|
19
|
-
readonly mutationFibers: FiberSet.FiberSet<unknown, unknown>;
|
|
20
|
-
readonly events: Stream.Stream<ClientEvent>;
|
|
21
|
-
readonly publishEvent: (event: ClientEvent) => void;
|
|
22
|
-
readonly getState: () => ClientState;
|
|
23
|
-
readonly updateState: (updateFn: (state: ClientState) => ClientState) => void;
|
|
24
|
-
/** Forks application-owned work into the application scope. */
|
|
25
|
-
readonly forkFiber: <A, E>(effect: Effect.Effect<A, E>) => Fiber.Fiber<A, E>;
|
|
26
|
-
/** Advances the monotonic sequence and returns it; reads and demands are ordered by it, never by wall clock. */
|
|
27
|
-
readonly advanceSequence: () => number;
|
|
28
|
-
/** Settles when the current session generation is retired; reads of that generation race it. */
|
|
29
|
-
readonly getGenerationRetirement: () => Deferred.Deferred<void>;
|
|
30
|
-
/** Advances the session generation and retires the previous one. */
|
|
31
|
-
readonly retireGeneration: () => void;
|
|
32
|
-
readonly getClientBuildId: () => string;
|
|
33
|
-
readonly getDeploymentId: () => string | undefined;
|
|
34
|
-
/** Whether the document was served by the development server. */
|
|
35
|
-
readonly runsInDevelopmentMode: () => boolean;
|
|
36
|
-
readonly clientLoaders: ClientLoaderRegistry;
|
|
37
|
-
/** Runs the application request decorator with assembled services. */
|
|
38
|
-
readonly prepareRequest: (context: ClientRequestContext) => Effect.Effect<HttpClientRequest.HttpClientRequest, unknown>;
|
|
39
|
-
/** Runs an Effect with the application's client services; before boot assembles them, they are unavailable. */
|
|
40
|
-
readonly provideClient: <A, E>(effect: Effect.Effect<A, E, unknown>) => Effect.Effect<A, E | ClientUnavailableError>;
|
|
41
|
-
/** Records a mismatch in state and publishes `BuildMismatchDetected`. */
|
|
42
|
-
readonly reportBuildMismatch: (mismatch: BuildMismatch) => void;
|
|
43
|
-
/** Route service activations by key, reference counted by their owners' scopes. */
|
|
44
|
-
readonly activations: ActivationMap;
|
|
45
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Effect } from "effect";
|
|
2
|
-
import type { ClientCore } from "./core.ts";
|
|
3
|
-
import type { NavigationOwner } from "./navigation.ts";
|
|
4
|
-
declare global {
|
|
5
|
-
interface Window {
|
|
6
|
-
__vorma_development?: {
|
|
7
|
-
readonly revalidateFn: () => Promise<void>;
|
|
8
|
-
readonly updateModuleFn: (url: string, module: Readonly<Record<string, unknown>>) => void;
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
/** Applies accepted view updates through the existing frame publication and service lifetimes. */
|
|
13
|
-
export declare function installDevelopmentUpdates(input: {
|
|
14
|
-
readonly core: ClientCore;
|
|
15
|
-
readonly navigation: NavigationOwner;
|
|
16
|
-
}): Effect.Effect<void, never, never>;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { Cause } from "effect";
|
|
2
|
-
import type { ClientCore } from "./core.ts";
|
|
3
|
-
/** Loads the browser's current URL as a document after client navigation cannot complete. */
|
|
4
|
-
export declare function reloadDocument(core: Pick<ClientCore, "getState" | "updateState" | "publishEvent">, cause: Cause.Cause<unknown>): void;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { Effect } from "effect";
|
|
2
|
-
import { Headers } from "effect/unstable/http";
|
|
3
|
-
import { type RedirectStatus } from "../universal/protocol-schemas.ts";
|
|
4
|
-
import type { EndpointCallInput } from "./contracts.ts";
|
|
5
|
-
import type { ClientCore } from "./core.ts";
|
|
6
|
-
import { BuildMismatchError, CancelledByDedupeKeyError, HandlerError, InputError, NavigationError, RevalidationError, TransportError } from "./errors.ts";
|
|
7
|
-
import type { NavigationResult, OperationId, RevalidationResult } from "./types.ts";
|
|
8
|
-
export type ResponseMetadata = {
|
|
9
|
-
readonly status: number;
|
|
10
|
-
readonly headers: Headers.Headers;
|
|
11
|
-
};
|
|
12
|
-
export type QueryResponse<A> = {
|
|
13
|
-
readonly data: A;
|
|
14
|
-
readonly responseMetadata: ResponseMetadata;
|
|
15
|
-
};
|
|
16
|
-
export type EndpointRevalidation = Effect.Effect<RevalidationResult, RevalidationError>;
|
|
17
|
-
export type MutationSettlement<A> = {
|
|
18
|
-
readonly _tag: "Completed";
|
|
19
|
-
readonly operationId: OperationId;
|
|
20
|
-
readonly data: A;
|
|
21
|
-
readonly responseMetadata: ResponseMetadata;
|
|
22
|
-
readonly revalidation: EndpointRevalidation;
|
|
23
|
-
} | {
|
|
24
|
-
readonly _tag: "Redirected";
|
|
25
|
-
readonly operationId: OperationId;
|
|
26
|
-
readonly redirectUrl: string;
|
|
27
|
-
/** The status the server intended; `undefined` when the browser followed the redirect itself, so the client never saw it. */
|
|
28
|
-
readonly redirectStatus: RedirectStatus | undefined;
|
|
29
|
-
readonly responseMetadata: ResponseMetadata;
|
|
30
|
-
readonly revalidation: EndpointRevalidation;
|
|
31
|
-
};
|
|
32
|
-
export type EndpointFrameworkError = InputError | CancelledByDedupeKeyError | BuildMismatchError | TransportError | HandlerError;
|
|
33
|
-
/** What the endpoint path needs from navigation and freshness. */
|
|
34
|
-
export type EndpointDependencies = {
|
|
35
|
-
/** Registers a demand and returns the observation of that registered demand. */
|
|
36
|
-
readonly requireRefreshFn: (input: {
|
|
37
|
-
readonly skipWorkIndicator: boolean;
|
|
38
|
-
}) => EndpointRevalidation;
|
|
39
|
-
/** Starts a replace navigation to a same-origin redirect target and observes it. */
|
|
40
|
-
readonly redirectFn: (url: URL) => Effect.Effect<NavigationResult, NavigationError>;
|
|
41
|
-
readonly navigateDocumentFn: (href: string) => void;
|
|
42
|
-
readonly retireReusableFn: () => void;
|
|
43
|
-
};
|
|
44
|
-
export type DispatchFacts = {
|
|
45
|
-
readonly sequence: number;
|
|
46
|
-
readonly generation: number;
|
|
47
|
-
};
|
|
48
|
-
export type EndpointOperations = {
|
|
49
|
-
readonly query: (input: EndpointCallInput) => Effect.Effect<QueryResponse<unknown>, unknown>;
|
|
50
|
-
/** A query read that reports its dispatch sequence, for freshness acknowledgment. */
|
|
51
|
-
readonly read: (input: EndpointCallInput, reportDispatchFn: ((facts: DispatchFacts) => void) | undefined) => Effect.Effect<QueryResponse<unknown>, unknown>;
|
|
52
|
-
readonly mutate: (input: EndpointCallInput) => Effect.Effect<MutationSettlement<unknown>, unknown>;
|
|
53
|
-
};
|
|
54
|
-
export declare function createEndpointOperations(core: Pick<ClientCore, "updateState" | "getState" | "publishEvent" | "getClientBuildId" | "getDeploymentId" | "reportBuildMismatch" | "prepareRequest" | "provideClient" | "advanceSequence" | "getGenerationRetirement" | "activations" | "mutationFibers">, dependencies: EndpointDependencies): EndpointOperations;
|
package/dist/client/errors.d.ts
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { Cause, type Effect } from "effect";
|
|
2
|
-
import type { RedirectStatus } from "../universal/protocol-schemas.ts";
|
|
3
|
-
import type { NavigationResult, OperationId, PublicRouteError } from "./types.ts";
|
|
4
|
-
type CommandBoundary = {
|
|
5
|
-
readonly pattern: string;
|
|
6
|
-
readonly operationId?: OperationId;
|
|
7
|
-
readonly method?: string;
|
|
8
|
-
};
|
|
9
|
-
declare const InputError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => Cause.YieldableError & {
|
|
10
|
-
readonly _tag: "InputError";
|
|
11
|
-
} & Readonly<A>;
|
|
12
|
-
export declare class InputError extends InputError_base<CommandBoundary & {
|
|
13
|
-
readonly message: string;
|
|
14
|
-
readonly cause?: unknown;
|
|
15
|
-
}> {
|
|
16
|
-
}
|
|
17
|
-
declare const BuildMismatchError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => Cause.YieldableError & {
|
|
18
|
-
readonly _tag: "BuildMismatchError";
|
|
19
|
-
} & Readonly<A>;
|
|
20
|
-
export declare class BuildMismatchError extends BuildMismatchError_base<CommandBoundary & {
|
|
21
|
-
readonly message: string;
|
|
22
|
-
}> {
|
|
23
|
-
}
|
|
24
|
-
declare const TransportError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => Cause.YieldableError & {
|
|
25
|
-
readonly _tag: "TransportError";
|
|
26
|
-
} & Readonly<A>;
|
|
27
|
-
export declare class TransportError extends TransportError_base<CommandBoundary & {
|
|
28
|
-
readonly message: string;
|
|
29
|
-
readonly cause: unknown;
|
|
30
|
-
readonly status?: number;
|
|
31
|
-
}> {
|
|
32
|
-
}
|
|
33
|
-
declare const HandlerError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => Cause.YieldableError & {
|
|
34
|
-
readonly _tag: "HandlerError";
|
|
35
|
-
} & Readonly<A>;
|
|
36
|
-
export declare class HandlerError extends HandlerError_base<CommandBoundary & PublicRouteError> {
|
|
37
|
-
}
|
|
38
|
-
declare const CancelledByDedupeKeyError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => Cause.YieldableError & {
|
|
39
|
-
readonly _tag: "CancelledByDedupeKeyError";
|
|
40
|
-
} & Readonly<A>;
|
|
41
|
-
/** A later endpoint call with the same dedupe key cancelled this call's request. */
|
|
42
|
-
export declare class CancelledByDedupeKeyError extends CancelledByDedupeKeyError_base<CommandBoundary & {
|
|
43
|
-
readonly dedupeKey: string;
|
|
44
|
-
}> {
|
|
45
|
-
}
|
|
46
|
-
declare const NavigationError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => Cause.YieldableError & {
|
|
47
|
-
readonly _tag: "NavigationError";
|
|
48
|
-
} & Readonly<A>;
|
|
49
|
-
export declare class NavigationError extends NavigationError_base<{
|
|
50
|
-
readonly stage: "target" | "request" | "assets" | "transition" | "publication";
|
|
51
|
-
readonly cause: Cause.Cause<unknown>;
|
|
52
|
-
}> {
|
|
53
|
-
}
|
|
54
|
-
declare const RevalidationError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => Cause.YieldableError & {
|
|
55
|
-
readonly _tag: "RevalidationError";
|
|
56
|
-
} & Readonly<A>;
|
|
57
|
-
export declare class RevalidationError extends RevalidationError_base<{
|
|
58
|
-
readonly reason: "route" | "query" | "build-mismatch" | "superseded" | "disposed";
|
|
59
|
-
readonly cause: Cause.Cause<unknown>;
|
|
60
|
-
}> {
|
|
61
|
-
}
|
|
62
|
-
declare const PrefetchError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => Cause.YieldableError & {
|
|
63
|
-
readonly _tag: "PrefetchError";
|
|
64
|
-
} & Readonly<A>;
|
|
65
|
-
export declare class PrefetchError extends PrefetchError_base<{
|
|
66
|
-
/** `takenByNavigation`: a navigation took the preparation, so readiness is no longer observable. */
|
|
67
|
-
readonly reason: "target" | "unavailable" | "preparation" | "superseded" | "takenByNavigation";
|
|
68
|
-
readonly cause?: unknown;
|
|
69
|
-
}> {
|
|
70
|
-
}
|
|
71
|
-
/** The navigation a query redirect started, observable without repeating the query. */
|
|
72
|
-
export type QueryNavigation = Effect.Effect<NavigationResult, NavigationError>;
|
|
73
|
-
declare const QueryRedirected_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => Cause.YieldableError & {
|
|
74
|
-
readonly _tag: "QueryRedirected";
|
|
75
|
-
} & Readonly<A>;
|
|
76
|
-
export declare class QueryRedirected extends QueryRedirected_base<CommandBoundary & {
|
|
77
|
-
readonly redirectUrl: string;
|
|
78
|
-
/** The status the server intended; `undefined` when the browser followed the redirect itself. */
|
|
79
|
-
readonly redirectStatus: RedirectStatus | undefined;
|
|
80
|
-
readonly navigation: QueryNavigation;
|
|
81
|
-
}> {
|
|
82
|
-
}
|
|
83
|
-
/** The sanitized presentation of any failure: explicit public fields, or a generic 500. */
|
|
84
|
-
export declare function sanitizeRouteError(error: unknown): PublicRouteError;
|
|
85
|
-
/** Recognizes typed navigation control without consuming defects or composite failures. */
|
|
86
|
-
export declare function getQueryRedirect(error: unknown): QueryRedirected | undefined;
|
|
87
|
-
export {};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { Deferred } from "effect";
|
|
2
|
-
import { RevalidationError } from "./errors.ts";
|
|
3
|
-
import type { FreshnessFacts } from "./state.ts";
|
|
4
|
-
import type { RevalidationResult } from "./types.ts";
|
|
5
|
-
export type Waiter = Deferred.Deferred<RevalidationResult, RevalidationError>;
|
|
6
|
-
export type FreshnessTransition = {
|
|
7
|
-
readonly facts: FreshnessFacts;
|
|
8
|
-
/** Completions to run after the state record has been replaced. */
|
|
9
|
-
readonly complete: ReadonlyArray<() => void>;
|
|
10
|
-
/** Whether a refresh attempt should start now. */
|
|
11
|
-
readonly startAttempt: boolean;
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* Registers a demand after `sequence` from an authorized trigger; merges into
|
|
15
|
-
* an outstanding demand. The epoch advances with it, and every query
|
|
16
|
-
* computation that evaluates for the new epoch expects itself through
|
|
17
|
-
* `expectQueries`; expectations from before the merge are dropped, because a
|
|
18
|
-
* retained query that no consumer holds does not evaluate and cannot answer.
|
|
19
|
-
*/
|
|
20
|
-
export declare function registerDemand(facts: FreshnessFacts, input: {
|
|
21
|
-
readonly sequence: number;
|
|
22
|
-
readonly waiter: Waiter | undefined;
|
|
23
|
-
readonly skipWorkIndicator: boolean;
|
|
24
|
-
}): FreshnessTransition;
|
|
25
|
-
/** An attempt starts for the outstanding demand, recording the sequence it covers and taking the demand's waiters. */
|
|
26
|
-
export declare function startAttempt(facts: FreshnessFacts): FreshnessFacts;
|
|
27
|
-
/** The running attempt failed and the application's schedule will run another; its waiters wait on. */
|
|
28
|
-
export declare function holdAttemptForRetry(facts: FreshnessFacts, error: RevalidationError): FreshnessTransition;
|
|
29
|
-
/** A read with `sequence` committed without a route error. */
|
|
30
|
-
export declare function satisfyDemand(facts: FreshnessFacts, input: {
|
|
31
|
-
readonly sequence: number;
|
|
32
|
-
}): FreshnessTransition;
|
|
33
|
-
/** An expected query read settled: a qualifying success acknowledges; a failure of a qualifying read fails the attempt. */
|
|
34
|
-
export declare function acknowledgeQuery(facts: FreshnessFacts, input: {
|
|
35
|
-
readonly id: string;
|
|
36
|
-
readonly sequence: number | undefined;
|
|
37
|
-
readonly success: boolean;
|
|
38
|
-
}): FreshnessTransition;
|
|
39
|
-
/** Query computations evaluated for the outstanding demand's epoch; each must acknowledge or be released. */
|
|
40
|
-
export declare function expectQueries(facts: FreshnessFacts, ids: ReadonlySet<string>): FreshnessTransition;
|
|
41
|
-
/** A query's computation was released with no successor; a demand waiting only on it completes. */
|
|
42
|
-
export declare function releaseQuery(facts: FreshnessFacts, id: string): FreshnessTransition;
|
|
43
|
-
/** The running attempt failed. Its captured batch fails; a newer demand starts another attempt. */
|
|
44
|
-
export declare function failAttempt(facts: FreshnessFacts, error: RevalidationError): FreshnessTransition;
|
|
45
|
-
/** The navigation that was running the attempt ended without settling it; the attempt's waiters return to the demand. */
|
|
46
|
-
export declare function abandonAttempt(facts: FreshnessFacts): FreshnessTransition;
|
|
47
|
-
/** Whether a new attempt may start: a demand exists, no attempt is running, and no failed attempt already covered the demand's sequence. */
|
|
48
|
-
export declare function canStartAttempt(facts: FreshnessFacts): boolean;
|
|
49
|
-
/** Retires the demand and settles every waiter with the given error. */
|
|
50
|
-
export declare function retireDemand(facts: FreshnessFacts, error: RevalidationError): FreshnessTransition;
|
|
51
|
-
export declare function makeRevalidationError(reason: RevalidationError["reason"], cause: unknown): RevalidationError;
|