Coder Social home page Coder Social logo

onegraph-changelog's People

Contributors

dwwoelfel avatar jsjoeio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

onegraph-changelog's Issues

[docs, feature]: Feedback in general

I think the setup instructions could be clarified to make it easier for first-time users. For instance, following the instructions, I get this after starting the app:

image

I know this is because the server isn't running and hasn't generated the queries but ideally, the setup should walk me through the entire setup (including the Relay part) before telling me to start the app.

Another thing that isn't clear is if I need to use two separate OneGraph apps? I am guessing no, but in the Setup part, you say use your "app's id". But then in the Relay part you say create a new app. I think we could clarify this section to avoid any confusion.

Also, I think we should try to solidify the use of env variables. There's a .env but then in the relay part, it tells me to add them inline with the yarn relay --watch command. It would be nice if I just added them to the .env.

While all of these may sound "negative", I do think this project is awesome and I know it's still very early on, but I did get things running :)

image

Last thing, I don't know the best solution, but the "issue" is having all the types of deployments in this one example. Now, to deploy to Netlify, I have to go delete the firebase, fly, now, files. Maybe instead you could do what services like Next.js and Nest.js do where you have a directory with examples:

Also, not your fault, but Netlify failed with I tried to deploy :( Something happened with the authorization? I ran yarn deploy:netlify, it opened a tab in my browser, I logged in and gave it permission then went back and reran the command but it failed saying unauthorized. Will figure this out. But might be worth noting in the docs.

image

Hmm...tried to deploy by connecting site to Netlify and it didn't work.
image

Looks like something went wrong with my functions maybe:
image

I'll have to investigate a bit further but I'm sure I can figure it out.

Summary of Feedback

Doc fixes

  • Rewrite Setup instructions to be more hold user's hand more
  • Decide on consistent user of environment variables
  • Refactor the main example and create /examples directory

Bugs

  • couldn't deploy to Netlify from command line (bug with Netlify?)

Feature Requests

  • OneGraph OneBlog CLI tool to generate boiler plate. It would ask what service you want to use (i.e. Firebase, now, Netlify), and then you wouldn't have all the unnecessary files

P.S. - this is the first time I've heard of Grommet. Looks pretty nice! 👌🏼

Updates to OneGraph's auth.js

We've published a few updates to onegraph-auth, the javascript library for logging your users into services on OneGraph. Upgrade to version 2.0.1 to get all of the updates.

Supports a custom GraphQL url to fetch login information

You can now use onegraph-auth if you're using OneGraph as a remote schema (e.g. with Hasura). Just instantiate OneGraphAuth with the new graphqlUrl property.

import OneGraphAuth from 'onegraph-auth';
const auth = new OneGraphAuth({
  appId: APP_ID,
  graphqlUrl: 'https://example.com/graphql'
})

Log out a particular user

The logout method now supports logging out a particular user. Just pass the user id as the second argument. For example auth.logout("slack", "U8E10DFK3"). To get a list of logged in users with their ids, use auth.loggedInServices().

Uses message passing instead of a redirect to complete the oauth flow

The default has been updated to use window.postMessage to send the OAuth code to the originating window once the flow is completed. Previously, the token was taken from the URL via a redirect. To keep the old behavior, pass communicationMode: 'redirect'when you create the auth.

Learn more about logging your users into OneGraph in the docs.

Hop into our Spectrum channel if you have any questions https://www.onegraph.com/chat.

Customize Styles for the OneGraph GraphiQL Explorer

Our open-source GraphiQL Explorer library just got support for custom styling.

You can provide custom colors, customize the button styles, and provide custom components for the checkboxes and arrows. Read more about how to customize the styles on the README.

We've been happy to see companies that use GraphQL adopt the explorer (see Gatsby, Shopify, AWS Amplify, PostGraphile, Hasura, GraphiQL Online, and GraphiQL.app).

With this change, we expect to see a few more come on board. If you'd like help integrating the explorer, email [email protected] or hop into our Spectrum channel.

Beta support for Google Search Console

Analyze your site's top search keywords with our just-released Google's Search Console integration.

The following query will show you all of your top search keywords for all the sites you manage that originate from the UK, all grouped by date and search term.

query GoogleSearchConsoleQuery {
  google {
    searchConsole {
      sites {
        nodes {
          siteUrl
          query(
            startDate: "2020-04-27"
            endDate: "2020-05-04"
            dimensions: [DATE, QUERY]
            dimensionFilters: [
              {
                dimension: COUNTRY
                operator: EQUALS
                expression: "GBR"
              }
            ]
          ) {
            responseAggregationType
            rows {
              clicks
              ctr
              impressions
              keys
              position
            }
          }
        }
      }
    }
  }
}

Be sure to follow our instructions in the docs to set up a custom OAuth client for Google Search Console.

Try it out at OneGraph.

Hop into our Spectrum channel if you have any questions.

Facebook Business API updated to version 5.0

The Facebook Business API has been updated to version 5.0.

It comes with support for a new ads volume field, so you can determine the volume of ads for your ad account.

query AdsVolume {
  facebookBusiness {
    me {
      adAccounts {
        nodes {
          adsVolume {
            nodes {
              adsRunningOrInReviewCount
              currentAccountAdsRunningOrInReviewCount
            }
          }
        }
      }
    }
  }
}

Try it out at OneGraph.

Hop into our Spectrum channel if you have any questions or a use case that's not supported.

Hello Cezar!

Anyone can open an issue...

code, "wow"

works!

AuthGuardian support for TwitchTV & built-in values

We've push support to AuthGuardian for rules based on the TwitchTV data: email rules, email verified, and login status.

That means you can build apps with TwitchTV login, and assign permissions basic on facts about them.

For example, to give users who have verified TwitchTV emails belonging to the onegraph.com domain admin access to our Hasura API, we can build these rules:

When this user on Twitchhas an email that has a domain that is equal to case insensitively "onegraph.com"
and this user on Twitch has verified email is true

Then On hasura set default role "admin"

And if we want to use information from Twitch in our API or client-side app, we can add an additional rule:

When this user on Twitch login status is true

Then On hasura set user id built in value TWITCH_TV_USER_ID
and In the json set value at path user.email built in value TWITCH_TV_EMAIL
and In the json set value at path user.avatarUrl built in value TWITCH_TV_LOGO_URL

And in the end, we'll get a JWT for our API or app with a payload of:

{
  "iss": "OneGraph",
  "aud": "https://serve.onegraph.com/dashboard/app/00000000-0000-0000-0000-000000000000",
  "iat": 1579589206,
  "exp": 1579675606,
  "https://hasura.io/jwt/claims": {
    "x-hasura-default-role": "admin",
    "x-hasura-allowed-roles": [
      "admin"
    ],
    "x-hasura-user-id": "258615874"
  },
  "user": {
    "email": "[email protected]",
    "avatarUrl": "https://static-cdn.jtvnw.net/jtv_user_pictures/8bacc874-0d33-40a2-9a2b-7827d4e94e2b-profile_image-300x300.png"
  }
}

List plans in Stripe

A couple of updates to the Stripe integration based on customer requests.

You can list your Stripe plans and get the subscriptions for those plans in a single query

query ListStripePlans {
  stripe {
    plans {
      nodes {
        id
        amount
        subscriptions(status: active) {
          nodes {
            id
            customer {
              ... on StripeCustomer {
                name
                email
              }
            }
          }
        }
      }
    }
  }
}

You can also filter invoices based on their status. Here's a query that gets all open invoices, along with the customer's email:

query StripeOpenInvoices {
  stripe {
    invoices(status: open) {
      nodes {
        total
        customer {
          ... on StripeCustomer {
            email
          }
        }
      }
    }
  }
}

Hop into our Spectrum channel if you have any questions or a use case that's not supported.

Add initial support for Mailchimp

We're trying something a little different with our Mailchimp integration.

For previous integrations, like Stripe, Facebook Business, Npm, Dribbble, etc., we mapped out the entire API to produce the best possible GraphQL API. We even drew connections between objects, so that you could get a customer, their invoices, and the charges for each invoice all in a single query.

Mapping out an API requires a deep understanding of the underlying data model, which can take time. With Mailchimp, we're going to take a more incremental approach.

We've added two fields for Mailchimp, a query field that lets you make get requests to any Mailchimp endpoint and a mutation field that lets you make post, put, delete, etc. requests.

For example, the following query will get the list of authorized apps for your Mailchimp account:

query MailchimpAuthorizedApps {
  mailchimp {
    makeRestCall {
      get(path: "/3.0/authorized-apps") {
        jsonBody
      }
    }
  }
}

The full result from the Mailchimp API is returned in the jsonBody field:

{
  "data": {
    "mailchimp": {
      "makeRestCall": {
        "get": {
          "jsonBody": {
            "apps": [
              {
                "id": 310479510789,
                "name": "OneGraph",
                "description": "OneGraph is a public GraphQL gateway combining all of your favorite apis.",
              }
            ],
            "total_items": 1,
          }
        }
      }
    }
  }
}

You can replace path with any valid Mailchimp path. There are also parameters for setting the query string.

This allows you to access all parts of the Mailchimp API and use OneGraph to handle logging in to Mailchimp.

As more people start to use the Mailchimp integration, we'll build out the full graph. Stay tuned here for updates!

Hop into our Spectrum channel if you have any questions onegraph.com/chat.

Support for Stripe Connect Auth via the Auths Arg

OneGraph supports different ways of providing auth for different use cases.

The most popular is our OAuth flow, usually via our OneGraph auth library.

We also support providing ad-hoc credentials via the auths arg that is available on every top-level field. The auths arg allows you to provide credentials for a single query and is a great way to make queries through OneGraph when your application already has auth tokens for a service.

Today we added support for Stripe's Connect auth via the Stripe-Account header

Example query

query StripeCustomers(
  $connectedStripeAccountId: String!
  $platformSecretKey: String!
) {
  stripe(
    auths: {
      stripeConnectAuth: {
        connectedStripeAccountId: $connectedStripeAccountId
        platformSecretKey: $platformSecretKey
      }
    }
  ) {
    customers {
      nodes {
        name
        email
      }
    }
  }
}

Hop into our Spectrum channel if you have any questions or a use case that's not supported.

Added play history to Spotify

Our Spotify integration now includes play history for the logged-in user.

query SpotifyPlayHistory {
  spotify {
    me {
      recentlyPlayed {
        nodes {
          playedAt
          track {
            name
          }
        }
      }
    }
  }
}

It requires a new user-read-recently-played scope. If you see an insufficient auth error after running the query, log out and back in to Spotify.

Try it out at OneGraph.

Hop into our Spectrum channel if you have any questions.

Facebook Business API

Facebook doesn't provide a GraphQL API, so we stepped up and built one for them!

Sign up to try an example query.

You'll need a Facebook developer app to run queries. If you don't have one yet, create one at the Facebook developer site (be sure to enable the Facebook Login and Marketing API products).

After you have created an app on the OneGraph dashboard, go to the "Advanced settings" page and fill in the Custom OAuth Credentials form with your Facebook App ID and App Secret.

Once you've set up your custom credentials, you can sign in to Facebook from the Data Explorer tab and explore you and your customer's Facebook data.

Here's an example query to get you started:

query FacebookQuery {
  facebookBusiness {
    me {
      adAccounts {
        nodes {
          accountId
          age
          balance
          amountSpent
          ads {
            nodes {
              name
            }
          }
        }
      }
    }
  }
}

Hop into our Spectrum if you have any questions.

DEV.to support

  1. DEV is one of the most open developer sites out there
  2. They have an API!
  3. .. and we've added it to the OneGraph tooling!

Here's an example to get the recently rising top
articles

right from within GraphiQL!

query RecentlyRisingTopArticles {
  devTo {
    articles(state: "rising") {
      nodes {
        id
        title
        url
        socialImage
        publishedAt
        user {
          name
          username
          githubUsername
        }
      }
    }
  }
}

We're still waiting to get into the private OAuth alpha, so for any fields that
require auth (basically any non-published articles or webhooks) you'll need to
create an API token to use the integration.

I suspect that ~30 minutes after we hear that OneGraph is in the OAuth alpha
(and we make our way back to a nearby keyboard), we'll have full onegraph-auth
support with automatic login for your apps!

In the meantime, we have near full coverage of the API:

We've also gone through the API looking to normalize as much as possible. DEV
has great content, they've been actively open, and we want to make their API as
joyous to use as possible.

If you find anything missing, just ping us on @onegraph!

Special thanks to @zaiste for requesting DEV's API in the first place - check out their articles on DEV!

AuthGuardian Release

We're making authentication and authorization easier by an order of magnitude today!

Better experience for invalid CORS/redirect destinations on sign-in

We've just pushed a bit of polish to help OneGraph developers add new domains (for example, in production)!

Previously if you asked a user to sign into a service on a url that wasn't allowed for your app, you would see something like this:

Our previous experience with that authentic programmer design sensibility

Before

We've cleaned up the design a bit, and linked to the app's dashboard where authorized owners will be able to add the new domain simply by clicking!

After!

See an example video of it on YouTube!

Support for User Events on Intercom

We updated our Intercom integration to support listing the most recent events for a user. We also support event summaries.

The following query will get the summary and list of events for your most recently active users:

query IntercomEvents {
  intercom {
    users(first: 10, sortByField: LAST_REQUEST_AT) {
      nodes {
        eventSummary {
          name
          first
          last
          count
        }
        events(first: 10) {
          nodes {
            eventName
            createdAt
            metadata
          }
        }
      }
    }
  }
}

Read more about Intercom Events on Intercom.

Sign up at OneGraph to try it out and hop into our Spectrum channel if you have any questions onegraph.com/chat.

TwitchTV support for OneGraph auth!

We just implemented the TwitchTV support for our onegraph-auth library, so you can easily have a user sign in with Twitch!

TwitchTV Auth support in OneGraph

To log in a user to your app with Twitch, you can use the following JavaScript:

import OneGraphAuth from 'onegraph-auth';

const auth = new OneGraphAuth({
  appId: APP_ID,
});

await auth.login('twitch-tv');
const isLoggedIn = await auth.isLoggedIn('twitch-tv');

if (isLoggedIn) {
  console.log("Successfully logged into Twitch!")
} else {
  console.log("User didn't log into Twitch")
}

Passthrough support

Another feature we've started adding to integrations is the concept of 'passthrough' fields, where you can make REST calls for any part of an API we haven't covered yet.

For example, to get a list of the top games on Twitch right now, you can simply run this query:

query TopGamesOnTwitchQuery {
  twitchTv {
    makeRestCall {
      get(path: "/kraken/games/top") {
        jsonBody
        response {
          headers
          statusCode
        }
      }
    }
  }
}

You can use that to hit any existing REST API endpoint you need.

And it's not simply a passthrough either! Twitch has changed how they do authentication between their v5 (kraken) and v6 (helix). Based on the endpoint you hit, we'll automatically choose the correct implementation so you don't need to worry about it!

Netlify preview and branch deploy support

Netlify is one of the most popular destinations for apps using OneGraph, so we've made it significantly smoother to work with!

OneGraph enforces strict CORS and authentication redirects as part of handling security appropriately, so request on behalf of a OneGraph app coming from an unknown origin will be blocked in the browser automatically.

Because Netlify deploy previews all and up on different subdomains, that meant each deploy had to be separately added to the allowed-CORS list.

But from today, when pasting in any Netlify url, we'll automatically allow CORS from all relevant deploys.

netlify_site_support

AuthGuardian support for adding Hasura session variables directly

A quick update, we've added an effect in AuthGuardian to add session variables
directly. Simple choose the action On Hasura set session variable, give the
variable a name, and we'll take care of prefixing the name and putting it in the right JWT location.

See the Hasura documentation on how session variables can be used with
permissions, mutations, and so much
more
.
It's an incredibly powerful system for being so small!

For example, if we want to make the user's verified TwitchTV email available for
our Hasura permission, queries, or mutations, we can set the following
AuthGuardian rules:

When this user on Twitch has verified email is true

Then On hasura set session variable email built in value TWITCH_TV_EMAIL

And our resulting JWT will have the X-HASURA-EMAIL variable correctly set:

{
  "iss": "OneGraph",
  "aud": "https://serve.onegraph.com/dashboard/app/00000000-0000-0000-0000-000000000000",
  "iat": 1579589498,
  "exp": 1579675898,
  "https://hasura.io/jwt/claims": {
    "x-hasura-email": "[email protected]"
  }
}

GitHub repository contributors available in OneGraph

For those of you who've reached out wondering how to get a list of all the contributors (and the number of their contributions) for a repository in GitHub, we've stitched in another part of the GitHub v3 REST api endpoint!

You can try it out right here

An example use case

Say you wanted to build a view similar to GitHub's contributors view:
Screenshot 2019-09-19 12 51 50

Show me the query!

You can get quite most (not all!) of the info with the following query:

query RepositoryContributorsQuery(
  $owner: String!
  $name: String!
  $after: String
) {
  gitHub {
    repository(name: $name, owner: $owner) {
      contributors_oneGraph(
        includeAnonymousContributors: false
        after: $after
      ) {
        nodes {
          avatarUrl
          contributionCount
          login
          user {
            bio
          }
        }
        pageInfo {
          hasNextPage
          hasPreviousPage
          startCursor
          endCursor
        }
      }
    }
  }
}

And you can simply use that query with variables like:

{"owner": "clojure", "name": "clojurescript", "after": null}

or for the second page of contributors (using the after argument and endCursor from the first query result) :

{"owner": "clojure", "name": "clojurescript", "after": "MDpnaXRodWI6MQ"}

Caveats

The API doesn't expose data about when a user contributed, or the total line added/removed by a contributor - just their discrete contribution total.

Pagination returns 30 contributors at a time, and you'll need to fetch more using the after argument until hasNextPage comes back as false.

As usual with our forward-looking integrations, we've marked the stitched field by adding a suffix of _oneGraph in case GitHub adds a contributors field in the future, there won't be a conflict and apps you build today will continue to work on OneGraph!

Try it out

Give it a try to see the top contributors to:

Hi Nik!

Anyone can open an issue.

code is supported

Create Hubspot Contacts with OneGraph Mutations

We've added our first set of mutations for Hubspot. You can now create and update contacts on Hubspot with a GraphQL mutation.

GraphQL mutations allow you to modify server-side data and fetch updated data in a single operation.

Here's an example mutation that demonstrates how to create a contact on Hubspot:

mutation CreateContact {
  hubspot {
    createContact(
      input: {
        properties: {
          email: "[email protected]"
          firstname: "Daniel"
          lastname: "Woelfel"
          jobtitle: "Founder"
        }
      }
    ) {
      contact {
        vid
        profileUrl
        properties {
          email {
            value
          }
        }
      }
    }
  }
}

Sign up to OneGraph to try it out!

Hop into our Spectrum if you have any questions.

Custom Fields and Mutations for Salesforce

Huge updates for OneGraph's Salesforce integration.

Custom fields for any object in Salesforce are available in a new JSON-typed customFields field on the object:

 query AccountQuery {
  salesforce {
   account(id: "YOUR_ACCOUNT_ID") {
     id
     industry
     customFields
   }
 }
}

If you only need some of the custom fields, you can use the fields argument on the customFields field:

 query AccountQuery {
  salesforce {
   account(id: "YOUR_ACCOUNT_ID") {
     id
     industry
     customFields(fields: ["NumberofLocations__c"])
   }
 }
}

You can also use custom fields in filters for advanced queries:

query CustomFieldFilter {
  salesforce {
    accounts(filter: {
      customField: {
        intField: {
          fieldName: "NumberofLocations__c"
          filter: {
            greaterThanOrEqualTo: 2
          }
        }
        stringField: {
          fieldName: "UpsellOpportunity__c"
          filter: {
            equalTo: "Maybe"
          }
        }
      }
    }) {
      nodes {
        id
        name
      }
    }
  }
}

We added support for creating, updating, and deleting objects in Salesforce through GraphQL mutations:

mutation CreateAccountMutation {
  salesforce {
    createAccount(input: {
      account: {
        name: "Testing123"
        customFields: [{
          fieldName: "NumberofLocations__c",
          value: 10
        }, {
          fieldName: "UpsellOpportunity__c",
          value: "Maybe"
        }]
      }
    }) {
      account {
        name
        customFields
      }
    }
  }
}

Try it out at OneGraph. Hop into our Spectrum if you have any questions.

Advanced filters for Salesforce

Salesforce queries on OneGraph now support advanced filtering to help you find exactly what you're looking for.

We know you have a limited number of API calls on your Salesforce account, so we've optimized our query engine to send the absolute minimum number of API calls. The query engine now uses SOQL, Salesforce's SQL-like query language, under the hood. The GraphQL interface that OneGraph exposes is still exactly the same, so our existing customers got a healthy speed boost without having to change a single line of code—that's the beauty of GraphQL.

Create an app on OneGraph to try it out.

Here's an example query that finds opportunities where the company has between 10-50 employees to get you started:

query SalesforceOpportunitiesQuery {
  salesforce {
    opportunities(
      first: 10
      filter: {
        account: {
          numberOfEmployees: {
            greaterThan: 10
            lessThan: 50
          }
        }
      }
    ) {
      nodes {
        name
        expectedRevenue
        probability
        stageName
        account {
          name
          numberOfEmployees
        }
      }
    }
  }
}

Hop into our Spectrum if you have any questions.

Sign in to OneGraph with GitHub now!

We've pushed support for signing in/up to OneGraph with Github now!. As much as I underestimated this feature (I use a password manager), I've found myself switching to it immediately once it was available. The difference between theory and practice, I suppose!

sign_in_to_github

If you already have a OneGraph account, just log into the dashboard and associate your account with GitHub by clicking on the upper-right menu and choosing, GitHub.

associate_github_account

Fun fact - we actually wrote this twice. First, with special hard-coded OAuth flows on the server, and then as just a normal OneGraph app using our client-side onegraph-auth library and AuthGuardian to configure the rules. The client-side version is significantly shorter, cleaner, and more straightforward.

We don't always get to dog food the nicer parts of OneGraph, but it sure is a pleasure when we do!

Query Tasks, Calls, Emails, Notes, and Other Engagements for Hubspot Contacts

OneGraph now supports querying tasks, calls, emails, meetings, and notes for a contact and across your entire Hubspot account.

The new objects are available through the engagements field on the contact. They use GraphQL Interfaces which allow you to specify exactly the fields you want for each type of engagement.

An example:

query EngagementsQuery {
  hubspot {
    contacts {
      nodes {
        engagements {
          nodes {
            id
            owner {
              email
            }
            __typename
            ... on HubspotEngagementEmail {
              from {
                email
              }
              to {
                email
              }
            }
            ... on HubspotEngagementNote {
              body
            }
          }
        }
      }
    }
  }
}

The special __typename field lets you determine exactly what type of engagement you're dealing with. If it's an email, the __typename will be "HubspotEngagementEmail". You can use inline fragments (the ... on HubspotEngagementEmail part) to get specific fields for the email.

Sign up to OneGraph to try it out!

Hop into our Spectrum if you have any questions.

Meetup support

We've just added support for Meetup via our passthrough API fields.

You can use OneGraph's auth to log in to Meetup and access any part of the Meetup API.

For example, the following query will get all upcoming events related to GraphQL

query MeetupEvents {
  meetup {
    makeRestCall {
      get(
        path: "/find/upcoming_events"
        query: [
          ["radius", "global"],
          ["text", "graphql"],
          ["order", "time"]
        ]
      ) {
        jsonBody
      }
    }
  }
}

If you're using a static site generator like Gatsby.js, you can use OneGraph's server-side auth tokens to embed data from Meetup into your site. Create new tokens from the "Server-side Auth" tab on the OneGraph dashboard.

You could also use our new persisted queries support to create a widget showing upcoming meetups.

The widget below uses a persisted query to pull all upcoming GraphQL-related meetups (view the source on GitHub).

Upcoming GraphQL Meetups

<iframe style="width:100%;height: 100%;border:none" src="https://onegraph.github.io/onegraph-meetup-plugin/"></iframe>

GraphiQL Explorer polish!

We recently took some time to polish the Explorer a bit more and add some
feature requests that have cropped up!

Just update to 0.5.1 for all the new polish

isDeprecated styling support

First, deprecated fields now have a special class name for styling. In the future, we'll allow a function passed in as a prop from the developer that’ll be given each field, and can determine which class names should be applied. This should allow for all the flexibility necessary for a number of interesting use-cases that we'll share later.

explorer_deprecated_support

Actions revamp

We've also fixed the New <Query | Mutation | Subscription> buttons to the bottom of the explorer where they're always accessible without scrolling, and they also take up significantly less real-estate. One of the biggest challenges with the explorer is how to compactly represent all of the data and actions given such a small area (and potentially huge schema!).

The explorer will now automatically scroll the newly-added operation into view as well.

explorer_actions

Automatic __typename removal

And finally __typename will be automatically removed if it’s not the only field selection (only at the top level) and added back in if there are no other fields. We introduce this quirk in the second release because of the way GraphQL parses operations with no selections - which is to say, it just throws them out. It's a struggle to find the right user-experience given we don't want to fork the community with secondary parsers, etc. but I think this feel significantly nicer now!

remove_typename


To upgrade, just switch to "graphiql-explorer": "0.5.1" in your package.json!

Special thanks to @schmavery for taking the time to sit down (in person!) and work through building these features out with the OneGraph team!

Updates to the Stripe API

We've made a big update to the Stripe API to support all of the latest additions from Stripe.

There is a lot of new stuff, so head over to OneGraph to check it out.

We wanted to highlight that you can now query addresses for Stripe customers, since some of you were asking for it:

query StripeCustomers {
  stripe {
    customers {
      edges {
        node {
          id
          email
          address {
            city
            state
            country
            line1
            line2
          }
        }
      }
    }
  }
}

Hop into our Spectrum channel if you have any questions or a use case that's not supported.

Initial Netlify support

We're pushing out the first release for Netlify - that includes full coverage of their API and authentication.

To get a list of all of sites and the available Netlify functions, you can run:

query MyNetlifySites {
  netlify {
    sites {
      name
      plan
      publishedDeploy {
        id
        name
        url
        availableFunctions {
          id
          name
          digest
          language
          size
        }
      }
    }
  }
}

netlify_api_1

We also include a link from Netlify site -> GitHub Repo, so for example you could easily pull out any issues associated with a Netlify site:

query MyNetlifySiteIssues($siteId: String!) {
  netlify {
    site(id: $siteId) {
      buildSettings {
        sourceRepository {
          ... on GitHubRepository {
            id
            name
            issues(
              first: 10
              orderBy: {
                direction: DESC
                field: CREATED_AT
              }
            ) {
              nodes {
                body
                title
              }
            }
          }
        }
      }
    }
  }
}

netlify_api_2

AuthGuardian support for adding ApolloServer roles directly

We've added an effect specifically for our onegraph-apollo-server-auth library
today, where you can add a role directly in AuthGuardian. It was possible
before, but only with the In the json add to the list at path effect, which
was less explicit.

Now for example if you want to only allow someone to have moderator access to
your Apollo Server GraphQL server if they're a member of your GitHub
organization, you can write the following rules:

When this user on GitHub is member of organization named "OneGraph"

Then On apollo server add roles [moderator]

And our JWT will generated appropriately:

{
  "iss": "OneGraph",
  "aud": "https://serve.onegraph.com/dashboard/app/00000000-0000-0000-0000-000000000000",
  "iat": 1579589770,
  "exp": 1579676170,
  "user": {
    "roles": [
      "moderator"
    ]
  }
}

See the OneGraph Apollo Server Auth
Example
for
more info on how to use AuthGuardian to secure your Apollo Server GraphQL
server!

Fixed a Bug that Caused OAuth Flows to Fail

We fixed a bug that was causing a small number of OAuth sign in flows to fail with an internal error due to expiring sessions too soon.

If you had to go through the sign in flow twice to add auth for a service, that is now fixed!

Payment Intents for Stripe

You can now get a Stripe payment intent by its id, list them at the top-level, or get all intents for a customer.

Payment intents are a new way to build dynamic payment flows. Read more about Payment Intents in Stripe's docs.

Example query:

query ListIntents {
  stripe {
    paymentIntents {
      nodes {
        id
        description
        customer {
          ... on StripeCustomer {
            email
          }
        }
      }
    }
  }
}

Hop into our Spectrum channel if you have any questions or a use case that's not supported.

Subscriptions for Npm packages

OneGraph now supports subscriptions for updates to Npm packages!

With the new OneGraph subscription, you get a webhook with the result of your query every time a package is updated.

Use them to:

  • automate dependency management
  • setup custom build flows
  • keep track of your favorite packages

The example below sets up a subscription for some of our favorite graphql-related packages.

subscription NewPackageSubscription {
  npm(
    webhookUrl: "https://websmee.com/hook/npm-graphql-subscriptions-demo"
  ) {
    packagePublished(
      input: {
        names: [
          "graphql"
          "graphiql"
          "graphiql-explorer"
          "@graphql-codegen/cli"
          "react-relay"
          "apollo-boost"
          "postgraphile"          
        ]
      }
    ) {
      package {
        name
        rev
        description
        distTags {
          latest {
            versionString
          }
        }
      }
    }
  }
}

When you run the above query, OneGraph will return a subscription id in the extensions field that you can use to cancel the subscription.

{
  "data": null,
  "extensions": {
    "subscriptionId": "8430b5b2-bfa1-11e9-a9b1-600308a850e2"
  }
}

Cancel the subscription with the following mutation:

mutation CancelSubscription {
  oneGraph {
    subscriptionUnsubscribe(data: {
      subscriptionId: "8430b5b2-bfa1-11e9-a9b1-600308a850e2"
    }) {
      subscription {
        status
      }
    }
  }
}

Hop into our Spectrum channel if you have any questions onegraph.com/chat.

AuthGuardian support for adding express.js permissions directly

We've been working hard on AuthGuardian to make securing every app, server, and
API as straight-forward as possible. Today we've pushed support for adding
express.js permissions for our onegraph-auth integration as a direct effect
inside AuthGuardian.

For example, if we wanted to only allow users to access the /we-rock route on
our express app if they were logged into Spotify, we could use these rules:

When this user on Spotify login status is true

Then On express js add permissions [to-rock]

and that would give us the resulting JWT:

{
  "iss": "OneGraph",
  "aud": "https://serve.onegraph.com/dashboard/app/00000000-0000-0000-0000-000000000000",
  "iat": 1579590299,
  "exp": 1579676699,
  "permissions": [
    "to-rock"
  ]
}

which we can use just like in our example expressjs + AuthGuardian app:

app.get("/we-rock", guard.check(["audiophile"]), function(req, res) {
  // Now users can only access this route...
  // with express permission to-rock!
});

Check out the source code of the example
app
if you're looking
for how to get started with Express and AuthGuardian!

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.