Files
FrenoCorp/node_modules/@trpc/client/dist/splitLink-BMgxggng.cjs
Michael Freno 7c684a42cc FRE-600: Fix code review blockers
- Consolidated duplicate UndoManagers to single instance
- Fixed connection promise to only resolve on 'connected' status
- Fixed WebSocketProvider import (WebsocketProvider)
- Added proper doc.destroy() cleanup
- Renamed isPresenceInitialized property to avoid conflict

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-04-25 00:08:01 -04:00

58 lines
1.5 KiB
JavaScript

const require_chunk = require('./chunk-DWy1uDak.cjs');
const __trpc_server_observable = require_chunk.__toESM(require("@trpc/server/observable"));
//#region src/links/internals/createChain.ts
/** @internal */
function createChain(opts) {
return (0, __trpc_server_observable.observable)((observer) => {
function execute(index = 0, op = opts.op) {
const next = opts.links[index];
if (!next) throw new Error("No more links to execute - did you forget to add an ending link?");
const subscription = next({
op,
next(nextOp) {
const nextObserver = execute(index + 1, nextOp);
return nextObserver;
}
});
return subscription;
}
const obs$ = execute();
return obs$.subscribe(observer);
});
}
//#endregion
//#region src/links/splitLink.ts
function asArray(value) {
return Array.isArray(value) ? value : [value];
}
function splitLink(opts) {
return (runtime) => {
const yes = asArray(opts.true).map((link) => link(runtime));
const no = asArray(opts.false).map((link) => link(runtime));
return (props) => {
return (0, __trpc_server_observable.observable)((observer) => {
const links = opts.condition(props.op) ? yes : no;
return createChain({
op: props.op,
links
}).subscribe(observer);
});
};
};
}
//#endregion
Object.defineProperty(exports, 'createChain', {
enumerable: true,
get: function () {
return createChain;
}
});
Object.defineProperty(exports, 'splitLink', {
enumerable: true,
get: function () {
return splitLink;
}
});