@splunk/visualization-context 24.2.0 → 24.3.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 \"@babel/runtime/regenerator\"","webpack:///external \"@babel/runtime/helpers/classCallCheck\"","webpack:///external \"@babel/runtime/helpers/createClass\"","webpack:///external \"@babel/runtime/helpers/asyncToGenerator\"","webpack:///external \"@babel/runtime/helpers/getPrototypeOf\"","webpack:///external \"@splunk/visualization-context/Provider\"","webpack:///external \"@babel/runtime/helpers/inherits\"","webpack:///external \"@babel/runtime/helpers/possibleConstructorReturn\"","webpack:///external \"@babel/runtime/helpers/defineProperty\"","webpack:///external \"@babel/runtime/helpers/slicedToArray\"","webpack:///./src/BaseRegistry.js","webpack:///external \"@babel/runtime/helpers/get\"","webpack:///./src/ImageRegistry.js"],"names":["BaseRegistry","provider","_","console","cachedProvider","providerType","type","isDefault","url","id","obj","options","offset","count","ids","ImageRegistry","validMediaType","VALID_MEDIA_TYPES","regex"],"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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,CAACE,iBAAmB;AACxE,aAAO,cAAc,CAAd,KAAoB,gBAAQ;AAC/B,YAAMC,KAAK,2BAAoBZ,IAAI,KAAJA,oCAApB,MAAX,aAAW,CAAX;AACA,eAAO,uBAAP,OAAO,CAAP;AAFJ,OAAO,CAAP;AAIH;AAED;AACJ;AACA;AACA;AACA;AACA;AACA;;;;WACI,iDAA0F;AAAA,UAAlDU,cAAkD,uEAAjCD,aAAa,CAACE,iBAAmB;;AACtF,UAAI,CAAC,+BAAL,cAAK,CAAL,EAAqD;AACjD,cAAM,UACFf,+DAAC,2EACsEc,cAAc,CAAdA,KADtE,IACsEA,CADtE,EADL,GACK,EADC,CAAN;AAOH;;AAED;AACH;;;WArCD,kBAAgB;AACZ,aAAO,IAAP,aAAO,EAAP;AACH;;;;EAHuBhB,qD;;6EAAtBe,a,uBAKyB,qC;;AAoC/B,8E","file":"ImageRegistry.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 = 26);\n","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@babel/runtime/regenerator\");","module.exports = require(\"@babel/runtime/helpers/classCallCheck\");","module.exports = require(\"@babel/runtime/helpers/createClass\");","module.exports = require(\"@babel/runtime/helpers/asyncToGenerator\");","module.exports = require(\"@babel/runtime/helpers/getPrototypeOf\");","module.exports = require(\"@splunk/visualization-context/Provider\");","module.exports = require(\"@babel/runtime/helpers/inherits\");","module.exports = require(\"@babel/runtime/helpers/possibleConstructorReturn\");","module.exports = require(\"@babel/runtime/helpers/defineProperty\");","module.exports = require(\"@babel/runtime/helpers/slicedToArray\");","/* eslint-disable class-methods-use-this */\nimport { _ } from '@splunk/ui-utils/i18n';\nimport Provider from '@splunk/visualization-context/Provider';\n\n/**\n * Base Registry\n */\nclass BaseRegistry {\n constructor() {\n this.cachedProviders = {};\n this.defaultProvider = null;\n }\n\n static create() {\n return new BaseRegistry();\n }\n\n /**\n * check whether user defined provider extends the base provider\n * @param {Provider} provider\n * @returns {Boolean}\n */\n isValidProvider(provider) {\n if (provider instanceof Provider) {\n return true;\n }\n throw new Error(_('Invalid Provider'));\n }\n\n /**\n * add default provider to cache\n * @param {Provider} provider\n */\n addDefaultProvider(provider) {\n if (this.isValidProvider(provider)) {\n this.addProvider(provider);\n this.defaultProvider = provider;\n }\n }\n\n /**\n * add provider to cache\n * @param {Provider} provider\n */\n addProvider(provider) {\n if (this.isValidProvider(provider)) {\n if (this.cachedProviders[provider.getType()]) {\n // eslint-disable-next-line\n console.warn(`The provider \"${provider.getType()}\" existed already.`);\n }\n this.cachedProviders[provider.getType()] = provider;\n }\n }\n\n /**\n * delete provider\n * @param {String} providerType\n */\n deleteProvider(providerType) {\n const cachedProvider = this.cachedProviders[providerType];\n if (!cachedProvider) {\n // eslint-disable-next-line\n console.warn(`The provider \"${providerType}\" does not existed`);\n return;\n }\n\n if (this.defaultProvider && providerType === this.defaultProvider.getType()) {\n this.defaultProvider = null;\n }\n delete this.cachedProviders[providerType];\n }\n\n /**\n * find provider from cache\n * @param {String} type\n * @returns {Provider} provider\n */\n findProvider(type) {\n const provider = this.cachedProviders[type];\n if (provider) {\n return provider;\n }\n throw new Error(_('Provider not found'));\n }\n\n /**\n * list all providers\n * @return {Object} provider = { type: 'local', isDefault: true }\n */\n listProviders() {\n return Object.keys(this.cachedProviders).map(type => ({\n type,\n isDefault: type === this.defaultProvider.getType(),\n }));\n }\n\n /**\n * check whether src is a http url or a url used for icon/image-registry (e.g. 'kvstore://image123')\n */\n isResourceURL(url) {\n if (!url || url.indexOf('://') < 0) {\n return false;\n }\n\n const { type } = this.parseURL(url);\n return type !== 'http' && type !== 'https';\n }\n\n /**\n * parse provider type and id from the url\n * @params {String} url 'kvstore://image123'\n * @returns {Object} obj\n * @returns {String} obj.type 'kvstore'\n * @returns {String} obj.id 'image123'\n */\n parseURL(url) {\n if (url) {\n const [type, id] = url.split('://');\n\n if (type && id) {\n return { type, id };\n }\n }\n throw new Error(_('Invalid url'));\n }\n\n /**\n * upload\n * @param {DataURI} dataURI\n * @param {Object} metaData\n * @param {String} providerType e.g. 'kvstore' or 'sui' or 'local'\n * @returns {String} id e.g. 'kvstore://image123'\n */\n async upload(dataURI, metaData, providerType) {\n if (providerType == null && this.defaultProvider == null) {\n throw new Error(_('No valid provider was found. Please add a provider'));\n }\n const provider = providerType ? this.findProvider(providerType) : this.defaultProvider;\n const id = await provider.upload(dataURI, metaData);\n return `${provider.getType()}://${id}`;\n }\n\n /**\n * get object by url\n * @param {String} url 'kvstore://image123'\n * @returns {Object} obj e.g. an image object or icon\n */\n async getByURL(url) {\n const { type, id } = this.parseURL(url);\n const provider = this.findProvider(type);\n const obj = await provider.getById(id);\n return obj;\n }\n\n /**\n * delete object by url\n * @param {String} url 'kvstore://image123' || 'sui://icon123'\n * @returns {Object} obj e.g. an image object or icon\n */\n async deleteByURL(url) {\n const { type, id } = this.parseURL(url);\n const provider = this.findProvider(type);\n const obj = await provider.deleteById(id);\n return obj;\n }\n\n /**\n * list all object ids\n * @params {String} providerType e.g. 'kvstore' or 'sui'\n * @params {Object} options\n * @returns {Array} ids\n */\n async listIds(providerType, options = { offset: 0, count: 100 }) {\n const provider = this.findProvider(providerType);\n const ids = await provider.listIds(options);\n return ids;\n }\n}\n\nexport default BaseRegistry;\n","module.exports = require(\"@babel/runtime/helpers/get\");","/* eslint-disable class-methods-use-this */\nimport { _ } from '@splunk/ui-utils/i18n';\nimport BaseRegistry from './BaseRegistry';\n\n/**\n * Image Registry\n */\nclass ImageRegistry extends BaseRegistry {\n static create() {\n return new ImageRegistry();\n }\n\n static VALID_MEDIA_TYPES = ['png', 'jpeg', 'svg', 'gif', 'webp'];\n\n /**\n * check if the the media type from the dataURI belongs to the supported types\n * @param {DataURI} dataURI\n * @returns {Boolean}\n */\n isValidMediaType(dataURI, validMediaType = ImageRegistry.VALID_MEDIA_TYPES) {\n return validMediaType.some(type => {\n const regex = `^data:image\\\\/${type === 'svg' ? `${type}\\\\+xml` : type};base64,.*$`;\n return new RegExp(regex).test(dataURI);\n });\n }\n\n /**\n * upload image if the image format is supported\n * @param {DataURI} dataURI\n * @param {Object} metaData\n * @param {String} providerType e.g. 'kvstore', or 'sui'\n * @returns {String} id e.g. 'kvstore://image123'\n */\n upload(dataURI, metaData, providerType, validMediaType = ImageRegistry.VALID_MEDIA_TYPES) {\n if (!this.isValidMediaType(dataURI, validMediaType)) {\n throw new Error(\n _(\n `The format of the uploaded file is not supported. Please upload ${validMediaType.join(\n ', '\n )}.`\n )\n );\n }\n\n return super.upload(dataURI, metaData, providerType);\n }\n}\n\nexport default ImageRegistry;\n"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"@splunk/ui-utils/i18n\"","webpack:///external \"@babel/runtime/regenerator\"","webpack:///external \"@babel/runtime/helpers/classCallCheck\"","webpack:///external \"@babel/runtime/helpers/createClass\"","webpack:///external \"@babel/runtime/helpers/asyncToGenerator\"","webpack:///external \"@babel/runtime/helpers/getPrototypeOf\"","webpack:///external \"@splunk/visualization-context/Provider\"","webpack:///external \"@babel/runtime/helpers/inherits\"","webpack:///external \"@babel/runtime/helpers/possibleConstructorReturn\"","webpack:///external \"@babel/runtime/helpers/defineProperty\"","webpack:///external \"@babel/runtime/helpers/slicedToArray\"","webpack:///./src/BaseRegistry.js","webpack:///external \"@babel/runtime/helpers/get\"","webpack:///./src/ImageRegistry.js"],"names":["BaseRegistry","provider","_","console","cachedProvider","providerType","type","isDefault","url","id","obj","options","offset","count","ids","ImageRegistry","validMediaType","VALID_MEDIA_TYPES","regex"],"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,uD;;;;;;ACAA,kE;;;;;;ACAA,+D;;;;;;ACAA,oE;;;;;;ACAA,kE;;;;;;ACAA,mE;;;;;;ACAA,4D;;;;;;ACAA,6E;;;;;;;ACAA,kE;;;;;;ACAA,iE;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;;AACA;AACA;AAEA;AACA;AACA;;IACMA,Y;AACF,0BAAc;AAAA;;AACV;AACA;AACH;;;;;AAMD;AACJ;AACA;AACA;AACA;AACI,uCAA0B;AACtB,UAAIC,QAAQ,YAAZ,+EAAkC;AAC9B;AACH;;AACD,YAAM,UAAUC,+DAAC,CAAjB,kBAAiB,CAAX,CAAN;AACH;AAED;AACJ;AACA;AACA;;;;WACI,sCAA6B;AACzB,UAAI,qBAAJ,QAAI,CAAJ,EAAoC;AAChC;AACA;AACH;AACJ;AAED;AACJ;AACA;AACA;;;;WACI,+BAAsB;AAClB,UAAI,qBAAJ,QAAI,CAAJ,EAAoC;AAChC,YAAI,qBAAqBD,QAAQ,CAAjC,OAAyBA,EAAr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C,uBAA5B,8DAAsC;AAAEC,wBAAM,EAAR;AAAaC,uBAAK,EAAE;AAApB,iBAAVF;AAClBV,wBADV,GACqB,kBADrB,YACqB,CAAXA;AADV;AAAA,uBAEsBA,QAAQ,CAARA,QAFtB,OAEsBA,CAFtB;;AAAA;AAEUa,mBAFV,iBAEUA;AAFV;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;;;;;;;;WA/JA,kBAAgB;AACZ,aAAO,IAAP,YAAO,EAAP;AACH;;;;;;AAoKL,6E;;;;;;ACnLA,uD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;;;AACA;AACA;AAEA;AACA;AACA;;IACMC,a;;;;;;;;;;;;;;AAOF;AACJ;AACA;AACA;AACA;AACI,uCAA4E;AAAA,UAAlDC,cAAkD,uEAAjCD,aAAa,CAACE,iBAAmB;AACxE,aAAO,cAAc,CAAd,KAAoB,gBAAQ;AAC/B,YAAMC,KAAK,2BAAoBZ,IAAI,KAAJA,oCAApB,MAAX,aAAW,CAAX;AACA,eAAO,uBAAP,OAAO,CAAP;AAFJ,OAAO,CAAP;AAIH;AAED;AACJ;AACA;AACA;AACA;AACA;AACA;;;;WACI,iDAA0F;AAAA,UAAlDU,cAAkD,uEAAjCD,aAAa,CAACE,iBAAmB;;AACtF,UAAI,CAAC,+BAAL,cAAK,CAAL,EAAqD;AACjD,cAAM,UACFf,+DAAC,2EACsEc,cAAc,CAAdA,KADtE,IACsEA,CADtE,EADL,GACK,EADC,CAAN;AAOH;;AAED;AACH;;;WArCD,kBAAgB;AACZ,aAAO,IAAP,aAAO,EAAP;AACH;;;;EAHuBhB,qD;;6EAAtBe,a,uBAKyB,qC;;AAoC/B,8E","file":"ImageRegistry.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 = 25);\n","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@babel/runtime/regenerator\");","module.exports = require(\"@babel/runtime/helpers/classCallCheck\");","module.exports = require(\"@babel/runtime/helpers/createClass\");","module.exports = require(\"@babel/runtime/helpers/asyncToGenerator\");","module.exports = require(\"@babel/runtime/helpers/getPrototypeOf\");","module.exports = require(\"@splunk/visualization-context/Provider\");","module.exports = require(\"@babel/runtime/helpers/inherits\");","module.exports = require(\"@babel/runtime/helpers/possibleConstructorReturn\");","module.exports = require(\"@babel/runtime/helpers/defineProperty\");","module.exports = require(\"@babel/runtime/helpers/slicedToArray\");","/* eslint-disable class-methods-use-this */\nimport { _ } from '@splunk/ui-utils/i18n';\nimport Provider from '@splunk/visualization-context/Provider';\n\n/**\n * Base Registry\n */\nclass BaseRegistry {\n constructor() {\n this.cachedProviders = {};\n this.defaultProvider = null;\n }\n\n static create() {\n return new BaseRegistry();\n }\n\n /**\n * check whether user defined provider extends the base provider\n * @param {Provider} provider\n * @returns {Boolean}\n */\n isValidProvider(provider) {\n if (provider instanceof Provider) {\n return true;\n }\n throw new Error(_('Invalid Provider'));\n }\n\n /**\n * add default provider to cache\n * @param {Provider} provider\n */\n addDefaultProvider(provider) {\n if (this.isValidProvider(provider)) {\n this.addProvider(provider);\n this.defaultProvider = provider;\n }\n }\n\n /**\n * add provider to cache\n * @param {Provider} provider\n */\n addProvider(provider) {\n if (this.isValidProvider(provider)) {\n if (this.cachedProviders[provider.getType()]) {\n // eslint-disable-next-line\n console.warn(`The provider \"${provider.getType()}\" existed already.`);\n }\n this.cachedProviders[provider.getType()] = provider;\n }\n }\n\n /**\n * delete provider\n * @param {String} providerType\n */\n deleteProvider(providerType) {\n const cachedProvider = this.cachedProviders[providerType];\n if (!cachedProvider) {\n // eslint-disable-next-line\n console.warn(`The provider \"${providerType}\" does not existed`);\n return;\n }\n\n if (this.defaultProvider && providerType === this.defaultProvider.getType()) {\n this.defaultProvider = null;\n }\n delete this.cachedProviders[providerType];\n }\n\n /**\n * find provider from cache\n * @param {String} type\n * @returns {Provider} provider\n */\n findProvider(type) {\n const provider = this.cachedProviders[type];\n if (provider) {\n return provider;\n }\n throw new Error(_('Provider not found'));\n }\n\n /**\n * list all providers\n * @return {Object} provider = { type: 'local', isDefault: true }\n */\n listProviders() {\n return Object.keys(this.cachedProviders).map(type => ({\n type,\n isDefault: type === this.defaultProvider.getType(),\n }));\n }\n\n /**\n * check whether src is a http url or a url used for icon/image-registry (e.g. 'kvstore://image123')\n */\n isResourceURL(url) {\n if (!url || url.indexOf('://') < 0) {\n return false;\n }\n\n const { type } = this.parseURL(url);\n return type !== 'http' && type !== 'https';\n }\n\n /**\n * parse provider type and id from the url\n * @params {String} url 'kvstore://image123'\n * @returns {Object} obj\n * @returns {String} obj.type 'kvstore'\n * @returns {String} obj.id 'image123'\n */\n parseURL(url) {\n if (url) {\n const [type, id] = url.split('://');\n\n if (type && id) {\n return { type, id };\n }\n }\n throw new Error(_('Invalid url'));\n }\n\n /**\n * upload\n * @param {DataURI} dataURI\n * @param {Object} metaData\n * @param {String} providerType e.g. 'kvstore' or 'sui' or 'local'\n * @returns {String} id e.g. 'kvstore://image123'\n */\n async upload(dataURI, metaData, providerType) {\n if (providerType == null && this.defaultProvider == null) {\n throw new Error(_('No valid provider was found. Please add a provider'));\n }\n const provider = providerType ? this.findProvider(providerType) : this.defaultProvider;\n const id = await provider.upload(dataURI, metaData);\n return `${provider.getType()}://${id}`;\n }\n\n /**\n * get object by url\n * @param {String} url 'kvstore://image123'\n * @returns {Object} obj e.g. an image object or icon\n */\n async getByURL(url) {\n const { type, id } = this.parseURL(url);\n const provider = this.findProvider(type);\n const obj = await provider.getById(id);\n return obj;\n }\n\n /**\n * delete object by url\n * @param {String} url 'kvstore://image123' || 'sui://icon123'\n * @returns {Object} obj e.g. an image object or icon\n */\n async deleteByURL(url) {\n const { type, id } = this.parseURL(url);\n const provider = this.findProvider(type);\n const obj = await provider.deleteById(id);\n return obj;\n }\n\n /**\n * list all object ids\n * @params {String} providerType e.g. 'kvstore' or 'sui'\n * @params {Object} options\n * @returns {Array} ids\n */\n async listIds(providerType, options = { offset: 0, count: 100 }) {\n const provider = this.findProvider(providerType);\n const ids = await provider.listIds(options);\n return ids;\n }\n}\n\nexport default BaseRegistry;\n","module.exports = require(\"@babel/runtime/helpers/get\");","/* eslint-disable class-methods-use-this */\nimport { _ } from '@splunk/ui-utils/i18n';\nimport BaseRegistry from './BaseRegistry';\n\n/**\n * Image Registry\n */\nclass ImageRegistry extends BaseRegistry {\n static create() {\n return new ImageRegistry();\n }\n\n static VALID_MEDIA_TYPES = ['png', 'jpeg', 'svg', 'gif', 'webp'];\n\n /**\n * check if the the media type from the dataURI belongs to the supported types\n * @param {DataURI} dataURI\n * @returns {Boolean}\n */\n isValidMediaType(dataURI, validMediaType = ImageRegistry.VALID_MEDIA_TYPES) {\n return validMediaType.some(type => {\n const regex = `^data:image\\\\/${type === 'svg' ? `${type}\\\\+xml` : type};base64,.*$`;\n return new RegExp(regex).test(dataURI);\n });\n }\n\n /**\n * upload image if the image format is supported\n * @param {DataURI} dataURI\n * @param {Object} metaData\n * @param {String} providerType e.g. 'kvstore', or 'sui'\n * @returns {String} id e.g. 'kvstore://image123'\n */\n upload(dataURI, metaData, providerType, validMediaType = ImageRegistry.VALID_MEDIA_TYPES) {\n if (!this.isValidMediaType(dataURI, validMediaType)) {\n throw new Error(\n _(\n `The format of the uploaded file is not supported. Please upload ${validMediaType.join(\n ', '\n )}.`\n )\n );\n }\n\n return super.upload(dataURI, metaData, providerType);\n }\n}\n\nexport default ImageRegistry;\n"],"sourceRoot":""}
@@ -87,7 +87,7 @@ module.exports =
87
87
  /******/
