Skip to content

Commit

Permalink
args.get -> args.getRaw
Browse files Browse the repository at this point in the history
  • Loading branch information
benjie committed Feb 14, 2025
1 parent 6d7eb3f commit bfc5690
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import type {
} from "grafast";
import {
__ListTransformStep,
bakedInput,
connection,
constant,
object,
Expand Down Expand Up @@ -569,6 +570,7 @@ export const PgCustomTypeFieldPlugin: GraphileConfig.Plugin = {
(
argDetailsLength,
argDetailsSimple,
bakedInput,
constant,
indexAfterWhichAllArgsAreNamed,
) =>
Expand All @@ -584,7 +586,8 @@ export const PgCustomTypeFieldPlugin: GraphileConfig.Plugin = {
required,
fetcher,
} = argDetailsSimple[i];
const $raw = args.getRaw([...path, graphqlArgName]);
const fullPath = [...path, graphqlArgName];
const $raw = args.getRaw(fullPath);
let step: ExecutableStep;
if ($raw.evalIs(undefined)) {
if (
Expand All @@ -599,11 +602,11 @@ export const PgCustomTypeFieldPlugin: GraphileConfig.Plugin = {
} else if (fetcher) {
step = (
fetcher(
args.get([...path, graphqlArgName]),
$raw as ExecutableStep<string>,
) as PgSelectSingleStep
).record();
} else {
step = args.get([...path, graphqlArgName]);
step = bakedInput(args.typeAt(fullPath), $raw);
}

if (skipped) {
Expand Down Expand Up @@ -631,6 +634,7 @@ export const PgCustomTypeFieldPlugin: GraphileConfig.Plugin = {
[
argDetailsLength,
argDetailsSimple,
bakedInput,
constant,
indexAfterWhichAllArgsAreNamed,
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ export const PgMutationUpdateDeletePlugin: GraphileConfig.Plugin = {
([attributeName, fieldName]) =>
te`${te.safeKeyOrThrow(
attributeName,
)}: args.get(['input', ${te.lit(fieldName)}])`,
)}: args.getRaw(['input', ${te.lit(fieldName)}])`,
),
", ",
)} }`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ return function (resource) {
return (_$root, args) => resource.get({ ${te.join(
attributeNames.map(
(attributeName) =>
te`${te.safeKeyOrThrow(attributeName)}: args.get(${te.lit(
te`${te.safeKeyOrThrow(attributeName)}: args.getRaw(${te.lit(
detailsByAttributeName[attributeName].graphqlName,
)})`,
),
Expand All @@ -180,7 +180,7 @@ return function (resource) {
function plan(_$root: any, args: FieldArgs) {
const spec = Object.create(null);
for (const attributeName in detailsByAttributeName) {
spec[attributeName] = args.get(
spec[attributeName] = args.getRaw(
detailsByAttributeName[attributeName]
.graphqlName,
);
Expand Down
2 changes: 1 addition & 1 deletion postgraphile/pgl/graphile.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ const preset: GraphileConfig.Preset = {
Subscription: {
// Test via SQL: `NOTIFY test, '{"a":40}';`
sub(_$root, args) {
const $topic = args.get("topic");
const $topic = args.getRaw("topic");
const $pgSubscriber = context().get("pgSubscriber");
return listen($pgSubscriber, $topic, ($payload) =>
object({ sub: jsonParse($payload).get("a" as never) }),
Expand Down
2 changes: 1 addition & 1 deletion postgraphile/postgraphile/graphile.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ const preset: GraphileConfig.Preset = {
// Test via SQL: `NOTIFY test, '{"a":40}';`
sub: EXPORTABLE(
(context, jsonParse, listen, object) => (_$root, args) => {
const $topic = args.get("topic");
const $topic = args.getRaw("topic");
const $pgSubscriber = context().get("pgSubscriber");
return listen($pgSubscriber, $topic, ($payload) =>
object({ sub: jsonParse($payload).get("a" as never) }),
Expand Down

0 comments on commit bfc5690

Please sign in to comment.