MCPcopy
hub / github.com/prisma/prisma / action

Function action

packages/client/src/runtime/core/model/applyModel.ts:78–111  ·  view source on GitHub ↗
(paramOverrides: O.Optional<InternalRequestParams>)

Source from the content-addressed store, hash-verified

76 // we return a function as the model action that we want to expose
77 // it takes user args and executes the request in a Prisma Promise
78 const action = (paramOverrides: O.Optional<InternalRequestParams>) => (userArgs?: UserArgs) => {
79 const callSite = getCallSite(client._errorFormat) // used for showing better errors
80
81 return client._createPrismaPromise(
82 (transaction) => {
83 const params: InternalRequestParams = {
84 // data and its dataPath for nested results
85 args: userArgs,
86 dataPath: [],
87
88 // action name and its related model
89 action: dmmfActionName,
90 model: dmmfModelName,
91
92 // method name for display only
93 clientMethod: `${jsModelName}.${key}`,
94 jsModelName,
95
96 // transaction information
97 transaction,
98
99 // stack trace
100 callsite: callSite,
101 }
102
103 return client._request({ ...params, ...paramOverrides })
104 },
105 {
106 action: dmmfActionName,
107 args: userArgs,
108 model: dmmfModelName,
109 },
110 )
111 }
112
113 // we give the control over action for building the fluent api
114 if ((fluentProps as readonly string[]).includes(dmmfActionName)) {

Callers 1

getPropertyValueFunction · 0.70

Calls 2

getCallSiteFunction · 0.90
_requestMethod · 0.80

Tested by

no test coverage detected