openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
29 lines (28 loc) • 646 B
JavaScript
//#region src/hooks/installs.ts
/** Return config with one hook install record merged into hooks.internal.installs. */
function recordHookInstall(cfg, update) {
const { hookId, ...record } = update;
const installs = {
...cfg.hooks?.internal?.installs,
[]: {
...cfg.hooks?.internal?.installs?.[hookId],
...record,
installedAt: record.installedAt ?? (/* @__PURE__ */ new Date()).toISOString()
}
};
return {
...cfg,
hooks: {
...cfg.hooks,
internal: {
...cfg.hooks?.internal,
installs: {
...installs,
[]: installs[hookId]
}
}
}
};
}
//#endregion
export { recordHookInstall as t };