Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | 1x 1x 1x 132x 5x 1x 1x 1x 1x | import { Assets, Asset, CalculatedChanges } from '../../../types'; import DefaultHandler from './default'; export const schema = { type: 'array', items: { type: 'object', properties: { key: { type: 'string', pattern: '^[A-Za-z0-9_-]*$' }, value: { type: 'string' }, }, required: ['key', 'value'], }, additionalProperties: false, }; export default class RulesConfigsHandler extends DefaultHandler { constructor(options: DefaultHandler) { super({ ...options, type: 'rulesConfigs', id: 'key', functions: { update: 'set', // Update or Creation of a ruleConfig is via set not update }, }); } async getType(): Promise<Asset[]> { return this.client.rulesConfigs.getAll(); } objString(item): string { return super.objString({ key: item.key }); } async calcChanges(assets: Assets): Promise<CalculatedChanges> { const { rulesConfigs } = assets; // Do nothing if not set Iif (!rulesConfigs || !rulesConfigs.length) return { del: [], update: [], create: [], conflicts: [], }; // Intention is to not delete/cleanup old configRules, that needs to be handled manually. return { del: [], update: rulesConfigs, create: [], conflicts: [], }; } } |