Skip to content

Commit f4311df

Browse files
Updated annotations and set the version to 1.2.7
1 parent 9e6c7b8 commit f4311df

12 files changed

+91
-91
lines changed

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.2.6 #
1+
# offline-persistence-toolkit 1.2.7 #
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.2.6 #
1+
# offline-persistence-toolkit 1.2.7 #
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.2.6/min'
61+
'persist' : 'js/libs/persist/v1.2.7/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.2.6/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.2.7/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.2.6/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.2.7/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.2.6/min'
94+
'persist' : 'js/libs/persist/v1.2.7/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.2.6 #
1+
# offline-persistence-toolkit 1.2.7 #
22

33
# Introduction #
44

docs/defaultResponseProxy.js.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,10 @@ <h1 class="page-title">Source: defaultResponseProxy.js</h1>
196196
logger.log("Offline Persistence Toolkit DefaultResponseProxy: Insert Response in syncManager after error for request with enpointKey: " + endpointKey);
197197
_insertSyncManagerRequest(requestClone, null, true).then(function() {
198198
cacheHandler.unregisterEndpointOptions(endpointKey);
199-
reject(err);
199+
reject(err);
200200
}, function() {
201201
cacheHandler.unregisterEndpointOptions(endpointKey);
202-
reject(err);
202+
reject(err);
203203
});
204204
});
205205
});
@@ -277,7 +277,7 @@ <h1 class="page-title">Source: defaultResponseProxy.js</h1>
277277

