All files / lib/model/nw/extensions Extender.js

100% Statements 8/8
100% Branches 0/0
100% Functions 2/2
100% Lines 8/8

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    3x 3x 3x                                           9x       9x 8x   9x       3x  
"use strict";
 
const SapExtenderBase = require("./sap/ExtenderBase");
const SapEntityTypeExtender = require("./sap/EntityTypeExtender");
const SapEntityContainerExtender = require("./sap/EntityContainerExtender");
 
/**
 * Envelope for vendor specific extensions.
 *
 * SAP extensions implemented
 *
 * https://wiki.scn.sap.com/wiki/display/EmTech/SAP+Annotations+for+OData+Version+2.0
 * https://github.com/SAP/odata-vocabularies
 *
 * @class Extender
 */
class Extender {
  /**
   * Applies available extensions to given schema.
   *
   * @static
   * @param {CsdlSchema} [schema] schema for extension
   * @param {Object} [settings] sparsing settings
   * @memberof Extender
   */
  static apply(schema, settings) {
    SapExtenderBase.applyAttributeExtension(
      schema,
      SapExtenderBase.ATTRIBUTES_SCHEMA
    );
    schema.entityTypes.forEach((et) =>
      SapEntityTypeExtender.process(et, schema, settings)
    );
    schema.entityContainers.forEach(SapEntityContainerExtender.process);
  }
}
 
module.exports = Extender;