Replaced the transport, giving it all of the functionality that was brought over to the client and making the client simply a place for the API to live. Essentially a shell that can easily be removed. spec'd out the TransportRequest which will eventually inherit from one of server possible promise implementations and will be plugable. It will also implement the "abort" functionality needed in an environment like node.js
32 lines
873 B
JavaScript
32 lines
873 B
JavaScript
var _ = require('../../../src/lib/utils');
|
|
var asset = require('assert');
|
|
var path = require('path');
|
|
var fs = require('fs');
|
|
var mkdirp = require('mkdirp');
|
|
var templates = require('./templates');
|
|
var clean = require('../../clean');
|
|
var urlParamRE = /\{(\w+)\}/g;
|
|
|
|
var outputPath = _.joinPath(__dirname, '../../../src/lib/api.js');
|
|
|
|
require('./actions').on('ready', function (actions) {
|
|
var defs = [];
|
|
|
|
var namespaces = _.filter(_.map(actions, function (action) {
|
|
if (~action.location.indexOf('.')) {
|
|
var path = action.location.split('.').slice(0, -1);
|
|
_.pull(path, 'prototype');
|
|
return path.join('.');
|
|
}
|
|
}));
|
|
|
|
clean(outputPath);
|
|
console.log('writing', actions.length, 'api actions to', outputPath);
|
|
fs.writeFileSync(outputPath, templates.apiFile({
|
|
actions: actions,
|
|
namespaces: _.unique(namespaces.sort(), true)
|
|
}));
|
|
});
|
|
|
|
|