@graphitation/supermassive
Advanced tools
Comparing version 3.5.0 to 3.5.1
# Change Log - @graphitation/supermassive | ||
This log was last generated on Thu, 07 Mar 2024 13:08:07 GMT and should not be manually modified. | ||
This log was last generated on Fri, 14 Jun 2024 18:43:34 GMT and should not be manually modified. | ||
<!-- Start content --> | ||
## 3.5.1 | ||
Fri, 14 Jun 2024 18:43:34 GMT | ||
### Patches | ||
- Revert back changes in execution where afterFieldResolve hook can return promise if async (sergeystoyan@microsoft.com) | ||
## 3.5.0 | ||
Thu, 07 Mar 2024 13:08:07 GMT | ||
Thu, 07 Mar 2024 13:08:30 GMT | ||
@@ -11,0 +19,0 @@ ### Minor changes |
@@ -559,3 +559,3 @@ "use strict"; | ||
); | ||
const isDefaultResolverUsed = resolveFn === exeContext.fieldResolver; | ||
const isDefaultResolverUsed = resolveFn === exeContext.fieldResolver || fieldName === "__typename"; | ||
const hooks = exeContext.fieldExecutionHooks; | ||
@@ -570,24 +570,46 @@ let hookContext = void 0; | ||
const result = resolveFn(source, args, contextValue, info); | ||
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldResolve)) { | ||
hookContext = invokeAfterFieldResolveHook( | ||
info, | ||
exeContext, | ||
hookContext, | ||
result | ||
); | ||
} | ||
let completed; | ||
if ((0, import_isPromise.isPromise)(result)) { | ||
completed = result.then((resolved) => { | ||
return completeValue( | ||
completed = result.then( | ||
(resolved) => { | ||
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldResolve)) { | ||
hookContext = invokeAfterFieldResolveHook( | ||
info, | ||
exeContext, | ||
hookContext, | ||
resolved | ||
); | ||
} | ||
return completeValue( | ||
exeContext, | ||
returnTypeRef, | ||
fieldGroup, | ||
info, | ||
path, | ||
resolved, | ||
incrementalDataRecord | ||
); | ||
}, | ||
(rawError) => { | ||
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldResolve)) { | ||
hookContext = invokeAfterFieldResolveHook( | ||
info, | ||
exeContext, | ||
hookContext, | ||
void 0, | ||
rawError | ||
); | ||
} | ||
throw rawError; | ||
} | ||
); | ||
} else { | ||
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldResolve)) { | ||
hookContext = invokeAfterFieldResolveHook( | ||
info, | ||
exeContext, | ||
returnTypeRef, | ||
fieldGroup, | ||
info, | ||
path, | ||
resolved, | ||
incrementalDataRecord | ||
hookContext, | ||
result | ||
); | ||
}); | ||
} else { | ||
} | ||
completed = completeValue( | ||
@@ -651,3 +673,4 @@ exeContext, | ||
hookContext, | ||
void 0 | ||
void 0, | ||
error | ||
); | ||
@@ -1158,3 +1181,3 @@ } | ||
} | ||
function invokeAfterFieldResolveHook(resolveInfo, exeContext, hookContext, result) { | ||
function invokeAfterFieldResolveHook(resolveInfo, exeContext, hookContext, result, error) { | ||
var _a; | ||
@@ -1170,7 +1193,8 @@ const hook = (_a = exeContext.fieldExecutionHooks) == null ? void 0 : _a.afterFieldResolve; | ||
hookContext, | ||
result | ||
result, | ||
error | ||
}), | ||
(_, rawError) => { | ||
if (rawError) { | ||
const error = toGraphQLError( | ||
const error2 = toGraphQLError( | ||
rawError, | ||
@@ -1180,3 +1204,3 @@ resolveInfo.path, | ||
); | ||
exeContext.errors.push(error); | ||
exeContext.errors.push(error2); | ||
} | ||
@@ -1183,0 +1207,0 @@ } |
@@ -12,9 +12,4 @@ import { ResolveInfo } from "../types"; | ||
export interface AfterFieldResolveHookArgs<ResolveContext, HookContext> extends PostExecuteFieldHookArgs<ResolveContext, HookContext> { | ||
/** | ||
* The result of the field execution _before_ completing the value. This | ||
* means the result may be a promise that is still pending, and the delta | ||
* between the time this hook and the `afterFieldComplete` hook is called | ||
* is the time it takes for the promise to resolve. | ||
*/ | ||
result?: unknown | Promise<unknown>; | ||
result?: unknown; | ||
error?: unknown; | ||
} | ||
@@ -21,0 +16,0 @@ export interface AfterFieldCompleteHookArgs<ResolveContext, HookContext> extends PostExecuteFieldHookArgs<ResolveContext, HookContext> { |
@@ -25,5 +25,14 @@ "use strict"; | ||
function printPathArray(path) { | ||
return path.map( | ||
(key) => typeof key === "number" ? "[" + key.toString() + "]" : "." + key | ||
).join(""); | ||
let result = ""; | ||
for (let i = 0; i < path.length; i++) { | ||
if (typeof path[i] === "number") { | ||
result += `[${path[i].toString()}]`; | ||
} else { | ||
if (i > 0) { | ||
result += "."; | ||
} | ||
result += path[i]; | ||
} | ||
} | ||
return result; | ||
} |
{ | ||
"name": "@graphitation/supermassive", | ||
"license": "MIT", | ||
"version": "3.5.0", | ||
"version": "3.5.1", | ||
"main": "./lib/index", | ||
@@ -6,0 +6,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1588292
15855