svelte-effect-runtime 3.4.7 → 3.4.8

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 (48) hide show
  1. package/.dist/chunks/{client-CsVu54pU.js → client-D_DE2cFa.js} +11 -42
  2. package/.dist/chunks/{client-CsVu54pU.js.map → client-D_DE2cFa.js.map} +1 -1
  3. package/.dist/chunks/{dispatcher-pHH4JcFR.js → dispatcher-BdvO4AAS.js} +2 -2
  4. package/.dist/chunks/{dispatcher-pHH4JcFR.js.map → dispatcher-BdvO4AAS.js.map} +1 -1
  5. package/.dist/chunks/{dispatcher-LtvFKYUp.js → dispatcher-NpL5xhWF.js} +3 -3
  6. package/.dist/chunks/{dispatcher-LtvFKYUp.js.map → dispatcher-NpL5xhWF.js.map} +1 -1
  7. package/.dist/chunks/{errors-Dcf0MVbq.js → errors-Bl3NVEez.js} +21 -3
  8. package/.dist/chunks/{errors-Dcf0MVbq.js.map → errors-Bl3NVEez.js.map} +1 -1
  9. package/.dist/chunks/live-DEmS7qpO.js +103 -0
  10. package/.dist/chunks/live-DEmS7qpO.js.map +1 -0
  11. package/.dist/chunks/{runtime-ekkMQ-wL.js → runtime-BNNW2GDT.js} +3 -3
  12. package/.dist/chunks/{runtime-ekkMQ-wL.js.map → runtime-BNNW2GDT.js.map} +1 -1
  13. package/.dist/chunks/{transform-CEK6Ccll.js → transform-C2fCVPL_.js} +172 -105
  14. package/.dist/chunks/transform-C2fCVPL_.js.map +1 -0
  15. package/.dist/dispatcher.js +1 -1
  16. package/.dist/errors.d.ts +15 -0
  17. package/.dist/generators.d.ts +3 -1
  18. package/.dist/internal/generators.js +20 -3
  19. package/.dist/internal/generators.js.map +1 -0
  20. package/.dist/internal/remote-client.js +1 -1
  21. package/.dist/live.d.ts +100 -0
  22. package/.dist/markup/promise.js +1 -1
  23. package/.dist/markup/run.js +1 -1
  24. package/.dist/markup/transform/constants.d.ts +1 -0
  25. package/.dist/markup/transform/types.d.ts +1 -0
  26. package/.dist/markup/transform.js +1 -1
  27. package/.dist/markup/value.js +1 -1
  28. package/.dist/mod.d.ts +5 -2
  29. package/.dist/mod.js +4 -3
  30. package/.dist/mod.js.map +1 -1
  31. package/.dist/remote/client/query.d.ts +6 -16
  32. package/.dist/remote/client/types.d.ts +2 -11
  33. package/.dist/remote/client.js +1 -1
  34. package/.dist/remote/server.js +1 -1
  35. package/.dist/runtime/transform.js +57 -26
  36. package/.dist/runtime/transform.js.map +1 -1
  37. package/.dist/script-transform/imports.d.ts +2 -0
  38. package/.dist/script-transform/types.d.ts +8 -0
  39. package/.dist/server/effects.d.ts +7 -7
  40. package/.dist/server/index.d.ts +3 -1
  41. package/.dist/server/types.d.ts +25 -50
  42. package/.dist/server/wrappers.d.ts +2 -2
  43. package/.dist/server.d.ts +2 -2
  44. package/.dist/server.js +40 -65
  45. package/.dist/server.js.map +1 -1
  46. package/.dist/yieldable.d.ts +41 -0
  47. package/package.json +1 -1
  48. package/.dist/chunks/transform-CEK6Ccll.js.map +0 -1