88
88
  /******/
89
89
  /******/ // Load entry module and return exports
90
- /******/ return __webpack_require__(__webpack_require__.s = 27);
90
+ /******/ return __webpack_require__(__webpack_require__.s = 26);
91
91
  /******/ })
92
92
  /************************************************************************/
93
93
  /******/ ([
@@ -146,22 +146,22 @@ module.exports = require("@babel/runtime/helpers/possibleConstructorReturn");
146
146
 
147
147
  /***/ }),
148
148
  /* 9 */,
149
- /* 10 */,
150
- /* 11 */
149
+ /* 10 */
151
150
  /***/ (function(module, exports) {
152
151
 
153
152
  module.exports = require("@babel/runtime/helpers/defineProperty");
154
153
 
155
154
  /***/ }),
155
+ /* 11 */,
156
156
  /* 12 */,
157
157
  /* 13 */,
158
- /* 14 */,
159
- /* 15 */
158
+ /* 14 */
160
159
  /***/ (function(module, exports) {
161
160
 
162
161
  module.exports = require("uuid-v4");
163
162
 
164
163
  /***/ }),
164
+ /* 15 */,
165
165
  /* 16 */,
166
166
  /* 17 */,
167
167
  /* 18 */,
@@ -172,15 +172,14 @@ module.exports = require("uuid-v4");
172
172
  /* 23 */,
