@splunk/visualization-encoding-parsers 25.13.1 → 26.1.0

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"@splunk/ui-utils/i18n\"","webpack:///external \"@splunk/visualization-encoding-parsers/Base\"","webpack:///./src/errorMsgs.js","webpack:///./src/SingleValueIconParser.js"],"names":["ErrorMsgs","NO_DATA_SOURCES","_","NO_ENCODING","ERROR_PARSE","dataContract","requiredDataSources","optionalDataSources","name","description","initialRequestParams","primary","offset","count","encoding","trend","isRequired","type","default","fill","field","format","ranges","from","value","to","parse","dataSources","userDefinedEncoding","mergeEncoding","props","baseParse","parsedProps","Object","keys","forEach","encodingKey","encodingValue","valueIndex","length","deltaValue","graphData","err","Error","backgroundColor"],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;AClFA,kD;;;;;;;ACAA,wE;;;;;;;;ACAA;AAAA;AAAA;AAAA;AAA0C;AAEnC,IAAMA,SAAS,GAAG;EACrBC,eAAe,EAAEC,+DAAC,CAAC,uBAAuB,CAAC;EAC3CC,WAAW,E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ACA;AACA;AACA;AACA;AACO,IAAME,KAAK,GAAG,SAARA,KAAKA,CAAIC,WAAW,EAAEC,mBAAmB,EAAK;EACvD,IAAMd,QAAQ,GAAGe,iGAAa,CAACxB,YAAY,CAACS,QAAQ,EAAEc,mBAAmB,CAAC;EAC1E,IAAME,KAAK,GAAGC,yFAAS,CAACJ,WAAW,EAAEb,QAAQ,CAAC;EAC9C,IAAMkB,WAAW,GAAG,CAAC,CAAC;EAEtB,IAAI;IACAC,MAAM,CAACC,IAAI,CAACJ,KAAK,CAAC,CAACK,OAAO,CAAC,UAAAC,WAAW,EAAI;MACtC,IAAMC,aAAa,GAAGP,KAAK,CAACM,WAAW,CAAC;MACxC,IAAME,UAAU,GAAGD,aAAa,CAACE,MAAM,GAAG,CAAC;MAE3C,IAAIH,WAAW,KAAK,OAAO,EAAE;QACzBJ,WAAW,CAACR,KAAK,GAAGa,aAAa,CAACC,UAAU,CAAC;QAC7CN,WAAW,CAACQ,UAAU,GAClBH,aAAa,CAACE,MAAM,KAAK,CAAC,GACpB,IAAI,GACJF,aAAa,CAACC,UAAU,CAAC,GAAGD,aAAa,CAACC,UAAU,GAAG,CAAC,CAAC;QACnEN,WAAW,CAACS,SAAS,GAAGJ,aAAa;MACzC,CAAC,MAAM;QACHL,WAAW,CAACI,WAAW,CAAC,GAAGC,aAAa,CAACC,UAAU,CAAC;MACxD;IACJ,CAAC,CAAC;EACN,CAAC,CAAC,OAAOI,GAAG,EAAE;IACV,MAAM,IAAIC,KAAK,CAAC3C,oDAAS,CAACI,WAAW,CAAC;EAC1C;EAEA,OAAO;IACHoB,KAAK,EAAEQ,WAAW,CAACR,KAAK;IACxBgB,UAAU,EAAER,WAAW,CAACQ,UAAU;IAClCC,SAAS,EAAET,WAAW,CAACS,SAAS;IAChCG,eAAe,EAAEZ,WAAW,CAACb;EACjC,CAAC;AACL,CAAC,C","file":"SingleValueIconParser.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 28);\n","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@splunk/visualization-encoding-parsers/Base\");","import { _ } from '@splunk/ui-utils/i18n';\n\nexport const ErrorMsgs = {\n NO_DATA_SOURCES: _('No valid dataSources.'),\n NO_ENCODING: _('No valid encoding.'),\n ERROR_PARSE: _('Can not parse data correctly.'),\n};\n","import { parse as baseParse, mergeEncoding } from '@splunk/visualization-encoding-parsers/Base';\nimport { ErrorMsgs } from './errorMsgs';\n\nexport const dataContract = {\n requiredDataSources: [],\n optionalDataSources: [\n {\n name: 'primary',\n description: 'DataSource that powers the visualization',\n },\n ],\n initialRequestParams: {\n primary: { offset: 0, count: 10000 },\n },\n encoding: {\n trend: {\n isRequired: true,\n type: ['number', 'string'],\n default: 'primary[0]',\n },\n fill: {\n isRequired: false,\n type: ['string'],\n default: {\n field: 'primary[0]',\n format: {\n type: 'rangevalue',\n ranges: [\n {\n from: 100,\n value: '#cb3b43',\n },\n {\n from: 70,\n to: 100,\n value: '#ff7152',\n },\n {\n from: 50,\n to: 70,\n value: '#fc9850',\n },\n {\n from: 30,\n to: 50,\n value: '#f4df7a',\n },\n {\n from: 10,\n to: 30,\n value: '#4beba8',\n },\n {\n to: 10,\n value: '#5fbcff',\n },\n ],\n },\n },\n },\n // todo: add it back later\n // icon: {\n // isRequired: false,\n // type: ['string'],\n // },\n },\n};\n\n/**\n * Single Value Icon parse function\n * @param {object} dataSources\n * @param {object} encoding\n * @return {object} props that dashboard/react visualizations can be used.\n * @public\n */\nexport const parse = (dataSources, userDefinedEncoding) => {\n const encoding = mergeEncoding(dataContract.encoding, userDefinedEncoding);\n const props = baseParse(dataSources, encoding);\n const parsedProps = {};\n\n try {\n Object.keys(props).forEach(encodingKey => {\n const encodingValue = props[encodingKey];\n const valueIndex = encodingValue.length - 1;\n\n if (encodingKey === 'trend') {\n parsedProps.value = encodingValue[valueIndex];\n parsedProps.deltaValue =\n encodingValue.length === 1\n ? null\n : encodingValue[valueIndex] - encodingValue[valueIndex - 1];\n parsedProps.graphData = encodingValue;\n } else {\n parsedProps[encodingKey] = encodingValue[valueIndex];\n }\n });\n } catch (err) {\n throw new Error(ErrorMsgs.ERROR_PARSE);\n }\n\n return {\n value: parsedProps.value,\n deltaValue: parsedProps.deltaValue,\n graphData: parsedProps.graphData,\n backgroundColor: parsedProps.fill,\n };\n};\n"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"@splunk/ui-utils/i18n\"","webpack:///external \"@splunk/visualization-encoding-parsers/Base\"","webpack:///./src/errorMsgs.js","webpack:///./src/SingleValueIconParser.js"],"names":["ErrorMsgs","NO_DATA_SOURCES","_","NO_ENCODING","ERROR_PARSE","dataContract","requiredDataSources","optionalDataSources","name","description","initialRequestParams","primary","offset","count","encoding","trend","isRequired","type","default","fill","field","format","ranges","from","value","to","parse","mergeEncoding","props","baseParse","parsedProps","Object","encodingValue","valueIndex","encodingKey","deltaValue","graphData","backgroundColor"],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA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file":"SingleValueIconParser.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 28);\n","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@splunk/visualization-encoding-parsers/Base\");","import { _ } from '@splunk/ui-utils/i18n';\n\nexport const ErrorMsgs = {\n NO_DATA_SOURCES: _('No valid dataSources.'),\n NO_ENCODING: _('No valid encoding.'),\n ERROR_PARSE: _('Can not parse data correctly.'),\n};\n","import { parse as baseParse, mergeEncoding } from '@splunk/visualization-encoding-parsers/Base';\nimport { ErrorMsgs } from './errorMsgs';\n\nexport const dataContract = {\n requiredDataSources: [],\n optionalDataSources: [\n {\n name: 'primary',\n description: 'DataSource that powers the visualization',\n },\n ],\n initialRequestParams: {\n primary: { offset: 0, count: 10000 },\n },\n encoding: {\n trend: {\n isRequired: true,\n type: ['number', 'string'],\n default: 'primary[0]',\n },\n fill: {\n isRequired: false,\n type: ['string'],\n default: {\n field: 'primary[0]',\n format: {\n type: 'rangevalue',\n ranges: [\n {\n from: 100,\n value: '#cb3b43',\n },\n {\n from: 70,\n to: 100,\n value: '#ff7152',\n },\n {\n from: 50,\n to: 70,\n value: '#fc9850',\n },\n {\n from: 30,\n to: 50,\n value: '#f4df7a',\n },\n {\n from: 10,\n to: 30,\n value: '#4beba8',\n },\n {\n to: 10,\n value: '#5fbcff',\n },\n ],\n },\n },\n },\n // todo: add it back later\n // icon: {\n // isRequired: false,\n // type: ['string'],\n // },\n },\n};\n\n/**\n * Single Value Icon parse function\n * @param {object} dataSources\n * @param {object} encoding\n * @return {object} props that dashboard/react visualizations can be used.\n * @public\n */\nexport const parse = (dataSources, userDefinedEncoding) => {\n const encoding = mergeEncoding(dataContract.encoding, userDefinedEncoding);\n const props = baseParse(dataSources, encoding);\n const parsedProps = {};\n\n try {\n Object.keys(props).forEach(encodingKey => {\n const encodingValue = props[encodingKey];\n const valueIndex = encodingValue.length - 1;\n\n if (encodingKey === 'trend') {\n parsedProps.value = encodingValue[valueIndex];\n parsedProps.deltaValue =\n encodingValue.length === 1\n ? null\n : encodingValue[valueIndex] - encodingValue[valueIndex - 1];\n parsedProps.graphData = encodingValue;\n } else {\n parsedProps[encodingKey] = encodingValue[valueIndex];\n }\n });\n } catch (err) {\n throw new Error(ErrorMsgs.ERROR_PARSE);\n }\n\n return {\n value: parsedProps.value,\n deltaValue: parsedProps.deltaValue,\n graphData: parsedProps.graphData,\n backgroundColor: parsedProps.fill,\n };\n};\n"],"sourceRoot":""}
@@ -198,7 +198,6 @@ var dataContract = {
198
198
  }