@@ -1,8 +1,8 @@
1
- import { Effect } from "effect";
1
+ import { Effect, Stream } from "effect";
2
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>, unknown, unknown> | EffectRemoteLiveSource<A>;
3
+ import type { EffectLike } from "./types.js";
4
+ type ResolvedLiveSource<A> = AsyncIterable<A>;
5
+ type LiveHandlerResult<A> = Stream.Stream<A, unknown, unknown>;
6
6
  /**
7
7
  * Checks whether a value is an Effect generator return object.
8
8
  *
@@ -34,13 +34,13 @@ export declare function ToEffect<A, E, R>(value: EffectLike<A, E, R>): Effect.Ef
34
34
  */
35
35
  export declare const to_effect: typeof ToEffect;
36
36
  /**
37
- * Checks whether a value is a live query source SvelteKit can consume.
37
+ * Checks whether a value is an Effect Stream live source.
38
38
  *
39
39
  * @since 2.0.0
40
40
  * @param value - Value to inspect.
41
- * @returns Whether the value is an Effect Stream or native iterable source.
41
+ * @returns Whether the value is an Effect Stream.
42
42
  */
43
- export declare function is_live_source<A>(value: unknown): value is EffectRemoteLiveSource<A>;
43
+ export declare function is_live_source<A>(value: unknown): value is Stream.Stream<A, unknown, unknown>;
44
44
  /**
45
45
  * Runs and normalizes a live query handler result with request services
46
46
  * available to Effect Streams.
@@ -2,5 +2,7 @@ export { Command, Form, Prerender, Query } from "./factories.js";
2
2
  export { Error, Redirect } from "./control-flow.js";
3
3
  export { get_server_runtime_or_throw, RequestEvent, ServerRuntime } from "./runtime.js";
4
4
  export { RuntimeAlreadyInitializedError } from "../errors.js";
5
+ export { Live } from "../live.js";
6
+ export type { LiveFactory, LiveStatus, RemoteLiveStream } from "../live.js";
5
7
  export type { ErrorBody, ErrorEffectFactory, ErrorProperties, ErrorStatus, ErrorStatusName, RedirectEffectFactory, RedirectOptions, RedirectStatus, RedirectStatusName, } from "./control-flow.js";
6
- export type { CommandFactory, EffectLike, EffectRemoteBatchHandler, EffectRemoteCommand, EffectRemoteForm, EffectRemoteFunction, EffectRemoteLiveQuery, EffectRemoteLiveQueryFunction, EffectRemoteLiveQueryResource, EffectRemoteLiveSource, EffectRemoteQuery, EffectRemoteQueryFunction, FormFactory, FormInvalid, PrerenderFactory, PrerenderOptions, QueryBatchFactory, QueryFactory, QueryLiveFactory, RemoteFormHandler, RemoteHandler, RemoteLiveHandler, SchemaEncodedInput, SchemaInput, ServerRuntimeFactory, StandardSchema, StandardSchemaInput, StandardSchemaOutput, } from "./types.js";
8
+ export type { CommandFactory, EffectLike, EffectRemoteBatchHandler, EffectRemoteCommand, EffectRemoteForm, EffectRemoteFunction, EffectRemoteLiveQuery, EffectRemoteLiveQueryFunction, EffectRemoteQuery, EffectRemoteQueryFunction, FormFactory, FormInvalid, PrerenderFactory, PrerenderOptions, QueryBatchFactory, QueryFactory, QueryLiveFactory, RemoteFormHandler, RemoteHandler, RemoteLiveHandler, RemoteLiveSource, SchemaEncodedInput, SchemaInput, ServerRuntimeFactory, StandardSchema, StandardSchemaInput, StandardSchemaOutput, } from "./types.js";
@@ -1,6 +1,7 @@
1
1
  import type { create_form_error, RemoteFailure } from "../remote/shared.js";
2
2
  import type { RemoteFormInput, RemoteQuery, RemoteQueryOverride } from "@sveltejs/kit";
3
3
  import type { EffectRemoteForm as ClientEffectRemoteForm } from "../remote/client.js";
4
+ import type { RemoteLiveStream } from "../live.js";
4
5
  import type { Effect, Layer, ManagedRuntime, Schema, Stream } from "effect";
5
6
  /**
6
7
  * Effect-like values accepted by remote helper wrappers.
@@ -26,17 +27,28 @@ export type EffectLike<A = unknown, E = unknown, R = unknown> = Effect.Effect<A,
26
27
  */
