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 does not show surrounding code like referenced types. | |
*/ | |
resultMutationField('inviteUserToProject', { | |
input(t) { | |
t.nonNull.id('userHandle') | |
t.nonNull.id('projectId') | |
t.nonNull.field('role', { | |
type: 'ProjectRole', |
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
/** | |
* Adapted from https://github.com/nextauthjs/adapters/tree/canary/packages/prisma | |
*/ | |
import * as Prisma from '@prisma/client' | |
import { User } from '@prisma/client' | |
import { AppOptions } from 'next-auth' | |
// @ts-expect-error TODO expose errors in next-auth | |
import { CreateUserError } from 'next-auth/dist/lib/errors' | |
// @ts-expect-error TODO expose logger in next-auth |
This sketch is outdated. Please refer to https://github.com/prisma/nexus-prisma for current spec & status.
Here is a GraphQL object manually projecting fields from the model layer. Assume the parent returned data of a project model.
objectType({
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 * as React from "react" | |
/** | |
* There are four cases of children state that Transition has to deal with. | |
*/ | |
type ChildCase = | |
| { | |
type: "no_child" | |
} | |
| { |
This is a TL;DR from a day in the life of node dependency shenanigans. Throughout this article I will use git status
and git diff
to make state explicit. You should be able to reproduce exactly what you see here. Lines prefixed with >
are what I entered into the terminal. Anything else is output I chose to show herein but often I will not copy the terminal output to this article because it would not be interesting.
Lets start with an empty node project.
First our node and npm versions:
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
function bufferUntil(stream, promise) { | |
return { | |
run: (sink, scheduler) => { | |
let didResolve = false | |
const buffer = [] | |
stream.source.run( | |
{ | |
event: (t, x) => { | |
if (didResolve) { |
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
function bufferedApply(streamOfFunctions, streamOfValues) { | |
const source = { | |
run: (sink, scheduler) => { | |
let f = null | |
const buffer = [] | |
streamOfFunctions.source.run( | |
{ | |
event: (t, newF) => { | |
f = newF |
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
// Falling water | |
// Calculate the area of sum of areas of water that would be captured in | |
// valleys of water along a series of constant-width variable-height columns. | |
// The geometry is grid based meaning there are no curves in this world. | |
const log = console.log | |
const sumPools = (cs) => { |
NewerOlder