Skip to content

Commit 54b899e

Browse files
committed
Updated to v1.4.5
1 parent 1a283c1 commit 54b899e

22 files changed

+547
-223
lines changed

Gruntfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ module.exports = function (grunt) {
331331
jscover: {
332332
command: 'java',
333333
jarName: 'coverage/JSCover-all.jar',
334-
javaArgs: '-fs dist/debug coverage/dist/debug --no-instrument=impl/fetch.js --no-instrument=<%= pouchdb_bundle %>'
334+
javaArgs: '-fs dist/debug coverage/dist/debug --no-instrument=impl/sql-where-parser.min.js --no-instrument=impl/fetch.js --no-instrument=<%= pouchdb_bundle %>'
335335
}
336336
}
337337
});

JSDOC.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# offline-persistence-toolkit 1.4.4 #
1+
# offline-persistence-toolkit 1.4.5 #
22

33
## Introduction ##
44

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# offline-persistence-toolkit 1.4.4 #
1+
# offline-persistence-toolkit 1.4.5 #
22

33
offline-persistence-toolkit is a client-side JavaScript library that provides caching and offline support at the HTTP request layer. This support is transparent to the user and is done through the Fetch API and an XHR adapter. HTTP requests made while the client device is offline are captured for replay when connection to the server is restored. Additional capabilities include a persistent storage layer, synchronization manager, binary data support and various configuration APIs for customizing the default behavior. This framework can be used in both ServiceWorker and non-ServiceWorker contexts within web and hybrid mobile apps.
44

