@agility/content-sync 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10857,26 +10857,25 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {try
10857
10857
  busy = false;
10858
10858
  waitMS = 0;
10859
10859
  waitMaxMS = 60000;
10860
- waitIntervalMS = 1000;case 7:
10860
+ waitIntervalMS = 1000;case 7:_context.next = 9;return (
10861
10861
 
10862
10862
 
10863
- syncRet = null;
10864
10863
 
10865
10864
 
10866
- //sync content items...
10867
- _context.next = 10;return this.agilityClient.getSyncContent({
10868
- syncToken: token,
10869
- pageSize: 100,
10870
- languageCode: languageCode });case 10:syncRet = _context.sent;if (!(
10865
+
10866
+ this.agilityClient.getSyncContent({
10867
+ syncToken: token,
10868
+ pageSize: 100,
10869
+ languageCode: languageCode }));case 9:syncRet = _context.sent;if (!(
10871
10870
 
10872
10871
 
10873
10872
 
10874
10873
 
10875
- syncRet === undefined || syncRet.busy !== undefined && syncRet.busy === true)) {_context.next = 20;break;}
10874
+ syncRet === undefined || syncRet === null || syncRet.busy !== undefined && syncRet.busy === true)) {_context.next = 19;break;}
10876
10875
  //if the api is being updated, wait a few ms and try again...
10877
10876
  waitMS += waitIntervalMS;if (!(
10878
- waitMS > waitMaxMS)) {_context.next = 16;break;}
10879
- Object(util["logWarning"])("Sync API has been busy for too long, canceling.");return _context.abrupt("break", 37);case 16:
10877
+ waitMS > waitMaxMS)) {_context.next = 15;break;}
10878
+ Object(util["logWarning"])("Sync API has been busy for too long, canceling.");return _context.abrupt("break", 36);case 15:
10880
10879
 
10881
10880
 
10882
10881
 
@@ -10884,9 +10883,9 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {try
10884
10883
  //first time we're busy...
10885
10884
  busy = true;
10886
10885
  Object(util["logInfo"])("Sync API is busy. Waiting...");
10887
- }_context.next = 19;return (
10886
+ }_context.next = 18;return (
10888
10887
 
10889
- Object(util["sleep"])(waitIntervalMS));case 19:return _context.abrupt("continue", 36);case 20:
10888
+ Object(util["sleep"])(waitIntervalMS));case 18:return _context.abrupt("continue", 35);case 19:
10890
10889
 
10891
10890
 
10892
10891
 
@@ -10899,22 +10898,22 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {try
10899
10898
  syncItems = syncRet.items;
10900
10899
 
10901
10900
  //if we don't get anything back, kick out
10902
- if (!(syncItems.length > 0)) {_context.next = 30;break;}
10901
+ if (!(syncItems.length > 0)) {_context.next = 29;break;}
10903
10902
 
10904
- index = 0;case 24:if (!(index < syncItems.length)) {_context.next = 30;break;}_context.next = 27;return (
10905
- storeInterface.saveContentItem({ contentItem: syncItems[index], languageCode: languageCode }));case 27:index++;_context.next = 24;break;case 30:if (!(
10903
+ index = 0;case 23:if (!(index < syncItems.length)) {_context.next = 29;break;}_context.next = 26;return (
10904
+ storeInterface.saveContentItem({ contentItem: syncItems[index], languageCode: languageCode }));case 26:index++;_context.next = 23;break;case 29:if (!(
10906
10905
 
10907
10906
 
10908
10907
 
10909
- syncRet.syncToken > token)) {_context.next = 34;break;}
10910
- token = syncRet.syncToken;_context.next = 35;break;case 34:return _context.abrupt("break", 37);case 35:
10908
+ syncRet.syncToken > token)) {_context.next = 33;break;}
10909
+ token = syncRet.syncToken;_context.next = 34;break;case 33:return _context.abrupt("break", 36);case 34:
10911
10910
 
10912
10911
 
10913
10912
 
10914
10913
 
10915
- itemCount += syncItems.length;case 36:if (
10914
+ itemCount += syncItems.length;case 35:if (
10916
10915
 
10917
- token > 0 || busy === true) {_context.next = 7;break;}case 37:
10916
+ token > 0 || busy === true) {_context.next = 7;break;}case 36:
10918
10917
 
10919
10918
  if (itemCount > 0) {
10920
10919
  Object(util["logInfo"])("Content Sync returned ".concat(itemCount, " item(s)."));
@@ -10922,7 +10921,7 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {try
10922
10921
  Object(util["logInfo"])("Content Sync returned no item(s).");
10923
10922
  }return _context.abrupt("return",
10924
10923
 
10925
- token);case 39:case "end":return _context.stop();}}}, _callee, this);}));return syncContent_ref.apply(this, arguments);}
10924
+ token);case 38:case "end":return _context.stop();}}}, _callee, this);}));return syncContent_ref.apply(this, arguments);}
10926
10925
  // CONCATENATED MODULE: ./src/methods/clearSync.js