199
199
  }
200
200
  };
201
-
202
201
  /**
203
202
  * Single Value parse function
204
203
  * @param {object} dataSources
@@ -206,17 +205,21 @@ var dataContract = {
206
205
  * @return {object} props that dashboard/react visualizations can be used.
207
206
  * @public
208
207
  */
208
+
209
209
  var parse = function parse(dataSources, userDefinedEncoding) {
210
210
  if (lodash_isEmpty__WEBPACK_IMPORTED_MODULE_1___default()(dataSources)) {
211
211
  throw new Error(_errorMsgs__WEBPACK_IMPORTED_MODULE_2__["ErrorMsgs"].NO_DATA_SOURCES);
212
212
  }
213
+
213
214
  var encoding = Object(_splunk_visualization_encoding_parsers_Base__WEBPACK_IMPORTED_MODULE_0__["mergeEncoding"])(dataContract.encoding, userDefinedEncoding);
214
215
  var props = Object(_splunk_visualization_encoding_parsers_Base__WEBPACK_IMPORTED_MODULE_0__["parse"])(dataSources, encoding);
215
216
  var parsedProps = {};
217
+
216
218
  try {
217
219
  Object.keys(props).forEach(function (encodingKey) {
218
220
  var encodingValue = props[encodingKey];
219
221
  var valueIndex = encodingValue.length - 1;
222
+
220
223
  if (encodingKey === 'trend') {
221
224
  parsedProps.value = encodingValue[valueIndex];
222
225
  parsedProps.deltaValue = encodingValue.length === 1 ? null : encodingValue[valueIndex] - encodingValue[valueIndex - 1];
@@ -228,6 +231,7 @@ var parse = function parse(dataSources, userDefinedEncoding) {
228
231
  } catch (err) {
229
232
  throw new Error(_errorMsgs__WEBPACK_IMPORTED_MODULE_2__["ErrorMsgs"].ERROR_PARSE);
230
233
  }
234
+
231
235
  return {
232
236
  value: parsedProps.value,
233
237
  deltaValue: parsedProps.deltaValue,
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"@splunk/ui-utils/i18n\"","webpack:///external \"@splunk/visualization-encoding-parsers/Base\"","webpack:///./src/errorMsgs.js","webpack:///./src/SingleValueParser.js","webpack:///external \"lodash/isEmpty\""],"names":["ErrorMsgs","NO_DATA_SOURCES","_","NO_ENCODING","ERROR_PARSE","dataContract","requiredDataSources","name","description","initialRequestParams","primary","offset","count","encoding","trend","isRequired","type","default","fill","field","format","ranges","from","value","to","majorColor","deltaColor","parse","dataSources","userDefinedEncoding","isEmpty","Error","mergeEncoding","props","baseParse","parsedProps","Object","keys","forEach","encodingKey","encodingValue","valueIndex","length","deltaValue","graphData","err","backgroundColor"],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAA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AAK,CAAC,GACpB,IAAI,GACJF,aAAa,CAACC,UAAU,CAAC,GAAGD,aAAa,CAACC,UAAU,GAAG,CAAC,CAAC;QACnEN,WAAW,CAACS,SAAS,GAAGJ,aAAa;MACzC,CAAC,MAAM;QACHL,WAAW,CAACI,WAAW,CAAC,GAAGC,aAAa,CAACC,UAAU,CAAC;MACxD;IACJ,CAAC,CAAC;EACN,CAAC,CAAC,OAAOI,GAAG,EAAE;IACV,MAAM,IAAId,KAAK,CAAC/B,oDAAS,CAACI,WAAW,CAAC;EAC1C;EAEA,OAAO;IACHmB,KAAK,EAAEY,WAAW,CAACZ,KAAK;IACxBoB,UAAU,EAAER,WAAW,CAACQ,UAAU;IAClCjB,UAAU,EAAES,WAAW,CAACT,UAAU;IAClCkB,SAAS,EAAET,WAAW,CAACS,SAAS;IAChCE,eAAe,EAAEX,WAAW,CAACjB,IAAI;IACjCO,UAAU,EAAEU,WAAW,CAACV;EAC5B,CAAC;AACL,CAAC,C;;;;;;;AClHD,2C","file":"SingleValueParser.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 29);\n","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@splunk/visualization-encoding-parsers/Base\");","import { _ } from '@splunk/ui-utils/i18n';\n\nexport const ErrorMsgs = {\n NO_DATA_SOURCES: _('No valid dataSources.'),\n NO_ENCODING: _('No valid encoding.'),\n ERROR_PARSE: _('Can not parse data correctly.'),\n};\n","import { parse as baseParse, mergeEncoding } from '@splunk/visualization-encoding-parsers/Base';\nimport isEmpty from 'lodash/isEmpty';\nimport { ErrorMsgs } from './errorMsgs';\n\nexport const dataContract = {\n requiredDataSources: [\n {\n name: 'primary',\n description: 'DataSource that powers the visualization',\n },\n ],\n initialRequestParams: {\n primary: { offset: 0, count: 10000 },\n },\n encoding: {\n trend: {\n isRequired: true,\n type: ['number', 'string'],\n default: ['primary[0]', 'primary[1]'],\n },\n fill: {\n isRequired: false,\n type: ['string'],\n default: {\n field: 'primary[0]',\n format: {\n type: 'rangevalue',\n ranges: [\n {\n from: 100,\n value: '#cb3b43',\n },\n {\n from: 70,\n to: 100,\n value: '#ff7152',\n },\n {\n from: 50,\n to: 70,\n value: '#fc9850',\n },\n {\n from: 30,\n to: 50,\n value: '#f4df7a',\n },\n {\n from: 10,\n to: 30,\n value: '#4beba8',\n },\n {\n to: 10,\n value: '#5fbcff',\n },\n ],\n },\n },\n },\n majorColor: {\n isRequired: false,\n type: ['string'],\n },\n deltaColor: {\n isRequired: false,\n type: ['string'],\n },\n },\n};\n\n/**\n * Single Value parse function\n * @param {object} dataSources\n * @param {object} encoding\n * @return {object} props that dashboard/react visualizations can be used.\n * @public\n */\nexport const parse = (dataSources, userDefinedEncoding) => {\n if (isEmpty(dataSources)) {\n throw new Error(ErrorMsgs.NO_DATA_SOURCES);\n }\n\n const encoding = mergeEncoding(dataContract.encoding, userDefinedEncoding);\n const props = baseParse(dataSources, encoding);\n const parsedProps = {};\n try {\n Object.keys(props).forEach(encodingKey => {\n const encodingValue = props[encodingKey];\n const valueIndex = encodingValue.length - 1;\n\n if (encodingKey === 'trend') {\n parsedProps.value = encodingValue[valueIndex];\n parsedProps.deltaValue =\n encodingValue.length === 1\n ? null\n : encodingValue[valueIndex] - encodingValue[valueIndex - 1];\n parsedProps.graphData = encodingValue;\n } else {\n parsedProps[encodingKey] = encodingValue[valueIndex];\n }\n });\n } catch (err) {\n throw new Error(ErrorMsgs.ERROR_PARSE);\n }\n\n return {\n value: parsedProps.value,\n deltaValue: parsedProps.deltaValue,\n deltaColor: parsedProps.deltaColor,\n graphData: parsedProps.graphData,\n backgroundColor: parsedProps.fill,\n majorColor: parsedProps.majorColor,\n };\n};\n","module.exports = require(\"lodash/isEmpty\");"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"@splunk/ui-utils/i18n\"","webpack:///external \"@splunk/visualization-encoding-parsers/Base\"","webpack:///./src/errorMsgs.js","webpack:///./src/SingleValueParser.js","webpack:///external \"lodash/isEmpty\""],"names":["ErrorMsgs","NO_DATA_SOURCES","_","NO_ENCODING","ERROR_PARSE","dataContract","requiredDataSources","name","description","initialRequestParams","primary","offset","count","encoding","trend","isRequired","type","default","fill","field","format","ranges","from","value","to","majorColor","deltaColor","parse","isEmpty","mergeEncoding","props","baseParse","parsedProps","Object","encodingValue","valueIndex","encodingKey","deltaValue","graphData","backgroundColor"],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;AClFA,kD;;;;;;;ACAA,wE;;;;;;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAEO,IAAMA,SAAS,GAAG;AACrBC,iBAAe,EAAEC,+DAA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n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 29);\n","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@splunk/visualization-encoding-parsers/Base\");","import { _ } from '@splunk/ui-utils/i18n';\n\nexport const ErrorMsgs = {\n NO_DATA_SOURCES: _('No valid dataSources.'),\n NO_ENCODING: _('No valid encoding.'),\n ERROR_PARSE: _('Can not parse data correctly.'),\n};\n","import { parse as baseParse, mergeEncoding } from '@splunk/visualization-encoding-parsers/Base';\nimport isEmpty from 'lodash/isEmpty';\nimport { ErrorMsgs } from './errorMsgs';\n\nexport const dataContract = {\n requiredDataSources: [\n {\n name: 'primary',\n description: 'DataSource that powers the visualization',\n },\n ],\n initialRequestParams: {\n primary: { offset: 0, count: 10000 },\n },\n encoding: {\n trend: {\n isRequired: true,\n type: ['number', 'string'],\n default: ['primary[0]', 'primary[1]'],\n },\n fill: {\n isRequired: false,\n type: ['string'],\n default: {\n field: 'primary[0]',\n format: {\n type: 'rangevalue',\n ranges: [\n {\n from: 100,\n value: '#cb3b43',\n },\n {\n from: 70,\n to: 100,\n value: '#ff7152',\n },\n {\n from: 50,\n to: 70,\n value: '#fc9850',\n },\n {\n from: 30,\n to: 50,\n value: '#f4df7a',\n },\n {\n from: 10,\n to: 30,\n value: '#4beba8',\n },\n {\n to: 10,\n value: '#5fbcff',\n },\n ],\n },\n },\n },\n majorColor: {\n isRequired: false,\n type: ['string'],\n },\n deltaColor: {\n isRequired: false,\n type: ['string'],\n },\n },\n};\n\n/**\n * Single Value parse function\n * @param {object} dataSources\n * @param {object} encoding\n * @return {object} props that dashboard/react visualizations can be used.\n * @public\n */\nexport const parse = (dataSources, userDefinedEncoding) => {\n if (isEmpty(dataSources)) {\n throw new Error(ErrorMsgs.NO_DATA_SOURCES);\n }\n\n const encoding = mergeEncoding(dataContract.encoding, userDefinedEncoding);\n const props = baseParse(dataSources, encoding);\n const parsedProps = {};\n try {\n Object.keys(props).forEach(encodingKey => {\n const encodingValue = props[encodingKey];\n const valueIndex = encodingValue.length - 1;\n\n if (encodingKey === 'trend') {\n parsedProps.value = encodingValue[valueIndex];\n parsedProps.deltaValue =\n encodingValue.length === 1\n ? null\n : encodingValue[valueIndex] - encodingValue[valueIndex - 1];\n parsedProps.graphData = encodingValue;\n } else {\n parsedProps[encodingKey] = encodingValue[valueIndex];\n }\n });\n } catch (err) {\n throw new Error(ErrorMsgs.ERROR_PARSE);\n }\n\n return {\n value: parsedProps.value,\n deltaValue: parsedProps.deltaValue,\n deltaColor: parsedProps.deltaColor,\n graphData: parsedProps.graphData,\n backgroundColor: parsedProps.fill,\n majorColor: parsedProps.majorColor,\n };\n};\n","module.exports = require(\"lodash/isEmpty\");"],"sourceRoot":""}
@@ -194,7 +194,6 @@ var dataContract = {
194
194
  }
