33 lines
1.3 KiB
TypeScript
33 lines
1.3 KiB
TypeScript
import { EntityDict } from '../oak-app-domain';
|
|
import { EntityDict as BaseEntityDict, SelectOpResult } from 'oak-domain/lib/types/Entity';
|
|
import { RuntimeContext } from './RuntimeContext';
|
|
import { BackendRuntimeContext as DependentBackendRuntimeContext } from 'oak-general-business/lib/context/BackendRuntimeContext';
|
|
import { unset } from 'oak-domain/lib/utils/lodash';
|
|
import { mergedProjection } from '../utils/application';
|
|
|
|
export class BackendRuntimeContext<ED extends EntityDict & BaseEntityDict> extends DependentBackendRuntimeContext<ED> implements RuntimeContext {
|
|
protected applicationProjection = mergedProjection;
|
|
async toString() {
|
|
const data = await this.getSerializedData();
|
|
return JSON.stringify(data);
|
|
}
|
|
|
|
async refineOpRecords(): Promise<void> {
|
|
await super.refineOpRecords();
|
|
for (const opRecord of this.opRecords) {
|
|
if (opRecord.a === 's') {
|
|
const { d } = opRecord as SelectOpResult<ED>;
|
|
for (const entity in d) {
|
|
if (
|
|
['application', 'system'].includes(entity)
|
|
) {
|
|
// todo 删除掉config中的敏感返回信息
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
};
|
|
|
|
export default BackendRuntimeContext; |