10927
10926
  function clearSync_asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {try {var info = gen[key](arg);var value = info.value;} catch (error) {reject(error);return;}if (info.done) {resolve(value);} else {Promise.resolve(value).then(_next, _throw);}}function clearSync_asyncToGenerator(fn) {return function () {var self = this,args = arguments;return new Promise(function (resolve, reject) {var gen = fn.apply(self, args);function _next(value) {clearSync_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);}function _throw(err) {clearSync_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);}_next(undefined);});};}
10928
10927
 
@@ -10941,8 +10940,8 @@ function syncPages_asyncGeneratorStep(gen, resolve, reject, _next, _throw, key,
10941
10940
 
10942
10941
  busy = false;
10943
10942
  waitMS = 0;
10944
- waitMaxMS = 30000;
10945
- waitIntervalMS = 500;case 7:_context.next = 9;return (
10943
+ waitMaxMS = 60000;
10944
+ waitIntervalMS = 1000;case 7:_context.next = 9;return (
10946
10945
 
10947
10946
 
10948
10947
 
@@ -10953,8 +10952,7 @@ function syncPages_asyncGeneratorStep(gen, resolve, reject, _next, _throw, key,
10953
10952
  languageCode: languageCode }));case 9:syncRet = _context.sent;if (!(
10954
10953
 
10955
10954
 
10956
- syncRet.busy !== undefined &&
10957
- syncRet.busy === true)) {_context.next = 19;break;}
10955
+ syncRet === undefined || syncRet === null || syncRet.busy !== undefined && syncRet.busy === true)) {_context.next = 19;break;}
10958
10956
  //if the api is being updated, wait a few ms and try again...
10959
10957
  waitMS += waitIntervalMS;if (!(
10960
10958
  waitMS > waitMaxMS)) {_context.next = 15;break;}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agility/content-sync",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "JavaScript SDK for synchronizing content from Agility CMS",
5
5
  "main": "dist/agility-sync-sdk.node.js",
6
6
  "scripts": {
@@ -16,11 +16,10 @@ export default async function (languageCode, token) {
16
16
  const waitIntervalMS = 1000
17
17
 
18
18
  do {
19
- let syncRet = null
20
19
 
21
20
 
22
21
  //sync content items...
23
- syncRet = await this.agilityClient.getSyncContent({
22
+ const syncRet = await this.agilityClient.getSyncContent({
24
23
  syncToken: token,
25
24
  pageSize: 100,
26
25
  languageCode: languageCode,
@@ -28,7 +27,7 @@ export default async function (languageCode, token) {
28
27
  });
29
28
 
30
29
 
31
- if (syncRet === undefined || (syncRet.busy !== undefined && syncRet.busy === true)) {
30
+ if (syncRet === undefined || syncRet === null || (syncRet.busy !== undefined && syncRet.busy === true)) {
32
31
  //if the api is being updated, wait a few ms and try again...
33
32
  waitMS += waitIntervalMS
34
33
  if (waitMS > waitMaxMS) {
@@ -8,8 +8,8 @@ export default async function (languageCode, token) {
8
8
 
9
9
  let busy = false
10
10
  let waitMS = 0
11
- const waitMaxMS = 30000
12
- const waitIntervalMS = 500
11
+ const waitMaxMS = 60000
12
+ const waitIntervalMS = 1000
13
13
 
14
14
 
15
15
  do {
@@ -20,8 +20,7 @@ export default async function (languageCode, token) {
20
20
  languageCode: languageCode
21
21
  });
22
22
 
23
- if (syncRet.busy !== undefined
24
- && syncRet.busy === true) {
23
+ if (syncRet === undefined || syncRet === null || (syncRet.busy !== undefined && syncRet.busy === true)) {
25
24
  //if the api is being updated, wait a few ms and try again...
26
25
  waitMS += waitIntervalMS
27
26
  if (waitMS > waitMaxMS) {