27
28
  export type RemoteHandler<Input = unknown, A = unknown, E = unknown, R = unknown> = (input: Input) => EffectLike<A, E, R>;
28
29
  /**
29
- * Handler or source shape accepted by live query helpers.
30
+ * Source shape accepted by no-argument live query helpers.
30
31
  *
31
32
  * @example
32
33
  * ```ts
33
- * const handler: RemoteLiveHandler<void, number> = () =>
34
- * Stream.make(1, 2, 3);
34
+ * const source: RemoteLiveSource<number> = Stream.make(1, 2, 3);
35
+ * ```
36
+ *
37
+ * @since 3.4.8
38
+ */
39
+ export type RemoteLiveSource<A = unknown, E = unknown, R = unknown> = Stream.Stream<A, E, R>;
40
+ /**
41
+ * Handler shape accepted by input-bearing live query helpers.
42
+ *
43
+ * @example
44
+ * ```ts
45
+ * const handler: RemoteLiveHandler<string, number> = (id) =>
46
+ * Stream.make(id.length);
35
47
  * ```
36
48
  *
37
49
  * @since 2.0.0
38
50
  */
39
- export type RemoteLiveHandler<Input = unknown, A = unknown, E = unknown, R = unknown> = EffectLike<EffectRemoteLiveSource<A>, E, R> | EffectRemoteLiveSource<A> | ((input: Input) => EffectLike<EffectRemoteLiveSource<A>, E, R> | EffectRemoteLiveSource<A>);
51
+ export type RemoteLiveHandler<Input = unknown, A = unknown, E = unknown, R = unknown> = (input: Input) => Stream.Stream<A, E, R>;
40
52
  /**
41
53
  * Handler shape accepted by batch query helpers. The handler receives the
42
54
  * validated inputs collected by SvelteKit and returns an Effect-producing
@@ -262,7 +274,7 @@ export interface QueryBatchFactory {
262
274
  * @since 2.0.0
263
275
  */
