From 022570d70093c66e148ed8301b68436b808b6bce Mon Sep 17 00:00:00 2001 From: Xc Date: Fri, 17 May 2024 16:31:55 +0800 Subject: [PATCH] 1.0.6-pub --- es/components/AbstractComponents.d.ts | 8 +++---- es/context/BackendRuntimeContext.d.ts | 1 + es/context/BackendRuntimeContext.js | 24 ++++++++++++++++++++ lib/context/BackendRuntimeContext.d.ts | 1 + lib/context/BackendRuntimeContext.js | 24 ++++++++++++++++++++ package.json | 10 ++++----- src/context/BackendRuntimeContext.ts | 31 +++++++++++++++++++++++++- 7 files changed, 89 insertions(+), 10 deletions(-) diff --git a/es/components/AbstractComponents.d.ts b/es/components/AbstractComponents.d.ts index 3794714f..c75f8b52 100644 --- a/es/components/AbstractComponents.d.ts +++ b/es/components/AbstractComponents.d.ts @@ -20,7 +20,7 @@ declare const List: (props: ReactComponentProps(props: { tablePagination?: any; rowSelection?: any; disableSerialNumber?: boolean | undefined; - size?: "small" | "middle" | "large" | undefined; + size?: "small" | "large" | "middle" | undefined; scroll?: any; locale?: any; opWidth?: number | undefined; @@ -57,14 +57,14 @@ declare const Detail: (props: ReactComponentProps; title?: string | undefined; bordered?: boolean | undefined; - layout?: "vertical" | "horizontal" | undefined; + layout?: "horizontal" | "vertical" | undefined; }>) => React.ReactElement; declare const Upsert: (props: ReactComponentProps; entity: T; attributes: OakAbsAttrUpsertDef[]; data: EntityDict[T]["Schema"]; - layout: "vertical" | "horizontal"; + layout: "horizontal" | "vertical"; mode: "default" | "card"; }>) => React.ReactElement; export { FilterPanel, List, ListPro, Detail, Upsert, ReactComponentProps, ColumnProps, RowWithActions, OakExtraActionProps, OakAbsAttrDef, onActionFnDef, }; diff --git a/es/context/BackendRuntimeContext.d.ts b/es/context/BackendRuntimeContext.d.ts index 35f569ed..e0b746fe 100644 --- a/es/context/BackendRuntimeContext.d.ts +++ b/es/context/BackendRuntimeContext.d.ts @@ -4,5 +4,6 @@ import { RuntimeContext } from './RuntimeContext'; import { BackendRuntimeContext as DependentBackendRuntimeContext } from './DependentContext'; export declare class BackendRuntimeContext extends DependentBackendRuntimeContext implements RuntimeContext { toString(): Promise; + refineOpRecords(): Promise; } export default BackendRuntimeContext; diff --git a/es/context/BackendRuntimeContext.js b/es/context/BackendRuntimeContext.js index 03486f9f..dc37390d 100644 --- a/es/context/BackendRuntimeContext.js +++ b/es/context/BackendRuntimeContext.js @@ -1,9 +1,33 @@ import { BackendRuntimeContext as DependentBackendRuntimeContext } from './DependentContext'; +import { unset } from 'oak-domain/lib/utils/lodash'; export class BackendRuntimeContext extends DependentBackendRuntimeContext { async toString() { const data = await this.getSerializedData(); return JSON.stringify(data); } + async refineOpRecords() { + await super.refineOpRecords(); + for (const opRecord of this.opRecords) { + if (opRecord.a === 's') { + const { d } = opRecord; + for (const entity in d) { + if (['application', 'system'].includes(entity)) { + // todo 删除掉config中的敏感返回信息 + const rowDict = d[entity]; + for (const id in rowDict) { + const { payConfig } = rowDict[id]; + if (payConfig) { + payConfig.forEach((config) => { + unset(config, 'publicKeyFilePath'); + unset(config, 'privateKeyFilePath'); + }); + } + } + } + } + } + } + } } ; export default BackendRuntimeContext; diff --git a/lib/context/BackendRuntimeContext.d.ts b/lib/context/BackendRuntimeContext.d.ts index 35f569ed..e0b746fe 100644 --- a/lib/context/BackendRuntimeContext.d.ts +++ b/lib/context/BackendRuntimeContext.d.ts @@ -4,5 +4,6 @@ import { RuntimeContext } from './RuntimeContext'; import { BackendRuntimeContext as DependentBackendRuntimeContext } from './DependentContext'; export declare class BackendRuntimeContext extends DependentBackendRuntimeContext implements RuntimeContext { toString(): Promise; + refineOpRecords(): Promise; } export default BackendRuntimeContext; diff --git a/lib/context/BackendRuntimeContext.js b/lib/context/BackendRuntimeContext.js index c02428a2..5ebe34cb 100644 --- a/lib/context/BackendRuntimeContext.js +++ b/lib/context/BackendRuntimeContext.js @@ -2,11 +2,35 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.BackendRuntimeContext = void 0; const DependentContext_1 = require("./DependentContext"); +const lodash_1 = require("oak-domain/lib/utils/lodash"); class BackendRuntimeContext extends DependentContext_1.BackendRuntimeContext { async toString() { const data = await this.getSerializedData(); return JSON.stringify(data); } + async refineOpRecords() { + await super.refineOpRecords(); + for (const opRecord of this.opRecords) { + if (opRecord.a === 's') { + const { d } = opRecord; + for (const entity in d) { + if (['application', 'system'].includes(entity)) { + // todo 删除掉config中的敏感返回信息 + const rowDict = d[entity]; + for (const id in rowDict) { + const { payConfig } = rowDict[id]; + if (payConfig) { + payConfig.forEach((config) => { + (0, lodash_1.unset)(config, 'publicKeyFilePath'); + (0, lodash_1.unset)(config, 'privateKeyFilePath'); + }); + } + } + } + } + } + } + } } exports.BackendRuntimeContext = BackendRuntimeContext; ; diff --git a/package.json b/package.json index 4a55211e..e42f9204 100644 --- a/package.json +++ b/package.json @@ -50,11 +50,11 @@ "js-base64": "^3.7.2", "lodash": "^4.17.21", "nprogress": "^0.2.0", - "oak-domain": "file:../oak-domain", - "oak-external-sdk": "file:../oak-external-sdk", - "oak-frontend-base": "file:../oak-frontend-base", - "oak-memory-tree-store": "file:../oak-memory-tree-store", - "oak-general-business": "file:../oak-general-business", + "oak-domain": "~5.0.7", + "oak-external-sdk": "~2.3.0", + "oak-frontend-base": "~5.0.8", + "oak-memory-tree-store": "~3.3.0", + "oak-general-business": "~5.0.8", "react": "^18.2.0", "react-dom": "^18.1.0", "react-image-gallery": "^1.2.11", diff --git a/src/context/BackendRuntimeContext.ts b/src/context/BackendRuntimeContext.ts index 920de1f5..29179043 100644 --- a/src/context/BackendRuntimeContext.ts +++ b/src/context/BackendRuntimeContext.ts @@ -1,13 +1,42 @@ import { EntityDict } from '@project/oak-app-domain'; -import { EntityDict as BaseEntityDict } from 'oak-domain/lib/types/Entity'; +import { EntityDict as BaseEntityDict, SelectOpResult } from 'oak-domain/lib/types/Entity'; import { RuntimeContext } from './RuntimeContext'; import { BackendRuntimeContext as DependentBackendRuntimeContext } from './DependentContext'; +import { unset } from 'oak-domain/lib/utils/lodash'; export class BackendRuntimeContext extends DependentBackendRuntimeContext implements RuntimeContext { async toString() { const data = await this.getSerializedData(); return JSON.stringify(data); } + + async refineOpRecords(): Promise { + await super.refineOpRecords(); + for (const opRecord of this.opRecords) { + if (opRecord.a === 's') { + const { d } = opRecord as SelectOpResult; + for (const entity in d) { + if ( + ['application', 'system'].includes(entity) + ) { + // todo 删除掉config中的敏感返回信息 + const rowDict = d[entity as 'system']; + for (const id in rowDict) { + const { payConfig } = rowDict[id] as EntityDict['system']['OpSchema']; + if (payConfig) { + payConfig.forEach( + (config) => { + unset(config, 'publicKeyFilePath'); + unset(config, 'privateKeyFilePath'); + } + ); + } + } + } + } + } + } + } }; export default BackendRuntimeContext; \ No newline at end of file