Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@

.env

/data/index.d.ts
/data/*/index.d.ts
103 changes: 103 additions & 0 deletions data/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
Run this in https://developer.github.com/v4/explorer/ to get the updated `schema.json` file.

```graphql
query IntrospectionQuery {
__schema {
queryType {
name
}
mutationType {
name
}
subscriptionType {
name
}
types {
...FullType
}
directives {
name
description
locations
args {
...InputValue
}
}
}
}

fragment FullType on __Type {
kind
name
description
fields(includeDeprecated: true) {
name
description
args {
...InputValue
}
type {
...TypeRef
}
isDeprecated
deprecationReason
}
inputFields {
...InputValue
}
interfaces {
...TypeRef
}
enumValues(includeDeprecated: true) {
name
description
isDeprecated
deprecationReason
}
possibleTypes {
...TypeRef
}
}

fragment InputValue on __InputValue {
name
description
type {
...TypeRef
}
defaultValue
}

fragment TypeRef on __Type {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
}
}
}
}
}
}
}
}
```
20 changes: 20 additions & 0 deletions data/build-from-query.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const {writeFileSync} = require('fs')
const {join: pathJoin} = require('path')
const {default: fromQuery} = require('@gql2ts/from-query')
const schema = require('./schema')

const queries = [
'getAllProjectCards',
'getCardAndColumnAutomationCards'
]

queries.forEach((queryName) => {

const query = require(`./${queryName}/graphql`)
const typescriptDefinitions = fromQuery(schema, query)

const allDefinitions = typescriptDefinitions.map(({ result }) => result).join('\n')

writeFileSync(pathJoin(__dirname, queryName, 'index.d.ts'), allDefinitions)

})
30 changes: 30 additions & 0 deletions data/getAllProjectCards/graphql.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const PROJECT_FRAGMENT = require('../project-fragment-graphql')

module.exports = `
query getAllProjectCards($issueUrl: URI!) {
resource(url: $issueUrl) {
... on Issue {
id
repository {
owner {
url
${''/* Projects can be attached to an Organization... */}
... on Organization {
projects(first: 10, states: [OPEN]) {
nodes {
${PROJECT_FRAGMENT}
}
}
}
}
${''/* ... or on a Repository */}
projects(first: 10, states: [OPEN]) {
nodes {
${PROJECT_FRAGMENT}
}
}
}
}
}
}
`
23 changes: 23 additions & 0 deletions data/getCardAndColumnAutomationCards/graphql.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const PROJECT_FRAGMENT = require('../project-fragment-graphql')

module.exports = `
query getCardAndColumnAutomationCards($url: URI!) {
resource(url: $url) {
... on Issue {
projectCards(first: 10) {
nodes {
id
url
column {
name
id
}
project {
${PROJECT_FRAGMENT}
}
}
}
}
}
}
`
30 changes: 30 additions & 0 deletions data/project-fragment-graphql.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Common GraphQL Fragment for getting the Automation Cards out of the bottom of every Column in a Project
// This is a fragment used by other, actual queries

module.exports = `
name
id
columns(first: 10) {
totalCount
nodes {
id
url
firstCards: cards(first: 1) {
totalCount
nodes {
url
id
note
}
}
lastCards: cards(last: 1) {
totalCount
nodes {
url
id
note
}
}
}
}
`
Loading