svelte-effect-runtime 1.6.2 → 2.0.0-beta.1

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 (174) hide show
  1. package/.dist/chunks/client-BeOE81fW.js +577 -0
  2. package/.dist/chunks/client-BeOE81fW.js.map +1 -0
  3. package/.dist/chunks/descriptors-CU2g4U_i.js +36 -0
  4. package/.dist/chunks/descriptors-CU2g4U_i.js.map +1 -0
  5. package/.dist/chunks/dispatcher-BSg2-ttN.js +339 -0
  6. package/.dist/chunks/dispatcher-BSg2-ttN.js.map +1 -0
  7. package/.dist/chunks/preprocess-BZyUYWY7.js +430 -0
  8. package/.dist/chunks/preprocess-BZyUYWY7.js.map +1 -0
  9. package/.dist/chunks/transform-BtlxgJrg.js +836 -0
  10. package/.dist/chunks/transform-BtlxgJrg.js.map +1 -0
  11. package/.dist/detect.d.ts +34 -0
  12. package/.dist/detect.js +56 -0
  13. package/.dist/detect.js.map +1 -0
  14. package/.dist/dispatcher/deps.d.ts +14 -0
  15. package/.dist/dispatcher/fibers.d.ts +52 -0
  16. package/.dist/dispatcher/index.d.ts +138 -0
  17. package/.dist/dispatcher/types.d.ts +63 -0
  18. package/.dist/dispatcher.d.ts +2 -0
  19. package/.dist/dispatcher.js +2 -0
  20. package/.dist/error.d.ts +77 -0
  21. package/.dist/generators.d.ts +16 -0
  22. package/.dist/internal/descriptors.d.ts +17 -0
  23. package/.dist/internal/generators.d.ts +6 -0
  24. package/.dist/internal/generators.js +5 -0
  25. package/.dist/internal/remote-client.d.ts +6 -0
  26. package/.dist/internal/remote-client.js +2 -0
  27. package/.dist/internal/remote-server.d.ts +6 -0
  28. package/.dist/internal/remote-server.js +2 -0
  29. package/.dist/markup/promise.d.ts +15 -0
  30. package/.dist/markup/promise.js +26 -0
  31. package/.dist/markup/promise.js.map +1 -0
  32. package/.dist/markup/run.d.ts +12 -0
  33. package/.dist/markup/run.js +21 -0
  34. package/.dist/markup/run.js.map +1 -0
  35. package/.dist/markup/transform/apply.d.ts +6 -0
  36. package/.dist/markup/transform/classify.d.ts +15 -0
  37. package/.dist/markup/transform/constants.d.ts +5 -0
  38. package/.dist/markup/transform/emit.d.ts +12 -0
  39. package/.dist/markup/transform/expressions.d.ts +39 -0
  40. package/.dist/markup/transform/index.d.ts +19 -0
  41. package/.dist/markup/transform/scan.d.ts +8 -0
  42. package/.dist/markup/transform/types.d.ts +64 -0
  43. package/.dist/markup/transform.d.ts +1 -0
  44. package/.dist/markup/transform.js +2 -0
  45. package/.dist/markup/value.d.ts +20 -0
  46. package/.dist/markup/value.js +32 -0
  47. package/.dist/markup/value.js.map +1 -0
  48. package/.dist/mod.d.ts +186 -0
  49. package/.dist/mod.js +190 -0
  50. package/.dist/mod.js.map +1 -0
  51. package/.dist/preprocess/ast.d.ts +51 -0
  52. package/.dist/preprocess/imports.d.ts +22 -0
  53. package/.dist/preprocess/index.d.ts +21 -0
  54. package/.dist/preprocess/lower.d.ts +12 -0
  55. package/.dist/preprocess/runtime-block.d.ts +8 -0
  56. package/.dist/preprocess/source.d.ts +29 -0
  57. package/.dist/preprocess/types.d.ts +70 -0
  58. package/.dist/preprocess.d.ts +2 -0
  59. package/.dist/preprocess.js +3 -0
  60. package/.dist/remote/client/command.d.ts +17 -0
  61. package/.dist/remote/client/effect.d.ts +15 -0
  62. package/.dist/remote/client/failures.d.ts +57 -0
  63. package/.dist/remote/client/form-data.d.ts +8 -0
  64. package/.dist/remote/client/form-enhance.d.ts +9 -0
  65. package/.dist/remote/client/form-transport.d.ts +20 -0
  66. package/.dist/remote/client/form.d.ts +21 -0
  67. package/.dist/remote/client/index.d.ts +4 -0
  68. package/.dist/remote/client/query-result.d.ts +14 -0
  69. package/.dist/remote/client/query.d.ts +57 -0
  70. package/.dist/remote/client/responses.d.ts +28 -0
  71. package/.dist/remote/client/types.d.ts +83 -0
  72. package/.dist/remote/client/utils.d.ts +11 -0
  73. package/.dist/remote/client.d.ts +2 -0
  74. package/.dist/remote/client.js +2 -0
  75. package/.dist/remote/server.d.ts +66 -0
  76. package/.dist/remote/server.js +104 -0
  77. package/.dist/remote/server.js.map +1 -0
  78. package/.dist/remote/shared.d.ts +202 -0
  79. package/.dist/remote/shared.js +161 -0
  80. package/.dist/remote/shared.js.map +1 -0
  81. package/.dist/runtime/preprocess.d.ts +38 -0
  82. package/.dist/runtime/preprocess.js +54 -0
  83. package/.dist/runtime/preprocess.js.map +1 -0
  84. package/.dist/server/effects.d.ts +49 -0
  85. package/.dist/server/factories.d.ts +97 -0
  86. package/.dist/server/index.d.ts +3 -0
  87. package/.dist/server/invalid.d.ts +9 -0
  88. package/.dist/server/runtime.d.ts +66 -0
  89. package/.dist/server/schema.d.ts +42 -0
  90. package/.dist/server/types.d.ts +271 -0
  91. package/.dist/server/wrappers.d.ts +45 -0
  92. package/.dist/server.d.ts +2 -0
  93. package/.dist/server.js +527 -0
  94. package/.dist/server.js.map +1 -0
  95. package/.dist/vite.d.ts +42 -0
  96. package/.dist/vite.js +118 -0
  97. package/.dist/vite.js.map +1 -0
  98. package/README.md +2 -0
  99. package/package.json +66 -101
  100. package/dist/chunks/client-vV6UAwoP.js +0 -199
  101. package/dist/chunks/client-vV6UAwoP.js.map +0 -1
  102. package/dist/chunks/effect-Crj3S8Cg.js +0 -51
  103. package/dist/chunks/effect-Crj3S8Cg.js.map +0 -1
  104. package/dist/chunks/effect-compat-BhW0YPIs.js +0 -103
  105. package/dist/chunks/effect-compat-BhW0YPIs.js.map +0 -1
  106. package/dist/chunks/magic-string.es-BnGH-5YR.js +0 -1013
  107. package/dist/chunks/magic-string.es-BnGH-5YR.js.map +0 -1
  108. package/dist/chunks/markup-CkPUZIJt.js +0 -13390
  109. package/dist/chunks/markup-CkPUZIJt.js.map +0 -1
  110. package/dist/chunks/preprocess-BFePqOC6.js +0 -49
  111. package/dist/chunks/preprocess-BFePqOC6.js.map +0 -1
  112. package/dist/chunks/server-Dea1CJuY.js +0 -704
  113. package/dist/chunks/server-Dea1CJuY.js.map +0 -1
  114. package/dist/chunks/v3-D0c0MKPf.js +0 -1
  115. package/dist/chunks/v4-MMhHmzIG.js +0 -1
  116. package/dist/chunks/vite-BlUTKv2u.js +0 -152
  117. package/dist/chunks/vite-BlUTKv2u.js.map +0 -1
  118. package/dist/client.d.ts +0 -1
  119. package/dist/client.js +0 -2
  120. package/dist/effect.d.ts +0 -1
  121. package/dist/effect.js +0 -2
  122. package/dist/internal/app-server-shim.d.ts +0 -8
  123. package/dist/internal/effect-compat.d.ts +0 -21
  124. package/dist/internal/markup.d.ts +0 -11
  125. package/dist/internal/markup.js +0 -2
  126. package/dist/internal/remote-client.d.ts +0 -36
  127. package/dist/internal/remote-client.js +0 -527
  128. package/dist/internal/remote-client.js.map +0 -1
  129. package/dist/internal/remote-shared.d.ts +0 -186
  130. package/dist/internal/remote-shared.js +0 -122
  131. package/dist/internal/remote-shared.js.map +0 -1
  132. package/dist/internal/transform.d.ts +0 -18
  133. package/dist/internal/transform.js +0 -418
  134. package/dist/internal/transform.js.map +0 -1
  135. package/dist/language-server.d.ts +0 -9
  136. package/dist/language-server.js +0 -4
  137. package/dist/mod.d.ts +0 -22
  138. package/dist/mod.js +0 -3
  139. package/dist/preprocess.d.ts +0 -29
  140. package/dist/preprocess.js +0 -20
  141. package/dist/preprocess.js.map +0 -1
  142. package/dist/root-node.d.ts +0 -1
  143. package/dist/root-node.js +0 -63
  144. package/dist/root-node.js.map +0 -1
  145. package/dist/server.d.ts +0 -81
  146. package/dist/server.js +0 -85
  147. package/dist/server.js.map +0 -1
  148. package/dist/v3/client.d.ts +0 -117
  149. package/dist/v3/effect.d.ts +0 -17
  150. package/dist/v3/mod.d.ts +0 -27
  151. package/dist/v3/preprocess.d.ts +0 -28
  152. package/dist/v3/root-node.d.ts +0 -59
  153. package/dist/v3/server.d.ts +0 -297
  154. package/dist/v3/vite.d.ts +0 -46
  155. package/dist/v4/client.d.ts +0 -2
  156. package/dist/v4/effect.d.ts +0 -24
  157. package/dist/v4/effect.js +0 -19
  158. package/dist/v4/effect.js.map +0 -1
  159. package/dist/v4/mod.d.ts +0 -27
  160. package/dist/v4/mod.js +0 -3
  161. package/dist/v4/preprocess.d.ts +0 -34
  162. package/dist/v4/preprocess.js +0 -32
  163. package/dist/v4/preprocess.js.map +0 -1
  164. package/dist/v4/root-node.d.ts +0 -59
  165. package/dist/v4/root-node.js +0 -4
  166. package/dist/v4/server.d.ts +0 -340
  167. package/dist/v4/server.js +0 -71
  168. package/dist/v4/server.js.map +0 -1
  169. package/dist/v4/vite.d.ts +0 -34
  170. package/dist/v4/vite.js +0 -31
  171. package/dist/v4/vite.js.map +0 -1
  172. package/dist/vite.d.ts +0 -31
  173. package/dist/vite.js +0 -24
  174. package/dist/vite.js.map +0 -1
