Skip to content

Commit

Permalink
docs: add jsdoc for $settings (#90)
Browse files Browse the repository at this point in the history
Co-authored-by: Jason Kuhrt <jasonkuhrt@me.com>
  • Loading branch information
iddan and jasonkuhrt authored Jun 23, 2021
1 parent 8acdce1 commit 98a2267
Show file tree
Hide file tree
Showing 7 changed files with 538 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/generator/gentime/settingsSingleton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,22 @@ export namespace Gentime {
},
})

/**
* Adjust Nexus Prisma's [gentime settings](https://pris.ly/nexus-prisma/docs/settings/gentime).
*
* @example
*
* // prisma/nexus-prisma.ts
*
* import { settings } from 'nexus-prisma/generator'
*
* settings({
* projectIdIntToGraphQL: 'ID',
* })
*
* @remarks This is _different_ than Nexus Prisma's [_runtime_
* settings](https://pris.ly/nexus-prisma/docs/settings/runtime).
*/
export function changeSettings(input: Setset.UserInput<SettingsInput>): void {
settings.change(input)
}
Expand Down
29 changes: 29 additions & 0 deletions src/generator/models/declaration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,35 @@ export function renderTypeScriptDeclarationForDocumentModels(
import { Runtime } from '../generator/runtime/settingsSingleton'
/**
* Adjust Nexus Prisma's [runtime settings](https://pris.ly/nexus-prisma/docs/settings/runtime).
*
*
* @example
*
* import { PrismaClient } from '@prisma/client'
* import { ApolloServer } from 'apollo-server'
* import { makeSchema } from 'nexus'
* import { User, Post, $settings } from 'nexus-prisma'
*
* new ApolloServer({
* schema: makeSchema({
* types: [],
* }),
* context() {
* return {
* db: new PrismaClient(), // <-- You put Prisma client on the "db" context property
* }
* },
* })
*
* $settings({
* prismaClientContextField: 'db', // <-- Tell Nexus Prisma
* })
*
* @remarks This is _different_ than Nexus Prisma's [_gentime_
* settings](https://pris.ly/nexus-prisma/docs/settings/gentime).
*/
export const $settings: typeof Runtime.changeSettings
` + OS.EOL
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,35 @@ export const Foo: $Types.Foo
import { Runtime } from '../generator/runtime/settingsSingleton'
/**
* Adjust Nexus Prisma's [runtime settings](https://pris.ly/nexus-prisma/docs/settings/runtime).
*
*
* @example
*
* import { PrismaClient } from '@prisma/client'
* import { ApolloServer } from 'apollo-server'
* import { makeSchema } from 'nexus'
* import { User, Post, $settings } from 'nexus-prisma'
*
* new ApolloServer({
* schema: makeSchema({
* types: [],
* }),
* context() {
* return {
* db: new PrismaClient(), // <-- You put Prisma client on the \\"db\\" context property
* }
* },
* })
*
* $settings({
* prismaClientContextField: 'db', // <-- Tell Nexus Prisma
* })
*
* @remarks This is _different_ than Nexus Prisma's [_gentime_
* settings](https://pris.ly/nexus-prisma/docs/settings/gentime).
*/
export const $settings: typeof Runtime.changeSettings
"
`;
Expand Down Expand Up @@ -218,6 +247,35 @@ export const Foo: $Types.Foo
import { Runtime } from '../generator/runtime/settingsSingleton'
/**
* Adjust Nexus Prisma's [runtime settings](https://pris.ly/nexus-prisma/docs/settings/runtime).
*
*
* @example
*
* import { PrismaClient } from '@prisma/client'
* import { ApolloServer } from 'apollo-server'
* import { makeSchema } from 'nexus'
* import { User, Post, $settings } from 'nexus-prisma'
*
* new ApolloServer({
* schema: makeSchema({
* types: [],
* }),
* context() {
* return {
* db: new PrismaClient(), // <-- You put Prisma client on the \\"db\\" context property
* }
* },
* })
*
* $settings({
* prismaClientContextField: 'db', // <-- Tell Nexus Prisma
* })
*
* @remarks This is _different_ than Nexus Prisma's [_gentime_
* settings](https://pris.ly/nexus-prisma/docs/settings/gentime).
*/
export const $settings: typeof Runtime.changeSettings
"
`;
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,35 @@ export const Foo: $Types.Foo
import { Runtime } from '../generator/runtime/settingsSingleton'
/**
* Adjust Nexus Prisma's [runtime settings](https://pris.ly/nexus-prisma/docs/settings/runtime).
*
*
* @example
*
* import { PrismaClient } from '@prisma/client'
* import { ApolloServer } from 'apollo-server'
* import { makeSchema } from 'nexus'
* import { User, Post, $settings } from 'nexus-prisma'
*
* new ApolloServer({
* schema: makeSchema({
* types: [],
* }),
* context() {
* return {
* db: new PrismaClient(), // <-- You put Prisma client on the \\"db\\" context property
* }
* },
* })
*
* $settings({
* prismaClientContextField: 'db', // <-- Tell Nexus Prisma
* })
*
* @remarks This is _different_ than Nexus Prisma's [_gentime_
* settings](https://pris.ly/nexus-prisma/docs/settings/gentime).
*/
export const $settings: typeof Runtime.changeSettings
"
`;
Expand Down Expand Up @@ -218,6 +247,35 @@ export const Foo: $Types.Foo
import { Runtime } from '../generator/runtime/settingsSingleton'
/**
* Adjust Nexus Prisma's [runtime settings](https://pris.ly/nexus-prisma/docs/settings/runtime).
*
*
* @example
*
* import { PrismaClient } from '@prisma/client'
* import { ApolloServer } from 'apollo-server'
* import { makeSchema } from 'nexus'
* import { User, Post, $settings } from 'nexus-prisma'
*
* new ApolloServer({
* schema: makeSchema({
* types: [],
* }),
* context() {
* return {
* db: new PrismaClient(), // <-- You put Prisma client on the \\"db\\" context property
* }
* },
* })
*
* $settings({
* prismaClientContextField: 'db', // <-- Tell Nexus Prisma
* })
*
* @remarks This is _different_ than Nexus Prisma's [_gentime_
* settings](https://pris.ly/nexus-prisma/docs/settings/gentime).
*/
export const $settings: typeof Runtime.changeSettings
"
`;
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,35 @@ export const SomeModel: $Types.SomeModel
import { Runtime } from '../generator/runtime/settingsSingleton'
/**
* Adjust Nexus Prisma's [runtime settings](https://pris.ly/nexus-prisma/docs/settings/runtime).
*
*
* @example
*
* import { PrismaClient } from '@prisma/client'
* import { ApolloServer } from 'apollo-server'
* import { makeSchema } from 'nexus'
* import { User, Post, $settings } from 'nexus-prisma'
*
* new ApolloServer({
* schema: makeSchema({
* types: [],
* }),
* context() {
* return {
* db: new PrismaClient(), // <-- You put Prisma client on the \\"db\\" context property
* }
* },
* })
*
* $settings({
* prismaClientContextField: 'db', // <-- Tell Nexus Prisma
* })
*
* @remarks This is _different_ than Nexus Prisma's [_gentime_
* settings](https://pris.ly/nexus-prisma/docs/settings/gentime).
*/
export const $settings: typeof Runtime.changeSettings
"
`;
Expand Down Expand Up @@ -356,6 +385,35 @@ export const SomeModel: $Types.SomeModel
import { Runtime } from '../generator/runtime/settingsSingleton'
/**
* Adjust Nexus Prisma's [runtime settings](https://pris.ly/nexus-prisma/docs/settings/runtime).
*
*
* @example
*
* import { PrismaClient } from '@prisma/client'
* import { ApolloServer } from 'apollo-server'
* import { makeSchema } from 'nexus'
* import { User, Post, $settings } from 'nexus-prisma'
*
* new ApolloServer({
* schema: makeSchema({
* types: [],
* }),
* context() {
* return {
* db: new PrismaClient(), // <-- You put Prisma client on the \\"db\\" context property
* }
* },
* })
*
* $settings({
* prismaClientContextField: 'db', // <-- Tell Nexus Prisma
* })
*
* @remarks This is _different_ than Nexus Prisma's [_gentime_
* settings](https://pris.ly/nexus-prisma/docs/settings/gentime).
*/
export const $settings: typeof Runtime.changeSettings
"
`;
Expand Down Expand Up @@ -516,6 +574,35 @@ export const SomeModel: $Types.SomeModel
import { Runtime } from '../generator/runtime/settingsSingleton'
/**
* Adjust Nexus Prisma's [runtime settings](https://pris.ly/nexus-prisma/docs/settings/runtime).
*
*
* @example
*
* import { PrismaClient } from '@prisma/client'
* import { ApolloServer } from 'apollo-server'
* import { makeSchema } from 'nexus'
* import { User, Post, $settings } from 'nexus-prisma'
*
* new ApolloServer({
* schema: makeSchema({
* types: [],
* }),
* context() {
* return {
* db: new PrismaClient(), // <-- You put Prisma client on the \\"db\\" context property
* }
* },
* })
*
* $settings({
* prismaClientContextField: 'db', // <-- Tell Nexus Prisma
* })
*
* @remarks This is _different_ than Nexus Prisma's [_gentime_
* settings](https://pris.ly/nexus-prisma/docs/settings/gentime).
*/
export const $settings: typeof Runtime.changeSettings
"
`;
Expand Down Expand Up @@ -702,6 +789,35 @@ export const SomeModel: $Types.SomeModel
import { Runtime } from '../generator/runtime/settingsSingleton'
/**
* Adjust Nexus Prisma's [runtime settings](https://pris.ly/nexus-prisma/docs/settings/runtime).
*
*
* @example
*
* import { PrismaClient } from '@prisma/client'
* import { ApolloServer } from 'apollo-server'
* import { makeSchema } from 'nexus'
* import { User, Post, $settings } from 'nexus-prisma'
*
* new ApolloServer({
* schema: makeSchema({
* types: [],
* }),
* context() {
* return {
* db: new PrismaClient(), // <-- You put Prisma client on the \\"db\\" context property
* }
* },
* })
*
* $settings({
* prismaClientContextField: 'db', // <-- Tell Nexus Prisma
* })
*
* @remarks This is _different_ than Nexus Prisma's [_gentime_
* settings](https://pris.ly/nexus-prisma/docs/settings/gentime).
*/
export const $settings: typeof Runtime.changeSettings
"
`;
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,35 @@ export const Post: $Types.Post
import { Runtime } from '../generator/runtime/settingsSingleton'
/**
* Adjust Nexus Prisma's [runtime settings](https://pris.ly/nexus-prisma/docs/settings/runtime).
*
*
* @example
*
* import { PrismaClient } from '@prisma/client'
* import { ApolloServer } from 'apollo-server'
* import { makeSchema } from 'nexus'
* import { User, Post, $settings } from 'nexus-prisma'
*
* new ApolloServer({
* schema: makeSchema({
* types: [],
* }),
* context() {
* return {
* db: new PrismaClient(), // <-- You put Prisma client on the \\"db\\" context property
* }
* },
* })
*
* $settings({
* prismaClientContextField: 'db', // <-- Tell Nexus Prisma
* })
*
* @remarks This is _different_ than Nexus Prisma's [_gentime_
* settings](https://pris.ly/nexus-prisma/docs/settings/gentime).
*/
export const $settings: typeof Runtime.changeSettings
"
`;
Loading

0 comments on commit 98a2267

Please sign in to comment.