{"version":3,"file":"helpers.mjs","names":[],"sources":["../src/helpers.ts"],"sourcesContent":["/**\n * Helper free functions that operate on an {@link ISdk} instance.\n *\n * These were previously instance methods on the SDK. They take the iii\n * instance as the first argument so the public API surface of `ISdk` stays\n * focused on the core lifecycle and registration methods.\n */\nimport type { Channel, ISdk } from './types'\nimport type { IStream } from './stream'\n\nexport { ChannelDirection, ChannelItem } from './channels'\nexport { extractChannelRefs, isChannelRef } from './utils'\n\ntype IIIWithHelperShims = ISdk & {\n  __helpers_create_channel(bufferSize?: number): Promise<Channel>\n  __helpers_create_stream<T>(name: string, stream: IStream<T>): void\n}\n\n/**\n * Create a streaming channel pair for worker-to-worker data transfer.\n *\n * Free-function form of the previous `ISdk.createChannel` instance method.\n */\nexport function createChannel(iii: ISdk, bufferSize?: number): Promise<Channel> {\n  return (iii as IIIWithHelperShims).__helpers_create_channel(bufferSize)\n}\n\n/**\n * Register a custom stream implementation by wiring its 5 callable methods\n * to `stream::get/set/delete/list/list_groups`.\n *\n * Free-function form of the previous `ISdk.createStream` instance method.\n */\nexport function createStream<TData>(iii: ISdk, streamName: string, stream: IStream<TData>): void {\n  ;(iii as IIIWithHelperShims).__helpers_create_stream(streamName, stream)\n}\n"],"mappings":";;;;;;;;AAuBA,SAAgB,cAAc,KAAW,YAAuC;AAC9E,QAAQ,IAA2B,yBAAyB,WAAW;;;;;;;;AASzE,SAAgB,aAAoB,KAAW,YAAoB,QAA8B;AAC9F,CAAC,IAA2B,wBAAwB,YAAY,OAAO"}