3.2.3 • Published 8 months ago

replit-graphql v3.2.3

Weekly downloads
-
License
ISC
Repository
github
Last release
8 months ago

Replit GraphQL Client

Replit GraphQL is the most performant, package which interacts with the Replit's GraphQL API to send GraphQL queries, mutations and subscriptions.

Installation

Install it by running this command in the Shell tab of your Repl

npm install replit-graphql

Usage

const replit = require('replit-graphql');

const getUsernameById = `query ($id: Int!) {
	user(id: $id) {
		username
	} 
}`;

const variables = { id: 1 };

replit.query(getUsernameById, { variables }).then(console.log);

API

Replit GraphQL exports an object with the following functions:

function query(query: string, config?: {
	variables?: object|string,
	raw?: boolean
}) => Promise<object|string>

Performs a GraphQL query with the given query and variables. Returns a Promise that resolves to the query result.

function subscribe(query: string, config?: {
	variables?: object|string
}) => EventEmitter

Performs a GraphQL subscription with the given query and variables. It returns an EventEmitter which has the following methods:

  • on(eventName: string, callback)
  • unsubscribe
function setSid(sid: string) => void

Sets the sid which is used for queries and subscriptions. If you have an environment variable/secret called SID, that will be used by default.

Contributing

Contributions are welcome! If you find a bug or want to add a new feature, please open an issue or submit a pull request on the GitHub repository.

1.1.0

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

2.0.3

1 year ago

2.0.2

1 year ago

2.0.5

1 year ago

2.0.4

1 year ago

2.0.7

1 year ago

2.0.6

1 year ago

2.0.9

1 year ago

2.0.8

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

3.2.2

8 months ago

3.0.4

11 months ago

3.1.2

8 months ago

3.2.1

9 months ago

3.0.3

1 year ago

3.2.0

9 months ago

3.1.1

9 months ago

3.0.2

1 year ago

3.1.0

10 months ago

3.0.1

1 year ago

3.2.3

8 months ago

3.0.5

11 months ago

3.0.0

1 year ago

1.0.2

1 year ago

1.0.0

1 year ago