MCPcopy Create free account
hub / github.com/zenstackhq/zenstack / applyExtResult

Function applyExtResult

packages/orm/src/client/client-impl.ts:1083–1099  ·  view source on GitHub ↗

* Applies extended result field computation to query results (recursive). * Processes the current model's ext result fields, then recurses into nested relation data.

(
    result: unknown,
    model: string,
    originalArgs: unknown,
    schema: SchemaDef,
    plugins: AnyPlugin[],
)

Source from the content-addressed store, hash-verified

1081 * Processes the current model's ext result fields, then recurses into nested relation data.
1082 */
1083function applyExtResult(
1084 result: unknown,
1085 model: string,
1086 originalArgs: unknown,
1087 schema: SchemaDef,
1088 plugins: AnyPlugin[],
1089): unknown {
1090 const extResultDefs = collectExtResultFieldDefs(model, schema, plugins);
1091 if (Array.isArray(result)) {
1092 for (let i = 0; i < result.length; i++) {
1093 result[i] = applyExtResultToRow(result[i], model, originalArgs, schema, plugins, extResultDefs);
1094 }
1095 return result;
1096 } else {
1097 return applyExtResultToRow(result, model, originalArgs, schema, plugins, extResultDefs);
1098 }
1099}
1100
1101function applyExtResultToRow(
1102 row: unknown,

Callers 2

proceedFunction · 0.85
applyExtResultToRowFunction · 0.85

Calls 2

applyExtResultToRowFunction · 0.85

Tested by

no test coverage detected