UNPKG

eas-cli

Version:
28 lines (27 loc) 953 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.fetchUserAsync = void 0; const tslib_1 = require("tslib"); const graphql_tag_1 = tslib_1.__importDefault(require("graphql-tag")); const createGraphqlClient_1 = require("../commandUtils/context/contextUtils/createGraphqlClient"); async function fetchUserAsync({ sessionSecret, }) { const graphqlClient = (0, createGraphqlClient_1.createGraphqlClient)({ accessToken: null, sessionSecret }); const result = await graphqlClient .query((0, graphql_tag_1.default) ` query UserQuery { meUserActor { id username } } `, {}, { additionalTypenames: [] /* UserQuery has immutable fields */, }) .toPromise(); const { data } = result; return { id: data.meUserActor.id, username: data.meUserActor.username, }; } exports.fetchUserAsync = fetchUserAsync;