inngest
Version:
Official SDK for Inngest.com. Inngest is the reliability layer for modern applications. Inngest combines durable execution, events, and queues into a zero-infra platform with built-in observability.
44 lines (43 loc) • 932 B
JavaScript
//#region src/components/realtime/channel.ts
const createTopicAccessors = (channelName, topics) => {
const accessors = {};
for (const [topicName, config] of Object.entries(topics)) accessors[topicName] = {
channel: channelName,
topic: topicName,
config
};
return accessors;
};
const channel = (options) => {
const { name, topics } = options;
if (typeof name === "function") {
const def = (...args) => {
const resolvedName = name(...args);
return {
name: resolvedName,
topics,
...createTopicAccessors(resolvedName, topics)
};
};
Object.defineProperties(def, {
topics: {
value: topics,
enumerable: true
},
$infer: { get: () => topics },
$params: { get: () => void 0 }
});
return def;
}
return {
name,
topics,
...createTopicAccessors(name, topics),
get $infer() {
return topics;
}
};
};
//#endregion
export { channel };
//# sourceMappingURL=channel.js.map