@@ -58,16 +58,16 @@ If your app uses [RequireJS](http://www.requirejs.org/ "RequireJS"), update the
5858
```javascript
5959
requirejs.config({
6060
paths: {
61-
'persist' : 'js/libs/persist/v1.4.4/min'
61+
'persist' : 'js/libs/persist/v1.4.5/min'
6262

6363
// Other path mappings here
6464
}
6565
```
66-
For Oracle JET apps, also open `appDir/src/js/main-release-paths.json` and add the `'persist' : 'js/libs/persist/v1.4.4/min'` entry to the list of paths.
66+
For Oracle JET apps, also open `appDir/src/js/main-release-paths.json` and add the `'persist' : 'js/libs/persist/v1.4.5/min'` entry to the list of paths.
6767
6868
You can choose the name of the paths prefix. That is, you can use a different value to the ‘persist’ value shown in the examples.
6969
70-
It is recommended to add the version number as a convention in your application build step such as `'persist' : 'js/libs/persist/v1.4.4/min'`.
70+
It is recommended to add the version number as a convention in your application build step such as `'persist' : 'js/libs/persist/v1.4.5/min'`.
7171
7272
Versions of the toolkit are also available on CDN under the latest JET release. e.g.
7373
@@ -91,7 +91,7 @@ And again, if you are using RequireJS, you will need to map paths for these pack
9191
paths: {
9292
'pouchdb': 'js/libs/pouchdb-7.0.0',
9393
'pouchfind': 'js/libs/pouchdb.find',
94-
'persist' : 'js/libs/persist/v1.4.4/min'
94+
'persist' : 'js/libs/persist/v1.4.5/min'
9595

9696
// Other path mappings here
9797
}

USAGE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# offline-persistence-toolkit 1.4.4 #
1+
# offline-persistence-toolkit 1.4.5 #
22

33
# Introduction #
44

docs/defaultResponseProxy.js.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ <h1 class="page-title">Source: defaultResponseProxy.js</h1>
609609
}
610610
return null;
611611
};
612-
612+
613613
function _getUndoRedoDataForShreddedDataItem(request, storename, shreddedDataItem) {
614614
var undoRedoArray = [];
615615
var key;
@@ -620,6 +620,11 @@ <h1 class="page-title">Source: defaultResponseProxy.js</h1>
620620
if (i &lt; dataArray.length &amp;&amp;
621621
request.method !== 'GET' &amp;&amp;
622622
request.method !== 'HEAD') {
623+
// when deleting a row offline then coming online to sync
624+
// it obtains a 'document deleted' doc which does not contain a key
625+
if (!dataArray[i]['key']){
626+
return undoRedoData(++i, dataArray);
627+
}
623628
key = dataArray[i]['key'].toString();
624629

625630
if (request.method !== 'DELETE') {

docs/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ <h3> </h3>
4343

4444

4545
<section>
46-
<article><h1>offline-persistence-toolkit 1.4.4</h1>
46+
<article><h1>offline-persistence-toolkit 1.4.5</h1>
4747
<h2>Introduction</h2>
4848
<p>This document provides a reference to the offline-persistence-toolkit's JavaScript API. Links to JSDoc for each class can be found to the right.</p>
4949
<p>The toolkit's <a href="https://github.com/oracle/offline-persistence-toolkit/" title="README">README</a> file provides an overview of the toolkit’s capabilities. Having read that document, you can find more information about how to implement a range of common and advanced use cases with the toolkit in the

docs/persistenceUtils.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ <h5>Parameters:</h5>
255255

256256
<dt class="tag-source">Source:</dt>
257257
<dd class="tag-source"><ul class="dummy"><li>
258-
<a href="persistenceUtils.js.html">persistenceUtils.js</a>, <a href="persistenceUtils.js.html#line510">line 510</a>
258+
<a href="persistenceUtils.js.html">persistenceUtils.js</a>, <a href="persistenceUtils.js.html#line513">line 513</a>
259259
</li></ul></dd>
260260

261261

@@ -756,7 +756,7 @@ <h5>Parameters:</h5>
756756

757757
<dt class="tag-source">Source:</dt>
758758
<dd class="tag-source"><ul class="dummy"><li>
759-
<a href="persistenceUtils.js.html">persistenceUtils.js</a>, <a href="persistenceUtils.js.html#line409">line 409</a>
759+
<a href="persistenceUtils.js.html">persistenceUtils.js</a>, <a href="persistenceUtils.js.html#line412">line 412</a>
760760
</li></ul></dd>
761761

762762

@@ -1236,7 +1236,7 @@ <h5>Parameters:</h5>
12361236

12371237
<dt class="tag-source">Source:</dt>
12381238
<dd class="tag-source"><ul class="dummy"><li>
1239-
<a href="persistenceUtils.js.html">persistenceUtils.js</a>, <a href="persistenceUtils.js.html#line340">line 340</a>
1239+
<a href="persistenceUtils.js.html">persistenceUtils.js</a>, <a href="persistenceUtils.js.html#line343">line 343</a>
12401240
</li></ul></dd>
12411241

12421242

@@ -1625,7 +1625,7 @@ <h5>Parameters:</h5>
16251625

16261626
<dt class="tag-source">Source:</dt>
16271627
<dd class="tag-source"><ul class="dummy"><li>
1628-
<a href="persistenceUtils.js.html">persistenceUtils.js</a>, <a href="persistenceUtils.js.html#line378">line 378</a>
1628+
<a href="persistenceUtils.js.html">persistenceUtils.js</a>, <a href="persistenceUtils.js.html#line381">line 381</a>
16291629
</li></ul></dd>
16301630

16311631

docs/persistenceUtils.js.html

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ <h1 class="page-title">Source: persistenceUtils.js</h1>
7777
* @static
7878
* @private
7979
* @param {Request} request Request object
80-
* @param {boolean} replay a flag indicating whether it is a request from syn
80+
* @param {boolean} replay a flag indicating whether it is a request from syn
8181
* operation or not.
8282
*/
8383
function markReplayRequest(request, replay) {
@@ -324,11 +324,14 @@ <h1 class="page-title">Source: persistenceUtils.js</h1>
324324
*/
325325
function requestFromJSON(data) {
326326
logger.log("Offline Persistence Toolkit persistenceUtils: requestFromJSON()");
327+
if (!data){
328+
return Promise.resolve();
329+
}
327330
var initFromData = {};
328331
_copyProperties(data, initFromData, ['headers', 'body', 'signal']);
329332
var skipContentType = _copyPayloadFromJsonObj(data, initFromData);
330333
initFromData.headers = _createHeadersFromJsonObj(data, skipContentType);
331-
334+
332335
return Promise.resolve(new Request(data.url, initFromData));
333336
};
334337

@@ -683,7 +686,7 @@ <h1 class="page-title">Source: persistenceUtils.js</h1>
683686
});
684687
} else {
685688
findQuery['value.' + filterCriterion.attribute] = {};
686-
findQuery['value.' + filterCriterion.attribute][filterCriterion.op] = filterCriterion.value;
689+
findQuery['value.' + filterCriterion.attribute][filterCriterion.op] = filterCriterion.value;
687690
}
688691
return findQuery;
689692
}

