lib/client
DgraphClientError
扩展
构造函数
new DgraphClientError(errors, query, variables)
new DgraphClientError(
errors,
query,
variables): DgraphClientError参数
| 参数 | 类型 |
|---|---|
错误 | any[] |
query | string |
variables | any |
返回值
重写
Error.constructor
属性
message
message: string;继承自
Error.message
name
name: string = "DgraphClientError";重写
Error.name
stack?
optional stack: string;继承自
Error.stack
prepareStackTrace()?
static optional prepareStackTrace: (err, stackTraces) => any;格式化堆栈跟踪的可选重写
查看
https://v8.node.org.cn/docs/stack-trace-api#customizing-stack-traces
参数
| 参数 | 类型 |
|---|---|
err | Error |
stackTraces | CallSite[] |
返回值
any
继承自
Error.prepareStackTrace
stackTraceLimit
static stackTraceLimit: number;继承自
Error.stackTraceLimit
方法
captureStackTrace()
static captureStackTrace(targetObject, constructorOpt?): void在目标对象上创建 .stack 属性
参数
| 参数 | 类型 |
|---|---|
targetObject | object |
constructorOpt? | Function |
返回值
void
继承自
Error.captureStackTrace
DgraphClientParams
属性
authHeader?
optional authHeader: string;默认
"Authorization"
[Using JWT and authorization claims](https://dgraph.io/docs/graphql/authorization/authorization-overview#using-jwts-and-authorization-claims)authToken
authToken: string;X-Auth-Token 标头值
endpoint
endpoint: string;jwtAlgorithm?
optional jwtAlgorithm: "HS256" | "RS256";默认
"RS256"
[Using JWT and authorization claims](https://dgraph.io/docs/graphql/authorization/authorization-overview#using-jwts-and-authorization-claims)jwtSecret?
optional jwtSecret: string;client()
client(params): {
run: Promise<null | T>;
}参数
| 参数 | 类型 |
|---|---|
params | DgraphClientParams |
返回值
{
run: Promise<null | T>;
}run()
类型参数
| 类型参数 |
|---|
T |
参数
| 参数 | 类型 |
|---|---|
query | string |
variables? | Record<string, any> |
返回值
Promise<null | T>