@agility/content-sync 1.1.6 → 1.1.7

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.
@@ -98,7 +98,8 @@ return /******/ (function(modules) { // webpackBootstrap
98
98
  /* 0 */
99
99
  /***/ (function(module, exports) {
100
100
 
101
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {try {var info = gen[key](arg);var value = info.value;} catch (error) {reject(error);return;}if (info.done) {resolve(value);} else {Promise.resolve(value).then(_next, _throw);}}function _asyncToGenerator(fn) {return function () {var self = this,args = arguments;return new Promise(function (resolve, reject) {var gen = fn.apply(self, args);function _next(value) {asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);}function _throw(err) {asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);}_next(undefined);});};}var asyncForEach = /*#__PURE__*/function () {var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(array, callback) {var index;return regeneratorRuntime.wrap(function _callee$(_context) {while (1) {switch (_context.prev = _context.next) {case 0:
101
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {try {var info = gen[key](arg);var value = info.value;} catch (error) {reject(error);return;}if (info.done) {resolve(value);} else {Promise.resolve(value).then(_next, _throw);}}function _asyncToGenerator(fn) {return function () {var self = this,args = arguments;return new Promise(function (resolve, reject) {var gen = fn.apply(self, args);function _next(value) {asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);}function _throw(err) {asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);}_next(undefined);});};}
102
+ var asyncForEach = /*#__PURE__*/function () {var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(array, callback) {var index;return regeneratorRuntime.wrap(function _callee$(_context) {while (1) {switch (_context.prev = _context.next) {case 0:
102
103
  index = 0;case 1:if (!(index < array.length)) {_context.next = 7;break;}_context.next = 4;return (
103
104
  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);};}();
104
105
 
@@ -108,7 +109,7 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {try
108
109
  var getLogLevel = function getLogLevel() {
109
110
  var logLevel = (process.env.AGILITY_LOG_LEVEL || 'warning').toLowerCase();
110
111
 
111
- if (logLevel !== 'debug' && logLevel !== 'info' && logLevel !== 'warning' && logLevel !== 'error') {
112
+ if (logLevel !== 'debug' && logLevel !== 'info' && logLevel !== 'warning' && logLevel !== 'error' && logLevel !== 'none') {
112
113
  return 'warning';
113
114
  }
114
115
 
@@ -11680,6 +11681,7 @@ var defaultConfig = {
11680
11681
  languages: [],
11681
11682
  channels: [],
11682
11683
  debug: false,
11684
+ logLevel: 'warning',
11683
11685
  store: {
11684
11686
  "interface": store_interface_filesystem_default.a,
11685
11687
  options: {
@@ -11695,6 +11697,8 @@ function createSyncClient(userConfig) {
11695
11697
 
11696
11698
 
11697
11699
 
11700
+ process.env.AGILITY_LOG_LEVEL = config.logLevel;
11701
+
11698
11702
  var agilityClient = agility_content_fetch_node_default.a.getApi({
11699
11703
  guid: config.guid,
11700
11704
  apiKey: config.apiKey,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agility/content-sync",
3
- "version": "1.1.6",
3
+ "version": "1.1.7",
4
4
  "description": "JavaScript SDK for synchronizing content from Agility CMS",
5
5
  "main": "dist/agility-sync-sdk.node.js",
6
6
  "scripts": {
@@ -7,16 +7,16 @@ import runSync from './methods/runSync'
7
7
  import storeInterface from './store-interface'
8
8
  import storeInterfaceFileSystem from './store-interface-filesystem'
9
9
 
10
- function getSyncClient (userConfig) {
10
+ function getSyncClient(userConfig) {
11
11
  validateConfigParams(userConfig);
12
12
  return createSyncClient(userConfig);
13
13
  }
14
14
 
15
15
  function validateConfigParams(configParams) {
16
16
 
17
- if(!configParams.guid || configParams.guid.length == 0) {
17
+ if (!configParams.guid || configParams.guid.length == 0) {
18
18
  throw new TypeError('You must provide an guid.');
19
- } else if(!configParams.apiKey || configParams.apiKey.length == 0) {
19
+ } else if (!configParams.apiKey || configParams.apiKey.length == 0) {
20
20
  throw new TypeError('You must provide an access token.');
21
21
  } else {
22
22
  return;
@@ -31,6 +31,7 @@ const defaultConfig = {
31
31
  languages: [],
32
32
  channels: [],
33
33
  debug: false,
34
+ logLevel: 'warning',
34
35
  store: {
35
36
  interface: storeInterfaceFileSystem,
36
37
  options: {
@@ -46,6 +47,8 @@ function createSyncClient(userConfig) {
46
47
 
47
48
  }
48
49
 
50
+ process.env.AGILITY_LOG_LEVEL = config.logLevel;
51
+
49
52
  const agilityClient = agility.getApi({
50
53
  guid: config.guid,
51
54
  apiKey: config.apiKey,
package/src/util.js CHANGED
@@ -1,3 +1,4 @@
1
+
1
2
  const asyncForEach = async (array, callback) => {
2
3
  for (let index = 0; index < array.length; index++) {
3
4
  await callback(array[index], index, array);
@@ -8,7 +9,7 @@ const asyncForEach = async (array, callback) => {
8
9
  const getLogLevel = () => {
9
10
  const logLevel = (process.env.AGILITY_LOG_LEVEL || 'warning').toLowerCase();
10
11
 
11
- if (logLevel !== 'debug' && logLevel !== 'info' && logLevel !== 'warning' && logLevel !== 'error') {
12
+ if (logLevel !== 'debug' && logLevel !== 'info' && logLevel !== 'warning' && logLevel !== 'error' && logLevel !== 'none') {
12
13
  return 'warning';
13
14
  }
14
15
 
@@ -14,10 +14,11 @@ function createSyncClient() {
14
14
  guid: guid,
15
15
  apiKey: apiKeyFetch,
16
16
  isPreview: false,
17
- channels: [ 'website'],
17
+ logLevel: 'info',
18
+ channels: ['website'],
18
19
  languages: ['en-us'],
19
20
  baseUrl: "https://api-dev.aglty.io"
20
- });
21
+ });
21
22
 
22
23
  return syncClient;
23
24
  }
@@ -27,7 +28,7 @@ function createSyncClientUsingConsoleStore() {
27
28
  guid: guid,
28
29
  apiKey: apiKeyFetch,
29
30
  isPreview: false,
30
- channels: [ 'website'],
31
+ channels: ['website'],
31
32
  languages: ['en-us'],
32
33
  store: {
33
34
  interface: storeInterfaceConsole,
@@ -44,7 +45,7 @@ function createPreviewSyncClient() {
44
45
  guid: guid,
45
46
  apiKey: apiKeyPreview,
46
47
  isPreview: true,
47
- channels: [ 'website'],
48
+ channels: ['website'],
48
49
  languages: ['en-us'],
49
50
  baseUrl: "https://api-dev.aglty.io"
50
51
  });