packages/api-gateway/src/index.js
function loadIntegrations(region, context, endpoints) {
  // The `deployIntegrations` hook takes four arguments
  // The region of the deployment
  // The "context" of the deployment
  // The list of endpoints that must be deployed
  // An array that will receive integration results
  const integrationDataInjectors = [];
  return plugin.myrmex.fire('loadIntegrations', region, context, endpoints, integrationDataInjectors)
  .spread((region, context, endpoints, integrationDataInjectors) => {
    // At this point, integration plugins returned their integrationDataInjectors
    return plugin.myrmex.fire('beforeAddIntegrationDataToEndpoints', endpoints, integrationDataInjectors);
  })
  .spread((endpoints, integrationDataInjectors) => {
    return Promise.map(integrationDataInjectors, (integrationDataInjector) => {
      return Promise.map(endpoints, (endpoint) => {
        return integrationDataInjector.applyToEndpoint(endpoint);
      });
    })
    .then(() => {
      return plugin.myrmex.fire('afterAddIntegrationDataToEndpoints', endpoints, integrationDataInjectors);
    });
  })
  .spread((endpoints, integrationDataInjectors) => {
    return Promise.resolve(endpoints);
  });
}
function loadIntegrations(region, context, endpoints) {
  // The `deployIntegrations` hook takes four arguments
  // The region of the deployment
  // The "context" of the deployment
  // The list of endpoints that must be deployed
  // An array that will receive integration results
  const integrationDataInjectors = [];
  return plugin.myrmex.fire('loadIntegrations', region, context, endpoints, integrationDataInjectors)
  .spread((region, context, endpoints, integrationDataInjectors) => {
    // At this point, integration plugins returned their integrationDataInjectors
    return plugin.myrmex.fire('beforeAddIntegrationDataToEndpoints', endpoints, integrationDataInjectors);
  })
  .spread((endpoints, integrationDataInjectors) => {
    return Promise.map(integrationDataInjectors, (integrationDataInjector) => {
      return Promise.map(endpoints, (endpoint) => {
        return integrationDataInjector.applyToEndpoint(endpoint);
      });
    })
    .then(() => {
      return plugin.myrmex.fire('afterAddIntegrationDataToEndpoints', endpoints, integrationDataInjectors);
    });
  })
  .spread((endpoints, integrationDataInjectors) => {
    return Promise.resolve(endpoints);
  });
}
function loadIntegrations ( region , context , endpoints ) { // The `deployIntegrations` hook takes four arguments // The region of the deployment // The "context" of the deployment // The list of endpoints that must be deployed // An array that will receive integration results const integrationDataInjectors = [ ] ; return plugin . myrmex . fire ( 'loadIntegrations' , region , context , endpoints , integrationDataInjectors ) . spread ( ( region , context , endpoints , integrationDataInjectors ) => { // At this point, integration plugins returned their integrationDataInjectors return plugin . myrmex . fire ( 'beforeAddIntegrationDataToEndpoints' , endpoints , integrationDataInjectors ) ; } ) . spread ( ( endpoints , integrationDataInjectors ) => { return Promise . map ( integrationDataInjectors , ( integrationDataInjector ) => { return Promise . map ( endpoints , ( endpoint ) => { return integrationDataInjector . applyToEndpoint ( endpoint ) ; } ) ; } ) . then ( ( ) => { return plugin . myrmex . fire ( 'afterAddIntegrationDataToEndpoints' , endpoints , integrationDataInjectors ) ; } ) ; } ) . spread ( ( endpoints , integrationDataInjectors ) => { return Promise . resolve ( endpoints ) ; } ) ; }
Update the configuration of endpoints with data returned by integration
This data can come from the deployment of a lambda function, the configuration
of an HTTP proxy, the generation of a mock etc ...
@param  {string} region - AWS region
@param  {string} stage - API stage
@param  {string} environment - environment identifier
@returns {[IntegrationObject]} - an array of integrqtion objects
Update the configuration of endpoints with data returned by integration This data can come from the deployment of a lambda function the configuration of an HTTP proxy the generation of a mock etc ...