173
173
  /* 24 */,
174
174
  /* 25 */,
175
- /* 26 */,
176
- /* 27 */
175
+ /* 26 */
177
176
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
178
177
 
179
178
  "use strict";
180
179
  __webpack_require__.r(__webpack_exports__);
181
180
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b64EncodeUnicode", function() { return b64EncodeUnicode; });
182
181
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "KEY", function() { return KEY; });
183
- /* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11);
182
+ /* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(10);
184
183
  /* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__);
185
184
  /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4);
186
185
  /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__);
@@ -196,7 +195,7 @@ __webpack_require__.r(__webpack_exports__);
196
195
  /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6__);
197
196
  /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(1);
198
197
  /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_7__);
199
- /* harmony import */ var uuid_v4__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(15);
198
+ /* harmony import */ var uuid_v4__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(14);
200
199
  /* harmony import */ var uuid_v4__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(uuid_v4__WEBPACK_IMPORTED_MODULE_8__);
201
200
  /* harmony import */ var _splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(0);
202
201
  /* harmony import */ var _splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_9__);
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"@splunk/ui-utils/i18n\"","webpack:///external \"@babel/runtime/regenerator\"","webpack:///external \"@babel/runtime/helpers/classCallCheck\"","webpack:///external \"@babel/runtime/helpers/createClass\"","webpack:///external \"@babel/runtime/helpers/asyncToGenerator\"","webpack:///external \"@babel/runtime/helpers/getPrototypeOf\"","webpack:///external \"@splunk/visualization-context/Provider\"","webpack:///external \"@babel/runtime/helpers/inherits\"","webpack:///external \"@babel/runtime/helpers/possibleConstructorReturn\"","webpack:///external \"@babel/runtime/helpers/defineProperty\"","webpack:///external \"uuid-v4\"","webpack:///./src/LocalIconProvider.js"],"names":["b64EncodeUnicode","btoa","String","parseInt","KEY","LocalIconProvider","fetch","response","text","parser","xmlDoc","svg","_","serializer","svgStr","iconDataURI","icon","dataURI","metaData","id","uuid","icons","JSON","localStorage","offset","count","meta","search","results","Object","iconMeta","isSearchedIcon","iconMetaValue","Provider"],"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,uD;;;;;;ACAA,kE;;;;;;ACAA,+D;;;;;;ACAA,oE;;;;;;ACAA,kE;;;;;;ACAA,mE;;;;;;ACAA,4D;;;;;;ACAA,6E;;;;;;;;ACAA,kE;;;;;;;;;ACAA,oC;;;;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AALA,EAAK,CAALA,aAFN,EAEX,CAFW,CAGX;;AACA,cAAMU,cAAc,GAChBJ,MAAM,IAANA,QACA,MAAM,CAAN,oBAA2B,gBAAQ;AAC/B,gBAAMK,aAAa,GAAGF,QAAQ,CAARA,IAAQ,CAARA,CAAtB,WAAsBA,EAAtB;AACA,mBAAOE,aAAa,CAAbA,QAAsBL,MAAM,CAA5BK,WAAsBL,EAAtBK,IAA8C,CAArD;AAJR,WAEI,CAFJ;;AAOA,cAAIL,MAAM,IAANA,QAAJ,gBAAsC;AAClC,gBAAID,IAAI,IAAIA,IAAI,CAAhB,QAAyB;AACrBV,kBAAI,CAAJA;AACAU,kBAAI,CAAJA,QAAa,gBAAQ;AACjB,oBAAII,QAAQ,CAARA,IAAQ,CAARA,IAAJ,MAA4B;AACxBd,sBAAI,CAAJA,iBAAsBc,QAAQ,CAA9Bd,IAA8B,CAA9BA;AACH;AAHLU;AAKH;;AAEDE,mBAAO,CAAPA;AACH;AAxBTC;AA2BA;AA/BJ,QAgCE,cAAc;AACZ,cAAM,UAAUjB,+DAAC,CAAjB,gCAAiB,CAAX,CAAN;AACH;AACJ;AAED;AACJ;AACA;;;;WACI,wBAAe;AACX,UAAI;AACA,YAAMI,IAAI,GAAG,aAAb,EAAa,CAAb;AACA,YAAMK,KAAK,GAAGC,IAAI,CAAJA,MAAWC,YAAY,CAAZA,QAAzB,GAAyBA,CAAXD,CAAd;AACA,eAAOD,KAAK,CAAZ,EAAY,CAAZ;AACAE,oBAAY,CAAZA,aAA0BD,IAAI,CAAJA,UAA1BC,KAA0BD,CAA1BC;AACA;AALJ,QAME,cAAc;AACZ,cAAM,UAAUX,+DAAC,CAAjB,6BAAiB,CAAX,CAAN;AACH;AACJ;;;;EAtH2BqB,8E;;AAyHhC,kF","file":"LocalIconProvider.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 = 27);\n","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@babel/runtime/regenerator\");","module.exports = require(\"@babel/runtime/helpers/classCallCheck\");","module.exports = require(\"@babel/runtime/helpers/createClass\");","module.exports = require(\"@babel/runtime/helpers/asyncToGenerator\");","module.exports = require(\"@babel/runtime/helpers/getPrototypeOf\");","module.exports = require(\"@splunk/visualization-context/Provider\");","module.exports = require(\"@babel/runtime/helpers/inherits\");","module.exports = require(\"@babel/runtime/helpers/possibleConstructorReturn\");","module.exports = require(\"@babel/runtime/helpers/defineProperty\");","module.exports = require(\"uuid-v4\");","/* eslint-disable class-methods-use-this,no-useless-constructor */\nimport uuid from 'uuid-v4';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport Provider from '@splunk/visualization-context/Provider';\n\nexport const b64EncodeUnicode = str =>\n // first we use encodeURIComponent to get percent-encoded UTF-8,\n // then we convert the percent encodings into raw bytes which\n // can be fed into btoa.\n btoa(\n encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, (match, p1) =>\n String.fromCharCode(parseInt(`0x${p1}`, 16))\n )\n );\n\nexport const KEY = '__icons__';\n\n/**\n * a local icon provider\n */\nclass LocalIconProvider extends Provider {\n constructor() {\n super();\n }\n\n /**\n * return provider type\n * @return {String} 'local'\n */\n getType() {\n return 'local';\n }\n\n /**\n * upload one new icon\n */\n async upload(dataURI, metaData) {\n // get svg from dataURI\n const response = await fetch(dataURI);\n const text = await response.text();\n const parser = new DOMParser();\n const xmlDoc = parser.parseFromString(text, 'text/xml');\n const svg = xmlDoc.getElementsByTagName('svg')[0];\n\n if (!svg.getAttribute('viewBox')) {\n throw new Error(_('Please upload a valid svg with viewBox attribute.'));\n }\n\n // reset svg attributes\n svg.setAttribute('preserveAspectRatio', 'none');\n // convert back to dataURI\n const serializer = new XMLSerializer();\n const svgStr = b64EncodeUnicode(serializer.serializeToString(svg));\n const iconDataURI = `data:image/svg+xml;base64,${svgStr}`;\n\n // save to localStorage\n try {\n const icon = { dataURI: iconDataURI, metaData };\n const id = uuid();\n let icons = JSON.parse(localStorage.getItem(KEY) || '{}');\n icons = { ...icons, [id]: icon };\n localStorage.setItem(KEY, JSON.stringify(icons));\n return id;\n } catch (error) {\n throw new Error(\n _('The icon cannot be uploaded. Please check whether your localStorage is full.')\n );\n }\n }\n\n /**\n * get one icon by icon id\n */\n getById(id) {\n const icons = JSON.parse(localStorage.getItem(KEY) || '{}');\n if (icons[id]) {\n return icons[id];\n }\n throw new Error(_('The icon is not found.'));\n }\n\n /**\n * get all icon ids\n * @params options\n * @params options.meta a list of meta data attribute that would be returned with each id\n * @params options.search a search string to filter the returned icons\n */\n listIds({ offset = 0, count = 100, meta = [], search = null }) {\n try {\n const icons = JSON.parse(localStorage.getItem(KEY) || '{}');\n const results = [];\n\n Object.keys(icons)\n .slice(offset, count)\n .forEach(id => {\n const icon = { id };\n const iconMeta = icons[id].metaData || {};\n // If search is a valid string, return the icon with matched meta data\n const isSearchedIcon =\n search != null &&\n Object.keys(iconMeta).some(attr => {\n const iconMetaValue = iconMeta[attr].toLowerCase();\n return iconMetaValue.indexOf(search.toLowerCase()) > -1;\n });\n\n if (search == null || isSearchedIcon) {\n if (meta && meta.length) {\n icon.metaData = {};\n meta.forEach(attr => {\n if (iconMeta[attr] != null) {\n icon.metaData[attr] = iconMeta[attr];\n }\n });\n }\n\n results.push(icon);\n }\n });\n\n return results;\n } catch (error) {\n throw new Error(_('The icon ids cannot be listed.'));\n }\n }\n\n /**\n * delete an icon by icon id\n */\n deleteById(id) {\n try {\n const icon = this.getById(id);\n const icons = JSON.parse(localStorage.getItem(KEY));\n delete icons[id];\n localStorage.setItem(KEY, JSON.stringify(icons));\n return icon;\n } catch (error) {\n throw new Error(_('The icon cannot be deleted.'));\n }\n }\n}\n\nexport default LocalIconProvider;\n"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"@splunk/ui-utils/i18n\"","webpack:///external \"@babel/runtime/regenerator\"","webpack:///external \"@babel/runtime/helpers/classCallCheck\"","webpack:///external \"@babel/runtime/helpers/createClass\"","webpack:///external \"@babel/runtime/helpers/asyncToGenerator\"","webpack:///external \"@babel/runtime/helpers/getPrototypeOf\"","webpack:///external \"@splunk/visualization-context/Provider\"","webpack:///external \"@babel/runtime/helpers/inherits\"","webpack:///external \"@babel/runtime/helpers/possibleConstructorReturn\"","webpack:///external \"@babel/runtime/helpers/defineProperty\"","webpack:///external \"uuid-v4\"","webpack:///./src/LocalIconProvider.js"],"names":["b64EncodeUnicode","btoa","String","parseInt","KEY","LocalIconProvider","fetch","response","text","parser","xmlDoc","svg","_","serializer","svgStr","iconDataURI","icon","dataURI","metaData","id","uuid","icons","JSON","localStorage","offset","count","meta","search","results","Object","iconMeta","isSearchedIcon","iconMetaValue","Provider"],"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,sDAAs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,UAAUX,+DAAC,CAAjB,6BAAiB,CAAX,CAAN;AACH;AACJ;;;;EAtH2BqB,8E;;AAyHhC,kF","file":"LocalIconProvider.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 = 26);\n","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@babel/runtime/regenerator\");","module.exports = require(\"@babel/runtime/helpers/classCallCheck\");","module.exports = require(\"@babel/runtime/helpers/createClass\");","module.exports = require(\"@babel/runtime/helpers/asyncToGenerator\");","module.exports = require(\"@babel/runtime/helpers/getPrototypeOf\");","module.exports = require(\"@splunk/visualization-context/Provider\");","module.exports = require(\"@babel/runtime/helpers/inherits\");","module.exports = require(\"@babel/runtime/helpers/possibleConstructorReturn\");","module.exports = require(\"@babel/runtime/helpers/defineProperty\");","module.exports = require(\"uuid-v4\");","/* eslint-disable class-methods-use-this,no-useless-constructor */\nimport uuid from 'uuid-v4';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport Provider from '@splunk/visualization-context/Provider';\n\nexport const b64EncodeUnicode = str =>\n // first we use encodeURIComponent to get percent-encoded UTF-8,\n // then we convert the percent encodings into raw bytes which\n // can be fed into btoa.\n btoa(\n encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, (match, p1) =>\n String.fromCharCode(parseInt(`0x${p1}`, 16))\n )\n );\n\nexport const KEY = '__icons__';\n\n/**\n * a local icon provider\n */\nclass LocalIconProvider extends Provider {\n constructor() {\n super();\n }\n\n /**\n * return provider type\n * @return {String} 'local'\n */\n getType() {\n return 'local';\n }\n\n /**\n * upload one new icon\n */\n async upload(dataURI, metaData) {\n // get svg from dataURI\n const response = await fetch(dataURI);\n const text = await response.text();\n const parser = new DOMParser();\n const xmlDoc = parser.parseFromString(text, 'text/xml');\n const svg = xmlDoc.getElementsByTagName('svg')[0];\n\n if (!svg.getAttribute('viewBox')) {\n throw new Error(_('Please upload a valid svg with viewBox attribute.'));\n }\n\n // reset svg attributes\n svg.setAttribute('preserveAspectRatio', 'none');\n // convert back to dataURI\n const serializer = new XMLSerializer();\n const svgStr = b64EncodeUnicode(serializer.serializeToString(svg));\n const iconDataURI = `data:image/svg+xml;base64,${svgStr}`;\n\n // save to localStorage\n try {\n const icon = { dataURI: iconDataURI, metaData };\n const id = uuid();\n let icons = JSON.parse(localStorage.getItem(KEY) || '{}');\n icons = { ...icons, [id]: icon };\n localStorage.setItem(KEY, JSON.stringify(icons));\n return id;\n } catch (error) {\n throw new Error(\n _('The icon cannot be uploaded. Please check whether your localStorage is full.')\n );\n }\n }\n\n /**\n * get one icon by icon id\n */\n getById(id) {\n const icons = JSON.parse(localStorage.getItem(KEY) || '{}');\n if (icons[id]) {\n return icons[id];\n }\n throw new Error(_('The icon is not found.'));\n }\n\n /**\n * get all icon ids\n * @params options\n * @params options.meta a list of meta data attribute that would be returned with each id\n * @params options.search a search string to filter the returned icons\n */\n listIds({ offset = 0, count = 100, meta = [], search = null }) {\n try {\n const icons = JSON.parse(localStorage.getItem(KEY) || '{}');\n const results = [];\n\n Object.keys(icons)\n .slice(offset, count)\n .forEach(id => {\n const icon = { id };\n const iconMeta = icons[id].metaData || {};\n // If search is a valid string, return the icon with matched meta data\n const isSearchedIcon =\n search != null &&\n Object.keys(iconMeta).some(attr => {\n const iconMetaValue = iconMeta[attr].toLowerCase();\n return iconMetaValue.indexOf(search.toLowerCase()) > -1;\n });\n\n if (search == null || isSearchedIcon) {\n if (meta && meta.length) {\n icon.metaData = {};\n meta.forEach(attr => {\n if (iconMeta[attr] != null) {\n icon.metaData[attr] = iconMeta[attr];\n }\n });\n }\n\n results.push(icon);\n }\n });\n\n return results;\n } catch (error) {\n throw new Error(_('The icon ids cannot be listed.'));\n }\n }\n\n /**\n * delete an icon by icon id\n */\n deleteById(id) {\n try {\n const icon = this.getById(id);\n const icons = JSON.parse(localStorage.getItem(KEY));\n delete icons[id];\n localStorage.setItem(KEY, JSON.stringify(icons));\n return icon;\n } catch (error) {\n throw new Error(_('The icon cannot be deleted.'));\n }\n }\n}\n\nexport default LocalIconProvider;\n"],"sourceRoot":""}
@@ -87,7 +87,7 @@ module.exports =
87
87
  /******/