278278
return fetchStrategy(request, self._options);
279279
};
280-
280+
281281
/**
282282
* The default HEAD request handler.
283283
* Processes the HEAD Request using the default logic. Can be overrided to provide
@@ -294,7 +294,7 @@ <h1 class="page-title">Source: defaultResponseProxy.js</h1>
294294
logger.log("Offline Persistence Toolkit DefaultResponseProxy: Processing Request with default HEAD Handler");
295295
return _handleGetWithFetchStrategy(this, request);
296296
};
297-
297+
298298
/**
299299
* The default OPTIONS request handler.
300300
* The default implementation when offline will return a Response with
@@ -366,7 +366,7 @@ <h1 class="page-title">Source: defaultResponseProxy.js</h1>
366366

367367
if (ifMatch || ifNoneMatch) {
368368
logger.log("Offline Persistence Toolkit DefaultResponseProxy: Generating ETag for offline Response for default PUT Handler");
369-
var randomInt = Math.floor(Math.random() * 1000000);
369+
var randomInt = Math.floor(Math.random() * 1000000); // @randomNumberOk - Only used to generate ETag while offline
370370
requestData.headers['etag'] = (Date.now() + randomInt).toString();
371371
requestData.headers['x-oracle-jscpt-etag-generated'] = requestData.headers['etag'];
372372
delete requestData.headers['if-match'];

docs/images/arch_diagram.png

16.2 KB
Loading

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.2.6</h1><h2>Introduction</h2><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>
46+
<article><h1>offline-persistence-toolkit 1.2.7</h1><h2>Introduction</h2><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>
4747
<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
4848
<a href="https://github.com/oracle/offline-persistence-toolkit/blob/master/USAGE.md" title="Usage guide">Usage guide</a>.</p>
4949
<h2>License</h2><p>Copyright (c) 2017 Oracle and/or its affiliates The Universal Permissive License (UPL), Version 1.0.</p></article>

docs/persistenceUtils.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ <h4 class="name" id=".buildEndpointKey"><span class="type-signature">(static) </
145145

146146

147147
<div class="description">
148-
helper function to build endpoint key to register options under.The option contains shredder/unshredder needed for cache to shred/unshreddresponses. Ideally, we would like cache to be able to look up suchinformation in the framework based on scope, but there is no central placefor such information to reside, considering the facts that the frameworkshould work in service worker case. So the solution is for cache tolookup the information based on request.url, thus we require(1) responseProxy needs to register/unregister the options so during which time period cache is able to look up shredder/unshredder(2) because of asynchronous nature, there could be multiple fetch events going on from the same url, while we don't want the registered shredder/unshredder to grow out of control, we create a unique key so we can use the same key to unreigster the shredder/unshredder(3) any cache operations needs to happen within defaultResponseProxy processRequest scope.
148+
helper function to build endpoint key to register options under.The option contains shredder/unshredder needed for cache to shred/unshreddresponses. Ideally, we would like cache to be able to look up suchinformation in the framework based on scope, but there is no central placefor such information to reside, considering the facts that the frameworkshould work in service worker case. So the solution is for cache tolookup the information based on request.url, thus we require(1) responseProxy needs to register/unregister the options so during which time period cache is able to look up shredder/unshredder(2) because of asynchronous nature, there could be multiple fetch events going on from the same url, while we don't want the registered shredder/unshredder to grow out of control, we create a unique key so we can use the same key to unreigster the shredder/unshredder(3) any cache operations needs to happen within defaultResponseProxy processRequest scope.
149149
</div>
150150

151151

@@ -976,7 +976,7 @@ <h4 class="name" id=".requestFromJSON"><span class="type-signature">(static) </s
976976

977977

978978
<div class="description">
979-
Return a Request object constructed from the JSON object returned by requestToJSON
979+
Return a Request object constructed from the JSON object returned byrequestToJSON
980980
</div>
981981

982982

@@ -1647,7 +1647,7 @@ <h4 class="name" id=".setResponsePayload"><span class="type-signature">(static)
16471647

16481648

16491649
<div class="description">
1650-
Update the Response object with the provided payload. The existing payload will be replaced
1650+
Update the Response object with the provided payload. The existing payloadwill be replaced
16511651
</div>
16521652

16531653

docs/persistenceUtils.js.html

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ <h1 class="page-title">Source: persistenceUtils.js</h1>
3333

3434
define(['./impl/logger'], function (logger) {
3535
'use strict';
36-
36+
3737
/**
3838
* @class persistenceUtils
3939
* @classdesc Provide various utilities for converting Request/Response objects
4040
* to JSON.
4141
* @export
4242
* @hideconstructor
4343
*/
44-
44+
4545
/**
4646
* Return whether the Response is a cached Response
4747
* @method
@@ -54,7 +54,7 @@ <h1 class="page-title">Source: persistenceUtils.js</h1>
5454
function isCachedResponse(response) {
5555
return response.headers.has('x-oracle-jscpt-cache-expiration-date');
5656
};
57-
57+
5858
/**
5959
* Return whether the Response has a generated ETag
6060
* @method
@@ -67,7 +67,7 @@ <h1 class="page-title">Source: persistenceUtils.js</h1>
6767
function isGeneratedEtagResponse(response) {
6868
return response.headers.has('x-oracle-jscpt-etag-generated');
6969
};
70-
70+
7171
/**
7272
* Derive the payload body type based on content-type from response
7373
* header and responseType from request.
@@ -109,7 +109,7 @@ <h1 class="page-title">Source: persistenceUtils.js</h1>
109109
}
110110
return false;
111111
};
112-
112+
113113
function _isMultipartPayload(headers) {
114114

115115
var contentType = headers.get('Content-Type');
@@ -138,7 +138,7 @@ <h1 class="page-title">Source: persistenceUtils.js</h1>
138138
requestObject['headers'] = _getHeaderValues(request.headers);
139139
return _copyPayload(request, requestObject);
140140
};
141-
141+
142142
function _copyProperties(sourceObj, targetObj, ignoreProps) {
143143
for (var k in sourceObj) {
144144
if (typeof (sourceObj[k]) !== 'function' &amp;&amp;
@@ -150,11 +150,11 @@ <h1 class="page-title">Source: persistenceUtils.js</h1>
150150
}
151151
}
152152
};
153-
153+
154154
function _isPrivateProperty(property) {
155155
return property.indexOf('_') === 0;
156156
};
157-
157+
158158
function _getHeaderValues(headers) {
159159
var headersData = {};
160160
if (headers.entries) {
@@ -179,10 +179,10 @@ <h1 class="page-title">Source: persistenceUtils.js</h1>
179179
})
180180
}
181181
_addDateHeaderIfNull(headersData);
182-
182+
183183
return headersData;
184184
};
185-
185+
186186
function _addDateHeaderIfNull(headersData) {
187187
// Date is not exposed for CORS request/response
188188
var date = headersData['date'];
@@ -196,7 +196,7 @@ <h1 class="page-title">Source: persistenceUtils.js</h1>
196196

197197
function _copyPayload(source, targetObj) {
198198
targetObj.body = {};
199-
199+
200200
if ((source instanceof Request) &amp;&amp;
201201
_isMultipartPayload(source.headers)) {
202202
return _copyMultipartPayload(source, targetObj);
@@ -210,7 +210,7 @@ <h1 class="page-title">Source: persistenceUtils.js</h1>
210210
});
211211
}
212212

213-
if (!(source instanceof Request) &amp;&amp;
213+
if (!(source instanceof Request) &amp;&amp;
214214
typeof(source.arrayBuffer) === 'function') {
215215
return source.arrayBuffer().then(function (aBuffer) {
216216
if (aBuffer.byteLength > 0) {
@@ -222,7 +222,7 @@ <h1 class="page-title">Source: persistenceUtils.js</h1>
222222

223223
return Promise.reject(new Error({message: 'payload body type is not supported'}));
224224
};
225-
225+
226226
function _copyMultipartPayload(request, targetObj) {
227227
logger.log("Offline Persistence Toolkit persistenceUtils: Copying multipart payload");
228228
if (typeof(request.formData) === 'function') {
@@ -292,7 +292,7 @@ <h1 class="page-title">Source: persistenceUtils.js</h1>
292292
};
293293

294294
/**
295-
* Return a Request object constructed from the JSON object returned by
295+
* Return a Request object constructed from the JSON object returned by
296296
* requestToJSON
297297
* @method
298298
* @name requestFromJSON
@@ -310,11 +310,11 @@ <h1 class="page-title">Source: persistenceUtils.js</h1>
310310

311311
return _createRequestFromJsonObj(data, initFromData);
312312
};
313-
313+
314314
function _copyPayloadFromJsonObj(data, targetObj) {
315315
var skipContentType = false;
316316
var body = data.body;
317-
317+
318318
if (body.text &amp;&amp; body.text.length > 0) {
319319
targetObj.body = body.text;
320320
} else if (body.arrayBuffer) {
@@ -331,7 +331,7 @@ <h1 class="page-title">Source: persistenceUtils.js</h1>
331331

332332
return skipContentType;
333333
};
334-
334+
335335
function _createHeadersFromJsonObj(data, skipContentType) {
336336
var headers = new Headers();
337337
Object.keys(data.headers).forEach(function (key) {
@@ -343,7 +343,7 @@ <h1 class="page-title">Source: persistenceUtils.js</h1>
343343

344344
return headers;
345345
};
346-
346+
347347
function _createRequestFromJsonObj(data, initFromData) {
348348
return Promise.resolve(new Request(data.url, initFromData));
349349
};
@@ -366,7 +366,7 @@ <h1 class="page-title">Source: persistenceUtils.js</h1>
366366

367367
return _createResponseFromJsonObj(data, initFromData);
368368
};
369-
369+
370370
function _createResponseFromJsonObj(data, initFromData) {
371371
var response;
372372
var body = data.body;
@@ -387,28 +387,28 @@ <h1 class="page-title">Source: persistenceUtils.js</h1>
387387
};
388388

389389
/**
390-
* Update the Response object with the provided payload. The existing payload
390+
* Update the Response object with the provided payload. The existing payload
391391
* will be replaced
392392
* @method
393393
* @name setResponsePayload
394394
* @memberof persistenceUtils
395395
* @static
396396
* @param {Response} response Response object
397397
* @param {Object} payload JSON payload data
398-
* @return {Promise} Returns a Promise which resolves to the updated Response object
398+
* @return {Promise} Returns a Promise which resolves to the updated Response object
399399
*/
400400
function setResponsePayload(response, payload) {
401401
logger.log("Offline Persistence Toolkit persistenceUtils: setResponsePayload()");
402402
return responseToJSON(response).then(function (responseObject) {
403403
var body = responseObject.body;
404-
404+
405405
body.arrayBuffer = null;
406406
body.blob = null;
407407
body.text = null;
408-
408+
409409
if (payload instanceof ArrayBuffer) {
410410
body.arrayBuffer = payload;
411-
} else if (payload instanceof Blob) {
411+
} else if (payload instanceof Blob) {
412412
body.blob = payload;
413413
} else {
414414
body.text = JSON.stringify(payload);
@@ -529,7 +529,7 @@ <h1 class="page-title">Source: persistenceUtils.js</h1>
529529
* (1) responseProxy needs to register/unregister the options so during which
530530
* time period cache is able to look up shredder/unshredder
531531
* (2) because of asynchronous nature, there could be multiple fetch events
532-
* going on from the same url, while we don't want the registered
532+
* going on from the same url, while we don't want the registered
533533
* shredder/unshredder to grow out of control, we create a unique key
534534
* so we can use the same key to unreigster the shredder/unshredder
535535
* (3) any cache operations needs to happen within defaultResponseProxy
@@ -545,19 +545,19 @@ <h1 class="page-title">Source: persistenceUtils.js</h1>
545545
logger.log("Offline Persistence Toolkit persistenceUtils: buildEndpointKey() for Request with url: " + request.url);
546546
var endPointKeyObj = {
547547
url: request.url,
548-
id : Math.random().toString(36).replace(/[^a-z]+/g, '')
548+
id : Math.random().toString(36).replace(/[^a-z]+/g, '') // @randomNumberOk - Only used to internally keep track of request URLs
549549
};
550550
return JSON.stringify(endPointKeyObj);
551551
};
552-
552+
553553
function _cloneRequest(request) {
554554
return requestToJSON(request, {_noClone: true}).then(function (requestJson) {
555555
return requestFromJSON(requestJson).then(function (requestClone) {
556556
return requestClone;
557557
});
558558
});
559559
};
560-
560+
561561
function _cloneResponse(response, options) {
562562
options = options || {};
563563
return responseToJSON(response, {_noClone: true}).then(function (responseJson) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@oracle/offline-persistence-toolkit",
33
"title": "Offline Persistence Toolkit",
4-
"version": "1.2.6",
4+
"version": "1.2.7",
55
"description": "Offline Persistence Toolkit by Oracle Corp.",
66
"author": "oraclejet",
77
"license": "UPL-1.0",

src/defaultResponseProxy.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,10 @@ define(['./persistenceManager', './persistenceUtils', './fetchStrategies',
168168
logger.log("Offline Persistence Toolkit DefaultResponseProxy: Insert Response in syncManager after error for request with enpointKey: " + endpointKey);
169169
_insertSyncManagerRequest(requestClone, null, true).then(function() {
170170
cacheHandler.unregisterEndpointOptions(endpointKey);
171-
reject(err);
171+
reject(err);
172172
}, function() {
173173
cacheHandler.unregisterEndpointOptions(endpointKey);
174-
reject(err);
174+
reject(err);
175175
});
176176
});
177177
});
@@ -249,7 +249,7 @@ define(['./persistenceManager', './persistenceUtils', './fetchStrategies',
249249

250250
return fetchStrategy(request, self._options);
251251
};
252-
252+
253253
/**
254254
* The default HEAD request handler.
255255
* Processes the HEAD Request using the default logic. Can be overrided to provide
@@ -266,7 +266,7 @@ define(['./persistenceManager', './persistenceUtils', './fetchStrategies',
266266
logger.log("Offline Persistence Toolkit DefaultResponseProxy: Processing Request with default HEAD Handler");
267267
return _handleGetWithFetchStrategy(this, request);
268268
};
269-
269+
270270
/**
271271
* The default OPTIONS request handler.
272272
* The default implementation when offline will return a Response with
@@ -338,7 +338,7 @@ define(['./persistenceManager', './persistenceUtils', './fetchStrategies',
338338

339339
if (ifMatch || ifNoneMatch) {
340340
logger.log("Offline Persistence Toolkit DefaultResponseProxy: Generating ETag for offline Response for default PUT Handler");
341-
var randomInt = Math.floor(Math.random() * 1000000);
341+
var randomInt = Math.floor(Math.random() * 1000000); // @randomNumberOk - Only used to generate ETag while offline
342342
requestData.headers['etag'] = (Date.now() + randomInt).toString();
343343
requestData.headers['x-oracle-jscpt-etag-generated'] = requestData.headers['etag'];
344344
delete requestData.headers['if-match'];

0 commit comments

Comments
 (0)