mirror of
https://github.com/domfelipe/mika-agent-assist.git
synced 2026-08-07 06:56:44 +00:00
Changes
Co-authored-by: domfelipe <53182096+domfelipe@users.noreply.github.com>
This commit is contained in:
parent
a72b4b6624
commit
d04260b038
1 changed files with 17 additions and 6 deletions
|
|
@ -197,11 +197,11 @@ export async function setHermesSuspended(opts: {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Busca o environmentId do primeiro deployment de um serviço. Útil quando vps_pool_id está null. */
|
/** Busca env+project IDs do primeiro deployment de um serviço. Útil quando vps_pool_id está null. */
|
||||||
export async function getServiceEnvironmentId(opts: {
|
export async function getServiceContext(opts: {
|
||||||
token: string;
|
token: string;
|
||||||
serviceId: string;
|
serviceId: string;
|
||||||
}): Promise<string | null> {
|
}): Promise<{ environmentId: string | null; projectId: string | null }> {
|
||||||
const query = `
|
const query = `
|
||||||
query Service($id: String!) {
|
query Service($id: String!) {
|
||||||
service(id: $id) {
|
service(id: $id) {
|
||||||
|
|
@ -216,10 +216,21 @@ export async function getServiceEnvironmentId(opts: {
|
||||||
service: { projectId: string; deployments: { edges: { node: { environmentId: string } }[] } };
|
service: { projectId: string; deployments: { edges: { node: { environmentId: string } }[] } };
|
||||||
}>(query, { id: opts.serviceId }, opts.token);
|
}>(query, { id: opts.serviceId }, opts.token);
|
||||||
if (res.errors?.length) {
|
if (res.errors?.length) {
|
||||||
console.error("getServiceEnvironmentId errors:", JSON.stringify(res.errors));
|
console.error("getServiceContext errors:", JSON.stringify(res.errors));
|
||||||
return null;
|
return { environmentId: null, projectId: null };
|
||||||
}
|
}
|
||||||
return res.data?.service?.deployments?.edges?.[0]?.node?.environmentId ?? null;
|
return {
|
||||||
|
environmentId: res.data?.service?.deployments?.edges?.[0]?.node?.environmentId ?? null,
|
||||||
|
projectId: res.data?.service?.projectId ?? null,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @deprecated use getServiceContext */
|
||||||
|
export async function getServiceEnvironmentId(opts: {
|
||||||
|
token: string;
|
||||||
|
serviceId: string;
|
||||||
|
}): Promise<string | null> {
|
||||||
|
return (await getServiceContext(opts)).environmentId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Apaga o webhook do Telegram para que o Hermes assuma via polling. */
|
/** Apaga o webhook do Telegram para que o Hermes assuma via polling. */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue