UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

1 lines • 2.54 kB
import{a as e,i as t,o as n,r}from"./openclaw-state-read-kysely-sync-Bcu0Qb7F.mjs";import{o as i}from"./openclaw-state-read-openclaw-state-db-schema-helpers-QFZd8aJI.mjs";import"./openclaw-state-read-github-publication-requester-CxKsTWaQ.mjs";import"./openclaw-state-read-github-publication-session-lifecycles.worker-Lg6oFR2C.mjs";import{n as a}from"./openclaw-state-read-github-publication-receipt-CKKO_G2m.mjs";const githubPublicationDatabase=t=>e(t);function readGitHubPublicationRequest(e,n){let r=githubPublicationDatabase(e).selectFrom(`github_publication_requests`).selectAll();return t(e,`requestId`in n?r.where(`request_id`,`=`,n.requestId):r.where(`session_id`,`=`,n.sessionId).where(`idempotency_key`,`=`,n.idempotencyKey))}function readKnownGitHubPublicationPullRequestUrlsInDatabase(e,t){let r=new Set(t.pull_request_url?[t.pull_request_url]:[]);for(let i of n(e,githubPublicationDatabase(e).selectFrom(`github_publication_requests`).selectAll().where(`worktree_id`,`=`,t.worktree_id).where(`repository_fingerprint`,`=`,t.repository_fingerprint).where(`repository`,`=`,t.repository).where(`branch`,`=`,t.branch).where(`base_branch`,`=`,t.base_branch).where(`identity_account_id`,`=`,t.identity_account_id).where(`status`,`=`,`published`)))a(i),i.pull_request_url&&r.add(i.pull_request_url);return[...r]}function listGitHubPublicationsForClaimInDatabase(e,t,n={}){if(!i(e,`github_publication_requests`))return[];let a=githubPublicationDatabase(e).selectFrom(`github_publication_requests`).selectAll().where(`session_id`,`=`,t.sessionId).where(`claim_id`,`=`,t.claimId).where(`run_id`,`=`,t.runId).orderBy(`created_at_ms`);return n.pendingOnly&&(a=a.where(`status`,`in`,[`requested`,`publishing`])),r(e,a).rows}function listSharedGitHubPublicationsInDatabase(e,t){if(!i(e,`github_publication_requests`))return[];let n=githubPublicationDatabase(e).selectFrom(`github_publication_requests`).selectAll();return t.pending!==void 0&&(n=n.where(`status`,`in`,t.pending?[`requested`,`publishing`]:[`published`,`failed`])),t.status!==void 0&&(n=n.where(`status`,`=`,t.status)),t.claimNull!==void 0&&(n=n.where(`claim_id`,t.claimNull?`is`:`is not`,null)),t.sessionId!==void 0&&(n=n.where(`session_id`,`=`,t.sessionId)),t.unreported&&(n=n.where(`reported_at_ms`,`is`,null)),r(e,n.orderBy(t.unreported?`updated_at_ms`:`created_at_ms`)).rows}export{githubPublicationDatabase,listGitHubPublicationsForClaimInDatabase,listSharedGitHubPublicationsInDatabase,readGitHubPublicationRequest,readKnownGitHubPublicationPullRequestUrlsInDatabase};