@actuallab/fusion-rpc 12.3.31 → 12.3.49
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.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -51,7 +51,7 @@ var FusionSystemCallHandler = class extends import_rpc2.RpcSystemCallHandler {
|
|
|
51
51
|
const method = message.Method;
|
|
52
52
|
const relatedId = message.RelatedId ?? 0;
|
|
53
53
|
if (method === FUSION_INVALIDATE_METHOD) {
|
|
54
|
-
const call = peer.
|
|
54
|
+
const call = peer.outboundCalls.remove(relatedId);
|
|
55
55
|
if (call instanceof RpcOutboundComputeCall) {
|
|
56
56
|
call.whenInvalidated.resolve();
|
|
57
57
|
}
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/fusion-hub.ts","../src/rpc-outbound-compute-call.ts"],"sourcesContent":["export {\r\n FusionHub,\r\n defineComputeService,\r\n FUSION_CALL_TYPE_ID,\r\n} from './fusion-hub.js';\r\nexport { RpcOutboundComputeCall } from './rpc-outbound-compute-call.js';\r\n","// .NET counterparts:\r\n// RpcComputeServiceDef — extends RpcServiceDef with ComputedOptionsProvider.\r\n// RpcComputeMethodDef — extends RpcMethodDef with ComputedOptions and sets\r\n// CallType = RpcComputeCallType (custom call type with its own\r\n// RpcOutboundComputeCall / RpcInboundComputeCall factories).\r\n// RpcInboundComputeCallHandler — an IRpcMiddleware that wraps inbound compute\r\n// calls in a ComputeContext, captures the Computed<T> instance, and stores\r\n// it on RpcInboundComputeCall.Computed for invalidation tracking.\r\n// RemoteComputeServiceInterceptor — the client-side interceptor that creates\r\n// compute-aware outbound calls, tracking server invalidation signals.\r\n//\r\n// In .NET this is split across ~10 files using DI, middleware, interceptors,\r\n// and the RpcComputeCallType custom call type. TS consolidates it into a\r\n// single FusionHub subclass with two method overrides.\r\n//\r\n// Omitted from .NET:\r\n// - RpcComputeCallType / typed RpcInboundComputeCall<T> / RpcOutboundComputeCall<T> —\r\n// .NET uses a separate call type with custom factories, result handling, and\r\n// stage tracking. TS extends the base RpcOutboundComputeCall with a\r\n// whenInvalidated promise (sufficient for the TS use case).\r\n// - ComputedOptionsProvider / ComputedOptions per method — .NET resolves\r\n// per-method caching/invalidation options via DI. TS uses default\r\n// ComputeFunction behavior for all methods.\r\n// - RpcInboundComputeCallHandler middleware — .NET wraps the inbound call in\r\n// ComputeContext using the middleware pipeline. TS wraps it directly in\r\n// _wrapServerMethod by calling cf.invoke() (which sets up\r\n// ComputeContext internally).\r\n// - LocalExecutionMode / ConstrainedEntry — .NET controls whether compute calls\r\n// can execute locally or must go remote (for Fusion's consistency guarantees).\r\n// TS always executes locally (server-side) or remotely (client-side).\r\n// - Invalidation via RpcInboundComputeCall.Computed.Invalidated event — .NET\r\n// attaches an invalidation callback to the captured Computed<T> that calls\r\n// SystemCallSender.Complete(peer, call, invalidatedResult). TS uses\r\n// $sys-c.Invalidate system call instead (equivalent wire effect).\r\n// - RpcOutboundComputeCall.SetError → SetInvalidatedUnsafe — .NET invalidates\r\n// the local computed when an error or reroute occurs. TS resolves\r\n// whenInvalidated on disconnect via rejectAll().\r\n\r\nimport {\r\n RpcHub,\r\n RpcServerPeer,\r\n RpcWebSocketConnection,\r\n RpcSystemCallHandler,\r\n serializeMessage,\r\n defineRpcService,\r\n wireMethodName,\r\n RpcType,\r\n RpcRemoteExecutionMode,\r\n type RpcConnection,\r\n type WebSocketLike,\r\n type RpcServiceDef,\r\n type RpcMethodDef,\r\n type RpcMethodDefInput,\r\n type RpcDispatchContext,\r\n type RpcPeer,\r\n type RpcMessage,\r\n type RpcCallOptions,\r\n getServiceMeta,\r\n getMethodsMeta,\r\n} from '@actuallab/rpc';\r\nimport {\r\n ComputeFunction,\r\n ComputeContext,\r\n type ComputeFunctionImpl,\r\n} from '@actuallab/fusion';\r\nimport { AsyncContext } from '@actuallab/core';\r\nimport { RpcOutboundComputeCall } from './rpc-outbound-compute-call.js';\r\n\r\n/** Call type ID for Fusion compute calls — matches .NET's RpcComputeCallType.Id. */\r\nexport const FUSION_CALL_TYPE_ID = 1;\r\n\r\n/** Wire method name for invalidation system call. */\r\nconst FUSION_INVALIDATE_METHOD = '$sys-c.Invalidate:0';\r\n\r\n/** Handles Fusion-specific system calls ($sys-c.Invalidate), delegating the rest to base. */\r\nclass FusionSystemCallHandler extends RpcSystemCallHandler {\r\n override handle(message: RpcMessage, args: unknown[], peer: RpcPeer): void {\r\n const method = message.Method;\r\n const relatedId = message.RelatedId ?? 0;\r\n\r\n if (method === FUSION_INVALIDATE_METHOD) {\r\n const call = peer.outbound.remove(relatedId);\r\n if (call instanceof RpcOutboundComputeCall) {\r\n call.whenInvalidated.resolve();\r\n }\r\n return;\r\n }\r\n\r\n super.handle(message, args, peer);\r\n }\r\n}\r\n\r\n/** Creates a compute service definition — all methods default to FUSION_CALL_TYPE_ID. */\r\nexport function defineComputeService(\r\n name: string,\r\n methods: Record<string, RpcMethodDefInput>\r\n): RpcServiceDef {\r\n const withCallType: Record<string, RpcMethodDefInput> = {};\r\n for (const [methodName, input] of Object.entries(methods)) {\r\n withCallType[methodName] = {\r\n ...input,\r\n callTypeId: input.callTypeId ?? FUSION_CALL_TYPE_ID,\r\n };\r\n }\r\n return defineRpcService(name, withCallType);\r\n}\r\n\r\n/** Central coordinator for Fusion + RPC — manages compute services, invalidation wiring. */\r\nexport class FusionHub extends RpcHub {\r\n constructor(hubId?: string) {\r\n super(hubId);\r\n this.systemCallHandler = new FusionSystemCallHandler();\r\n // Register Fusion-specific system call for compact format hash resolution\r\n this.registry.register(FUSION_INVALIDATE_METHOD);\r\n }\r\n\r\n /** Accept an incoming WebSocket and create a server peer. */\r\n acceptConnection(ws: WebSocketLike): RpcServerPeer {\r\n const ref = `server://${crypto.randomUUID()}`;\r\n const conn = new RpcWebSocketConnection(ws);\r\n const peer = this.getServerPeer(ref);\r\n peer.accept(conn);\r\n return peer;\r\n }\r\n\r\n /** Accept an RpcConnection and create a server peer. */\r\n acceptRpcConnection(conn: RpcConnection): RpcServerPeer {\r\n const ref = `server://${crypto.randomUUID()}`;\r\n const peer = this.getServerPeer(ref);\r\n peer.accept(conn);\r\n return peer;\r\n }\r\n\r\n /** Override to apply FUSION_CALL_TYPE_ID for compute methods. */\r\n protected override _buildServiceDef(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n cls: abstract new (...args: any[]) => any\r\n ): RpcServiceDef {\r\n const svcMeta = getServiceMeta(cls);\r\n if (svcMeta === undefined)\r\n throw new Error('Contract class missing @rpcService metadata');\r\n\r\n const methodsMeta = getMethodsMeta(cls) ?? {};\r\n const methods = new Map<string, RpcMethodDef>();\r\n\r\n for (const [name, meta] of Object.entries(methodsMeta)) {\r\n const wireArgCount = meta.argCount + 1;\r\n const mapKey = `${name}:${wireArgCount}`;\r\n methods.set(mapKey, {\r\n name,\r\n serviceName: svcMeta.name,\r\n argCount: meta.argCount,\r\n wireArgCount,\r\n callTypeId:\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\r\n (meta as any).compute === true ? FUSION_CALL_TYPE_ID : 0,\r\n stream: meta.returns === RpcType.stream,\r\n noWait: meta.returns === RpcType.noWait,\r\n remoteExecutionMode: RpcRemoteExecutionMode.Default,\r\n });\r\n }\r\n\r\n return { name: svcMeta.name, methods };\r\n }\r\n\r\n protected override _wrapServerMethod(\r\n methodDef: RpcMethodDef,\r\n fn: (...args: unknown[]) => unknown,\r\n impl: object\r\n ): (...args: unknown[]) => unknown {\r\n if (methodDef.callTypeId !== FUSION_CALL_TYPE_ID) return fn;\r\n\r\n // Route through ComputeFunction + wire invalidation → $sys-c.Invalidate\r\n const cf = new ComputeFunction(\r\n methodDef.name,\r\n fn as ComputeFunctionImpl\r\n );\r\n return async (...args: unknown[]) => {\r\n const context = extractDispatchContext(args);\r\n const cleanArgs = context !== undefined ? args.slice(0, -1) : args;\r\n\r\n const computed = await cf.invoke(impl, cleanArgs);\r\n\r\n // Wire invalidation → send $sys-c.Invalidate to the client\r\n if (context !== undefined) {\r\n computed.onInvalidated.add(() => {\r\n const msg = serializeMessage({\r\n Method: FUSION_INVALIDATE_METHOD,\r\n RelatedId: context.callId,\r\n });\r\n context.connection.send(msg);\r\n });\r\n }\r\n\r\n return computed.value;\r\n };\r\n }\r\n\r\n protected override _createClientMethod(\r\n peer: RpcPeer,\r\n methodDef: RpcMethodDef\r\n ): (...args: unknown[]) => unknown {\r\n if (methodDef.callTypeId !== FUSION_CALL_TYPE_ID)\r\n return super._createClientMethod(peer, methodDef);\r\n\r\n const wireName = wireMethodName(methodDef);\r\n // Local ComputeFunction whose impl makes an RPC call\r\n const rpcImpl: ComputeFunctionImpl = async function (\r\n ...args: unknown[]\r\n ) {\r\n // Capture ComputeContext synchronously — AsyncContext.current is the child\r\n // context set by ComputeFunction.invoke() and won't survive the await below.\r\n const computeCtx = ComputeContext.from(AsyncContext.current);\r\n const callOptions: RpcCallOptions = {\r\n callTypeId: FUSION_CALL_TYPE_ID,\r\n outboundCallFactory: (id, m) =>\r\n new RpcOutboundComputeCall(id, m),\r\n };\r\n const outboundCall = peer.call(\r\n wireName,\r\n args,\r\n callOptions\r\n ) as RpcOutboundComputeCall;\r\n const value = await outboundCall.result.promise;\r\n // Wire server invalidation → local computed invalidation\r\n if (computeCtx) {\r\n void outboundCall.whenInvalidated.promise.then(() =>\r\n computeCtx.computed.invalidate()\r\n );\r\n }\r\n return value;\r\n };\r\n const cf = new ComputeFunction(methodDef.name, rpcImpl);\r\n const syntheticInstance = {};\r\n return (...args: unknown[]) => {\r\n const last = args[args.length - 1];\r\n const sliced = args.slice(0, methodDef.argCount);\r\n const invokeArgs =\r\n last instanceof AsyncContext ? [...sliced, last] : sliced;\r\n return cf.invoke(syntheticInstance, invokeArgs).then(c => c.value);\r\n };\r\n }\r\n}\r\n\r\nfunction extractDispatchContext(\r\n args: unknown[]\r\n): RpcDispatchContext | undefined {\r\n const last = args[args.length - 1];\r\n if (last !== null && typeof last === 'object' && '__rpcDispatch' in last) {\r\n return last as RpcDispatchContext;\r\n }\r\n return undefined;\r\n}\r\n","import { PromiseSource } from '@actuallab/core';\r\nimport { RpcOutboundCall } from '@actuallab/rpc';\r\n\r\n/** Tracks a pending outbound compute RPC call — stays in tracker until invalidated. */\r\nexport class RpcOutboundComputeCall extends RpcOutboundCall {\r\n override readonly removeOnOk = false;\r\n readonly whenInvalidated = new PromiseSource<void>();\r\n\r\n override onDisconnect(): void {\r\n this.whenInvalidated.resolve();\r\n }\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACsCA,IAAAA,cAqBO;AACP,oBAIO;AACP,IAAAC,eAA6B;;;ACjE7B,kBAA8B;AAC9B,iBAAgC;AAGzB,IAAM,yBAAN,cAAqC,2BAAgB;AAAA,EACtC,aAAa;AAAA,EACtB,kBAAkB,IAAI,0BAAoB;AAAA,EAE1C,eAAqB;AAC1B,SAAK,gBAAgB,QAAQ;AAAA,EACjC;AACJ;;;AD0DO,IAAM,sBAAsB;AAGnC,IAAM,2BAA2B;AAGjC,IAAM,0BAAN,cAAsC,iCAAqB;AAAA,EAC9C,OAAO,SAAqB,MAAiB,MAAqB;AACvE,UAAM,SAAS,QAAQ;AACvB,UAAM,YAAY,QAAQ,aAAa;AAEvC,QAAI,WAAW,0BAA0B;AACrC,YAAM,OAAO,KAAK,SAAS,OAAO,SAAS;AAC3C,UAAI,gBAAgB,wBAAwB;AACxC,aAAK,gBAAgB,QAAQ;AAAA,MACjC;AACA;AAAA,IACJ;AAEA,UAAM,OAAO,SAAS,MAAM,IAAI;AAAA,EACpC;AACJ;AAGO,SAAS,qBACZ,MACA,SACa;AACb,QAAM,eAAkD,CAAC;AACzD,aAAW,CAAC,YAAY,KAA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,aAAO;AAAA,IACX;AACA,UAAM,KAAK,IAAI,8BAAgB,UAAU,MAAM,OAAO;AACtD,UAAM,oBAAoB,CAAC;AAC3B,WAAO,IAAI,SAAoB;AAC3B,YAAM,OAAO,KAAK,KAAK,SAAS,CAAC;AACjC,YAAM,SAAS,KAAK,MAAM,GAAG,UAAU,QAAQ;AAC/C,YAAM,aACF,gBAAgB,4BAAe,CAAC,GAAG,QAAQ,IAAI,IAAI;AACvD,aAAO,GAAG,OAAO,mBAAmB,UAAU,EAAE,KAAK,OAAK,EAAE,KAAK;AAAA,IACrE;AAAA,EACJ;AACJ;AAEA,SAAS,uBACL,MAC8B;AAC9B,QAAM,OAAO,KAAK,KAAK,SAAS,CAAC;AACjC,MAAI,SAAS,QAAQ,OAAO,SAAS,YAAY,mBAAmB,MAAM;AACtE,WAAO;AAAA,EACX;AACA,SAAO;AACX;","names":["import_rpc","import_core"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/fusion-hub.ts","../src/rpc-outbound-compute-call.ts"],"sourcesContent":["export {\r\n FusionHub,\r\n defineComputeService,\r\n FUSION_CALL_TYPE_ID,\r\n} from './fusion-hub.js';\r\nexport { RpcOutboundComputeCall } from './rpc-outbound-compute-call.js';\r\n","// .NET counterparts:\r\n// RpcComputeServiceDef — extends RpcServiceDef with ComputedOptionsProvider.\r\n// RpcComputeMethodDef — extends RpcMethodDef with ComputedOptions and sets\r\n// CallType = RpcComputeCallType (custom call type with its own\r\n// RpcOutboundComputeCall / RpcInboundComputeCall factories).\r\n// RpcInboundComputeCallHandler — an IRpcMiddleware that wraps inbound compute\r\n// calls in a ComputeContext, captures the Computed<T> instance, and stores\r\n// it on RpcInboundComputeCall.Computed for invalidation tracking.\r\n// RemoteComputeServiceInterceptor — the client-side interceptor that creates\r\n// compute-aware outbound calls, tracking server invalidation signals.\r\n//\r\n// In .NET this is split across ~10 files using DI, middleware, interceptors,\r\n// and the RpcComputeCallType custom call type. TS consolidates it into a\r\n// single FusionHub subclass with two method overrides.\r\n//\r\n// Omitted from .NET:\r\n// - RpcComputeCallType / typed RpcInboundComputeCall<T> / RpcOutboundComputeCall<T> —\r\n// .NET uses a separate call type with custom factories, result handling, and\r\n// stage tracking. TS extends the base RpcOutboundComputeCall with a\r\n// whenInvalidated promise (sufficient for the TS use case).\r\n// - ComputedOptionsProvider / ComputedOptions per method — .NET resolves\r\n// per-method caching/invalidation options via DI. TS uses default\r\n// ComputeFunction behavior for all methods.\r\n// - RpcInboundComputeCallHandler middleware — .NET wraps the inbound call in\r\n// ComputeContext using the middleware pipeline. TS wraps it directly in\r\n// _wrapServerMethod by calling cf.invoke() (which sets up\r\n// ComputeContext internally).\r\n// - LocalExecutionMode / ConstrainedEntry — .NET controls whether compute calls\r\n// can execute locally or must go remote (for Fusion's consistency guarantees).\r\n// TS always executes locally (server-side) or remotely (client-side).\r\n// - Invalidation via RpcInboundComputeCall.Computed.Invalidated event — .NET\r\n// attaches an invalidation callback to the captured Computed<T> that calls\r\n// SystemCallSender.Complete(peer, call, invalidatedResult). TS uses\r\n// $sys-c.Invalidate system call instead (equivalent wire effect).\r\n// - RpcOutboundComputeCall.SetError → SetInvalidatedUnsafe — .NET invalidates\r\n// the local computed when an error or reroute occurs. TS resolves\r\n// whenInvalidated on disconnect via rejectAll().\r\n\r\nimport {\r\n RpcHub,\r\n RpcServerPeer,\r\n RpcWebSocketConnection,\r\n RpcSystemCallHandler,\r\n serializeMessage,\r\n defineRpcService,\r\n wireMethodName,\r\n RpcType,\r\n RpcRemoteExecutionMode,\r\n type RpcConnection,\r\n type WebSocketLike,\r\n type RpcServiceDef,\r\n type RpcMethodDef,\r\n type RpcMethodDefInput,\r\n type RpcDispatchContext,\r\n type RpcPeer,\r\n type RpcMessage,\r\n type RpcCallOptions,\r\n getServiceMeta,\r\n getMethodsMeta,\r\n} from '@actuallab/rpc';\r\nimport {\r\n ComputeFunction,\r\n ComputeContext,\r\n type ComputeFunctionImpl,\r\n} from '@actuallab/fusion';\r\nimport { AsyncContext } from '@actuallab/core';\r\nimport { RpcOutboundComputeCall } from './rpc-outbound-compute-call.js';\r\n\r\n/** Call type ID for Fusion compute calls — matches .NET's RpcComputeCallType.Id. */\r\nexport const FUSION_CALL_TYPE_ID = 1;\r\n\r\n/** Wire method name for invalidation system call. */\r\nconst FUSION_INVALIDATE_METHOD = '$sys-c.Invalidate:0';\r\n\r\n/** Handles Fusion-specific system calls ($sys-c.Invalidate), delegating the rest to base. */\r\nclass FusionSystemCallHandler extends RpcSystemCallHandler {\r\n override handle(message: RpcMessage, args: unknown[], peer: RpcPeer): void {\r\n const method = message.Method;\r\n const relatedId = message.RelatedId ?? 0;\r\n\r\n if (method === FUSION_INVALIDATE_METHOD) {\r\n const call = peer.outboundCalls.remove(relatedId);\r\n if (call instanceof RpcOutboundComputeCall) {\r\n call.whenInvalidated.resolve();\r\n }\r\n return;\r\n }\r\n\r\n super.handle(message, args, peer);\r\n }\r\n}\r\n\r\n/** Creates a compute service definition — all methods default to FUSION_CALL_TYPE_ID. */\r\nexport function defineComputeService(\r\n name: string,\r\n methods: Record<string, RpcMethodDefInput>\r\n): RpcServiceDef {\r\n const withCallType: Record<string, RpcMethodDefInput> = {};\r\n for (const [methodName, input] of Object.entries(methods)) {\r\n withCallType[methodName] = {\r\n ...input,\r\n callTypeId: input.callTypeId ?? FUSION_CALL_TYPE_ID,\r\n };\r\n }\r\n return defineRpcService(name, withCallType);\r\n}\r\n\r\n/** Central coordinator for Fusion + RPC — manages compute services, invalidation wiring. */\r\nexport class FusionHub extends RpcHub {\r\n constructor(hubId?: string) {\r\n super(hubId);\r\n this.systemCallHandler = new FusionSystemCallHandler();\r\n // Register Fusion-specific system call for compact format hash resolution\r\n this.registry.register(FUSION_INVALIDATE_METHOD);\r\n }\r\n\r\n /** Accept an incoming WebSocket and create a server peer. */\r\n acceptConnection(ws: WebSocketLike): RpcServerPeer {\r\n const ref = `server://${crypto.randomUUID()}`;\r\n const conn = new RpcWebSocketConnection(ws);\r\n const peer = this.getServerPeer(ref);\r\n peer.accept(conn);\r\n return peer;\r\n }\r\n\r\n /** Accept an RpcConnection and create a server peer. */\r\n acceptRpcConnection(conn: RpcConnection): RpcServerPeer {\r\n const ref = `server://${crypto.randomUUID()}`;\r\n const peer = this.getServerPeer(ref);\r\n peer.accept(conn);\r\n return peer;\r\n }\r\n\r\n /** Override to apply FUSION_CALL_TYPE_ID for compute methods. */\r\n protected override _buildServiceDef(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n cls: abstract new (...args: any[]) => any\r\n ): RpcServiceDef {\r\n const svcMeta = getServiceMeta(cls);\r\n if (svcMeta === undefined)\r\n throw new Error('Contract class missing @rpcService metadata');\r\n\r\n const methodsMeta = getMethodsMeta(cls) ?? {};\r\n const methods = new Map<string, RpcMethodDef>();\r\n\r\n for (const [name, meta] of Object.entries(methodsMeta)) {\r\n const wireArgCount = meta.argCount + 1;\r\n const mapKey = `${name}:${wireArgCount}`;\r\n methods.set(mapKey, {\r\n name,\r\n serviceName: svcMeta.name,\r\n argCount: meta.argCount,\r\n wireArgCount,\r\n callTypeId:\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\r\n (meta as any).compute === true ? FUSION_CALL_TYPE_ID : 0,\r\n stream: meta.returns === RpcType.stream,\r\n noWait: meta.returns === RpcType.noWait,\r\n remoteExecutionMode: RpcRemoteExecutionMode.Default,\r\n });\r\n }\r\n\r\n return { name: svcMeta.name, methods };\r\n }\r\n\r\n protected override _wrapServerMethod(\r\n methodDef: RpcMethodDef,\r\n fn: (...args: unknown[]) => unknown,\r\n impl: object\r\n ): (...args: unknown[]) => unknown {\r\n if (methodDef.callTypeId !== FUSION_CALL_TYPE_ID) return fn;\r\n\r\n // Route through ComputeFunction + wire invalidation → $sys-c.Invalidate\r\n const cf = new ComputeFunction(\r\n methodDef.name,\r\n fn as ComputeFunctionImpl\r\n );\r\n return async (...args: unknown[]) => {\r\n const context = extractDispatchContext(args);\r\n const cleanArgs = context !== undefined ? args.slice(0, -1) : args;\r\n\r\n const computed = await cf.invoke(impl, cleanArgs);\r\n\r\n // Wire invalidation → send $sys-c.Invalidate to the client\r\n if (context !== undefined) {\r\n computed.onInvalidated.add(() => {\r\n const msg = serializeMessage({\r\n Method: FUSION_INVALIDATE_METHOD,\r\n RelatedId: context.callId,\r\n });\r\n context.connection.send(msg);\r\n });\r\n }\r\n\r\n return computed.value;\r\n };\r\n }\r\n\r\n protected override _createClientMethod(\r\n peer: RpcPeer,\r\n methodDef: RpcMethodDef\r\n ): (...args: unknown[]) => unknown {\r\n if (methodDef.callTypeId !== FUSION_CALL_TYPE_ID)\r\n return super._createClientMethod(peer, methodDef);\r\n\r\n const wireName = wireMethodName(methodDef);\r\n // Local ComputeFunction whose impl makes an RPC call\r\n const rpcImpl: ComputeFunctionImpl = async function (\r\n ...args: unknown[]\r\n ) {\r\n // Capture ComputeContext synchronously — AsyncContext.current is the child\r\n // context set by ComputeFunction.invoke() and won't survive the await below.\r\n const computeCtx = ComputeContext.from(AsyncContext.current);\r\n const callOptions: RpcCallOptions = {\r\n callTypeId: FUSION_CALL_TYPE_ID,\r\n outboundCallFactory: (id, m) =>\r\n new RpcOutboundComputeCall(id, m),\r\n };\r\n const outboundCall = peer.call(\r\n wireName,\r\n args,\r\n callOptions\r\n ) as RpcOutboundComputeCall;\r\n const value = await outboundCall.result.promise;\r\n // Wire server invalidation → local computed invalidation\r\n if (computeCtx) {\r\n void outboundCall.whenInvalidated.promise.then(() =>\r\n computeCtx.computed.invalidate()\r\n );\r\n }\r\n return value;\r\n };\r\n const cf = new ComputeFunction(methodDef.name, rpcImpl);\r\n const syntheticInstance = {};\r\n return (...args: unknown[]) => {\r\n const last = args[args.length - 1];\r\n const sliced = args.slice(0, methodDef.argCount);\r\n const invokeArgs =\r\n last instanceof AsyncContext ? [...sliced, last] : sliced;\r\n return cf.invoke(syntheticInstance, invokeArgs).then(c => c.value);\r\n };\r\n }\r\n}\r\n\r\nfunction extractDispatchContext(\r\n args: unknown[]\r\n): RpcDispatchContext | undefined {\r\n const last = args[args.length - 1];\r\n if (last !== null && typeof last === 'object' && '__rpcDispatch' in last) {\r\n return last as RpcDispatchContext;\r\n }\r\n return undefined;\r\n}\r\n","import { PromiseSource } from '@actuallab/core';\r\nimport { RpcOutboundCall } from '@actuallab/rpc';\r\n\r\n/** Tracks a pending outbound compute RPC call — stays in tracker until invalidated. */\r\nexport class RpcOutboundComputeCall extends RpcOutboundCall {\r\n override readonly removeOnOk = false;\r\n readonly whenInvalidated = new PromiseSource<void>();\r\n\r\n override onDisconnect(): void {\r\n this.whenInvalidated.resolve();\r\n }\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACsCA,IAAAA,cAqBO;AACP,oBAIO;AACP,IAAAC,eAA6B;;;ACjE7B,kBAA8B;AAC9B,iBAAgC;AAGzB,IAAM,yBAAN,cAAqC,2BAAgB;AAAA,EACtC,aAAa;AAAA,EACtB,kBAAkB,IAAI,0BAAoB;AAAA,EAE1C,eAAqB;AAC1B,SAAK,gBAAgB,QAAQ;AAAA,EACjC;AACJ;;;AD0DO,IAAM,sBAAsB;AAGnC,IAAM,2BAA2B;AAGjC,IAAM,0BAAN,cAAsC,iCAAqB;AAAA,EAC9C,OAAO,SAAqB,MAAiB,MAAqB;AACvE,UAAM,SAAS,QAAQ;AACvB,UAAM,YAAY,QAAQ,aAAa;AAEvC,QAAI,WAAW,0BAA0B;AACrC,YAAM,OAAO,KAAK,cAAc,OAAO,SAAS;AAChD,UAAI,gBAAgB,wBAAwB;AACxC,aAAK,gBAAgB,QAAQ;AAAA,MACjC;AACA;AAAA,IACJ;AAEA,UAAM,OAAO,SAAS,MAAM,IAAI;AAAA,EACpC;AACJ;AAGO,SAAS,qBACZ,MACA,SACa;AACb,QAAM,eAAkD,CAAC;AACzD,aAAW,CAAC,YAAY,KAAK,KAAK,OAAO,QAAQ,O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UAAM,KAAK,IAAI,8BAAgB,UAAU,MAAM,OAAO;AACtD,UAAM,oBAAoB,CAAC;AAC3B,WAAO,IAAI,SAAoB;AAC3B,YAAM,OAAO,KAAK,KAAK,SAAS,CAAC;AACjC,YAAM,SAAS,KAAK,MAAM,GAAG,UAAU,QAAQ;AAC/C,YAAM,aACF,gBAAgB,4BAAe,CAAC,GAAG,QAAQ,IAAI,IAAI;AACvD,aAAO,GAAG,OAAO,mBAAmB,UAAU,EAAE,KAAK,OAAK,EAAE,KAAK;AAAA,IACrE;AAAA,EACJ;AACJ;AAEA,SAAS,uBACL,MAC8B;AAC9B,QAAM,OAAO,KAAK,KAAK,SAAS,CAAC;AACjC,MAAI,SAAS,QAAQ,OAAO,SAAS,YAAY,mBAAmB,MAAM;AACtE,WAAO;AAAA,EACX;AACA,SAAO;AACX;","names":["import_rpc","import_core"]}
|
package/dist/index.js
CHANGED
|
@@ -36,7 +36,7 @@ var FusionSystemCallHandler = class extends RpcSystemCallHandler {
|
|
|
36
36
|
const method = message.Method;
|
|
37
37
|
const relatedId = message.RelatedId ?? 0;
|
|
38
38
|
if (method === FUSION_INVALIDATE_METHOD) {
|
|
39
|
-
const call = peer.
|
|
39
|
+
const call = peer.outboundCalls.remove(relatedId);
|
|
40
40
|
if (call instanceof RpcOutboundComputeCall) {
|
|
41
41
|
call.whenInvalidated.resolve();
|
|
42
42
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/fusion-hub.ts","../src/rpc-outbound-compute-call.ts"],"sourcesContent":["// .NET counterparts:\r\n// RpcComputeServiceDef — extends RpcServiceDef with ComputedOptionsProvider.\r\n// RpcComputeMethodDef — extends RpcMethodDef with ComputedOptions and sets\r\n// CallType = RpcComputeCallType (custom call type with its own\r\n// RpcOutboundComputeCall / RpcInboundComputeCall factories).\r\n// RpcInboundComputeCallHandler — an IRpcMiddleware that wraps inbound compute\r\n// calls in a ComputeContext, captures the Computed<T> instance, and stores\r\n// it on RpcInboundComputeCall.Computed for invalidation tracking.\r\n// RemoteComputeServiceInterceptor — the client-side interceptor that creates\r\n// compute-aware outbound calls, tracking server invalidation signals.\r\n//\r\n// In .NET this is split across ~10 files using DI, middleware, interceptors,\r\n// and the RpcComputeCallType custom call type. TS consolidates it into a\r\n// single FusionHub subclass with two method overrides.\r\n//\r\n// Omitted from .NET:\r\n// - RpcComputeCallType / typed RpcInboundComputeCall<T> / RpcOutboundComputeCall<T> —\r\n// .NET uses a separate call type with custom factories, result handling, and\r\n// stage tracking. TS extends the base RpcOutboundComputeCall with a\r\n// whenInvalidated promise (sufficient for the TS use case).\r\n// - ComputedOptionsProvider / ComputedOptions per method — .NET resolves\r\n// per-method caching/invalidation options via DI. TS uses default\r\n// ComputeFunction behavior for all methods.\r\n// - RpcInboundComputeCallHandler middleware — .NET wraps the inbound call in\r\n// ComputeContext using the middleware pipeline. TS wraps it directly in\r\n// _wrapServerMethod by calling cf.invoke() (which sets up\r\n// ComputeContext internally).\r\n// - LocalExecutionMode / ConstrainedEntry — .NET controls whether compute calls\r\n// can execute locally or must go remote (for Fusion's consistency guarantees).\r\n// TS always executes locally (server-side) or remotely (client-side).\r\n// - Invalidation via RpcInboundComputeCall.Computed.Invalidated event — .NET\r\n// attaches an invalidation callback to the captured Computed<T> that calls\r\n// SystemCallSender.Complete(peer, call, invalidatedResult). TS uses\r\n// $sys-c.Invalidate system call instead (equivalent wire effect).\r\n// - RpcOutboundComputeCall.SetError → SetInvalidatedUnsafe — .NET invalidates\r\n// the local computed when an error or reroute occurs. TS resolves\r\n// whenInvalidated on disconnect via rejectAll().\r\n\r\nimport {\r\n RpcHub,\r\n RpcServerPeer,\r\n RpcWebSocketConnection,\r\n RpcSystemCallHandler,\r\n serializeMessage,\r\n defineRpcService,\r\n wireMethodName,\r\n RpcType,\r\n RpcRemoteExecutionMode,\r\n type RpcConnection,\r\n type WebSocketLike,\r\n type RpcServiceDef,\r\n type RpcMethodDef,\r\n type RpcMethodDefInput,\r\n type RpcDispatchContext,\r\n type RpcPeer,\r\n type RpcMessage,\r\n type RpcCallOptions,\r\n getServiceMeta,\r\n getMethodsMeta,\r\n} from '@actuallab/rpc';\r\nimport {\r\n ComputeFunction,\r\n ComputeContext,\r\n type ComputeFunctionImpl,\r\n} from '@actuallab/fusion';\r\nimport { AsyncContext } from '@actuallab/core';\r\nimport { RpcOutboundComputeCall } from './rpc-outbound-compute-call.js';\r\n\r\n/** Call type ID for Fusion compute calls — matches .NET's RpcComputeCallType.Id. */\r\nexport const FUSION_CALL_TYPE_ID = 1;\r\n\r\n/** Wire method name for invalidation system call. */\r\nconst FUSION_INVALIDATE_METHOD = '$sys-c.Invalidate:0';\r\n\r\n/** Handles Fusion-specific system calls ($sys-c.Invalidate), delegating the rest to base. */\r\nclass FusionSystemCallHandler extends RpcSystemCallHandler {\r\n override handle(message: RpcMessage, args: unknown[], peer: RpcPeer): void {\r\n const method = message.Method;\r\n const relatedId = message.RelatedId ?? 0;\r\n\r\n if (method === FUSION_INVALIDATE_METHOD) {\r\n const call = peer.outbound.remove(relatedId);\r\n if (call instanceof RpcOutboundComputeCall) {\r\n call.whenInvalidated.resolve();\r\n }\r\n return;\r\n }\r\n\r\n super.handle(message, args, peer);\r\n }\r\n}\r\n\r\n/** Creates a compute service definition — all methods default to FUSION_CALL_TYPE_ID. */\r\nexport function defineComputeService(\r\n name: string,\r\n methods: Record<string, RpcMethodDefInput>\r\n): RpcServiceDef {\r\n const withCallType: Record<string, RpcMethodDefInput> = {};\r\n for (const [methodName, input] of Object.entries(methods)) {\r\n withCallType[methodName] = {\r\n ...input,\r\n callTypeId: input.callTypeId ?? FUSION_CALL_TYPE_ID,\r\n };\r\n }\r\n return defineRpcService(name, withCallType);\r\n}\r\n\r\n/** Central coordinator for Fusion + RPC — manages compute services, invalidation wiring. */\r\nexport class FusionHub extends RpcHub {\r\n constructor(hubId?: string) {\r\n super(hubId);\r\n this.systemCallHandler = new FusionSystemCallHandler();\r\n // Register Fusion-specific system call for compact format hash resolution\r\n this.registry.register(FUSION_INVALIDATE_METHOD);\r\n }\r\n\r\n /** Accept an incoming WebSocket and create a server peer. */\r\n acceptConnection(ws: WebSocketLike): RpcServerPeer {\r\n const ref = `server://${crypto.randomUUID()}`;\r\n const conn = new RpcWebSocketConnection(ws);\r\n const peer = this.getServerPeer(ref);\r\n peer.accept(conn);\r\n return peer;\r\n }\r\n\r\n /** Accept an RpcConnection and create a server peer. */\r\n acceptRpcConnection(conn: RpcConnection): RpcServerPeer {\r\n const ref = `server://${crypto.randomUUID()}`;\r\n const peer = this.getServerPeer(ref);\r\n peer.accept(conn);\r\n return peer;\r\n }\r\n\r\n /** Override to apply FUSION_CALL_TYPE_ID for compute methods. */\r\n protected override _buildServiceDef(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n cls: abstract new (...args: any[]) => any\r\n ): RpcServiceDef {\r\n const svcMeta = getServiceMeta(cls);\r\n if (svcMeta === undefined)\r\n throw new Error('Contract class missing @rpcService metadata');\r\n\r\n const methodsMeta = getMethodsMeta(cls) ?? {};\r\n const methods = new Map<string, RpcMethodDef>();\r\n\r\n for (const [name, meta] of Object.entries(methodsMeta)) {\r\n const wireArgCount = meta.argCount + 1;\r\n const mapKey = `${name}:${wireArgCount}`;\r\n methods.set(mapKey, {\r\n name,\r\n serviceName: svcMeta.name,\r\n argCount: meta.argCount,\r\n wireArgCount,\r\n callTypeId:\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\r\n (meta as any).compute === true ? FUSION_CALL_TYPE_ID : 0,\r\n stream: meta.returns === RpcType.stream,\r\n noWait: meta.returns === RpcType.noWait,\r\n remoteExecutionMode: RpcRemoteExecutionMode.Default,\r\n });\r\n }\r\n\r\n return { name: svcMeta.name, methods };\r\n }\r\n\r\n protected override _wrapServerMethod(\r\n methodDef: RpcMethodDef,\r\n fn: (...args: unknown[]) => unknown,\r\n impl: object\r\n ): (...args: unknown[]) => unknown {\r\n if (methodDef.callTypeId !== FUSION_CALL_TYPE_ID) return fn;\r\n\r\n // Route through ComputeFunction + wire invalidation → $sys-c.Invalidate\r\n const cf = new ComputeFunction(\r\n methodDef.name,\r\n fn as ComputeFunctionImpl\r\n );\r\n return async (...args: unknown[]) => {\r\n const context = extractDispatchContext(args);\r\n const cleanArgs = context !== undefined ? args.slice(0, -1) : args;\r\n\r\n const computed = await cf.invoke(impl, cleanArgs);\r\n\r\n // Wire invalidation → send $sys-c.Invalidate to the client\r\n if (context !== undefined) {\r\n computed.onInvalidated.add(() => {\r\n const msg = serializeMessage({\r\n Method: FUSION_INVALIDATE_METHOD,\r\n RelatedId: context.callId,\r\n });\r\n context.connection.send(msg);\r\n });\r\n }\r\n\r\n return computed.value;\r\n };\r\n }\r\n\r\n protected override _createClientMethod(\r\n peer: RpcPeer,\r\n methodDef: RpcMethodDef\r\n ): (...args: unknown[]) => unknown {\r\n if (methodDef.callTypeId !== FUSION_CALL_TYPE_ID)\r\n return super._createClientMethod(peer, methodDef);\r\n\r\n const wireName = wireMethodName(methodDef);\r\n // Local ComputeFunction whose impl makes an RPC call\r\n const rpcImpl: ComputeFunctionImpl = async function (\r\n ...args: unknown[]\r\n ) {\r\n // Capture ComputeContext synchronously — AsyncContext.current is the child\r\n // context set by ComputeFunction.invoke() and won't survive the await below.\r\n const computeCtx = ComputeContext.from(AsyncContext.current);\r\n const callOptions: RpcCallOptions = {\r\n callTypeId: FUSION_CALL_TYPE_ID,\r\n outboundCallFactory: (id, m) =>\r\n new RpcOutboundComputeCall(id, m),\r\n };\r\n const outboundCall = peer.call(\r\n wireName,\r\n args,\r\n callOptions\r\n ) as RpcOutboundComputeCall;\r\n const value = await outboundCall.result.promise;\r\n // Wire server invalidation → local computed invalidation\r\n if (computeCtx) {\r\n void outboundCall.whenInvalidated.promise.then(() =>\r\n computeCtx.computed.invalidate()\r\n );\r\n }\r\n return value;\r\n };\r\n const cf = new ComputeFunction(methodDef.name, rpcImpl);\r\n const syntheticInstance = {};\r\n return (...args: unknown[]) => {\r\n const last = args[args.length - 1];\r\n const sliced = args.slice(0, methodDef.argCount);\r\n const invokeArgs =\r\n last instanceof AsyncContext ? [...sliced, last] : sliced;\r\n return cf.invoke(syntheticInstance, invokeArgs).then(c => c.value);\r\n };\r\n }\r\n}\r\n\r\nfunction extractDispatchContext(\r\n args: unknown[]\r\n): RpcDispatchContext | undefined {\r\n const last = args[args.length - 1];\r\n if (last !== null && typeof last === 'object' && '__rpcDispatch' in last) {\r\n return last as RpcDispatchContext;\r\n }\r\n return undefined;\r\n}\r\n","import { PromiseSource } from '@actuallab/core';\r\nimport { RpcOutboundCall } from '@actuallab/rpc';\r\n\r\n/** Tracks a pending outbound compute RPC call — stays in tracker until invalidated. */\r\nexport class RpcOutboundComputeCall extends RpcOutboundCall {\r\n override readonly removeOnOk = false;\r\n readonly whenInvalidated = new PromiseSource<void>();\r\n\r\n override onDisconnect(): void {\r\n this.whenInvalidated.resolve();\r\n }\r\n}\r\n"],"mappings":";AAsCA;AAAA,EACI;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAUA;AAAA,EACA;AAAA,OACG;AACP;AAAA,EACI;AAAA,EACA;AAAA,OAEG;AACP,SAAS,oBAAoB;;;ACjE7B,SAAS,qBAAqB;AAC9B,SAAS,uBAAuB;AAGzB,IAAM,yBAAN,cAAqC,gBAAgB;AAAA,EACtC,aAAa;AAAA,EACtB,kBAAkB,IAAI,cAAoB;AAAA,EAE1C,eAAqB;AAC1B,SAAK,gBAAgB,QAAQ;AAAA,EACjC;AACJ;;;AD0DO,IAAM,sBAAsB;AAGnC,IAAM,2BAA2B;AAGjC,IAAM,0BAAN,cAAsC,qBAAqB;AAAA,EAC9C,OAAO,SAAqB,MAAiB,MAAqB;AACvE,UAAM,SAAS,QAAQ;AACvB,UAAM,YAAY,QAAQ,aAAa;AAEvC,QAAI,WAAW,0BAA0B;AACrC,YAA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AI,CAAC;AAAA,MACxC;AACA,YAAM,eAAe,KAAK;AAAA,QACtB;AAAA,QACA;AAAA,QACA;AAAA,MACJ;AACA,YAAM,QAAQ,MAAM,aAAa,OAAO;AAExC,UAAI,YAAY;AACZ,aAAK,aAAa,gBAAgB,QAAQ;AAAA,UAAK,MAC3C,WAAW,SAAS,WAAW;AAAA,QACnC;AAAA,MACJ;AACA,aAAO;AAAA,IACX;AACA,UAAM,KAAK,IAAI,gBAAgB,UAAU,MAAM,OAAO;AACtD,UAAM,oBAAoB,CAAC;AAC3B,WAAO,IAAI,SAAoB;AAC3B,YAAM,OAAO,KAAK,KAAK,SAAS,CAAC;AACjC,YAAM,SAAS,KAAK,MAAM,GAAG,UAAU,QAAQ;AAC/C,YAAM,aACF,gBAAgB,eAAe,CAAC,GAAG,QAAQ,IAAI,IAAI;AACvD,aAAO,GAAG,OAAO,mBAAmB,UAAU,EAAE,KAAK,OAAK,EAAE,KAAK;AAAA,IACrE;AAAA,EACJ;AACJ;AAEA,SAAS,uBACL,MAC8B;AAC9B,QAAM,OAAO,KAAK,KAAK,SAAS,CAAC;AACjC,MAAI,SAAS,QAAQ,OAAO,SAAS,YAAY,mBAAmB,MAAM;AACtE,WAAO;AAAA,EACX;AACA,SAAO;AACX;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/fusion-hub.ts","../src/rpc-outbound-compute-call.ts"],"sourcesContent":["// .NET counterparts:\r\n// RpcComputeServiceDef — extends RpcServiceDef with ComputedOptionsProvider.\r\n// RpcComputeMethodDef — extends RpcMethodDef with ComputedOptions and sets\r\n// CallType = RpcComputeCallType (custom call type with its own\r\n// RpcOutboundComputeCall / RpcInboundComputeCall factories).\r\n// RpcInboundComputeCallHandler — an IRpcMiddleware that wraps inbound compute\r\n// calls in a ComputeContext, captures the Computed<T> instance, and stores\r\n// it on RpcInboundComputeCall.Computed for invalidation tracking.\r\n// RemoteComputeServiceInterceptor — the client-side interceptor that creates\r\n// compute-aware outbound calls, tracking server invalidation signals.\r\n//\r\n// In .NET this is split across ~10 files using DI, middleware, interceptors,\r\n// and the RpcComputeCallType custom call type. TS consolidates it into a\r\n// single FusionHub subclass with two method overrides.\r\n//\r\n// Omitted from .NET:\r\n// - RpcComputeCallType / typed RpcInboundComputeCall<T> / RpcOutboundComputeCall<T> —\r\n// .NET uses a separate call type with custom factories, result handling, and\r\n// stage tracking. TS extends the base RpcOutboundComputeCall with a\r\n// whenInvalidated promise (sufficient for the TS use case).\r\n// - ComputedOptionsProvider / ComputedOptions per method — .NET resolves\r\n// per-method caching/invalidation options via DI. TS uses default\r\n// ComputeFunction behavior for all methods.\r\n// - RpcInboundComputeCallHandler middleware — .NET wraps the inbound call in\r\n// ComputeContext using the middleware pipeline. TS wraps it directly in\r\n// _wrapServerMethod by calling cf.invoke() (which sets up\r\n// ComputeContext internally).\r\n// - LocalExecutionMode / ConstrainedEntry — .NET controls whether compute calls\r\n// can execute locally or must go remote (for Fusion's consistency guarantees).\r\n// TS always executes locally (server-side) or remotely (client-side).\r\n// - Invalidation via RpcInboundComputeCall.Computed.Invalidated event — .NET\r\n// attaches an invalidation callback to the captured Computed<T> that calls\r\n// SystemCallSender.Complete(peer, call, invalidatedResult). TS uses\r\n// $sys-c.Invalidate system call instead (equivalent wire effect).\r\n// - RpcOutboundComputeCall.SetError → SetInvalidatedUnsafe — .NET invalidates\r\n// the local computed when an error or reroute occurs. TS resolves\r\n// whenInvalidated on disconnect via rejectAll().\r\n\r\nimport {\r\n RpcHub,\r\n RpcServerPeer,\r\n RpcWebSocketConnection,\r\n RpcSystemCallHandler,\r\n serializeMessage,\r\n defineRpcService,\r\n wireMethodName,\r\n RpcType,\r\n RpcRemoteExecutionMode,\r\n type RpcConnection,\r\n type WebSocketLike,\r\n type RpcServiceDef,\r\n type RpcMethodDef,\r\n type RpcMethodDefInput,\r\n type RpcDispatchContext,\r\n type RpcPeer,\r\n type RpcMessage,\r\n type RpcCallOptions,\r\n getServiceMeta,\r\n getMethodsMeta,\r\n} from '@actuallab/rpc';\r\nimport {\r\n ComputeFunction,\r\n ComputeContext,\r\n type ComputeFunctionImpl,\r\n} from '@actuallab/fusion';\r\nimport { AsyncContext } from '@actuallab/core';\r\nimport { RpcOutboundComputeCall } from './rpc-outbound-compute-call.js';\r\n\r\n/** Call type ID for Fusion compute calls — matches .NET's RpcComputeCallType.Id. */\r\nexport const FUSION_CALL_TYPE_ID = 1;\r\n\r\n/** Wire method name for invalidation system call. */\r\nconst FUSION_INVALIDATE_METHOD = '$sys-c.Invalidate:0';\r\n\r\n/** Handles Fusion-specific system calls ($sys-c.Invalidate), delegating the rest to base. */\r\nclass FusionSystemCallHandler extends RpcSystemCallHandler {\r\n override handle(message: RpcMessage, args: unknown[], peer: RpcPeer): void {\r\n const method = message.Method;\r\n const relatedId = message.RelatedId ?? 0;\r\n\r\n if (method === FUSION_INVALIDATE_METHOD) {\r\n const call = peer.outboundCalls.remove(relatedId);\r\n if (call instanceof RpcOutboundComputeCall) {\r\n call.whenInvalidated.resolve();\r\n }\r\n return;\r\n }\r\n\r\n super.handle(message, args, peer);\r\n }\r\n}\r\n\r\n/** Creates a compute service definition — all methods default to FUSION_CALL_TYPE_ID. */\r\nexport function defineComputeService(\r\n name: string,\r\n methods: Record<string, RpcMethodDefInput>\r\n): RpcServiceDef {\r\n const withCallType: Record<string, RpcMethodDefInput> = {};\r\n for (const [methodName, input] of Object.entries(methods)) {\r\n withCallType[methodName] = {\r\n ...input,\r\n callTypeId: input.callTypeId ?? FUSION_CALL_TYPE_ID,\r\n };\r\n }\r\n return defineRpcService(name, withCallType);\r\n}\r\n\r\n/** Central coordinator for Fusion + RPC — manages compute services, invalidation wiring. */\r\nexport class FusionHub extends RpcHub {\r\n constructor(hubId?: string) {\r\n super(hubId);\r\n this.systemCallHandler = new FusionSystemCallHandler();\r\n // Register Fusion-specific system call for compact format hash resolution\r\n this.registry.register(FUSION_INVALIDATE_METHOD);\r\n }\r\n\r\n /** Accept an incoming WebSocket and create a server peer. */\r\n acceptConnection(ws: WebSocketLike): RpcServerPeer {\r\n const ref = `server://${crypto.randomUUID()}`;\r\n const conn = new RpcWebSocketConnection(ws);\r\n const peer = this.getServerPeer(ref);\r\n peer.accept(conn);\r\n return peer;\r\n }\r\n\r\n /** Accept an RpcConnection and create a server peer. */\r\n acceptRpcConnection(conn: RpcConnection): RpcServerPeer {\r\n const ref = `server://${crypto.randomUUID()}`;\r\n const peer = this.getServerPeer(ref);\r\n peer.accept(conn);\r\n return peer;\r\n }\r\n\r\n /** Override to apply FUSION_CALL_TYPE_ID for compute methods. */\r\n protected override _buildServiceDef(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n cls: abstract new (...args: any[]) => any\r\n ): RpcServiceDef {\r\n const svcMeta = getServiceMeta(cls);\r\n if (svcMeta === undefined)\r\n throw new Error('Contract class missing @rpcService metadata');\r\n\r\n const methodsMeta = getMethodsMeta(cls) ?? {};\r\n const methods = new Map<string, RpcMethodDef>();\r\n\r\n for (const [name, meta] of Object.entries(methodsMeta)) {\r\n const wireArgCount = meta.argCount + 1;\r\n const mapKey = `${name}:${wireArgCount}`;\r\n methods.set(mapKey, {\r\n name,\r\n serviceName: svcMeta.name,\r\n argCount: meta.argCount,\r\n wireArgCount,\r\n callTypeId:\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\r\n (meta as any).compute === true ? FUSION_CALL_TYPE_ID : 0,\r\n stream: meta.returns === RpcType.stream,\r\n noWait: meta.returns === RpcType.noWait,\r\n remoteExecutionMode: RpcRemoteExecutionMode.Default,\r\n });\r\n }\r\n\r\n return { name: svcMeta.name, methods };\r\n }\r\n\r\n protected override _wrapServerMethod(\r\n methodDef: RpcMethodDef,\r\n fn: (...args: unknown[]) => unknown,\r\n impl: object\r\n ): (...args: unknown[]) => unknown {\r\n if (methodDef.callTypeId !== FUSION_CALL_TYPE_ID) return fn;\r\n\r\n // Route through ComputeFunction + wire invalidation → $sys-c.Invalidate\r\n const cf = new ComputeFunction(\r\n methodDef.name,\r\n fn as ComputeFunctionImpl\r\n );\r\n return async (...args: unknown[]) => {\r\n const context = extractDispatchContext(args);\r\n const cleanArgs = context !== undefined ? args.slice(0, -1) : args;\r\n\r\n const computed = await cf.invoke(impl, cleanArgs);\r\n\r\n // Wire invalidation → send $sys-c.Invalidate to the client\r\n if (context !== undefined) {\r\n computed.onInvalidated.add(() => {\r\n const msg = serializeMessage({\r\n Method: FUSION_INVALIDATE_METHOD,\r\n RelatedId: context.callId,\r\n });\r\n context.connection.send(msg);\r\n });\r\n }\r\n\r\n return computed.value;\r\n };\r\n }\r\n\r\n protected override _createClientMethod(\r\n peer: RpcPeer,\r\n methodDef: RpcMethodDef\r\n ): (...args: unknown[]) => unknown {\r\n if (methodDef.callTypeId !== FUSION_CALL_TYPE_ID)\r\n return super._createClientMethod(peer, methodDef);\r\n\r\n const wireName = wireMethodName(methodDef);\r\n // Local ComputeFunction whose impl makes an RPC call\r\n const rpcImpl: ComputeFunctionImpl = async function (\r\n ...args: unknown[]\r\n ) {\r\n // Capture ComputeContext synchronously — AsyncContext.current is the child\r\n // context set by ComputeFunction.invoke() and won't survive the await below.\r\n const computeCtx = ComputeContext.from(AsyncContext.current);\r\n const callOptions: RpcCallOptions = {\r\n callTypeId: FUSION_CALL_TYPE_ID,\r\n outboundCallFactory: (id, m) =>\r\n new RpcOutboundComputeCall(id, m),\r\n };\r\n const outboundCall = peer.call(\r\n wireName,\r\n args,\r\n callOptions\r\n ) as RpcOutboundComputeCall;\r\n const value = await outboundCall.result.promise;\r\n // Wire server invalidation → local computed invalidation\r\n if (computeCtx) {\r\n void outboundCall.whenInvalidated.promise.then(() =>\r\n computeCtx.computed.invalidate()\r\n );\r\n }\r\n return value;\r\n };\r\n const cf = new ComputeFunction(methodDef.name, rpcImpl);\r\n const syntheticInstance = {};\r\n return (...args: unknown[]) => {\r\n const last = args[args.length - 1];\r\n const sliced = args.slice(0, methodDef.argCount);\r\n const invokeArgs =\r\n last instanceof AsyncContext ? [...sliced, last] : sliced;\r\n return cf.invoke(syntheticInstance, invokeArgs).then(c => c.value);\r\n };\r\n }\r\n}\r\n\r\nfunction extractDispatchContext(\r\n args: unknown[]\r\n): RpcDispatchContext | undefined {\r\n const last = args[args.length - 1];\r\n if (last !== null && typeof last === 'object' && '__rpcDispatch' in last) {\r\n return last as RpcDispatchContext;\r\n }\r\n return undefined;\r\n}\r\n","import { PromiseSource } from '@actuallab/core';\r\nimport { RpcOutboundCall } from '@actuallab/rpc';\r\n\r\n/** Tracks a pending outbound compute RPC call — stays in tracker until invalidated. */\r\nexport class RpcOutboundComputeCall extends RpcOutboundCall {\r\n override readonly removeOnOk = false;\r\n readonly whenInvalidated = new PromiseSource<void>();\r\n\r\n override onDisconnect(): void {\r\n this.whenInvalidated.resolve();\r\n }\r\n}\r\n"],"mappings":";AAsCA;AAAA,EACI;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAUA;AAAA,EACA;AAAA,OACG;AACP;AAAA,EACI;AAAA,EACA;AAAA,OAEG;AACP,SAAS,oBAAoB;;;ACjE7B,SAAS,qBAAqB;AAC9B,SAAS,uBAAuB;AAGzB,IAAM,yBAAN,cAAqC,gBAAgB;AAAA,EACtC,aAAa;AAAA,EACtB,kBAAkB,IAAI,cAAoB;AAAA,EAE1C,eAAqB;AAC1B,SAAK,gBAAgB,QAAQ;AAAA,EACjC;AACJ;;;AD0DO,IAAM,sBAAsB;AAGnC,IAAM,2BAA2B;AAGjC,IAAM,0BAAN,cAAsC,qBAAqB;AAAA,EAC9C,OAAO,SAAqB,MAAiB,MAAqB;AACvE,UAAM,SAAS,QAAQ;AACvB,UAAM,YAAY,QAAQ,aAAa;AAEvC,QAAI,WAAW,0BAA0B;AACrC,YAAM,OAAO,KAAK,cAAc,OAAO,SAAS;AAChD,UAAI,gBAAgB,wBAAwB;AACxC,aAAK,gBAAgB,QAAQ;AAAA,MACjC;AACA;A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MAAM,aAAa,OAAO;AAExC,UAAI,YAAY;AACZ,aAAK,aAAa,gBAAgB,QAAQ;AAAA,UAAK,MAC3C,WAAW,SAAS,WAAW;AAAA,QACnC;AAAA,MACJ;AACA,aAAO;AAAA,IACX;AACA,UAAM,KAAK,IAAI,gBAAgB,UAAU,MAAM,OAAO;AACtD,UAAM,oBAAoB,CAAC;AAC3B,WAAO,IAAI,SAAoB;AAC3B,YAAM,OAAO,KAAK,KAAK,SAAS,CAAC;AACjC,YAAM,SAAS,KAAK,MAAM,GAAG,UAAU,QAAQ;AAC/C,YAAM,aACF,gBAAgB,eAAe,CAAC,GAAG,QAAQ,IAAI,IAAI;AACvD,aAAO,GAAG,OAAO,mBAAmB,UAAU,EAAE,KAAK,OAAK,EAAE,KAAK;AAAA,IACrE;AAAA,EACJ;AACJ;AAEA,SAAS,uBACL,MAC8B;AAC9B,QAAM,OAAO,KAAK,KAAK,SAAS,CAAC;AACjC,MAAI,SAAS,QAAQ,OAAO,SAAS,YAAY,mBAAmB,MAAM;AACtE,WAAO;AAAA,EACX;AACA,SAAO;AACX;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@actuallab/fusion-rpc",
|
|
3
|
-
"version": "12.3.
|
|
3
|
+
"version": "12.3.49",
|
|
4
4
|
"description": "Bridge between Fusion and RPC - FusionHub, compute service registration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"clean": "rm -rf dist"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@actuallab/core": "12.3.
|
|
30
|
-
"@actuallab/fusion": "12.3.
|
|
31
|
-
"@actuallab/rpc": "12.3.
|
|
29
|
+
"@actuallab/core": "12.3.49",
|
|
30
|
+
"@actuallab/fusion": "12.3.49",
|
|
31
|
+
"@actuallab/rpc": "12.3.49"
|
|
32
32
|
},
|
|
33
33
|
"publishConfig": {
|
|
34
34
|
"access": "public"
|