@agility/content-sync 1.2.0-beta.8.1 → 1.2.3

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.
@@ -0,0 +1,33 @@
1
+ name: Publish to npm
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ paths:
8
+ - package.json
9
+
10
+ jobs:
11
+ publish:
12
+ runs-on: ubuntu-latest
13
+ permissions:
14
+ id-token: write
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+
18
+ - uses: actions/setup-node@v4
19
+ with:
20
+ node-version: 20
21
+ registry-url: https://registry.npmjs.org
22
+
23
+ - name: Upgrade npm for Trusted Publisher OIDC support
24
+ run: npm install -g npm@latest
25
+
26
+ - name: Install dependencies
27
+ run: npm ci
28
+
29
+ - name: Build
30
+ run: npm run build
31
+
32
+ - name: Publish
33
+ run: npm publish --access public --provenance
@@ -82,7 +82,7 @@ module.exports =
82
82
  /******/
83
83
  /******/
84
84
  /******/ // Load entry module and return exports
85
- /******/ return __webpack_require__(__webpack_require__.s = 46);
85
+ /******/ return __webpack_require__(__webpack_require__.s = 47);
86
86
  /******/ })
87
87
  /************************************************************************/
88
88
  /******/ ([
@@ -139,80 +139,112 @@ module.exports = _asyncToGenerator, module.exports.__esModule = true, module.exp
139
139
 
140
140
  /***/ }),
141
141
  /* 2 */
142
- /***/ (function(module, exports, __webpack_require__) {
142
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
143
143
 
144
- var toPropertyKey = __webpack_require__(9);
145
- function _defineProperty(e, r, t) {
146
- return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
147
- value: t,
148
- enumerable: !0,
149
- configurable: !0,
150
- writable: !0
151
- }) : e[r] = t, e;
152
- }
153
- module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
144
+ "use strict";
145
+ __webpack_require__.r(__webpack_exports__);
146
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "logDebug", function() { return logDebug; });
147
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "logInfo", function() { return logInfo; });
148
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "logError", function() { return logError; });
149
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "logWarning", function() { return logWarning; });
150
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "logSuccess", function() { return logSuccess; });
151
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "asyncForEach", function() { return asyncForEach; });
152
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sleep", function() { return sleep; });
153
+ /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
154
+ /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0__);
155
+ /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(0);
156
+ /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__);
157
+
158
+ var asyncForEach = /*#__PURE__*/function () {var _ref = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0___default()(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee(array, callback) {var index;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function (_context) {while (1) switch (_context.prev = _context.next) {case 0:
159
+ index = 0;case 1:if (!(index < array.length)) {_context.next = 3;break;}_context.next = 2;return (
160
+ callback(array[index], index, array));case 2:index++;_context.next = 1;break;case 3:case "end":return _context.stop();}}, _callee);}));return function asyncForEach(_x, _x2) {return _ref.apply(this, arguments);};}();
154
161
 
155
- /***/ }),
156
- /* 3 */
157
- /***/ (function(module, exports) {
158
162
 
159
- module.exports = require("fs");
160
163
 
161
- /***/ }),
162
- /* 4 */
163
- /***/ (function(module, exports) {
164
164
 
165
- module.exports = require("path");
165
+ var getLogLevel = function getLogLevel() {
166
+ var logLevel = (process.env.AGILITY_LOG_LEVEL || 'warning').toLowerCase();
166
167
 
167
- /***/ }),
168
- /* 5 */
169
- /***/ (function(module, exports, __webpack_require__) {
168
+ if (logLevel !== 'debug' && logLevel !== 'info' && logLevel !== 'warning' && logLevel !== 'error' && logLevel !== 'none') {
169
+ return 'warning';
170
+ }
170
171
 
171
- "use strict";
172
+ return logLevel;
172
173
 
174
+ };
173
175
 
174
- const lockfile = __webpack_require__(33);
175
- const { toPromise, toSync, toSyncOptions } = __webpack_require__(45);
176
176
 
177
- async function lock(file, options) {
178
- const release = await toPromise(lockfile.lock)(file, options);
177
+ var logSuccess = function logSuccess(message) {
179
178
 
180
- return toPromise(release);
181
- }
179
+ var logLevel = getLogLevel();
180
+ if (logLevel === 'debug' || logLevel === 'info') {
182
181
 
183
- function lockSync(file, options) {
184
- const release = toSync(lockfile.lock)(file, toSyncOptions(options));
182
+ message = "AgilityCMS => ".concat(message, " ");
183
+ console.log('\x1b[32m%s\x1b[0m', message);
184
+ }
185
+ };
185
186
 
186
- return toSync(release);
187
- }
187
+ var logWarning = function logWarning(message) {
188
188
 
189
- function unlock(file, options) {
190
- return toPromise(lockfile.unlock)(file, options);
191
- }
189
+ var logLevel = getLogLevel();
190
+ if (logLevel === 'debug' || logLevel === 'info' || logLevel === 'warning') {
192
191
 
193
- function unlockSync(file, options) {
194
- return toSync(lockfile.unlock)(file, toSyncOptions(options));
195
- }
192
+ message = "AgilityCMS => ".concat(message, " ");
193
+ console.log('\x1b[33m%s\x1b[0m', message);
194
+ }
195
+ };
196
196
 
197
- function check(file, options) {
198
- return toPromise(lockfile.check)(file, options);
199
- }
197
+ var logError = function logError(message) {
200
198
 
201
- function checkSync(file, options) {
202
- return toSync(lockfile.check)(file, toSyncOptions(options));
203
- }
199
+ var logLevel = getLogLevel();
200
+ if (logLevel === 'debug' || logLevel === 'info' || logLevel === 'warning' || logLevel === 'error') {
201
+
202
+ message = "AgilityCMS => ".concat(message, " ");
203
+ console.log('\x1b[31m%s\x1b[0m', message);
204
+ }
205
+ };
206
+
207
+ var logInfo = function logInfo(message) {
208
+ var logLevel = getLogLevel();
209
+ if (logLevel === 'debug' || logLevel === 'info') {
210
+ message = "AgilityCMS => ".concat(message, " ");
211
+ console.log(message);
212
+ }
213
+ };
214
+
215
+ var logDebug = function logDebug(message) {
216
+ var logLevel = getLogLevel();
217
+ if (logLevel === 'debug') {
218
+ console.log('#######################################################################');
219
+ message = "AgilityCMS(debug) => ".concat(message, " ");
220
+ console.log('"\x1b[35m%s\x1b[0m', message);
221
+ }
222
+ };
223
+
224
+
225
+ var sleep = function sleep(ms) {
226
+ return new Promise(function (resolve) {return setTimeout(resolve, ms);});
227
+ };
204
228
 
205
- module.exports = lock;
206
- module.exports.lock = lock;
207
- module.exports.unlock = unlock;
208
- module.exports.lockSync = lockSync;
209
- module.exports.unlockSync = unlockSync;
210
- module.exports.check = check;
211
- module.exports.checkSync = checkSync;
212
229
 
213
230
 
214
231
  /***/ }),