88
88
  /******/
89
89
  /******/ // Load entry module and return exports
90
- /******/ return __webpack_require__(__webpack_require__.s = 28);
90
+ /******/ return __webpack_require__(__webpack_require__.s = 27);
91
91
  /******/ })
92
92
  /************************************************************************/
93
93
  /******/ ([
@@ -136,22 +136,22 @@ module.exports = require("@babel/runtime/helpers/possibleConstructorReturn");
136
136
 
137
137
  /***/ }),
138
138
  /* 9 */,
139
- /* 10 */,
140
- /* 11 */
139
+ /* 10 */
141
140
  /***/ (function(module, exports) {
142
141
 
143
142
  module.exports = require("@babel/runtime/helpers/defineProperty");
144
143
 
145
144
  /***/ }),
145
+ /* 11 */,
146
146
  /* 12 */,
147
147
  /* 13 */,
148
- /* 14 */,
149
- /* 15 */
148
+ /* 14 */
150
149
  /***/ (function(module, exports) {
151
150
 
152
151
  module.exports = require("uuid-v4");
153
152
 
154
153
  /***/ }),
154
+ /* 15 */,
155
155
  /* 16 */,
156
156
  /* 17 */,
157
157
  /* 18 */,
@@ -163,14 +163,13 @@ module.exports = require("uuid-v4");
163
163
  /* 24 */,
