@replit/river 0.213.0 → 0.214.0

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.
@@ -1,5 +1,5 @@
1
- import { A as AnyServiceSchemaMap, M as MaybeDisposable, P as ProcedureHandlerContext, a as PayloadType, I as InstantiatedServiceSchemaMap, b as AnyProcedure } from '../services-C656NVV3.cjs';
2
- export { J as BaseErrorSchemaType, G as CANCEL_CODE, L as Client, N as Err, T as ErrResult, F as INVALID_REQUEST_CODE, O as Ok, X as OkResult, h as ProcErrors, d as ProcHandler, e as ProcInit, f as ProcRequest, g as ProcResponse, i as ProcType, z as Procedure, B as ProcedureErrorSchemaType, r as ProcedureMap, R as RPCProcedure, y as RawReadable, v as Readable, x as ReadableBrokenError, w as ReadableResult, H as ReaderErrorSchema, _ as ResponseData, Q as Result, Z as ResultUnwrapErr, Y as ResultUnwrapOk, m as SerializedProcedureSchema, q as SerializedProcedureSchemaProtocolv1, k as SerializedServerSchema, o as SerializedServerSchemaProtocolv1, l as SerializedServiceSchema, p as SerializedServiceSchemaProtocolv1, S as Service, c as ServiceConfiguration, u as StreamProcedure, t as SubscriptionProcedure, D as UNCAUGHT_ERROR_CODE, E as UNEXPECTED_DISCONNECT_CODE, U as UploadProcedure, V as ValidProcType, W as Writable, K as createClient, j as createServiceSchema, C as flattenErrorType, s as serializeSchema, n as serializeSchemaV1Compat } from '../services-C656NVV3.cjs';
1
+ import { A as AnyServiceSchemaMap, M as MaybeDisposable, P as ProcedureHandlerContext, a as PayloadType, I as InstantiatedServiceSchemaMap, b as AnyProcedure } from '../services-DqYQvm_L.cjs';
2
+ export { J as BaseErrorSchemaType, G as CANCEL_CODE, L as Client, N as Err, T as ErrResult, F as INVALID_REQUEST_CODE, O as Ok, X as OkResult, h as ProcErrors, d as ProcHandler, e as ProcInit, f as ProcRequest, g as ProcResponse, i as ProcType, z as Procedure, B as ProcedureErrorSchemaType, r as ProcedureMap, R as RPCProcedure, y as RawReadable, v as Readable, x as ReadableBrokenError, w as ReadableResult, H as ReaderErrorSchema, _ as ResponseData, Q as Result, Z as ResultUnwrapErr, Y as ResultUnwrapOk, m as SerializedProcedureSchema, q as SerializedProcedureSchemaProtocolv1, k as SerializedServerSchema, o as SerializedServerSchemaProtocolv1, l as SerializedServiceSchema, p as SerializedServiceSchemaProtocolv1, S as Service, c as ServiceConfiguration, u as StreamProcedure, t as SubscriptionProcedure, D as UNCAUGHT_ERROR_CODE, E as UNEXPECTED_DISCONNECT_CODE, U as UploadProcedure, V as ValidProcType, W as Writable, K as createClient, j as createServiceSchema, C as flattenErrorType, s as serializeSchema, n as serializeSchemaV1Compat } from '../services-DqYQvm_L.cjs';
3
3
  import { TSchema, Static } from '@sinclair/typebox';
4
4
  import { c as TransportClientId, b as OpaqueTransportMessage } from '../message-Dlsh5WDF.cjs';
5
5
  import { C as Connection, q as ServerHandshakeOptions } from '../transport-CxT7y8Qk.cjs';
@@ -74,6 +74,6 @@ declare function createServer<MetadataSchema extends TSchema, ParsedMetadata ext
74
74
  middlewares?: Array<Middleware>;
75
75
  }>): Server<Context, ParsedMetadata, Services>;
76
76
 
77
- var version = "0.213.0";
77
+ var version = "0.214.0";
78
78
 
79
79
  export { MaybeDisposable, type Middleware, type MiddlewareContext, type MiddlewareParam, PayloadType, ProcedureHandlerContext, version as RIVER_VERSION, type Server, createServer };
