@zambezi/address
Advanced tools
Comparing version 2.0.0-omo.2 to 2.0.0-omo.3
@@ -60,11 +60,14 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
address: __webpack_require__(1) | ||
, response: __webpack_require__(22) | ||
, ok: __webpack_require__(23) | ||
, created: __webpack_require__(22) | ||
, error: __webpack_require__(16) | ||
, redirect: __webpack_require__(24) | ||
, into: __webpack_require__(25) | ||
, httpStatusCode: __webpack_require__(6) | ||
, stream: __webpack_require__(26) | ||
, interpolate: __webpack_require__(9) | ||
, into: __webpack_require__(23) | ||
, location: __webpack_require__(19) | ||
, interpolate: __webpack_require__(9) | ||
, middleware: __webpack_require__(24) | ||
, ok: __webpack_require__(25) | ||
, redirect: __webpack_require__(26) | ||
, response: __webpack_require__(27) | ||
, serialize: __webpack_require__(28) | ||
, stream: __webpack_require__(29) | ||
} | ||
@@ -765,14 +768,48 @@ }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) | ||
var location = __webpack_require__(20) | ||
, state = location.state() | ||
, findClosest = __webpack_require__(5) | ||
, rebind = __webpack_require__(18) | ||
, dispatch = __webpack_require__(17).dispatch | ||
, dispatcher = dispatch('statechange') | ||
, on = __webpack_require__(21) | ||
, ignoreFlag = false | ||
location.on('statechange.location', handleStateChange) | ||
function handleStateChange() { | ||
if(ignore()) return ignore(false) | ||
setState(location.state()) | ||
ignore(false) | ||
} | ||
function ignore(value) { | ||
if(!arguments.length) return ignoreFlag | ||
ignoreFlag = value | ||
} | ||
function pushState(value) { | ||
if(isCurrentState(value)) return | ||
ignore(true) | ||
currentState(value) | ||
location.state(value) | ||
return true | ||
} | ||
function setState(value) { | ||
var pushed = pushState(value) | ||
if (pushed) dispatcher.statechange(value) | ||
} | ||
function currentState(value) { | ||
if(!arguments.length) return state | ||
state = value | ||
} | ||
function isCurrentState(value) { | ||
return value == currentState() | ||
} | ||
return function createComponent(web, address) { | ||
var state = location.state() | ||
, dispatcher = dispatch('statechange') | ||
, ignoreFlag = false | ||
, api = {} | ||
var api = {} | ||
location.on('statechange', handleStateChange) | ||
on.call(document, 'click.location', handleClick) | ||
@@ -787,35 +824,2 @@ | ||
function handleStateChange() { | ||
if(ignore()) return ignore(false) | ||
setState(location.state()) | ||
ignore(false) | ||
} | ||
function pushState(value) { | ||
if(isCurrentState(value)) return | ||
ignore(true) | ||
currentState(value) | ||
location.state(value) | ||
return true | ||
} | ||
function setState(value) { | ||
var pushed = pushState(value) | ||
if (pushed) dispatcher.statechange(value) | ||
} | ||
function currentState(value) { | ||
if(!arguments.length) return state | ||
state = value | ||
} | ||
function ignore(value) { | ||
if(!arguments.length) return ignoreFlag | ||
ignoreFlag = value | ||
} | ||
function isCurrentState(value) { | ||
return value == currentState() | ||
} | ||
function openNewWindow(path, target) { | ||
@@ -953,10 +957,13 @@ window.open(location.hrefFromPath(path), target, '') | ||
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function() { | ||
return function(code, body, headers) { | ||
return function(location, body) { | ||
return { | ||
statusCode : code | ||
, headers : headers || {} | ||
statusCode : 201 | ||
, body : body | ||
, headers : { | ||
location : location | ||
} | ||
} | ||
} | ||
}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) | ||
@@ -967,2 +974,55 @@ /***/ }, | ||
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(1) | ||
], __WEBPACK_AMD_DEFINE_RESULT__ = function(address) { | ||
return function(resource) { | ||
address(resource).into(this)() | ||
} | ||
}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) | ||
/***/ }, | ||
/* 24 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
var __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require) { | ||
var error = __webpack_require__(16) | ||
return { | ||
requestTimeout : function(req, res, next) { | ||
var responded | ||
, timeout = setTimeout(function() { | ||
responded = true | ||
res(null, error(408)) | ||
}, 30000) | ||
next(req, function(err, data) { | ||
clearTimeout(timeout) | ||
!responded && res(err, data) | ||
}) | ||
} | ||
, logger : function(log) { | ||
return function(req, res, next) { | ||
next(req, function(err, data) { | ||
if(data.statusCode == 302) log.debug(data.statusCode, req.uri, data.headers.location) | ||
if(data.statusCode >= 400) { | ||
log.debug(data.statusCode, 'address failed to load resource:', req.uri, req.method, data.body || '') | ||
} | ||
res(err, data) | ||
}) | ||
} | ||
} | ||
} | ||
}.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) | ||
/***/ }, | ||
/* 25 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(3) | ||
@@ -976,3 +1036,3 @@ ], __WEBPACK_AMD_DEFINE_RESULT__ = function(nap) { | ||
/***/ }, | ||
/* 24 */ | ||
/* 26 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -993,21 +1053,38 @@ | ||
/***/ }, | ||
/* 25 */ | ||
/* 27 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(1) | ||
], __WEBPACK_AMD_DEFINE_RESULT__ = function(address) { | ||
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function() { | ||
return function(code, body, headers) { | ||
return { | ||
statusCode : code | ||
, headers : headers || {} | ||
, body : body | ||
} | ||
} | ||
}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) | ||
/***/ }, | ||
/* 28 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function() { | ||
return function(resource) { | ||
address(resource).into(this)() | ||
return function(query) { | ||
var params = Object.keys(query).reduce(function(a,k) { | ||
a.push(k + '=' + query[k]) | ||
return a | ||
},[]) | ||
return params.length ? '?' + params.join('&') : '' | ||
} | ||
}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) | ||
}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) | ||
/***/ }, | ||
/* 26 */ | ||
/* 29 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
var __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_RESULT__ = function (require) { | ||
var dispatch = __webpack_require__(27) | ||
, redispatch = __webpack_require__(28) | ||
var dispatch = __webpack_require__(30) | ||
, redispatch = __webpack_require__(31) | ||
, rebind = __webpack_require__(18) | ||
@@ -1035,3 +1112,3 @@ | ||
/***/ }, | ||
/* 27 */ | ||
/* 30 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -1090,3 +1167,3 @@ | ||
/***/ }, | ||
/* 28 */ | ||
/* 31 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -1093,0 +1170,0 @@ |
{ | ||
"name": "@zambezi/address", | ||
"version": "2.0.0-omo.2", | ||
"version": "2.0.0-omo.3", | ||
"description": "API for nap resources", | ||
@@ -5,0 +5,0 @@ "main": "lib/address.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
94172
961