After going full circle on @oneField
directive -> tagged type -> back again, the
GraphQL Input Unions Working Group have determined that our current best
proposal is to add a variant of the existing input object type that accepts
only one field, and a variant of object fields that accept only one argument.
Though the changes to introspection for this are likely to be relatively small
(e.g. adding something like __Type.isOneOf: Boolean and `__Field.isOneOf:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- This is a compiled version of the PostGraphile introspection query. | |
| -- The query that would actually run may differ from this based on | |
| -- what version of PostgreSQL you're running and what your PostGraphile | |
| -- options are. | |
| -- @see https://www.postgresql.org/docs/9.5/static/catalogs.html | |
| -- @see https://github.com/graphile/graphile-engine/blob/master/packages/graphile-build-pg/src/plugins/introspectionQuery.js | |
| -- | |
| with | |
| accessible_roles(_oid) as ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import type { Plugin } from "graphile-build"; | |
| const makeDeprecateTypePlugin = (typeName: string, deprecationReason: string): Plugin => builder => { | |
| builder.hook('GraphQLObjectType:fields:field', (field, { graphql }) => { | |
| if (graphql.getNamedType(field.type).name !== typeName) { | |
| return field; | |
| } | |
| return { | |
| ...field, | |
| deprecationReason, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { promises: fsp } = require("fs"); | |
| async function main(name) { | |
| const content = await fsp.readFile(`./${name}.test.ts.snap`, "utf8"); | |
| const lines = content.split("\n"); | |
| const results = {}; | |
| let header = ""; | |
| for (let lineNumber = 0; lineNumber < lines.length; lineNumber++) { | |
| const line = lines[lineNumber]; | |
| if (line.startsWith("//")) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "pgSettings": { | |
| "search_path": "app_public,app_private,app_hidden,public" | |
| }, | |
| "placeholders": { | |
| ":DATABASE_AUTHENTICATOR": "!ENV", | |
| ":DATABASE_VISITOR": "!ENV" | |
| }, | |
| "afterReset": [ | |
| "afterReset.sql", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * If you're sent a dynamic value but you want to treat it as static (e.g. for | |
| * hook dependencies), you can use this function. For arrays it will compare the | |
| * contents of the array rather than the array object itself. For objects it | |
| * will compare the keys and values of the object, rather than the object | |
| * itself. For functions it will just replace the function with a static | |
| * function that calls the underlying function using references. | |
| */ | |
| export function useDynamicToStatic<T>(value: T) { | |
| let condition = []; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.exports = function PgUpsertPlugin( | |
| builder, | |
| { pgDisableDefaultMutations } | |
| ) { | |
| if (pgDisableDefaultMutations) { | |
| return; | |
| } | |
| builder.hook("inflection", (inflection, build) => | |
| build.extend(inflection, { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| echo "Enter OTP code:" | |
| read otp | |
| export NPM_CONFIG_OTP=$otp | |
| function next2latest { | |
| V=$(npm info $1 dist-tags.next | xargs) | |
| npm dist-tags add $1@$V latest | |
| } | |
| next2latest graphql-parse-resolve-info | |
| next2latest graphile-build |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Read a file manually, but pretend it's actually a Node.js module. Tested in Node 8.11.3 only. | |
| */ | |
| "use strict"; | |
| const fs = require("fs"); | |
| const path = require("path"); | |
| const { Module } = require("module"); | |
| // Get the javascript contents from wherever: filesystem, database, network, etc. | |
| // Node calls this filename, but it's actually the full path to the file |