@@ -1,5 +1,5 @@
1
- import { A as AnyServiceSchemaMap, M as MaybeDisposable, P as ProcedureHandlerContext, a as PayloadType, I as InstantiatedServiceSchemaMap, b as AnyProcedure } from '../services-ChTb4jmc.js';
2
- export { J as BaseErrorSchemaType, G as CANCEL_CODE, L as Client, N as Err, T as ErrResult, F as INVALID_REQUEST_CODE, O as Ok, X as OkResult, h as ProcErrors, d as ProcHandler, e as ProcInit, f as ProcRequest, g as ProcResponse, i as ProcType, z as Procedure, B as ProcedureErrorSchemaType, r as ProcedureMap, R as RPCProcedure, y as RawReadable, v as Readable, x as ReadableBrokenError, w as ReadableResult, H as ReaderErrorSchema, _ as ResponseData, Q as Result, Z as ResultUnwrapErr, Y as ResultUnwrapOk, m as SerializedProcedureSchema, q as SerializedProcedureSchemaProtocolv1, k as SerializedServerSchema, o as SerializedServerSchemaProtocolv1, l as SerializedServiceSchema, p as SerializedServiceSchemaProtocolv1, S as Service, c as ServiceConfiguration, u as StreamProcedure, t as SubscriptionProcedure, D as UNCAUGHT_ERROR_CODE, E as UNEXPECTED_DISCONNECT_CODE, U as UploadProcedure, V as ValidProcType, W as Writable, K as createClient, j as createServiceSchema, C as flattenErrorType, s as serializeSchema, n as serializeSchemaV1Compat } from '../services-ChTb4jmc.js';
1
+ import { A as AnyServiceSchemaMap, M as MaybeDisposable, P as ProcedureHandlerContext, a as PayloadType, I as InstantiatedServiceSchemaMap, b as AnyProcedure } from '../services-D47_GPCH.js';
2
+ export { J as BaseErrorSchemaType, G as CANCEL_CODE, L as Client, N as Err, T as ErrResult, F as INVALID_REQUEST_CODE, O as Ok, X as OkResult, h as ProcErrors, d as ProcHandler, e as ProcInit, f as ProcRequest, g as ProcResponse, i as ProcType, z as Procedure, B as ProcedureErrorSchemaType, r as ProcedureMap, R as RPCProcedure, y as RawReadable, v as Readable, x as ReadableBrokenError, w as ReadableResult, H as ReaderErrorSchema, _ as ResponseData, Q as Result, Z as ResultUnwrapErr, Y as ResultUnwrapOk, m as SerializedProcedureSchema, q as SerializedProcedureSchemaProtocolv1, k as SerializedServerSchema, o as SerializedServerSchemaProtocolv1, l as SerializedServiceSchema, p as SerializedServiceSchemaProtocolv1, S as Service, c as ServiceConfiguration, u as StreamProcedure, t as SubscriptionProcedure, D as UNCAUGHT_ERROR_CODE, E as UNEXPECTED_DISCONNECT_CODE, U as UploadProcedure, V as ValidProcType, W as Writable, K as createClient, j as createServiceSchema, C as flattenErrorType, s as serializeSchema, n as serializeSchemaV1Compat } from '../services-D47_GPCH.js';
3
3
  import { TSchema, Static } from '@sinclair/typebox';
4
4
  import { c as TransportClientId, b as OpaqueTransportMessage } from '../message-Dlsh5WDF.js';
5
5
  import { C as Connection, q as ServerHandshakeOptions } from '../transport-pdbkDzmJ.js';
@@ -74,6 +74,6 @@ declare function createServer<MetadataSchema extends TSchema, ParsedMetadata ext
74
74
  middlewares?: Array<Middleware>;
75
75
  }>): Server<Context, ParsedMetadata, Services>;
76
76
 
77
- var version = "0.213.0";
77
+ var version = "0.214.0";
78
78
 
79
79
  export { MaybeDisposable, type Middleware, type MiddlewareContext, type MiddlewareParam, PayloadType, ProcedureHandlerContext, version as RIVER_VERSION, type Server, createServer };
