@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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjcx/vorma",
3
- "version": "0.0.0-pre.2",
3
+ "version": "0.0.0-pre.4",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "license": "MIT",
@@ -13,26 +13,6 @@
13
13
  "types": "./dist/build/index.d.ts",
14
14
  "import": "./dist/build/index.js"
15
15
  },
16
- "./client": {
17
- "types": "./dist/client/index.d.ts",
18
- "import": "./dist/client/index.js"
19
- },
20
- "./client/react": {
21
- "types": "./dist/client/react/index.d.ts",
22
- "import": "./dist/client/react/index.js"
23
- },
24
- "./primitives/tasks": {
25
- "types": "./dist/primitives/tasks/index.d.ts",
26
- "import": "./dist/primitives/tasks/index.js"
27
- },
28
- "./server": {
29
- "types": "./dist/server/index.d.ts",
30
- "import": "./dist/server/index.js"
31
- },
32
- "./server/config": {
33
- "types": "./dist/server/config/index.d.ts",
34
- "import": "./dist/server/config/index.js"
35
- },
36
16
  "./vite": {
37
17
  "types": "./dist/vite/index.d.ts",
38
18
  "import": "./dist/vite/index.js"
@@ -42,36 +22,25 @@
42
22
  "@effect/platform-node-shared": "^4.0.0-rc.115",
43
23
  "@noble/hashes": "^2.4.0",
44
24
  "@scure/base": "^2.4.0",
45
- "@vorma/primitives": "npm:@sjcx/vorma-primitives@0.0.0-pre.2",
25
+ "@vorma/primitives": "npm:@sjcx/vorma-primitives@0.0.0-pre.4",
26
+ "@vorma/protocol": "npm:@sjcx/vorma-protocol@0.0.0-pre.4",
46
27
  "chokidar": "^5.0.0",
47
28
  "lightningcss": "^1.33.0",
48
29
  "rolldown": "^1.2.6",
49
30
  "typescript": "^7.0.2"
50
31
  },
51
32
  "peerDependencies": {
52
- "@effect/atom-react": ">=4.0.0-0",
53
- "@types/react": "*",
33
+ "@vorma/server": "*",
54
34
  "effect": ">=4.0.0-rc.115",
55
- "react": "*",
56
- "react-dom": "*",
57
35
  "vite": "*"
58
36
  },
59
37
  "peerDependenciesMeta": {
60
- "@effect/atom-react": {
61
- "optional": true
62
- },
63
- "@types/react": {
38
+ "@vorma/server": {
64
39
  "optional": true
65
40
  },
66
41
  "effect": {
67
42
  "optional": true
68
43
  },
69
- "react": {
70
- "optional": true
71
- },
72
- "react-dom": {
73
- "optional": true
74
- },
75
44
  "vite": {
76
45
  "optional": true
77
46
  }
@@ -1,42 +0,0 @@
1
- import { Effect } from "effect";
2
- import type { ApplicationGeneration } from "./generate-application.ts";
3
- export type ServerCompilationIssue = {
4
- readonly _tag: "ServerCompilationIssue";
5
- readonly cause: unknown;
6
- };
7
- /** A compiler report that does not prevent publication. */
8
- export type ServerCompilationDiagnostic = {
9
- readonly level: string;
10
- readonly code: string;
11
- readonly message: string;
12
- };
13
- export type CompiledServer = {
14
- /** Every compiled module of the flat server output, entry included. */
15
- readonly files: ReadonlyArray<{
16
- readonly fileName: string;
17
- readonly source: string;
18
- }>;
19
- readonly diagnostics: ReadonlyArray<ServerCompilationDiagnostic>;
20
- /** Native compiler inputs, including modules removed by tree shaking. */
21
- readonly inputFilePaths: ReadonlyArray<string>;
22
- };
23
- /**
24
- * Compiles the configured server entry and internal runtime
25
- * entry together into ECMAScript modules that run
26
- * without a TypeScript loader, a Vorma installation, or a bundler in the
27
- * target process. The compilation rewrites nothing in the application's
28
- * source. Effect remains a runtime peer shared with the containing application.
29
- *
30
- * Rolldown uses the configured server TypeScript project. The client's Vite
31
- * configuration does not configure server compilation.
32
- *
33
- * Production bytes must depend on the sources alone, so the debug comments
34
- * that name module paths relative to the build directory are off: the
35
- * checkout's location must not reach the artifact. Symlink resolution stays on
36
- * because an isolated package store reaches a package's own dependencies only
37
- * through the real path. Development source maps retain authored locations.
38
- */
39
- export declare function compileServerApplication(input: {
40
- readonly generation: ApplicationGeneration;
41
- readonly sourcemap: "inline" | false;
42
- }): Effect.Effect<CompiledServer, ServerCompilationIssue>;
@@ -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>;
@@ -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 {};
@@ -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;