fix auth error in transactor rcp (#7661)

Signed-off-by: Nikolay Chunosov <Chunosov.N@gmail.com>
This commit is contained in:
Chunosov 2025-01-14 15:37:34 +07:00 committed by GitHub
parent 6711ceb877
commit e81100cbaf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 7 deletions

View File

@ -2,11 +2,8 @@
root = true
[*]
indent_style = tab
indent_style = space
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.yml]
indent_style = space

View File

@ -68,7 +68,7 @@ class TransactorRpcTarget extends RpcTarget {
}
async getModel (): Promise<any> {
return (this.transactor as any).getModel()
return (this.transactor as any).getModel(this.token)
}
async getAccount (): Promise<any> {

View File

@ -387,6 +387,7 @@ export class Transactor extends DurableObject<Env> {
const session = await this.makeRpcSession(rawToken, cs)
const pipeline =
session.workspace.pipeline instanceof Promise ? await session.workspace.pipeline : session.workspace.pipeline
;(session as any).includeSessionContext(this.measureCtx, pipeline)
result = await pipeline.findAll(this.measureCtx, _class, query ?? {}, options ?? {})
} catch (error: any) {
result = { error: `${error}` }
@ -403,7 +404,8 @@ export class Transactor extends DurableObject<Env> {
const session = await this.makeRpcSession(rawToken, cs)
const pipeline =
session.workspace.pipeline instanceof Promise ? await session.workspace.pipeline : session.workspace.pipeline
await pipeline.tx(this.measureCtx, [tx])
;(session as any).includeSessionContext(this.measureCtx, pipeline)
result = await pipeline.tx(this.measureCtx, [tx])
} catch (error: any) {
result = { error: `${error}` }
} finally {
@ -419,6 +421,7 @@ export class Transactor extends DurableObject<Env> {
const session = await this.makeRpcSession(rawToken, cs)
const pipeline =
session.workspace.pipeline instanceof Promise ? await session.workspace.pipeline : session.workspace.pipeline
;(session as any).includeSessionContext(this.measureCtx, pipeline)
const ret = await pipeline.loadModel(this.measureCtx, 0)
if (Array.isArray(ret)) {
result = ret
@ -426,7 +429,7 @@ export class Transactor extends DurableObject<Env> {
result = ret.transactions
}
} catch (error: any) {
result = []
return { error: `${error}` }
} finally {
await this.sessionManager.close(this.measureCtx, cs, this.workspace)
}