diff --git a/.changeset/cold-glasses-complain.md b/.changeset/cold-glasses-complain.md new file mode 100644 index 0000000000..2cac8706c6 --- /dev/null +++ b/.changeset/cold-glasses-complain.md @@ -0,0 +1,6 @@ +--- +"graphile-build": patch +--- + +Improve error message when `build.getTypeByName` and related methods are called +before the 'init' phase is complete. diff --git a/.changeset/cyan-kings-bake.md b/.changeset/cyan-kings-bake.md new file mode 100644 index 0000000000..1e780af96e --- /dev/null +++ b/.changeset/cyan-kings-bake.md @@ -0,0 +1,10 @@ +--- +"graphile-build-pg": patch +"postgraphile": patch +"@dataplan/pg": patch +--- + +Added `pgRegistry.pgExecutors` so executors don't need to be looked up from a +resource (this causes confusion) - instead they can be referenced directly. By +default there's one executor called `main`, i.e. +`build.input.pgRegistry.pgExecutors.main`. diff --git a/grafast/dataplan-pg/src/datasource.ts b/grafast/dataplan-pg/src/datasource.ts index 2d1e74b7ec..ecdae22c40 100644 --- a/grafast/dataplan-pg/src/datasource.ts +++ b/grafast/dataplan-pg/src/datasource.ts @@ -252,7 +252,12 @@ export class PgResource< TParameters extends readonly PgResourceParameter[] | undefined = | readonly PgResourceParameter[] | undefined, - TRegistry extends PgRegistry = PgRegistry, + TRegistry extends PgRegistry = PgRegistry< + any, + any, + any, + any + >, > { public readonly registry: TRegistry; public readonly codec: TCodec; @@ -858,11 +863,25 @@ export interface PgRegistryBuilder< >; }; }, + TExecutors extends { + [name in string]: PgExecutor; + }, > { getRegistryConfig(): PgRegistryConfig< Expand, Expand, - Expand + Expand, + Expand + >; + addExecutor( + codec: TExecutor, + ): PgRegistryBuilder< + TCodecs, + TResources, + TRelations, + TExecutors & { + [name in TExecutor["name"]]: TExecutor; + } >; addCodec( codec: TCodec, @@ -871,7 +890,8 @@ export interface PgRegistryBuilder< [name in TCodec["name"]]: TCodec; }, TResources, - TRelations + TRelations, + TExecutors >; addResource>( @@ -883,7 +903,8 @@ export interface PgRegistryBuilder< TResources & { [name in TResource["name"]]: TResource; }, - TRelations + TRelations, + TExecutors >; addRelation< @@ -909,10 +930,16 @@ export interface PgRegistryBuilder< remoteResourceOptions: TRemoteResource; }; }; - } + }, + TExecutors >; - build(): PgRegistry, Expand, Expand>; + build(): PgRegistry< + Expand, + Expand, + Expand, + Expand + >; } export function makeRegistry< @@ -943,35 +970,88 @@ export function makeRegistry< >; }; }, + TExecutors extends { + [name in string]: PgExecutor; + }, >( - config: PgRegistryConfig, -): PgRegistry { - const registry: PgRegistry = { + config: PgRegistryConfig, +): PgRegistry { + const registry: PgRegistry< + TCodecs, + TResourceOptions, + TRelations, + TExecutors + > = { + pgExecutors: Object.create(null) as any, pgCodecs: Object.create(null) as any, pgResources: Object.create(null) as any, pgRelations: Object.create(null) as any, }; // Tell the system to read the built pgCodecs, pgResources, pgRelations from the registry + Object.defineProperties(registry.pgExecutors, { + $exporter$args: { value: [registry] }, + $exporter$factory: { + value: (registry: PgRegistry) => registry.pgExecutors, + }, + }); Object.defineProperties(registry.pgCodecs, { $exporter$args: { value: [registry] }, $exporter$factory: { - value: (registry: PgRegistry) => registry.pgCodecs, + value: (registry: PgRegistry) => registry.pgCodecs, }, }); Object.defineProperties(registry.pgResources, { $exporter$args: { value: [registry] }, $exporter$factory: { - value: (registry: PgRegistry) => registry.pgResources, + value: (registry: PgRegistry) => registry.pgResources, }, }); Object.defineProperties(registry.pgRelations, { $exporter$args: { value: [registry] }, $exporter$factory: { - value: (registry: PgRegistry) => registry.pgRelations, + value: (registry: PgRegistry) => registry.pgRelations, }, }); + let addExecutorForbidden = false; + function addExecutor(executor: PgExecutor): PgExecutor { + if (addExecutorForbidden) { + throw new Error(`It's too late to call addExecutor now`); + } + const executorName = executor.name; + if (registry.pgExecutors[executorName]) { + if (registry.pgExecutors[executorName] !== executor) { + console.dir({ + existing: registry.pgExecutors[executorName], + new: executor, + }); + throw new Error( + `Executor named '${executorName}' is already registered; you cannot have two executors with the same name`, + ); + } + return executor; + } else { + // Custom spec, pin it back to the registry + registry.pgExecutors[executorName as keyof TExecutors] = executor as any; + + if (!(executor as any).$$export && !(executor as any).$exporter$factory) { + // Tell the system to read the built executor from the registry + Object.defineProperties(executor, { + $exporter$args: { value: [registry, executorName] }, + $exporter$factory: { + value: ( + registry: PgRegistry, + executorName: string, + ) => registry.pgExecutors[executorName], + }, + }); + } + + return executor; + } + } + let addCodecForbidden = false; function addCodec(codec: PgCodec): PgCodec { if (addCodecForbidden) { @@ -985,7 +1065,7 @@ export function makeRegistry< new: codec, }); throw new Error( - `Codec named '${codecName}' is already registsred; you cannot have two codecs with the same name`, + `Codec named '${codecName}' is already registered; you cannot have two codecs with the same name`, ); } return codec; @@ -1016,8 +1096,10 @@ export function makeRegistry< Object.defineProperties(codec, { $exporter$args: { value: [registry, codecName] }, $exporter$factory: { - value: (registry: PgRegistry, codecName: string) => - registry.pgCodecs[codecName], + value: ( + registry: PgRegistry, + codecName: string, + ) => registry.pgCodecs[codecName], }, }); @@ -1025,11 +1107,22 @@ export function makeRegistry< } } - for (const [codecName, codecSpec] of Object.entries(config.pgCodecs)) { - if (codecName !== codecSpec.name) { + for (const [executorName, executor] of Object.entries(config.pgExecutors)) { + if (executorName !== executor.name) { + throw new Error( + `Executor added to registry with wrong name; ${JSON.stringify( + executorName, + )} !== ${JSON.stringify(executor.name)}`, + ); + } + addExecutor(executor); + } + + for (const [codecName, codec] of Object.entries(config.pgCodecs)) { + if (codecName !== codec.name) { throw new Error(`Codec added to registry with wrong name`); } - addCodec(codecSpec); + addCodec(codec); } for (const [resourceName, rawConfig] of Object.entries( @@ -1037,6 +1130,7 @@ export function makeRegistry< ) as [keyof TResourceOptions, PgResourceOptions][]) { const resourceConfig = { ...rawConfig, + executor: addExecutor(rawConfig.executor), codec: addCodec(rawConfig.codec), parameters: rawConfig.parameters ? (rawConfig.parameters as readonly PgResourceParameter[]).map((p) => ({ @@ -1053,8 +1147,10 @@ export function makeRegistry< Object.defineProperties(resource, { $exporter$args: { value: [registry, resourceName] }, $exporter$factory: { - value: (registry: PgRegistry, resourceName: string) => - registry.pgResources[resourceName], + value: ( + registry: PgRegistry, + resourceName: string, + ) => registry.pgResources[resourceName], }, }); @@ -1083,6 +1179,7 @@ export function makeRegistry< // DO NOT CALL addCodec BELOW HERE addCodecForbidden = true; + addExecutorForbidden = true; /** * If the user uses a codec with attributes as a column type (or an array of @@ -1163,8 +1260,10 @@ export function makeRegistry< Object.defineProperties(resource, { $exporter$args: { value: [registry, resourceName] }, $exporter$factory: { - value: (registry: PgRegistry, resourceName: string) => - registry.pgResources[resourceName], + value: ( + registry: PgRegistry, + resourceName: string, + ) => registry.pgResources[resourceName], }, }); @@ -1186,7 +1285,7 @@ export function makeRegistry< Object.defineProperties(builtRelations, { $exporter$args: { value: [registry, codecName] }, $exporter$factory: { - value: (registry: PgRegistry, codecName: string) => + value: (registry: PgRegistry, codecName: string) => registry.pgRelations[codecName], }, }); @@ -1213,7 +1312,7 @@ export function makeRegistry< $exporter$args: { value: [registry, codecName, relationName] }, $exporter$factory: { value: ( - registry: PgRegistry, + registry: PgRegistry, codecName: string, relationName: string, ) => registry.pgRelations[codecName][relationName], @@ -1232,7 +1331,7 @@ export function makeRegistry< } exportAs("@dataplan/pg", makeRegistry, "makeRegistry"); -function validateRelations(registry: PgRegistry): void { +function validateRelations(registry: PgRegistry): void { // PERF: skip this if not isDev? const reg = registry as PgRegistry; @@ -1279,18 +1378,35 @@ function validateRelations(registry: PgRegistry): void { } // eslint-disable-next-line @typescript-eslint/ban-types -export function makeRegistryBuilder(): PgRegistryBuilder<{}, {}, {}> { +export function makeRegistryBuilder(): PgRegistryBuilder<{}, {}, {}, {}> { const registryConfig: PgRegistryConfig = { + pgExecutors: Object.create(null), pgCodecs: Object.create(null), pgResources: Object.create(null), pgRelations: Object.create(null), }; - const builder: PgRegistryBuilder = { + const builder: PgRegistryBuilder = { getRegistryConfig() { return registryConfig; }, + addExecutor(executor) { + const existing = registryConfig.pgExecutors[executor.name]; + if (existing) { + if (existing !== executor) { + throw new Error( + `Attempted to add a second executor named '${ + executor.name + }' (existing: ${inspect(existing)}, new: ${inspect(executor)})`, + ); + } + return builder; + } + registryConfig.pgExecutors[executor.name] = executor; + return builder; + }, + addCodec(codec) { const existing = registryConfig.pgCodecs[codec.name]; if (existing) { @@ -1322,6 +1438,7 @@ export function makeRegistryBuilder(): PgRegistryBuilder<{}, {}, {}> { }, addResource(resource) { + this.addExecutor(resource.executor); const existing = registryConfig.pgResources[resource.name] as | PgResourceOptions | undefined; diff --git a/grafast/dataplan-pg/src/examples/exampleSchema.ts b/grafast/dataplan-pg/src/examples/exampleSchema.ts index 5ae4232ebb..b51ee92d2d 100644 --- a/grafast/dataplan-pg/src/examples/exampleSchema.ts +++ b/grafast/dataplan-pg/src/examples/exampleSchema.ts @@ -159,7 +159,7 @@ export function makeExampleSchema( const executor = EXPORTABLE( (PgExecutor, context, object) => new PgExecutor({ - name: "default", + name: "main", context: () => { const $context = context(); return object< @@ -1127,6 +1127,7 @@ export function makeExampleSchema( }); return makeRegistryBuilder() + .addExecutor(executor) .addCodec(forumCodec) .addCodec(userCodec) .addCodec(messagesCodec) @@ -5156,19 +5157,13 @@ export function makeExampleSchema( }, type: MultipleActionsPayload, plan: EXPORTABLE( - ( - object, - relationalPostsResource, - sleep, - sql, - withPgClientTransaction, - ) => + (executor, object, sleep, sql, withPgClientTransaction) => function plan(_$root, { $input: { $a } }) { const $transactionResult = withPgClientTransaction< { a: number | null | undefined }, number[] >( - relationalPostsResource.executor, + executor, object({ a: $a as ExecutableStep, }), @@ -5213,13 +5208,7 @@ export function makeExampleSchema( return $transactionResult; }, - [ - object, - relationalPostsResource, - sleep, - sql, - withPgClientTransaction, - ], + [executor, object, sleep, sql, withPgClientTransaction], ), }, }, diff --git a/grafast/dataplan-pg/src/executor.ts b/grafast/dataplan-pg/src/executor.ts index 0fce42db0f..e58e41b012 100644 --- a/grafast/dataplan-pg/src/executor.ts +++ b/grafast/dataplan-pg/src/executor.ts @@ -135,13 +135,13 @@ export type PgExecutorSubscribeOptions = { * can exist in the same schema. PgExecutor is also responsible for things like * caching. */ -export class PgExecutor { - public name: string; +export class PgExecutor { + public name: TName; private contextCallback: () => ObjectStep>; private $$cache: symbol; constructor(options: { - name: string; + name: TName; context: () => ObjectStep>; }) { const { name, context } = options; diff --git a/grafast/dataplan-pg/src/interfaces.ts b/grafast/dataplan-pg/src/interfaces.ts index 2b36a29219..c5b0b77197 100644 --- a/grafast/dataplan-pg/src/interfaces.ts +++ b/grafast/dataplan-pg/src/interfaces.ts @@ -556,7 +556,13 @@ export interface PgRegistryConfig< >; }; }, + TExecutors extends { + [executorName in string]: PgExecutor; + } = { + [executorName: string]: PgExecutor; + }, > { + pgExecutors: TExecutors; pgCodecs: TCodecs; pgResources: TResourceOptions; pgRelations: TRelations; @@ -632,7 +638,13 @@ export interface PgRegistry< > > >, + TExecutors extends { + [executorName in string]: PgExecutor; + } = { + [executorName: string]: PgExecutor; + }, > { + pgExecutors: TExecutors; pgCodecs: TCodecs; pgResources: { [name in keyof TResourceOptions]: TResourceOptions[name] extends PgResourceOptions< @@ -676,14 +688,16 @@ export interface PgRegistry< }; } -export type GetPgRegistryCodecs> = - TRegistry["pgCodecs"]; +export type GetPgRegistryCodecs< + TRegistry extends PgRegistry, +> = TRegistry["pgCodecs"]; -export type GetPgRegistrySources> = - TRegistry["pgResources"]; +export type GetPgRegistrySources< + TRegistry extends PgRegistry, +> = TRegistry["pgResources"]; export type GetPgRegistryCodecRelations< - TRegistry extends PgRegistry, + TRegistry extends PgRegistry, TCodec extends PgCodec, > = TRegistry["pgRelations"][TCodec["name"]]; diff --git a/grafast/website/grafast/step-library/dataplan-pg/withPgClient.md b/grafast/website/grafast/step-library/dataplan-pg/withPgClient.md index 1d298e1fff..b827073bfa 100644 --- a/grafast/website/grafast/step-library/dataplan-pg/withPgClient.md +++ b/grafast/website/grafast/step-library/dataplan-pg/withPgClient.md @@ -15,8 +15,8 @@ Like `lambda`, `withPgClient` is an escape hatch and does not use batching. You need to pass three arguments to `withPgClient`: - `executor` - this is needed to connect to the database; you can grab the - executor from any of the [resources](./registry/resources) that you have in - the same database + executor from the registry directly or any of the + [resources](./registry/resources) that you have in the same database - `$data` - an arbitrary step representing the data that your `callback` needs; set this to `constant(null)` if you don't need anything - `callback(client, data)` - the (async) function to be called with the @@ -27,29 +27,34 @@ for it to return, and then release the client again, ultimately resolving to the return result of your callback. ```ts -// import withPgClient step import { withPgClient } from "@dataplan/pg"; - -// Grab executor from any resource -const { executor } = usersResource; - -// Arbitrary data for our callback to use -const $twenty = constant(20); - -// 20 + 22 = 42 -const $meaningOfLife = withPgClient( - executor, - $twenty, - async (client, twenty) => { - // The client that you receive will be dependent on the adaptor you're - // using, but must have a `query` method: - const { - rows: [{ num }], - } = await client.query({ text: `select 22 as num` }); - - return twenty + parseInt(num, 10); - }, -); +import { constant } from "grafast"; +import { registry } from "./myRegistry"; + +// Grab executor from the registry +const executor = pgRegistry.pgExecutors.main; + +function meaningOfLifePlan() { + // Arbitrary data for our callback to use + const $twenty = constant(20); + + // 20 + 22 = 42 + const $meaningOfLife = withPgClient( + executor, + $twenty, + async (client, twenty) => { + // The client that you receive will be dependent on the adaptor you're + // using, but must have a `query` method: + const { + rows: [{ num }], + } = await client.query({ text: `select 22 as num` }); + + return twenty + parseInt(num, 10); + }, + ); + + return $meaningOfLife; +} ``` ## withPgClientTransaction(executor, $data, callback) diff --git a/graphile-build/graphile-build-pg/src/plugins/PgIntrospectionPlugin.ts b/graphile-build/graphile-build-pg/src/plugins/PgIntrospectionPlugin.ts index 6c202deb74..1796a1363a 100644 --- a/graphile-build/graphile-build-pg/src/plugins/PgIntrospectionPlugin.ts +++ b/graphile-build/graphile-build-pg/src/plugins/PgIntrospectionPlugin.ts @@ -385,6 +385,7 @@ export const PgIntrospectionPlugin: GraphileConfig.Plugin = { ], serviceName === "main" ? `executor` : `${serviceName}Executor`, ); + info.state.executors[serviceName] = executor; return executor; }, @@ -623,6 +624,14 @@ export const PgIntrospectionPlugin: GraphileConfig.Plugin = { async pgRegistry_PgRegistryBuilder_init(info, _event) { await info.helpers.pgIntrospection.getIntrospection(); }, + pgRegistry_PgRegistryBuilder_pgExecutors(info, event) { + for (const pgService of info.resolvedPreset.pgServices ?? []) { + const executor = info.helpers.pgIntrospection.getExecutorForService( + pgService.name, + ); + event.registryBuilder.addExecutor(executor); + } + }, }, async watch(info, callback) { diff --git a/graphile-build/graphile-build-pg/src/plugins/PgRegistryPlugin.ts b/graphile-build/graphile-build-pg/src/plugins/PgRegistryPlugin.ts index 72ec4fe60c..0659ab7f20 100644 --- a/graphile-build/graphile-build-pg/src/plugins/PgRegistryPlugin.ts +++ b/graphile-build/graphile-build-pg/src/plugins/PgRegistryPlugin.ts @@ -14,29 +14,34 @@ declare global { interface GatherHelpers { pgRegistry: { - getRegistryBuilder(): PromiseOrDirect>; - getRegistry(): PromiseOrDirect>; + getRegistryBuilder(): PromiseOrDirect< + PgRegistryBuilder + >; + getRegistry(): PromiseOrDirect>; }; } interface GatherHooks { pgRegistry_PgRegistryBuilder_init(event: { - registryBuilder: PgRegistryBuilder; + registryBuilder: PgRegistryBuilder; + }): PromiseOrDirect; + pgRegistry_PgRegistryBuilder_pgExecutors(event: { + registryBuilder: PgRegistryBuilder; }): PromiseOrDirect; pgRegistry_PgRegistryBuilder_pgCodecs(event: { - registryBuilder: PgRegistryBuilder; + registryBuilder: PgRegistryBuilder; }): PromiseOrDirect; pgRegistry_PgRegistryBuilder_pgResources(event: { - registryBuilder: PgRegistryBuilder; + registryBuilder: PgRegistryBuilder; }): PromiseOrDirect; pgRegistry_PgRegistryBuilder_pgRelations(event: { - registryBuilder: PgRegistryBuilder; + registryBuilder: PgRegistryBuilder; }): PromiseOrDirect; pgRegistry_PgRegistryBuilder_finalize(event: { - registryBuilder: PgRegistryBuilder; + registryBuilder: PgRegistryBuilder; }): PromiseOrDirect; pgRegistry_PgRegistry(event: { - registry: PgRegistry; + registry: PgRegistry; }): PromiseOrDirect; } } @@ -45,8 +50,8 @@ declare global { interface Cache {} interface State { - registryBuilder: PgRegistryBuilder; - registry: PromiseOrDirect> | null; + registryBuilder: PgRegistryBuilder; + registry: PromiseOrDirect> | null; } export const PgRegistryPlugin: GraphileConfig.Plugin = { @@ -75,6 +80,9 @@ export const PgRegistryPlugin: GraphileConfig.Plugin = { await info.process("pgRegistry_PgRegistryBuilder_init", { registryBuilder, }); + await info.process("pgRegistry_PgRegistryBuilder_pgExecutors", { + registryBuilder, + }); await info.process("pgRegistry_PgRegistryBuilder_pgCodecs", { registryBuilder, }); diff --git a/graphile-build/graphile-build/src/makeNewBuild.ts b/graphile-build/graphile-build/src/makeNewBuild.ts index 4cc1703784..a92abc9a84 100644 --- a/graphile-build/graphile-build/src/makeNewBuild.ts +++ b/graphile-build/graphile-build/src/makeNewBuild.ts @@ -289,7 +289,7 @@ export default function makeNewBuild( assertTypeName(typeName) { if (!this.status.isBuildPhaseComplete) { throw new Error( - "Must not call build.assertTypeName before 'build' phase is complete", + "Must not call build.assertTypeName before 'build' phase is complete; use 'init' phase instead", ); } if (typeName in allTypesSources) { @@ -304,7 +304,7 @@ export default function makeNewBuild( getTypeMetaByName(typeName) { if (!this.status.isBuildPhaseComplete) { throw new Error( - "Must not call build.getTypeMetaByName before 'build' phase is complete", + "Must not call build.getTypeMetaByName before 'build' phase is complete; use 'init' phase instead", ); } // Meta for builtins @@ -367,9 +367,7 @@ style for these configuration options (e.g. change \`interfaces: \ ); } if (!this.status.isInitPhaseComplete) { - throw new Error( - "Must not call build.getTypeByName before 'init' phase is complete", - ); + throw new Error(mustUseThunkMessage("build.getTypeByName")); } if (typeName in allTypes) { return allTypes[typeName]; @@ -445,9 +443,7 @@ style for these configuration options (e.g. change \`interfaces: \ }, getInputTypeByName(typeName) { if (!this.status.isInitPhaseComplete) { - throw new Error( - "Must not call build.getInputTypeByName before 'init' phase is complete", - ); + throw new Error(mustUseThunkMessage("build.getInputTypeByName")); } const type = this.getTypeByName(typeName); if (!type) { @@ -470,9 +466,7 @@ style for these configuration options (e.g. change \`interfaces: \ }, getOutputTypeByName(typeName) { if (!this.status.isInitPhaseComplete) { - throw new Error( - "Must not call build.getOutputTypeByName before 'init' phase is complete", - ); + throw new Error(mustUseThunkMessage("build.getOutputTypeByName")); } const type = this.getTypeByName(typeName); if (!type) { @@ -519,3 +513,13 @@ function generateSpecFromDetails(details: TypeDetails) { currentTypeDetails = null; } } + +function mustUseThunkMessage(fn: string) { + return ( + "Must not call " + + fn + + " before 'init' phase is complete; please be sure to use the 'thunk' configuration method for GraphQL types (e.g. instead of `fields: { /* ... */ }` use `fields: () => ({ /* ... */ })`), and be sure to only call " + + fn + + " from inside a thunk." + ); +} diff --git a/graphile-build/graphile-utils/__tests__/RegisterUserPlugin.ts b/graphile-build/graphile-utils/__tests__/RegisterUserPlugin.ts index e71e834531..c7241f9080 100644 --- a/graphile-build/graphile-utils/__tests__/RegisterUserPlugin.ts +++ b/graphile-build/graphile-utils/__tests__/RegisterUserPlugin.ts @@ -16,7 +16,7 @@ import { gql, makeExtendSchemaPlugin } from "../src/index.js"; export const RegisterUserPlugin = makeExtendSchemaPlugin((build) => { const { users } = build.input.pgRegistry.pgResources; - const { executor } = users; + const executor = build.input.pgRegistry.pgExecutors.main; return { typeDefs: gql` extend type Mutation { diff --git a/graphile-build/graphile-utils/__tests__/makeExtendSchemaPlugin.test.ts b/graphile-build/graphile-utils/__tests__/makeExtendSchemaPlugin.test.ts index f086108373..a18fd672c5 100644 --- a/graphile-build/graphile-utils/__tests__/makeExtendSchemaPlugin.test.ts +++ b/graphile-build/graphile-utils/__tests__/makeExtendSchemaPlugin.test.ts @@ -184,7 +184,7 @@ it("supports unary steps in loadOne", async () => { plugins: [ makeExtendSchemaPlugin((build) => { const { loadOne } = build.grafast; - const { users } = build.input.pgRegistry.pgResources; + const { main } = build.input.pgRegistry.pgExecutors; return { typeDefs: gql` extend type User { @@ -195,7 +195,7 @@ it("supports unary steps in loadOne", async () => { User: { uppercaseName($user) { const $name = $user.get("name"); - const $executorContext = users.executor.context(); + const $executorContext = main.context(); return loadOne( $name, $executorContext, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/defaultOptions.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/defaultOptions.1.export.mjs index 53491c0023..2c7e5efac5 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/defaultOptions.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/defaultOptions.1.export.mjs @@ -3523,6 +3523,9 @@ const type_function_listFunctionIdentifer = sql.identifier("b", "type_function_l const type_function_list_mutationFunctionIdentifer = sql.identifier("b", "type_function_list_mutation"); const person_type_function_listFunctionIdentifer = sql.identifier("c", "person_type_function_list"); const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { int4: TYPES.int, void: TYPES.void, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/defaultOptions.inheritence.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/defaultOptions.inheritence.1.export.mjs index 1fd569ff42..70fc97c61b 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/defaultOptions.inheritence.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/defaultOptions.inheritence.1.export.mjs @@ -65,7 +65,6 @@ const nodeIdCodecs = Object.assign(Object.create(null), { }) } }); -const fileIdentifier = sql.identifier("inheritence", "file"); const executor = new PgExecutor({ name: "main", context() { @@ -76,6 +75,7 @@ const executor = new PgExecutor({ }); } }); +const fileIdentifier = sql.identifier("inheritence", "file"); const spec_file = { name: "file", identifier: fileIdentifier, @@ -258,6 +258,9 @@ const registryConfig_pgResources_user_file_user_file = { } }; const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { text: TYPES.text, varchar: TYPES.varchar, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/defaultOptions.nested_arrays.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/defaultOptions.nested_arrays.1.export.mjs index 43008e1143..692808cf9e 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/defaultOptions.nested_arrays.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/defaultOptions.nested_arrays.1.export.mjs @@ -65,7 +65,6 @@ const nodeIdCodecs = Object.assign(Object.create(null), { }) } }); -const tIdentifier = sql.identifier("nested_arrays", "t"); const executor = new PgExecutor({ name: "main", context() { @@ -76,6 +75,7 @@ const executor = new PgExecutor({ }); } }); +const tIdentifier = sql.identifier("nested_arrays", "t"); const workHourPartsCodec = recordCodec({ name: "workHourParts", identifier: sql.identifier("nested_arrays", "work_hour_parts"), @@ -237,6 +237,9 @@ const tUniques = [{ } }]; const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { bool: TYPES.boolean, t: tCodec, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/defaultOptions.subscriptions.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/defaultOptions.subscriptions.1.export.mjs index 53491c0023..2c7e5efac5 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/defaultOptions.subscriptions.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/defaultOptions.subscriptions.1.export.mjs @@ -3523,6 +3523,9 @@ const type_function_listFunctionIdentifer = sql.identifier("b", "type_function_l const type_function_list_mutationFunctionIdentifer = sql.identifier("b", "type_function_list_mutation"); const person_type_function_listFunctionIdentifer = sql.identifier("c", "person_type_function_list"); const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { int4: TYPES.int, void: TYPES.void, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/enum_tables.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/enum_tables.1.export.mjs index cae737645f..81caa76395 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/enum_tables.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/enum_tables.1.export.mjs @@ -65,7 +65,6 @@ const nodeIdCodecs = Object.assign(Object.create(null), { }) } }); -const abcdIdentifier = sql.identifier("enum_tables", "abcd"); const executor = new PgExecutor({ name: "main", context() { @@ -76,6 +75,7 @@ const executor = new PgExecutor({ }); } }); +const abcdIdentifier = sql.identifier("enum_tables", "abcd"); const spec_abcd = { name: "abcd", identifier: abcdIdentifier, @@ -764,6 +764,9 @@ const registryConfig_pgResources_lots_of_enums_lots_of_enums = { } }; const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { abcd: abcdCodec, text: TYPES.text, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/foreignKey-smart-tag-autofix.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/foreignKey-smart-tag-autofix.1.export.mjs index 4ba8c6f541..b17ccc215d 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/foreignKey-smart-tag-autofix.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/foreignKey-smart-tag-autofix.1.export.mjs @@ -2518,6 +2518,9 @@ const person_type_function_connectionFunctionIdentifer = sql.identifier("c", "pe const person_type_functionFunctionIdentifer = sql.identifier("c", "person_type_function"); const person_type_function_listFunctionIdentifer = sql.identifier("c", "person_type_function_list"); const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { int4: TYPES.int, json: TYPES.json, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/foreignKey-smart-tag-good.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/foreignKey-smart-tag-good.1.export.mjs index e9e0584923..dedfef5a3d 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/foreignKey-smart-tag-good.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/foreignKey-smart-tag-good.1.export.mjs @@ -2516,6 +2516,9 @@ const person_type_function_connectionFunctionIdentifer = sql.identifier("c", "pe const person_type_functionFunctionIdentifer = sql.identifier("c", "person_type_function"); const person_type_function_listFunctionIdentifer = sql.identifier("c", "person_type_function_list"); const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { int4: TYPES.int, json: TYPES.json, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/function-clash-with-tags-file-workaround.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/function-clash-with-tags-file-workaround.1.export.mjs index c08c2e1a76..92f31ec182 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/function-clash-with-tags-file-workaround.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/function-clash-with-tags-file-workaround.1.export.mjs @@ -3530,6 +3530,9 @@ const type_function_listFunctionIdentifer = sql.identifier("b", "type_function_l const type_function_list_mutationFunctionIdentifer = sql.identifier("b", "type_function_list_mutation"); const person_type_function_listFunctionIdentifer = sql.identifier("c", "person_type_function_list"); const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { int4: TYPES.int, void: TYPES.void, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/function-clash.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/function-clash.1.export.mjs index b74017485b..ac78a63398 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/function-clash.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/function-clash.1.export.mjs @@ -3524,6 +3524,9 @@ const type_function_listFunctionIdentifer = sql.identifier("b", "type_function_l const type_function_list_mutationFunctionIdentifer = sql.identifier("b", "type_function_list_mutation"); const person_type_function_listFunctionIdentifer = sql.identifier("c", "person_type_function_list"); const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { int4: TYPES.int, void: TYPES.void, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/geometry.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/geometry.1.export.mjs index f6e353e42b..12572febe1 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/geometry.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/geometry.1.export.mjs @@ -65,7 +65,6 @@ const nodeIdCodecs = Object.assign(Object.create(null), { }) } }); -const geomIdentifier = sql.identifier("geometry", "geom"); const executor = new PgExecutor({ name: "main", context() { @@ -76,6 +75,7 @@ const executor = new PgExecutor({ }); } }); +const geomIdentifier = sql.identifier("geometry", "geom"); const spec_geom = { name: "geom", identifier: geomIdentifier, @@ -184,6 +184,9 @@ const geomUniques = [{ } }]; const pgResource_geomPgResource = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { text: TYPES.text, varchar: TYPES.varchar, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/indexes.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/indexes.1.export.mjs index fc6da9aa93..abfdd30bb2 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/indexes.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/indexes.1.export.mjs @@ -3751,6 +3751,9 @@ const type_function_listFunctionIdentifer = sql.identifier("b", "type_function_l const type_function_list_mutationFunctionIdentifer = sql.identifier("b", "type_function_list_mutation"); const person_type_function_listFunctionIdentifer = sql.identifier("c", "person_type_function_list"); const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { int4: TYPES.int, void: TYPES.void, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/indexes.index_expressions.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/indexes.index_expressions.1.export.mjs index 0ce71893d0..36814d9585 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/indexes.index_expressions.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/indexes.index_expressions.1.export.mjs @@ -65,7 +65,6 @@ const nodeIdCodecs = Object.assign(Object.create(null), { }) } }); -const employeeIdentifier = sql.identifier("index_expressions", "employee"); const executor = new PgExecutor({ name: "main", context() { @@ -76,6 +75,7 @@ const executor = new PgExecutor({ }); } }); +const employeeIdentifier = sql.identifier("index_expressions", "employee"); const spec_employee = { name: "employee", identifier: employeeIdentifier, @@ -130,6 +130,9 @@ const employeeUniques = [{ } }]; const pgResource_employeePgResource = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { text: TYPES.text, varchar: TYPES.varchar, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/inflect-core.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/inflect-core.1.export.mjs index 1c78657027..4cf15be9e6 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/inflect-core.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/inflect-core.1.export.mjs @@ -3523,6 +3523,9 @@ const type_function_listFunctionIdentifer = sql.identifier("b", "type_function_l const type_function_list_mutationFunctionIdentifer = sql.identifier("b", "type_function_list_mutation"); const person_type_function_listFunctionIdentifer = sql.identifier("c", "person_type_function_list"); const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { int4: TYPES.int, void: TYPES.void, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/js-reserved.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/js-reserved.1.export.mjs index f82fb695e9..dba6f3ba5a 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/js-reserved.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/js-reserved.1.export.mjs @@ -20,6 +20,16 @@ const handler_codec_base64JSON = { return base64JSONDecode; })() }; +const executor = new PgExecutor({ + name: "main", + context() { + const ctx = context(); + return object({ + pgSettings: "pgSettings" != null ? ctx.get("pgSettings") : constant(null), + withPgClient: ctx.get("withPgClient") + }); + } +}); const relationalTopicsIdentifier = sql.identifier("js_reserved", "relational_topics"); const itemTypeCodec = enumCodec({ name: "itemType", @@ -35,16 +45,6 @@ const itemTypeCodec = enumCodec({ tags: Object.create(null) } }); -const executor = new PgExecutor({ - name: "main", - context() { - const ctx = context(); - return object({ - pgSettings: "pgSettings" != null ? ctx.get("pgSettings") : constant(null), - withPgClient: ctx.get("withPgClient") - }); - } -}); const spec_relationalTopics = { name: "relationalTopics", identifier: relationalTopicsIdentifier, @@ -1010,6 +1010,9 @@ const registryConfig_pgResources_relational_items_relational_items = { } }; const registryConfig = { + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.fromEntries([["int4", TYPES.int], ["relationalTopics", relationalTopicsCodec], ["text", TYPES.text], ["__proto__", __proto__Codec], ["building", buildingCodec], ["constructor", constructorCodec], ["crop", cropCodec], ["machine", machineCodec], ["material", materialCodec], ["null", nullCodec], ["project", projectCodec], ["relationalStatus", relationalStatusCodec], ["yield", yieldCodec], ["reserved", reservedCodec], ["relationalItems", relationalItemsCodec], ["itemType", itemTypeCodec], ["varchar", TYPES.varchar], ["bpchar", TYPES.bpchar]]), pgResources: Object.fromEntries([["await", { executor, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/jwt.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/jwt.1.export.mjs index 63537619df..4dc0f67b2f 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/jwt.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/jwt.1.export.mjs @@ -66,6 +66,16 @@ const nodeIdCodecs = Object.assign(Object.create(null), { }) } }); +const executor = new PgExecutor({ + name: "main", + context() { + const ctx = context(); + return object({ + pgSettings: "pgSettings" != null ? ctx.get("pgSettings") : constant(null), + withPgClient: ctx.get("withPgClient") + }); + } +}); const guidCodec = domainOfCodec(TYPES.varchar, "guid", sql.identifier("b", "guid"), { description: undefined, extensions: { @@ -79,16 +89,6 @@ const guidCodec = domainOfCodec(TYPES.varchar, "guid", sql.identifier("b", "guid notNull: false }); const updatableViewIdentifier = sql.identifier("b", "updatable_view"); -const executor = new PgExecutor({ - name: "main", - context() { - const ctx = context(); - return object({ - pgSettings: "pgSettings" != null ? ctx.get("pgSettings") : constant(null), - withPgClient: ctx.get("withPgClient") - }); - } -}); const spec_updatableView = { name: "updatableView", identifier: updatableViewIdentifier, @@ -1151,6 +1151,9 @@ const type_function_mutationFunctionIdentifer = sql.identifier("b", "type_functi const type_function_listFunctionIdentifer = sql.identifier("b", "type_function_list"); const type_function_list_mutationFunctionIdentifer = sql.identifier("b", "type_function_list_mutation"); const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { int4: TYPES.int, guid: guidCodec, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/network_types.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/network_types.1.export.mjs index 367d524545..ad7d5f219a 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/network_types.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/network_types.1.export.mjs @@ -65,7 +65,6 @@ const nodeIdCodecs = Object.assign(Object.create(null), { }) } }); -const networkIdentifier = sql.identifier("network_types", "network"); const executor = new PgExecutor({ name: "main", context() { @@ -76,6 +75,7 @@ const executor = new PgExecutor({ }); } }); +const networkIdentifier = sql.identifier("network_types", "network"); const spec_network = { name: "network", identifier: networkIdentifier, @@ -139,6 +139,9 @@ const networkUniques = [{ } }]; const pgResource_networkPgResource = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { text: TYPES.text, varchar: TYPES.varchar, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/network_types.custom.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/network_types.custom.1.export.mjs index 2fc9d8f8d4..9d4a3b7145 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/network_types.custom.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/network_types.custom.1.export.mjs @@ -65,7 +65,6 @@ const nodeIdCodecs = Object.assign(Object.create(null), { }) } }); -const networkIdentifier = sql.identifier("network_types", "network"); const executor = new PgExecutor({ name: "main", context() { @@ -76,6 +75,7 @@ const executor = new PgExecutor({ }); } }); +const networkIdentifier = sql.identifier("network_types", "network"); const spec_network = { name: "network", identifier: networkIdentifier, @@ -139,6 +139,9 @@ const networkUniques = [{ } }]; const pgResource_networkPgResource = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { text: TYPES.text, varchar: TYPES.varchar, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/noDefaultMutations.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/noDefaultMutations.1.export.mjs index 8342d7dda7..cfdbc62fd4 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/noDefaultMutations.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/noDefaultMutations.1.export.mjs @@ -2507,6 +2507,9 @@ const person_type_function_connectionFunctionIdentifer = sql.identifier("c", "pe const person_type_functionFunctionIdentifer = sql.identifier("c", "person_type_function"); const person_type_function_listFunctionIdentifer = sql.identifier("c", "person_type_function_list"); const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { int4: TYPES.int, json: TYPES.json, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.1.export.mjs index d38d295f90..c68fdb5b58 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.1.export.mjs @@ -65,7 +65,6 @@ const nodeIdCodecs = Object.assign(Object.create(null), { }) } }); -const flambleIdentifier = sql.identifier("d", "flibble"); const executor = new PgExecutor({ name: "main", context() { @@ -76,6 +75,7 @@ const executor = new PgExecutor({ }); } }); +const flambleIdentifier = sql.identifier("d", "flibble"); const flambleCodec = recordCodec({ name: "flamble", identifier: flambleIdentifier, @@ -674,6 +674,9 @@ const registryConfig_pgResources_person_person = { } }; const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { int4: TYPES.int, flamble: flambleCodec, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitcolumns.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitcolumns.1.export.mjs index 3a89ffabac..4b23846b2c 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitcolumns.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitcolumns.1.export.mjs @@ -65,7 +65,6 @@ const nodeIdCodecs = Object.assign(Object.create(null), { }) } }); -const flambleIdentifier = sql.identifier("d", "flibble"); const executor = new PgExecutor({ name: "main", context() { @@ -76,6 +75,7 @@ const executor = new PgExecutor({ }); } }); +const flambleIdentifier = sql.identifier("d", "flibble"); const flambleCodec = recordCodec({ name: "flamble", identifier: flambleIdentifier, @@ -677,6 +677,9 @@ const registryConfig_pgResources_person_person = { } }; const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { int4: TYPES.int, flamble: flambleCodec, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitcolumns.execute.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitcolumns.execute.1.export.mjs index e7b3005e52..b75ce153d5 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitcolumns.execute.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitcolumns.execute.1.export.mjs @@ -65,7 +65,6 @@ const nodeIdCodecs = Object.assign(Object.create(null), { }) } }); -const flambleIdentifier = sql.identifier("d", "flibble"); const executor = new PgExecutor({ name: "main", context() { @@ -76,6 +75,7 @@ const executor = new PgExecutor({ }); } }); +const flambleIdentifier = sql.identifier("d", "flibble"); const flambleCodec = recordCodec({ name: "flamble", identifier: flambleIdentifier, @@ -674,6 +674,9 @@ const registryConfig_pgResources_person_person = { } }; const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { int4: TYPES.int, flamble: flambleCodec, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitcolumns.loads-title.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitcolumns.loads-title.1.export.mjs index 1916a0d3cc..7d3a532f0c 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitcolumns.loads-title.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitcolumns.loads-title.1.export.mjs @@ -65,7 +65,6 @@ const nodeIdCodecs = Object.assign(Object.create(null), { }) } }); -const flambleIdentifier = sql.identifier("d", "flibble"); const executor = new PgExecutor({ name: "main", context() { @@ -76,6 +75,7 @@ const executor = new PgExecutor({ }); } }); +const flambleIdentifier = sql.identifier("d", "flibble"); const flambleCodec = recordCodec({ name: "flamble", identifier: flambleIdentifier, @@ -677,6 +677,9 @@ const registryConfig_pgResources_person_person = { } }; const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { int4: TYPES.int, flamble: flambleCodec, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitcolumns.shows-title-asterisk.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitcolumns.shows-title-asterisk.1.export.mjs index 92c7398e8f..e2f90e0699 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitcolumns.shows-title-asterisk.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitcolumns.shows-title-asterisk.1.export.mjs @@ -65,7 +65,6 @@ const nodeIdCodecs = Object.assign(Object.create(null), { }) } }); -const flambleIdentifier = sql.identifier("d", "flibble"); const executor = new PgExecutor({ name: "main", context() { @@ -76,6 +75,7 @@ const executor = new PgExecutor({ }); } }); +const flambleIdentifier = sql.identifier("d", "flibble"); const flambleCodec = recordCodec({ name: "flamble", identifier: flambleIdentifier, @@ -680,6 +680,9 @@ const registryConfig_pgResources_person_person = { } }; const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { int4: TYPES.int, flamble: flambleCodec, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitcolumns.title-order.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitcolumns.title-order.1.export.mjs index ddeee658cf..9d0200626c 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitcolumns.title-order.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitcolumns.title-order.1.export.mjs @@ -65,7 +65,6 @@ const nodeIdCodecs = Object.assign(Object.create(null), { }) } }); -const flambleIdentifier = sql.identifier("d", "flibble"); const executor = new PgExecutor({ name: "main", context() { @@ -76,6 +75,7 @@ const executor = new PgExecutor({ }); } }); +const flambleIdentifier = sql.identifier("d", "flibble"); const flambleCodec = recordCodec({ name: "flamble", identifier: flambleIdentifier, @@ -677,6 +677,9 @@ const registryConfig_pgResources_person_person = { } }; const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { int4: TYPES.int, flamble: flambleCodec, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitcolumns.update-title.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitcolumns.update-title.1.export.mjs index 9cc69ae5ec..ca0288f4db 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitcolumns.update-title.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitcolumns.update-title.1.export.mjs @@ -65,7 +65,6 @@ const nodeIdCodecs = Object.assign(Object.create(null), { }) } }); -const flambleIdentifier = sql.identifier("d", "flibble"); const executor = new PgExecutor({ name: "main", context() { @@ -76,6 +75,7 @@ const executor = new PgExecutor({ }); } }); +const flambleIdentifier = sql.identifier("d", "flibble"); const flambleCodec = recordCodec({ name: "flamble", identifier: flambleIdentifier, @@ -677,6 +677,9 @@ const registryConfig_pgResources_person_person = { } }; const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { int4: TYPES.int, flamble: flambleCodec, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitstuff.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitstuff.1.export.mjs index ec90df50a7..89aee1fbfc 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitstuff.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitstuff.1.export.mjs @@ -65,7 +65,6 @@ const nodeIdCodecs = Object.assign(Object.create(null), { }) } }); -const flambleIdentifier = sql.identifier("d", "flibble"); const executor = new PgExecutor({ name: "main", context() { @@ -76,6 +75,7 @@ const executor = new PgExecutor({ }); } }); +const flambleIdentifier = sql.identifier("d", "flibble"); const flambleCodec = recordCodec({ name: "flamble", identifier: flambleIdentifier, @@ -677,6 +677,9 @@ const registryConfig_pgResources_person_person = { } }; const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { int4: TYPES.int, flamble: flambleCodec, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitstuff.constraints.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitstuff.constraints.1.export.mjs index 46634366f0..a100f44e7b 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitstuff.constraints.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitstuff.constraints.1.export.mjs @@ -65,7 +65,6 @@ const nodeIdCodecs = Object.assign(Object.create(null), { }) } }); -const flambleIdentifier = sql.identifier("d", "flibble"); const executor = new PgExecutor({ name: "main", context() { @@ -76,6 +75,7 @@ const executor = new PgExecutor({ }); } }); +const flambleIdentifier = sql.identifier("d", "flibble"); const flambleCodec = recordCodec({ name: "flamble", identifier: flambleIdentifier, @@ -680,6 +680,9 @@ const registryConfig_pgResources_person_person = { } }; const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { int4: TYPES.int, flamble: flambleCodec, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitstuff.films-asterisk.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitstuff.films-asterisk.1.export.mjs index e01778e46a..6074ae540e 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitstuff.films-asterisk.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitstuff.films-asterisk.1.export.mjs @@ -65,7 +65,6 @@ const nodeIdCodecs = Object.assign(Object.create(null), { }) } }); -const flambleIdentifier = sql.identifier("d", "flibble"); const executor = new PgExecutor({ name: "main", context() { @@ -76,6 +75,7 @@ const executor = new PgExecutor({ }); } }); +const flambleIdentifier = sql.identifier("d", "flibble"); const flambleCodec = recordCodec({ name: "flamble", identifier: flambleIdentifier, @@ -674,6 +674,9 @@ const registryConfig_pgResources_person_person = { } }; const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { int4: TYPES.int, flamble: flambleCodec, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitstuff.films-create.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitstuff.films-create.1.export.mjs index 510a3e5a45..2b1bc44774 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitstuff.films-create.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitstuff.films-create.1.export.mjs @@ -65,7 +65,6 @@ const nodeIdCodecs = Object.assign(Object.create(null), { }) } }); -const flambleIdentifier = sql.identifier("d", "flibble"); const executor = new PgExecutor({ name: "main", context() { @@ -76,6 +75,7 @@ const executor = new PgExecutor({ }); } }); +const flambleIdentifier = sql.identifier("d", "flibble"); const flambleCodec = recordCodec({ name: "flamble", identifier: flambleIdentifier, @@ -677,6 +677,9 @@ const registryConfig_pgResources_person_person = { } }; const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { int4: TYPES.int, flamble: flambleCodec, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitstuff.films-delete.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitstuff.films-delete.1.export.mjs index 3d4d26705d..1c92389a41 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitstuff.films-delete.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitstuff.films-delete.1.export.mjs @@ -65,7 +65,6 @@ const nodeIdCodecs = Object.assign(Object.create(null), { }) } }); -const flambleIdentifier = sql.identifier("d", "flibble"); const executor = new PgExecutor({ name: "main", context() { @@ -76,6 +75,7 @@ const executor = new PgExecutor({ }); } }); +const flambleIdentifier = sql.identifier("d", "flibble"); const flambleCodec = recordCodec({ name: "flamble", identifier: flambleIdentifier, @@ -677,6 +677,9 @@ const registryConfig_pgResources_person_person = { } }; const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { int4: TYPES.int, flamble: flambleCodec, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitstuff.films-loads.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitstuff.films-loads.1.export.mjs index 2986155d45..590639f91b 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitstuff.films-loads.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitstuff.films-loads.1.export.mjs @@ -65,7 +65,6 @@ const nodeIdCodecs = Object.assign(Object.create(null), { }) } }); -const flambleIdentifier = sql.identifier("d", "flibble"); const executor = new PgExecutor({ name: "main", context() { @@ -76,6 +75,7 @@ const executor = new PgExecutor({ }); } }); +const flambleIdentifier = sql.identifier("d", "flibble"); const flambleCodec = recordCodec({ name: "flamble", identifier: flambleIdentifier, @@ -669,6 +669,9 @@ const registryConfig_pgResources_person_person = { } }; const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { int4: TYPES.int, flamble: flambleCodec, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitstuff.films-update.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitstuff.films-update.1.export.mjs index b59a13e2d8..f04ff33f80 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitstuff.films-update.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitstuff.films-update.1.export.mjs @@ -65,7 +65,6 @@ const nodeIdCodecs = Object.assign(Object.create(null), { }) } }); -const flambleIdentifier = sql.identifier("d", "flibble"); const executor = new PgExecutor({ name: "main", context() { @@ -76,6 +75,7 @@ const executor = new PgExecutor({ }); } }); +const flambleIdentifier = sql.identifier("d", "flibble"); const flambleCodec = recordCodec({ name: "flamble", identifier: flambleIdentifier, @@ -677,6 +677,9 @@ const registryConfig_pgResources_person_person = { } }; const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { int4: TYPES.int, flamble: flambleCodec, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitstuff.shows-order.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitstuff.shows-order.1.export.mjs index 1dc4efd38b..532ec30684 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitstuff.shows-order.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/omit-rename.omitstuff.shows-order.1.export.mjs @@ -65,7 +65,6 @@ const nodeIdCodecs = Object.assign(Object.create(null), { }) } }); -const flambleIdentifier = sql.identifier("d", "flibble"); const executor = new PgExecutor({ name: "main", context() { @@ -76,6 +75,7 @@ const executor = new PgExecutor({ }); } }); +const flambleIdentifier = sql.identifier("d", "flibble"); const flambleCodec = recordCodec({ name: "flamble", identifier: flambleIdentifier, @@ -679,6 +679,9 @@ const registryConfig_pgResources_person_person = { } }; const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { int4: TYPES.int, flamble: flambleCodec, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/partitions.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/partitions.1.export.mjs index 83884572b0..fbdc5856c3 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/partitions.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/partitions.1.export.mjs @@ -65,7 +65,6 @@ const nodeIdCodecs = Object.assign(Object.create(null), { }) } }); -const usersIdentifier = sql.identifier("partitions", "users"); const executor = new PgExecutor({ name: "main", context() { @@ -76,6 +75,7 @@ const executor = new PgExecutor({ }); } }); +const usersIdentifier = sql.identifier("partitions", "users"); const spec_users = { name: "users", identifier: usersIdentifier, @@ -222,6 +222,9 @@ const registryConfig_pgResources_measurements_measurements = { } }; const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { users: usersCodec, int4: TYPES.int, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/pg11.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/pg11.1.export.mjs index ee89786d75..7cf7779813 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/pg11.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/pg11.1.export.mjs @@ -65,7 +65,6 @@ const nodeIdCodecs = Object.assign(Object.create(null), { }) } }); -const alwaysAsIdentityIdentifier = sql.identifier("pg11", "always_as_identity"); const executor = new PgExecutor({ name: "main", context() { @@ -76,6 +75,7 @@ const executor = new PgExecutor({ }); } }); +const alwaysAsIdentityIdentifier = sql.identifier("pg11", "always_as_identity"); const spec_alwaysAsIdentity = { name: "alwaysAsIdentity", identifier: alwaysAsIdentityIdentifier, @@ -492,6 +492,9 @@ const typesUniques = [{ } }]; const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { alwaysAsIdentity: alwaysAsIdentityCodec, int4: TYPES.int, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/pg11.custom.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/pg11.custom.1.export.mjs index 1b309bb39d..625f668140 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/pg11.custom.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/pg11.custom.1.export.mjs @@ -65,7 +65,6 @@ const nodeIdCodecs = Object.assign(Object.create(null), { }) } }); -const alwaysAsIdentityIdentifier = sql.identifier("pg11", "always_as_identity"); const executor = new PgExecutor({ name: "main", context() { @@ -76,6 +75,7 @@ const executor = new PgExecutor({ }); } }); +const alwaysAsIdentityIdentifier = sql.identifier("pg11", "always_as_identity"); const spec_alwaysAsIdentity = { name: "alwaysAsIdentity", identifier: alwaysAsIdentityIdentifier, @@ -492,6 +492,9 @@ const typesUniques = [{ } }]; const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { alwaysAsIdentity: alwaysAsIdentityCodec, int4: TYPES.int, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/polymorphic.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/polymorphic.1.export.mjs index 9d18095743..9d40bf4637 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/polymorphic.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/polymorphic.1.export.mjs @@ -20,7 +20,6 @@ const handler_codec_base64JSON = { return base64JSONDecode; })() }; -const awsApplicationFirstPartyVulnerabilitiesIdentifier = sql.identifier("polymorphic", "aws_application_first_party_vulnerabilities"); const executor = new PgExecutor({ name: "main", context() { @@ -31,6 +30,7 @@ const executor = new PgExecutor({ }); } }); +const awsApplicationFirstPartyVulnerabilitiesIdentifier = sql.identifier("polymorphic", "aws_application_first_party_vulnerabilities"); const spec_awsApplicationFirstPartyVulnerabilities = { name: "awsApplicationFirstPartyVulnerabilities", identifier: awsApplicationFirstPartyVulnerabilitiesIdentifier, @@ -3013,6 +3013,9 @@ const registryConfig_pgResources_relational_items_relational_items = { } }; const registryConfig = { + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { awsApplicationFirstPartyVulnerabilities: awsApplicationFirstPartyVulnerabilitiesCodec, int4: TYPES.int, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/rbac.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/rbac.1.export.mjs index 66e693ab5b..ab92f953ec 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/rbac.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/rbac.1.export.mjs @@ -3649,6 +3649,9 @@ const type_function_listFunctionIdentifer = sql.identifier("b", "type_function_l const type_function_list_mutationFunctionIdentifer = sql.identifier("b", "type_function_list_mutation"); const person_type_function_listFunctionIdentifer = sql.identifier("c", "person_type_function_list"); const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { int4: TYPES.int, void: TYPES.void, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/rbac.ignore.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/rbac.ignore.1.export.mjs index 53491c0023..2c7e5efac5 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/rbac.ignore.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/rbac.ignore.1.export.mjs @@ -3523,6 +3523,9 @@ const type_function_listFunctionIdentifer = sql.identifier("b", "type_function_l const type_function_list_mutationFunctionIdentifer = sql.identifier("b", "type_function_list_mutation"); const person_type_function_listFunctionIdentifer = sql.identifier("c", "person_type_function_list"); const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { int4: TYPES.int, void: TYPES.void, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/refs.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/refs.1.export.mjs index ccff364773..ac58dfe84f 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/refs.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/refs.1.export.mjs @@ -65,7 +65,6 @@ const nodeIdCodecs = Object.assign(Object.create(null), { }) } }); -const peopleIdentifier = sql.identifier("refs", "people"); const executor = new PgExecutor({ name: "main", context() { @@ -76,6 +75,7 @@ const executor = new PgExecutor({ }); } }); +const peopleIdentifier = sql.identifier("refs", "people"); const spec_people = { name: "people", identifier: peopleIdentifier, @@ -224,6 +224,9 @@ const registryConfig_pgResources_posts_posts = { } }; const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { text: TYPES.text, varchar: TYPES.varchar, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/relay.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/relay.1.export.mjs index 36d052c5b8..7a48a7fe9b 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/relay.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/relay.1.export.mjs @@ -65,7 +65,6 @@ const nodeIdCodecs = Object.assign(Object.create(null), { }) } }); -const flambleIdentifier = sql.identifier("d", "flibble"); const executor = new PgExecutor({ name: "main", context() { @@ -76,6 +75,7 @@ const executor = new PgExecutor({ }); } }); +const flambleIdentifier = sql.identifier("d", "flibble"); const flambleCodec = recordCodec({ name: "flamble", identifier: flambleIdentifier, @@ -674,6 +674,9 @@ const registryConfig_pgResources_person_person = { } }; const registryConfig = { + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { int4: TYPES.int, flamble: flambleCodec, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/relay1.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/relay1.1.export.mjs index d8a1e5b1df..4729ccf2c3 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/relay1.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/relay1.1.export.mjs @@ -2507,6 +2507,9 @@ const person_type_function_connectionFunctionIdentifer = sql.identifier("c", "pe const person_type_functionFunctionIdentifer = sql.identifier("c", "person_type_function"); const person_type_function_listFunctionIdentifer = sql.identifier("c", "person_type_function_list"); const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { int4: TYPES.int, json: TYPES.json, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/simple-collections.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/simple-collections.1.export.mjs index 09514dec77..344a134c4e 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/simple-collections.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/simple-collections.1.export.mjs @@ -2507,6 +2507,9 @@ const person_type_function_connectionFunctionIdentifer = sql.identifier("c", "pe const person_type_functionFunctionIdentifer = sql.identifier("c", "person_type_function"); const person_type_function_listFunctionIdentifer = sql.identifier("c", "person_type_function_list"); const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { int4: TYPES.int, json: TYPES.json, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/simple-collections.omit-pets-simple.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/simple-collections.omit-pets-simple.1.export.mjs index 959b214ff4..fb86b24fac 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/simple-collections.omit-pets-simple.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/simple-collections.omit-pets-simple.1.export.mjs @@ -65,7 +65,6 @@ const nodeIdCodecs = Object.assign(Object.create(null), { }) } }); -const peopleIdentifier = sql.identifier("simple_collections", "people"); const executor = new PgExecutor({ name: "main", context() { @@ -76,6 +75,7 @@ const executor = new PgExecutor({ }); } }); +const peopleIdentifier = sql.identifier("simple_collections", "people"); const spec_people = { name: "people", identifier: peopleIdentifier, @@ -214,6 +214,9 @@ const registryConfig_pgResources_pets_pets = { }; const people_odd_petsFunctionIdentifer = sql.identifier("simple_collections", "people_odd_pets"); const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { people: peopleCodec, int4: TYPES.int, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/simple-collections.only-people-omit.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/simple-collections.only-people-omit.1.export.mjs index 1751467f84..722dac07ae 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/simple-collections.only-people-omit.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/simple-collections.only-people-omit.1.export.mjs @@ -65,7 +65,6 @@ const nodeIdCodecs = Object.assign(Object.create(null), { }) } }); -const peopleIdentifier = sql.identifier("simple_collections", "people"); const executor = new PgExecutor({ name: "main", context() { @@ -76,6 +75,7 @@ const executor = new PgExecutor({ }); } }); +const peopleIdentifier = sql.identifier("simple_collections", "people"); const spec_people = { name: "people", identifier: peopleIdentifier, @@ -220,6 +220,9 @@ const registryConfig_pgResources_pets_pets = { }; const people_odd_petsFunctionIdentifer = sql.identifier("simple_collections", "people_odd_pets"); const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { people: peopleCodec, int4: TYPES.int, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/simple-collections.only.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/simple-collections.only.1.export.mjs index 0726332583..06c61281a2 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/simple-collections.only.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/simple-collections.only.1.export.mjs @@ -2507,6 +2507,9 @@ const person_type_function_connectionFunctionIdentifer = sql.identifier("c", "pe const person_type_functionFunctionIdentifer = sql.identifier("c", "person_type_function"); const person_type_function_listFunctionIdentifer = sql.identifier("c", "person_type_function_list"); const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { int4: TYPES.int, json: TYPES.json, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/simple-collections.pets-simple.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/simple-collections.pets-simple.1.export.mjs index dab1c53808..1ee6404967 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/simple-collections.pets-simple.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/simple-collections.pets-simple.1.export.mjs @@ -65,7 +65,6 @@ const nodeIdCodecs = Object.assign(Object.create(null), { }) } }); -const peopleIdentifier = sql.identifier("simple_collections", "people"); const executor = new PgExecutor({ name: "main", context() { @@ -76,6 +75,7 @@ const executor = new PgExecutor({ }); } }); +const peopleIdentifier = sql.identifier("simple_collections", "people"); const spec_people = { name: "people", identifier: peopleIdentifier, @@ -214,6 +214,9 @@ const registryConfig_pgResources_pets_pets = { }; const people_odd_petsFunctionIdentifer = sql.identifier("simple_collections", "people_odd_pets"); const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { people: peopleCodec, int4: TYPES.int, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/simplePrint.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/simplePrint.export.mjs index 53491c0023..2c7e5efac5 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/simplePrint.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/simplePrint.export.mjs @@ -3523,6 +3523,9 @@ const type_function_listFunctionIdentifer = sql.identifier("b", "type_function_l const type_function_list_mutationFunctionIdentifer = sql.identifier("b", "type_function_list_mutation"); const person_type_function_listFunctionIdentifer = sql.identifier("c", "person_type_function_list"); const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { int4: TYPES.int, void: TYPES.void, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/skipNodePlugin.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/skipNodePlugin.1.export.mjs index 3581aae112..cd897b42cd 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/skipNodePlugin.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/skipNodePlugin.1.export.mjs @@ -3461,6 +3461,9 @@ const type_function_listFunctionIdentifer = sql.identifier("b", "type_function_l const type_function_list_mutationFunctionIdentifer = sql.identifier("b", "type_function_list_mutation"); const person_type_function_listFunctionIdentifer = sql.identifier("c", "person_type_function_list"); const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { int4: TYPES.int, void: TYPES.void, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/skipNodePlugin.polymorphic.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/skipNodePlugin.polymorphic.1.export.mjs index 20a73bc350..9cd4cc87a1 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/skipNodePlugin.polymorphic.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/skipNodePlugin.polymorphic.1.export.mjs @@ -3,7 +3,6 @@ import { ConnectionStep, EdgeStep, ObjectStep, SafeError, __ValueStep, assertEdg import { GraphQLError, Kind } from "graphql"; import { sql } from "pg-sql2"; import { inspect } from "util"; -const awsApplicationFirstPartyVulnerabilitiesIdentifier = sql.identifier("polymorphic", "aws_application_first_party_vulnerabilities"); const executor = new PgExecutor({ name: "main", context() { @@ -14,6 +13,7 @@ const executor = new PgExecutor({ }); } }); +const awsApplicationFirstPartyVulnerabilitiesIdentifier = sql.identifier("polymorphic", "aws_application_first_party_vulnerabilities"); const spec_awsApplicationFirstPartyVulnerabilities = { name: "awsApplicationFirstPartyVulnerabilities", identifier: awsApplicationFirstPartyVulnerabilitiesIdentifier, @@ -2996,6 +2996,9 @@ const registryConfig_pgResources_relational_items_relational_items = { } }; const registryConfig = { + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { awsApplicationFirstPartyVulnerabilities: awsApplicationFirstPartyVulnerabilitiesCodec, int4: TYPES.int, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/smart_comment_relations.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/smart_comment_relations.1.export.mjs index 98bd7c087e..e20545e449 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/smart_comment_relations.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/smart_comment_relations.1.export.mjs @@ -65,7 +65,6 @@ const nodeIdCodecs = Object.assign(Object.create(null), { }) } }); -const post_tableIdentifier = sql.identifier("smart_comment_relations", "post"); const executor = new PgExecutor({ name: "main", context() { @@ -76,6 +75,7 @@ const executor = new PgExecutor({ }); } }); +const post_tableIdentifier = sql.identifier("smart_comment_relations", "post"); const spec_post_table = { name: "post_table", identifier: post_tableIdentifier, @@ -778,6 +778,9 @@ const registryConfig_pgResources_buildings_buildings = { } }; const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { post_table: post_tableCodec, text: TYPES.text, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/smart_comment_relations.post.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/smart_comment_relations.post.1.export.mjs index fc32298328..993ddb7fd2 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/smart_comment_relations.post.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/smart_comment_relations.post.1.export.mjs @@ -65,7 +65,6 @@ const nodeIdCodecs = Object.assign(Object.create(null), { }) } }); -const post_tableIdentifier = sql.identifier("smart_comment_relations", "post"); const executor = new PgExecutor({ name: "main", context() { @@ -76,6 +75,7 @@ const executor = new PgExecutor({ }); } }); +const post_tableIdentifier = sql.identifier("smart_comment_relations", "post"); const spec_post_table = { name: "post_table", identifier: post_tableIdentifier, @@ -756,6 +756,9 @@ const registryConfig_pgResources_buildings_buildings = { } }; const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { post_table: post_tableCodec, text: TYPES.text, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/smart_comment_relations.post_view.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/smart_comment_relations.post_view.1.export.mjs index 0a52f2433e..bb64c2c989 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/smart_comment_relations.post_view.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/smart_comment_relations.post_view.1.export.mjs @@ -65,7 +65,6 @@ const nodeIdCodecs = Object.assign(Object.create(null), { }) } }); -const post_tableIdentifier = sql.identifier("smart_comment_relations", "post"); const executor = new PgExecutor({ name: "main", context() { @@ -76,6 +75,7 @@ const executor = new PgExecutor({ }); } }); +const post_tableIdentifier = sql.identifier("smart_comment_relations", "post"); const spec_post_table = { name: "post_table", identifier: post_tableIdentifier, @@ -778,6 +778,9 @@ const registryConfig_pgResources_buildings_buildings = { } }; const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { post_table: post_tableCodec, text: TYPES.text, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/smart_comment_relations.post_view_no_pk.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/smart_comment_relations.post_view_no_pk.1.export.mjs index e54af8575d..6c976f015e 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/smart_comment_relations.post_view_no_pk.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/smart_comment_relations.post_view_no_pk.1.export.mjs @@ -65,7 +65,6 @@ const nodeIdCodecs = Object.assign(Object.create(null), { }) } }); -const post_tableIdentifier = sql.identifier("smart_comment_relations", "post"); const executor = new PgExecutor({ name: "main", context() { @@ -76,6 +75,7 @@ const executor = new PgExecutor({ }); } }); +const post_tableIdentifier = sql.identifier("smart_comment_relations", "post"); const spec_post_table = { name: "post_table", identifier: post_tableIdentifier, @@ -781,6 +781,9 @@ const registryConfig_pgResources_buildings_buildings = { } }; const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { post_table: post_tableCodec, text: TYPES.text, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/smart_comment_relations.view_fake_unique.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/smart_comment_relations.view_fake_unique.1.export.mjs index dedc1810d1..19f2cc3735 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/smart_comment_relations.view_fake_unique.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/smart_comment_relations.view_fake_unique.1.export.mjs @@ -65,7 +65,6 @@ const nodeIdCodecs = Object.assign(Object.create(null), { }) } }); -const post_tableIdentifier = sql.identifier("smart_comment_relations", "post"); const executor = new PgExecutor({ name: "main", context() { @@ -76,6 +75,7 @@ const executor = new PgExecutor({ }); } }); +const post_tableIdentifier = sql.identifier("smart_comment_relations", "post"); const spec_post_table = { name: "post_table", identifier: post_tableIdentifier, @@ -777,6 +777,9 @@ const registryConfig_pgResources_buildings_buildings = { } }; const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { post_table: post_tableCodec, text: TYPES.text, diff --git a/postgraphile/postgraphile/__tests__/schema/v4/smart_comment_relations.view_fake_unique_pk.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v4/smart_comment_relations.view_fake_unique_pk.1.export.mjs index 5ff2d0f9dd..020c86d5cc 100644 --- a/postgraphile/postgraphile/__tests__/schema/v4/smart_comment_relations.view_fake_unique_pk.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v4/smart_comment_relations.view_fake_unique_pk.1.export.mjs @@ -65,7 +65,6 @@ const nodeIdCodecs = Object.assign(Object.create(null), { }) } }); -const post_tableIdentifier = sql.identifier("smart_comment_relations", "post"); const executor = new PgExecutor({ name: "main", context() { @@ -76,6 +75,7 @@ const executor = new PgExecutor({ }); } }); +const post_tableIdentifier = sql.identifier("smart_comment_relations", "post"); const spec_post_table = { name: "post_table", identifier: post_tableIdentifier, @@ -777,6 +777,9 @@ const registryConfig_pgResources_buildings_buildings = { } }; const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { post_table: post_tableCodec, text: TYPES.text, diff --git a/postgraphile/postgraphile/__tests__/schema/v5/skipNodePlugin.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v5/skipNodePlugin.1.export.mjs index 2a1d46b654..501957fdd0 100644 --- a/postgraphile/postgraphile/__tests__/schema/v5/skipNodePlugin.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v5/skipNodePlugin.1.export.mjs @@ -3458,6 +3458,9 @@ const type_function_listFunctionIdentifer = sql.identifier("b", "type_function_l const type_function_list_mutationFunctionIdentifer = sql.identifier("b", "type_function_list_mutation"); const person_type_function_listFunctionIdentifer = sql.identifier("c", "person_type_function_list"); const registry = makeRegistry({ + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { int4: TYPES.int, void: TYPES.void, diff --git a/postgraphile/postgraphile/__tests__/schema/v5/skipNodePlugin.polymorphic.1.export.mjs b/postgraphile/postgraphile/__tests__/schema/v5/skipNodePlugin.polymorphic.1.export.mjs index 955a50d98f..9ac2bcbbd3 100644 --- a/postgraphile/postgraphile/__tests__/schema/v5/skipNodePlugin.polymorphic.1.export.mjs +++ b/postgraphile/postgraphile/__tests__/schema/v5/skipNodePlugin.polymorphic.1.export.mjs @@ -3,7 +3,6 @@ import { ConnectionStep, EdgeStep, ObjectStep, SafeError, __ValueStep, assertEdg import { GraphQLError, Kind } from "graphql"; import { sql } from "pg-sql2"; import { inspect } from "util"; -const awsApplicationFirstPartyVulnerabilitiesIdentifier = sql.identifier("polymorphic", "aws_application_first_party_vulnerabilities"); const executor = new PgExecutor({ name: "main", context() { @@ -14,6 +13,7 @@ const executor = new PgExecutor({ }); } }); +const awsApplicationFirstPartyVulnerabilitiesIdentifier = sql.identifier("polymorphic", "aws_application_first_party_vulnerabilities"); const spec_awsApplicationFirstPartyVulnerabilities = { name: "awsApplicationFirstPartyVulnerabilities", identifier: awsApplicationFirstPartyVulnerabilitiesIdentifier, @@ -2991,6 +2991,9 @@ const registryConfig_pgResources_relational_items_relational_items = { } }; const registryConfig = { + pgExecutors: Object.assign(Object.create(null), { + main: executor + }), pgCodecs: Object.assign(Object.create(null), { awsApplicationFirstPartyVulnerabilities: awsApplicationFirstPartyVulnerabilitiesCodec, int4: TYPES.int, diff --git a/postgraphile/website/postgraphile/make-extend-schema-plugin.md b/postgraphile/website/postgraphile/make-extend-schema-plugin.md index 1ff5238497..6063ff5210 100644 --- a/postgraphile/website/postgraphile/make-extend-schema-plugin.md +++ b/postgraphile/website/postgraphile/make-extend-schema-plugin.md @@ -448,11 +448,20 @@ database. **How do I get an executor?** -You can get the executor from any resource representing the target database, -for example: +Executors are available in the registry; by default there's one executor called +`main` which you can access like this: ```ts -const { executor } = channels; +const executor = build.input.pgRegistry.pgExecutors.main; +``` + +However, PostGraphile can handle multiple sources, or custom source/executor +names, via `preset.pgServices`. If you don't know the name of the executor but +you do have a resource representing the target database, you can extract the +executor for that DB from the resource, for example: + +```ts +const executor = channels.executor; ``` ### Example @@ -468,7 +477,8 @@ import { withPgClient } from "postgraphile/@dataplan/pg"; export const MyChannelsPlugin = makeExtendSchemaPlugin((build) => { const { channels } = build.input.pgRegistry.pgResources; - const { executor } = channels; + const executor = build.input.pgRegistry.pgExecutors.main; + // or: `const executor = channels.executor;` return { typeDefs: gql` @@ -610,6 +620,7 @@ export const MyRegisterUserMutationPlugin = makeExtendSchemaPlugin((build) => { const { sql } = build; const { users } = build.input.pgRegistry.pgResources; const { executor } = users; + // Or: `const executor = build.input.pgRegistry.pgExecutors.main;` return { typeDefs: gql` input RegisterUserInput { @@ -712,6 +723,7 @@ const DeleteItemByNodeIdPlugin = makeExtendSchemaPlugin((build) => { // Extract the executor from the items resource const { items } = build.input.pgRegistry.pgResources; const { executor } = items; + // Or: `const executor = build.input.pgRegistry.pgExecutors.main;` return { typeDefs: gql` @@ -800,6 +812,7 @@ import { DatabaseError } from "pg"; export const RegisterUserPlugin = makeExtendSchemaPlugin((build) => { const { users } = build.input.pgRegistry.pgResources; const { executor } = users; + // Or: `const executor = build.input.pgRegistry.pgExecutors.main;` return { typeDefs: gql` extend type Mutation { diff --git a/postgraphile/website/postgraphile/migrating-from-v4/make-extend-schema-plugin.md b/postgraphile/website/postgraphile/migrating-from-v4/make-extend-schema-plugin.md index 1a04487c95..800b012266 100644 --- a/postgraphile/website/postgraphile/migrating-from-v4/make-extend-schema-plugin.md +++ b/postgraphile/website/postgraphile/migrating-from-v4/make-extend-schema-plugin.md @@ -268,10 +268,11 @@ export default makeExtendSchemaPlugin((build) => { const { sql } = build; /** * The 'executor' tells us which database we're talking to. - * You can get this from any source via `pgResource.executor`; here we use the - * executor from the 'users' source. + * You can get this from the registry, the default executor name is `main` + * but you can override this and add extra sources/executors via the + * `pgServices` configuration option. */ - const executor = build.input.pgRegistry.pgResources.users.executor; + const executor = build.input.pgRegistry.pgExecutors.main; return { typeDefs: /* GraphQL */ `