
Product
Introducing Tier 1 Reachability: Precision CVE Triage for Enterprise Teams
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
replit-graphql-api
Advanced tools
A package to easily interact with Replit's graphql API!
This package includes:
fetch
: A function to fetch the data from the endpointgetUser
: A function to get some informations on a usergetRepl
:A function to get some informations on a replbuildRequest
: A function to get the body of the request (JSON)buildQuery
: A function to build the query from an objectgetPossibleTargets
: Return an array with the possible targetsgetInfosOnTarget
: return some infos on a targetnpm install replit-graphql-api
import GraphQL from 'replit-graphql-api'
import { fetch } from 'replit-graphql-api'
fetch({
operationName: 'UserCard',
query: `
query UserCard($username: String!) {
userByUsername(username: $username) {
id
fullName
username
url
bio
image
followerCount
followCount
}
}
`,
variables: {
username: 'nathanTi'
}
})
Note: The following funtions will build the query themselves.
import { getUser } from 'replit-graphql-api'
getUser({
// the username
username: 'nathanTi',
// the infos you want to access to (optionnal, default is ['id', 'title', 'timeCreated', 'imageUrl', 'description', 'commentCount'])
fields: [
'id',
'fullName',
'username',
'url',
'bio',
'image',
'followerCount',
'followCount'
]
})
.then(data => {
console.log(data);
})
// Result:
{
user: {
id: '...',
fullName: '...',
username: '...'
// ...
}
}
To find a repl, you can search it with it's url or it's id
import { getRepl } from 'replit-graphql-api'
getRepl({
// the username
url: '/@<username>/<repl-name>',
// the infos you want to access to (optionnal, default is ['id', 'title', 'timeCreated', 'imageUrl', 'description', 'commentCount']
fields: ['id', 'title', 'timeCreated', 'imageUrl', 'description', 'commentCount']
})
.then(data => {
console.log(data);
})
// Result:
{
repl: {
id: '...',
title: '...',
timeCreated: '...'
// ...
}
}
buildRequest
packageThis function can be used to build a qraphql query.
In the fields
, you can specify a simple info,
import { fetch, buildRequest } from 'replit-graphql-api'
const request = buildRequest({
// the typename of the thing you want to search
target: 'Repl',
// the data you want to access to
fields: [
'id',
'title',
// you can access to more complex data, as the infos on the owner of the repl
{
name: 'owner',
fields: [
'id',
'username',
'fullName'
]
}
],
// the variables to access to the data
variables: {
// YOu search a repl, so you set the variables to search for the repl here
Repl: {
url: '/@<username>/<repl-name>'
}
}
});
fetch(request)
.then(data => {
console.log(data);
});
// Result:
{
repl: {
id: '...',
title: '...',
owner: {
id: '...',
username: '...',
fullName: '...'
}
}
}
buildQuery
packageThis function can be used to build a qraphql query:
import { buildQuery }
const query = buildQuery({
target: 'Repl',
fields: [
'id',
'title',
{
name: 'owner',
fields: [
'id',
'username',
'fullName'
]
}
],
variables: {
Repl: {
url: '/@<username>/<repl-name>'
}
}
});
import { getPossibleTargets } from 'replit-graphql-api'
console.log(getPossibleTargets())
import { getInfosOnTarget } from 'replit-graphql-api'
console.log(getInfosOnTarget('Repl'))
FAQs
A module to easily interact with Replit's graphql API!
We found that replit-graphql-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.