@sjcx/vorma 0.0.0-pre.2 → 0.0.0-pre.4

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.
Files changed (137) hide show
  1. package/dist/build/assemble-artifacts.d.ts +1 -1
  2. package/dist/build/bundle-client.d.ts +1 -1
  3. package/dist/build/cli.js +53 -44
  4. package/dist/build/compile-application.d.ts +2 -2
  5. package/dist/build/development-artifacts.d.ts +1 -1
  6. package/dist/build/development-build.d.ts +3 -6
  7. package/dist/build/development-server-process.d.ts +3 -3
  8. package/dist/build/development-work.d.ts +4 -3
  9. package/dist/build/generate-application.d.ts +4 -4
  10. package/dist/build/index.d.ts +2 -3
  11. package/dist/build/index.js +1 -1
  12. package/dist/build/inspect-projects.d.ts +3 -3
  13. package/dist/build/load-config.d.ts +17 -16
  14. package/dist/build/publish-artifacts.d.ts +1 -4
  15. package/dist/build/render-client-transport.d.ts +1 -1
  16. package/dist/build/render-server-generated.d.ts +1 -12
  17. package/dist/build/render-types.d.ts +1 -1
  18. package/dist/build/resolve-config.d.ts +6 -9
  19. package/dist/build/source-layout.d.ts +2 -2
  20. package/dist/build/typescript-projects.d.ts +5 -0
  21. package/dist/{build-DcP5_DUV.js → build-BeUTL6eX.js} +104 -301
  22. package/package.json +5 -36
  23. package/dist/build/compile-server.d.ts +0 -42
  24. package/dist/client/assembly.d.ts +0 -40
  25. package/dist/client/browser-http-client.d.ts +0 -10
  26. package/dist/client/client-loaders.d.ts +0 -93
  27. package/dist/client/commit.d.ts +0 -41
  28. package/dist/client/contracts.d.ts +0 -192
  29. package/dist/client/core.d.ts +0 -45
  30. package/dist/client/development.d.ts +0 -16
  31. package/dist/client/document-recovery.d.ts +0 -4
  32. package/dist/client/endpoints.d.ts +0 -54
  33. package/dist/client/errors.d.ts +0 -87
  34. package/dist/client/freshness.d.ts +0 -51
  35. package/dist/client/head.d.ts +0 -14
  36. package/dist/client/history.d.ts +0 -25
  37. package/dist/client/index.d.ts +0 -80
  38. package/dist/client/index.js +0 -150
  39. package/dist/client/links.d.ts +0 -48
  40. package/dist/client/materialize.d.ts +0 -21
  41. package/dist/client/modules.d.ts +0 -2
  42. package/dist/client/navigation.d.ts +0 -47
  43. package/dist/client/payload.d.ts +0 -54
  44. package/dist/client/prefetch.d.ts +0 -28
  45. package/dist/client/prepare.d.ts +0 -47
  46. package/dist/client/projections.d.ts +0 -26
  47. package/dist/client/queries.d.ts +0 -33
  48. package/dist/client/react/application.d.ts +0 -87
  49. package/dist/client/react/hooks.d.ts +0 -36
  50. package/dist/client/react/index.d.ts +0 -5
  51. package/dist/client/react/index.js +0 -3237
  52. package/dist/client/react/link.d.ts +0 -27
  53. package/dist/client/react/view.d.ts +0 -86
  54. package/dist/client/request.d.ts +0 -16
  55. package/dist/client/route-context.d.ts +0 -31
  56. package/dist/client/route-matching.d.ts +0 -22
  57. package/dist/client/route-synchronization.d.ts +0 -30
  58. package/dist/client/route-url.d.ts +0 -5
  59. package/dist/client/runtime.d.ts +0 -82
  60. package/dist/client/scroll.d.ts +0 -16
  61. package/dist/client/services.d.ts +0 -34
  62. package/dist/client/state.d.ts +0 -102
  63. package/dist/client/static-assets.d.ts +0 -3
  64. package/dist/client/stylesheets.d.ts +0 -7
  65. package/dist/client/transport-type-entries.d.ts +0 -2
  66. package/dist/client/types.d.ts +0 -152
  67. package/dist/client/view-definition.d.ts +0 -24
  68. package/dist/client/work-indicator.d.ts +0 -18
  69. package/dist/compile-Me8EOyMK.js +0 -870
  70. package/dist/development-B_rxuwY7.js +0 -128
  71. package/dist/hash-set-BPx3iXec.js +0 -141
  72. package/dist/href-Cqyax8Y0.js +0 -357
  73. package/dist/materialize-DZ7VSLFk.js +0 -739
  74. package/dist/metadata-BoPKo-G2.js +0 -32
  75. package/dist/primitives/tasks/index.d.ts +0 -1
  76. package/dist/primitives/tasks/index.js +0 -1
  77. package/dist/route-context-CtY_9U_W.js +0 -559
  78. package/dist/route-matching-D_uSG2P9.js +0 -33
  79. package/dist/search-parse-0f7oqVsG.js +0 -375
  80. package/dist/server/config/index.d.ts +0 -36
  81. package/dist/server/config/index.js +0 -30
  82. package/dist/server/development/metadata.d.ts +0 -11
  83. package/dist/server/document.d.ts +0 -37
  84. package/dist/server/form-data.d.ts +0 -21
  85. package/dist/server/graph/compile.d.ts +0 -118
  86. package/dist/server/graph/declarations.d.ts +0 -117
  87. package/dist/server/graph/literal-error-tag.d.ts +0 -14
  88. package/dist/server/graph/pattern-conflicts.d.ts +0 -36
  89. package/dist/server/graph/search-schema.d.ts +0 -13
  90. package/dist/server/graph/transport-schema.d.ts +0 -11
  91. package/dist/server/index.d.ts +0 -310
  92. package/dist/server/index.js +0 -2311
  93. package/dist/server/public-assets.d.ts +0 -18
  94. package/dist/server/runtime/application.d.ts +0 -15
  95. package/dist/server/runtime/assets.d.ts +0 -15
  96. package/dist/server/runtime/context.d.ts +0 -96
  97. package/dist/server/runtime/domain-errors.d.ts +0 -11
  98. package/dist/server/runtime/effects.d.ts +0 -83
  99. package/dist/server/runtime/execute.d.ts +0 -13
  100. package/dist/server/runtime/finalize.d.ts +0 -44
  101. package/dist/server/runtime/handler.d.ts +0 -106
  102. package/dist/server/runtime/head.d.ts +0 -22
  103. package/dist/server/runtime/payload.d.ts +0 -50
  104. package/dist/server/runtime/pipeline.d.ts +0 -27
  105. package/dist/server/runtime/plan.d.ts +0 -98
  106. package/dist/server/runtime/render-document.d.ts +0 -16
  107. package/dist/server/runtime/startup-error.d.ts +0 -11
  108. package/dist/server/runtime/transport-type-entries.d.ts +0 -2
  109. package/dist/server/runtime/vercel-deployment.d.ts +0 -2
  110. package/dist/server/url-pathname.d.ts +0 -13
  111. package/dist/static-assets-BrH3O0M8.js +0 -199
  112. package/dist/universal/generated-types.d.ts +0 -9
  113. package/dist/universal/href.d.ts +0 -17
  114. package/dist/universal/http-method.d.ts +0 -4
  115. package/dist/universal/json-transport.d.ts +0 -14
  116. package/dist/universal/null-prototype-record.d.ts +0 -7
  117. package/dist/universal/path-wire.d.ts +0 -71
  118. package/dist/universal/pattern-language.d.ts +0 -4
  119. package/dist/universal/protocol-schemas.d.ts +0 -99
  120. package/dist/universal/protocol.d.ts +0 -162
  121. package/dist/universal/search-grammar.d.ts +0 -7
  122. package/dist/universal/search-parse.d.ts +0 -22
  123. package/dist/universal/search-serialize.d.ts +0 -16
  124. package/dist/universal/search-shape.d.ts +0 -32
  125. package/dist/universal/static-assets.d.ts +0 -2
  126. package/dist/universal/transport-types/big-decimal.d.ts +0 -13
  127. package/dist/universal/transport-types/chunk.d.ts +0 -8
  128. package/dist/universal/transport-types/date-time-utc.d.ts +0 -13
  129. package/dist/universal/transport-types/date-time-zoned.d.ts +0 -13
  130. package/dist/universal/transport-types/duration.d.ts +0 -13
  131. package/dist/universal/transport-types/hash-map.d.ts +0 -8
  132. package/dist/universal/transport-types/hash-set.d.ts +0 -8
  133. package/dist/universal/transport-types/option.d.ts +0 -10
  134. package/dist/universal/transport-types/redacted.d.ts +0 -9
  135. package/dist/universal/value-transport.d.ts +0 -117
  136. package/dist/value-transport-Bst4Hk-n.js +0 -864
  137. /package/dist/{universal → build}/content-digest.d.ts +0 -0
