JavaScript Extension Development API for Oracle Visual Builder Cloud Service - Classic Applications

Source: bop/js/spi/operation/BOPAuthenticator.js

define([], function () {
    'use strict';

    /**
     * BOPAuthenticator provides a bridge between BOP writers and the existing
     * authentication system, this interface defines the SPI.
     *
     * @version 17.1.1
     * @AbcsExtension stable
     * @exports bop/js/spi/operation/BOPAuthenticator
     *
     * @constructor
     * @private
     */
    var BOPAuthenticator = function () {
    };

    /**
     * Invokes a remote rest service using the authentication configuration
     * provided to the BOP along with any extra ajax configuration parameters
     * provided. This causes the required authentication headers and proxies to
     * be applied to the request transparently.
     *
     * <p>A default conversion to {@link operation/js/api/OperationResult OperationResult} is provided
     * but these by can of course be override by then/catch and then just returning a new promise
     * with the modified data.</p>
     *
     * <p>The default setting if no ajax override is provided is a GET request assuming that
     * the any content of of type application/json</p>
     *
     * @version 17.1.1
     * @AbcsExtension stable
     *
     * @param {ajaxObject} ajaxObject A JQuery AJAX configuraiton object that can use used to customize the request
     * @returns {Promise<operation/js/api/OperationResult>} - Promise of the {@link operation/js/api/OperationResult OperationResult} for this operation.

     * @see {@link operation/js/api/Operation#perform Operation.perform(..)}
     *
     * @example
     * <caption>
     *   Take an existing authenticator and use it to implement an OperationProvider
     * </caption>
     *
     *  var authenticator = this.getBOPAuthenticator();
     *
     *  var performOperation = function (inputData) {
     *      var ajaxObj = {
     *          method: 'POST',
     *          url: dependencies[0].getDefinition().parameters.baseUri + ...,
     *      };
     *
     *      return authenticator.invoke(ajaxObj);
     *  };
     *
     *  var employeeEntity = Abcs.Entities().findById('my.custom.bop.Employee');
     *  var findEmployeesNearlyAtRetirement = new OperationBuilder({
     *      name: 'Query employees ready for retirement',
     *      type: Operation.Type.READ_MANY,
     *      performs: performOperation
     *  }).returns(employeeEntity).build();
     *
      */
    BOPAuthenticator.prototype.invoke = function (ajaxObject) { //eslint-disable-line no-unused-vars
    };

    return AbcsLib.initInterface(BOPAuthenticator, 'BOPAuthenticator');
});