@agility/content-sync 1.2.0-beta.3 → 1.2.0-beta.4
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.
- package/dist/agility-sync-sdk.node.js +505 -558
- package/package.json +3 -1
- package/src/store-interface-filesystem.js +9 -9
- package/src/sync-client.js +1 -1
- package/src/util.js +1 -1
- package/webpack.config.js +1 -5
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
module.exports = factory();
|
|
4
|
-
else if(typeof define === 'function' && define.amd)
|
|
5
|
-
define("agilitySync", [], factory);
|
|
6
|
-
else if(typeof exports === 'object')
|
|
7
|
-
exports["agilitySync"] = factory();
|
|
8
|
-
else
|
|
9
|
-
root["agilitySync"] = factory();
|
|
10
|
-
})(typeof self !== 'undefined' ? self : this, function() {
|
|
11
|
-
return /******/ (function(modules) { // webpackBootstrap
|
|
1
|
+
module.exports =
|
|
2
|
+
/******/ (function(modules) { // webpackBootstrap
|
|
12
3
|
/******/ // The module cache
|
|
13
4
|
/******/ var installedModules = {};
|
|
14
5
|
/******/
|
|
@@ -91,7 +82,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
91
82
|
/******/
|
|
92
83
|
/******/
|
|
93
84
|
/******/ // Load entry module and return exports
|
|
94
|
-
/******/ return __webpack_require__(__webpack_require__.s =
|
|
85
|
+
/******/ return __webpack_require__(__webpack_require__.s = 37);
|
|
95
86
|
/******/ })
|
|
96
87
|
/************************************************************************/
|
|
97
88
|
/******/ ([
|
|
@@ -148,114 +139,80 @@ module.exports = _asyncToGenerator, module.exports.__esModule = true, module.exp
|
|
|
148
139
|
|
|
149
140
|
/***/ }),
|
|
150
141
|
/* 2 */
|
|
151
|
-
/***/ (function(module,
|
|
152
|
-
|
|
153
|
-
"use strict";
|
|
154
|
-
__webpack_require__.r(__webpack_exports__);
|
|
155
|
-
/* WEBPACK VAR INJECTION */(function(module) {/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
|
|
156
|
-
/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0__);
|
|
157
|
-
/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(0);
|
|
158
|
-
/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__);
|
|
159
|
-
|
|
160
|
-
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 _callee$(_context) {while (1) switch (_context.prev = _context.next) {case 0:
|
|
161
|
-
index = 0;case 1:if (!(index < array.length)) {_context.next = 7;break;}_context.next = 4;return (
|
|
162
|
-
callback(array[index], index, array));case 4:index++;_context.next = 1;break;case 7:case "end":return _context.stop();}}, _callee);}));return function asyncForEach(_x, _x2) {return _ref.apply(this, arguments);};}();
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
var getLogLevel = function getLogLevel() {
|
|
168
|
-
var logLevel = (process.env.AGILITY_LOG_LEVEL || 'warning').toLowerCase();
|
|
169
|
-
|
|
170
|
-
if (logLevel !== 'debug' && logLevel !== 'info' && logLevel !== 'warning' && logLevel !== 'error' && logLevel !== 'none') {
|
|
171
|
-
return 'warning';
|
|
172
|
-
}
|
|
142
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
173
143
|
|
|
174
|
-
|
|
144
|
+
var toPropertyKey = __webpack_require__(8);
|
|
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;
|
|
175
154
|
|
|
176
|
-
}
|
|
155
|
+
/***/ }),
|
|
156
|
+
/* 3 */
|
|
157
|
+
/***/ (function(module, exports) {
|
|
177
158
|
|
|
159
|
+
module.exports = require("fs");
|
|
178
160
|
|
|
179
|
-
|
|
161
|
+
/***/ }),
|
|
162
|
+
/* 4 */
|
|
163
|
+
/***/ (function(module, exports) {
|
|
180
164
|
|
|
181
|
-
|
|
182
|
-
if (logLevel === 'debug' || logLevel === 'info') {
|
|
165
|
+
module.exports = require("path");
|
|
183
166
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
};
|
|
167
|
+
/***/ }),
|
|
168
|
+
/* 5 */
|
|
169
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
188
170
|
|
|
189
|
-
|
|
171
|
+
"use strict";
|
|
190
172
|
|
|
191
|
-
var logLevel = getLogLevel();
|
|
192
|
-
if (logLevel === 'debug' || logLevel === 'info' || logLevel === 'warning') {
|
|
193
173
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
}
|
|
197
|
-
};
|
|
174
|
+
const lockfile = __webpack_require__(24);
|
|
175
|
+
const { toPromise, toSync, toSyncOptions } = __webpack_require__(36);
|
|
198
176
|
|
|
199
|
-
|
|
177
|
+
async function lock(file, options) {
|
|
178
|
+
const release = await toPromise(lockfile.lock)(file, options);
|
|
200
179
|
|
|
201
|
-
|
|
202
|
-
|
|
180
|
+
return toPromise(release);
|
|
181
|
+
}
|
|
203
182
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
}
|
|
207
|
-
};
|
|
183
|
+
function lockSync(file, options) {
|
|
184
|
+
const release = toSync(lockfile.lock)(file, toSyncOptions(options));
|
|
208
185
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
if (logLevel === 'debug' || logLevel === 'info') {
|
|
212
|
-
message = "AgilityCMS => ".concat(message, " ");
|
|
213
|
-
console.log(message);
|
|
214
|
-
}
|
|
215
|
-
};
|
|
186
|
+
return toSync(release);
|
|
187
|
+
}
|
|
216
188
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
console.log('#######################################################################');
|
|
221
|
-
message = "AgilityCMS(debug) => ".concat(message, " ");
|
|
222
|
-
console.log('"\x1b[35m%s\x1b[0m', message);
|
|
223
|
-
}
|
|
224
|
-
};
|
|
189
|
+
function unlock(file, options) {
|
|
190
|
+
return toPromise(lockfile.unlock)(file, options);
|
|
191
|
+
}
|
|
225
192
|
|
|
193
|
+
function unlockSync(file, options) {
|
|
194
|
+
return toSync(lockfile.unlock)(file, toSyncOptions(options));
|
|
195
|
+
}
|
|
226
196
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
}
|
|
197
|
+
function check(file, options) {
|
|
198
|
+
return toPromise(lockfile.check)(file, options);
|
|
199
|
+
}
|
|
230
200
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
logError: logError,
|
|
235
|
-
logWarning: logWarning,
|
|
236
|
-
logSuccess: logSuccess,
|
|
237
|
-
asyncForEach: asyncForEach,
|
|
238
|
-
sleep: sleep
|
|
239
|
-
};
|
|
240
|
-
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(11)(module)))
|
|
201
|
+
function checkSync(file, options) {
|
|
202
|
+
return toSync(lockfile.check)(file, toSyncOptions(options));
|
|
203
|
+
}
|
|
241
204
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
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;
|
|
245
212
|
|
|
246
|
-
var toPropertyKey = __webpack_require__(8);
|
|
247
|
-
function _defineProperty(e, r, t) {
|
|
248
|
-
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
249
|
-
value: t,
|
|
250
|
-
enumerable: !0,
|
|
251
|
-
configurable: !0,
|
|
252
|
-
writable: !0
|
|
253
|
-
}) : e[r] = t, e;
|
|
254
|
-
}
|
|
255
|
-
module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
256
213
|
|
|
257
214
|
/***/ }),
|
|
258
|
-
/*
|
|
215
|
+
/* 6 */
|
|
259
216
|
/***/ (function(module, exports) {
|
|
260
217
|
|
|
261
218
|
function _typeof(o) {
|
|
@@ -269,29 +226,17 @@ function _typeof(o) {
|
|
|
269
226
|
}
|
|
270
227
|
module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
271
228
|
|
|
272
|
-
/***/ }),
|
|
273
|
-
/* 5 */
|
|
274
|
-
/***/ (function(module, exports) {
|
|
275
|
-
|
|
276
|
-
module.exports = require("assert");
|
|
277
|
-
|
|
278
|
-
/***/ }),
|
|
279
|
-
/* 6 */
|
|
280
|
-
/***/ (function(module, exports) {
|
|
281
|
-
|
|
282
|
-
module.exports = require("fs");
|
|
283
|
-
|
|
284
229
|
/***/ }),
|
|
285
230
|
/* 7 */
|
|
286
231
|
/***/ (function(module, exports) {
|
|
287
232
|
|
|
288
|
-
module.exports = require("
|
|
233
|
+
module.exports = require("assert");
|
|
289
234
|
|
|
290
235
|
/***/ }),
|
|
291
236
|
/* 8 */
|
|
292
237
|
/***/ (function(module, exports, __webpack_require__) {
|
|
293
238
|
|
|
294
|
-
var _typeof = __webpack_require__(
|
|
239
|
+
var _typeof = __webpack_require__(6)["default"];
|
|
295
240
|
var toPrimitive = __webpack_require__(17);
|
|
296
241
|
function toPropertyKey(t) {
|
|
297
242
|
var i = toPrimitive(t, "string");
|
|
@@ -313,42 +258,12 @@ module.exports = require("util");
|
|
|
313
258
|
|
|
314
259
|
/***/ }),
|
|
315
260
|
/* 11 */
|
|
316
|
-
/***/ (function(module, exports) {
|
|
317
|
-
|
|
318
|
-
module.exports = function(originalModule) {
|
|
319
|
-
if (!originalModule.webpackPolyfill) {
|
|
320
|
-
var module = Object.create(originalModule);
|
|
321
|
-
// module.parent = undefined by default
|
|
322
|
-
if (!module.children) module.children = [];
|
|
323
|
-
Object.defineProperty(module, "loaded", {
|
|
324
|
-
enumerable: true,
|
|
325
|
-
get: function() {
|
|
326
|
-
return module.l;
|
|
327
|
-
}
|
|
328
|
-
});
|
|
329
|
-
Object.defineProperty(module, "id", {
|
|
330
|
-
enumerable: true,
|
|
331
|
-
get: function() {
|
|
332
|
-
return module.i;
|
|
333
|
-
}
|
|
334
|
-
});
|
|
335
|
-
Object.defineProperty(module, "exports", {
|
|
336
|
-
enumerable: true
|
|
337
|
-
});
|
|
338
|
-
module.webpackPolyfill = 1;
|
|
339
|
-
}
|
|
340
|
-
return module;
|
|
341
|
-
};
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
/***/ }),
|
|
345
|
-
/* 12 */
|
|
346
261
|
/***/ (function(module, exports, __webpack_require__) {
|
|
347
262
|
|
|
348
|
-
var fs = __webpack_require__(
|
|
349
|
-
var polyfills = __webpack_require__(
|
|
350
|
-
var legacy = __webpack_require__(
|
|
351
|
-
var clone = __webpack_require__(
|
|
263
|
+
var fs = __webpack_require__(3)
|
|
264
|
+
var polyfills = __webpack_require__(25)
|
|
265
|
+
var legacy = __webpack_require__(27)
|
|
266
|
+
var clone = __webpack_require__(28)
|
|
352
267
|
|
|
353
268
|
var util = __webpack_require__(10)
|
|
354
269
|
|
|
@@ -431,7 +346,7 @@ if (!fs[gracefulQueue]) {
|
|
|
431
346
|
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) {
|
|
432
347
|
process.on('exit', function() {
|
|
433
348
|
debug(fs[gracefulQueue])
|
|
434
|
-
__webpack_require__(
|
|
349
|
+
__webpack_require__(7).equal(fs[gracefulQueue].length, 0)
|
|
435
350
|
})
|
|
436
351
|
}
|
|
437
352
|
}
|
|
@@ -796,7 +711,7 @@ function retry () {
|
|
|
796
711
|
|
|
797
712
|
|
|
798
713
|
/***/ }),
|
|
799
|
-
/*
|
|
714
|
+
/* 12 */
|
|
800
715
|
/***/ (function(module, exports, __webpack_require__) {
|
|
801
716
|
|
|
802
717
|
/* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof2(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof2(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
@@ -7715,7 +7630,7 @@ function _typeof2(o) { "@babel/helpers - typeof"; return _typeof2 = "function" =
|
|
|
7715
7630
|
/***/
|
|
7716
7631
|
}), (/* 31 */
|
|
7717
7632
|
/***/function (module, exports) {
|
|
7718
|
-
module.exports = __webpack_require__(
|
|
7633
|
+
module.exports = __webpack_require__(7);
|
|
7719
7634
|
|
|
7720
7635
|
/***/
|
|
7721
7636
|
}), (/* 32 */
|
|
@@ -9137,7 +9052,7 @@ function _typeof2(o) { "@babel/helpers - typeof"; return _typeof2 = "function" =
|
|
|
9137
9052
|
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(18)(module)))
|
|
9138
9053
|
|
|
9139
9054
|
/***/ }),
|
|
9140
|
-
/*
|
|
9055
|
+
/* 13 */
|
|
9141
9056
|
/***/ (function(module, exports) {
|
|
9142
9057
|
|
|
9143
9058
|
function _classCallCheck(a, n) {
|
|
@@ -9146,7 +9061,7 @@ function _classCallCheck(a, n) {
|
|
|
9146
9061
|
module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
9147
9062
|
|
|
9148
9063
|
/***/ }),
|
|
9149
|
-
/*
|
|
9064
|
+
/* 14 */
|
|
9150
9065
|
/***/ (function(module, exports, __webpack_require__) {
|
|
9151
9066
|
|
|
9152
9067
|
var toPropertyKey = __webpack_require__(8);
|
|
@@ -9164,223 +9079,135 @@ function _createClass(e, r, t) {
|
|
|
9164
9079
|
module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
9165
9080
|
|
|
9166
9081
|
/***/ }),
|
|
9167
|
-
/*
|
|
9168
|
-
/***/ (function(module,
|
|
9169
|
-
|
|
9170
|
-
"use strict";
|
|
9171
|
-
/* WEBPACK VAR INJECTION */(function(module) {/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
|
|
9172
|
-
/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0__);
|
|
9173
|
-
/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(0);
|
|
9174
|
-
/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__);
|
|
9175
|
-
var fs = __webpack_require__(6);
|
|
9176
|
-
var os = __webpack_require__(24);
|
|
9177
|
-
var path = __webpack_require__(7);
|
|
9178
|
-
var _require = __webpack_require__(2),sleep = _require.sleep;
|
|
9179
|
-
var _require2 = __webpack_require__(25),lockSync = _require2.lockSync,unlockSync = _require2.unlockSync,checkSync = _require2.checkSync,check = _require2.check;
|
|
9180
|
-
|
|
9181
|
-
|
|
9182
|
-
__webpack_require__(39).config({
|
|
9183
|
-
path: ".env.".concat("production")
|
|
9184
|
-
});
|
|
9082
|
+
/* 15 */
|
|
9083
|
+
/***/ (function(module, exports) {
|
|
9185
9084
|
|
|
9186
|
-
|
|
9187
|
-
* The function to handle saving/updating an item to your storage. This could be a Content Item, Page, Url Redirections, Sync State (state), or Sitemap.
|
|
9188
|
-
* @param {Object} params - The parameters object
|
|
9189
|
-
* @param {Object} params.options - A flexible object that can contain any properties specifically related to this interface
|
|
9190
|
-
* @param {String} params.options.rootPath - The path to store/access the content as JSON
|
|
9191
|
-
* @param {Object} params.item - The object representing the Content Item, Page, Url Redirections, Sync State (state), or Sitemap that needs to be saved/updated
|
|
9192
|
-
* @param {String} params.itemType - The type of item being saved/updated, expected values are `item`, `page`, `sitemap`, `nestedsitemap`, `state`, `urlredirections`
|
|
9193
|
-
* @param {String} params.languageCode - The locale code associated to the item being saved/updated
|
|
9194
|
-
* @param {(String|Number)} params.itemID - The ID of the item being saved/updated - this could be a string or number depending on the itemType
|
|
9195
|
-
* @returns {Void}
|
|
9196
|
-
*/
|
|
9197
|
-
var saveItem = /*#__PURE__*/function () {var _ref2 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0___default()(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee(_ref) {var options, item, itemType, languageCode, itemID, filePath, dirPath, json;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee$(_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;
|
|
9085
|
+
module.exports = require("os");
|
|
9198
9086
|
|
|
9199
|
-
|
|
9087
|
+
/***/ }),
|
|
9088
|
+
/* 16 */
|
|
9089
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
9200
9090
|
|
|
9201
|
-
|
|
9091
|
+
/* @flow */
|
|
9092
|
+
/*::
|
|
9202
9093
|
|
|
9094
|
+
type DotenvParseOptions = {
|
|
9095
|
+
debug?: boolean
|
|
9096
|
+
}
|
|
9203
9097
|
|
|
9204
|
-
|
|
9205
|
-
|
|
9206
|
-
}
|
|
9098
|
+
// keys and values from src
|
|
9099
|
+
type DotenvParseOutput = { [string]: string }
|
|
9207
9100
|
|
|
9208
|
-
|
|
9209
|
-
|
|
9101
|
+
type DotenvConfigOptions = {
|
|
9102
|
+
path?: string, // path to .env file
|
|
9103
|
+
encoding?: string, // encoding of .env file
|
|
9104
|
+
debug?: string // turn on logging for debugging purposes
|
|
9105
|
+
}
|
|
9210
9106
|
|
|
9211
|
-
|
|
9212
|
-
|
|
9213
|
-
|
|
9214
|
-
|
|
9215
|
-
* @param {String} params.options.rootPath - The path to store/access the content as JSON
|
|
9216
|
-
* @param {String} params.itemType - The type of item being deleted, expected values are `item`, `page`, `sitemap`, `nestedsitemap`, `state`, `urlredirections`
|
|
9217
|
-
* @param {String} params.languageCode - The locale code associated to the item being saved/updated
|
|
9218
|
-
* @param {(String|Number)} params.itemID - The ID of the item being deleted - this could be a string or number depending on the itemType
|
|
9219
|
-
* @returns {Void}
|
|
9220
|
-
*/
|
|
9221
|
-
var deleteItem = /*#__PURE__*/function () {var _ref4 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0___default()(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee2(_ref3) {var options, itemType, languageCode, itemID, filePath;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee2$(_context2) {while (1) switch (_context2.prev = _context2.next) {case 0:options = _ref3.options, itemType = _ref3.itemType, languageCode = _ref3.languageCode, itemID = _ref3.itemID;
|
|
9107
|
+
type DotenvConfigOutput = {
|
|
9108
|
+
parsed?: DotenvParseOutput,
|
|
9109
|
+
error?: Error
|
|
9110
|
+
}
|
|
9222
9111
|
|
|
9223
|
-
|
|
9112
|
+
*/
|
|
9224
9113
|
|
|
9225
|
-
|
|
9226
|
-
|
|
9227
|
-
}case 3:case "end":return _context2.stop();}}, _callee2);}));return function deleteItem(_x2) {return _ref4.apply(this, arguments);};}();
|
|
9114
|
+
const fs = __webpack_require__(3)
|
|
9115
|
+
const path = __webpack_require__(4)
|
|
9228
9116
|
|
|
9117
|
+
function log (message /*: string */) {
|
|
9118
|
+
console.log(`[dotenv][DEBUG] ${message}`)
|
|
9119
|
+
}
|
|
9229
9120
|
|
|
9230
|
-
|
|
9231
|
-
|
|
9232
|
-
|
|
9233
|
-
|
|
9234
|
-
* @param {String} params.options.rootPath - The path to store/access the content as JSON
|
|
9235
|
-
* @param {Object} params.item - The object representing the Content Item
|
|
9236
|
-
* @param {String} params.languageCode - The locale code associated to the item being saved/updated
|
|
9237
|
-
* @param {(String|Number)} params.itemID - The ID of the item being updated - this could be a string or number depending on the itemType
|
|
9238
|
-
* @param {String} params.referenceName - The reference name of the Content List that this Content Item should be added to
|
|
9239
|
-
* @param {String} params.definitionName - The Model name that the Content Item is based on
|
|
9240
|
-
* @returns {Void}
|
|
9241
|
-
*/
|
|
9242
|
-
var mergeItemToList = /*#__PURE__*/function () {var _ref6 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0___default()(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee3(_ref5) {var options, item, languageCode, itemID, referenceName, definitionName, contentList, cIndex;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee3$(_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 = 3;return (
|
|
9243
|
-
|
|
9244
|
-
getItem({ options: options, itemType: "list", languageCode: languageCode, itemID: referenceName }));case 3:contentList = _context3.sent;
|
|
9245
|
-
|
|
9246
|
-
if (contentList == null) {
|
|
9247
|
-
//initialize the list
|
|
9248
|
-
contentList = [item];
|
|
9249
|
-
} else {
|
|
9250
|
-
//replace the item...
|
|
9251
|
-
cIndex = contentList.findIndex(function (ci) {
|
|
9252
|
-
return ci.contentID === itemID;
|
|
9253
|
-
});
|
|
9254
|
-
|
|
9255
|
-
if (item.properties.state === 3) {
|
|
9256
|
-
//*** deleted item (remove from the list) ***
|
|
9257
|
-
if (cIndex >= 0) {
|
|
9258
|
-
//remove the item
|
|
9259
|
-
contentList.splice(cIndex, 1);
|
|
9260
|
-
}
|
|
9261
|
-
|
|
9262
|
-
} else {
|
|
9263
|
-
//*** regular item (merge) ***
|
|
9264
|
-
if (cIndex >= 0) {
|
|
9265
|
-
//replace the existing item
|
|
9266
|
-
contentList[cIndex] = item;
|
|
9267
|
-
} else {
|
|
9268
|
-
//and it to the end of the
|
|
9269
|
-
contentList.push(item);
|
|
9270
|
-
}
|
|
9271
|
-
}
|
|
9272
|
-
}_context3.next = 7;return (
|
|
9273
|
-
|
|
9274
|
-
saveItem({ options: options, item: contentList, itemType: "list", languageCode: languageCode, itemID: referenceName }));case 7:case "end":return _context3.stop();}}, _callee3);}));return function mergeItemToList(_x3) {return _ref6.apply(this, arguments);};}();
|
|
9275
|
-
|
|
9276
|
-
/**
|
|
9277
|
-
* The function to handle retrieving a Content Item, Page, Url Redirections, Sync State (state), or Sitemap
|
|
9278
|
-
* @param {Object} params - The parameters object
|
|
9279
|
-
* @param {Object} params.options - A flexible object that can contain any properties specifically related to this interface
|
|
9280
|
-
* @param {String} params.options.rootPath - The path to store/access the content as JSON
|
|
9281
|
-
* @param {String} params.itemType - The type of item being accessed, expected values are `item`, `list`, `page`, `sitemap`, `nestedsitemap`, `state`, `urlredirections`
|
|
9282
|
-
* @param {String} params.languageCode - The locale code associated to the item being accessed
|
|
9283
|
-
* @param {(String|Number)} params.itemID - The ID of the item being accessed - this could be a string or number depending on the itemType
|
|
9284
|
-
* @returns {Object}
|
|
9285
|
-
*/
|
|
9286
|
-
var getItem = /*#__PURE__*/function () {var _ref8 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0___default()(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee4(_ref7) {var options, itemType, languageCode, itemID, filePath, json;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee4$(_context4) {while (1) switch (_context4.prev = _context4.next) {case 0:options = _ref7.options, itemType = _ref7.itemType, languageCode = _ref7.languageCode, itemID = _ref7.itemID;
|
|
9287
|
-
filePath = getFilePath({ options: options, itemType: itemType, languageCode: languageCode, itemID: itemID });if (
|
|
9288
|
-
|
|
9289
|
-
fs.existsSync(filePath)) {_context4.next = 4;break;}return _context4.abrupt("return", null);case 4:
|
|
9290
|
-
|
|
9291
|
-
json = fs.readFileSync(filePath, 'utf8');return _context4.abrupt("return",
|
|
9292
|
-
JSON.parse(json));case 6:case "end":return _context4.stop();}}, _callee4);}));return function getItem(_x4) {return _ref8.apply(this, arguments);};}();
|
|
9293
|
-
|
|
9294
|
-
|
|
9295
|
-
/**
|
|
9296
|
-
* The function to handle clearing the cache of synchronized data from the CMS
|
|
9297
|
-
* @param {Object} params - The parameters object
|
|
9298
|
-
* @param {Object} params.options - A flexible object that can contain any properties specifically related to this interface
|
|
9299
|
-
* @param {String} params.options.rootPath - The path to store/access the content as JSON
|
|
9300
|
-
* @returns {Void}
|
|
9301
|
-
*/
|
|
9302
|
-
var clearItems = /*#__PURE__*/function () {var _ref0 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0___default()(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee5(_ref9) {var options;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee5$(_context5) {while (1) switch (_context5.prev = _context5.next) {case 0:options = _ref9.options;
|
|
9303
|
-
fs.rmdirSync(options.rootPath, { recursive: true });case 2:case "end":return _context5.stop();}}, _callee5);}));return function clearItems(_x5) {return _ref0.apply(this, arguments);};}();
|
|
9304
|
-
|
|
9305
|
-
|
|
9306
|
-
|
|
9307
|
-
|
|
9308
|
-
/**
|
|
9309
|
-
* The function to handle multi-threaded Syncs that may be happening at the same time. If you need to prevent a sync from happening and let it wait until another sync has finished use this.
|
|
9310
|
-
* @returns {Promise}
|
|
9311
|
-
*/
|
|
9312
|
-
var mutexLock = /*#__PURE__*/function () {var _ref1 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0___default()(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee6() {var dir, lockFile;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee6$(_context6) {while (1) switch (_context6.prev = _context6.next) {case 0:
|
|
9313
|
-
|
|
9314
|
-
|
|
9315
|
-
dir = os.tmpdir();
|
|
9316
|
-
lockFile = "".concat(dir, "/", "agility-sync", ".mutex");
|
|
9317
|
-
if (!fs.existsSync(lockFile)) {
|
|
9318
|
-
fs.writeFileSync(lockFile, "agility-sync");
|
|
9319
|
-
}
|
|
9320
|
-
|
|
9321
|
-
//THE LOCK IS ALREADY HELD - WAIT UP!
|
|
9322
|
-
_context6.next = 5;return waitOnLock(lockFile);case 5:_context6.prev = 5;return _context6.abrupt("return",
|
|
9323
|
-
|
|
9324
|
-
|
|
9325
|
-
lockSync(lockFile));case 9:_context6.prev = 9;_context6.t0 = _context6["catch"](5);if (!(
|
|
9326
|
-
|
|
9327
|
-
"".concat(_context6.t0).indexOf("Lock file is already being held") !== -1)) {_context6.next = 28;break;}_context6.next = 14;return (
|
|
9328
|
-
|
|
9329
|
-
|
|
9330
|
-
sleep(100));case 14:_context6.next = 16;return (
|
|
9331
|
-
waitOnLock(lockFile));case 16:_context6.prev = 16;return _context6.abrupt("return",
|
|
9332
|
-
|
|
9333
|
-
|
|
9334
|
-
lockSync(lockFile));case 20:_context6.prev = 20;_context6.t1 = _context6["catch"](16);if (!(
|
|
9335
|
-
|
|
9336
|
-
"".concat(_context6.t0).indexOf("Lock file is already being held") !== -1)) {_context6.next = 28;break;}_context6.next = 25;return (
|
|
9337
|
-
|
|
9338
|
-
|
|
9339
|
-
sleep(100));case 25:_context6.next = 27;return (
|
|
9340
|
-
waitOnLock(lockFile));case 27:return _context6.abrupt("return",
|
|
9341
|
-
lockSync(lockFile));case 28:throw (
|
|
9342
|
-
|
|
9121
|
+
const NEWLINE = '\n'
|
|
9122
|
+
const RE_INI_KEY_VAL = /^\s*([\w.-]+)\s*=\s*(.*)?\s*$/
|
|
9123
|
+
const RE_NEWLINES = /\\n/g
|
|
9124
|
+
const NEWLINES_MATCH = /\n|\r|\r\n/
|
|
9343
9125
|
|
|
9126
|
+
// Parses src into an Object
|
|
9127
|
+
function parse (src /*: string | Buffer */, options /*: ?DotenvParseOptions */) /*: DotenvParseOutput */ {
|
|
9128
|
+
const debug = Boolean(options && options.debug)
|
|
9129
|
+
const obj = {}
|
|
9344
9130
|
|
|
9131
|
+
// convert Buffers before splitting into lines and processing
|
|
9132
|
+
src.toString().split(NEWLINES_MATCH).forEach(function (line, idx) {
|
|
9133
|
+
// matching "KEY' and 'VAL' in 'KEY=VAL'
|
|
9134
|
+
const keyValueArr = line.match(RE_INI_KEY_VAL)
|
|
9135
|
+
// matched?
|
|
9136
|
+
if (keyValueArr != null) {
|
|
9137
|
+
const key = keyValueArr[1]
|
|
9138
|
+
// default undefined or missing values to empty string
|
|
9139
|
+
let val = (keyValueArr[2] || '')
|
|
9140
|
+
const end = val.length - 1
|
|
9141
|
+
const isDoubleQuoted = val[0] === '"' && val[end] === '"'
|
|
9142
|
+
const isSingleQuoted = val[0] === "'" && val[end] === "'"
|
|
9345
9143
|
|
|
9346
|
-
|
|
9144
|
+
// if single or double quoted, remove quotes
|
|
9145
|
+
if (isSingleQuoted || isDoubleQuoted) {
|
|
9146
|
+
val = val.substring(1, end)
|
|
9347
9147
|
|
|
9148
|
+
// if double quoted, expand newlines
|
|
9149
|
+
if (isDoubleQuoted) {
|
|
9150
|
+
val = val.replace(RE_NEWLINES, NEWLINE)
|
|
9151
|
+
}
|
|
9152
|
+
} else {
|
|
9153
|
+
// remove surrounding whitespace
|
|
9154
|
+
val = val.trim()
|
|
9155
|
+
}
|
|
9348
9156
|
|
|
9157
|
+
obj[key] = val
|
|
9158
|
+
} else if (debug) {
|
|
9159
|
+
log(`did not match key and value when parsing line ${idx + 1}: ${line}`)
|
|
9160
|
+
}
|
|
9161
|
+
})
|
|
9349
9162
|
|
|
9163
|
+
return obj
|
|
9164
|
+
}
|
|
9350
9165
|
|
|
9166
|
+
// Populates process.env from .env file
|
|
9167
|
+
function config (options /*: ?DotenvConfigOptions */) /*: DotenvConfigOutput */ {
|
|
9168
|
+
let dotenvPath = path.resolve(process.cwd(), '.env')
|
|
9169
|
+
let encoding /*: string */ = 'utf8'
|
|
9170
|
+
let debug = false
|
|
9351
9171
|
|
|
9352
|
-
|
|
9353
|
-
|
|
9354
|
-
|
|
9355
|
-
|
|
9172
|
+
if (options) {
|
|
9173
|
+
if (options.path != null) {
|
|
9174
|
+
dotenvPath = options.path
|
|
9175
|
+
}
|
|
9176
|
+
if (options.encoding != null) {
|
|
9177
|
+
encoding = options.encoding
|
|
9178
|
+
}
|
|
9179
|
+
if (options.debug != null) {
|
|
9180
|
+
debug = true
|
|
9181
|
+
}
|
|
9182
|
+
}
|
|
9356
9183
|
|
|
9184
|
+
try {
|
|
9185
|
+
// specifying an encoding returns a string instead of a buffer
|
|
9186
|
+
const parsed = parse(fs.readFileSync(dotenvPath, { encoding }), { debug })
|
|
9357
9187
|
|
|
9188
|
+
Object.keys(parsed).forEach(function (key) {
|
|
9189
|
+
if (!Object.prototype.hasOwnProperty.call(process.env, key)) {
|
|
9190
|
+
process.env[key] = parsed[key]
|
|
9191
|
+
} else if (debug) {
|
|
9192
|
+
log(`"${key}" is already defined in \`process.env\` and will not be overwritten`)
|
|
9193
|
+
}
|
|
9194
|
+
})
|
|
9358
9195
|
|
|
9359
|
-
|
|
9360
|
-
|
|
9361
|
-
|
|
9362
|
-
itemID = itemID.replace(/[`!@#$%^&*()+\=\[\]{};':"\\|,.<>\/?~]/g, "");
|
|
9196
|
+
return { parsed }
|
|
9197
|
+
} catch (e) {
|
|
9198
|
+
return { error: e }
|
|
9363
9199
|
}
|
|
9364
|
-
|
|
9365
|
-
return path.join(options.rootPath, languageCode, itemType, fileName);
|
|
9366
|
-
};
|
|
9200
|
+
}
|
|
9367
9201
|
|
|
9202
|
+
module.exports.config = config
|
|
9203
|
+
module.exports.parse = parse
|
|
9368
9204
|
|
|
9369
|
-
module.exports = {
|
|
9370
|
-
saveItem: saveItem,
|
|
9371
|
-
deleteItem: deleteItem,
|
|
9372
|
-
mergeItemToList: mergeItemToList,
|
|
9373
|
-
getItem: getItem,
|
|
9374
|
-
clearItems: clearItems,
|
|
9375
|
-
mutexLock: mutexLock
|
|
9376
|
-
};
|
|
9377
|
-
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(11)(module)))
|
|
9378
9205
|
|
|
9379
9206
|
/***/ }),
|
|
9380
9207
|
/* 17 */
|
|
9381
9208
|
/***/ (function(module, exports, __webpack_require__) {
|
|
9382
9209
|
|
|
9383
|
-
var _typeof = __webpack_require__(
|
|
9210
|
+
var _typeof = __webpack_require__(6)["default"];
|
|
9384
9211
|
function toPrimitive(t, r) {
|
|
9385
9212
|
if ("object" != _typeof(t) || !t) return t;
|
|
9386
9213
|
var e = t[Symbol.toPrimitive];
|
|
@@ -9449,7 +9276,7 @@ module.exports = require("zlib");
|
|
|
9449
9276
|
/* 23 */
|
|
9450
9277
|
/***/ (function(module, exports, __webpack_require__) {
|
|
9451
9278
|
|
|
9452
|
-
var _typeof = __webpack_require__(
|
|
9279
|
+
var _typeof = __webpack_require__(6)["default"];
|
|
9453
9280
|
function _regeneratorRuntime() {
|
|
9454
9281
|
"use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
9455
9282
|
module.exports = _regeneratorRuntime = function _regeneratorRuntime() {
|
|
@@ -9756,69 +9583,16 @@ module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.e
|
|
|
9756
9583
|
|
|
9757
9584
|
/***/ }),
|
|
9758
9585
|
/* 24 */
|
|
9759
|
-
/***/ (function(module, exports) {
|
|
9760
|
-
|
|
9761
|
-
module.exports = require("os");
|
|
9762
|
-
|
|
9763
|
-
/***/ }),
|
|
9764
|
-
/* 25 */
|
|
9765
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
9766
|
-
|
|
9767
|
-
"use strict";
|
|
9768
|
-
|
|
9769
|
-
|
|
9770
|
-
const lockfile = __webpack_require__(26);
|
|
9771
|
-
const { toPromise, toSync, toSyncOptions } = __webpack_require__(38);
|
|
9772
|
-
|
|
9773
|
-
async function lock(file, options) {
|
|
9774
|
-
const release = await toPromise(lockfile.lock)(file, options);
|
|
9775
|
-
|
|
9776
|
-
return toPromise(release);
|
|
9777
|
-
}
|
|
9778
|
-
|
|
9779
|
-
function lockSync(file, options) {
|
|
9780
|
-
const release = toSync(lockfile.lock)(file, toSyncOptions(options));
|
|
9781
|
-
|
|
9782
|
-
return toSync(release);
|
|
9783
|
-
}
|
|
9784
|
-
|
|
9785
|
-
function unlock(file, options) {
|
|
9786
|
-
return toPromise(lockfile.unlock)(file, options);
|
|
9787
|
-
}
|
|
9788
|
-
|
|
9789
|
-
function unlockSync(file, options) {
|
|
9790
|
-
return toSync(lockfile.unlock)(file, toSyncOptions(options));
|
|
9791
|
-
}
|
|
9792
|
-
|
|
9793
|
-
function check(file, options) {
|
|
9794
|
-
return toPromise(lockfile.check)(file, options);
|
|
9795
|
-
}
|
|
9796
|
-
|
|
9797
|
-
function checkSync(file, options) {
|
|
9798
|
-
return toSync(lockfile.check)(file, toSyncOptions(options));
|
|
9799
|
-
}
|
|
9800
|
-
|
|
9801
|
-
module.exports = lock;
|
|
9802
|
-
module.exports.lock = lock;
|
|
9803
|
-
module.exports.unlock = unlock;
|
|
9804
|
-
module.exports.lockSync = lockSync;
|
|
9805
|
-
module.exports.unlockSync = unlockSync;
|
|
9806
|
-
module.exports.check = check;
|
|
9807
|
-
module.exports.checkSync = checkSync;
|
|
9808
|
-
|
|
9809
|
-
|
|
9810
|
-
/***/ }),
|
|
9811
|
-
/* 26 */
|
|
9812
9586
|
/***/ (function(module, exports, __webpack_require__) {
|
|
9813
9587
|
|
|
9814
9588
|
"use strict";
|
|
9815
9589
|
|
|
9816
9590
|
|
|
9817
|
-
const path = __webpack_require__(
|
|
9818
|
-
const fs = __webpack_require__(
|
|
9819
|
-
const retry = __webpack_require__(
|
|
9820
|
-
const onExit = __webpack_require__(
|
|
9821
|
-
const mtimePrecision = __webpack_require__(
|
|
9591
|
+
const path = __webpack_require__(4);
|
|
9592
|
+
const fs = __webpack_require__(11);
|
|
9593
|
+
const retry = __webpack_require__(29);
|
|
9594
|
+
const onExit = __webpack_require__(32);
|
|
9595
|
+
const mtimePrecision = __webpack_require__(35);
|
|
9822
9596
|
|
|
9823
9597
|
const locks = {};
|
|
9824
9598
|
|
|
@@ -10157,10 +9931,10 @@ module.exports.getLocks = getLocks;
|
|
|
10157
9931
|
|
|
10158
9932
|
|
|
10159
9933
|
/***/ }),
|
|
10160
|
-
/*
|
|
9934
|
+
/* 25 */
|
|
10161
9935
|
/***/ (function(module, exports, __webpack_require__) {
|
|
10162
9936
|
|
|
10163
|
-
var constants = __webpack_require__(
|
|
9937
|
+
var constants = __webpack_require__(26)
|
|
10164
9938
|
|
|
10165
9939
|
var origCwd = process.cwd
|
|
10166
9940
|
var cwd = null
|
|
@@ -10518,13 +10292,13 @@ function patch (fs) {
|
|
|
10518
10292
|
|
|
10519
10293
|
|
|
10520
10294
|
/***/ }),
|
|
10521
|
-
/*
|
|
10295
|
+
/* 26 */
|
|
10522
10296
|
/***/ (function(module, exports) {
|
|
10523
10297
|
|
|
10524
10298
|
module.exports = require("constants");
|
|
10525
10299
|
|
|
10526
10300
|
/***/ }),
|
|
10527
|
-
/*
|
|
10301
|
+
/* 27 */
|
|
10528
10302
|
/***/ (function(module, exports, __webpack_require__) {
|
|
10529
10303
|
|
|
10530
10304
|
var Stream = __webpack_require__(9).Stream
|
|
@@ -10648,7 +10422,7 @@ function legacy (fs) {
|
|
|
10648
10422
|
|
|
10649
10423
|
|
|
10650
10424
|
/***/ }),
|
|
10651
|
-
/*
|
|
10425
|
+
/* 28 */
|
|
10652
10426
|
/***/ (function(module, exports, __webpack_require__) {
|
|
10653
10427
|
|
|
10654
10428
|
"use strict";
|
|
@@ -10678,16 +10452,16 @@ function clone (obj) {
|
|
|
10678
10452
|
|
|
10679
10453
|
|
|
10680
10454
|
/***/ }),
|
|
10681
|
-
/*
|
|
10455
|
+
/* 29 */
|
|
10682
10456
|
/***/ (function(module, exports, __webpack_require__) {
|
|
10683
10457
|
|
|
10684
|
-
module.exports = __webpack_require__(
|
|
10458
|
+
module.exports = __webpack_require__(30);
|
|
10685
10459
|
|
|
10686
10460
|
/***/ }),
|
|
10687
|
-
/*
|
|
10461
|
+
/* 30 */
|
|
10688
10462
|
/***/ (function(module, exports, __webpack_require__) {
|
|
10689
10463
|
|
|
10690
|
-
var RetryOperation = __webpack_require__(
|
|
10464
|
+
var RetryOperation = __webpack_require__(31);
|
|
10691
10465
|
|
|
10692
10466
|
exports.operation = function(options) {
|
|
10693
10467
|
var timeouts = exports.timeouts(options);
|
|
@@ -10790,7 +10564,7 @@ exports.wrap = function(obj, options, methods) {
|
|
|
10790
10564
|
|
|
10791
10565
|
|
|
10792
10566
|
/***/ }),
|
|
10793
|
-
/*
|
|
10567
|
+
/* 31 */
|
|
10794
10568
|
/***/ (function(module, exports) {
|
|
10795
10569
|
|
|
10796
10570
|
function RetryOperation(timeouts, options) {
|
|
@@ -10954,7 +10728,7 @@ RetryOperation.prototype.mainError = function() {
|
|
|
10954
10728
|
|
|
10955
10729
|
|
|
10956
10730
|
/***/ }),
|
|
10957
|
-
/*
|
|
10731
|
+
/* 32 */
|
|
10958
10732
|
/***/ (function(module, exports, __webpack_require__) {
|
|
10959
10733
|
|
|
10960
10734
|
// Note: since nyc uses this module to output coverage, any lines
|
|
@@ -10982,11 +10756,11 @@ if (!processOk(process)) {
|
|
|
10982
10756
|
return function () {}
|
|
10983
10757
|
}
|
|
10984
10758
|
} else {
|
|
10985
|
-
var assert = __webpack_require__(
|
|
10986
|
-
var signals = __webpack_require__(
|
|
10759
|
+
var assert = __webpack_require__(7)
|
|
10760
|
+
var signals = __webpack_require__(33)
|
|
10987
10761
|
var isWin = /^win/i.test(process.platform)
|
|
10988
10762
|
|
|
10989
|
-
var EE = __webpack_require__(
|
|
10763
|
+
var EE = __webpack_require__(34)
|
|
10990
10764
|
/* istanbul ignore if */
|
|
10991
10765
|
if (typeof EE !== 'function') {
|
|
10992
10766
|
EE = EE.EventEmitter
|
|
@@ -11162,7 +10936,7 @@ if (!processOk(process)) {
|
|
|
11162
10936
|
|
|
11163
10937
|
|
|
11164
10938
|
/***/ }),
|
|
11165
|
-
/*
|
|
10939
|
+
/* 33 */
|
|
11166
10940
|
/***/ (function(module, exports) {
|
|
11167
10941
|
|
|
11168
10942
|
// This is not the set of all possible signals.
|
|
@@ -11221,13 +10995,13 @@ if (process.platform === 'linux') {
|
|
|
11221
10995
|
|
|
11222
10996
|
|
|
11223
10997
|
/***/ }),
|
|
11224
|
-
/*
|
|
10998
|
+
/* 34 */
|
|
11225
10999
|
/***/ (function(module, exports) {
|
|
11226
11000
|
|
|
11227
11001
|
module.exports = require("events");
|
|
11228
11002
|
|
|
11229
11003
|
/***/ }),
|
|
11230
|
-
/*
|
|
11004
|
+
/* 35 */
|
|
11231
11005
|
/***/ (function(module, exports, __webpack_require__) {
|
|
11232
11006
|
|
|
11233
11007
|
"use strict";
|
|
@@ -11289,13 +11063,13 @@ module.exports.getMtime = getMtime;
|
|
|
11289
11063
|
|
|
11290
11064
|
|
|
11291
11065
|
/***/ }),
|
|
11292
|
-
/*
|
|
11066
|
+
/* 36 */
|
|
11293
11067
|
/***/ (function(module, exports, __webpack_require__) {
|
|
11294
11068
|
|
|
11295
11069
|
"use strict";
|
|
11296
11070
|
|
|
11297
11071
|
|
|
11298
|
-
const fs = __webpack_require__(
|
|
11072
|
+
const fs = __webpack_require__(11);
|
|
11299
11073
|
|
|
11300
11074
|
function createSyncFs(fs) {
|
|
11301
11075
|
const methods = ['mkdir', 'realpath', 'stat', 'rmdir', 'utimes'];
|
|
@@ -11381,150 +11155,105 @@ module.exports = {
|
|
|
11381
11155
|
|
|
11382
11156
|
|
|
11383
11157
|
/***/ }),
|
|
11384
|
-
/*
|
|
11385
|
-
/***/ (function(module,
|
|
11158
|
+
/* 37 */
|
|
11159
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
11386
11160
|
|
|
11387
|
-
|
|
11388
|
-
|
|
11161
|
+
"use strict";
|
|
11162
|
+
// ESM COMPAT FLAG
|
|
11163
|
+
__webpack_require__.r(__webpack_exports__);
|
|
11389
11164
|
|
|
11390
|
-
|
|
11391
|
-
|
|
11392
|
-
}
|
|
11165
|
+
// EXPORTS
|
|
11166
|
+
__webpack_require__.d(__webpack_exports__, "getSyncClient", function() { return /* binding */ getSyncClient; });
|
|
11393
11167
|
|
|
11394
|
-
//
|
|
11395
|
-
|
|
11168
|
+
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/defineProperty.js
|
|
11169
|
+
var defineProperty = __webpack_require__(2);
|
|
11170
|
+
var defineProperty_default = /*#__PURE__*/__webpack_require__.n(defineProperty);
|
|
11396
11171
|
|
|
11397
|
-
|
|
11398
|
-
|
|
11399
|
-
|
|
11400
|
-
debug?: string // turn on logging for debugging purposes
|
|
11401
|
-
}
|
|
11172
|
+
// EXTERNAL MODULE: ./node_modules/@agility/content-fetch/dist/agility-content-fetch.node.js
|
|
11173
|
+
var agility_content_fetch_node = __webpack_require__(12);
|
|
11174
|
+
var agility_content_fetch_node_default = /*#__PURE__*/__webpack_require__.n(agility_content_fetch_node);
|
|
11402
11175
|
|
|
11403
|
-
|
|
11404
|
-
|
|
11405
|
-
|
|
11406
|
-
}
|
|
11176
|
+
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/asyncToGenerator.js
|
|
11177
|
+
var asyncToGenerator = __webpack_require__(1);
|
|
11178
|
+
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
|
|
11407
11179
|
|
|
11408
|
-
|
|
11180
|
+
// EXTERNAL MODULE: ./node_modules/@babel/runtime/regenerator/index.js
|
|
11181
|
+
var regenerator = __webpack_require__(0);
|
|
11182
|
+
var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator);
|
|
11409
11183
|
|
|
11410
|
-
|
|
11411
|
-
const path = __webpack_require__(7)
|
|
11184
|
+
// CONCATENATED MODULE: ./src/util.js
|
|
11412
11185
|
|
|
11413
|
-
function
|
|
11414
|
-
|
|
11415
|
-
}
|
|
11186
|
+
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 _callee$(_context) {while (1) switch (_context.prev = _context.next) {case 0:
|
|
11187
|
+
index = 0;case 1:if (!(index < array.length)) {_context.next = 7;break;}_context.next = 4;return (
|
|
11188
|
+
callback(array[index], index, array));case 4:index++;_context.next = 1;break;case 7:case "end":return _context.stop();}}, _callee);}));return function asyncForEach(_x, _x2) {return _ref.apply(this, arguments);};}();
|
|
11416
11189
|
|
|
11417
|
-
const NEWLINE = '\n'
|
|
11418
|
-
const RE_INI_KEY_VAL = /^\s*([\w.-]+)\s*=\s*(.*)?\s*$/
|
|
11419
|
-
const RE_NEWLINES = /\\n/g
|
|
11420
|
-
const NEWLINES_MATCH = /\n|\r|\r\n/
|
|
11421
11190
|
|
|
11422
|
-
// Parses src into an Object
|
|
11423
|
-
function parse (src /*: string | Buffer */, options /*: ?DotenvParseOptions */) /*: DotenvParseOutput */ {
|
|
11424
|
-
const debug = Boolean(options && options.debug)
|
|
11425
|
-
const obj = {}
|
|
11426
11191
|
|
|
11427
|
-
// convert Buffers before splitting into lines and processing
|
|
11428
|
-
src.toString().split(NEWLINES_MATCH).forEach(function (line, idx) {
|
|
11429
|
-
// matching "KEY' and 'VAL' in 'KEY=VAL'
|
|
11430
|
-
const keyValueArr = line.match(RE_INI_KEY_VAL)
|
|
11431
|
-
// matched?
|
|
11432
|
-
if (keyValueArr != null) {
|
|
11433
|
-
const key = keyValueArr[1]
|
|
11434
|
-
// default undefined or missing values to empty string
|
|
11435
|
-
let val = (keyValueArr[2] || '')
|
|
11436
|
-
const end = val.length - 1
|
|
11437
|
-
const isDoubleQuoted = val[0] === '"' && val[end] === '"'
|
|
11438
|
-
const isSingleQuoted = val[0] === "'" && val[end] === "'"
|
|
11439
11192
|
|
|
11440
|
-
|
|
11441
|
-
|
|
11442
|
-
val = val.substring(1, end)
|
|
11193
|
+
var getLogLevel = function getLogLevel() {
|
|
11194
|
+
var logLevel = (process.env.AGILITY_LOG_LEVEL || 'warning').toLowerCase();
|
|
11443
11195
|
|
|
11444
|
-
|
|
11445
|
-
|
|
11446
|
-
|
|
11447
|
-
}
|
|
11448
|
-
} else {
|
|
11449
|
-
// remove surrounding whitespace
|
|
11450
|
-
val = val.trim()
|
|
11451
|
-
}
|
|
11196
|
+
if (logLevel !== 'debug' && logLevel !== 'info' && logLevel !== 'warning' && logLevel !== 'error' && logLevel !== 'none') {
|
|
11197
|
+
return 'warning';
|
|
11198
|
+
}
|
|
11452
11199
|
|
|
11453
|
-
|
|
11454
|
-
} else if (debug) {
|
|
11455
|
-
log(`did not match key and value when parsing line ${idx + 1}: ${line}`)
|
|
11456
|
-
}
|
|
11457
|
-
})
|
|
11200
|
+
return logLevel;
|
|
11458
11201
|
|
|
11459
|
-
|
|
11460
|
-
}
|
|
11202
|
+
};
|
|
11461
11203
|
|
|
11462
|
-
// Populates process.env from .env file
|
|
11463
|
-
function config (options /*: ?DotenvConfigOptions */) /*: DotenvConfigOutput */ {
|
|
11464
|
-
let dotenvPath = path.resolve(process.cwd(), '.env')
|
|
11465
|
-
let encoding /*: string */ = 'utf8'
|
|
11466
|
-
let debug = false
|
|
11467
11204
|
|
|
11468
|
-
|
|
11469
|
-
|
|
11470
|
-
|
|
11471
|
-
|
|
11472
|
-
|
|
11473
|
-
|
|
11474
|
-
|
|
11475
|
-
if (options.debug != null) {
|
|
11476
|
-
debug = true
|
|
11477
|
-
}
|
|
11205
|
+
var logSuccess = function logSuccess(message) {
|
|
11206
|
+
|
|
11207
|
+
var logLevel = getLogLevel();
|
|
11208
|
+
if (logLevel === 'debug' || logLevel === 'info') {
|
|
11209
|
+
|
|
11210
|
+
message = "AgilityCMS => ".concat(message, " ");
|
|
11211
|
+
console.log('\x1b[32m%s\x1b[0m', message);
|
|
11478
11212
|
}
|
|
11213
|
+
};
|
|
11479
11214
|
|
|
11480
|
-
|
|
11481
|
-
// specifying an encoding returns a string instead of a buffer
|
|
11482
|
-
const parsed = parse(fs.readFileSync(dotenvPath, { encoding }), { debug })
|
|
11215
|
+
var logWarning = function logWarning(message) {
|
|
11483
11216
|
|
|
11484
|
-
|
|
11485
|
-
|
|
11486
|
-
process.env[key] = parsed[key]
|
|
11487
|
-
} else if (debug) {
|
|
11488
|
-
log(`"${key}" is already defined in \`process.env\` and will not be overwritten`)
|
|
11489
|
-
}
|
|
11490
|
-
})
|
|
11217
|
+
var logLevel = getLogLevel();
|
|
11218
|
+
if (logLevel === 'debug' || logLevel === 'info' || logLevel === 'warning') {
|
|
11491
11219
|
|
|
11492
|
-
|
|
11493
|
-
|
|
11494
|
-
return { error: e }
|
|
11220
|
+
message = "AgilityCMS => ".concat(message, " ");
|
|
11221
|
+
console.log('\x1b[33m%s\x1b[0m', message);
|
|
11495
11222
|
}
|
|
11496
|
-
}
|
|
11497
|
-
|
|
11498
|
-
module.exports.config = config
|
|
11499
|
-
module.exports.parse = parse
|
|
11223
|
+
};
|
|
11500
11224
|
|
|
11225
|
+
var logError = function logError(message) {
|
|
11501
11226
|
|
|
11502
|
-
|
|
11503
|
-
|
|
11504
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
11227
|
+
var logLevel = getLogLevel();
|
|
11228
|
+
if (logLevel === 'debug' || logLevel === 'info' || logLevel === 'warning' || logLevel === 'error') {
|
|
11505
11229
|
|
|
11506
|
-
"
|
|
11507
|
-
|
|
11508
|
-
|
|
11230
|
+
message = "AgilityCMS => ".concat(message, " ");
|
|
11231
|
+
console.log('\x1b[31m%s\x1b[0m', message);
|
|
11232
|
+
}
|
|
11233
|
+
};
|
|
11509
11234
|
|
|
11510
|
-
|
|
11511
|
-
var
|
|
11512
|
-
|
|
11235
|
+
var logInfo = function logInfo(message) {
|
|
11236
|
+
var logLevel = getLogLevel();
|
|
11237
|
+
if (logLevel === 'debug' || logLevel === 'info') {
|
|
11238
|
+
message = "AgilityCMS => ".concat(message, " ");
|
|
11239
|
+
console.log(message);
|
|
11240
|
+
}
|
|
11241
|
+
};
|
|
11513
11242
|
|
|
11514
|
-
|
|
11515
|
-
var
|
|
11516
|
-
|
|
11243
|
+
var logDebug = function logDebug(message) {
|
|
11244
|
+
var logLevel = getLogLevel();
|
|
11245
|
+
if (logLevel === 'debug') {
|
|
11246
|
+
console.log('#######################################################################');
|
|
11247
|
+
message = "AgilityCMS(debug) => ".concat(message, " ");
|
|
11248
|
+
console.log('"\x1b[35m%s\x1b[0m', message);
|
|
11249
|
+
}
|
|
11250
|
+
};
|
|
11517
11251
|
|
|
11518
|
-
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/asyncToGenerator.js
|
|
11519
|
-
var asyncToGenerator = __webpack_require__(1);
|
|
11520
|
-
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
|
|
11521
11252
|
|
|
11522
|
-
|
|
11523
|
-
|
|
11524
|
-
|
|
11253
|
+
var sleep = function sleep(ms) {
|
|
11254
|
+
return new Promise(function (resolve) {return setTimeout(resolve, ms);});
|
|
11255
|
+
};
|
|
11525
11256
|
|
|
11526
|
-
// EXTERNAL MODULE: ./src/util.js
|
|
11527
|
-
var util = __webpack_require__(2);
|
|
11528
11257
|
|
|
11529
11258
|
// CONCATENATED MODULE: ./src/methods/syncContent.js
|
|
11530
11259
|
|
|
@@ -11560,22 +11289,22 @@ var util = __webpack_require__(2);
|
|
|
11560
11289
|
//if the api is being updated, wait a few ms and try again...
|
|
11561
11290
|
waitMS += waitIntervalMS;if (!(
|
|
11562
11291
|
waitMS > waitMaxMS)) {_context.next = 14;break;}
|
|
11563
|
-
|
|
11292
|
+
logWarning("Sync API has been busy for too long, canceling.");return _context.abrupt("break", 35);case 14:
|
|
11564
11293
|
|
|
11565
11294
|
|
|
11566
11295
|
|
|
11567
11296
|
if (!busy) {
|
|
11568
11297
|
//first time we're busy...
|
|
11569
11298
|
busy = true;
|
|
11570
|
-
|
|
11299
|
+
logInfo("Sync API is busy. Waiting...");
|
|
11571
11300
|
}_context.next = 17;return (
|
|
11572
11301
|
|
|
11573
|
-
|
|
11302
|
+
sleep(waitIntervalMS));case 17:return _context.abrupt("continue", 34);case 18:
|
|
11574
11303
|
|
|
11575
11304
|
|
|
11576
11305
|
|
|
11577
11306
|
if (busy === true) {
|
|
11578
|
-
|
|
11307
|
+
logInfo("Continuing sync...");
|
|
11579
11308
|
busy = false;
|
|
11580
11309
|
waitMS = 0;
|
|
11581
11310
|
}
|
|
@@ -11601,9 +11330,9 @@ var util = __webpack_require__(2);
|
|
|
11601
11330
|
token > 0 || busy === true) {_context.next = 6;break;}case 35:
|
|
11602
11331
|
|
|
11603
11332
|
if (itemCount > 0) {
|
|
11604
|
-
|
|
11333
|
+
logInfo("Content Sync returned ".concat(itemCount, " item(s)."));
|
|
11605
11334
|
} else {
|
|
11606
|
-
|
|
11335
|
+
logInfo("Content Sync returned no item(s).");
|
|
11607
11336
|
}return _context.abrupt("return",
|
|
11608
11337
|
|
|
11609
11338
|
token);case 37:case "end":return _context.stop();}}, _callee);}));return syncContent_ref.apply(this, arguments);}
|
|
@@ -11612,7 +11341,7 @@ var util = __webpack_require__(2);
|
|
|
11612
11341
|
|
|
11613
11342
|
/* 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 _callee$(_context) {while (1) switch (_context.prev = _context.next) {case 0:_context.next = 2;return (
|
|
11614
11343
|
storeInterface.clear());case 2:
|
|
11615
|
-
|
|
11344
|
+
logSuccess("Cleared Sync Items");case 3:case "end":return _context.stop();}}, _callee);}));return clearSync_ref.apply(this, arguments);}
|
|
11616
11345
|
// CONCATENATED MODULE: ./src/methods/syncPages.js
|
|
11617
11346
|
|
|
11618
11347
|
|
|
@@ -11640,21 +11369,21 @@ var util = __webpack_require__(2);
|
|
|
11640
11369
|
//if the api is being updated, wait a few ms and try again...
|
|
11641
11370
|
waitMS += waitIntervalMS;if (!(
|
|
11642
11371
|
waitMS > waitMaxMS)) {_context.next = 14;break;}
|
|
11643
|
-
|
|
11372
|
+
logWarning("Sync API has been busy for too long, canceling.");return _context.abrupt("break", 35);case 14:
|
|
11644
11373
|
|
|
11645
11374
|
|
|
11646
11375
|
|
|
11647
11376
|
if (!busy) {
|
|
11648
11377
|
busy = true;
|
|
11649
|
-
|
|
11378
|
+
logInfo("Sync API is busy. Waiting...");
|
|
11650
11379
|
}_context.next = 17;return (
|
|
11651
11380
|
|
|
11652
|
-
|
|
11381
|
+
sleep(waitIntervalMS));case 17:return _context.abrupt("continue", 34);case 18:
|
|
11653
11382
|
|
|
11654
11383
|
|
|
11655
11384
|
|
|
11656
11385
|
if (busy === true) {
|
|
11657
|
-
|
|
11386
|
+
logInfo("Continuing sync...");
|
|
11658
11387
|
waitMS = 0;
|
|
11659
11388
|
busy = false;
|
|
11660
11389
|
}
|
|
@@ -11682,9 +11411,9 @@ var util = __webpack_require__(2);
|
|
|
11682
11411
|
token > 0 || busy === true) {_context.next = 6;break;}case 35:
|
|
11683
11412
|
|
|
11684
11413
|
if (itemCount > 0) {
|
|
11685
|
-
|
|
11414
|
+
logInfo("Page Sync returned ".concat(itemCount, " item(s)."));
|
|
11686
11415
|
} else {
|
|
11687
|
-
|
|
11416
|
+
logInfo("Page Sync returned no item(s).");
|
|
11688
11417
|
}return _context.abrupt("return",
|
|
11689
11418
|
|
|
11690
11419
|
|
|
@@ -11740,7 +11469,7 @@ var sync = /*#__PURE__*/function () {var _ref2 = asyncToGenerator_default()(/*#_
|
|
|
11740
11469
|
|
|
11741
11470
|
|
|
11742
11471
|
|
|
11743
|
-
|
|
11472
|
+
logSuccess("Starting Sync for ".concat(languageCode, " - ").concat(modeStr, " mode."));_context2.next = 18;return (
|
|
11744
11473
|
syncContent(languageCode, syncState.itemToken));case 18:newItemToken = _context2.sent;_context2.next = 21;return (
|
|
11745
11474
|
syncPages(languageCode, syncState.pageToken));case 21:newPageToken = _context2.sent;if (!(
|
|
11746
11475
|
|
|
@@ -11749,7 +11478,7 @@ var sync = /*#__PURE__*/function () {var _ref2 = asyncToGenerator_default()(/*#_
|
|
|
11749
11478
|
//if we sync ANYTHING - pull the new sitemap down
|
|
11750
11479
|
_iterator2 = _createForOfIteratorHelper(
|
|
11751
11480
|
channels);_context2.prev = 24;_iterator2.s();case 26:if ((_step2 = _iterator2.n()).done) {_context2.next = 39;break;}channelName = _step2.value;
|
|
11752
|
-
|
|
11481
|
+
logInfo("Updating Sitemap channel ".concat(channelName, " in ").concat(languageCode));_context2.next = 31;return (
|
|
11753
11482
|
|
|
11754
11483
|
agilityClient.getSitemapFlat({ channelName: channelName, languageCode: languageCode }));case 31:sitemap = _context2.sent;
|
|
11755
11484
|
storeInterface.saveSitemap({ sitemap: sitemap, languageCode: languageCode, channelName: channelName });_context2.next = 35;return (
|
|
@@ -11767,7 +11496,7 @@ var sync = /*#__PURE__*/function () {var _ref2 = asyncToGenerator_default()(/*#_
|
|
|
11767
11496
|
|
|
11768
11497
|
agilityClient.getUrlRedirections({ lastAccessDate: lastAccessDate }));case 54:urlRedirections = _context2.sent;if (!(
|
|
11769
11498
|
urlRedirections && urlRedirections.isUpToDate === false)) {_context2.next = 59;break;}
|
|
11770
|
-
|
|
11499
|
+
logInfo("URL Redirections Updated and Saved");_context2.next = 59;return (
|
|
11771
11500
|
storeInterface.saveUrlRedirections({ urlRedirections: urlRedirections, languageCode: languageCode }));case 59:
|
|
11772
11501
|
|
|
11773
11502
|
|
|
@@ -11777,18 +11506,18 @@ var sync = /*#__PURE__*/function () {var _ref2 = asyncToGenerator_default()(/*#_
|
|
|
11777
11506
|
|
|
11778
11507
|
storeInterface.saveSyncState({ syncState: syncState, languageCode: languageCode }));case 64:
|
|
11779
11508
|
|
|
11780
|
-
|
|
11509
|
+
logSuccess("Completed Sync for ".concat(languageCode, " - ").concat(modeStr, " mode."));case 65:_context2.next = 6;break;case 67:_context2.next = 72;break;case 69:_context2.prev = 69;_context2.t1 = _context2["catch"](4);_iterator.e(_context2.t1);case 72:_context2.prev = 72;_iterator.f();return _context2.finish(72);case 75:case "end":return _context2.stop();}}, _callee2, null, [[4, 69, 72, 75], [24, 41, 44, 47]]);}));return function sync(_x6, _x7, _x8, _x9, _x0) {return _ref2.apply(this, arguments);};}();
|
|
11781
11510
|
|
|
11782
11511
|
|
|
11783
11512
|
|
|
11784
11513
|
|
|
11785
11514
|
/* harmony default export */ var methods_runSync = (syncRunner);
|
|
11786
11515
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/classCallCheck.js
|
|
11787
|
-
var classCallCheck = __webpack_require__(
|
|
11516
|
+
var classCallCheck = __webpack_require__(13);
|
|
11788
11517
|
var classCallCheck_default = /*#__PURE__*/__webpack_require__.n(classCallCheck);
|
|
11789
11518
|
|
|
11790
11519
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/createClass.js
|
|
11791
|
-
var createClass = __webpack_require__(
|
|
11520
|
+
var createClass = __webpack_require__(14);
|
|
11792
11521
|
var createClass_default = /*#__PURE__*/__webpack_require__.n(createClass);
|
|
11793
11522
|
|
|
11794
11523
|
// CONCATENATED MODULE: ./src/store-interface.js
|
|
@@ -11852,7 +11581,7 @@ var store_interface_StoreInterface = /*#__PURE__*/function () {
|
|
|
11852
11581
|
!contentItem ||
|
|
11853
11582
|
!contentItem.properties)) {_context.next = 4;break;}
|
|
11854
11583
|
|
|
11855
|
-
|
|
11584
|
+
logWarning("Null item or item with no properties cannot be saved");return _context.abrupt("return");case 4:
|
|
11856
11585
|
|
|
11857
11586
|
|
|
11858
11587
|
|
|
@@ -11886,7 +11615,7 @@ var store_interface_StoreInterface = /*#__PURE__*/function () {
|
|
|
11886
11615
|
|
|
11887
11616
|
!contentItem.properties.definitionName ||
|
|
11888
11617
|
!contentItem.properties.referenceName)) {_context.next = 20;break;}
|
|
11889
|
-
|
|
11618
|
+
logWarning("Content with id ".concat(contentItem.contentID, " does not have the neccessary properties to be saved."));return _context.abrupt("return");case 20:_context.next = 22;return (
|
|
11890
11619
|
|
|
11891
11620
|
|
|
11892
11621
|
|
|
@@ -12275,9 +12004,228 @@ var store_interface_StoreInterface = /*#__PURE__*/function () {
|
|
|
12275
12004
|
*/defineProperty_default()(this, "clear", /*#__PURE__*/asyncToGenerator_default()(/*#__PURE__*/regenerator_default.a.mark(
|
|
12276
12005
|
function _callee13() {return regenerator_default.a.wrap(function _callee13$(_context13) {while (1) switch (_context13.prev = _context13.next) {case 0:_context13.next = 2;return (
|
|
12277
12006
|
_this.store.clearItems({ options: _this.options }));case 2: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`.");}} }]);}();
|
|
12278
|
-
// EXTERNAL MODULE:
|
|
12279
|
-
var
|
|
12007
|
+
// EXTERNAL MODULE: external "fs"
|
|
12008
|
+
var external_fs_ = __webpack_require__(3);
|
|
12009
|
+
var external_fs_default = /*#__PURE__*/__webpack_require__.n(external_fs_);
|
|
12010
|
+
|
|
12011
|
+
// EXTERNAL MODULE: external "os"
|
|
12012
|
+
var external_os_ = __webpack_require__(15);
|
|
12013
|
+
var external_os_default = /*#__PURE__*/__webpack_require__.n(external_os_);
|
|
12014
|
+
|
|
12015
|
+
// EXTERNAL MODULE: external "path"
|
|
12016
|
+
var external_path_ = __webpack_require__(4);
|
|
12017
|
+
var external_path_default = /*#__PURE__*/__webpack_require__.n(external_path_);
|
|
12018
|
+
|
|
12019
|
+
// EXTERNAL MODULE: ./node_modules/proper-lockfile/index.js
|
|
12020
|
+
var proper_lockfile = __webpack_require__(5);
|
|
12021
|
+
|
|
12022
|
+
// EXTERNAL MODULE: ./node_modules/dotenv/lib/main.js
|
|
12023
|
+
var main = __webpack_require__(16);
|
|
12024
|
+
var main_default = /*#__PURE__*/__webpack_require__.n(main);
|
|
12025
|
+
|
|
12026
|
+
// CONCATENATED MODULE: ./src/store-interface-filesystem.js
|
|
12027
|
+
|
|
12028
|
+
|
|
12029
|
+
|
|
12030
|
+
|
|
12031
|
+
|
|
12032
|
+
|
|
12033
|
+
|
|
12034
|
+
main_default.a.config({
|
|
12035
|
+
path: ".env.".concat("production")
|
|
12036
|
+
});
|
|
12037
|
+
|
|
12038
|
+
/**
|
|
12039
|
+
* The function to handle saving/updating an item to your storage. This could be a Content Item, Page, Url Redirections, Sync State (state), or Sitemap.
|
|
12040
|
+
* @param {Object} params - The parameters object
|
|
12041
|
+
* @param {Object} params.options - A flexible object that can contain any properties specifically related to this interface
|
|
12042
|
+
* @param {String} params.options.rootPath - The path to store/access the content as JSON
|
|
12043
|
+
* @param {Object} params.item - The object representing the Content Item, Page, Url Redirections, Sync State (state), or Sitemap that needs to be saved/updated
|
|
12044
|
+
* @param {String} params.itemType - The type of item being saved/updated, expected values are `item`, `page`, `sitemap`, `nestedsitemap`, `state`, `urlredirections`
|
|
12045
|
+
* @param {String} params.languageCode - The locale code associated to the item being saved/updated
|
|
12046
|
+
* @param {(String|Number)} params.itemID - The ID of the item being saved/updated - this could be a string or number depending on the itemType
|
|
12047
|
+
* @returns {Void}
|
|
12048
|
+
*/
|
|
12049
|
+
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 _callee$(_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;
|
|
12050
|
+
|
|
12051
|
+
filePath = store_interface_filesystem_getFilePath({ options: options, itemType: itemType, languageCode: languageCode, itemID: itemID });
|
|
12052
|
+
|
|
12053
|
+
dirPath = external_path_default.a.dirname(filePath);
|
|
12054
|
+
|
|
12055
|
+
|
|
12056
|
+
if (!external_fs_default.a.existsSync(dirPath)) {
|
|
12057
|
+
external_fs_default.a.mkdirSync(dirPath, { recursive: true });
|
|
12058
|
+
}
|
|
12059
|
+
|
|
12060
|
+
json = JSON.stringify(item);
|
|
12061
|
+
external_fs_default.a.writeFileSync(filePath, json);case 6:case "end":return _context.stop();}}, _callee);}));return function saveItem(_x) {return _ref2.apply(this, arguments);};}();
|
|
12062
|
+
|
|
12063
|
+
/**
|
|
12064
|
+
* The function to handle deleting an item to your storage. This could be a Content Item, Page, Url Redirections, Sync State (state), or Sitemap.
|
|
12065
|
+
* @param {Object} params - The parameters object
|
|
12066
|
+
* @param {Object} params.options - A flexible object that can contain any properties specifically related to this interface
|
|
12067
|
+
* @param {String} params.options.rootPath - The path to store/access the content as JSON
|
|
12068
|
+
* @param {String} params.itemType - The type of item being deleted, expected values are `item`, `page`, `sitemap`, `nestedsitemap`, `state`, `urlredirections`
|
|
12069
|
+
* @param {String} params.languageCode - The locale code associated to the item being saved/updated
|
|
12070
|
+
* @param {(String|Number)} params.itemID - The ID of the item being deleted - this could be a string or number depending on the itemType
|
|
12071
|
+
* @returns {Void}
|
|
12072
|
+
*/
|
|
12073
|
+
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 _callee2$(_context2) {while (1) switch (_context2.prev = _context2.next) {case 0:options = _ref3.options, itemType = _ref3.itemType, languageCode = _ref3.languageCode, itemID = _ref3.itemID;
|
|
12074
|
+
|
|
12075
|
+
filePath = store_interface_filesystem_getFilePath({ options: options, itemType: itemType, languageCode: languageCode, itemID: itemID });
|
|
12076
|
+
|
|
12077
|
+
if (external_fs_default.a.existsSync(filePath)) {
|
|
12078
|
+
external_fs_default.a.unlinkSync(filePath);
|
|
12079
|
+
}case 3:case "end":return _context2.stop();}}, _callee2);}));return function deleteItem(_x2) {return _ref4.apply(this, arguments);};}();
|
|
12080
|
+
|
|
12081
|
+
|
|
12082
|
+
/**
|
|
12083
|
+
* The function to handle updating and placing a Content Item into a "list" so that you can handle querying a collection of items.
|
|
12084
|
+
* @param {Object} params - The parameters object
|
|
12085
|
+
* @param {Object} params.options - A flexible object that can contain any properties specifically related to this interface
|
|
12086
|
+
* @param {String} params.options.rootPath - The path to store/access the content as JSON
|
|
12087
|
+
* @param {Object} params.item - The object representing the Content Item
|
|
12088
|
+
* @param {String} params.languageCode - The locale code associated to the item being saved/updated
|
|
12089
|
+
* @param {(String|Number)} params.itemID - The ID of the item being updated - this could be a string or number depending on the itemType
|
|
12090
|
+
* @param {String} params.referenceName - The reference name of the Content List that this Content Item should be added to
|
|
12091
|
+
* @param {String} params.definitionName - The Model name that the Content Item is based on
|
|
12092
|
+
* @returns {Void}
|
|
12093
|
+
*/
|
|
12094
|
+
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 _callee3$(_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 = 3;return (
|
|
12095
|
+
|
|
12096
|
+
getItem({ options: options, itemType: "list", languageCode: languageCode, itemID: referenceName }));case 3:contentList = _context3.sent;
|
|
12097
|
+
|
|
12098
|
+
if (contentList == null) {
|
|
12099
|
+
//initialize the list
|
|
12100
|
+
contentList = [item];
|
|
12101
|
+
} else {
|
|
12102
|
+
//replace the item...
|
|
12103
|
+
cIndex = contentList.findIndex(function (ci) {
|
|
12104
|
+
return ci.contentID === itemID;
|
|
12105
|
+
});
|
|
12106
|
+
|
|
12107
|
+
if (item.properties.state === 3) {
|
|
12108
|
+
//*** deleted item (remove from the list) ***
|
|
12109
|
+
if (cIndex >= 0) {
|
|
12110
|
+
//remove the item
|
|
12111
|
+
contentList.splice(cIndex, 1);
|
|
12112
|
+
}
|
|
12113
|
+
|
|
12114
|
+
} else {
|
|
12115
|
+
//*** regular item (merge) ***
|
|
12116
|
+
if (cIndex >= 0) {
|
|
12117
|
+
//replace the existing item
|
|
12118
|
+
contentList[cIndex] = item;
|
|
12119
|
+
} else {
|
|
12120
|
+
//and it to the end of the
|
|
12121
|
+
contentList.push(item);
|
|
12122
|
+
}
|
|
12123
|
+
}
|
|
12124
|
+
}_context3.next = 7;return (
|
|
12125
|
+
|
|
12126
|
+
saveItem({ options: options, item: contentList, itemType: "list", languageCode: languageCode, itemID: referenceName }));case 7:case "end":return _context3.stop();}}, _callee3);}));return function mergeItemToList(_x3) {return _ref6.apply(this, arguments);};}();
|
|
12127
|
+
|
|
12128
|
+
/**
|
|
12129
|
+
* The function to handle retrieving a Content Item, Page, Url Redirections, Sync State (state), or Sitemap
|
|
12130
|
+
* @param {Object} params - The parameters object
|
|
12131
|
+
* @param {Object} params.options - A flexible object that can contain any properties specifically related to this interface
|
|
12132
|
+
* @param {String} params.options.rootPath - The path to store/access the content as JSON
|
|
12133
|
+
* @param {String} params.itemType - The type of item being accessed, expected values are `item`, `list`, `page`, `sitemap`, `nestedsitemap`, `state`, `urlredirections`
|
|
12134
|
+
* @param {String} params.languageCode - The locale code associated to the item being accessed
|
|
12135
|
+
* @param {(String|Number)} params.itemID - The ID of the item being accessed - this could be a string or number depending on the itemType
|
|
12136
|
+
* @returns {Object}
|
|
12137
|
+
*/
|
|
12138
|
+
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 _callee4$(_context4) {while (1) switch (_context4.prev = _context4.next) {case 0:options = _ref7.options, itemType = _ref7.itemType, languageCode = _ref7.languageCode, itemID = _ref7.itemID;
|
|
12139
|
+
filePath = store_interface_filesystem_getFilePath({ options: options, itemType: itemType, languageCode: languageCode, itemID: itemID });if (
|
|
12140
|
+
|
|
12141
|
+
external_fs_default.a.existsSync(filePath)) {_context4.next = 4;break;}return _context4.abrupt("return", null);case 4:
|
|
12142
|
+
|
|
12143
|
+
json = external_fs_default.a.readFileSync(filePath, 'utf8');return _context4.abrupt("return",
|
|
12144
|
+
JSON.parse(json));case 6:case "end":return _context4.stop();}}, _callee4);}));return function getItem(_x4) {return _ref8.apply(this, arguments);};}();
|
|
12145
|
+
|
|
12146
|
+
|
|
12147
|
+
/**
|
|
12148
|
+
* The function to handle clearing the cache of synchronized data from the CMS
|
|
12149
|
+
* @param {Object} params - The parameters object
|
|
12150
|
+
* @param {Object} params.options - A flexible object that can contain any properties specifically related to this interface
|
|
12151
|
+
* @param {String} params.options.rootPath - The path to store/access the content as JSON
|
|
12152
|
+
* @returns {Void}
|
|
12153
|
+
*/
|
|
12154
|
+
var clearItems = /*#__PURE__*/function () {var _ref0 = asyncToGenerator_default()(/*#__PURE__*/regenerator_default.a.mark(function _callee5(_ref9) {var options;return regenerator_default.a.wrap(function _callee5$(_context5) {while (1) switch (_context5.prev = _context5.next) {case 0:options = _ref9.options;
|
|
12155
|
+
external_fs_default.a.rmdirSync(options.rootPath, { recursive: true });case 2:case "end":return _context5.stop();}}, _callee5);}));return function clearItems(_x5) {return _ref0.apply(this, arguments);};}();
|
|
12156
|
+
|
|
12157
|
+
|
|
12158
|
+
|
|
12159
|
+
|
|
12160
|
+
/**
|
|
12161
|
+
* The function to handle multi-threaded Syncs that may be happening at the same time. If you need to prevent a sync from happening and let it wait until another sync has finished use this.
|
|
12162
|
+
* @returns {Promise}
|
|
12163
|
+
*/
|
|
12164
|
+
var mutexLock = /*#__PURE__*/function () {var _ref1 = asyncToGenerator_default()(/*#__PURE__*/regenerator_default.a.mark(function _callee6() {var dir, lockFile;return regenerator_default.a.wrap(function _callee6$(_context6) {while (1) switch (_context6.prev = _context6.next) {case 0:
|
|
12165
|
+
|
|
12166
|
+
|
|
12167
|
+
dir = external_os_default.a.tmpdir();
|
|
12168
|
+
lockFile = "".concat(dir, "/", "agility-sync", ".mutex");
|
|
12169
|
+
if (!external_fs_default.a.existsSync(lockFile)) {
|
|
12170
|
+
external_fs_default.a.writeFileSync(lockFile, "agility-sync");
|
|
12171
|
+
}
|
|
12172
|
+
|
|
12173
|
+
//THE LOCK IS ALREADY HELD - WAIT UP!
|
|
12174
|
+
_context6.next = 5;return waitOnLock(lockFile);case 5:_context6.prev = 5;return _context6.abrupt("return",
|
|
12175
|
+
|
|
12176
|
+
|
|
12177
|
+
Object(proper_lockfile["lockSync"])(lockFile));case 9:_context6.prev = 9;_context6.t0 = _context6["catch"](5);if (!(
|
|
12178
|
+
|
|
12179
|
+
"".concat(_context6.t0).indexOf("Lock file is already being held") !== -1)) {_context6.next = 28;break;}_context6.next = 14;return (
|
|
12180
|
+
|
|
12181
|
+
|
|
12182
|
+
sleep(100));case 14:_context6.next = 16;return (
|
|
12183
|
+
waitOnLock(lockFile));case 16:_context6.prev = 16;return _context6.abrupt("return",
|
|
12184
|
+
|
|
12185
|
+
|
|
12186
|
+
Object(proper_lockfile["lockSync"])(lockFile));case 20:_context6.prev = 20;_context6.t1 = _context6["catch"](16);if (!(
|
|
12187
|
+
|
|
12188
|
+
"".concat(_context6.t0).indexOf("Lock file is already being held") !== -1)) {_context6.next = 28;break;}_context6.next = 25;return (
|
|
12189
|
+
|
|
12190
|
+
|
|
12191
|
+
sleep(100));case 25:_context6.next = 27;return (
|
|
12192
|
+
waitOnLock(lockFile));case 27:return _context6.abrupt("return",
|
|
12193
|
+
Object(proper_lockfile["lockSync"])(lockFile));case 28:throw (
|
|
12194
|
+
|
|
12195
|
+
|
|
12196
|
+
|
|
12197
|
+
|
|
12198
|
+
Error("The mutex lock could not be obtained."));case 29:case "end":return _context6.stop();}}, _callee6, null, [[5, 9], [16, 20]]);}));return function mutexLock() {return _ref1.apply(this, arguments);};}();
|
|
12199
|
+
|
|
12200
|
+
|
|
12201
|
+
|
|
12202
|
+
|
|
12203
|
+
|
|
12204
|
+
//private function to get a wait on a lock file
|
|
12205
|
+
var waitOnLock = /*#__PURE__*/function () {var _ref10 = asyncToGenerator_default()(/*#__PURE__*/regenerator_default.a.mark(function _callee7(lockFile) {return regenerator_default.a.wrap(function _callee7$(_context7) {while (1) switch (_context7.prev = _context7.next) {case 0:_context7.next = 2;return (
|
|
12206
|
+
Object(proper_lockfile["check"])(lockFile));case 2:if (!_context7.sent) {_context7.next = 7;break;}_context7.next = 5;return (
|
|
12207
|
+
sleep(100));case 5:_context7.next = 0;break;case 7:case "end":return _context7.stop();}}, _callee7);}));return function waitOnLock(_x6) {return _ref10.apply(this, arguments);};}();
|
|
12208
|
+
|
|
12209
|
+
|
|
12210
|
+
|
|
12211
|
+
//private function to get path of an item
|
|
12212
|
+
var store_interface_filesystem_getFilePath = function getFilePath(_ref11) {var options = _ref11.options,itemType = _ref11.itemType,languageCode = _ref11.languageCode,itemID = _ref11.itemID;
|
|
12213
|
+
if (typeof itemID === 'string' || itemID instanceof String) {
|
|
12214
|
+
itemID = itemID.replace(/[`!@#$%^&*()+\=\[\]{};':"\\|,.<>\/?~]/g, "");
|
|
12215
|
+
}
|
|
12216
|
+
var fileName = "".concat(itemID, ".json");
|
|
12217
|
+
return external_path_default.a.join(options.rootPath, languageCode, itemType, fileName);
|
|
12218
|
+
};
|
|
12219
|
+
|
|
12280
12220
|
|
|
12221
|
+
/* harmony default export */ var store_interface_filesystem = ({
|
|
12222
|
+
saveItem: saveItem,
|
|
12223
|
+
deleteItem: deleteItem,
|
|
12224
|
+
mergeItemToList: mergeItemToList,
|
|
12225
|
+
getItem: getItem,
|
|
12226
|
+
clearItems: clearItems,
|
|
12227
|
+
mutexLock: mutexLock
|
|
12228
|
+
});
|
|
12281
12229
|
// CONCATENATED MODULE: ./src/sync-client.js
|
|
12282
12230
|
function ownKeys(e, r) {var t = Object.keys(e);if (Object.getOwnPropertySymbols) {var o = Object.getOwnPropertySymbols(e);r && (o = o.filter(function (r) {return Object.getOwnPropertyDescriptor(e, r).enumerable;})), t.push.apply(t, o);}return t;}function _objectSpread(e) {for (var r = 1; r < arguments.length; r++) {var t = null != arguments[r] ? arguments[r] : {};r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {defineProperty_default()(e, r, t[r]);}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));});}return e;}
|
|
12283
12231
|
|
|
@@ -12315,7 +12263,7 @@ var defaultConfig = {
|
|
|
12315
12263
|
debug: false,
|
|
12316
12264
|
logLevel: 'warning',
|
|
12317
12265
|
store: {
|
|
12318
|
-
"interface": store_interface_filesystem
|
|
12266
|
+
"interface": store_interface_filesystem,
|
|
12319
12267
|
options: {
|
|
12320
12268
|
rootPath: '.agility-files'
|
|
12321
12269
|
}
|
|
@@ -12363,8 +12311,7 @@ function createSyncClient(userConfig) {
|
|
|
12363
12311
|
};
|
|
12364
12312
|
}
|
|
12365
12313
|
|
|
12366
|
-
|
|
12314
|
+
|
|
12367
12315
|
|
|
12368
12316
|
/***/ })
|
|
12369
|
-
/******/ ])
|
|
12370
|
-
});
|
|
12317
|
+
/******/ ]);
|