48 lines
1.9 KiB
JavaScript
48 lines
1.9 KiB
JavaScript
async function main() {
|
|
const authRes = await fetch('https://auth.ghaymah.systems/signin/email-password', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ email: 'ziadalex2003@gmail.com', password: '2062003Mz*' })
|
|
});
|
|
const { session } = await authRes.json();
|
|
const token = session.accessToken;
|
|
|
|
// Try AppLogs mutation
|
|
const logs = await fetch('https://graphql.ghaymah.systems/v1/graphql', {
|
|
method: 'POST',
|
|
headers: { 'Authorization': 'Bearer ' + token, 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({
|
|
query: `mutation AppLogs($appId: String!, $max: Int!) {
|
|
appLogs(arg1: { appId: $appId, max: $max }) {
|
|
timestamp message source severity
|
|
}
|
|
}`,
|
|
variables: { appId: 'af1b9e91-9bec-4d6a-b76c-92d7273b82ce', max: 50 }
|
|
})
|
|
});
|
|
const logsData = await logs.json();
|
|
console.log('App A logs:', JSON.stringify(logsData, null, 2));
|
|
|
|
// Also check resource status again
|
|
const res = await fetch('https://graphql.ghaymah.systems/v1/graphql', {
|
|
method: 'POST',
|
|
headers: { 'Authorization': 'Bearer ' + token, 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({
|
|
query: `query GetResources($userId: uuid) {
|
|
ghaymah_cloud_resources(where: { user_id: { _eq: $userId }, deleted: { _eq: false }, chart_name: { _eq: "ghaymah-app" } }) {
|
|
id status values message updated_at
|
|
}
|
|
}`,
|
|
variables: { userId: session.user.id }
|
|
})
|
|
});
|
|
const resData = await res.json();
|
|
resData.data?.ghaymah_cloud_resources.forEach(r => {
|
|
if (r.values?.name === 'tcp-echo-server' || r.values?.name === 'tcp-test-client') {
|
|
console.log(`${r.values.name}: status=${r.status}, msg=${r.message}, updated=${r.updated_at}`);
|
|
console.log(' command:', JSON.stringify(r.values.command)?.substring(0, 200));
|
|
}
|
|
});
|
|
}
|
|
main().catch(console.error);
|