@@ -18,7 +18,7 @@ import {
18
18
  serializeSchema,
19
19
  serializeSchemaV1Compat,
20
20
  version
21
- } from "../chunk-ED2QVVIW.js";
21
+ } from "../chunk-LECVFB2G.js";
22
22
  export {
23
23
  CANCEL_CODE,
24
24
  Err,
@@ -1,5 +1,5 @@
1
1
  import * as _sinclair_typebox from '@sinclair/typebox';
2
- import { TNever, TObject, TLiteral, TEnum, TString, TSchema, TUnion, Static } from '@sinclair/typebox';
2
+ import { TObject, TLiteral, TEnum, TString, TSchema, TNever, TUnion, Static } from '@sinclair/typebox';
3
3
  import { Span } from '@opentelemetry/api';
4
4
  import { c as TransportClientId } from './message-Dlsh5WDF.js';
5
5
  import { C as Connection, n as ClientHandshakeOptions, z as SessionId } from './transport-pdbkDzmJ.js';
@@ -406,6 +406,22 @@ type ProcedureHandlerContext<State, Context, ParsedMetadata> = Context & {
406
406
  * the river documentation to understand the difference between the two concepts.
407
407
  */
408
408
  cancel: (message?: string) => ErrResult<Static<typeof CancelErrorSchema>>;
409
+ /**
410
+ * Register a cleanup function that will run after the procedure handler
411
+ * completes (whether it returns normally, throws, or is cancelled).
412
+ * Cleanup functions run in reverse registration order (LIFO) and each
413
+ * cleanup is awaited before the next one starts.
414
+ *
415
+ * Prefer this over registering async cleanup work on `signal`'s 'abort'
416
+ * event. Abort signal callbacks fire synchronously and do not await async
417
+ * work, so multiple async callbacks will interlace their execution
418
+ * (coroutine-like behavior) rather than running sequentially to completion.
419
+ * `deferCleanup` guarantees each cleanup finishes before the next begins.
420
+ *
421
+ * If a cleanup function throws, the error is recorded on the cleanup span
422
+ * but remaining cleanups continue to run.
423
+ */
424
+ deferCleanup: (fn: () => void | Promise<void>) => void;
409
425
  /**
410
426
  * This signal is a standard [AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)
411
427
  * triggered when the procedure invocation is done. This signal tracks the invocation/request finishing
@@ -1,5 +1,5 @@
1
1
  import * as _sinclair_typebox from '@sinclair/typebox';
2
- import { TNever, TObject, TLiteral, TEnum, TString, TSchema, TUnion, Static } from '@sinclair/typebox';
2
+ import { TObject, TLiteral, TEnum, TString, TSchema, TNever, TUnion, Static } from '@sinclair/typebox';
3
3
  import { Span } from '@opentelemetry/api';
4
4
  import { c as TransportClientId } from './message-Dlsh5WDF.cjs';
5
5
  import { C as Connection, n as ClientHandshakeOptions, z as SessionId } from './transport-CxT7y8Qk.cjs';
@@ -406,6 +406,22 @@ type ProcedureHandlerContext<State, Context, ParsedMetadata> = Context & {
406
406
  * the river documentation to understand the difference between the two concepts.
407
407
  */
408
408
  cancel: (message?: string) => ErrResult<Static<typeof CancelErrorSchema>>;
409
+ /**
410
+ * Register a cleanup function that will run after the procedure handler
411
+ * completes (whether it returns normally, throws, or is cancelled).
412
+ * Cleanup functions run in reverse registration order (LIFO) and each
413
+ * cleanup is awaited before the next one starts.
414
+ *
415
+ * Prefer this over registering async cleanup work on `signal`'s 'abort'
416
+ * event. Abort signal callbacks fire synchronously and do not await async
417
+ * work, so multiple async callbacks will interlace their execution
418
+ * (coroutine-like behavior) rather than running sequentially to completion.
419
+ * `deferCleanup` guarantees each cleanup finishes before the next begins.
420
+ *
421
+ * If a cleanup function throws, the error is recorded on the cleanup span
422
+ * but remaining cleanups continue to run.
423
+ */
424
+ deferCleanup: (fn: () => void | Promise<void>) => void;
409
425
  /**
410
426
  * This signal is a standard [AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)
411
427
  * triggered when the procedure invocation is done. This signal tracks the invocation/request finishing
@@ -35,6 +35,7 @@ __export(testUtil_exports, {
35
35
  createDummyTransportMessage: () => createDummyTransportMessage,
36
36
  createLocalWebSocketClient: () => createLocalWebSocketClient,
37
37
  createMockTransportNetwork: () => createMockTransportNetwork,
38
+ createPartialContext: () => createPartialContext,
38
39
  createWebSocketServer: () => createWebSocketServer,
39
40
  dummySession: () => dummySession,
40
41
  getClientSendFn: () => getClientSendFn,
@@ -558,7 +559,7 @@ function coerceErrorString(err) {
558
559
  }
559
560
 
560
561
  // package.json
561
- var version = "0.213.0";
562
+ var version = "0.214.0";
562
563
 
563
564
  // tracing/index.ts
564
565
  function getPropagationContext(ctx) {
@@ -2863,6 +2864,21 @@ function closeAllConnections(transport) {
2863
2864
  conn.close();
2864
2865
  }
2865
2866
  }
2867
+ function createPartialContext(partial) {
2868
+ return new Proxy(partial, {
2869
+ get(target, prop, receiver) {
2870
+ if (prop in target) {
2871
+ return Reflect.get(target, prop, receiver);
2872
+ }
2873
+ if (typeof prop === "string" && prop !== "then") {
2874
+ throw new Error(
2875
+ `${prop} is not mocked in the test context. Provide it via createPartialContext if your test needs it.`
2876
+ );
2877
+ }
2878
+ return void 0;
2879
+ }
2880
+ });
2881
+ }
2866
2882
  // Annotate the CommonJS export names for ESM import in node:
2867
2883
  0 && (module.exports = {
2868
2884
  InMemoryConnection,
@@ -2870,6 +2886,7 @@ function closeAllConnections(transport) {
2870
2886
  createDummyTransportMessage,
2871
2887
  createLocalWebSocketClient,
2872
2888
  createMockTransportNetwork,
2889
+ createPartialContext,
2873
2890
  createWebSocketServer,
2874
2891
  dummySession,
2875
2892
  getClientSendFn,