195
195
  }
196
196
  };
197
-
198
197
  /**
199
198
  * Single Value parse function
200
199
  * @param {object} dataSources
@@ -202,10 +201,12 @@ var dataContract = {
202
201
  * @return {object} props that dashboard/react visualizations can be used.
203
202
  * @public
204
203
  */
204
+
205
205
  var parse = function parse(dataSources, userDefinedEncoding) {
206
206
  if (lodash_isEmpty__WEBPACK_IMPORTED_MODULE_1___default()(dataSources)) {
207
207
  throw new Error(_errorMsgs__WEBPACK_IMPORTED_MODULE_2__["ErrorMsgs"].NO_DATA_SOURCES);
208
208
  }
209
+
209
210
  if (lodash_isEmpty__WEBPACK_IMPORTED_MODULE_1___default()(userDefinedEncoding) || !userDefinedEncoding.trend || !userDefinedEncoding.trend.length) {
210
211
  console.warn(_errorMsgs__WEBPACK_IMPORTED_MODULE_2__["ErrorMsgs"].NO_ENCODING); // eslint-disable-line no-console
211
212
  }
@@ -213,10 +214,12 @@ var parse = function parse(dataSources, userDefinedEncoding) {
213
214
  var encoding = Object(_splunk_visualization_encoding_parsers_Base__WEBPACK_IMPORTED_MODULE_0__["mergeEncoding"])(dataContract.encoding, userDefinedEncoding);
214
215
  var props = Object(_splunk_visualization_encoding_parsers_Base__WEBPACK_IMPORTED_MODULE_0__["parse"])(dataSources, encoding);
215
216
  var parsedProps = {};
217
+
216
218
  try {
217
219
  Object.keys(props).forEach(function (encodingKey) {
218
220
  var encodingValue = props[encodingKey];
219
221
  var valueIndex = encodingValue.length - 1;
222
+
220
223
  if (encodingKey === 'trend') {
221
224
  parsedProps.value = encodingValue[valueIndex];
222
225
  parsedProps.deltaValue = encodingValue.length === 1 ? null : encodingValue[valueIndex] - encodingValue[valueIndex - 1];
@@ -228,6 +231,7 @@ var parse = function parse(dataSources, userDefinedEncoding) {
228
231
  } catch (err) {
229
232
  throw new Error(_errorMsgs__WEBPACK_IMPORTED_MODULE_2__["ErrorMsgs"].ERROR_PARSE);
230
233
  }
234
+
231
235
  return {
232
236
  value: parsedProps.value,
233
237
  deltaValue: parsedProps.deltaValue,
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"@splunk/ui-utils/i18n\"","webpack:///external \"@splunk/visualization-encoding-parsers/Base\"","webpack:///./src/errorMsgs.js","webpack:///external \"lodash/isEmpty\"","webpack:///./src/SingleValueRadialParser.js"],"names":["ErrorMsgs","NO_DATA_SOURCES","_","NO_ENCODING","ERROR_PARSE","dataContract","requiredDataSources","initialRequestParams","primary","offset","count","encoding","trend","isRequired","type","default","fill","field","format","ranges","from","value","to","parse","dataSources","userDefinedEncoding","isEmpty","Error","length","console","warn","mergeEncoding","props","baseParse","parsedProps","Object","keys","forEach","encodingKey","encodingValue","valueIndex","deltaValue","graphData","err","backgroundColor"],"mappings":";;;;;;;QAAA;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,CAACC,IAAI,CAACJ,KAAK,CAAC,CAACK,OAAO,CAAC,UAAAC,WAAW,EAAI;MACtC,IAAMC,aAAa,GAAGP,KAAK,CAACM,WAAW,CAAC;MACxC,IAAME,UAAU,GAAGD,aAAa,CAACX,MAAM,GAAG,CAAC;MAE3C,IAAIU,WAAW,KAAK,OAAO,EAAE;QACzBJ,WAAW,CAACb,KAAK,GAAGkB,aAAa,CAACC,UAAU,CAAC;QAC7CN,WAAW,CAACO,UAAU,GAClBF,aAAa,CAACX,MAAM,KAAK,CAAC,GACpB,IAAI,GACJW,aAAa,CAACC,UAAU,CAAC,GAAGD,aAAa,CAACC,UAAU,GAAG,CAAC,CAAC;QACnEN,WAAW,CAACQ,SAAS,GAAGH,aAAa;MACzC,CAAC,MAAM;QACHL,WAAW,CAACI,WAAW,CAAC,GAAGC,aAAa,CAACC,UAAU,CAAC;MACxD;IACJ,CAAC,CAAC;EACN,CAAC,CAAC,OAAOG,GAAG,EAAE;IACV,MAAM,IAAIhB,KAAK,CAAC3B,oDAAS,CAACI,WAAW,CAAC;EAC1C;EAEA,OAAO;IACHiB,KAAK,EAAEa,WAAW,CAACb,KAAK;IACxBoB,UAAU,EAAEP,WAAW,CAACO,UAAU;IAClCC,SAAS,EAAER,WAAW,CAACQ,SAAS;IAChCE,eAAe,EAAEV,WAAW,CAAClB;EACjC,CAAC;AACL,CAAC,C","file":"SingleValueRadialParser.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 30);\n","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@splunk/visualization-encoding-parsers/Base\");","import { _ } from '@splunk/ui-utils/i18n';\n\nexport const ErrorMsgs = {\n NO_DATA_SOURCES: _('No valid dataSources.'),\n NO_ENCODING: _('No valid encoding.'),\n ERROR_PARSE: _('Can not parse data correctly.'),\n};\n","module.exports = require(\"lodash/isEmpty\");","import { parse as baseParse, mergeEncoding } from '@splunk/visualization-encoding-parsers/Base';\nimport isEmpty from 'lodash/isEmpty';\nimport { ErrorMsgs } from './errorMsgs';\n\nexport const dataContract = {\n requiredDataSources: ['primary'],\n initialRequestParams: {\n primary: { offset: 0, count: 10000 },\n },\n encoding: {\n trend: {\n isRequired: true,\n type: ['number', 'string'],\n default: 'primary[0]',\n },\n fill: {\n isRequired: false,\n type: ['string'],\n default: {\n field: 'primary[0]',\n format: {\n type: 'rangevalue',\n ranges: [\n {\n from: 100,\n value: '#cb3b43',\n },\n {\n from: 70,\n to: 100,\n value: '#ff7152',\n },\n {\n from: 50,\n to: 70,\n value: '#fc9850',\n },\n {\n from: 30,\n to: 50,\n value: '#f4df7a',\n },\n {\n from: 10,\n to: 30,\n value: '#4beba8',\n },\n {\n to: 10,\n value: '#5fbcff',\n },\n ],\n },\n },\n },\n },\n};\n\n/**\n * Single Value parse function\n * @param {object} dataSources\n * @param {object} encoding\n * @return {object} props that dashboard/react visualizations can be used.\n * @public\n */\nexport const parse = (dataSources, userDefinedEncoding) => {\n if (isEmpty(dataSources)) {\n throw new Error(ErrorMsgs.NO_DATA_SOURCES);\n }\n\n if (isEmpty(userDefinedEncoding) || !userDefinedEncoding.trend || !userDefinedEncoding.trend.length) {\n console.warn(ErrorMsgs.NO_ENCODING); // eslint-disable-line no-console\n }\n\n const encoding = mergeEncoding(dataContract.encoding, userDefinedEncoding);\n const props = baseParse(dataSources, encoding);\n const parsedProps = {};\n\n try {\n Object.keys(props).forEach(encodingKey => {\n const encodingValue = props[encodingKey];\n const valueIndex = encodingValue.length - 1;\n\n if (encodingKey === 'trend') {\n parsedProps.value = encodingValue[valueIndex];\n parsedProps.deltaValue =\n encodingValue.length === 1\n ? null\n : encodingValue[valueIndex] - encodingValue[valueIndex - 1];\n parsedProps.graphData = encodingValue;\n } else {\n parsedProps[encodingKey] = encodingValue[valueIndex];\n }\n });\n } catch (err) {\n throw new Error(ErrorMsgs.ERROR_PARSE);\n }\n\n return {\n value: parsedProps.value,\n deltaValue: parsedProps.deltaValue,\n graphData: parsedProps.graphData,\n backgroundColor: parsedProps.fill,\n };\n};\n"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"@splunk/ui-utils/i18n\"","webpack:///external \"@splunk/visualization-encoding-parsers/Base\"","webpack:///./src/errorMsgs.js","webpack:///external \"lodash/isEmpty\"","webpack:///./src/SingleValueRadialParser.js"],"names":["ErrorMsgs","NO_DATA_SOURCES","_","NO_ENCODING","ERROR_PARSE","dataContract","requiredDataSources","initialRequestParams","primary","offset","count","encoding","trend","isRequired","type","default","fill","field","format","ranges","from","value","to","parse","isEmpty","userDefinedEncoding","console","mergeEncoding","props","baseParse","parsedProps","Object","encodingValue","valueIndex","encodingKey","deltaValue","graphData","backgroundColor"],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QAC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W,CAHnB;AAIHO,mBAAe,EAAEP,WAAW,CAACd;AAJ1B,GAAP;AAjCG,E","file":"SingleValueRadialParser.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 30);\n","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@splunk/visualization-encoding-parsers/Base\");","import { _ } from '@splunk/ui-utils/i18n';\n\nexport const ErrorMsgs = {\n NO_DATA_SOURCES: _('No valid dataSources.'),\n NO_ENCODING: _('No valid encoding.'),\n ERROR_PARSE: _('Can not parse data correctly.'),\n};\n","module.exports = require(\"lodash/isEmpty\");","import { parse as baseParse, mergeEncoding } from '@splunk/visualization-encoding-parsers/Base';\nimport isEmpty from 'lodash/isEmpty';\nimport { ErrorMsgs } from './errorMsgs';\n\nexport const dataContract = {\n requiredDataSources: ['primary'],\n initialRequestParams: {\n primary: { offset: 0, count: 10000 },\n },\n encoding: {\n trend: {\n isRequired: true,\n type: ['number', 'string'],\n default: 'primary[0]',\n },\n fill: {\n isRequired: false,\n type: ['string'],\n default: {\n field: 'primary[0]',\n format: {\n type: 'rangevalue',\n ranges: [\n {\n from: 100,\n value: '#cb3b43',\n },\n {\n from: 70,\n to: 100,\n value: '#ff7152',\n },\n {\n from: 50,\n to: 70,\n value: '#fc9850',\n },\n {\n from: 30,\n to: 50,\n value: '#f4df7a',\n },\n {\n from: 10,\n to: 30,\n value: '#4beba8',\n },\n {\n to: 10,\n value: '#5fbcff',\n },\n ],\n },\n },\n },\n },\n};\n\n/**\n * Single Value parse function\n * @param {object} dataSources\n * @param {object} encoding\n * @return {object} props that dashboard/react visualizations can be used.\n * @public\n */\nexport const parse = (dataSources, userDefinedEncoding) => {\n if (isEmpty(dataSources)) {\n throw new Error(ErrorMsgs.NO_DATA_SOURCES);\n }\n\n if (isEmpty(userDefinedEncoding) || !userDefinedEncoding.trend || !userDefinedEncoding.trend.length) {\n console.warn(ErrorMsgs.NO_ENCODING); // eslint-disable-line no-console\n }\n\n const encoding = mergeEncoding(dataContract.encoding, userDefinedEncoding);\n const props = baseParse(dataSources, encoding);\n const parsedProps = {};\n\n try {\n Object.keys(props).forEach(encodingKey => {\n const encodingValue = props[encodingKey];\n const valueIndex = encodingValue.length - 1;\n\n if (encodingKey === 'trend') {\n parsedProps.value = encodingValue[valueIndex];\n parsedProps.deltaValue =\n encodingValue.length === 1\n ? null\n : encodingValue[valueIndex] - encodingValue[valueIndex - 1];\n parsedProps.graphData = encodingValue;\n } else {\n parsedProps[encodingKey] = encodingValue[valueIndex];\n }\n });\n } catch (err) {\n throw new Error(ErrorMsgs.ERROR_PARSE);\n }\n\n return {\n value: parsedProps.value,\n deltaValue: parsedProps.deltaValue,\n graphData: parsedProps.graphData,\n backgroundColor: parsedProps.fill,\n };\n};\n"],"sourceRoot":""}
package/TableParser.js CHANGED
@@ -177,10 +177,10 @@ var dataContract = {
177
177
  type: ['time', 'number', 'string'],
178
178
  // TODO: In the future, once supported, add 'sparkline' as a type
179
179
  default: 'primary[0:]' // TODO: In the future, refactor according to UX designs to show only first N fields
180
+
180
181
  }
181
182
  }
182
183
  };
