Added browser build, including angular version. minified versions available

This commit is contained in:
Spencer Alger
2013-10-29 19:47:00 -07:00
parent 2557202bf8
commit 286a08c8c2
29 changed files with 32934 additions and 518 deletions

View File

@ -26,7 +26,25 @@ function transformFile(entry) {
// itterate all of the specs within the file, should only be one
_.each(JSON.parse(entry.data), function (def, name) {
//camelcase the name
name = _.map(name.split('.'), _.camelCase).join('.');
var steps = name.split('.');
function transformParamKeys(note, param, key) {
var cmlKey = _.camelCase(key);
if (cmlKey !== key) {
param.name = key;
if (key.charAt(0) === '_') {
cmlKey = '_' + cmlKey;
}
}
note[cmlKey] = param;
}
def.url.params = _.transform(def.url.params, transformParamKeys, {});
def.url.parts = _.transform(def.url.parts, transformParamKeys, {});
var allParams = _.extend({}, def.url.params, def.url.parts);
var spec = {
name: name,
@ -53,6 +71,7 @@ function transformFile(entry) {
var optionalVars = {};
var requiredVars = {};
var param;
var name;
var target;
var match;
@ -61,19 +80,16 @@ function transformFile(entry) {
}
while (match = urlParamRE.exec(url)) {
param = def.url.parts[match[1]] || {};
name = _.camelCase(match[1]);
param = def.url.parts[name] || {};
target = (param.required || !param.default) ? requiredVars : optionalVars;
target[match[1]] = _.omit(param, 'required');
target[name] = _.omit(param, 'required', 'description', 'name');
}
[requiredVars, optionalVars].forEach(function (vars) {
_.each(vars, function (v, name) {
vars[name] = _.omit(v, 'description');
});
});
return _.omit({
fmt: url.replace(urlParamRE, '<%=$1%>'),
fmt: url.replace(urlParamRE, function (full, match) {
return '<%=' + _.camelCase(match) + '%>';
}),
opt: _.size(optionalVars) ? optionalVars : null,
req: _.size(requiredVars) ? requiredVars : null,
sortOrder: _.size(requiredVars) * -1
@ -87,15 +103,14 @@ function transformFile(entry) {
});
spec.params = _.transform(spec.params, function (note, param, name) {
param.name = name;
// param.name = name;
note[name] = _.pick(param, [
'type', 'default', 'options', 'required'
'type', 'default', 'options', 'required', 'name'
]);
}, {});
// escape method names with "special" keywords
var location = _.map(spec.name.split('.'), _.camelCase)
.join('.prototype.')
var location = spec.name.split('.').join('.prototype.')
.replace(/(^|\.)(delete|default)(\.|$)/g, '[\'$2\']');
var action = {

View File

@ -1,5 +1,5 @@
module.exports = {
'cluster.node_hot_threads': [
'cluster.nodeHotThreads': [
'/_cluster/nodes/hotthreads',
'/_cluster/nodes/hot_threads',
'/_nodes/hot_threads',
@ -7,7 +7,7 @@ module.exports = {
'/_cluster/nodes/{node_id}/hot_threads',
'/_nodes/{node_id}/hot_threads'
],
'cluster.node_info': [
'cluster.nodeInfo': [
'/_cluster/nodes',
'/_nodes/settings',
'/_nodes/os',
@ -29,10 +29,10 @@ module.exports = {
'/_nodes/{node_id}/http',
'/_nodes/{node_id}/plugin'
],
'cluster.node_shutdown': [
'cluster.nodeShutdown': [
'/_cluster/nodes/_shutdown'
],
'cluster.node_stats': [
'cluster.nodeStats': [
'/_cluster/nodes/stats',
'/_nodes/stats/{metric_family}',
'/_nodes/stats/indices/{metric}/{fields}',
@ -43,7 +43,7 @@ module.exports = {
'get': [
'/{index}/{type}/{id}/_source'
],
'indices.delete_mapping': [
'indices.deleteMapping': [
'/{index}/{type}/_mapping'
],
'indices.stats': [

View File

@ -1,3 +1,5 @@
/* jshint maxlen: false */
var ca = require('./client_action');
var errors = require('./errors');