164
164
  /* 25 */,
165
165
  /* 26 */,
166
- /* 27 */,
167
- /* 28 */
166
+ /* 27 */
168
167
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
169
168
 
170
169
  "use strict";
171
170
  __webpack_require__.r(__webpack_exports__);
172
171
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "KEY", function() { return KEY; });
173
- /* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11);
172
+ /* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(10);
174
173
  /* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__);
175
174
  /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2);
176
175
  /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1__);
@@ -182,7 +181,7 @@ __webpack_require__.r(__webpack_exports__);
182
181
  /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__);
183
182
  /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(5);
184
183
  /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5__);
185
- /* harmony import */ var uuid_v4__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(15);
184
+ /* harmony import */ var uuid_v4__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(14);
186
185
  /* harmony import */ var uuid_v4__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(uuid_v4__WEBPACK_IMPORTED_MODULE_6__);
187
186
  /* harmony import */ var _splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(0);
188
187
  /* harmony import */ var _splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_7__);
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"@splunk/ui-utils/i18n\"","webpack:///external \"@babel/runtime/helpers/classCallCheck\"","webpack:///external \"@babel/runtime/helpers/createClass\"","webpack:///external \"@babel/runtime/helpers/getPrototypeOf\"","webpack:///external \"@splunk/visualization-context/Provider\"","webpack:///external \"@babel/runtime/helpers/inherits\"","webpack:///external \"@babel/runtime/helpers/possibleConstructorReturn\"","webpack:///external \"@babel/runtime/helpers/defineProperty\"","webpack:///external \"uuid-v4\"","webpack:///./src/LocalImageProvider.js"],"names":["KEY","LocalImageProvider","id","uuid","imageObject","dataURI","metaData","images","JSON","localStorage","_","offset","count","imageIDS","Object","Provider"],"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,kE;;;;;;ACAA,+D;;;;;;;ACAA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;AACA,YAAMK,QAAQ,GAAGC,MAAM,CAANA,KAAjB,MAAiBA,CAAjB;AACA,eAAOD,QAAQ,CAARA,cAAP,KAAOA,CAAP;AAHJ,QAIE,cAAc;AACZ,cAAM,UAAUH,+DAAC,CAAjB,iCAAiB,CAAX,CAAN;AACH;AACJ;AAED;AACJ;AACA;;;;WACI,6BAAoB;AAChB,UAAI;AACA,YAAMN,WAAW,GAAG,aAApB,OAAoB,CAApB;AACA,YAAMG,MAAM,GAAGC,IAAI,CAAJA,MAAWC,YAAY,CAAZA,QAA1B,GAA0BA,CAAXD,CAAf;AACA,eAAOD,MAAM,CAAb,OAAa,CAAb;AACAE,oBAAY,CAAZA,aAA0BD,IAAI,CAAJA,UAA1BC,MAA0BD,CAA1BC;AACA;AALJ,QAME,cAAc;AACZ,cAAM,UAAUC,+DAAC,CAAjB,8BAAiB,CAAX,CAAN;AACH;AACJ;;;;EApE4BK,6E;;AAuEjC,mF","file":"LocalImageProvider.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(\"@babel/runtime/helpers/classCallCheck\");","module.exports = require(\"@babel/runtime/helpers/createClass\");","module.exports = require(\"@babel/runtime/helpers/getPrototypeOf\");","module.exports = require(\"@splunk/visualization-context/Provider\");","module.exports = require(\"@babel/runtime/helpers/inherits\");","module.exports = require(\"@babel/runtime/helpers/possibleConstructorReturn\");","module.exports = require(\"@babel/runtime/helpers/defineProperty\");","module.exports = require(\"uuid-v4\");","/* eslint-disable class-methods-use-this,no-useless-constructor */\nimport uuid from 'uuid-v4';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport Provider from '@splunk/visualization-context/Provider';\n\nexport const KEY = '__images__';\n\n/**\n * a pure frontend local image provider\n */\nclass LocalImageProvider extends Provider {\n constructor() {\n super();\n }\n\n /**\n * return provider type\n */\n getType() {\n return 'local';\n }\n\n /**\n * add a new image\n */\n upload(dataURI, metaData) {\n try {\n const id = uuid();\n const imageObject = { dataURI, metaData };\n let images = JSON.parse(localStorage.getItem(KEY) || '{}');\n images = { ...images, [id]: imageObject };\n localStorage.setItem(KEY, JSON.stringify(images));\n return id;\n } catch (error) {\n throw new Error(\n _('The image cannot be uploaded. Please check whether your localStorage is full.')\n );\n }\n }\n\n /**\n * get image by imageID\n */\n getById(imageID) {\n const images = JSON.parse(localStorage.getItem(KEY) || '{}');\n const imageObject = images[imageID];\n if (imageObject) {\n return imageObject;\n }\n throw new Error(_('The image is not found.'));\n }\n\n /**\n * get all imageIDs\n */\n listIds({ offset, count }) {\n try {\n const images = JSON.parse(localStorage.getItem(KEY) || '{}');\n const imageIDS = Object.keys(images);\n return imageIDS.slice(offset, count);\n } catch (error) {\n throw new Error(_('The image ids cannot be listed.'));\n }\n }\n\n /**\n * delete an image by dataID\n */\n deleteById(imageID) {\n try {\n const imageObject = this.getById(imageID);\n const images = JSON.parse(localStorage.getItem(KEY));\n delete images[imageID];\n localStorage.setItem(KEY, JSON.stringify(images));\n return imageObject;\n } catch (error) {\n throw new Error(_('The image cannot be deleted.'));\n }\n }\n}\n\nexport default LocalImageProvider;\n"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"@splunk/ui-utils/i18n\"","webpack:///external \"@babel/runtime/helpers/classCallCheck\"","webpack:///external \"@babel/runtime/helpers/createClass\"","webpack:///external \"@babel/runtime/helpers/getPrototypeOf\"","webpack:///external \"@splunk/visualization-context/Provider\"","webpack:///external \"@babel/runtime/helpers/inherits\"","webpack:///external \"@babel/runtime/helpers/possibleConstructorReturn\"","webpack:///external \"@babel/runtime/helpers/defineProperty\"","webpack:///external \"uuid-v4\"","webpack:///./src/LocalImageProvider.js"],"names":["KEY","LocalImageProvider","id","uuid","imageObject","dataURI","metaData","images","JSON","localStorage","_","offset","count","imageIDS","Object","Provider"],"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,kE;;;;;;ACAA,+D;;;;;;;ACAA,kE;;;;;;ACAA,mE;;;;;;ACAA,4D;;;;;;ACAA,6E;;;;;;;ACAA,kE;;;;;;;;;ACAA,oC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;;;AACA;AACA;AACA;AAEO,IAAMA,GAAG,GAAT;AAEP;AACA;AACA;;IACMC,kB;;;;;AACF,gCAAc;AAAA;;AAAA;AAEb;AAED;AACJ;AACA;;;;;WACI,mBAAU;AACN;AACH;AAED;AACJ;AACA;;;;WACI,m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Ab;AACAE,oBAAY,CAAZA,aAA0BD,IAAI,CAAJA,UAA1BC,MAA0BD,CAA1BC;AACA;AALJ,QAME,cAAc;AACZ,cAAM,UAAUC,+DAAC,CAAjB,8BAAiB,CAAX,CAAN;AACH;AACJ;;;;EApE4BK,6E;;AAuEjC,mF","file":"LocalImageProvider.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 = 27);\n","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@babel/runtime/helpers/classCallCheck\");","module.exports = require(\"@babel/runtime/helpers/createClass\");","module.exports = require(\"@babel/runtime/helpers/getPrototypeOf\");","module.exports = require(\"@splunk/visualization-context/Provider\");","module.exports = require(\"@babel/runtime/helpers/inherits\");","module.exports = require(\"@babel/runtime/helpers/possibleConstructorReturn\");","module.exports = require(\"@babel/runtime/helpers/defineProperty\");","module.exports = require(\"uuid-v4\");","/* eslint-disable class-methods-use-this,no-useless-constructor */\nimport uuid from 'uuid-v4';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport Provider from '@splunk/visualization-context/Provider';\n\nexport const KEY = '__images__';\n\n/**\n * a pure frontend local image provider\n */\nclass LocalImageProvider extends Provider {\n constructor() {\n super();\n }\n\n /**\n * return provider type\n */\n getType() {\n return 'local';\n }\n\n /**\n * add a new image\n */\n upload(dataURI, metaData) {\n try {\n const id = uuid();\n const imageObject = { dataURI, metaData };\n let images = JSON.parse(localStorage.getItem(KEY) || '{}');\n images = { ...images, [id]: imageObject };\n localStorage.setItem(KEY, JSON.stringify(images));\n return id;\n } catch (error) {\n throw new Error(\n _('The image cannot be uploaded. Please check whether your localStorage is full.')\n );\n }\n }\n\n /**\n * get image by imageID\n */\n getById(imageID) {\n const images = JSON.parse(localStorage.getItem(KEY) || '{}');\n const imageObject = images[imageID];\n if (imageObject) {\n return imageObject;\n }\n throw new Error(_('The image is not found.'));\n }\n\n /**\n * get all imageIDs\n */\n listIds({ offset, count }) {\n try {\n const images = JSON.parse(localStorage.getItem(KEY) || '{}');\n const imageIDS = Object.keys(images);\n return imageIDS.slice(offset, count);\n } catch (error) {\n throw new Error(_('The image ids cannot be listed.'));\n }\n }\n\n /**\n * delete an image by dataID\n */\n deleteById(imageID) {\n try {\n const imageObject = this.getById(imageID);\n const images = JSON.parse(localStorage.getItem(KEY));\n delete images[imageID];\n localStorage.setItem(KEY, JSON.stringify(images));\n return imageObject;\n } catch (error) {\n throw new Error(_('The image cannot be deleted.'));\n }\n }\n}\n\nexport default LocalImageProvider;\n"],"sourceRoot":""}
@@ -87,12 +87,12 @@ module.exports =
87
87
  /******/