@@ -0,0 +1,161 @@
1
+ //#region src/remote/shared.ts
2
+ /**
3
+ * Shared types, markers, and constructors used by both the client-side remote
4
+ * adapters and the server-side handler runtime. These types define the error
5
+ * protocol that flows across the network boundary.
6
+ *
7
+ * @since 2.0.0
8
+ */
9
+ /**
10
+ * Well-known marker injected into every serialised remote-failure envelope
11
+ * so the client can reliably distinguish runtime errors from domain values.
12
+ *
13
+ * @since 2.0.0
14
+ * @internal
15
+ */
16
+ const EFFECT_REMOTE_ERROR_MARKER = "__svelte_effect_remote__";
17
+ /**
18
+ * Well-known symbol used to attach a payload decoder to a remote function
19
+ * so the client's transport layer can decode domain error types.
20
+ *
21
+ * @since 2.0.0
22
+ * @internal
23
+ */
24
+ const REMOTE_ERROR_DECODER = Symbol.for("svelte-effect-runtime/remote-error-decoder");
25
+ /**
26
+ * Creates a {@link FormError} holding the given issues.
27
+ *
28
+ * @since 2.0.0
29
+ * @param issues - The validation issues to attach.
30
+ * @returns A FormError with the `_tag` set and no schema reference.
31
+ */
32
+ function create_form_error(issues) {
33
+ return {
34
+ _tag: "FormError",
35
+ issues
36
+ };
37
+ }
38
+ /**
39
+ * Type guard that narrows an unknown value to a {@link FormError}.
40
+ *
41
+ * @since 2.0.0
42
+ * @param value - The value to check.
43
+ * @returns `true` when the value is a FormError.
44
+ */
45
+ function is_form_error(value) {
46
+ return typeof value === "object" && value !== null && value._tag === "FormError";
47
+ }
48
+ /** Constructors for structured remote error values. */
49
+ /**
50
+ * Creates a {@link RemoteValidationError} from a list of form issues.
51
+ *
52
+ * @since 2.0.0
53
+ * @param issues - The validation issues reported by the server handler.
54
+ * @param body - Optional response body returned alongside the error.
55
+ * @param status - HTTP status code (defaults to 400).
56
+ * @returns A remote-validation error shape.
57
+ * @internal
58
+ */
59
+ function create_remote_validation_error(issues, body, status = 400) {
60
+ return {
61
+ _tag: "RemoteValidationError",
62
+ issues,
63
+ body,
64
+ status
65
+ };
66
+ }
67
+ /**
68
+ * Creates a {@link RemoteHttpError} for a given HTTP status.
69
+ *
70
+ * @since 2.0.0
71
+ * @param status - The HTTP status code.
72
+ * @param body - Optional response body.
73
+ * @param cause - Optional underlying cause.
74
+ * @returns A remote HTTP error shape.
75
+ * @internal
76
+ */
77
+ function create_remote_http_error(status, body, cause) {
78
+ return {
79
+ _tag: "RemoteHttpError",
80
+ status,
81
+ body,
82
+ cause
83
+ };
84
+ }
85
+ /**
86
+ * Creates a {@link RemoteTransportError} for network or decode failures.
87
+ *
88
+ * @since 2.0.0
89
+ * @param cause - The underlying error that caused the transport failure.
90
+ * @param body - Optional response body if one was received.
91
+ * @returns A remote transport error shape.
92
+ * @internal
93
+ */
94
+ function create_remote_transport_error(cause, body) {
95
+ return {
96
+ _tag: "RemoteTransportError",
97
+ cause,
98
+ body
99
+ };
100
+ }
101
+ /**
102
+ * Wraps a devalue-encoded error string inside a
103
+ * {@link SerializedRemoteFailureEnvelope}.
104
+ *
105
+ * @since 2.0.0
106
+ * @param encoded - The devalue-encoded error value.
107
+ * @returns The wire-format envelope.
108
+ * @internal
109
+ */
110
+ function create_serialized_remote_failure_envelope(encoded) {
111
+ return {
112
+ __svelte_effect_remote__: true,
113
+ encoded
114
+ };
115
+ }
116
+ /** Type guards for structured remote error values. */
117
+ /**
118
+ * Checks whether a value is a {@link SerializedRemoteFailureEnvelope}.
119
+ *
120
+ * @since 2.0.0
121
+ * @param value - The value to check.
122
+ * @returns `true` when the value is a serialised failure envelope.
123
+ * @internal
124
+ */
125
+ function is_serialized_remote_failure_envelope(value) {
126
+ return typeof value === "object" && value !== null && value.__svelte_effect_remote__ === true;
127
+ }
128
+ /**
129
+ * Checks whether a value is a {@link RemoteValidationError}.
130
+ *
131
+ * @since 2.0.0
132
+ * @param value - The value to check.
133
+ * @returns `true` when the value is a remote validation error.
134
+ */
135
+ function is_remote_validation_error(value) {
136
+ return typeof value === "object" && value !== null && value._tag === "RemoteValidationError";
137
+ }
138
+ /**
139
+ * Checks whether a value is a {@link RemoteHttpError}.
140
+ *
141
+ * @since 2.0.0
142
+ * @param value - The value to check.
143
+ * @returns `true` when the value is a remote HTTP error.
144
+ */
145
+ function is_remote_http_error(value) {
146
+ return typeof value === "object" && value !== null && value._tag === "RemoteHttpError";
147
+ }
148
+ /**
149
+ * Checks whether a value is a {@link RemoteTransportError}.
150
+ *
151
+ * @since 2.0.0
152
+ * @param value - The value to check.
153
+ * @returns `true` when the value is a remote transport error.
154
+ */
155
+ function is_remote_transport_error(value) {
156
+ return typeof value === "object" && value !== null && value._tag === "RemoteTransportError";
157
+ }
158
+ //#endregion
159
+ export { EFFECT_REMOTE_ERROR_MARKER, REMOTE_ERROR_DECODER, create_form_error, create_remote_http_error, create_remote_transport_error, create_remote_validation_error, create_serialized_remote_failure_envelope, is_form_error, is_remote_http_error, is_remote_transport_error, is_remote_validation_error, is_serialized_remote_failure_envelope };
160
+
161
+ //# sourceMappingURL=shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.js","names":[],"sources":["../../../modules/svelte-effect-runtime/src/remote/shared.ts"],"sourcesContent":["/**\n * Shared types, markers, and constructors used by both the client-side remote\n * adapters and the server-side handler runtime. These types define the error\n * protocol that flows across the network boundary.\n *\n * @since 2.0.0\n */\n\n/**\n * Well-known marker injected into every serialised remote-failure envelope\n * so the client can reliably distinguish runtime errors from domain values.\n *\n * @since 2.0.0\n * @internal\n */\nexport const EFFECT_REMOTE_ERROR_MARKER = \"__svelte_effect_remote__\";\n\n/**\n * Well-known symbol used to attach a payload decoder to a remote function\n * so the client's transport layer can decode domain error types.\n *\n * @since 2.0.0\n * @internal\n */\nexport const REMOTE_ERROR_DECODER = Symbol.for(\n \"svelte-effect-runtime/remote-error-decoder\",\n);\n\n/** Form validation helpers and types. */\n\n/**\n * A single field-level or form-level validation issue reported by a\n * {@link Form} handler.\n *\n * @since 2.0.0\n */\nexport interface FormIssue {\n /** Human-readable validation message. */\n message: string;\n /** Path to the offending field as an array of string-or-number keys. */\n path: (string | number)[];\n}\n\n/**\n * Error subtype thrown by {@link Form} handlers to signal validation\n * failures. The `issues` array is forwarded to SvelteKit's `invalid()`\n * helper on the server and surfaced as `FormError` on the client.\n *\n * @since 2.0.0\n */\nexport interface FormError<SchemaType = unknown> {\n readonly _tag: \"FormError\";\n readonly issues: readonly FormIssue[];\n /** Phantom type slot for the schema this error was derived from. */\n readonly _schema?: SchemaType;\n}\n\n/**\n * Creates a {@link FormError} holding the given issues.\n *\n * @since 2.0.0\n * @param issues - The validation issues to attach.\n * @returns A FormError with the `_tag` set and no schema reference.\n */\nexport function create_form_error(issues: readonly FormIssue[]): FormError {\n return { _tag: \"FormError\", issues };\n}\n\n/**\n * Type guard that narrows an unknown value to a {@link FormError}.\n *\n * @since 2.0.0\n * @param value - The value to check.\n * @returns `true` when the value is a FormError.\n */\nexport function is_form_error(value: unknown): value is FormError {\n return (\n typeof value === \"object\" &&\n value !== null &&\n (value as Record<string, unknown>)._tag === \"FormError\"\n );\n}\n\n/** Remote error types shared by client and server helpers. */\n\n/**\n * Union of all wire-level error shapes that a remote function can\n * surface on its error channel.\n *\n * @example\n * ```ts\n * const result = yield* myQuery();\n * // error channel is RemoteFailure<DomainError>\n * ```\n *\n * @since 2.0.0\n */\nexport type RemoteFailure<ErrorType> =\n | ErrorType\n | RemoteValidationError\n | RemoteHttpError\n | RemoteTransportError;\n\n/**\n * Validation errors that originate from a server-side {@link Form}\n * handler calling `invalid()` (SvelteKit's `fail`).\n *\n * @since 2.0.0\n */\nexport interface RemoteValidationError {\n readonly _tag: \"RemoteValidationError\";\n readonly issues?: readonly FormIssue[];\n readonly body?: unknown;\n readonly status: number;\n}\n\n/**\n * HTTP-level errors with a status code and optional response body. Raised\n * when the server explicitly calls SvelteKit's `error(status, body)`.\n *\n * @since 2.0.0\n */\nexport interface RemoteHttpError {\n readonly _tag: \"RemoteHttpError\";\n readonly status: number;\n readonly body?: unknown;\n readonly cause?: unknown;\n}\n\n/**\n * Transport-level errors raised by the client adapter when the network\n * request fails or the response cannot be decoded.\n *\n * @since 2.0.0\n */\nexport interface RemoteTransportError {\n readonly _tag: \"RemoteTransportError\";\n readonly cause?: unknown;\n readonly body?: unknown;\n}\n\n/**\n * Wire format for an encoded remote failure. The server wraps domain\n * errors in this envelope before serialising them with devalue.\n *\n * @since 2.0.0\n * @internal\n */\nexport interface SerializedRemoteFailureEnvelope {\n readonly __svelte_effect_remote__: true;\n readonly encoded: string;\n}\n\n/** Constructors for structured remote error values. */\n\n/**\n * Creates a {@link RemoteValidationError} from a list of form issues.\n *\n * @since 2.0.0\n * @param issues - The validation issues reported by the server handler.\n * @param body - Optional response body returned alongside the error.\n * @param status - HTTP status code (defaults to 400).\n * @returns A remote-validation error shape.\n * @internal\n */\nexport function create_remote_validation_error(\n issues: readonly FormIssue[],\n body?: unknown,\n status = 400,\n): RemoteValidationError {\n\n return { _tag: \"RemoteValidationError\", issues, body, status };\n}\n\n/**\n * Creates a {@link RemoteHttpError} for a given HTTP status.\n *\n * @since 2.0.0\n * @param status - The HTTP status code.\n * @param body - Optional response body.\n * @param cause - Optional underlying cause.\n * @returns A remote HTTP error shape.\n * @internal\n */\nexport function create_remote_http_error(\n status: number,\n body?: unknown,\n cause?: unknown,\n): RemoteHttpError {\n\n return { _tag: \"RemoteHttpError\", status, body, cause };\n}\n\n/**\n * Creates a {@link RemoteTransportError} for network or decode failures.\n *\n * @since 2.0.0\n * @param cause - The underlying error that caused the transport failure.\n * @param body - Optional response body if one was received.\n * @returns A remote transport error shape.\n * @internal\n */\nexport function create_remote_transport_error(\n cause: unknown,\n body?: unknown,\n): RemoteTransportError {\n\n return { _tag: \"RemoteTransportError\", cause, body };\n}\n\n/**\n * Wraps a devalue-encoded error string inside a\n * {@link SerializedRemoteFailureEnvelope}.\n *\n * @since 2.0.0\n * @param encoded - The devalue-encoded error value.\n * @returns The wire-format envelope.\n * @internal\n */\nexport function create_serialized_remote_failure_envelope(\n encoded: string,\n): SerializedRemoteFailureEnvelope {\n\n return { __svelte_effect_remote__: true, encoded };\n}\n\n/** Type guards for structured remote error values. */\n\n/**\n * Checks whether a value is a {@link SerializedRemoteFailureEnvelope}.\n *\n * @since 2.0.0\n * @param value - The value to check.\n * @returns `true` when the value is a serialised failure envelope.\n * @internal\n */\nexport function is_serialized_remote_failure_envelope(\n value: unknown,\n): value is SerializedRemoteFailureEnvelope {\n\n return (\n typeof value === \"object\" &&\n value !== null &&\n (value as Record<string, unknown>).__svelte_effect_remote__ === true\n );\n}\n\n/**\n * Checks whether a value is a {@link RemoteValidationError}.\n *\n * @since 2.0.0\n * @param value - The value to check.\n * @returns `true` when the value is a remote validation error.\n */\nexport function is_remote_validation_error(\n value: unknown,\n): value is RemoteValidationError {\n\n return (\n typeof value === \"object\" &&\n value !== null &&\n (value as Record<string, unknown>)._tag === \"RemoteValidationError\"\n );\n}\n\n/**\n * Checks whether a value is a {@link RemoteHttpError}.\n *\n * @since 2.0.0\n * @param value - The value to check.\n * @returns `true` when the value is a remote HTTP error.\n */\nexport function is_remote_http_error(\n value: unknown,\n): value is RemoteHttpError {\n\n return (\n typeof value === \"object\" &&\n value !== null &&\n (value as Record<string, unknown>)._tag === \"RemoteHttpError\"\n );\n}\n\n/**\n * Checks whether a value is a {@link RemoteTransportError}.\n *\n * @since 2.0.0\n * @param value - The value to check.\n * @returns `true` when the value is a remote transport error.\n */\nexport function is_remote_transport_error(\n value: unknown,\n): value is RemoteTransportError {\n\n return (\n typeof value === \"object\" &&\n value !== null &&\n (value as Record<string, unknown>)._tag === \"RemoteTransportError\"\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAa,6BAA6B;;;;;;;;AAS1C,MAAa,uBAAuB,OAAO,IACzC,6CACD;;;;;;;;AAsCD,SAAgB,kBAAkB,QAAyC;AACzE,QAAO;EAAE,MAAM;EAAa;EAAQ;;;;;;;;;AAUtC,SAAgB,cAAc,OAAoC;AAChE,QACE,OAAO,UAAU,YACjB,UAAU,QACT,MAAkC,SAAS;;;;;;;;;;;;;AAsFhD,SAAgB,+BACd,QACA,MACA,SAAS,KACc;AAEvB,QAAO;EAAE,MAAM;EAAyB;EAAQ;EAAM;EAAQ;;;;;;;;;;;;AAahE,SAAgB,yBACd,QACA,MACA,OACiB;AAEjB,QAAO;EAAE,MAAM;EAAmB;EAAQ;EAAM;EAAO;;;;;;;;;;;AAYzD,SAAgB,8BACd,OACA,MACsB;AAEtB,QAAO;EAAE,MAAM;EAAwB;EAAO;EAAM;;;;;;;;;;;AAYtD,SAAgB,0CACd,SACiC;AAEjC,QAAO;EAAE,0BAA0B;EAAM;EAAS;;;;;;;;;;;AAapD,SAAgB,sCACd,OAC0C;AAE1C,QACE,OAAO,UAAU,YACjB,UAAU,QACT,MAAkC,6BAA6B;;;;;;;;;AAWpE,SAAgB,2BACd,OACgC;AAEhC,QACE,OAAO,UAAU,YACjB,UAAU,QACT,MAAkC,SAAS;;;;;;;;;AAWhD,SAAgB,qBACd,OAC0B;AAE1B,QACE,OAAO,UAAU,YACjB,UAAU,QACT,MAAkC,SAAS;;;;;;;;;AAWhD,SAAgB,0BACd,OAC+B;AAE/B,QACE,OAAO,UAAU,YACjB,UAAU,QACT,MAAkC,SAAS"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Result returned by the Svelte markup preprocessor hook.
3
+ *
4
+ * @since 2.0.0
5
+ */
6
+ interface MarkupResult {
7
+ code: string;
8
+ }
9
+ /**
10
+ * Minimal Svelte preprocessor group shape used by the runtime.
11
+ *
12
+ * @since 2.0.0
13
+ */
14
+ interface PreprocessGroup {
15
+ name: string;
16
+ markup(options: {
17
+ content: string;
18
+ filename: string;
19
+ }): MarkupResult;
20
+ }
21
+ /**
22
+ * Svelte preprocessor that lowers `yield*` in script and markup blocks.
23
+ *
24
+ * @example
25
+ * ```js
26
+ * import { preprocess } from "svelte-effect-runtime";
27
+ *
28
+ * export default {
29
+ * preprocess: [preprocess()],
30
+ * };
31
+ * ```
32
+ *
33
+ * @since 2.0.0
34
+ * @returns A Svelte preprocessor group with a `markup` hook.
35
+ */
36
+ export declare function preprocess(): PreprocessGroup;
37
+ export { type BlockRef, type ScriptTransformResult, transform_script_effect, } from "../preprocess.js";
38
+ export { type MarkupTransformResult, transform_markup_effect, } from "../markup/transform.js";
@@ -0,0 +1,54 @@
1
+ import { t as transform_markup_effect } from "../chunks/transform-BtlxgJrg.js";
2
+ import { t as transform_script_effect } from "../chunks/preprocess-BZyUYWY7.js";
3
+ //#region src/runtime/preprocess.ts
4
+ /**
5
+ * Svelte preprocessor that lowers `yield*` in script and markup blocks.
6
+ *
7
+ * @example
8
+ * ```js
9
+ * import { preprocess } from "svelte-effect-runtime";
10
+ *
11
+ * export default {
12
+ * preprocess: [preprocess()],
13
+ * };
14
+ * ```
15
+ *
16
+ * @since 2.0.0
17
+ * @returns A Svelte preprocessor group with a `markup` hook.
18
+ */
19
+ function preprocess() {
20
+ return {
21
+ name: "svelte-effect-runtime",
22
+ markup({ content, filename }) {
23
+ const script = find_script(content);
24
+ let combined = content;
25
+ if (script?.has_effect) {
26
+ const result = transform_script_effect(script.text, filename);
27
+ combined = content.slice(0, script.effect_attr_start) + content.slice(script.effect_attr_end, script.open_end) + result.code + content.slice(script.close_start);
28
+ }
29
+ return { code: transform_markup_effect(combined, filename).code };
30
+ }
31
+ };
32
+ }
33
+ function find_script(content) {
34
+ for (const match of content.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script\s*>/gi)) {
35
+ if (match.index === void 0 || /\bmodule\b/.test(match[1] ?? "")) continue;
36
+ const attrs = match[1] ?? "";
37
+ const effect_match = /\s+effect(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+))?/.exec(attrs);
38
+ const open_end = match.index + match[0].indexOf(">") + 1;
39
+ const attr_start = effect_match?.index ?? attrs.length;
40
+ const attr_end = attr_start + (effect_match?.[0].length ?? 0);
41
+ return {
42
+ text: match[2],
43
+ open_end,
44
+ close_start: match.index + match[0].lastIndexOf("<"),
45
+ has_effect: effect_match !== null,
46
+ effect_attr_start: match.index + 7 + attr_start,
47
+ effect_attr_end: match.index + 7 + attr_end
48
+ };
49
+ }
50
+ }
51
+ //#endregion
52
+ export { preprocess, transform_markup_effect, transform_script_effect };
53
+
54
+ //# sourceMappingURL=preprocess.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preprocess.js","names":[],"sources":["../../../modules/svelte-effect-runtime/src/runtime/preprocess.ts"],"sourcesContent":["import { transform_markup_effect } from \"$/markup/transform.ts\";\nimport { transform_script_effect } from \"$/preprocess.ts\";\n\n/**\n * Result returned by the Svelte markup preprocessor hook.\n *\n * @since 2.0.0\n */\ninterface MarkupResult {\n code: string;\n}\n\n/**\n * Minimal Svelte preprocessor group shape used by the runtime.\n *\n * @since 2.0.0\n */\ninterface PreprocessGroup {\n name: string;\n markup(options: { content: string; filename: string }): MarkupResult;\n}\n\n/**\n * Svelte preprocessor that lowers `yield*` in script and markup blocks.\n *\n * @example\n * ```js\n * import { preprocess } from \"svelte-effect-runtime\";\n *\n * export default {\n * preprocess: [preprocess()],\n * };\n * ```\n *\n * @since 2.0.0\n * @returns A Svelte preprocessor group with a `markup` hook.\n */\nexport function preprocess(): PreprocessGroup {\n return {\n name: \"svelte-effect-runtime\",\n\n markup({ content, filename }: { content: string; filename: string }) {\n const script = find_script(content);\n\n let combined = content;\n\n if (script?.has_effect) {\n const result = transform_script_effect(script.text, filename);\n\n combined = content.slice(0, script.effect_attr_start) +\n content.slice(script.effect_attr_end, script.open_end) +\n result.code +\n content.slice(script.close_start);\n }\n\n const result = transform_markup_effect(combined, filename);\n\n return { code: result.code };\n },\n };\n}\n\nfunction find_script(content: string):\n | {\n text: string;\n open_end: number;\n close_start: number;\n has_effect: boolean;\n effect_attr_start: number;\n effect_attr_end: number;\n }\n | undefined {\n const pattern = /<script\\b([^>]*)>([\\s\\S]*?)<\\/script\\s*>/gi;\n\n for (const match of content.matchAll(pattern)) {\n if (match.index === undefined || /\\bmodule\\b/.test(match[1] ?? \"\")) {\n continue;\n }\n\n const attrs = match[1] ?? \"\";\n const effect_match = /\\s+effect(?:\\s*=\\s*(?:\"[^\"]*\"|'[^']*'|[^\\s>]+))?/\n .exec(attrs);\n const open_end = match.index + match[0].indexOf(\">\") + 1;\n const attr_start = effect_match?.index ?? attrs.length;\n const attr_end = attr_start + (effect_match?.[0].length ?? 0);\n\n return {\n text: match[2],\n open_end,\n close_start: match.index + match[0].lastIndexOf(\"<\"),\n has_effect: effect_match !== null,\n effect_attr_start: match.index + \"<script\".length + attr_start,\n effect_attr_end: match.index + \"<script\".length + attr_end,\n };\n }\n\n return undefined;\n}\n\nexport {\n type BlockRef,\n type ScriptTransformResult,\n transform_script_effect,\n} from \"$/preprocess.ts\";\n\nexport {\n type MarkupTransformResult,\n transform_markup_effect,\n} from \"$/markup/transform.ts\";\n"],"mappings":";;;;;;;;;;;;;;;;;;AAqCA,SAAgB,aAA8B;AAC5C,QAAO;EACL,MAAM;EAEN,OAAO,EAAE,SAAS,YAAmD;GACnE,MAAM,SAAS,YAAY,QAAQ;GAEnC,IAAI,WAAW;AAEf,OAAI,QAAQ,YAAY;IACtB,MAAM,SAAS,wBAAwB,OAAO,MAAM,SAAS;AAE7D,eAAW,QAAQ,MAAM,GAAG,OAAO,kBAAkB,GACnD,QAAQ,MAAM,OAAO,iBAAiB,OAAO,SAAS,GACtD,OAAO,OACP,QAAQ,MAAM,OAAO,YAAY;;AAKrC,UAAO,EAAE,MAFM,wBAAwB,UAAU,SAAS,CAEpC,MAAM;;EAE/B;;AAGH,SAAS,YAAY,SASP;AAGZ,MAAK,MAAM,SAAS,QAAQ,SAFZ,6CAE6B,EAAE;AAC7C,MAAI,MAAM,UAAU,KAAA,KAAa,aAAa,KAAK,MAAM,MAAM,GAAG,CAChE;EAGF,MAAM,QAAQ,MAAM,MAAM;EAC1B,MAAM,eAAe,mDAClB,KAAK,MAAM;EACd,MAAM,WAAW,MAAM,QAAQ,MAAM,GAAG,QAAQ,IAAI,GAAG;EACvD,MAAM,aAAa,cAAc,SAAS,MAAM;EAChD,MAAM,WAAW,cAAc,eAAe,GAAG,UAAU;AAE3D,SAAO;GACL,MAAM,MAAM;GACZ;GACA,aAAa,MAAM,QAAQ,MAAM,GAAG,YAAY,IAAI;GACpD,YAAY,iBAAiB;GAC7B,mBAAmB,MAAM,QAAQ,IAAmB;GACpD,iBAAiB,MAAM,QAAQ,IAAmB;GACnD"}
@@ -0,0 +1,49 @@
1
+ import { Effect } from "effect";
2
+ import type { RequestEvent as RequestEventShape } from "./runtime.js";
3
+ import type { EffectLike, EffectRemoteLiveSource } from "./types.js";
4
+ type ResolvedLiveSource<A> = AsyncIterable<A> | AsyncIterator<A> | Iterable<A> | Iterator<A>;
5
+ type LiveHandlerResult<A> = EffectLike<EffectRemoteLiveSource<A>> | EffectRemoteLiveSource<A>;
6
+ /**
7
+ * Checks whether a value is an Effect generator return object.
8
+ *
9
+ * @since 2.0.0
10
+ * @param value - Value to inspect.
11
+ * @returns Whether the value should be wrapped with `Effect.gen`.
12
+ */
13
+ export declare function is_generator_result<A>(value: unknown): value is Effect.gen.Return<A, unknown, unknown>;
14
+ /**
15
+ * Normalizes an Effect-like handler return value into an Effect.
16
+ *
17
+ * @since 2.0.0
18
+ * @param value - Effect or generator return value.
19
+ * @returns Normalized Effect.
20
+ */
21
+ export declare function to_effect<A>(value: EffectLike<A>): Effect.Effect<A, unknown, unknown>;
22
+ /**
23
+ * Checks whether a value is a live query source SvelteKit can consume.
24
+ *
25
+ * @since 2.0.0
26
+ * @param value - Value to inspect.
27
+ * @returns Whether the value is an Effect Stream or native iterable source.
28
+ */
29
+ export declare function is_live_source<A>(value: unknown): value is EffectRemoteLiveSource<A>;
30
+ /**
31
+ * Runs and normalizes a live query handler result with request services
32
+ * available to Effect Streams.
33
+ *
34
+ * @since 2.0.0
35
+ * @param value - Live query source or Effect that resolves to one.
36
+ * @param event - SvelteKit request event for this remote call.
37
+ * @returns Promise resolving with a source SvelteKit can stream.
38
+ */
39
+ export declare function run_live_handler_source<A>(value: LiveHandlerResult<A>, event: RequestEventShape): Promise<ResolvedLiveSource<A>>;
40
+ /**
41
+ * Runs a remote handler Effect with the current request event provided.
42
+ *
43
+ * @since 2.0.0
44
+ * @param value - Handler return value.
45
+ * @param event - SvelteKit request event for this remote call.
46
+ * @returns Promise resolving with the handler output.
47
+ */
48
+ export declare function run_handler_effect<A>(value: EffectLike<A>, event: RequestEventShape): Promise<A>;
49
+ export {};
@@ -0,0 +1,97 @@
1
+ import { prerender as native_prerender } from "$app/server";
2
+ import type { RemoteFormInput } from "@sveltejs/kit";
3
+ import { type Schema } from "effect";
4
+ import type { EffectLike, EffectRemoteBatchHandler, EffectRemoteCommand, EffectRemoteForm, EffectRemoteLiveQueryFunction, EffectRemoteLiveSource, EffectRemoteQueryFunction, PrerenderOptions, RemoteFormHandler, RemoteHandler, SchemaInput } from "./types.js";
5
+ type FormSchemaInput<S> = SchemaInput<S> extends RemoteFormInput ? SchemaInput<S> : never;
6
+ type RemoteLiveHandler<Input = unknown, A = unknown> = EffectLike<EffectRemoteLiveSource<A>> | EffectRemoteLiveSource<A> | ((input: Input) => EffectLike<EffectRemoteLiveSource<A>> | EffectRemoteLiveSource<A>);
7
+ interface QueryFactory {
8
+ <A>(validate_or_handler: EffectLike<A> | RemoteHandler<void, A>): EffectRemoteQueryFunction<void, A>;
9
+ <Input, A>(validate_or_handler: "unchecked", maybe_handler: RemoteHandler<Input, A>): EffectRemoteQueryFunction<Input, A>;
10
+ <S extends Schema.Schema<unknown>, A>(validate_or_handler: S, maybe_handler: RemoteHandler<SchemaInput<S>, A>): EffectRemoteQueryFunction<SchemaInput<S>, A>;
11
+ readonly batch: typeof QueryBatch;
12
+ readonly live: typeof QueryLive;
13
+ }
14
+ /**
15
+ * Factory for a batched read-only remote query function.
16
+ *
17
+ * @since 2.0.0
18
+ * @param validate_or_handler - A schema or `"unchecked"` sentinel.
19
+ * @param maybe_handler - Handler receiving validated inputs as one batch.
20
+ * @returns A SvelteKit batch query function.
21
+ */
22
+ declare function QueryBatch<Input, A>(validate_or_handler: "unchecked", maybe_handler: EffectRemoteBatchHandler<Input, A>): EffectRemoteQueryFunction<Input, A>;
23
+ declare function QueryBatch<S extends Schema.Schema<unknown>, A>(validate_or_handler: S, maybe_handler: EffectRemoteBatchHandler<SchemaInput<S>, A>): EffectRemoteQueryFunction<SchemaInput<S>, A>;
24
+ /**
25
+ * Factory for a live remote query function.
26
+ *
27
+ * @since 2.0.0
28
+ * @param validate_or_handler - A schema, `"unchecked"`, or no-arg live handler.
29
+ * @param maybe_handler - Handler used when a validator is supplied.
30
+ * @returns A SvelteKit live query function.
31
+ */
32
+ declare function QueryLive<A>(validate_or_handler: RemoteLiveHandler<void, A>): EffectRemoteLiveQueryFunction<void, A>;
33
+ declare function QueryLive<Input, A>(validate_or_handler: "unchecked", maybe_handler: RemoteLiveHandler<Input, A>): EffectRemoteLiveQueryFunction<Input, A>;
34
+ declare function QueryLive<S extends Schema.Schema<unknown>, A>(validate_or_handler: S, maybe_handler: RemoteLiveHandler<SchemaInput<S>, A>): EffectRemoteLiveQueryFunction<SchemaInput<S>, A>;
35
+ /**
36
+ * Factory for read-only remote query functions.
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * export const getUser = Query(Schema.Struct({ id: Schema.String }), (input) =>
41
+ * Effect.succeed(input.id)
42
+ * );
43
+ *
44
+ * export const getUserBatch = Query.batch(Schema.String, (ids) =>
45
+ * Effect.succeed((id) => ids.includes(id))
46
+ * );
47
+ * ```
48
+ *
49
+ * @since 2.0.0
50
+ */
51
+ export declare const Query: QueryFactory;
52
+ /**
53
+ * Factory for a write-oriented remote command function.
54
+ *
55
+ * @since 2.0.0
56
+ * @param validate_or_handler - A schema, `"unchecked"`, or no-arg handler.
57
+ * @param maybe_handler - Handler used when a validator is supplied.
58
+ * @returns A SvelteKit command function.
59
+ */
60
+ export declare function Command<A>(validate_or_handler: EffectLike<A> | RemoteHandler<void, A>): EffectRemoteCommand<void, A>;
61
+ export declare function Command<Input, A>(validate_or_handler: "unchecked", maybe_handler: RemoteHandler<Input, A>): EffectRemoteCommand<Input, A>;
62
+ export declare function Command<S extends Schema.Schema<unknown>, A>(validate_or_handler: S, maybe_handler: RemoteHandler<SchemaInput<S>, A>): EffectRemoteCommand<SchemaInput<S>, A>;
63
+ /**
64
+ * Factory for a remote form handler.
65
+ *
66
+ * @example
67
+ * ```ts
68
+ * export const SignIn = Form(signInSchema, ({ data, invalid }) =>
69
+ * Effect.gen(function* () {
70
+ * if (!data.email.includes("@")) {
71
+ * return yield* invalid.email("Use an email address.");
72
+ * }
73
+ *
74
+ * return { email: data.email };
75
+ * })
76
+ * );
77
+ * ```
78
+ *
79
+ * @since 2.0.0
80
+ * @param validate_or_handler - A schema, `"unchecked"`, or no-arg handler.
81
+ * @param maybe_handler - Handler used when a validator is supplied.
82
+ * @returns A SvelteKit form function.
83
+ */
84
+ export declare function Form<A>(validate_or_handler: EffectLike<A> | RemoteFormHandler<void, A>): EffectRemoteForm<void, A>;
85
+ export declare function Form<Input extends RemoteFormInput, A>(validate_or_handler: "unchecked", maybe_handler: RemoteFormHandler<Input, A>): EffectRemoteForm<Input, A>;
86
+ export declare function Form<S extends Schema.Schema<unknown>, A>(validate_or_handler: S, maybe_handler: RemoteFormHandler<FormSchemaInput<S>, A>): EffectRemoteForm<FormSchemaInput<S>, A>;
87
+ /**
88
+ * Factory for a prerenderable remote function.
89
+ *
90
+ * @since 2.0.0
91
+ * @param validate_or_handler - A schema, `"unchecked"`, or no-arg handler.
92
+ * @param maybe_handler_or_options - Handler or prerender options.
93
+ * @param maybe_options - Prerender options used with a validator.
94
+ * @returns A SvelteKit prerender function.
95
+ */
96
+ export declare function Prerender(validate_or_handler: unknown, maybe_handler_or_options?: RemoteHandler | PrerenderOptions, maybe_options?: PrerenderOptions): ReturnType<typeof native_prerender>;
97
+ export {};
@@ -0,0 +1,3 @@
1
+ export { Command, Form, Prerender, Query } from "./factories.js";
2
+ export { get_server_runtime_or_throw, RequestEvent, ServerRuntime, } from "./runtime.js";
3
+ export type { EffectLike, EffectRemoteBatchHandler, EffectRemoteCommand, EffectRemoteForm, EffectRemoteFunction, EffectRemoteLiveQuery, EffectRemoteLiveQueryFunction, EffectRemoteLiveSource, EffectRemoteQuery, EffectRemoteQueryFunction, FormInvalid, CommandFactory, FormFactory, PrerenderOptions, PrerenderFactory, QueryBatchFactory, QueryFactory, QueryLiveFactory, RemoteLiveHandler, RemoteFormHandler, RemoteHandler, SchemaInput, ServerRuntimeFactory, StandardSchema, } from "./types.js";
@@ -0,0 +1,9 @@
1
+ import type { FormInvalid } from "./types.js";
2
+ /**
3
+ * Creates a path-aware proxy for remote form validation failures.
4
+ *
5
+ * @since 2.0.0
6
+ * @param path - Current nested form path.
7
+ * @returns Callable invalid proxy for this path.
8
+ */
9
+ export declare function make_invalid_proxy(path?: readonly (string | number)[]): FormInvalid;
@@ -0,0 +1,66 @@
1
+ import { Context, Layer, ManagedRuntime } from "effect";
2
+ /**
3
+ * Subset of SvelteKit's `RequestEvent` that remote handlers typically access.
4
+ *
5
+ * @since 2.0.0
6
+ */
7
+ export interface RequestEvent {
8
+ readonly url: URL;
9
+ readonly request: Request;
10
+ readonly cookies: {
11
+ get(name: string): string | undefined;
12
+ set(name: string, value: string, opts?: Record<string, unknown>): void;
13
+ delete(name: string, opts?: Record<string, unknown>): void;
14
+ serialize(name: string, value: string, opts?: Record<string, unknown>): string;
15
+ };
16
+ readonly locals: Record<string, unknown>;
17
+ readonly params: Record<string, string>;
18
+ readonly route: {
19
+ id: string | null;
20
+ };
21
+ readonly platform?: unknown;
22
+ readonly getClientAddress: () => string;
23
+ }
24
+ /**
25
+ * SvelteKit's `RequestEvent` exposed as an Effect {@link Context.Tag}.
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * const event = yield* RequestEvent;
30
+ * ```
31
+ *
32
+ * @since 2.0.0
33
+ */
34
+ export declare const RequestEvent: Context.Reference<RequestEvent>;
35
+ /**
36
+ * Builder for the server-side Effect runtime.
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * ServerRuntime.make(Db.Live);
41
+ * ```
42
+ *
43
+ * @since 2.0.0
44
+ */
45
+ export declare class ServerRuntime {
46
+ /**
47
+ * Build and cache the server-side `ManagedRuntime`.
48
+ *
49
+ * @since 2.0.0
50
+ * @param layer - Optional Effect layer to provide to the runtime.
51
+ * @returns The configured ManagedRuntime.
52
+ */
53
+ static make<R = never>(layer?: Layer.Layer<R>): ManagedRuntime.ManagedRuntime<R, never>;
54
+ }
55
+ /**
56
+ * Returns the active server runtime, creating a default one if needed.
57
+ *
58
+ * @example
59
+ * ```ts
60
+ * const runtime = get_server_runtime_or_throw();
61
+ * ```
62
+ *
63
+ * @since 2.0.0
64
+ * @returns The current ManagedRuntime instance.
65
+ */
66
+ export declare function get_server_runtime_or_throw(): ManagedRuntime.ManagedRuntime<unknown, never>;
@@ -0,0 +1,42 @@
1
+ import { Schema } from "effect";
2
+ import type { RemoteHandler, StandardSchema } from "./types.js";
3
+ /**
4
+ * Checks whether a value is the string sentinel for unchecked remotes.
5
+ *
6
+ * @since 2.0.0
7
+ * @param value - Value to inspect.
8
+ * @returns Whether the value is `"unchecked"`.
9
+ */
10
+ export declare function is_unchecked(value: unknown): value is "unchecked";
11
+ /**
12
+ * Checks whether a value is a remote handler function.
13
+ *
14
+ * @since 2.0.0
15
+ * @param value - Value to inspect.
16
+ * @returns Whether the value is callable as a handler.
17
+ */
18
+ export declare function is_handler(value: unknown): value is RemoteHandler;
19
+ /**
20
+ * Checks whether a value implements the Standard Schema contract.
21
+ *
22
+ * @since 2.0.0
23
+ * @param value - Value to inspect.
24
+ * @returns Whether the value is a Standard Schema.
25
+ */
26
+ export declare function is_standard_schema(value: unknown): value is StandardSchema;
27
+ /**
28
+ * Checks whether a value looks like an Effect Schema.
29
+ *
30
+ * @since 2.0.0
31
+ * @param value - Value to inspect.
32
+ * @returns Whether the value should be converted to Standard Schema.
33
+ */
34
+ export declare function is_effect_schema(value: unknown): value is Schema.Schema<unknown>;
35
+ /**
36
+ * Converts Effect Schema inputs to Standard Schema for SvelteKit.
37
+ *
38
+ * @since 2.0.0
39
+ * @param value - Schema or handler input.
40
+ * @returns Original value or Standard Schema view of an Effect Schema.
41
+ */
42
+ export declare function normalize_validator(value: unknown): unknown;