From e98383b09d622a9937c6188b910a6e8169e06ded Mon Sep 17 00:00:00 2001 From: Michael Hayes Date: Tue, 10 Sep 2024 14:29:48 -0700 Subject: [PATCH] [drizzle] use getMappedArgumentValues --- .changeset/gold-eggs-clap.md | 5 +++++ packages/plugin-drizzle/src/utils/map-query.ts | 13 +++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) create mode 100644 .changeset/gold-eggs-clap.md diff --git a/.changeset/gold-eggs-clap.md b/.changeset/gold-eggs-clap.md new file mode 100644 index 000000000..0a18900ac --- /dev/null +++ b/.changeset/gold-eggs-clap.md @@ -0,0 +1,5 @@ +--- +"@pothos/plugin-drizzle": patch +--- + +use getMappedArgumentValues to improve relay compatibility diff --git a/packages/plugin-drizzle/src/utils/map-query.ts b/packages/plugin-drizzle/src/utils/map-query.ts index df7cced3c..e828f3f1d 100644 --- a/packages/plugin-drizzle/src/utils/map-query.ts +++ b/packages/plugin-drizzle/src/utils/map-query.ts @@ -1,9 +1,7 @@ -import { PothosValidationError } from '@pothos/core'; -import { - type DBQueryConfig, - RelationalSchemaConfig, - type TableRelationalConfig, - TablesRelationalConfig, +import { PothosValidationError, getMappedArgumentValues } from '@pothos/core'; +import type { + DBQueryConfig, + TableRelationalConfig, } from 'drizzle-orm'; import { type FieldNode, @@ -18,7 +16,6 @@ import { type InlineFragmentNode, Kind, type SelectionSetNode, - getArgumentValues, getDirectiveValues, getNamedType, isInterfaceType, @@ -291,7 +288,7 @@ function addFieldSelection( let fieldSelectionMap: DBQueryConfig<'one', false> | undefined; let mappings: LoaderMappings = {}; if (typeof fieldSelect === 'function') { - const args = getArgumentValues(field, selection, info.variableValues) as Record< + const args = getMappedArgumentValues(field, selection, context, info) as Record< string, unknown >;