Coder Social home page Coder Social logo

Browser-side plugins about core.js HOT 6 CLOSED

aensley avatar aensley commented on May 27, 2024
Browser-side plugins

from core.js.

Comments (6)

gr2m avatar gr2m commented on May 27, 2024 1

OH, I just realized that the baseUrl option might be a problem with GitHub Enterprise. I'll look into fixing it, but for the time being, try to set it to just https://mygithubenterprise.com/api

from core.js.

gr2m avatar gr2m commented on May 27, 2024 1

Assuming the plugins were on Pika, you would use them like this

<script type="module">
import { retryPlugin } from "https://cdn.pika.dev/@octokit/plugin-retry";
import { throttlePlugin } from "https://cdn.pika.dev/@octokit/plugin-throttling";
import { Octokit } from "https://cdn.pika.dev/@octokit/core";

const MyOctokit = Octokit.plugin([retryPlugin, throttlePlugin])
const octokit = new MyOctokit()
</script>

Note that the throttle plugin will not be helpful for GraphQL at this point, it has its own rate limiting independent of http requests.

And for retries, I was told to try a graphql request once in case in timed out, as a temporary index might have been created and the 2nd request might be able to respond within the 10s timeout. That is currently not implemented in the retry plugin.

I'll happily take pull requests that make the plugins pika-compatible. Here is a plugin that can be used as reference: https://github.com/octokit/plugin-paginate-rest.js. I cannot work on it myself until the next year, I'm afraid

I want to paginate graphql queries without having to write a lot of code

I did not found a simple solution for that bit yet. I've shared some insights in my comment here: octokit/graphql.js#61 (comment)

from core.js.

gr2m avatar gr2m commented on May 27, 2024 1

All the plugins are now published to pika, the code shown above should just work ™️ Let me know if you run into any problems

from core.js.

gr2m avatar gr2m commented on May 27, 2024

Unfortunately the plugins are not yet published to Pika, but it's something I'm working on right now.

@octokit/graphql is no a plugin though, it's a standalone library. But the good news is that it's already built into @octokit/core, so you can just do this:

import { Octokit } from 'https://cdn.pika.dev/@octokit/core'
const octokit = new Octokit({
  auth: '1234',
  baseUrl: 'https://mygithubenterprise.com/api/graphql',
  previews: ['cloak-preview', 'mercy-preview']
})
octokit.graphql(`... your query here ...`)

Does that work for you?

from core.js.

aensley avatar aensley commented on May 27, 2024

@gr2m Thanks for the replies. I was going off of this comment on @octokit/graphql: octokit/graphql.js#61 (comment)

Basically, I want to paginate graphql queries without having to write a lot of code. I'm also interested in using the retry and throttling plugins, so my basic question is still unanswered. Assuming the plugins were on Pika, how would I use them from the browser?

from core.js.

aensley avatar aensley commented on May 27, 2024

@gr2m That makes sense. I'm afraid much of this is out of my league (I'm not really a JS/ES/TS dev), so I'll wait patiently for a solution. Thanks for the explanation and all your work on this project. It has really helped me.

from core.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.