@parsrun/service 0.1.32 → 0.1.34

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
1
  import { s as RpcTransport, S as ServiceConfig, i as RpcMetadata, m as TraceContext, f as RpcRequest, g as RpcResponse } from './types-DHZaZwAt.js';
2
- import { R as RpcServer } from './server-BB9AbnkP.js';
2
+ import { R as RpcServer } from './server-Cg0UtKpw.js';
3
3
  import { Serializer } from './serialization/index.js';
4
4
  import { ParsError } from '@parsrun/core';
5
5
 
package/dist/index.d.ts CHANGED
@@ -2,8 +2,8 @@ import { S as ServiceConfig, E as EventFormatConfig, a as SerializationConfig, T
2
2
  export { B as BulkheadConfig, u as CircuitBreakerConfig, C as CompactEvent, I as EventData, c as EventDefinition, j as EventHandler, k as EventHandlerContext, d as EventHandlerDefinition, e as EventHandlerOptions, l as EventLogger, t as EventTransport, F as Fetcher, M as MutationDefinition, G as MutationInput, H as MutationOutput, P as ParsEvent, Q as QueryDefinition, z as QueryInput, A as QueryOutput, v as RetryConfig, h as RpcErrorData, i as RpcMetadata, f as RpcRequest, g as RpcResponse, s as RpcTransport, x as ServiceClient, w as ServiceClientOptions, b as ServiceDefinition, y as ServiceInstance, n as Span, q as SpanAttributeValue, r as SpanEvent, o as SpanKind, p as SpanStatus, m as TraceContext, U as Unsubscribe } from './types-DHZaZwAt.js';
3
3
  export { defineService, getMethodTimeout, getServiceEvents, getServiceMethods, isMethodDeprecated, satisfiesVersion } from './define.js';
4
4
  export { ServiceRegistry, createServiceRegistry, useService, useTypedService } from './client.js';
5
- export { B as BulkheadRejectedError, C as CallOptions, i as CircuitOpenError, b as EmbeddedRegistry, E as EmbeddedTransport, H as HttpTransport, f as HttpTransportOptions, M as MethodNotFoundError, R as RpcClient, h as RpcError, k as SerializationError, S as ServiceNotFoundError, T as TimeoutError, j as TransportError, V as VersionMismatchError, a as createEmbeddedTransport, e as createHttpHandler, d as createHttpTransport, c as createRpcClient, g as getEmbeddedRegistry, p as parseTraceparent, t as toRpcError } from './index-reEpIe1R.js';
6
- export { a as RpcHandler, e as RpcHandlerContext, b as RpcHandlers, d as RpcMiddleware, R as RpcServer, c as createRpcServer, l as loggingMiddleware, t as tenantMiddleware, v as validationMiddleware } from './server-BB9AbnkP.js';
5
+ export { B as BulkheadRejectedError, C as CallOptions, i as CircuitOpenError, b as EmbeddedRegistry, E as EmbeddedTransport, H as HttpTransport, f as HttpTransportOptions, M as MethodNotFoundError, R as RpcClient, h as RpcError, k as SerializationError, S as ServiceNotFoundError, T as TimeoutError, j as TransportError, V as VersionMismatchError, a as createEmbeddedTransport, e as createHttpHandler, d as createHttpTransport, c as createRpcClient, g as getEmbeddedRegistry, p as parseTraceparent, t as toRpcError } from './index-DOw3yXa2.js';
6
+ export { a as RpcHandler, e as RpcHandlerContext, b as RpcHandlers, d as RpcMiddleware, R as RpcServer, c as createRpcServer, l as loggingMiddleware, t as tenantMiddleware, v as validationMiddleware } from './server-Cg0UtKpw.js';
7
7
  export { EmitOptions, EventEmitter, EventEmitterOptions, GlobalEventBus, MemoryEventTransport, MemoryEventTransportOptions, ScopedEmitter, TypedEventEmitter, createEvent, createEventEmitter, createMemoryEventTransport, createTypedEmitter, formatEventType, fromCompactEvent, getGlobalEventBus, matchEventType, parseEventType, toCloudEvent, toCompactEvent, validateCompactEvent, validateEvent } from './events/index.js';
8
8
  export { A as AddEntryOptions, d as DeadLetterEntry, D as DeadLetterQueue, e as DeadLetterQueueOptions, E as EventHandlerRegistry, a as EventHandlerRegistryOptions, H as HandlerRegistration, b as createDeadLetterQueue, c as createEventHandlerRegistry } from './handler-eCIZLODd.js';
9
9
  export { Bulkhead, BulkheadOptions, CircuitBreaker, CircuitBreakerOptions, CircuitState, RetryOptions, TimeoutExceededError, createRetryWrapper, createTimeoutWrapper, executeWithDeadline, executeWithRetry, executeWithTimeout, raceWithTimeout, withRetry, withTimeout } from './resilience/index.js';
package/dist/index.js CHANGED
@@ -3011,9 +3011,13 @@ var RpcServer = class {
3011
3011
  defaultTimeout;
3012
3012
  middleware;
3013
3013
  constructor(options) {
3014
- this.definition = options.definition;
3014
+ const definition = options.definition ?? options.service;
3015
+ if (!definition) {
3016
+ throw new Error("RpcServerOptions requires either 'definition' or 'service' to be provided");
3017
+ }
3018
+ this.definition = definition;
3015
3019
  this.handlers = options.handlers;
3016
- this.logger = options.logger ?? createLogger5({ name: `rpc:${options.definition.name}` });
3020
+ this.logger = options.logger ?? createLogger5({ name: `rpc:${definition.name}` });
3017
3021
  this.defaultTimeout = options.defaultTimeout ?? 3e4;
3018
3022
  this.middleware = options.middleware ?? [];
3019
3023
  }