264
276
  export interface QueryLiveFactory {
265
- <A, E = never, R = never>(validate_or_handler: RemoteLiveHandler<void, A, E, R>): EffectRemoteLiveQueryFunction<void, A, E>;
277
+ <A, E = never, R = never>(validate_or_handler: RemoteLiveSource<A, E, R> | RemoteLiveHandler<void, A, E, R>): EffectRemoteLiveQueryFunction<void, A, E>;
266
278
  <Input, A, E = never, R = never>(validate_or_handler: "unchecked", maybe_handler: RemoteLiveHandler<Input, A, E, R>): EffectRemoteLiveQueryFunction<Input, A, E>;
267
279
  <S extends Schema.Schema<unknown>, A, E = never, R = never>(validate_or_handler: S, maybe_handler: RemoteLiveHandler<SchemaInput<S>, A, E, R>): EffectRemoteLiveQueryFunction<SchemaEncodedInput<S>, A, E>;
268
280
  <S extends StandardSchema, A, E = never, R = never>(validate_or_handler: S, maybe_handler: RemoteLiveHandler<StandardSchemaOutput<S>, A, E, R>): EffectRemoteLiveQueryFunction<StandardSchemaInput<S>, A, E>;
@@ -321,17 +333,6 @@ export interface PrerenderFactory {
321
333
  <S extends Schema.Schema<unknown>, A, E = never, R = never>(validate_or_handler: S, maybe_handler: RemoteHandler<SchemaInput<S>, A, E, R>, maybe_options?: PrerenderOptions): EffectRemoteFunction<SchemaEncodedInput<S>, A, E>;
322
334
  <S extends StandardSchema, A, E = never, R = never>(validate_or_handler: S, maybe_handler: RemoteHandler<StandardSchemaOutput<S>, A, E, R>, maybe_options?: PrerenderOptions): EffectRemoteFunction<StandardSchemaInput<S>, A, E>;
323
335
  }
324
- /**
325
- * Source values accepted by live query helpers.
326
- *
327
- * @example
328
- * ```ts
329
- * const source: EffectRemoteLiveSource<number> = Stream.make(1, 2, 3);
330
- * ```
331
- *
332
- * @since 2.0.0
333
- */
334
- export type EffectRemoteLiveSource<A> = Stream.Stream<A, unknown, unknown> | AsyncIterable<A> | AsyncIterator<A> | Iterable<A> | Iterator<A>;
335
336
  /**
336
337
  * Effect-returning remote function type exposed by query and prerender.
337
338
  *
@@ -381,52 +382,26 @@ export type EffectRemoteQuery<A, E = never> = Effect.Effect<A, RemoteFailure<E>,
381
382
  */
382
383
  export type EffectRemoteQueryFunction<Input, A, E = never> = [Input] extends [void] ? () => EffectRemoteQuery<A, E> : undefined extends Input ? (input?: Input) => EffectRemoteQuery<A, E> : (input: Input) => EffectRemoteQuery<A, E>;
383
384
  /**
384
- * Live query resource with SvelteKit live stream state and reconnect controls
385
- * preserved.
386
- *
387
- * @example
388
- * ```ts
389
- * const clock = yield* getClock();
390
- * yield* clock.reconnect();
391
- *
392
- * for await (const value of clock) {
393
- * console.log(value);
394
- * }
395
- * ```
396
- *
397
- * @since 2.0.0
398
- */
399
- export type EffectRemoteLiveQueryResource<A> = {
400
- readonly connected: boolean;
401
- readonly current: A | undefined;
402
- readonly done: boolean;
403
- readonly error: unknown;
404
- readonly loading: boolean;
405
- readonly ready: boolean;
406
- readonly reconnect: () => Effect.Effect<void, unknown, never>;
407
- } & AsyncIterable<A>;
408
- /**
409
- * Effect-returning live query whose yielded value is the live resource.
385
+ * Remote live query stream.
410
386
  *
411
387
  * @example
412
388
  * ```ts
413
- * const clock = yield* getClock();
414
- * const current = clock.current;
389
+ * const clock = getClock();
390
+ * const first = yield* Stream.runHead(clock);
415
391
  * ```
416
392
  *
417
- * @since 2.2.0
393
+ * @since 3.4.8
418
394
  */
419
- export type EffectRemoteLiveQuery<A, E = never> = Effect.Effect<EffectRemoteLiveQueryResource<A>, RemoteFailure<E>, never>;
395
+ export type EffectRemoteLiveQuery<A, E = never> = RemoteLiveStream<A, E>;
420
396
  /**
421
- * Effect-returning remote live query function with SvelteKit live stream
422
- * properties preserved on the returned Effect.
397
+ * Remote live query function returning an Effect Stream.
423
398
  *
424
399
  * @example
425
400
  * ```ts
426
- * const clock = yield* getClock();
401
+ * const clock = getClock();
427
402
  * ```
428
403
  *
429
- * @since 2.2.0
404
+ * @since 3.4.8
430
405
  */
431
406
  export type EffectRemoteLiveQueryFunction<Input, A, E = never> = [Input] extends [void] ? () => EffectRemoteLiveQuery<A, E> : undefined extends Input ? (input?: Input) => EffectRemoteLiveQuery<A, E> : (input: Input) => EffectRemoteLiveQuery<A, E>;
432
407
  /**
@@ -1,4 +1,4 @@
1
- import type { EffectLike, RemoteFormHandler, RemoteHandler, RemoteLiveHandler } from "./types.js";
1
+ import type { EffectLike, RemoteFormHandler, RemoteHandler, RemoteLiveHandler, RemoteLiveSource } from "./types.js";
2
2
  /**
3
3
  * Reports whether SER is currently executing user remote handler code.
4
4
  *
@@ -31,7 +31,7 @@ export declare function make_remote_wrapper(handler: RemoteHandler<unknown, unkn
31
31
  * @param helper_name - Remote helper name for error normalization.
32
32
  * @returns Native SvelteKit live query wrapper.
33
33
  */
34
- export declare function make_remote_live_wrapper<Input, A>(handler: RemoteLiveHandler<Input, A, unknown, unknown>, helper_name: string): (input: unknown) => Promise<unknown>;
34
+ export declare function make_remote_live_wrapper<Input, A>(handler: RemoteLiveSource<A, unknown, unknown> | RemoteLiveHandler<Input, A, unknown, unknown>, helper_name: string): (input: unknown) => Promise<unknown>;
35
35
  /**
36
36
  * Builds the wrapper passed to native form helpers.
37
37
  *
package/.dist/server.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { Command, Error, Form, get_server_runtime_or_throw, Prerender, Query, Redirect, RequestEvent, ServerRuntime, } from "./server/index.js";
2
- export type { CommandFactory, EffectLike, EffectRemoteBatchHandler, EffectRemoteCommand, EffectRemoteForm, EffectRemoteFunction, EffectRemoteLiveQuery, EffectRemoteLiveQueryFunction, EffectRemoteLiveQueryResource, EffectRemoteLiveSource, EffectRemoteQuery, EffectRemoteQueryFunction, ErrorBody, ErrorEffectFactory, ErrorProperties, ErrorStatus, ErrorStatusName, FormFactory, FormInvalid, PrerenderFactory, PrerenderOptions, QueryBatchFactory, QueryFactory, QueryLiveFactory, RedirectEffectFactory, RedirectOptions, RedirectStatus, RedirectStatusName, RemoteFormHandler, RemoteHandler, RemoteLiveHandler, SchemaEncodedInput, SchemaInput, ServerRuntimeFactory, StandardSchema, StandardSchemaInput, StandardSchemaOutput, } from "./server/index.js";
1
+ export { Command, Error, Form, get_server_runtime_or_throw, Live, Prerender, Query, Redirect, RequestEvent, ServerRuntime, } from "./server/index.js";
2
+ export type { CommandFactory, EffectLike, EffectRemoteBatchHandler, EffectRemoteCommand, EffectRemoteForm, EffectRemoteFunction, EffectRemoteLiveQuery, EffectRemoteLiveQueryFunction, EffectRemoteQuery, EffectRemoteQueryFunction, ErrorBody, ErrorEffectFactory, ErrorProperties, ErrorStatus, ErrorStatusName, FormFactory, FormInvalid, LiveFactory, LiveStatus, PrerenderFactory, PrerenderOptions, QueryBatchFactory, QueryFactory, QueryLiveFactory, RedirectEffectFactory, RedirectOptions, RedirectStatus, RedirectStatusName, RemoteFormHandler, RemoteHandler, RemoteLiveStream, RemoteLiveHandler, RemoteLiveSource, SchemaEncodedInput, SchemaInput, ServerRuntimeFactory, StandardSchema, StandardSchemaInput, StandardSchemaOutput, } from "./server/index.js";
package/.dist/server.js CHANGED
@@ -1,9 +1,10 @@
1
- import { C as UncheckedLiveQueryHandlerMissingError, S as UncheckedFormHandlerMissingError, T as UncheckedQueryHandlerMissingError, c as InvalidLiveQueryReturnError, i as BatchQueryHandlerMissingError, w as UncheckedPrerenderHandlerMissingError, x as UncheckedCommandHandlerMissingError } from "./chunks/errors-Dcf0MVbq.js";
2
- import { create_form_error } from "./remote/shared.js";
1
+ import { C as UncheckedFormHandlerMissingError, E as UncheckedQueryHandlerMissingError, S as UncheckedCommandHandlerMissingError, T as UncheckedPrerenderHandlerMissingError, i as BatchQueryHandlerMissingError, l as InvalidLiveQueryReturnError, w as UncheckedLiveQueryHandlerMissingError } from "./chunks/errors-Bl3NVEez.js";
2
+ import { n as make_remote_live_stream, t as Live } from "./chunks/live-DEmS7qpO.js";
3
+ import { create_form_error, create_remote_transport_error, create_serialized_remote_failure_envelope } from "./remote/shared.js";
3
4
  import { t as copy_property_descriptors } from "./chunks/descriptors-cOe9uRJz.js";
4
- import { normalize_remote_helper_error, run_remote_effect } from "./remote/server.js";
5
- import { i as get_server_runtime_or_throw, n as ServerRuntime, t as RequestEvent } from "./chunks/runtime-ekkMQ-wL.js";
6
- import { Effect, Schema, Stream } from "effect";
5
+ import { encode_remote_failure, normalize_remote_helper_error, run_remote_effect } from "./remote/server.js";
6
+ import { i as get_server_runtime_or_throw, n as ServerRuntime, t as RequestEvent } from "./chunks/runtime-BNNW2GDT.js";
7
+ import { Cause, Effect, Schema, Stream } from "effect";
7
8
  import { error, invalid, redirect } from "@sveltejs/kit";
8
9
  import { command, form, getRequestEvent, prerender, query } from "$app/server";
9
10
  //#region src/server/schema.ts
@@ -82,17 +83,14 @@ function ToEffect(value) {
82
83
  return value;
83
84
  }
84
85
  /**
85
- * Checks whether a value is a live query source SvelteKit can consume.
86
+ * Checks whether a value is an Effect Stream live source.
86
87
  *
87
88
  * @since 2.0.0
88
89
  * @param value - Value to inspect.
89
- * @returns Whether the value is an Effect Stream or native iterable source.
90
+ * @returns Whether the value is an Effect Stream.
90
91
  */
91
92
  function is_live_source(value) {
92
- if (Stream.isStream(value)) return true;
93
- if (typeof value !== "object" || value === null) return false;
94
- const source = value;
95
- return typeof source.next === "function" || typeof source[Symbol.asyncIterator] === "function" || typeof source[Symbol.iterator] === "function";
93
+ return Stream.isStream(value);
96
94
  }
97
95
  /**
98
96
  * Runs and normalizes a live query handler result with request services
@@ -104,17 +102,40 @@ function is_live_source(value) {
104
102
  * @returns Promise resolving with a source SvelteKit can stream.
105
103
  */
106
104
  function run_live_handler_source(value, event) {
105
+ if (!is_live_source(value)) throw new InvalidLiveQueryReturnError();
107
106
  const runtime = get_server_runtime_or_throw();
108
107
  return run_remote_effect(Effect.provideService(ToLiveSourceEffect(value), RequestEvent, event), runtime, invalid, svelte_remote_error);
109
108
  }
110
109
  function ToLiveSourceEffect(value) {
111
- if (Stream.isStream(value)) return Stream.toAsyncIterableEffect(value);
112
- if (is_native_live_source(value)) return Effect.succeed(value);
113
- if (!Effect.isEffect(value)) return Effect.fail(new InvalidLiveQueryReturnError());
114
- return Effect.flatMap(value, ToLiveSourceEffect);
110
+ return Stream.toAsyncIterableEffect(value).pipe(Effect.map(wrap_live_source_errors));
115
111
  }
116
- function is_native_live_source(value) {
117
- return is_live_source(value) && !Stream.isStream(value);
112
+ function wrap_live_source_errors(source) {
113
+ return { [Symbol.asyncIterator]() {
114
+ const iterator = source[Symbol.asyncIterator]();
115
+ return {
116
+ async next() {
117
+ try {
118
+ return await iterator.next();
119
+ } catch (error) {
120
+ throw_live_source_error(error);
121
+ }
122
+ },
123
+ async return(value) {
124
+ if (iterator.return) return await iterator.return(value);
125
+ return {
126
+ done: true,
127
+ value: void 0
128
+ };
129
+ },
130
+ async throw(error) {
131
+ if (iterator.throw) return await iterator.throw(error);
132
+ throw_live_source_error(error);
133
+ }
134
+ };
135
+ } };
136
+ }
137
+ function throw_live_source_error(error$2) {
138
+ error(500, create_serialized_remote_failure_envelope(encode_remote_failure(Cause.fail(error$2))));
118
139
  }
119
140
  /**
120
141
  * Runs a remote handler Effect with the current request event provided.
@@ -299,12 +320,7 @@ function is_request_event_context_error(error) {
299
320
  }
300
321
  function to_effect_live_query(native) {
301
322
  const wrapped = ((input) => {
302
- return Effect.try({
303
- try: () => {
304
- return make_live_resource(native(input));
305
- },
306
- catch: (error) => error
307
- });
323
+ return make_remote_live_stream(native(input), create_remote_transport_error);
308
324
  });
309
325
  copy_property_descriptors(native, wrapped);
310
326
  return wrapped;
@@ -313,10 +329,6 @@ function is_query_resource(resource) {
313
329
  const resource_type = typeof resource;
314
330
  return resource_type === "object" && resource !== null || resource_type === "function";
315
331
  }
316
- function is_live_resource(resource) {
317
- const resource_type = typeof resource;
318
- return resource_type === "object" && resource !== null || resource_type === "function";
319
- }
320
332
  function attach_remote_resource_getters(resource, effect) {
321
333
  const methods = is_query_resource(resource) ? resource : void 0;
322
334
  const keys = [
@@ -357,43 +369,6 @@ function attach_query_resource_methods(resource, effect) {
357
369
  value: (update) => with_override.call(resource, update)
358
370
  });
359
371
  }
360
- function attach_live_resource_methods(resource, effect) {
361
- const methods = is_live_resource(resource) ? resource : void 0;
362
- const reconnect = methods?.reconnect;
363
- const async_iterator = methods?.[Symbol.asyncIterator];
364
- const keys = [
365
- "connected",
366
- "current",
367
- "done",
368
- "error",
369
- "loading",
370
- "ready"
371
- ];
372
- if (!methods) return;
373
- for (const key of keys) {
374
- if (!(key in methods)) continue;
375
- Object.defineProperty(effect, key, {
376
- configurable: true,
377
- get: () => methods[key]
378
- });
379
- }
380
- if (typeof reconnect === "function") Object.defineProperty(effect, "reconnect", {
381
- configurable: true,
382
- value: () => Effect.tryPromise({
383
- try: () => Promise.resolve(reconnect.call(resource)),
384
- catch: (error) => error
385
- })
386
- });
387
- if (typeof async_iterator === "function") Object.defineProperty(effect, Symbol.asyncIterator, {
388
- configurable: true,
389
- value: () => async_iterator.call(resource)
390
- });
391
- }
392
- function make_live_resource(resource) {
393
- const live_resource = {};
394
- attach_live_resource_methods(resource, live_resource);
395
- return live_resource;
396
- }
397
372
  function QueryRoot(validate_or_handler, maybe_handler) {
398
373
  try {
399
374
  if (maybe_handler) return to_effect_query(query(normalize_validator(validate_or_handler), make_remote_wrapper(maybe_handler, "Query")));
@@ -589,6 +564,6 @@ function resolve_redirect_status(status) {
589
564
  return redirect_status_codes[status];
590
565
  }
591
566
  //#endregion
592
- export { Command, Error$1 as Error, Form, Prerender, Query, Redirect, RequestEvent, ServerRuntime, get_server_runtime_or_throw };
567
+ export { Command, Error$1 as Error, Form, Live, Prerender, Query, Redirect, RequestEvent, ServerRuntime, get_server_runtime_or_throw };
593
568
 
594
569
  //# sourceMappingURL=server.js.map