88
88
  /******/
89
89
  /******/ // Load entry module and return exports
90
- /******/ return __webpack_require__(__webpack_require__.s = 10);
90
+ /******/ return __webpack_require__(__webpack_require__.s = 28);
91
91
  /******/ })
92
92
  /************************************************************************/
93
93
  /******/ ({
94
94
 
95
- /***/ 10:
95
+ /***/ 28:
96
96
  /***/ (function(module, exports, __webpack_require__) {
97
97
 
98
98
  "use strict";
@@ -101,10 +101,63 @@ module.exports =
101
101
  Object.defineProperty(exports, "__esModule", {
102
102
  value: true
103
103
  });
104
- exports.version = void 0;
105
- exports.version = '24.2.0';
104
+ exports.testTileConfig = exports.MapContextConsumer = exports.MapContextProvider = void 0;
105
+
106
+ var React = __webpack_require__(9);
107
+
108
+ var MapContext = React.createContext({
109
+ defaultTileConfig: []
110
+ });
111
+ MapContext.displayName = "data-splunk-visualization-version-MapContext-".concat("24.3.0 - 1c1ae4b3c");
112
+ exports.MapContextProvider = MapContext.Provider;
113
+ exports.MapContextConsumer = MapContext.Consumer;
114
+ exports.default = MapContext;
115
+ exports.testTileConfig = [{
116
+ name: 'Carto Base Map - Light',
117
+ key: 'carto.base.map.light',
118
+ theme: 'light',
119
+ sources: {
120
+ 'base-tiles': {
121
+ type: 'raster',
122
+ tiles: ['https://a.basemaps.cartocdn.com/rastertiles/voyager_labels_under/{z}/{x}/{y}.png'],
123
+ tileSize: 256
124
+ }
125
+ },
126
+ layers: [{
127
+ id: 'base-layer',
128
+ type: 'raster',
129
+ source: 'base-tiles',
130
+ minzoom: 0,
131
+ maxzoom: 12
132
+ }]
133
+ }, {
134
+ name: 'Cart Base Map - dark',
135
+ key: 'carto.base.map.dark',
136
+ theme: 'dark',
137
+ sources: {
138
+ 'base-tiles': {
139
+ type: 'raster',
140
+ tiles: ['https://a.basemaps.cartocdn.com/rastertiles/dark_all/{z}/{x}/{y}.png'],
141
+ tileSize: 256
142
+ }
143
+ },
144
+ layers: [{
145
+ id: 'base-layer',
146
+ type: 'raster',
147
+ source: 'base-tiles',
148
+ minzoom: 0,
149
+ maxzoom: 12
150
+ }]
151
+ }];
152
+
153
+ /***/ }),
154
+
155
+ /***/ 9:
156
+ /***/ (function(module, exports) {
157
+
158
+ module.exports = require("react");
106
159
 
107
160
  /***/ })
108
161
 
109
162
  /******/ });