@@ -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;
@@ -1,14 +0,0 @@
1
- import { Result } from "effect";
2
- import type { HeadElementWire } from "../universal/protocol-schemas.ts";
3
- export type HeadSections = {
4
- readonly title: HeadElementWire | undefined;
5
- readonly meta: ReadonlyArray<HeadElementWire>;
6
- readonly rest: ReadonlyArray<HeadElementWire>;
7
- };
8
- export type HeadReconciliationError = {
9
- readonly _tag: "HeadReconciliationError";
10
- readonly message: string;
11
- };
12
- export declare function applyHead(sections: HeadSections): Result.Result<void, HeadReconciliationError>;
13
- /** Reads the server-rendered head state from the three managed regions. */
14
- export declare function readDocumentHead(): Result.Result<HeadSections, HeadReconciliationError>;
@@ -1,25 +0,0 @@
1
- import { Result } from "effect";
2
- import type { ScrollPosition } from "./scroll.ts";
3
- export type BrowserPosition = {
4
- readonly href: string;
5
- readonly userState: unknown;
6
- readonly key: string | undefined;
7
- };
8
- export type HistoryStateError = {
9
- readonly _tag: "HistoryStateError";
10
- readonly message: string;
11
- readonly cause: unknown;
12
- };
13
- export declare function createEntryKey(): string;
14
- /** Reads native user state and Vorma's entry key without imposing a user-data codec. */
15
- export declare function readBrowserPosition(): Result.Result<BrowserPosition, HistoryStateError>;
16
- /** Writes a new or replaced history entry and returns the position it produced. */
17
- export declare function writeBrowserPosition(input: {
18
- readonly href: string;
19
- readonly replace: boolean;
20
- readonly userState: unknown;
21
- readonly key: string;
22
- }): Result.Result<BrowserPosition, HistoryStateError>;
23
- /** Remembers the scroll position of the entry `key` names. */
24
- export declare function rememberScroll(key: string, scroll: ScrollPosition): void;
25
- export declare function recallScroll(key: string): ScrollPosition | undefined;
@@ -1,80 +0,0 @@
1
- import { Effect, Result, Stream } from "effect";
2
- import type { Atom } from "effect/unstable/reactivity";
3
- import type { MissingGeneratedApplicationKey } from "../universal/generated-types.ts";
4
- import type { EndpointCallFailure, EndpointCallOutput, MutationEndpointCallInput, NavigationTargetInput, QueryEndpointCallInput } from "./contracts.ts";
5
- import type { EndpointFrameworkError, MutationSettlement } from "./endpoints.ts";
6
- import { InputError, NavigationError, PrefetchError, type QueryRedirected, type RevalidationError } from "./errors.ts";
7
- import { type LinkMatchRules, type LinkState } from "./links.ts";
8
- import type { QueryEndpointOutput } from "./queries.ts";
9
- import { ClientCoordinator } from "./runtime.ts";
10
- import type { ClientEvent, NavigationOptions, NavigationResult, RevalidationResult } from "./types.ts";
11
- export type { WorkIndicatorOptions } from "./work-indicator.ts";
12
- /** Application contract catalogue supplied by Vorma's generated declarations. */
13
- export interface ClientApplicationContracts {
14
- }
15
- type RegisteredAssetKey = ClientApplicationContracts extends {
16
- readonly assets: infer Key extends string;
17
- } ? Key | `/${Key}` : MissingGeneratedApplicationKey;
18
- /**
19
- * The hashed URL of a public asset, typed by the generated asset keys. The
20
- * build requires a string literal argument and replaces each call with that
21
- * asset's hashed URL. This function body exists so that imports and re-exports
22
- * of `getPublicUrl` are valid JavaScript; a correct client build replaces every
23
- * call, and the bundler then removes the unused function from the output.
24
- */
25
- export declare function getPublicUrl(_key: RegisteredAssetKey): string;
26
- export type { BuildMismatch, ClientBootError, ClientEvent, ClientLifecycle, FailureSource, NavigationOptions, NavigationResult, NavigationSource, NavigationState, OperationId, OperationKind, OperationPhase, OperationState, PendingNavigation, PendingPrefetch, PendingRevalidation, PublicRouteError, BoundaryError, RequestKind, RevalidationResult, RevalidationState, RouteError, RouteErrorSource, RouteMatchSummary, RouteState, RouteUpdateReason, WorkState, } from "./types.ts";
27
- export type { AnyRouteMatch, ClientLoaderData, ClientLoaderState, ClientLoaderRoutePattern, EndpointCallFailure, EndpointCallOutput, EndpointRequestOptions, LoaderData, LoaderRoutePattern, MutationEndpointCallInput, QueryEndpointCallInput, RawHrefTarget, RouteInput, RouteMatch, RoutePattern, RouteTarget, RouteUrlInput, } from "./contracts.ts";
28
- export type { TransportTypeEntry } from "../universal/value-transport.ts";
29
- export { optionTransportType } from "../universal/transport-types/option.ts";
30
- export { redactedTransportType } from "../universal/transport-types/redacted.ts";
31
- export { chunkTransportType } from "../universal/transport-types/chunk.ts";
32
- export { durationTransportType } from "../universal/transport-types/duration.ts";
33
- export { bigDecimalTransportType } from "../universal/transport-types/big-decimal.ts";
34
- export { dateTimeUtcTransportType } from "../universal/transport-types/date-time-utc.ts";
35
- export { dateTimeZonedTransportType } from "../universal/transport-types/date-time-zoned.ts";
36
- export { hashMapTransportType } from "../universal/transport-types/hash-map.ts";
37
- export { hashSetTransportType } from "../universal/transport-types/hash-set.ts";
38
- export type { ClientRequestContext, PrepareRequestFn } from "./request.ts";
39
- export { synchronizeRoute, type RouteSynchronizationOptions, } from "./route-synchronization.ts";
40
- export { toHref } from "./route-url.ts";
41
- export type { EndpointFrameworkError, MutationSettlement, ResponseMetadata, QueryResponse, } from "./endpoints.ts";
42
- export type { ClientLoaderTrigger } from "./client-loaders.ts";
43
- export { createQueryAtom, type QueryAtom, type QueryEndpointOutput, } from "./queries.ts";
44
- export type { ClientLoaderContext } from "./contracts.ts";
45
- export { getClientLoaderDataAtom, getLoaderDataAtom, getRouteMatchAtom, type RouteContext, } from "./route-context.ts";
46
- export { type LinkMatchRules, type LinkState } from "./links.ts";
47
- export { BuildMismatchError, HandlerError, CancelledByDedupeKeyError, InputError, NavigationError, PrefetchError, QueryRedirected, RevalidationError, TransportError, type QueryNavigation, } from "./errors.ts";
48
- export { type ClientCoordinator, clientRuntime, universalRuntime, type ClientUnavailableError, } from "./runtime.ts";
49
- export declare function getRouteStateAtom(): Atom.Atom<import("effect/Option").Option<import("./types.ts").RouteState>>;
50
- export declare function getNavigationStateAtom(): Atom.Atom<import("./types.ts").NavigationState>;
51
- export declare function getRevalidationStateAtom(): Atom.Atom<import("./types.ts").RevalidationState>;
52
- export declare function getWorkStateAtom(): Atom.Atom<import("./types.ts").WorkState>;
53
- /** Includes an Effect in the work indicator until it succeeds, fails, or is interrupted. */
54
- export declare function trackWork<A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, E, R | ClientCoordinator>;
55
- export declare function getWorkIndicatorActiveAtom(): Atom.Atom<boolean>;
56
- export declare function getBuildMismatchAtom(): Atom.Atom<import("effect/Option").Option<import("./types.ts").BuildMismatch>>;
57
- /** Native atom retention owns the last observed settlement after active work retires. */
58
- export { getOperationStateAtom } from "./projections.ts";
59
- /** Subscribe to each framework event from this mounted application's lifetime. */
60
- export declare function observeClientEvents(): Stream.Stream<ClientEvent, never, ClientCoordinator>;
61
- /** Starts a navigation and observes its typed outcome. */
62
- export declare function navigate(input: NavigationTargetInput & NavigationOptions): Effect.Effect<NavigationResult, NavigationError, ClientCoordinator>;
63
- /** Prepares a destination for promotion while the Effect runs; readiness completes it. */
64
- export declare function prefetch(input: NavigationTargetInput & {
65
- readonly skipWorkIndicator?: boolean;
66
- }): Effect.Effect<void, PrefetchError, ClientCoordinator>;
67
- /** The active and pending facts of a link target under its match rules; a target that does not encode has no link state. */
68
- export declare function getLinkStateAtom(input: NavigationTargetInput & {
69
- readonly matchRules?: LinkMatchRules;
70
- }): Result.Result<Atom.Atom<LinkState>, InputError>;
71
- /** Retires every value of the current session, refreshes the committed route and active queries, and awaits the result. */
72
- export declare function invalidateClientData(): Effect.Effect<RevalidationResult, RevalidationError, ClientCoordinator>;
73
- /** Registers fresh-data demand for the committed route and awaits its qualifying result. */
74
- export declare function revalidate(options?: {
75
- readonly skipWorkIndicator?: boolean;
76
- }): Effect.Effect<RevalidationResult, RevalidationError, ClientCoordinator>;
77
- /** Returns decoded query data and response metadata; a redirect surfaces as a typed navigation handoff. */
78
- export declare function queryEndpoint<const Input extends QueryEndpointCallInput>(input: Input): Effect.Effect<QueryEndpointOutput<Input>, EndpointCallFailure<Input, EndpointFrameworkError | QueryRedirected>, ClientCoordinator>;
79
- /** Observes an application-owned mutation settlement and its scheduled refresh. */
80
- export declare function mutateEndpoint<const Input extends MutationEndpointCallInput>(input: Input): Effect.Effect<MutationSettlement<EndpointCallOutput<Input>>, EndpointCallFailure<Input, EndpointFrameworkError>, ClientCoordinator>;
@@ -1,150 +0,0 @@
1
- import { A as routeStateAtom, B as RevalidationError, F as HandlerError, I as InputError, L as NavigationError, N as BuildMismatchError, O as refreshEpochAtom, P as CancelledByDedupeKeyError, R as PrefetchError, S as buildMismatchAtom, T as navigationStateAtom, V as TransportError, d as ClientCoordinator, f as clientRuntime, g as toHref, h as universalRuntime, i as getRouteMatchAtom, j as workStateAtom, k as revalidationStateAtom, l as workIndicatorActiveAtom, n as getClientLoaderDataAtom, r as getLoaderDataAtom, s as synchronizeRoute, w as getOperationStateAtom, x as getLinkStateAtomFor, z as QueryRedirected } from "../route-context-CtY_9U_W.js";
2
- import { a as bigDecimalTransportType, c as redactedTransportType, i as dateTimeUtcTransportType, l as optionTransportType, n as hashMapTransportType, o as durationTransportType, r as dateTimeZonedTransportType, s as chunkTransportType, t as hashSetTransportType } from "../hash-set-BPx3iXec.js";
3
- import { Cause, Context, Effect, Exit, Option, Result, Stream } from "effect";
4
- import { AsyncResult, Atom } from "effect/unstable/reactivity";
5
- //#region src/client/queries.ts
6
- function createQueryAtom(input) {
7
- const id = crypto.randomUUID();
8
- const requestAtom = Atom.isAtom(input.request) ? input.request : Atom.make(Option.some(input.request));
9
- const reading = input.runtime.atom((get) => {
10
- const request = get(requestAtom);
11
- get(refreshEpochAtom);
12
- const computation = {
13
- id,
14
- token: Symbol("vorma/query-computation")
15
- };
16
- const runtime = get(input.runtime);
17
- const coordinatorNow = AsyncResult.isSuccess(runtime) ? Context.getOption(runtime.value, ClientCoordinator) : Option.none();
18
- if (Option.isSome(coordinatorNow) && Option.isSome(request)) coordinatorNow.value.queries.expect(computation);
19
- return Effect.gen(function* () {
20
- if (Option.isNone(request)) return yield* Effect.never;
21
- const coordinator = yield* ClientCoordinator;
22
- yield* Effect.addFinalizer(() => {
23
- return Effect.sync(() => coordinator.queries.release(computation));
24
- });
25
- let dispatched;
26
- const exit = yield* Effect.exit(coordinator.endpoints.read(request.value, (facts) => {
27
- dispatched = facts;
28
- }));
29
- if (Exit.isSuccess(exit) || !Cause.hasInterruptsOnly(exit.cause)) coordinator.queries.acknowledge({
30
- id,
31
- dispatched,
32
- success: Exit.isSuccess(exit)
33
- });
34
- return Exit.isSuccess(exit) ? exit.value : yield* Effect.failCause(exit.cause);
35
- });
36
- });
37
- return Atom.readable((get) => {
38
- return Option.isNone(get(requestAtom)) ? AsyncResult.initial() : get(reading);
39
- }, (refresh) => refresh(reading));
40
- }
41
- //#endregion
42
- //#region src/client/index.ts
43
- /**
44
- * The hashed URL of a public asset, typed by the generated asset keys. The
45
- * build requires a string literal argument and replaces each call with that
46
- * asset's hashed URL. This function body exists so that imports and re-exports
47
- * of `getPublicUrl` are valid JavaScript; a correct client build replaces every
48
- * call, and the bundler then removes the unused function from the output.
49
- */
50
- function getPublicUrl(_key) {
51
- throw new Error("Vorma's client build did not replace getPublicUrl with a public asset URL");
52
- }
53
- function getRouteStateAtom() {
54
- return routeStateAtom;
55
- }
56
- function getNavigationStateAtom() {
57
- return navigationStateAtom;
58
- }
59
- function getRevalidationStateAtom() {
60
- return revalidationStateAtom;
61
- }
62
- function getWorkStateAtom() {
63
- return workStateAtom;
64
- }
65
- /** Includes an Effect in the work indicator until it succeeds, fails, or is interrupted. */
66
- function trackWork(effect) {
67
- return Effect.flatMap(ClientCoordinator, (coordinator) => coordinator.trackWork(effect));
68
- }
69
- function getWorkIndicatorActiveAtom() {
70
- return workIndicatorActiveAtom;
71
- }
72
- function getBuildMismatchAtom() {
73
- return buildMismatchAtom;
74
- }
75
- /** Subscribe to each framework event from this mounted application's lifetime. */
76
- function observeClientEvents() {
77
- return Stream.unwrap(Effect.map(ClientCoordinator, (coordinator) => coordinator.events));
78
- }
79
- /** Starts a navigation and observes its typed outcome. */
80
- function navigate(input) {
81
- return Effect.flatMap(ClientCoordinator, (coordinator) => {
82
- const href = toHref(input);
83
- if (Result.isFailure(href)) return Effect.fail(new NavigationError({
84
- stage: "target",
85
- cause: Cause.fail(href.failure)
86
- }));
87
- const options = {
88
- ...input.replace === void 0 ? {} : { replace: input.replace },
89
- ...input.scrollToTop === void 0 ? {} : { scrollToTop: input.scrollToTop },
90
- ...input.scrollToFragment === void 0 ? {} : { scrollToFragment: input.scrollToFragment },
91
- ...input.historyState === void 0 ? {} : { historyState: input.historyState },
92
- ...input.skipWorkIndicator === void 0 ? {} : { skipWorkIndicator: input.skipWorkIndicator }
93
- };
94
- return coordinator.navigation.navigate(href.success, options);
95
- });
96
- }
97
- /** Prepares a destination for promotion while the Effect runs; readiness completes it. */
98
- function prefetch(input) {
99
- return Effect.flatMap(ClientCoordinator, (coordinator) => {
100
- const href = toHref(input);
101
- const url = Result.flatMap(href, (value) => {
102
- return Result.try(() => new URL(value, window.location.href));
103
- });
104
- if (Result.isFailure(url)) return Effect.fail(new PrefetchError({
105
- reason: "target",
106
- cause: url.failure
107
- }));
108
- if (url.success.origin !== window.location.origin) return Effect.fail(new PrefetchError({
109
- reason: "target",
110
- cause: "A prefetch target must be on the application's origin"
111
- }));
112
- return coordinator.prefetch.awaitReadiness(url.success, { skipWorkIndicator: input.skipWorkIndicator === true });
113
- });
114
- }
115
- /** The active and pending facts of a link target under its match rules; a target that does not encode has no link state. */
116
- function getLinkStateAtom(input) {
117
- return Result.map(toHref(input), (href) => {
118
- return getLinkStateAtomFor({
119
- href,
120
- pattern: input.pattern,
121
- rules: input.matchRules
122
- });
123
- });
124
- }
125
- /** Retires every value of the current session, refreshes the committed route and active queries, and awaits the result. */
126
- function invalidateClientData() {
127
- return Effect.flatMap(ClientCoordinator, (coordinator) => {
128
- return coordinator.navigation.invalidate();
129
- });
130
- }
131
- /** Registers fresh-data demand for the committed route and awaits its qualifying result. */
132
- function revalidate(options) {
133
- return Effect.flatMap(ClientCoordinator, (coordinator) => {
134
- return coordinator.navigation.revalidate({ skipWorkIndicator: options?.skipWorkIndicator === true });
135
- });
136
- }
137
- /** Returns decoded query data and response metadata; a redirect surfaces as a typed navigation handoff. */
138
- function queryEndpoint(input) {
139
- return Effect.flatMap(ClientCoordinator, (coordinator) => {
140
- return coordinator.endpoints.query(input);
141
- });
142
- }
143
- /** Observes an application-owned mutation settlement and its scheduled refresh. */
144
- function mutateEndpoint(input) {
145
- return Effect.flatMap(ClientCoordinator, (coordinator) => {
146
- return coordinator.endpoints.mutate(input);
147
- });
148
- }
149
- //#endregion
150
- export { BuildMismatchError, CancelledByDedupeKeyError, HandlerError, InputError, NavigationError, PrefetchError, QueryRedirected, RevalidationError, TransportError, bigDecimalTransportType, chunkTransportType, clientRuntime, createQueryAtom, dateTimeUtcTransportType, dateTimeZonedTransportType, durationTransportType, getBuildMismatchAtom, getClientLoaderDataAtom, getLinkStateAtom, getLoaderDataAtom, getNavigationStateAtom, getOperationStateAtom, getPublicUrl, getRevalidationStateAtom, getRouteMatchAtom, getRouteStateAtom, getWorkIndicatorActiveAtom, getWorkStateAtom, hashMapTransportType, hashSetTransportType, invalidateClientData, mutateEndpoint, navigate, observeClientEvents, optionTransportType, prefetch, queryEndpoint, redactedTransportType, revalidate, synchronizeRoute, toHref, trackWork, universalRuntime };
@@ -1,48 +0,0 @@
1
- import { Atom } from "effect/unstable/reactivity";
2
- import type { ClientCoordinatorService } from "./runtime.ts";
3
- export type LinkMatchRules = {
4
- readonly skip?: boolean;
5
- readonly includeSearch?: boolean;
6
- readonly includeHash?: boolean;
7
- };
8
- export type LinkState = {
9
- readonly active: {
10
- readonly exact: boolean;
11
- readonly ancestor: boolean;
12
- };
13
- readonly pending: {
14
- readonly exact: boolean;
15
- readonly ancestor: boolean;
16
- };
17
- };
18
- /** The active and pending facts of a resolved link target under its match rules. */
19
- export declare function getLinkStateAtomFor(input: {
20
- readonly href: string;
21
- readonly pattern: string | undefined;
22
- readonly rules: LinkMatchRules | undefined;
23
- }): Atom.Atom<LinkState>;
24
- /** The subset of pointer event fields the click predicates inspect. */
25
- export type ClickFacts = {
26
- readonly metaKey?: boolean;
27
- readonly altKey?: boolean;
28
- readonly ctrlKey?: boolean;
29
- readonly shiftKey?: boolean;
30
- readonly button?: number;
31
- };
32
- /** Whether a click may be intercepted: unmodified, primary, and targeting this browsing context. */
33
- export declare function allowsInterception(event: ClickFacts, targetAttribute: string | undefined): boolean;
34
- export type LinkIntent = {
35
- /** Starts a prefetch observer after the supplied delay, or 100 ms when omitted. */
36
- readonly begin: (source: "pointer" | "focus", delayMs: number | undefined) => void;
37
- /** Records that the pointer or focus left; a pointer leaving during touch input is ignored. */
38
- readonly end: (source: "pointer" | "focus") => void;
39
- readonly reset: () => void;
40
- };
41
- /** Tracks whether the last pointer input was touch; the returned function detaches. */
42
- export declare function attachPointerModalityTracking(): () => void;
43
- /** One link's prefetch intent: an observer handle held from a pointer's or focus's arrival until either leaves. */
44
- export declare function createLinkIntent(input: {
45
- readonly coordinator: ClientCoordinatorService;
46
- readonly getHrefFn: () => string;
47
- readonly skipWorkIndicator: boolean;
48
- }): LinkIntent;
@@ -1,21 +0,0 @@
1
- import { Effect } from "effect";
2
- import type { DecodedRoute } from "./payload.ts";
3
- import type { ViewDefinition } from "./view-definition.ts";
4
- export type MaterializedRoute = DecodedRoute & {
5
- readonly definition: ViewDefinition | undefined;
6
- };
7
- export type ModuleLoadError = {
8
- readonly _tag: "ModuleLoadError";
9
- readonly url: string;
10
- readonly cause: unknown;
11
- };
12
- /** Native imports cache production modules; development retains accepted replacement namespaces. */
13
- export declare function enableDevelopmentModules(): {
14
- replaceFn(input: {
15
- readonly url: string;
16
- readonly module: Readonly<Record<string, unknown>>;
17
- }): Map<unknown, unknown>;
18
- closeFn(): void;
19
- };
20
- /** Loads one position independently, retaining its decoded facts and selected view. */
21
- export declare function materializeRoute(route: DecodedRoute): Effect.Effect<MaterializedRoute, ModuleLoadError>;
@@ -1,2 +0,0 @@
1
- /** Writes a `modulepreload` link for each module path that has none yet. */
2
- export declare function preloadModules(paths: ReadonlyArray<string>): void;
@@ -1,47 +0,0 @@
1
- import { Duration, Effect, Result, type Schedule, Scope } from "effect";
2
- import { type CommitDependencies } from "./commit.ts";
3
- import type { ClientCore } from "./core.ts";
4
- import { NavigationError, RevalidationError } from "./errors.ts";
5
- import { type BrowserPosition } from "./history.ts";
6
- import { type PrefetchOwner } from "./prefetch.ts";
7
- import { type PreparationDependencies, type PreparedRoute } from "./prepare.ts";
8
- import type { QueryOwner } from "./queries.ts";
9
- import type { Frame } from "./state.ts";
10
- import type { NavigationOptions, NavigationResult, RevalidationResult } from "./types.ts";
11
- export type NavigationOwner = {
12
- readonly navigate: (href: string, options: NavigationOptions) => Effect.Effect<NavigationResult, NavigationError>;
13
- /** Records a target failure that happened before a navigation candidate existed. */
14
- readonly recordTargetFailure: (error: NavigationError) => void;
15
- /** Starts the navigation now and returns its observation. */
16
- readonly begin: (href: string, options: NavigationOptions) => Effect.Effect<NavigationResult, NavigationError>;
17
- /** Registers a demand when executed and awaits its qualifying result. */
18
- readonly revalidate: (options: {
19
- readonly skipWorkIndicator: boolean;
20
- }) => Effect.Effect<RevalidationResult, RevalidationError>;
21
- /** Registers a demand now and returns the observation of that demand. */
22
- readonly requireRefresh: (options: {
23
- readonly skipWorkIndicator: boolean;
24
- }) => Effect.Effect<RevalidationResult, RevalidationError>;
25
- /** Commits the boot preparation, whose entries' activations `scope` already holds. */
26
- readonly commitBoot: (prepared: PreparedRoute, scope: Scope.Closeable, position: BrowserPosition) => Result.Result<Frame, NavigationError>;
27
- /** Advances the session generation, retires every reusable value, and awaits fresh data. */
28
- readonly invalidate: () => Effect.Effect<RevalidationResult, RevalidationError>;
29
- readonly queries: QueryOwner;
30
- /** Attaches popstate and focus handling; the returned function detaches them. */
31
- readonly attachBrowserListeners: () => () => void;
32
- /** Settles every navigation that waited for the first frame: boot's outcome decides whether it starts or fails. */
33
- readonly settleBoot: (outcome: Result.Result<void, unknown>) => void;
34
- /** Retires all prefetch preparations and retained snapshots. */
35
- readonly retireReusable: () => void;
36
- /** Retires every reusable value and outstanding observation; disposal calls it. */
37
- readonly retireAll: () => void;
38
- };
39
- export declare function createNavigation(core: PreparationDependencies & CommitDependencies & Pick<ClientCore, "retireGeneration">, prefetch: PrefetchOwner, options: {
40
- readonly enableViewTransitions: boolean;
41
- readonly revalidateOnWindowFocus: {
42
- readonly staleTime: Duration.Input;
43
- readonly skipWorkIndicator: boolean;
44
- } | undefined;
45
- /** Runs a failed refresh attempt again under this schedule; without one a failed refresh fails once. */
46
- readonly refreshRetrySchedule: Schedule.Schedule<unknown, RevalidationError> | undefined;
47
- }): NavigationOwner;
@@ -1,54 +0,0 @@
1
- import type { CompiledNestedPattern } from "@vorma/primitives/matcher";
2
- import { Result } from "effect";
3
- import type { SearchContractDocument } from "../universal/protocol-schemas.ts";
4
- import { type TransportDecodeError } from "../universal/value-transport.ts";
5
- import type { HeadSections } from "./head.ts";
6
- export type DecodedRoute = {
7
- readonly pattern: string;
8
- readonly params: Readonly<Record<string, string>>;
9
- readonly splatValues: ReadonlyArray<string>;
10
- /** The pattern as the server's matcher holds it; the registry learns it for early client loader starts. */
11
- readonly compiledPattern: CompiledNestedPattern;
12
- /** The check-free decoded contract document that parses a URL's search; null for a route without one. */
13
- readonly searchContract: SearchContractDocument | null;
14
- /** The search the server parsed and validated for this route's loader; undefined for a route without a search contract. */
15
- readonly searchInput: unknown;
16
- readonly moduleReference: {
17
- readonly url: string;
18
- readonly exportNames: ReadonlyArray<string>;
19
- } | null;
20
- readonly loaderData: unknown;
21
- };
22
- export type ServerRouteError = {
23
- /** The failed position follows the successful route prefix. Its metadata is not disclosed. */
24
- readonly index: number;
25
- readonly status: number;
26
- readonly clientMessage: string;
27
- };
28
- export type DecodedRoutePayload = {
29
- readonly routes: ReadonlyArray<DecodedRoute>;
30
- readonly serverError: ServerRouteError | undefined;
31
- };
32
- export type DecodedPayload = DecodedRoutePayload & {
33
- readonly head: HeadSections;
34
- readonly deps: ReadonlyArray<string>;
35
- readonly cssBundles: ReadonlyArray<string>;
36
- readonly staticAssets: ReadonlyArray<string>;
37
- };
38
- export type BootstrapPayload = DecodedRoutePayload & {
39
- readonly clientBuildId: string;
40
- /** Whether the development server served the document. */
41
- readonly developmentMode: boolean;
42
- readonly deploymentId: string | undefined;
43
- };
44
- /** A transported value on a route record whose marks do not restore it. */
45
- export type PayloadReadError = {
46
- readonly _tag: "PayloadReadError";
47
- readonly pattern: string;
48
- readonly field: "search_input" | "loader_data";
49
- readonly cause: TransportDecodeError;
50
- };
51
- /** Reads a navigation payload this build's server wrote. */
52
- export declare function readPayload(raw: unknown): Result.Result<DecodedPayload, PayloadReadError>;
53
- /** Reads the initial document payload, including build identity. */
54
- export declare function readBootstrapPayload(raw: unknown): Result.Result<BootstrapPayload, PayloadReadError>;
@@ -1,28 +0,0 @@
1
- import { Effect } from "effect";
2
- import type { ClientCore } from "./core.ts";
3
- import { NavigationError, PrefetchError } from "./errors.ts";
4
- import { type PreparationDependencies, type PreparationOutcome } from "./prepare.ts";
5
- export type ConsumedPreparation = {
6
- /** The preparation's outcome; a redirect or refusal is the consumer's to handle. */
7
- readonly result: Effect.Effect<PreparationOutcome, NavigationError>;
8
- /** The sequence current when the preparation started; its read is newer. */
9
- readonly startSequence: number;
10
- /** Ends the preparation: the consumer calls it once the frame holds what it needs, or when it stops. */
11
- readonly release: () => void;
12
- };
13
- export type PrefetchOwner = {
14
- /** Holds an observer handle for the Effect's lifetime and observes readiness. */
15
- readonly awaitReadiness: (url: URL, options: {
16
- readonly skipWorkIndicator: boolean;
17
- }) => Effect.Effect<void, PrefetchError>;
18
- /** Holds an observer handle until interrupted; intent that outlasts readiness uses this. */
19
- readonly holdUntilInterrupted: (url: URL, options: {
20
- readonly skipWorkIndicator: boolean;
21
- }) => Effect.Effect<never, PrefetchError>;
22
- /** Transfers the destination's preparation to navigation, if one exists. */
23
- readonly takeForNavigation: (destination: string) => ConsumedPreparation | null;
24
- readonly retirePreparations: () => void;
25
- };
26
- /** The part of an address a preparation serves: its path and query. */
27
- export declare function readDestination(url: URL): string;
28
- export declare function createPrefetch(core: PreparationDependencies & Pick<ClientCore, "updateState" | "forkFiber">): PrefetchOwner;