wappsto-redux
Advanced tools
Comparing version 3.0.10 to 3.1.0
@@ -1,2 +0,3 @@ | ||
import querystring from 'querystring'; | ||
import querystring from 'query-string'; | ||
import equal from 'deep-equal'; | ||
import config from '../config'; | ||
@@ -19,3 +20,3 @@ import { getUrlInfo, getServiceVersion } from '../util/helpers'; | ||
while ((match = search.exec(query))) | ||
while (match = search.exec(query)) | ||
urlParams[decode(match[1])] = decode(match[2]); | ||
@@ -61,3 +62,3 @@ return urlParams; | ||
} | ||
if(['PUT' , 'PATCH', 'POST'].indexOf(method) !== -1){ | ||
if(['GET', 'DELETE'].indexOf(method) === -1){ | ||
requestOptions.body = JSON.stringify(data); | ||
@@ -181,2 +182,17 @@ } | ||
function findRequest(state, url, data, options) { | ||
for (let id in state.request) { | ||
const stateRequest = state.request[id]; | ||
const rUrl = querystring.parseUrl(stateRequest.url); | ||
const parsedUrl = querystring.parseUrl(url); | ||
const rQuery = { ...stateRequest.query, ...rUrl.query }; | ||
const query = options.query ? { ...options.query, ...parsedUrl.query } : parsedUrl.query; | ||
if (equal(rUrl.url, parsedUrl.url) | ||
&& equal(rQuery, query) | ||
&& equal(stateRequest.data, data)) { | ||
return stateRequest.id; | ||
} | ||
} | ||
} | ||
let nextId = 1; | ||
@@ -198,2 +214,6 @@ export function makeRequest(method, url, data, options = {}) { | ||
const state = getState(); | ||
const existingRequest = findRequest(state, url, data, options); | ||
if (existingRequest) { | ||
return existingRequest; | ||
} | ||
const requestOptions = getOptions(method, result.url, data, result.options, state.session); | ||
@@ -200,0 +220,0 @@ const id = nextId; |
{ | ||
"name": "wappsto-redux", | ||
"version": "3.0.10", | ||
"version": "3.1.0", | ||
"description": "", | ||
@@ -24,4 +24,5 @@ "main": "index.js", | ||
"dependencies": { | ||
"deep-equal": "^2.0.3", | ||
"normalizr": "^3.4.1", | ||
"querystring": "^0.2.0", | ||
"query-string": "^6.13.1", | ||
"redux": "^4.0.4", | ||
@@ -28,0 +29,0 @@ "redux-thunk": "^2.3.0", |
import config from '../config'; | ||
export const UUIDRegex = '[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-b8-9][a-f0-9]{3}-[a-f0-9]{12}'; | ||
const rex = new RegExp('^' + UUIDRegex + '$', 'i'); | ||
export function isUUID(data){ | ||
try { | ||
if (data.match(/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-b8-9][a-f0-9]{3}-[a-f0-9]{12}$/i).length > 0) { | ||
if (data.match(rex).length > 0) { | ||
return true; | ||
@@ -7,0 +10,0 @@ } |
@@ -11,3 +11,3 @@ export function parse(json){ | ||
json.meta.id = json.path; | ||
return [json] | ||
return [json]; | ||
} | ||
@@ -14,0 +14,0 @@ } |
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
49482
1264
6
+ Addeddeep-equal@^2.0.3
+ Addedquery-string@^6.13.1
+ Addedarray-buffer-byte-length@1.0.2(transitive)
+ Addedavailable-typed-arrays@1.0.7(transitive)
+ Addedcall-bind@1.0.8(transitive)
+ Addedcall-bind-apply-helpers@1.0.1(transitive)
+ Addedcall-bound@1.0.3(transitive)
+ Addeddecode-uri-component@0.2.2(transitive)
+ Addeddeep-equal@2.2.3(transitive)
+ Addeddefine-data-property@1.1.4(transitive)
+ Addeddefine-properties@1.2.1(transitive)
+ Addeddunder-proto@1.0.1(transitive)
+ Addedes-define-property@1.0.1(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedes-get-iterator@1.1.3(transitive)
+ Addedes-object-atoms@1.0.0(transitive)
+ Addedfilter-obj@1.1.0(transitive)
+ Addedfor-each@0.3.3(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedfunctions-have-names@1.2.3(transitive)
+ Addedget-intrinsic@1.2.6(transitive)
+ Addedgopd@1.2.0(transitive)
+ Addedhas-bigints@1.1.0(transitive)
+ Addedhas-property-descriptors@1.0.2(transitive)
+ Addedhas-symbols@1.1.0(transitive)
+ Addedhas-tostringtag@1.0.2(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedinternal-slot@1.1.0(transitive)
+ Addedis-arguments@1.2.0(transitive)
+ Addedis-array-buffer@3.0.5(transitive)
+ Addedis-bigint@1.1.0(transitive)
+ Addedis-boolean-object@1.2.1(transitive)
+ Addedis-callable@1.2.7(transitive)
+ Addedis-date-object@1.1.0(transitive)
+ Addedis-map@2.0.3(transitive)
+ Addedis-number-object@1.1.1(transitive)
+ Addedis-regex@1.2.1(transitive)
+ Addedis-set@2.0.3(transitive)
+ Addedis-shared-array-buffer@1.0.4(transitive)
+ Addedis-string@1.1.1(transitive)
+ Addedis-symbol@1.1.1(transitive)
+ Addedis-weakmap@2.0.2(transitive)
+ Addedis-weakset@2.0.4(transitive)
+ Addedisarray@2.0.5(transitive)
+ Addedmath-intrinsics@1.1.0(transitive)
+ Addedobject-inspect@1.13.3(transitive)
+ Addedobject-is@1.1.6(transitive)
+ Addedobject-keys@1.1.1(transitive)
+ Addedobject.assign@4.1.7(transitive)
+ Addedpossible-typed-array-names@1.0.0(transitive)
+ Addedquery-string@6.14.1(transitive)
+ Addedregexp.prototype.flags@1.5.3(transitive)
+ Addedsafe-regex-test@1.1.0(transitive)
+ Addedset-function-length@1.2.2(transitive)
+ Addedset-function-name@2.0.2(transitive)
+ Addedside-channel@1.1.0(transitive)
+ Addedside-channel-list@1.0.0(transitive)
+ Addedside-channel-map@1.0.1(transitive)
+ Addedside-channel-weakmap@1.0.2(transitive)
+ Addedsplit-on-first@1.1.0(transitive)
+ Addedstop-iteration-iterator@1.1.0(transitive)
+ Addedstrict-uri-encode@2.0.0(transitive)
+ Addedwhich-boxed-primitive@1.1.1(transitive)
+ Addedwhich-collection@1.0.2(transitive)
+ Addedwhich-typed-array@1.1.18(transitive)
- Removedquerystring@^0.2.0
- Removedquerystring@0.2.1(transitive)