(source: any, key: string, value: any)
| 70 | } |
| 71 | |
| 72 | applyDelta(source: any, key: string, value: any) { |
| 73 | const path = key.split('.'); |
| 74 | if (path.some((i) => SettingService.blacklist.includes(i))) return false; |
| 75 | const t = path.pop(); |
| 76 | const root = JSON.parse(JSON.stringify(source)); |
| 77 | let cursor = root; |
| 78 | for (const p of path) { |
| 79 | cursor[p] ??= {}; |
| 80 | cursor = cursor[p]; |
| 81 | } |
| 82 | cursor[t] = value; |
| 83 | return root; |
| 84 | } |
| 85 | |
| 86 | isPatchValid(key: string, value: any) { |
| 87 | const root = this.applyDelta(this.systemConfig, key, value); |
no test coverage detected