215
- /* 6 */
232
+ /* 3 */
233
+ /***/ (function(module, exports, __webpack_require__) {
234
+
235
+ var toPropertyKey = __webpack_require__(8);
236
+ function _defineProperty(e, r, t) {
237
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
238
+ value: t,
239
+ enumerable: !0,
240
+ configurable: !0,
241
+ writable: !0
242
+ }) : e[r] = t, e;
243
+ }
244
+ module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
245
+
246
+ /***/ }),
247
+ /* 4 */
216
248
  /***/ (function(module, exports) {
217
249
 
218
250
  function _typeof(o) {
@@ -227,22 +259,28 @@ function _typeof(o) {
227
259
  module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
228
260
 
229
261
  /***/ }),
230
- /* 7 */
262
+ /* 5 */
231
263
  /***/ (function(module, exports) {
232
264
 
233
265
  module.exports = require("assert");
234
266
 
235
267
  /***/ }),
236
- /* 8 */
268
+ /* 6 */
237
269
  /***/ (function(module, exports) {
238
270
 
239
- module.exports = require("os");
271
+ module.exports = require("fs");
240
272
 
241
273
  /***/ }),
242
- /* 9 */
274
+ /* 7 */
275
+ /***/ (function(module, exports) {
276
+
277
+ module.exports = require("path");
278
+
279
+ /***/ }),
280
+ /* 8 */
243
281
  /***/ (function(module, exports, __webpack_require__) {
244
282
 
245
- var _typeof = __webpack_require__(6)["default"];
283
+ var _typeof = __webpack_require__(4)["default"];
246
284
  var toPrimitive = __webpack_require__(22);
247
285
  function toPropertyKey(t) {
248
286
  var i = toPrimitive(t, "string");
@@ -251,17 +289,23 @@ function toPropertyKey(t) {
251
289
  module.exports = toPropertyKey, module.exports.__esModule = true, module.exports["default"] = module.exports;
252
290
 
253
291
  /***/ }),
254
- /* 10 */
292
+ /* 9 */
255
293
  /***/ (function(module, exports) {
256
294
 
257
295
  module.exports = require("util");
258
296
 
259
297
  /***/ }),
260
- /* 11 */
298
+ /* 10 */
261
299
  /***/ (function(module, exports) {
262
300
 
263
301
  module.exports = require("stream");
264
302
 
303
+ /***/ }),
304
+ /* 11 */
305
+ /***/ (function(module, exports) {
306
+
307
+ module.exports = require("os");
308
+
265
309
  /***/ }),
266
310
  /* 12 */
267
311
  /***/ (function(module, exports) {
@@ -447,12 +491,12 @@ module.exports = AsyncIterator, module.exports.__esModule = true, module.exports
447
491
  /* 17 */
448
492
  /***/ (function(module, exports, __webpack_require__) {
449
493
 
450
- var fs = __webpack_require__(3)
451
- var polyfills = __webpack_require__(34)
452
- var legacy = __webpack_require__(36)
453
- var clone = __webpack_require__(37)
494
+ var fs = __webpack_require__(6)
495
+ var polyfills = __webpack_require__(35)
496
+ var legacy = __webpack_require__(37)
497
+ var clone = __webpack_require__(38)
454
498
 
455
- var util = __webpack_require__(10)
499
+ var util = __webpack_require__(9)
456
500
 
457
501
  /* istanbul ignore next - node 0.x polyfill */
458
502
  var gracefulQueue
@@ -533,7 +577,7 @@ if (!fs[gracefulQueue]) {
533
577
  if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) {
534
578
  process.on('exit', function() {
535
579
  debug(fs[gracefulQueue])
536
- __webpack_require__(7).equal(fs[gracefulQueue].length, 0)
580
+ __webpack_require__(5).equal(fs[gracefulQueue].length, 0)
537
581
  })
538
582
  }
539
583
  }
@@ -2440,7 +2484,7 @@ function _typeof2(o) { "@babel/helpers - typeof"; return _typeof2 = "function" =
2440
2484
  /***/
2441
2485
  }), (/* 15 */
2442
2486
  /***/function (module, exports) {
2443
- module.exports = __webpack_require__(10);
2487
+ module.exports = __webpack_require__(9);
2444
2488
 
2445
2489
  /***/
2446
2490
  }), (/* 16 */
@@ -9583,12 +9627,12 @@ function _typeof2(o) { "@babel/helpers - typeof"; return _typeof2 = "function" =
9583
9627
  /***/
9584
9628
  }), (/* 32 */
9585
9629
  /***/function (module, exports) {
9586
- module.exports = __webpack_require__(11);
9630
+ module.exports = __webpack_require__(10);
9587
9631
 
9588
9632
  /***/
9589
9633
  }), (/* 33 */
9590
9634
  /***/function (module, exports) {
9591
- module.exports = __webpack_require__(7);
9635
+ module.exports = __webpack_require__(5);
9592
9636
 
9593
9637
  /***/
9594
9638
  }), (/* 34 */
@@ -10249,7 +10293,7 @@ function _typeof2(o) { "@babel/helpers - typeof"; return _typeof2 = "function" =
10249
10293
  /***/
10250
10294
  }), (/* 41 */
10251
10295
  /***/function (module, exports) {
10252
- module.exports = __webpack_require__(8);
10296
+ module.exports = __webpack_require__(11);
10253
10297
 
10254
10298
  /***/
10255
10299
  }), (/* 42 */
@@ -11677,7 +11721,7 @@ module.exports = _classCallCheck, module.exports.__esModule = true, module.expor
11677
11721
  /* 20 */
11678
11722
  /***/ (function(module, exports, __webpack_require__) {
11679
11723
 
11680
- var toPropertyKey = __webpack_require__(9);
11724
+ var toPropertyKey = __webpack_require__(8);
11681
11725
  function _defineProperties(e, r) {
11682
11726
  for (var t = 0; t < r.length; t++) {
11683
11727
  var o = r[t];
@@ -11718,8 +11762,8 @@ type DotenvConfigOutput = {
11718
11762
 
11719
11763
  */
11720
11764
 
11721
- const fs = __webpack_require__(3)
11722
- const path = __webpack_require__(4)
11765
+ const fs = __webpack_require__(6)
11766
+ const path = __webpack_require__(7)
11723
11767
 
11724
11768
  function log (message /*: string */) {
11725
11769
  console.log(`[dotenv][DEBUG] ${message}`)
@@ -11814,7 +11858,7 @@ module.exports.parse = parse
11814
11858
  /* 22 */
11815
11859
  /***/ (function(module, exports, __webpack_require__) {
11816
11860
 
11817
- var _typeof = __webpack_require__(6)["default"];
11861
+ var _typeof = __webpack_require__(4)["default"];
11818
11862
  function toPrimitive(t, r) {
11819
11863
  if ("object" != _typeof(t) || !t) return t;
11820
11864
  var e = t[Symbol.toPrimitive];
@@ -11999,7 +12043,7 @@ module.exports = _regeneratorKeys, module.exports.__esModule = true, module.expo
11999
12043
  /* 32 */
12000
12044
  /***/ (function(module, exports, __webpack_require__) {
12001
12045
 
12002
- var _typeof = __webpack_require__(6)["default"];
12046
+ var _typeof = __webpack_require__(4)["default"];
12003
12047
  function _regeneratorValues(e) {
12004
12048
  if (null != e) {
12005
12049
  var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"],
@@ -12026,11 +12070,58 @@ module.exports = _regeneratorValues, module.exports.__esModule = true, module.ex
12026
12070
  "use strict";
12027
12071
 
12028
12072
 
12029
- const path = __webpack_require__(4);
12073
+ const lockfile = __webpack_require__(34);
12074
+ const { toPromise, toSync, toSyncOptions } = __webpack_require__(46);
12075
+
12076
+ async function lock(file, options) {
12077
+ const release = await toPromise(lockfile.lock)(file, options);
12078
+
12079
+ return toPromise(release);
12080
+ }
12081
+
12082
+ function lockSync(file, options) {
12083
+ const release = toSync(lockfile.lock)(file, toSyncOptions(options));
12084
+
12085
+ return toSync(release);
12086
+ }
12087
+
12088
+ function unlock(file, options) {
12089
+ return toPromise(lockfile.unlock)(file, options);
12090
+ }
12091
+
12092
+ function unlockSync(file, options) {
12093
+ return toSync(lockfile.unlock)(file, toSyncOptions(options));
12094
+ }
12095
+
12096
+ function check(file, options) {
12097
+ return toPromise(lockfile.check)(file, options);
12098
+ }
12099
+
12100
+ function checkSync(file, options) {
12101
+ return toSync(lockfile.check)(file, toSyncOptions(options));
12102
+ }
12103
+
12104
+ module.exports = lock;
12105
+ module.exports.lock = lock;
12106
+ module.exports.unlock = unlock;
12107
+ module.exports.lockSync = lockSync;
12108
+ module.exports.unlockSync = unlockSync;
12109
+ module.exports.check = check;
12110
+ module.exports.checkSync = checkSync;
12111
+
12112
+
12113
+ /***/ }),
12114
+ /* 34 */
12115
+ /***/ (function(module, exports, __webpack_require__) {
12116
+
12117
+ "use strict";
12118
+
12119
+
12120
+ const path = __webpack_require__(7);
12030
12121
  const fs = __webpack_require__(17);
12031
- const retry = __webpack_require__(38);
12032
- const onExit = __webpack_require__(41);
12033
- const mtimePrecision = __webpack_require__(44);
12122
+ const retry = __webpack_require__(39);
12123
+ const onExit = __webpack_require__(42);
12124
+ const mtimePrecision = __webpack_require__(45);
12034
12125
 
12035
12126
  const locks = {};
12036
12127
 
@@ -12369,10 +12460,10 @@ module.exports.getLocks = getLocks;
12369
12460
 
12370
12461
 
12371
12462
  /***/ }),
12372
- /* 34 */
12463
+ /* 35 */
12373
12464
  /***/ (function(module, exports, __webpack_require__) {
12374
12465
 
12375
- var constants = __webpack_require__(35)
12466
+ var constants = __webpack_require__(36)
12376
12467
 
12377
12468
  var origCwd = process.cwd
12378
12469
  var cwd = null
@@ -12730,16 +12821,16 @@ function patch (fs) {
12730
12821
 
12731
12822
 
12732
12823
  /***/ }),
12733
- /* 35 */
12824
+ /* 36 */
12734
12825
  /***/ (function(module, exports) {
12735
12826
 
12736
12827
  module.exports = require("constants");
12737
12828
 
12738
12829
  /***/ }),
12739
- /* 36 */
12830
+ /* 37 */
12740
12831
  /***/ (function(module, exports, __webpack_require__) {
12741
12832
 
12742
- var Stream = __webpack_require__(11).Stream
12833
+ var Stream = __webpack_require__(10).Stream
12743
12834
 
12744
12835
  module.exports = legacy
12745
12836
 
@@ -12860,7 +12951,7 @@ function legacy (fs) {
12860
12951
 
12861
12952
 
12862
12953
  /***/ }),
12863
- /* 37 */
12954
+ /* 38 */
12864
12955
  /***/ (function(module, exports, __webpack_require__) {
12865
12956
 
12866
12957
  "use strict";
@@ -12890,16 +12981,16 @@ function clone (obj) {
12890
12981
 
12891
12982
 
12892
12983
  /***/ }),
12893
- /* 38 */
12984
+ /* 39 */
12894
12985
  /***/ (function(module, exports, __webpack_require__) {
12895
12986
 
12896
- module.exports = __webpack_require__(39);
12987
+ module.exports = __webpack_require__(40);
12897
12988
 
12898
12989
  /***/ }),
12899
- /* 39 */
12990
+ /* 40 */
12900
12991
  /***/ (function(module, exports, __webpack_require__) {
12901
12992
 
12902
- var RetryOperation = __webpack_require__(40);
12993
+ var RetryOperation = __webpack_require__(41);
12903
12994
 
12904
12995
  exports.operation = function(options) {
12905
12996
  var timeouts = exports.timeouts(options);
@@ -13002,7 +13093,7 @@ exports.wrap = function(obj, options, methods) {
13002
13093
 
13003
13094
 
13004
13095
  /***/ }),
13005
- /* 40 */
13096
+ /* 41 */
13006
13097
  /***/ (function(module, exports) {
13007
13098
 
13008
13099
  function RetryOperation(timeouts, options) {
@@ -13166,7 +13257,7 @@ RetryOperation.prototype.mainError = function() {
13166
13257
 
13167
13258
 
13168
13259
  /***/ }),
13169
- /* 41 */
13260
+ /* 42 */
13170
13261
  /***/ (function(module, exports, __webpack_require__) {
13171
13262
 
13172
13263
  // Note: since nyc uses this module to output coverage, any lines
@@ -13194,11 +13285,11 @@ if (!processOk(process)) {
13194
13285
  return function () {}
13195
13286
  }
13196
13287
  } else {
13197
- var assert = __webpack_require__(7)
13198
- var signals = __webpack_require__(42)
13288
+ var assert = __webpack_require__(5)
13289
+ var signals = __webpack_require__(43)
13199
13290
  var isWin = /^win/i.test(process.platform)
13200
13291
 
13201
- var EE = __webpack_require__(43)
13292
+ var EE = __webpack_require__(44)
13202
13293
  /* istanbul ignore if */
13203
13294
  if (typeof EE !== 'function') {
13204
13295
  EE = EE.EventEmitter
@@ -13374,7 +13465,7 @@ if (!processOk(process)) {
13374
13465
 
13375
13466
 
13376
13467
  /***/ }),
13377
- /* 42 */
13468
+ /* 43 */
13378
13469
  /***/ (function(module, exports) {
13379
13470
 
13380
13471
  // This is not the set of all possible signals.
@@ -13433,13 +13524,13 @@ if (process.platform === 'linux') {
13433
13524
 
13434
13525
 
13435
13526
  /***/ }),
13436
- /* 43 */
13527
+ /* 44 */
13437
13528
  /***/ (function(module, exports) {
13438
13529
 
13439
13530
  module.exports = require("events");
13440
13531
 
13441
13532
  /***/ }),
13442
- /* 44 */
13533
+ /* 45 */
13443
13534
  /***/ (function(module, exports, __webpack_require__) {
13444
13535
 
13445
13536
  "use strict";
@@ -13501,7 +13592,7 @@ module.exports.getMtime = getMtime;
13501
13592
 
13502
13593
 
13503
13594
  /***/ }),
13504
- /* 45 */
13595
+ /* 46 */
13505
13596
  /***/ (function(module, exports, __webpack_require__) {
13506
13597
 
13507
13598
  "use strict";
@@ -13593,7 +13684,7 @@ module.exports = {
13593
13684
 
13594
13685
 
13595
13686
  /***/ }),
13596
- /* 46 */
13687
+ /* 47 */
13597
13688
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
13598
13689
 
13599
13690
  "use strict";
@@ -13604,7 +13695,7 @@ __webpack_require__.r(__webpack_exports__);
13604
13695
  __webpack_require__.d(__webpack_exports__, "getSyncClient", function() { return /* binding */ getSyncClient; });
13605
13696
 
13606
13697
  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/defineProperty.js
13607
- var defineProperty = __webpack_require__(2);
13698
+ var defineProperty = __webpack_require__(3);
13608
13699
  var defineProperty_default = /*#__PURE__*/__webpack_require__.n(defineProperty);
13609
13700
 
13610
13701
  // EXTERNAL MODULE: ./node_modules/@agility/content-fetch/dist/agility-content-fetch.node.js
@@ -13619,79 +13710,8 @@ var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerat
13619
13710
  var regenerator = __webpack_require__(0);
13620
13711
  var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator);
13621
13712
 
13622
- // CONCATENATED MODULE: ./src/util.js
13623
-
13624
- var asyncForEach = /*#__PURE__*/function () {var _ref = asyncToGenerator_default()(/*#__PURE__*/regenerator_default.a.mark(function _callee(array, callback) {var index;return regenerator_default.a.wrap(function (_context) {while (1) switch (_context.prev = _context.next) {case 0:
13625
- index = 0;case 1:if (!(index < array.length)) {_context.next = 3;break;}_context.next = 2;return (
13626
- callback(array[index], index, array));case 2:index++;_context.next = 1;break;case 3:case "end":return _context.stop();}}, _callee);}));return function asyncForEach(_x, _x2) {return _ref.apply(this, arguments);};}();
13627
-
13628
-
13629
-
13630
-
13631
- var getLogLevel = function getLogLevel() {
13632
- var logLevel = (process.env.AGILITY_LOG_LEVEL || 'warning').toLowerCase();
13633
-
13634
- if (logLevel !== 'debug' && logLevel !== 'info' && logLevel !== 'warning' && logLevel !== 'error' && logLevel !== 'none') {
13635
- return 'warning';
13636
- }
13637
-
13638
- return logLevel;
13639
-
13640
- };
13641
-
13642
-
13643
- var logSuccess = function logSuccess(message) {
13644
-
13645
- var logLevel = getLogLevel();
13646
- if (logLevel === 'debug' || logLevel === 'info') {
13647
-
13648
- message = "AgilityCMS => ".concat(message, " ");
13649
- console.log('\x1b[32m%s\x1b[0m', message);
13650
- }
13651
- };
13652
-
13653
- var logWarning = function logWarning(message) {
13654
-
13655
- var logLevel = getLogLevel();
13656
- if (logLevel === 'debug' || logLevel === 'info' || logLevel === 'warning') {
13657
-
13658
- message = "AgilityCMS => ".concat(message, " ");
13659
- console.log('\x1b[33m%s\x1b[0m', message);
13660
- }
13661
- };
13662
-
13663
- var logError = function logError(message) {
13664
-
13665
- var logLevel = getLogLevel();
13666
- if (logLevel === 'debug' || logLevel === 'info' || logLevel === 'warning' || logLevel === 'error') {
13667
-
13668
- message = "AgilityCMS => ".concat(message, " ");
13669
- console.log('\x1b[31m%s\x1b[0m', message);
13670
- }
13671
- };
13672
-
13673
- var logInfo = function logInfo(message) {
13674
- var logLevel = getLogLevel();
13675
- if (logLevel === 'debug' || logLevel === 'info') {
13676
- message = "AgilityCMS => ".concat(message, " ");
13677
- console.log(message);
13678
- }
13679
- };
13680
-
13681
- var logDebug = function logDebug(message) {
13682
- var logLevel = getLogLevel();
13683
- if (logLevel === 'debug') {
13684
- console.log('#######################################################################');
13685
- message = "AgilityCMS(debug) => ".concat(message, " ");
13686
- console.log('"\x1b[35m%s\x1b[0m', message);
13687
- }
13688
- };
13689
-
13690
-
13691
- var sleep = function sleep(ms) {
13692
- return new Promise(function (resolve) {return setTimeout(resolve, ms);});
13693
- };
13694
-
13713
+ // EXTERNAL MODULE: ./src/util.js
13714
+ var util = __webpack_require__(2);
13695
13715
 
13696
13716
  // CONCATENATED MODULE: ./src/methods/syncContent.js
13697
13717
 
@@ -13727,22 +13747,22 @@ var sleep = function sleep(ms) {
13727
13747
  //if the api is being updated, wait a few ms and try again...
13728
13748
  waitMS += waitIntervalMS;if (!(
13729
13749
  waitMS > waitMaxMS)) {_context.next = 3;break;}
13730
- logWarning("Sync API has been busy for too long, canceling.");return _context.abrupt("continue", 12);case 3:
13750
+ Object(util["logWarning"])("Sync API has been busy for too long, canceling.");return _context.abrupt("continue", 12);case 3:
13731
13751
 
13732
13752
 
13733
13753
 
13734
13754
  if (!busy) {
13735
13755
  //first time we're busy...
13736
13756
  busy = true;
13737
- logInfo("Sync API is busy. Waiting...");
13757
+ Object(util["logInfo"])("Sync API is busy. Waiting...");
13738
13758
  }_context.next = 4;return (
13739
13759
 
13740
- sleep(waitIntervalMS));case 4:return _context.abrupt("continue", 11);case 5:
13760
+ Object(util["sleep"])(waitIntervalMS));case 4:return _context.abrupt("continue", 11);case 5:
13741
13761
 
13742
13762
 
13743
13763
 
13744
13764
  if (busy === true) {
13745
- logInfo("Continuing sync...");
13765
+ Object(util["logInfo"])("Continuing sync...");
13746
13766
  busy = false;
13747
13767
  waitMS = 0;
13748
13768
  }
@@ -13768,9 +13788,9 @@ var sleep = function sleep(ms) {
13768
13788
  token > 0 || busy === true) {_context.next = 1;break;}case 12:
13769
13789
 
13770
13790
  if (itemCount > 0) {
13771
- logInfo("Content Sync returned ".concat(itemCount, " item(s)."));
13791
+ Object(util["logInfo"])("Content Sync returned ".concat(itemCount, " item(s)."));
13772
13792
  } else {
13773
- logInfo("Content Sync returned no item(s).");
13793
+ Object(util["logInfo"])("Content Sync returned no item(s).");
13774
13794
  }return _context.abrupt("return",
13775
13795
 
13776
13796
  token);case 13:case "end":return _context.stop();}}, _callee);}));return syncContent_ref.apply(this, arguments);}
@@ -13779,7 +13799,7 @@ var sleep = function sleep(ms) {
13779
13799
 
13780
13800
  /* harmony default export */ var methods_clearSync = (function (_x) {return clearSync_ref.apply(this, arguments);});function clearSync_ref() {clearSync_ref = asyncToGenerator_default()(/*#__PURE__*/regenerator_default.a.mark(function _callee(storeInterface) {return regenerator_default.a.wrap(function (_context) {while (1) switch (_context.prev = _context.next) {case 0:_context.next = 1;return (
13781
13801
  storeInterface.clear());case 1:
13782
- logSuccess("Cleared Sync Items");case 2:case "end":return _context.stop();}}, _callee);}));return clearSync_ref.apply(this, arguments);}
13802
+ Object(util["logSuccess"])("Cleared Sync Items");case 2:case "end":return _context.stop();}}, _callee);}));return clearSync_ref.apply(this, arguments);}
13783
13803
  // CONCATENATED MODULE: ./src/methods/syncPages.js
13784
13804
 
13785
13805
 
@@ -13807,21 +13827,21 @@ var sleep = function sleep(ms) {
13807
13827
  //if the api is being updated, wait a few ms and try again...
13808
13828
  waitMS += waitIntervalMS;if (!(
13809
13829
  waitMS > waitMaxMS)) {_context.next = 3;break;}
13810
- logWarning("Sync API has been busy for too long, canceling.");return _context.abrupt("continue", 12);case 3:
13830
+ Object(util["logWarning"])("Sync API has been busy for too long, canceling.");return _context.abrupt("continue", 12);case 3:
13811
13831
 
13812
13832
 
13813
13833
 
13814
13834
  if (!busy) {
13815
13835
  busy = true;
13816
- logInfo("Sync API is busy. Waiting...");
13836
+ Object(util["logInfo"])("Sync API is busy. Waiting...");
13817
13837
  }_context.next = 4;return (
13818
13838
 
13819
- sleep(waitIntervalMS));case 4:return _context.abrupt("continue", 11);case 5:
13839
+ Object(util["sleep"])(waitIntervalMS));case 4:return _context.abrupt("continue", 11);case 5:
13820
13840
 
13821
13841
 
13822
13842
 
13823
13843
  if (busy === true) {
13824
- logInfo("Continuing sync...");
13844
+ Object(util["logInfo"])("Continuing sync...");
13825
13845
  waitMS = 0;
13826
13846
  busy = false;
13827
13847
  }
@@ -13849,9 +13869,9 @@ var sleep = function sleep(ms) {
13849
13869
  token > 0 || busy === true) {_context.next = 1;break;}case 12:
13850
13870
 
13851
13871
  if (itemCount > 0) {
13852
- logInfo("Page Sync returned ".concat(itemCount, " item(s)."));
13872
+ Object(util["logInfo"])("Page Sync returned ".concat(itemCount, " item(s)."));
13853
13873
  } else {
13854
- logInfo("Page Sync returned no item(s).");
13874
+ Object(util["logInfo"])("Page Sync returned no item(s).");
13855
13875
  }return _context.abrupt("return",
13856
13876
 
13857
13877
 
@@ -13907,7 +13927,7 @@ var sync = /*#__PURE__*/function () {var _ref2 = asyncToGenerator_default()(/*#_
13907
13927
 
13908
13928
 
13909
13929
 
13910
- logSuccess("Starting Sync for ".concat(languageCode, " - ").concat(modeStr, " mode."));_context2.next = 5;return (
13930
+ Object(util["logSuccess"])("Starting Sync for ".concat(languageCode, " - ").concat(modeStr, " mode."));_context2.next = 5;return (
13911
13931
  syncContent(languageCode, syncState.itemToken));case 5:newItemToken = _context2.sent;_context2.next = 6;return (
13912
13932
  syncPages(languageCode, syncState.pageToken));case 6:newPageToken = _context2.sent;if (!(
13913
13933
 
@@ -13916,7 +13936,7 @@ var sync = /*#__PURE__*/function () {var _ref2 = asyncToGenerator_default()(/*#_
13916
13936
  //if we sync ANYTHING - pull the new sitemap down
13917
13937
  _iterator2 = _createForOfIteratorHelper(
13918
13938
  channels);_context2.prev = 7;_iterator2.s();case 8:if ((_step2 = _iterator2.n()).done) {_context2.next = 12;break;}channelName = _step2.value;
13919
- logInfo("Updating Sitemap channel ".concat(channelName, " in ").concat(languageCode));_context2.next = 9;return (
13939
+ Object(util["logInfo"])("Updating Sitemap channel ".concat(channelName, " in ").concat(languageCode));_context2.next = 9;return (
13920
13940
 
13921
13941
  agilityClient.getSitemapFlat({ channelName: channelName, languageCode: languageCode }));case 9:sitemap = _context2.sent;
13922
13942
  storeInterface.saveSitemap({ sitemap: sitemap, languageCode: languageCode, channelName: channelName });_context2.next = 10;return (
@@ -13934,7 +13954,7 @@ var sync = /*#__PURE__*/function () {var _ref2 = asyncToGenerator_default()(/*#_
13934
13954
 
13935
13955
  agilityClient.getUrlRedirections({ lastAccessDate: lastAccessDate }));case 17:urlRedirections = _context2.sent;if (!(
13936
13956
  urlRedirections && urlRedirections.isUpToDate === false)) {_context2.next = 18;break;}
13937
- logInfo("URL Redirections Updated and Saved");_context2.next = 18;return (
13957
+ Object(util["logInfo"])("URL Redirections Updated and Saved");_context2.next = 18;return (
13938
13958
  storeInterface.saveUrlRedirections({ urlRedirections: urlRedirections, languageCode: languageCode }));case 18:
13939
13959
 
13940
13960
 
@@ -13944,7 +13964,7 @@ var sync = /*#__PURE__*/function () {var _ref2 = asyncToGenerator_default()(/*#_
13944
13964
 
13945
13965
  storeInterface.saveSyncState({ syncState: syncState, languageCode: languageCode }));case 19:
13946
13966
 
13947
- logSuccess("Completed Sync for ".concat(languageCode, " - ").concat(modeStr, " mode."));case 20:_context2.next = 2;break;case 21:_context2.next = 23;break;case 22:_context2.prev = 22;_t2 = _context2["catch"](1);_iterator.e(_t2);case 23:_context2.prev = 23;_iterator.f();return _context2.finish(23);case 24:case "end":return _context2.stop();}}, _callee2, null, [[1, 22, 23, 24], [7, 13, 14, 15]]);}));return function sync(_x6, _x7, _x8, _x9, _x0) {return _ref2.apply(this, arguments);};}();
13967
+ Object(util["logSuccess"])("Completed Sync for ".concat(languageCode, " - ").concat(modeStr, " mode."));case 20:_context2.next = 2;break;case 21:_context2.next = 23;break;case 22:_context2.prev = 22;_t2 = _context2["catch"](1);_iterator.e(_t2);case 23:_context2.prev = 23;_iterator.f();return _context2.finish(23);case 24:case "end":return _context2.stop();}}, _callee2, null, [[1, 22, 23, 24], [7, 13, 14, 15]]);}));return function sync(_x6, _x7, _x8, _x9, _x0) {return _ref2.apply(this, arguments);};}();
13948
13968
 
13949
13969
 
13950
13970
 
@@ -14019,7 +14039,7 @@ var store_interface_StoreInterface = /*#__PURE__*/function () {
14019
14039
  !contentItem ||
14020
14040
  !contentItem.properties)) {_context.next = 1;break;}
14021
14041
 
14022
- logWarning("Null item or item with no properties cannot be saved");return _context.abrupt("return");case 1:
14042
+ Object(util["logWarning"])("Null item or item with no properties cannot be saved");return _context.abrupt("return");case 1:
14023
14043
 
14024
14044
 
14025
14045
 
@@ -14053,7 +14073,7 @@ var store_interface_StoreInterface = /*#__PURE__*/function () {
14053
14073
 
14054
14074
  !contentItem.properties.definitionName ||
14055
14075
  !contentItem.properties.referenceName)) {_context.next = 5;break;}
14056
- logWarning("Content with id ".concat(contentItem.contentID, " does not have the neccessary properties to be saved."));return _context.abrupt("return");case 5:_context.next = 6;return (
14076
+ Object(util["logWarning"])("Content with id ".concat(contentItem.contentID, " does not have the neccessary properties to be saved."));return _context.abrupt("return");case 5:_context.next = 6;return (
14057
14077
 
14058
14078
 
14059
14079
 
@@ -14442,31 +14462,16 @@ var store_interface_StoreInterface = /*#__PURE__*/function () {
14442
14462
  */defineProperty_default()(this, "clear", /*#__PURE__*/asyncToGenerator_default()(/*#__PURE__*/regenerator_default.a.mark(
14443
14463
  function _callee13() {return regenerator_default.a.wrap(function (_context13) {while (1) switch (_context13.prev = _context13.next) {case 0:_context13.next = 1;return (
14444
14464
  _this.store.clearItems({ options: _this.options }));case 1:case "end":return _context13.stop();}}, _callee13);})));this.store = store;this.options = options;}return createClass_default()(StoreInterface, [{ key: "validateStoreInterface", value: function validateStoreInterface(storeCandidate) {if (!storeCandidate.clearItems) {throw new TypeError("Your sync store interface must implement `clearItems`.");}if (!storeCandidate.deleteItem) {throw new TypeError("Your sync store interface must implement `deleteItem`.");}if (!storeCandidate.getItem) {throw new TypeError("Your sync store interface must implement `getItem`.");}if (!storeCandidate.saveItem) {throw new TypeError("Your sync store interface must implement `saveItem`.");}if (!storeCandidate.mergeItemToList) {throw new TypeError("Your sync store interface must implement `mergeItemToList`.");}} }]);}();
14445
- // EXTERNAL MODULE: external "fs"
14446
- var external_fs_ = __webpack_require__(3);
14447
- var external_fs_default = /*#__PURE__*/__webpack_require__.n(external_fs_);
14448
-
14449
- // EXTERNAL MODULE: external "os"
14450
- var external_os_ = __webpack_require__(8);
14451
- var external_os_default = /*#__PURE__*/__webpack_require__.n(external_os_);
14452
-
14453
- // EXTERNAL MODULE: external "path"
14454
- var external_path_ = __webpack_require__(4);
14455
- var external_path_default = /*#__PURE__*/__webpack_require__.n(external_path_);
14456
-
14457
- // EXTERNAL MODULE: ./node_modules/proper-lockfile/index.js
14458
- var proper_lockfile = __webpack_require__(5);
14459
-
14460
14465
  // EXTERNAL MODULE: ./node_modules/dotenv/lib/main.js
14461
14466
  var main = __webpack_require__(21);
14462
14467
  var main_default = /*#__PURE__*/__webpack_require__.n(main);
14463
14468
 
14464
14469
  // CONCATENATED MODULE: ./src/store-interface-filesystem.js
14465
-
14466
-
14467
-
14468
-
14469
-
14470
+ var fs = __webpack_require__(6);
14471
+ var os = __webpack_require__(11);
14472
+ var path = __webpack_require__(7);
14473
+ var _require = __webpack_require__(2),sleep = _require.sleep;
14474
+ var _require2 = __webpack_require__(33),lockSync = _require2.lockSync,check = _require2.check;
14470
14475
 
14471
14476
 
14472
14477
  main_default.a.config({
@@ -14482,21 +14487,21 @@ main_default.a.config({
14482
14487
  * @param {String} params.itemType - The type of item being saved/updated, expected values are `item`, `page`, `sitemap`, `nestedsitemap`, `state`, `urlredirections`
14483
14488
  * @param {String} params.languageCode - The locale code associated to the item being saved/updated
14484
14489
  * @param {(String|Number)} params.itemID - The ID of the item being saved/updated - this could be a string or number depending on the itemType
14485
- * @returns {Void}
14490
+ * @returns {promise<void>}
14486
14491
  */
14487
14492
  var saveItem = /*#__PURE__*/function () {var _ref2 = asyncToGenerator_default()(/*#__PURE__*/regenerator_default.a.mark(function _callee(_ref) {var options, item, itemType, languageCode, itemID, filePath, dirPath, json;return regenerator_default.a.wrap(function (_context) {while (1) switch (_context.prev = _context.next) {case 0:options = _ref.options, item = _ref.item, itemType = _ref.itemType, languageCode = _ref.languageCode, itemID = _ref.itemID;
14488
14493
 
14489
- filePath = store_interface_filesystem_getFilePath({ options: options, itemType: itemType, languageCode: languageCode, itemID: itemID });
14494
+ filePath = getFilePath({ options: options, itemType: itemType, languageCode: languageCode, itemID: itemID });
14490
14495
 
14491
- dirPath = external_path_default.a.dirname(filePath);
14496
+ dirPath = path.dirname(filePath);if (
14492
14497
 
14493
14498
 
14494
- if (!external_fs_default.a.existsSync(dirPath)) {
14495
- external_fs_default.a.mkdirSync(dirPath, { recursive: true });
14496
- }
14499
+ fs.existsSync(dirPath)) {_context.next = 1;break;}_context.next = 1;return (
14500
+ fs.promises.mkdir(dirPath, { recursive: true }));case 1:
14501
+
14497
14502
 
14498
- json = JSON.stringify(item);
14499
- external_fs_default.a.writeFileSync(filePath, json);case 1:case "end":return _context.stop();}}, _callee);}));return function saveItem(_x) {return _ref2.apply(this, arguments);};}();
14503
+ json = JSON.stringify(item);_context.next = 2;return (
14504
+ fs.promises.writeFile(filePath, json));case 2:case "end":return _context.stop();}}, _callee);}));return function saveItem(_x) {return _ref2.apply(this, arguments);};}();
14500
14505
 
14501
14506
  /**
14502
14507
  * The function to handle deleting an item to your storage. This could be a Content Item, Page, Url Redirections, Sync State (state), or Sitemap.
@@ -14506,15 +14511,15 @@ var saveItem = /*#__PURE__*/function () {var _ref2 = asyncToGenerator_default()(
14506
14511
  * @param {String} params.itemType - The type of item being deleted, expected values are `item`, `page`, `sitemap`, `nestedsitemap`, `state`, `urlredirections`
14507
14512
  * @param {String} params.languageCode - The locale code associated to the item being saved/updated
14508
14513
  * @param {(String|Number)} params.itemID - The ID of the item being deleted - this could be a string or number depending on the itemType
14509
- * @returns {Void}
14514
+ * @returns {promise<void>}
14510
14515
  */
14511
14516
  var deleteItem = /*#__PURE__*/function () {var _ref4 = asyncToGenerator_default()(/*#__PURE__*/regenerator_default.a.mark(function _callee2(_ref3) {var options, itemType, languageCode, itemID, filePath;return regenerator_default.a.wrap(function (_context2) {while (1) switch (_context2.prev = _context2.next) {case 0:options = _ref3.options, itemType = _ref3.itemType, languageCode = _ref3.languageCode, itemID = _ref3.itemID;
14512
14517
 
14513
- filePath = store_interface_filesystem_getFilePath({ options: options, itemType: itemType, languageCode: languageCode, itemID: itemID });
14518
+ filePath = getFilePath({ options: options, itemType: itemType, languageCode: languageCode, itemID: itemID });if (!
14519
+
14520
+ fs.existsSync(filePath)) {_context2.next = 1;break;}_context2.next = 1;return (
14521
+ fs.promises.unlink(filePath));case 1:case "end":return _context2.stop();}}, _callee2);}));return function deleteItem(_x2) {return _ref4.apply(this, arguments);};}();
14514
14522
 
14515
- if (external_fs_default.a.existsSync(filePath)) {
14516
- external_fs_default.a.unlinkSync(filePath);
14517
- }case 1:case "end":return _context2.stop();}}, _callee2);}));return function deleteItem(_x2) {return _ref4.apply(this, arguments);};}();
14518
14523
 
14519
14524
 
14520
14525
  /**
@@ -14527,7 +14532,7 @@ var deleteItem = /*#__PURE__*/function () {var _ref4 = asyncToGenerator_default(
14527
14532
  * @param {(String|Number)} params.itemID - The ID of the item being updated - this could be a string or number depending on the itemType
14528
14533
  * @param {String} params.referenceName - The reference name of the Content List that this Content Item should be added to
14529
14534
  * @param {String} params.definitionName - The Model name that the Content Item is based on
14530
- * @returns {Void}
14535
+ * @returns {Promise<void>}
14531
14536
  */
14532
14537
  var mergeItemToList = /*#__PURE__*/function () {var _ref6 = asyncToGenerator_default()(/*#__PURE__*/regenerator_default.a.mark(function _callee3(_ref5) {var options, item, languageCode, itemID, referenceName, definitionName, contentList, cIndex;return regenerator_default.a.wrap(function (_context3) {while (1) switch (_context3.prev = _context3.next) {case 0:options = _ref5.options, item = _ref5.item, languageCode = _ref5.languageCode, itemID = _ref5.itemID, referenceName = _ref5.referenceName, definitionName = _ref5.definitionName;_context3.next = 1;return (
14533
14538
 
@@ -14571,15 +14576,15 @@ var mergeItemToList = /*#__PURE__*/function () {var _ref6 = asyncToGenerator_def
14571
14576
  * @param {String} params.itemType - The type of item being accessed, expected values are `item`, `list`, `page`, `sitemap`, `nestedsitemap`, `state`, `urlredirections`
14572
14577
  * @param {String} params.languageCode - The locale code associated to the item being accessed
14573
14578
  * @param {(String|Number)} params.itemID - The ID of the item being accessed - this could be a string or number depending on the itemType
14574
- * @returns {Object}
14579
+ * @returns {Promise<Object>}
14575
14580
  */
14576
14581
  var getItem = /*#__PURE__*/function () {var _ref8 = asyncToGenerator_default()(/*#__PURE__*/regenerator_default.a.mark(function _callee4(_ref7) {var options, itemType, languageCode, itemID, filePath, json;return regenerator_default.a.wrap(function (_context4) {while (1) switch (_context4.prev = _context4.next) {case 0:options = _ref7.options, itemType = _ref7.itemType, languageCode = _ref7.languageCode, itemID = _ref7.itemID;
14577
- filePath = store_interface_filesystem_getFilePath({ options: options, itemType: itemType, languageCode: languageCode, itemID: itemID });if (
14582
+ filePath = getFilePath({ options: options, itemType: itemType, languageCode: languageCode, itemID: itemID });if (
14578
14583
 
14579
- external_fs_default.a.existsSync(filePath)) {_context4.next = 1;break;}return _context4.abrupt("return", null);case 1:
14584
+ fs.existsSync(filePath)) {_context4.next = 1;break;}return _context4.abrupt("return", null);case 1:_context4.next = 2;return (
14580
14585
 
14581
- json = external_fs_default.a.readFileSync(filePath, 'utf8');return _context4.abrupt("return",
14582
- JSON.parse(json));case 2:case "end":return _context4.stop();}}, _callee4);}));return function getItem(_x4) {return _ref8.apply(this, arguments);};}();
14586
+ fs.promises.readFile(filePath, 'utf8'));case 2:json = _context4.sent;return _context4.abrupt("return",
14587
+ JSON.parse(json));case 3:case "end":return _context4.stop();}}, _callee4);}));return function getItem(_x4) {return _ref8.apply(this, arguments);};}();
14583
14588
 
14584
14589
 
14585
14590
  /**
@@ -14587,10 +14592,10 @@ var getItem = /*#__PURE__*/function () {var _ref8 = asyncToGenerator_default()(/
14587
14592
  * @param {Object} params - The parameters object
14588
14593
  * @param {Object} params.options - A flexible object that can contain any properties specifically related to this interface
14589
14594
  * @param {String} params.options.rootPath - The path to store/access the content as JSON
14590
- * @returns {Void}
14595
+ * @returns {Promise<void>}
14591
14596
  */
14592
- var clearItems = /*#__PURE__*/function () {var _ref0 = asyncToGenerator_default()(/*#__PURE__*/regenerator_default.a.mark(function _callee5(_ref9) {var options;return regenerator_default.a.wrap(function (_context5) {while (1) switch (_context5.prev = _context5.next) {case 0:options = _ref9.options;
14593
- external_fs_default.a.rmdirSync(options.rootPath, { recursive: true });case 1:case "end":return _context5.stop();}}, _callee5);}));return function clearItems(_x5) {return _ref0.apply(this, arguments);};}();
14597
+ var clearItems = /*#__PURE__*/function () {var _ref0 = asyncToGenerator_default()(/*#__PURE__*/regenerator_default.a.mark(function _callee5(_ref9) {var options;return regenerator_default.a.wrap(function (_context5) {while (1) switch (_context5.prev = _context5.next) {case 0:options = _ref9.options;_context5.next = 1;return (
14598
+ fs.promises.rmdir(options.rootPath, { recursive: true }));case 1:case "end":return _context5.stop();}}, _callee5);}));return function clearItems(_x5) {return _ref0.apply(this, arguments);};}();
14594
14599
 
14595
14600
 
14596
14601
 
@@ -14602,38 +14607,38 @@ var clearItems = /*#__PURE__*/function () {var _ref0 = asyncToGenerator_default(
14602
14607
  var mutexLock = /*#__PURE__*/function () {var _ref1 = asyncToGenerator_default()(/*#__PURE__*/regenerator_default.a.mark(function _callee6() {var dir, lockFile, _t, _t2;return regenerator_default.a.wrap(function (_context6) {while (1) switch (_context6.prev = _context6.next) {case 0:
14603
14608
 
14604
14609
 
14605
- dir = external_os_default.a.tmpdir();
14606
- lockFile = "".concat(dir, "/", "agility-sync", ".mutex");
14607
- if (!external_fs_default.a.existsSync(lockFile)) {
14608
- external_fs_default.a.writeFileSync(lockFile, "agility-sync");
14609
- }
14610
+ dir = os.tmpdir();
14611
+ lockFile = "".concat(dir, "/", "agility-sync", ".mutex");if (
14612
+ fs.existsSync(lockFile)) {_context6.next = 1;break;}_context6.next = 1;return (
14613
+ fs.promises.writeFile(lockFile, "agility-sync"));case 1:_context6.next = 2;return (
14614
+
14615
+
14610
14616
 
14611
- //THE LOCK IS ALREADY HELD - WAIT UP!
14612
- _context6.next = 1;return waitOnLock(lockFile);case 1:_context6.prev = 1;return _context6.abrupt("return",
14617
+ waitOnLock(lockFile));case 2:_context6.prev = 2;return _context6.abrupt("return",
14613
14618
 
14614
14619
 
14615
- Object(proper_lockfile["lockSync"])(lockFile));case 2:_context6.prev = 2;_t = _context6["catch"](1);if (!(
14620
+ lockSync(lockFile));case 3:_context6.prev = 3;_t = _context6["catch"](2);if (!(
14616
14621
 
14617
- "".concat(_t).indexOf("Lock file is already being held") !== -1)) {_context6.next = 8;break;}_context6.next = 3;return (
14622
+ "".concat(_t).indexOf("Lock file is already being held") !== -1)) {_context6.next = 9;break;}_context6.next = 4;return (
14618
14623
 
14619
14624
 
14620
- sleep(100));case 3:_context6.next = 4;return (
14621
- waitOnLock(lockFile));case 4:_context6.prev = 4;return _context6.abrupt("return",
14625
+ sleep(100));case 4:_context6.next = 5;return (
14626
+ waitOnLock(lockFile));case 5:_context6.prev = 5;return _context6.abrupt("return",
14622
14627
 
14623
14628
 
14624
- Object(proper_lockfile["lockSync"])(lockFile));case 5:_context6.prev = 5;_t2 = _context6["catch"](4);if (!(
14629
+ lockSync(lockFile));case 6:_context6.prev = 6;_t2 = _context6["catch"](5);if (!(
14625
14630
 
14626
- "".concat(_t).indexOf("Lock file is already being held") !== -1)) {_context6.next = 8;break;}_context6.next = 6;return (
14631
+ "".concat(_t).indexOf("Lock file is already being held") !== -1)) {_context6.next = 9;break;}_context6.next = 7;return (
14627
14632
 
14628
14633
 
14629
- sleep(100));case 6:_context6.next = 7;return (
14630
- waitOnLock(lockFile));case 7:return _context6.abrupt("return",
14631
- Object(proper_lockfile["lockSync"])(lockFile));case 8:throw (
14634
+ sleep(100));case 7:_context6.next = 8;return (
14635
+ waitOnLock(lockFile));case 8:return _context6.abrupt("return",
14636
+ lockSync(lockFile));case 9:throw (
14632
14637
 
14633
14638
 
14634
14639
 
14635
14640
 
14636
- Error("The mutex lock could not be obtained."));case 9:case "end":return _context6.stop();}}, _callee6, null, [[1, 2], [4, 5]]);}));return function mutexLock() {return _ref1.apply(this, arguments);};}();
14641
+ Error("The mutex lock could not be obtained."));case 10:case "end":return _context6.stop();}}, _callee6, null, [[2, 3], [5, 6]]);}));return function mutexLock() {return _ref1.apply(this, arguments);};}();
14637
14642
 
14638
14643
 
14639
14644
 
@@ -14641,18 +14646,18 @@ var mutexLock = /*#__PURE__*/function () {var _ref1 = asyncToGenerator_default()
14641
14646
 
14642
14647
  //private function to get a wait on a lock file
14643
14648
  var waitOnLock = /*#__PURE__*/function () {var _ref10 = asyncToGenerator_default()(/*#__PURE__*/regenerator_default.a.mark(function _callee7(lockFile) {return regenerator_default.a.wrap(function (_context7) {while (1) switch (_context7.prev = _context7.next) {case 0:_context7.next = 1;return (
14644
- Object(proper_lockfile["check"])(lockFile));case 1:if (!_context7.sent) {_context7.next = 3;break;}_context7.next = 2;return (
14649
+ check(lockFile));case 1:if (!_context7.sent) {_context7.next = 3;break;}_context7.next = 2;return (
14645
14650
  sleep(100));case 2:_context7.next = 0;break;case 3:case "end":return _context7.stop();}}, _callee7);}));return function waitOnLock(_x6) {return _ref10.apply(this, arguments);};}();
14646
14651
 
14647
14652
 
14648
14653
 
14649
14654
  //private function to get path of an item
14650
- var store_interface_filesystem_getFilePath = function getFilePath(_ref11) {var options = _ref11.options,itemType = _ref11.itemType,languageCode = _ref11.languageCode,itemID = _ref11.itemID;
14655
+ var getFilePath = function getFilePath(_ref11) {var options = _ref11.options,itemType = _ref11.itemType,languageCode = _ref11.languageCode,itemID = _ref11.itemID;
14651
14656
  if (typeof itemID === 'string' || itemID instanceof String) {
14652
14657
  itemID = itemID.replace(/[`!@#$%^&*()+\=\[\]{};':"\\|,.<>\/?~]/g, "");
14653
14658
  }
14654
14659
  var fileName = "".concat(itemID, ".json");
14655
- return external_path_default.a.join(options.rootPath, languageCode, itemType, fileName);
14660
+ return path.join(options.rootPath, languageCode, itemType, fileName);
14656
14661
  };
14657
14662
 
14658
14663
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agility/content-sync",
3
- "version": "1.2.0-beta.8.1",
3
+ "version": "1.2.3",
4
4
  "description": "JavaScript SDK for synchronizing content from Agility CMS",
5
5
  "main": "dist/agility-sync-sdk.node.js",
6
6
  "scripts": {
@@ -1,8 +1,8 @@
1
- import fs from 'fs'
2
- import os from 'os'
3
- import path from 'path'
4
- import { sleep } from "./util.js"
5
- import { lockSync, unlockSync, checkSync, check } from "proper-lockfile"
1
+ const fs = require('fs')
2
+ const os = require('os')
3
+ const path = require('path')
4
+ const {sleep} = require("./util")
5
+ const { lockSync, check } = require("proper-lockfile")
6
6
  import dotenv from "dotenv"
7
7
 
8
8
  dotenv.config({
@@ -18,7 +18,7 @@ dotenv.config({
18
18
  * @param {String} params.itemType - The type of item being saved/updated, expected values are `item`, `page`, `sitemap`, `nestedsitemap`, `state`, `urlredirections`
19
19
  * @param {String} params.languageCode - The locale code associated to the item being saved/updated
20
20
  * @param {(String|Number)} params.itemID - The ID of the item being saved/updated - this could be a string or number depending on the itemType
21
- * @returns {Void}
21
+ * @returns {promise<void>}
22
22
  */
23
23
  const saveItem = async ({ options, item, itemType, languageCode, itemID }) => {
24
24
 
@@ -28,11 +28,11 @@ const saveItem = async ({ options, item, itemType, languageCode, itemID }) => {
28
28
 
29
29
 
30
30
  if (!fs.existsSync(dirPath)) {
31
- fs.mkdirSync(dirPath, { recursive: true });
31
+ await fs.promises.mkdir(dirPath, { recursive: true });
32
32
  }
33
33
 
34
34
  let json = JSON.stringify(item);
35
- fs.writeFileSync(filePath, json);
35
+ await fs.promises.writeFile(filePath, json);
36
36
  }
37
37
  /**
38
38
  * The function to handle deleting an item to your storage. This could be a Content Item, Page, Url Redirections, Sync State (state), or Sitemap.
@@ -42,14 +42,14 @@ const saveItem = async ({ options, item, itemType, languageCode, itemID }) => {
42
42
  * @param {String} params.itemType - The type of item being deleted, expected values are `item`, `page`, `sitemap`, `nestedsitemap`, `state`, `urlredirections`
43
43
  * @param {String} params.languageCode - The locale code associated to the item being saved/updated
44
44
  * @param {(String|Number)} params.itemID - The ID of the item being deleted - this could be a string or number depending on the itemType
45
- * @returns {Void}
45
+ * @returns {promise<void>}
46
46
  */
47
47
  const deleteItem = async ({ options, itemType, languageCode, itemID }) => {
48
48
 
49
49
  let filePath = getFilePath({ options, itemType, languageCode, itemID });
50
50
 
51
51
  if (fs.existsSync(filePath)) {
52
- fs.unlinkSync(filePath);
52
+ await fs.promises.unlink(filePath);
53
53
  }
54
54
 
55
55
  }
@@ -63,7 +63,7 @@ const deleteItem = async ({ options, itemType, languageCode, itemID }) => {
63
63
  * @param {(String|Number)} params.itemID - The ID of the item being updated - this could be a string or number depending on the itemType
64
64
  * @param {String} params.referenceName - The reference name of the Content List that this Content Item should be added to
65
65
  * @param {String} params.definitionName - The Model name that the Content Item is based on
66
- * @returns {Void}
66
+ * @returns {Promise<void>}
67
67
  */
68
68
  const mergeItemToList = async ({ options, item, languageCode, itemID, referenceName, definitionName }) => {
69
69
 
@@ -107,14 +107,14 @@ const mergeItemToList = async ({ options, item, languageCode, itemID, referenceN
107
107
  * @param {String} params.itemType - The type of item being accessed, expected values are `item`, `list`, `page`, `sitemap`, `nestedsitemap`, `state`, `urlredirections`
108
108
  * @param {String} params.languageCode - The locale code associated to the item being accessed
109
109
  * @param {(String|Number)} params.itemID - The ID of the item being accessed - this could be a string or number depending on the itemType
110
- * @returns {Object}
110
+ * @returns {Promise<Object>}
111
111
  */
112
112
  const getItem = async ({ options, itemType, languageCode, itemID }) => {
113
113
  let filePath = getFilePath({ options, itemType, languageCode, itemID });
114
114
 
115
115
  if (!fs.existsSync(filePath)) return null;
116
116
 
117
- let json = fs.readFileSync(filePath, 'utf8');
117
+ let json = await fs.promises.readFile(filePath, 'utf8');
118
118
  return JSON.parse(json);
119
119
  }
120
120
 
@@ -123,10 +123,10 @@ const getItem = async ({ options, itemType, languageCode, itemID }) => {
123
123
  * @param {Object} params - The parameters object
124
124
  * @param {Object} params.options - A flexible object that can contain any properties specifically related to this interface
125
125
  * @param {String} params.options.rootPath - The path to store/access the content as JSON
126
- * @returns {Void}
126
+ * @returns {Promise<void>}
127
127
  */
128
128
  const clearItems = async ({ options }) => {
129
- fs.rmdirSync(options.rootPath, { recursive: true })
129
+ await fs.promises.rmdir(options.rootPath, { recursive: true })
130
130
  }
131
131
 
132
132
 
@@ -141,7 +141,7 @@ const mutexLock = async () => {
141
141
  const dir = os.tmpdir();
142
142
  const lockFile = `${dir}/${"agility-sync"}.mutex`
143
143
  if (! fs.existsSync(lockFile)) {
144
- fs.writeFileSync(lockFile, "agility-sync");
144
+ await fs.promises.writeFile(lockFile, "agility-sync");
145
145
  }
146
146
 
147
147
  //THE LOCK IS ALREADY HELD - WAIT UP!
@@ -199,4 +199,4 @@ export default {
199
199
  getItem,
200
200
  clearItems,
201
201
  mutexLock
202
- }
202
+ }