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O,YAKpB,iBAAiB,EAAI,kBAAkB,SAAS,GAKhD,eAAe,EAAI,gBAAgB,SAAS,GAK5C,QAAQ,EAAI,SAAS,SAAS,EAAS,GAKvC,UAAU,EAAI,WAAW,SAAS,GAKlC,KAAK,EAAI,MAAM,SAAS,GAKxB,MAAM,EAAI,OAAO,SAAS,GAK1B,OAAO,EAAI,QAAQ,SAAS,GAK5B,UAAU,EAAI,WAAW,SAAS,EAAS,GAK3C,OAAO,EAAI,QAAQ,SAAS,EAAS,GAGzC,EAEA,OAAO,QAAU","file":"/npm/sdk-temp-wip@1.4.0/dist/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/sdk-temp-wip@1.4.0/dist/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","'use strict';\n\nvar _protocolManager = require('./protocolManager');\n\nvar _protocolManager2 = _interopRequireDefault(_protocolManager);\n\nvar _deviceManager = require('./deviceManager');\n\nvar _deviceManager2 = _interopRequireDefault(_deviceManager);\n\nvar _device = require('./device');\n\nvar _device2 = _interopRequireDefault(_device);\n\nvar _protocol = require('./protocol');\n\nvar _protocol2 = _interopRequireDefault(_protocol);\n\nvar _idm = require('./idm');\n\nvar _idm2 = _interopRequireDefault(_idm);\n\nvar _data = require('./data');\n\nvar _data2 = _interopRequireDefault(_data);\n\nvar _cloud = require('./cloud');\n\nvar _cloud2 = _interopRequireDefault(_cloud);\n\nvar _policies = require('./policies');\n\nvar _policies2 = _interopRequireDefault(_policies);\n\nvar _audit = require('./audit');\n\nvar _audit2 = _interopRequireDefault(_audit);\n\nvar _urlParse = require('url-parse');\n\nvar _urlParse2 = _interopRequireDefault(_urlParse);\n\nvar _clone = require('lodash/clone');\n\nvar _clone2 = _interopRequireDefault(_clone);\n\nvar _utils = require('./utils');\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n  * @namespace agile\n  * @description\n  * Welcome to the Agile SDK documentation.\n  *\n  * This document aims to describe all the functions supported by the SDK, as well as showing examples of their expected usage.\n  *\n  * If you feel something is missing, not clear or could be improved, please don't hesitate to open an [issue in GitHub](https://github.com/agile-iot/agile-sdk/issues/new), we'll be happy to help.\n  * @param {Object} - including the api base url, idm base url (if not provided defaults to the same api host but default idm port), and a token.\n  * @returns {Object}\n  * @example\n  * var agile = require('agile-sdk')({\n      api:'http://agile-core:8080',\n      idm: 'http://agile-core:3000',\n      data: 'http://agile-data:1338',\n      token: 'zIOycOqbEQh4ayw7lGAm9ILBIr'\n    })\n*/\n/*******************************************************************************\n * Copyright (C) 2018 resin.io, and others\n *\n * This program and the accompanying materials are made\n * available under the terms of the Eclipse Public License 2.0\n * which is available at https://www.eclipse.org/legal/epl-2.0/\n *\n * SPDX-License-Identifier: EPL-2.0\n ******************************************************************************/\nvar agileSDK = function agileSDK(params) {\n  // backwards compatibility\n  if (typeof params === 'string' || params instanceof String) {\n    params = { api: params };\n  }\n  // parse url to remove any irregularites\n  var parsed = (0, _urlParse2.default)(params.api);\n  var apiBase = params.api.indexOf('/') === 0 ? params.api + '/api' : parsed.origin + '/api';\n  var idmBase = params.idm ? params.idm : '' + (0, _clone2.default)(parsed).set('port', 3000).origin;\n  var dataBase = params.data ? params.data : '' + (0, _clone2.default)(parsed).set('port', 1338).origin;\n  var wsBase = (0, _clone2.default)(parsed).set('protocol', 'ws:').origin + '/ws';\n  // for now we keep it as const... but token in the sdk should be updated once in a while, since it can expire.\n  // for now we just create a new SDK object each time\n  var token = (0, _utils.tokenSet)(params.token);\n  return {\n    /**\n    * @summary Set/Update Idm Authentication token\n    * @name tokenSet\n    * @public\n    * @function\n    * @memberof agile\n    * @param {String} token - Idm Authentication token\n    * @returns {String} token - Newly set Idm Authentication token\n    * @example\n    * agile.tokenSet('1234');\n    **/\n    tokenSet: _utils.tokenSet,\n    /**\n    * @summary Get Idm Authentication token\n    * @name tokenGet\n    * @public\n    * @function\n    * @memberof agile\n    * @returns {String}\n    * @example\n    * agile.tokenGet();\n    **/\n    tokenGet: _utils.tokenGet,\n    /**\n    * @summary Unset/delete Idm Authentication token\n    * @name tokenDelete\n    * @public\n    * @function\n    * @memberof agile\n    * @returns {String}\n    * @example\n    * agile.tokenDelete();\n    **/\n    tokenDelete: _utils.tokenDelete,\n    /**\n    * @namespace protocolManager\n    * @memberof agile\n    **/\n    protocolManager: (0, _protocolManager2.default)(apiBase),\n    /**\n    * @namespace deviceManager\n    * @memberof agile\n    **/\n    deviceManager: (0, _deviceManager2.default)(apiBase),\n    /**\n    * @namespace device\n    * @memberof agile\n    **/\n    device: (0, _device2.default)(apiBase, wsBase),\n    /**\n    * @namespace protocol\n    * @memberof agile\n    **/\n    protocol: (0, _protocol2.default)(apiBase),\n    /**\n    * @namespace idm\n    * @memberof agile\n    **/\n    idm: (0, _idm2.default)(idmBase),\n    /**\n    * @namespace data\n    * @memberof agile\n    **/\n    data: (0, _data2.default)(dataBase),\n    /**\n    * @namespace cloud\n    * @memberof agile\n    **/\n    cloud: (0, _cloud2.default)(dataBase),\n    /**\n    * @namespace policies\n    * @memberof agile\n    **/\n    policies: (0, _policies2.default)(idmBase, token),\n    /**\n    * @namespace audit\n    * @memberof agile\n    **/\n    audit: (0, _audit2.default)(idmBase, token)\n\n  };\n};\n\nmodule.exports = agileSDK;"]}