183
-
184
184
  /**
185
185
  * Table parse function
186
186
  * @param {object} dataSources
@@ -188,18 +188,22 @@ var dataContract = {
188
188
  * @return {object} props that dashboard visualization can use.
189
189
  * @public
190
190
  */
191
+
191
192
  var parse = function parse(dataSources, userDefinedEncoding) {
192
193
  if (lodash_isEmpty__WEBPACK_IMPORTED_MODULE_1___default()(dataSources)) {
193
194
  throw new Error(_errorMsgs__WEBPACK_IMPORTED_MODULE_3__["ErrorMsgs"].NO_DATA_SOURCES);
194
195
  }
196
+
195
197
  var encoding = Object(_splunk_visualization_encoding_parsers_Base__WEBPACK_IMPORTED_MODULE_0__["mergeEncoding"])(dataContract.encoding, userDefinedEncoding);
196
198
  var parsedProps = Object(_splunk_visualization_encoding_parsers_Base__WEBPACK_IMPORTED_MODULE_0__["parse"])(dataSources, encoding);
197
199
  var columns = parsedProps.columns;
198
200
  var columnsFieldName = parsedProps['_meta'].fieldNames.columns;
201
+
199
202
  if (!lodash_isArray__WEBPACK_IMPORTED_MODULE_2___default()(columnsFieldName)) {
200
203
  columnsFieldName = [columnsFieldName];
201
204
  columns = [columns];
202
205
  }
206
+
203
207
  return {
204
208
  columns: columns,
205
209
  columnsFieldName: columnsFieldName
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"@splunk/ui-utils/i18n\"","webpack:///external \"@splunk/visualization-encoding-parsers/Base\"","webpack:///external \"lodash/isArray\"","webpack:///./src/errorMsgs.js","webpack:///external \"lodash/isEmpty\"","webpack:///./src/TableParser.js"],"names":["ErrorMsgs","NO_DATA_SOURCES","_","NO_ENCODING","ERROR_PARSE","dataContract","requiredDataSources","name","description","initialRequestParams","primary","options","arguments","length","undefined","offset","count","requestTotalCount","encoding","columns","isRequired","type","default","parse","dataSources","userDefinedEncoding","isEmpty","Error","mergeEncoding","parsedProps","baseParse","columnsFieldName","fieldNames","isArray"],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;Q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A;AACA;AACA;AACA;AACA;AACA;AACO,IAAMC,KAAK,GAAG,SAARA,KAAKA,CAAIC,WAAW,EAAEC,mBAAmB,EAAK;EACvD,IAAIC,qDAAO,CAACF,WAAW,CAAC,EAAE;IACtB,MAAM,IAAIG,KAAK,CAAC3B,oDAAS,CAACC,eAAe,CAAC;EAC9C;EAEA,IAAMiB,QAAQ,GAAGU,iGAAa,CAACvB,YAAY,CAACa,QAAQ,EAAEO,mBAAmB,CAAC;EAC1E,IAAMI,WAAW,GAAGC,yFAAS,CAACN,WAAW,EAAEN,QAAQ,CAAC;EAAC,IAE/CC,OAAO,GAAKU,WAAW,CAAvBV,OAAO;EACb,IAAIY,gBAAgB,GAAGF,WAAW,CAAC,OAAO,CAAC,CAACG,UAAU,CAACb,OAAO;EAC9D,IAAI,CAACc,qDAAO,CAACF,gBAAgB,CAAC,EAAE;IAC5BA,gBAAgB,GAAG,CAACA,gBAAgB,CAAC;IACrCZ,OAAO,GAAG,CAACA,OAAO,CAAC;EACvB;EAEA,OAAO;IACHA,OAAO,EAAPA,OAAO;IACPY,gBAAgB,EAAhBA;EACJ,CAAC;AACL,CAAC,C","file":"TableParser.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 31);\n","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@splunk/visualization-encoding-parsers/Base\");","module.exports = require(\"lodash/isArray\");","import { _ } from '@splunk/ui-utils/i18n';\n\nexport const ErrorMsgs = {\n NO_DATA_SOURCES: _('No valid dataSources.'),\n NO_ENCODING: _('No valid encoding.'),\n ERROR_PARSE: _('Can not parse data correctly.'),\n};\n","module.exports = require(\"lodash/isEmpty\");","/* eslint-disable dot-notation */\nimport { parse as baseParse, mergeEncoding } from '@splunk/visualization-encoding-parsers/Base';\nimport isEmpty from 'lodash/isEmpty';\nimport isArray from 'lodash/isArray';\nimport { ErrorMsgs } from './errorMsgs';\n\nexport const dataContract = {\n requiredDataSources: [\n {\n name: 'primary',\n description: 'DataSource that powers the visualization',\n },\n ],\n initialRequestParams: {\n primary: (options = {}) => ({\n offset: 0,\n count: options.count ? options.count : 20,\n requestTotalCount: true,\n }),\n },\n encoding: {\n columns: {\n isRequired: true,\n type: ['time', 'number', 'string'], // TODO: In the future, once supported, add 'sparkline' as a type\n default: 'primary[0:]', // TODO: In the future, refactor according to UX designs to show only first N fields\n },\n },\n};\n\n/**\n * Table parse function\n * @param {object} dataSources\n * @param {object} userDefinedEncoding\n * @return {object} props that dashboard visualization can use.\n * @public\n */\nexport const parse = (dataSources, userDefinedEncoding) => {\n if (isEmpty(dataSources)) {\n throw new Error(ErrorMsgs.NO_DATA_SOURCES);\n }\n\n const encoding = mergeEncoding(dataContract.encoding, userDefinedEncoding);\n const parsedProps = baseParse(dataSources, encoding);\n\n let { columns } = parsedProps;\n let columnsFieldName = parsedProps['_meta'].fieldNames.columns;\n if (!isArray(columnsFieldName)) {\n columnsFieldName = [columnsFieldName];\n columns = [columns];\n }\n\n return {\n columns,\n columnsFieldName,\n };\n};\n"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"@splunk/ui-utils/i18n\"","webpack:///external \"@splunk/visualization-encoding-parsers/Base\"","webpack:///external \"lodash/isArray\"","webpack:///./src/errorMsgs.js","webpack:///external \"lodash/isEmpty\"","webpack:///./src/TableParser.js"],"names":["ErrorMsgs","NO_DATA_SOURCES","_","NO_ENCODING","ERROR_PARSE","dataContract","requiredDataSources","name","description","initialRequestParams","primary","options","offset","count","requestTotalCount","encoding","columns","isRequired","type","default","parse","isEmpty","mergeEncoding","parsedProps","baseParse","columnsFieldName","isArray"],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;AClFA,kD;;;;;;;ACAA,wE;;;;;;;ACAA,2C;;;;;;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAEO,IAAMA,SAAS,GAAG;AACrBC,iBAAe,EAAEC,+DAAC,CADG,uBACH,CADG;AAErBC,aAAW,EAAED,+DAAC,CAFO,oBAEP,CAFO;AAGrBE,aAAW,EAAEF,+DAAC;AAHO,CAAlB,C;;;;;;;ACFP,2C;;;;;;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAEO,IAAMG,YAAY,GAAG;AACxBC,qBAAmB,EAAE,CACjB;AACIC,QAAI,EADR;AAEIC,eAAW,EAAE;AAFjB,GADiB,CADG;AAOxBC,sBAAoB,EAAE;AAClBC,WAAO,EAAE;AAAA,UAACC,OAAD;AAAA,aAAmB;AACxBC,cAAM,EADkB;AAExBC,aAAK,EAAEF,OAAO,CAAPA,QAAgBA,OAAO,CAAvBA,QAFiB;AAGxBG,yBAAiB,EAAE;AAHK,OAAnB;AAAA;AADS,GAPE;AAcxBC,UAAQ,EAAE;AACNC,WAAO,EAAE;AACLC,gBAAU,EADL;AAELC,UAAI,EAAE,mBAFD,QAEC,CAFD;AAE+B;AACpCC,aAAO,EAHF,cAGmB;;AAHnB;AADH;AAdc,CAArB;AAuBP;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,IAAMC,KAAK,GAAG,SAARA,KAAQ,mCAAsC;AACvD,MAAIC,qDAAO,CAAX,WAAW,CAAX,EAA0B;AACtB,UAAM,UAAUrB,oDAAS,CAAzB,eAAM,CAAN;AACH;;AAED,MAAMe,QAAQ,GAAGO,iGAAa,CAACjB,YAAY,CAAb,UAA9B,mBAA8B,CAA9B;AACA,MAAMkB,WAAW,GAAGC,yFAAS,cAA7B,QAA6B,CAA7B;AANuD,MAQjDR,OARiD,GAQrCO,WARqC;AASvD,MAAIE,gBAAgB,GAAGF,WAAW,CAAXA,OAAW,CAAXA,YAAvB;;AACA,MAAI,CAACG,qDAAO,CAAZ,gBAAY,CAAZ,EAAgC;AAC5BD,oBAAgB,GAAG,CAAnBA,gBAAmB,CAAnBA;AACAT,WAAO,GAAG,CAAVA,OAAU,CAAVA;AACH;;AAED,SAAO;AACHA,WAAO,EADJ;AAEHS,oBAAgB,EAAhBA;AAFG,GAAP;AAfG,E","file":"TableParser.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 31);\n","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@splunk/visualization-encoding-parsers/Base\");","module.exports = require(\"lodash/isArray\");","import { _ } from '@splunk/ui-utils/i18n';\n\nexport const ErrorMsgs = {\n NO_DATA_SOURCES: _('No valid dataSources.'),\n NO_ENCODING: _('No valid encoding.'),\n ERROR_PARSE: _('Can not parse data correctly.'),\n};\n","module.exports = require(\"lodash/isEmpty\");","/* eslint-disable dot-notation */\nimport { parse as baseParse, mergeEncoding } from '@splunk/visualization-encoding-parsers/Base';\nimport isEmpty from 'lodash/isEmpty';\nimport isArray from 'lodash/isArray';\nimport { ErrorMsgs } from './errorMsgs';\n\nexport const dataContract = {\n requiredDataSources: [\n {\n name: 'primary',\n description: 'DataSource that powers the visualization',\n },\n ],\n initialRequestParams: {\n primary: (options = {}) => ({\n offset: 0,\n count: options.count ? options.count : 20,\n requestTotalCount: true,\n }),\n },\n encoding: {\n columns: {\n isRequired: true,\n type: ['time', 'number', 'string'], // TODO: In the future, once supported, add 'sparkline' as a type\n default: 'primary[0:]', // TODO: In the future, refactor according to UX designs to show only first N fields\n },\n },\n};\n\n/**\n * Table parse function\n * @param {object} dataSources\n * @param {object} userDefinedEncoding\n * @return {object} props that dashboard visualization can use.\n * @public\n */\nexport const parse = (dataSources, userDefinedEncoding) => {\n if (isEmpty(dataSources)) {\n throw new Error(ErrorMsgs.NO_DATA_SOURCES);\n }\n\n const encoding = mergeEncoding(dataContract.encoding, userDefinedEncoding);\n const parsedProps = baseParse(dataSources, encoding);\n\n let { columns } = parsedProps;\n let columnsFieldName = parsedProps['_meta'].fieldNames.columns;\n if (!isArray(columnsFieldName)) {\n columnsFieldName = [columnsFieldName];\n columns = [columns];\n }\n\n return {\n columns,\n columnsFieldName,\n };\n};\n"],"sourceRoot":""}
package/errorMsgs.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"@splunk/ui-utils/i18n\"","webpack:///./src/errorMsgs.js"],"names":["ErrorMsgs","NO_DATA_SOURCES","_","NO_ENCODING","ERROR_PARSE"],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;AClFA,kD;;;;;;;;ACAA;AAAA;AAAA;AAAA;AAA0C;AAEnC,IAAMA,SAAS,GAAG;EACrBC,eAAe,EAAEC,+DAAC,CAAC,uBAAuB,CAAC;EAC3CC,WAAW,EAAED,+DAAC,CAAC,oBAAoB,CAAC;EACpCE,WAAW,EAAEF,+DAAC,CAAC,+BAA+B;AAClD,CAAC,C","file":"errorMsgs.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 2);\n","module.exports = require(\"@splunk/ui-utils/i18n\");","import { _ } from '@splunk/ui-utils/i18n';\n\nexport const ErrorMsgs = {\n NO_DATA_SOURCES: _('No valid dataSources.'),\n NO_ENCODING: _('No valid encoding.'),\n ERROR_PARSE: _('Can not parse data correctly.'),\n};\n"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"@splunk/ui-utils/i18n\"","webpack:///./src/errorMsgs.js"],"names":["ErrorMsgs","NO_DATA_SOURCES","_","NO_ENCODING","ERROR_PARSE"],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;AClFA,kD;;;;;;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAEO,IAAMA,SAAS,GAAG;AACrBC,iBAAe,EAAEC,+DAAC,CADG,uBACH,CADG;AAErBC,aAAW,EAAED,+DAAC,CAFO,oBAEP,CAFO;AAGrBE,aAAW,EAAEF,+DAAC;AAHO,CAAlB,C","file":"errorMsgs.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 2);\n","module.exports = require(\"@splunk/ui-utils/i18n\");","import { _ } from '@splunk/ui-utils/i18n';\n\nexport const ErrorMsgs = {\n NO_DATA_SOURCES: _('No valid dataSources.'),\n NO_ENCODING: _('No valid encoding.'),\n ERROR_PARSE: _('Can not parse data correctly.'),\n};\n"],"sourceRoot":""}
package/package.json CHANGED
@@ -2,14 +2,14 @@
2
2
  "name": "@splunk/visualization-encoding-parsers",