110
- //# sourceMappingURL=version.js.map
163
+ //# sourceMappingURL=MapContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/MapContext.tsx","webpack:///external \"react\""],"names":[],"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;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EAAE;AALb,GADI;AAXZ,CAtB4C,CAAnC,C;;;;;;;ACtCb,kC","file":"MapContext.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","import * as React from 'react';\nimport type { Style, VectorSource, RasterSource, AnyLayer } from 'maplibre-gl';\n\n// Global provided via webpack\n// eslint-disable-next-line no-underscore-dangle\ndeclare const __VISION_VERSION__: string;\n\n/**\n * We are omitting the `sources`, `layers`, `verison` properties, and re-adding them with some constraint\n * 1. Changing `sources` and `layers` from optional to required\n * 2. Limiting `sources` type to `VectorSource` and `RasterSource` for MVP\n * 3. `version` property is specific to MapLibre and is always an 8. We will add this internally in the\n * Viz map component and not let the consumers bother\n */\nexport interface BaseTileConfig extends Omit<Style, 'sources' | 'layers' | 'version'> {\n name: string; // used to populate the tile server dropdown in editor, eg: 'Mapbox Streets V8 tileset'\n key: string; // sets the Viz map option - 'baseLayerTileServer'\n theme?: 'light' | 'dark'; // if no theme is specified, the tileserver is available for all themes\n sources: {\n [sourceName: string]: VectorSource | RasterSource;\n };\n layers: AnyLayer[];\n version?: number;\n}\n\nexport interface MapContextInterface {\n defaultTileConfig: BaseTileConfig[];\n customTileConfig?: BaseTileConfig[];\n mapboxAccessToken?: string;\n}\n\nconst MapContext = React.createContext<MapContextInterface>({ defaultTileConfig: [] });\nMapContext.displayName = `data-splunk-visualization-version-MapContext-${__VISION_VERSION__}`;\n\nexport const MapContextProvider = MapContext.Provider;\nexport const MapContextConsumer = MapContext.Consumer;\nexport default MapContext;\n\nexport const testTileConfig: BaseTileConfig[] = [\n {\n name: 'Carto Base Map - Light',\n key: 'carto.base.map.light',\n theme: 'light',\n sources: {\n 'base-tiles': {\n type: 'raster',\n tiles: ['https://a.basemaps.cartocdn.com/rastertiles/voyager_labels_under/{z}/{x}/{y}.png'],\n tileSize: 256,\n },\n },\n layers: [\n {\n id: 'base-layer',\n type: 'raster',\n source: 'base-tiles',\n minzoom: 0,\n maxzoom: 12,\n },\n ],\n },\n {\n name: 'Cart Base Map - dark',\n key: 'carto.base.map.dark',\n theme: 'dark',\n sources: {\n 'base-tiles': {\n type: 'raster',\n tiles: ['https://a.basemaps.cartocdn.com/rastertiles/dark_all/{z}/{x}/{y}.png'],\n tileSize: 256,\n },\n },\n layers: [\n {\n id: 'base-layer',\n type: 'raster',\n source: 'base-tiles',\n minzoom: 0,\n maxzoom: 12,\n },\n ],\n },\n];\n","module.exports = require(\"react\");"],"sourceRoot":""}
package/MockedProvider.js CHANGED
@@ -99,7 +99,7 @@ module.exports = require("@splunk/ui-utils/i18n");
99
99
 
100
100
  /***/ }),
101
101
 