docs/queryHandlers.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ <h5>Parameters:</h5>
564564

565565
<dt class="tag-source">Source:</dt>
566566
<dd class="tag-source"><ul class="dummy"><li>
567-
<a href="queryHandlers.js.html">queryHandlers.js</a>, <a href="queryHandlers.js.html#line404">line 404</a>
567+
<a href="queryHandlers.js.html">queryHandlers.js</a>, <a href="queryHandlers.js.html#line399">line 399</a>
568568
</li></ul></dd>
569569

570570

docs/queryHandlers.js.html

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -149,18 +149,18 @@ <h1 class="page-title">Source: queryHandlers.js</h1>
149149
return Promise.resolve();
150150
};
151151
};
152-
152+
153153
// 1. get the matched raw entry from cache store: it should contain key, and
154-
// response header.
154+
// response header.
155155
// 2. if we found a match:
156156
// for single resource type, we'll just get it from cache, by using cache key.
157-
// for collection resource type, we'll need to query the store, and
157+
// for collection resource type, we'll need to query the store, and
158158
// construct the response.
159159
// 3. if we don't find a match
160160
// get the possible id from the url, and search store on that key.
161161
// if we no possible id, or no entry found with that key, we don't have a match
162162
// if we found an object from the store, then we need to construct a response.
163-
//
163+
//
164164
function _processQuery(request, storeName, findQuery, shredder, unshredder, offset, limit) {
165165
return persistenceManager.getCache()._internalMatch(request, {ignoreSearch: true, ignoreBody: true}).then(function (cacheEntryMetadata) {
166166
if (cacheEntryMetadata) {
@@ -175,11 +175,6 @@ <h1 class="page-title">Source: queryHandlers.js</h1>
175175
// 2. apply offset and limit.
176176
// 3. reconstruct the response
177177
return persistenceStoreManager.openStore(storeName).then(function(store) {
178-
if (cacheEntryMetadata.resourceIdentifierMap &amp;&amp;
179-
cacheEntryMetadata.resourceIdentifierMap[storeName]) {
180-
_addSearchCriteria(findQuery, 'metadata.resourceIdentifier',
181-
cacheEntryMetadata.resourceIdentifierMap[storeName]);
182-
}
183178
return store.find(findQuery);
184179
}).then(function(results) {
185180
var hasMore = false;
@@ -204,7 +199,7 @@ <h1 class="page-title">Source: queryHandlers.js</h1>
204199
};
205200
return persistenceManager.getCache()._matchByKey(
206201
request, cacheEntryMetadata.key, {ignoreBody: true}
207-
).then(function(response) {
202+
).then(function(response) {
208203
return unshredder([newShreddedData], response).then(function(newResponse) {
209204
// add limit and offset to the newly constructed response.
210205
var responseClone = newResponse.clone();
@@ -238,7 +233,7 @@ <h1 class="page-title">Source: queryHandlers.js</h1>
238233
}
239234
} else {
240235
// no matched response from cache, could be
241-
// 1. this is a single row query, we'll try finding that row in the
236+
// 1. this is a single row query, we'll try finding that row in the
242237
// shredded store.
243238
// 2. there is just no cached response for this request at all.
244239
var id = _getRequestUrlId(request);
@@ -272,12 +267,12 @@ <h1 class="page-title">Source: queryHandlers.js</h1>
272267
});
273268
});
274269
} else {
275-
// should never come here since we are able to get id from
270+
// should never come here since we are able to get id from
276271
// the url, we should be able to get the colletion URL.
277272
return;
278273
}
279274
} else {
280-
// nothing in the shredded store, we don't have anything to return
275+
// nothing in the shredded store, we don't have anything to return
281276
// a valid response.
282277
return;
283278
}
@@ -572,7 +567,7 @@ <h1 class="page-title">Source: queryHandlers.js</h1>
572567
};
573568
}
574569
}
575-
570+
576571
function _cleanURIValue(value) {
577572
return decodeURIComponent(value.replace(/\+/g, ' '));
578573
};

0 commit comments

Comments
 (0)