3
3
  "license": "SEE LICENSE IN LICENSE.md",
4
4
  "author": "Splunk",
5
- "version": "25.13.1",
5
+ "version": "26.1.0",
6
6
  "scripts": {
7
- "build": "NODE_ENV=production webpack --config ./webpack.config.js --bail",
7
+ "build": "export NODE_OPTIONS=--openssl-legacy-provider && NODE_ENV=production webpack --config ./webpack.config.js --bail",
8
8
  "build:ci": "yarn build && yarn docs",
9
9
  "clean": "yarn clean:webpack && yarn clean:test-reports",
10
10
  "clean:webpack": "git ls-files --others -i --exclude-standard *.js *.map | xargs rm",
11
11
  "clean:test-reports": "rm -rf ./test-reports",
12
- "dev": "NODE_ENV=development webpack --config ./webpack.config.js --watch",
12
+ "dev": "export NODE_OPTIONS=--openssl-legacy-provider && NODE_ENV=development webpack --config ./webpack.config.js --watch",
13
13
  "eslint": "eslint src --ext \".js,.jsx\"",
14
14
  "eslint:ci": "eslint src --ext \".js,.jsx\" -f junit -o test-reports/lint-results.xml",
15
15
  "eslint:fix": "eslint src --ext \".js, .jsx\" --fix",
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "@babel/runtime": "^7.13.0",
24
- "@splunk/visualizations-shared": "^25.13.1",
24
+ "@splunk/visualizations-shared": "^26.1.0",
25
25
  "chroma-js": "^2.0.0",
26
26
  "lodash": "^4.17.21"
27
27
  },
@@ -29,14 +29,14 @@
29
29
  "@babel/plugin-transform-runtime": "^7.13.0",
30
30
  "@splunk/eslint-config": "^4.0.0",
31
31
  "@splunk/jsdoc-loader": "^3.0.0",
32
- "@splunk/visualization-build-tools": "^25.13.1",
32
+ "@splunk/visualization-build-tools": "^26.1.0",
33
33
  "@splunk/webpack-configs": "^4.0.0",
34
34
  "babel-jest": "^26.0.0",
35
35
  "babel-loader": "^8.2.1",
36
36
  "eslint": "^7.20.0",
37
37
  "eslint-config-airbnb": "^18.2.1",
38
38
  "eslint-config-prettier": "^7.2.0",
39
- "eslint-import-resolver-webpack": "^0.13.0",
39
+ "eslint-import-resolver-webpack": "^0.13.8",
40
40
  "eslint-plugin-import": "^2.22.1",
41
41
  "jest": "^26.0.0",
42
42
  "raw-loader": "^4.0.0",