102
- /***/ 11:
102
+ /***/ 10:
103
103
  /***/ (function(module, exports) {
104
104
 
105
105
  module.exports = require("@babel/runtime/helpers/defineProperty");
@@ -125,7 +125,7 @@ module.exports = require("@babel/runtime/helpers/createClass");
125
125
 
126
126
  "use strict";
127
127
  __webpack_require__.r(__webpack_exports__);
128
- /* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11);
128
+ /* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(10);
129
129
  /* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__);
130
130
  /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2);
131
131
  /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1__);
@@ -92,20 +92,6 @@ module.exports =
92
92
  /************************************************************************/
93
93
  /******/ ({
94
94
 
95
- /***/ 10:
96
- /***/ (function(module, exports, __webpack_require__) {
97
-
98
- "use strict";
99
-
100
-
101
- Object.defineProperty(exports, "__esModule", {
102
- value: true
103
- });
104
- exports.version = void 0;
105
- exports.version = '24.2.0';
106
-
107
- /***/ }),
108
-
109
95
  /***/ 32:
110
96
  /***/ (function(module, exports, __webpack_require__) {
111
97
 
@@ -119,10 +105,8 @@ exports.TimezoneContextConsumer = exports.TimezoneContextProvider = void 0;
119
105
 
120
106
  var React = __webpack_require__(9);
121
107
 
122
- var version_1 = __webpack_require__(10);
123
-
124
108
  var TimezoneContext = React.createContext({});
125
- TimezoneContext.displayName = "data-splunk-visualization-version-TimezoneContext-".concat(version_1.version);
109
+ TimezoneContext.displayName = "data-splunk-visualization-version-TimezoneContext-".concat("24.3.0 - 1c1ae4b3c");
126
110
  exports.TimezoneContextProvider = TimezoneContext.Provider;
127
111
  exports.TimezoneContextConsumer = TimezoneContext.Consumer;
128
112
  exports.default = TimezoneContext;
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/version.ts","webpack:///./src/TimezoneContext.ts","webpack:///external \"react\""],"names":[],"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,kBAAU,QAAV,C;;;;;;;;;;;;;;;ACAb;;AACA;;AAiBA,IAAM,eAAe,GAAG,KAAK,CAAC,aAAN,CAA8C,EAA9C,CAAxB;AACA,eAAe,CAAC,WAAhB,+DAAmF,iBAAnF;AAEa,kCAA0B,eAAe,CAAC,QAA1C;AACA,kCAA0B,eAAe,CAAC,QAA1C;AACb,kBAAe,eAAf,C;;;;;;;ACvBA,kC","file":"TimezoneContext.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 = 32);\n","export const version = '24.2.0';\n","import * as React from 'react';\nimport { version } from './version';\n\n/**\n * ianaTimezone can be used to specify a timezone corresponding to one of the entries in the IANA time zone database (e.g. America/Los_Angeles)\n *\n * serializedTimezone is Splunk's serialized timezone format and is usually present in enterprise via window.$C.SERVER_ZONEINFO\n * serialized time format examples can be found here https://git.splunk.com/projects/UI/repos/splunk-ui/browse/packages/moment/src/test/timezones\n *\n * utcOffset can be used to specify the desired display timezone via its offset from UTC time in minutes\n * Positive values are west, negative values are east of UTC, as in the ECMAScript getTimezoneOffset method\n */\nexport interface TimezoneContextInterface {\n ianaTimezone?: string;\n serializedTimezone?: string;\n utcOffset?: number;\n}\n\nconst TimezoneContext = React.createContext<TimezoneContextInterface>({});\nTimezoneContext.displayName = `data-splunk-visualization-version-TimezoneContext-${version}`;\n\nexport const TimezoneContextProvider = TimezoneContext.Provider;\nexport const TimezoneContextConsumer = TimezoneContext.Consumer;\nexport default TimezoneContext;\n","module.exports = require(\"react\");"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/TimezoneContext.ts","webpack:///external \"react\""],"names":[],"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;;AAqBA,IAAM,eAAe,GAAG,KAAK,CAAC,aAAN,CAA8C,EAA9C,CAAxB;AACA,eAAe,CAAC,WAAhB,+DAAmF,oBAAnF;AAEa,kCAA0B,eAAe,CAAC,QAA1C;AACA,kCAA0B,eAAe,CAAC,QAA1C;AACb,kBAAe,eAAf,C;;;;;;;AC1BA,kC","file":"TimezoneContext.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 = 32);\n","import * as React from 'react';\n\n// Global provided via webpack\n// eslint-disable-next-line no-underscore-dangle\ndeclare const __VISION_VERSION__: string;\n\n/**\n * ianaTimezone can be used to specify a timezone corresponding to one of the entries in the IANA time zone database (e.g. America/Los_Angeles)\n *\n * serializedTimezone is Splunk's serialized timezone format and is usually present in enterprise via window.$C.SERVER_ZONEINFO\n * serialized time format examples can be found here https://git.splunk.com/projects/UI/repos/splunk-ui/browse/packages/moment/src/test/timezones\n *\n * utcOffset can be used to specify the desired display timezone via its offset from UTC time in minutes\n * Positive values are west, negative values are east of UTC, as in the ECMAScript getTimezoneOffset method\n */\nexport interface TimezoneContextInterface {\n ianaTimezone?: string;\n serializedTimezone?: string;\n utcOffset?: number;\n}\n\nconst TimezoneContext = React.createContext<TimezoneContextInterface>({});\nTimezoneContext.displayName = `data-splunk-visualization-version-TimezoneContext-${__VISION_VERSION__}`;\n\nexport const TimezoneContextProvider = TimezoneContext.Provider;\nexport const TimezoneContextConsumer = TimezoneContext.Consumer;\nexport default TimezoneContext;\n","module.exports = require(\"react\");"],"sourceRoot":""}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@splunk/visualization-context",
3
3
  "license": "SEE LICENSE IN LICENSE.md",
4
4
  "author": "Splunk",
5
- "version": "24.2.0",
5
+ "version": "24.3.0",
6
6
  "scripts": {
7
7
  "build": "NODE_ENV=production webpack --config ./webpack.config.js --bail",
8
8
  "build:ci": "yarn build && yarn docs",
@@ -15,8 +15,7 @@
15
15
  "lint:fix": "eslint src --ext \".js,.jsx,.ts,.tsx\" --fix",
16
16
  "test:unit": "jest src/.*",
17
17
  "test:unit:ci": "yarn run test:unit",
18
- "test:unit:watch": "jest --watch src/.*",
19
- "generateVersion": "node ./scripts/generateVersion"
18
+ "test:unit:watch": "jest --watch src/.*"
20
19
  },
21
20
  "dependencies": {
22
21
  "@babel/runtime": "^7.13.0",
@@ -26,13 +25,13 @@
26
25
  "peerDependencies": {
27
26
  "react": "^16.11.0",
28
27
  "react-dom": "^16.11.0",
29
- "styled-components": "^5.1"
28
+ "styled-components": "5.1.1"
30
29
  },
31
30
  "devDependencies": {
32
31
  "@babel/plugin-transform-runtime": "^7.13.0",
33
32
  "@splunk/eslint-config": "^4.0.0",
34
33
  "@splunk/jsdoc-loader": "^3.0.0",
35
- "@splunk/visualization-build-tools": "^24.2.0",
34
+ "@splunk/visualization-build-tools": "^24.3.0",
36
35
  "@splunk/webpack-configs": "^4.0.0",
37
36
  "babel-jest": "^26.0.0",
38
37
  "babel-loader": "^8.2.1",
@@ -1,13 +0,0 @@
1
- /* eslint-disable */
2
- const fs = require('fs');
3
- const { execSync } = require('child_process');
4
- let SHA = '';
5
-
6
- if (process.argv[2] === 'includeGitHash') {
7
- SHA = ` - ${execSync('git rev-parse --short HEAD', { encoding: 'utf8' }).split('\n').join('')}`;
8
- }
9
-
10
- fs.writeFileSync(
11
- './src/version.ts',
12
- `export const version = '${JSON.parse(fs.readFileSync('package.json', 'utf8')).version}${SHA}';\n`
13
- );
package/version.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/version.ts"],"names":[],"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,kBAAU,QAAV,C","file":"version.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 = 10);\n","export const version = '24.2.0';\n"],"sourceRoot":""}