UNPKG

oca_package

Version:

The wrapper of OCA bundle to generate OCA Package at ADC

31 lines (30 loc) 929 B
import { saidify } from 'saidify'; class Sensitive { constructor(dynOverlay) { if (!dynOverlay) { throw new Error('a dynamic extension overlay are required'); } this.dynOverlay = dynOverlay; } GetSensitiveAttributes() { const sensitive_overlay_attributes = this.dynOverlay.sensitive_attributes; // to match the canonicalization of of attributs in the capture base const sortedAttributes = sensitive_overlay_attributes.sort(); return sortedAttributes; } toJSON() { return { d: '', type: 'community/overlays/adc/sensitive/1.1', sensitive_attributes: this.GetSensitiveAttributes(), }; } Saidifying() { const [, sad] = saidify(this.toJSON()); return sad; } GenerateOverlay() { return JSON.stringify(this.Saidifying()); } } export default Sensitive;