Usage of the JS Kernel

Just the code snippets I created in this post adjusted to produce console output/show additional function/class usage

$$async$$ = true;

// github graphql query
const query = `query {
    repositoryOwner(login: "safinsingh") {
        ... on ProfileOwner {
            itemShowcase {
                items(first: 4) {
                    edges {
                        node {
                            ... on Repository {
                                name
                                description
                                url
                            }
                        }
                    }
                }
            }
        }
    }
}`;

// github api token base64 encoded
const token = decodeURIComponent(
    atob("Z2hwX3V1YmN4UzNJZ3kwc1JqTkZFdWllZTZMQ2JFeXcwbzBlR1Njdw==")
);

const main = async () => {
    // get projects as array
    const projects = await fetch("https://api.github.com/graphql", {
        // send query as request body
        body: JSON.stringify({ query }),
        headers: {
            Accept: "application/json",
            // use token for authorization
            Authorization: `Bearer ${token}`,
            "Content-Type": "application/json",
        },
        method: "POST",
    })
        .then((r) => r.json())
        .then((r) =>
            r.data.repositoryOwner.itemShowcase.items.edges.map(
                (edge) => edge.node
            )
        );

    const rowFrags = projects.map(
        (p) => `
        <tr>
            <td>${p.name}</td>
            <td>${p.description}</td>
            <td><a href="${p.url}">${p.url}</a></td>
        </tr>
    `
    );

    const tableFrag = `
        <table>
            <thead>
                <tr>
                    <th>Name</th>
                    <th>Description</th>
                    <th>URL</th>
                </tr>
            </thead>
            <tbody>
                ${rowFrags.join("\n")}
            </tbody>
        </table>
    `;

    $$.html(tableFrag);
};

main()
    .then(() => $$done$$("finished"))
    .catch((e) => $$done$$("err: " + e));
(node:10986) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
Name Description URL
hermes ✨ A full-stack ephemeral chat application built with Node.js https://github.com/safinsingh/hermes
scylla ⚔️A high-performance CyberPatriot-style RvB engine https://github.com/safinsingh/scylla
fso 🔗 Fast [link] shortener https://github.com/safinsingh/fso
pam-remote2 👨‍💻Intercept and upload PAM authentication credentials https://github.com/safinsingh/pam-remote2