rqlite-js 2.5.6 → 2.5.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,6 +28,12 @@ export const CONSISTENCY_LEVEL_NONE = 'none'
28
28
  */
29
29
  export const CONSISTENCY_LEVEL_STRONG = 'strong'
30
30
 
31
+ /**
32
+ * Read query consistency linearizable which must come from
33
+ * the master node
34
+ */
35
+ export const CONSISTENCY_LEVEL_LINEARIZABLE = 'linearizable'
36
+
31
37
  /**
32
38
  * Read query consistency weak which must come from
33
39
  * the master node
package/es6/index.js CHANGED
@@ -6,6 +6,12 @@ import DataApiClient from './api/data'
6
6
  import BackupApiClient from './api/backup'
7
7
  import StatusApiClient from './api/status'
8
8
 
9
+ export {
10
+ DataApiClient,
11
+ BackupApiClient,
12
+ StatusApiClient,
13
+ }
14
+
9
15
  export default {
10
16
  DataApiClient,
11
17
  BackupApiClient,
package/jsconfig.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  "allowSyntheticDefaultImports": true,
4
+ "moduleResolution": "node",
4
5
  "module": "commonJS",
5
- "target": "es6"
6
+ "target": "ES5"
6
7
  },
7
8
  "exclude": [
8
9
  "node_modules",
@@ -8,26 +8,26 @@ var _contentTypes = require("../../http-request/content-types"); /**
8
8
  * @module api/backup
9
9
  */ /**
10
10
  * The RQLite load api path
11
- */const PATH_LOAD = '/db/load';
11
+ */const PATH_LOAD = exports.PATH_LOAD = '/db/load';
12
12
 
13
13
  /**
14
14
  * The RQLite backup api path
15
- */exports.PATH_LOAD = PATH_LOAD;
16
- const PATH_BACKUP = '/db/backup';
15
+ */
16
+ const PATH_BACKUP = exports.PATH_BACKUP = '/db/backup';
17
17
 
18
18
  /**
19
19
  * Use plain SQL dump as the back up format
20
- */exports.PATH_BACKUP = PATH_BACKUP;
21
- const BACKUP_DATA_FORMAT_SQL = 'sql';
20
+ */
21
+ const BACKUP_DATA_FORMAT_SQL = exports.BACKUP_DATA_FORMAT_SQL = 'sql';
22
22
 
23
23
  /**
24
24
  * Use sqlite3 dump as the back up format
25
- */exports.BACKUP_DATA_FORMAT_SQL = BACKUP_DATA_FORMAT_SQL;
26
- const BACKUP_DATA_FORMAT_DUMP = 'dump';
25
+ */
26
+ const BACKUP_DATA_FORMAT_DUMP = exports.BACKUP_DATA_FORMAT_DUMP = 'dump';
27
27
 
28
28
  /**
29
29
  * Backup api client to perform RQLite back up and load operations
30
- */exports.BACKUP_DATA_FORMAT_DUMP = BACKUP_DATA_FORMAT_DUMP;
30
+ */
31
31
  class BackupApiClient extends _httpRequest.default {
32
32
  /**
33
33
  * Perform a SQL dump backup from the RQLite server
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_httpRequest","_interopRequireDefault","require","_contentTypes","PATH_LOAD","exports","PATH_BACKUP","BACKUP_DATA_FORMAT_SQL","BACKUP_DATA_FORMAT_DUMP","BackupApiClient","HttpRequest","backup","format","_superprop_getGet","get","_this","_asyncToGenerator2","default","stream","call","headers","Accept","CONTENT_TYPE_APPLICATION_OCTET_STREAM","query","fmt","undefined","json","uri","useLeader","load","data","_superprop_getPost","post","_this2","body","CONTENT_TYPE_TEXT_PLAIN"],"sources":["../../../es6/api/backup/index.js"],"sourcesContent":["/**\n * Backup api client to perform RQLite back and load operations\n * @module api/backup\n */\nimport HttpRequest from '../../http-request'\nimport { CONTENT_TYPE_APPLICATION_OCTET_STREAM, CONTENT_TYPE_TEXT_PLAIN } from '../../http-request/content-types'\n\n/**\n * The RQLite load api path\n */\nexport const PATH_LOAD = '/db/load'\n\n/**\n * The RQLite backup api path\n */\nexport const PATH_BACKUP = '/db/backup'\n\n/**\n * Use plain SQL dump as the back up format\n */\nexport const BACKUP_DATA_FORMAT_SQL = 'sql'\n\n/**\n * Use sqlite3 dump as the back up format\n */\nexport const BACKUP_DATA_FORMAT_DUMP = 'dump'\n\n/**\n * Backup api client to perform RQLite back up and load operations\n */\nexport default class BackupApiClient extends HttpRequest {\n /**\n * Perform a SQL dump backup from the RQLite server\n * @param {String} [format=BACKUP_DATA_FORMAT_DUMP] The backup data format\n * @returns {Stream} The response stream\n */\n async backup (format = BACKUP_DATA_FORMAT_DUMP) {\n const stream = super.get({\n headers: {\n // Always sends application/octet-stream from the server in RQLite v4.x\n Accept: CONTENT_TYPE_APPLICATION_OCTET_STREAM,\n },\n query: { fmt: format === BACKUP_DATA_FORMAT_SQL ? format : undefined },\n json: false,\n stream: true,\n uri: PATH_BACKUP,\n useLeader: true,\n })\n return stream\n }\n\n /**\n * Perform a SQL restore by sending data the RQLite server\n * @param {Buffer|String} data The data to be loaded\n * @param {String} [format=BACKUP_DATA_FORMAT_SQL] The backup data format\n * @returns {Stream} The response stream\n */\n async load (data, format = BACKUP_DATA_FORMAT_SQL) {\n return super.post({\n body: data,\n headers: {\n // eslint-disable-next-line max-len\n 'Content-Type': format === BACKUP_DATA_FORMAT_SQL ? CONTENT_TYPE_TEXT_PLAIN : CONTENT_TYPE_APPLICATION_OCTET_STREAM,\n },\n json: false,\n stream: true,\n uri: PATH_LOAD,\n useLeader: true,\n })\n }\n}\n"],"mappings":";;;;AAIA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA,qCAAiH,CALjH;AACA;AACA;AACA,GAHA,CAOA;AACA;AACA,GACO,MAAME,SAAS,GAAG,UAAU;;AAEnC;AACA;AACA,GAFAC,OAAA,CAAAD,SAAA,GAAAA,SAAA;AAGO,MAAME,WAAW,GAAG,YAAY;;AAEvC;AACA;AACA,GAFAD,OAAA,CAAAC,WAAA,GAAAA,WAAA;AAGO,MAAMC,sBAAsB,GAAG,KAAK;;AAE3C;AACA;AACA,GAFAF,OAAA,CAAAE,sBAAA,GAAAA,sBAAA;AAGO,MAAMC,uBAAuB,GAAG,MAAM;;AAE7C;AACA;AACA,GAFAH,OAAA,CAAAG,uBAAA,GAAAA,uBAAA;AAGe,MAAMC,eAAe,SAASC,oBAAW,CAAC;EACvD;AACF;AACA;AACA;AACA;EACQC,MAAMA,CAAEC,MAAM,GAAGJ,uBAAuB,EAAE,KAAAK,iBAAA,GAAAA,CAAA,WAAAC,GAAA,CAAAC,KAAA,mBAAAC,kBAAA,CAAAC,OAAA;MAC9C,MAAMC,MAAM,GAAGL,iBAAA,GAAAM,IAAA,CAAAJ,KAAA,EAAU;QACvBK,OAAO,EAAE;UACP;UACAC,MAAM,EAAEC;QACV,CAAC;QACDC,KAAK,EAAE,EAAEC,GAAG,EAAEZ,MAAM,KAAKL,sBAAsB,GAAGK,MAAM,GAAGa,SAAS,CAAC,CAAC;QACtEC,IAAI,EAAE,KAAK;QACXR,MAAM,EAAE,IAAI;QACZS,GAAG,EAAErB,WAAW;QAChBsB,SAAS,EAAE;MACb,CAAC,CAAC;MACF,OAAOV,MAAM;EACf;;EAEA;AACF;AACA;AACA;AACA;AACA;EACQW,IAAIA,CAAEC,IAAI,EAAElB,MAAM,GAAGL,sBAAsB,EAAE,KAAAwB,kBAAA,GAAAA,CAAA,WAAAC,IAAA,CAAAC,MAAA,mBAAAjB,kBAAA,CAAAC,OAAA;MACjD,OAAOc,kBAAA,GAAAZ,IAAA,CAAAc,MAAA,EAAW;QAChBC,IAAI,EAAEJ,IAAI;QACVV,OAAO,EAAE;UACP;UACA,cAAc,EAAER,MAAM,KAAKL,sBAAsB,GAAG4B,qCAAuB,GAAGb;QAChF,CAAC;QACDI,IAAI,EAAE,KAAK;QACXR,MAAM,EAAE,IAAI;QACZS,GAAG,EAAEvB,SAAS;QACdwB,SAAS,EAAE;MACb,CAAC,CAAC;EACJ;AACF,CAACvB,OAAA,CAAAY,OAAA,GAAAR,eAAA"}
1
+ {"version":3,"file":"index.js","names":["_httpRequest","_interopRequireDefault","require","_contentTypes","PATH_LOAD","exports","PATH_BACKUP","BACKUP_DATA_FORMAT_SQL","BACKUP_DATA_FORMAT_DUMP","BackupApiClient","HttpRequest","backup","format","_superprop_getGet","get","_this","_asyncToGenerator2","default","stream","call","headers","Accept","CONTENT_TYPE_APPLICATION_OCTET_STREAM","query","fmt","undefined","json","uri","useLeader","load","data","_superprop_getPost","post","_this2","body","CONTENT_TYPE_TEXT_PLAIN"],"sources":["../../../es6/api/backup/index.js"],"sourcesContent":["/**\n * Backup api client to perform RQLite back and load operations\n * @module api/backup\n */\nimport HttpRequest from '../../http-request'\nimport { CONTENT_TYPE_APPLICATION_OCTET_STREAM, CONTENT_TYPE_TEXT_PLAIN } from '../../http-request/content-types'\n\n/**\n * The RQLite load api path\n */\nexport const PATH_LOAD = '/db/load'\n\n/**\n * The RQLite backup api path\n */\nexport const PATH_BACKUP = '/db/backup'\n\n/**\n * Use plain SQL dump as the back up format\n */\nexport const BACKUP_DATA_FORMAT_SQL = 'sql'\n\n/**\n * Use sqlite3 dump as the back up format\n */\nexport const BACKUP_DATA_FORMAT_DUMP = 'dump'\n\n/**\n * Backup api client to perform RQLite back up and load operations\n */\nexport default class BackupApiClient extends HttpRequest {\n /**\n * Perform a SQL dump backup from the RQLite server\n * @param {String} [format=BACKUP_DATA_FORMAT_DUMP] The backup data format\n * @returns {Stream} The response stream\n */\n async backup (format = BACKUP_DATA_FORMAT_DUMP) {\n const stream = super.get({\n headers: {\n // Always sends application/octet-stream from the server in RQLite v4.x\n Accept: CONTENT_TYPE_APPLICATION_OCTET_STREAM,\n },\n query: { fmt: format === BACKUP_DATA_FORMAT_SQL ? format : undefined },\n json: false,\n stream: true,\n uri: PATH_BACKUP,\n useLeader: true,\n })\n return stream\n }\n\n /**\n * Perform a SQL restore by sending data the RQLite server\n * @param {Buffer|String} data The data to be loaded\n * @param {String} [format=BACKUP_DATA_FORMAT_SQL] The backup data format\n * @returns {Stream} The response stream\n */\n async load (data, format = BACKUP_DATA_FORMAT_SQL) {\n return super.post({\n body: data,\n headers: {\n // eslint-disable-next-line max-len\n 'Content-Type': format === BACKUP_DATA_FORMAT_SQL ? CONTENT_TYPE_TEXT_PLAIN : CONTENT_TYPE_APPLICATION_OCTET_STRE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,OAAA;MACjD,OAAOc,kBAAA,GAAAZ,IAAA,CAAAc,MAAA,EAAW;QAChBC,IAAI,EAAEJ,IAAI;QACVV,OAAO,EAAE;UACP;UACA,cAAc,EAAER,MAAM,KAAKL,sBAAsB,GAAG4B,qCAAuB,GAAGb;QAChF,CAAC;QACDI,IAAI,EAAE,KAAK;QACXR,MAAM,EAAE,IAAI;QACZS,GAAG,EAAEvB,SAAS;QACdwB,SAAS,EAAE;MACb,CAAC,CAAC;EACJ;AACF,CAACvB,OAAA,CAAAY,OAAA,GAAAR,eAAA","ignoreList":[]}
@@ -3,7 +3,7 @@
3
3
 
4
4
 
5
5
  var _httpRequest = _interopRequireDefault(require("../../http-request"));
6
- var _httpMethods = require("../../http-request/http-methods");function ownKeys(object, enumerableOnly) {var keys = Object.keys(object);if (Object.getOwnPropertySymbols) {var symbols = Object.getOwnPropertySymbols(object);enumerableOnly && (symbols = symbols.filter(function (sym) {return Object.getOwnPropertyDescriptor(object, sym).enumerable;})), keys.push.apply(keys, symbols);}return keys;}function _objectSpread(target) {for (var i = 1; i < arguments.length; i++) {var source = null != arguments[i] ? arguments[i] : {};i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {(0, _defineProperty2.default)(target, key, source[key]);}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));});}return target;} /**
6
+ var _httpMethods = require("../../http-request/http-methods");function ownKeys(e, r) {var t = Object.keys(e);if (Object.getOwnPropertySymbols) {var o = Object.getOwnPropertySymbols(e);r && (o = o.filter(function (r) {return Object.getOwnPropertyDescriptor(e, r).enumerable;})), t.push.apply(t, o);}return t;}function _objectSpread(e) {for (var r = 1; r < arguments.length; r++) {var t = null != arguments[r] ? arguments[r] : {};r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {(0, _defineProperty2.default)(e, r, t[r]);}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));});}return e;} /**
7
7
  * Base API client for RQLite which abstracts the HTTP calls
8
8
  * @module api/client
9
9
  */ /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_httpRequest","_interopRequireDefault","require","_httpMethods","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","createQuery","options","level","pretty","timings","atomic","transaction","query","entries","reduce","acc","entry","_entry","_slicedToArray2","val","ApiClient","HttpRequest","get","path","sql","_superprop_getGet","_this","_asyncToGenerator2","useLeader","Error","call","uri","httpMethod","HTTP_METHOD_GET","q","post","_superprop_getPost","_this2","HTTP_METHOD_POST","body","Array","isArray","exports"],"sources":["../../../es6/api/client/index.js"],"sourcesContent":["/**\n * Base API client for RQLite which abstracts the HTTP calls\n * @module api/client\n */\nimport HttpRequest from '../../http-request'\nimport { HTTP_METHOD_GET, HTTP_METHOD_POST } from '../../http-request/http-methods'\n\n/**\n * @typedef HttpRequestOptions\n * @type {import('../../http-request').HttpRequestOptions}\n */\n\n/**\n * Create the base HTTP query options from RQLite API options\n * @param {Object} [options={}] The RQLite API options\n * @param {String} [options.level] The consistency level\n * @param {String} [options.pretty] Pretty print the response body\n * @param {String} [options.timings] Provide query timings\n * @param {String} [options.atomic] Treat all commands in the request as a single transaction\n * for RQLite v5 and higher\n * @param {String} [options.transaction] Treat all commands in the request as a single transaction\n * for RQLite v4 and lower\n * @returns {Object} The HTTP query\n */\nexport function createQuery (options = {}) {\n const { level, pretty, timings, atomic, transaction } = options\n\n // Remove all undefined values\n const query = { level, pretty, timings, atomic, transaction }\n return Object.entries(query).reduce((acc, entry) => {\n const [key, val] = entry\n // Only take defined values\n if (typeof val !== 'undefined') {\n acc[key] = val\n }\n return acc\n }, {})\n}\n\n/**\n * Base API client for RQLite which abstracts the HTTP calls\n * from the user\n */\nexport default class ApiClient extends HttpRequest {\n /**\n * Perform a RQLite data API get request\n * @param {String} path The path for the request i.e. /db/query\n * @param {String} sql The SQL query\n * @param {HttpRequestOptions} [options={}] RQLite API options\n */\n async get (path, sql, options = {}) {\n const { useLeader } = options\n if (!path) {\n throw new Error('The path argument is required')\n }\n return super.get({\n useLeader,\n uri: path,\n httpMethod: HTTP_METHOD_GET,\n query: { ...createQuery(options), q: sql },\n })\n }\n\n /**\n * Perform a RQLite data API post request\n * @param {String} path The path for the request i.e. /db/query\n * @param {String} sql The SQL query\n * @param {HttpRequestOptions} [options={}] RQLite API options\n */\n async post (path, sql, options = {}) {\n const { useLeader } = options\n if (!path) {\n throw new Error('The path argument is required')\n }\n return super.post({\n useLeader,\n uri: path,\n httpMethod: HTTP_METHOD_POST,\n query: createQuery(options),\n body: Array.isArray(sql) ? sql : [sql],\n })\n }\n}\n"],"mappings":";;;;AAIA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA,oCAAmF,SAAAE,QAAAC,MAAA,EAAAC,cAAA,OAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,MAAAG,MAAA,CAAAC,qBAAA,OAAAC,OAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAJ,MAAA,EAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,UAAAJ,MAAA,CAAAK,wBAAA,CAAAR,MAAA,EAAAO,GAAA,EAAAE,UAAA,MAAAP,IAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,IAAA,EAAAG,OAAA,UAAAH,IAAA,WAAAU,cAAAC,MAAA,YAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,SAAAG,MAAA,WAAAF,SA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K,EAAEP,WAAW,CAACC,OAAO,CAAC;QAC3BiC,IAAI,EAAEC,KAAK,CAACC,OAAO,CAACjB,GAAG,CAAC,GAAGA,GAAG,GAAG,CAACA,GAAG;MACvC,CAAC,CAAC;EACJ;AACF,CAACkB,OAAA,CAAAzC,OAAA,GAAAmB,SAAA"}
1
+ {"version":3,"file":"index.js","names":["_httpRequest","_interopRequireDefault","require","_httpMethods","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","createQuery","options","level","pretty","timings","atomic","transaction","query","entries","reduce","acc","entry","_entry","_slicedToArray2","key","val","ApiClient","HttpRequest","get","path","sql","_superprop_getGet","_this","_asyncToGenerator2","useLeader","Error","call","uri","httpMethod","HTTP_METHOD_GET","q","post","_superprop_getPost","_this2","HTTP_METHOD_POST","body","Array","isArray","exports"],"sources":["../../../es6/api/client/index.js"],"sourcesContent":["/**\n * Base API client for RQLite which abstracts the HTTP calls\n * @module api/client\n */\nimport HttpRequest from '../../http-request'\nimport { HTTP_METHOD_GET, HTTP_METHOD_POST } from '../../http-request/http-methods'\n\n/**\n * @typedef HttpRequestOptions\n * @type {import('../../http-request').HttpRequestOptions}\n */\n\n/**\n * Create the base HTTP query options from RQLite API options\n * @param {Object} [options={}] The RQLite API options\n * @param {String} [options.level] The consistency level\n * @param {String} [options.pretty] Pretty print the response body\n * @param {String} [options.timings] Provide query timings\n * @param {String} [options.atomic] Treat all commands in the request as a single transaction\n * for RQLite v5 and higher\n * @param {String} [options.transaction] Treat all commands in the request as a single transaction\n * for RQLite v4 and lower\n * @returns {Object} The HTTP query\n */\nexport function createQuery (options = {}) {\n const { level, pretty, timings, atomic, transaction } = options\n\n // Remove all undefined values\n const query = { level, pretty, timings, atomic, transaction }\n return Object.entries(query).reduce((acc, entry) => {\n const [key, val] = entry\n // Only take defined values\n if (typeof val !== 'undefined') {\n acc[key] = val\n }\n return acc\n }, {})\n}\n\n/**\n * Base API client for RQLite which abstracts the HTTP calls\n * from the user\n */\nexport default class ApiClient extends HttpRequest {\n /**\n * Perform a RQLite data API get request\n * @param {String} path The path for the request i.e. /db/query\n * @param {String} sql The SQL query\n * @param {HttpRequestOptions} [options={}] RQLite API options\n */\n async get (path, sql, options = {}) {\n const { useLeader } = options\n if (!path) {\n throw new Error('The path argument is required')\n }\n return super.get({\n useLeader,\n uri: path,\n httpMethod: HTTP_METHOD_GET,\n query: { ...createQuery(options), q: sql },\n })\n }\n\n /**\n * Perform a RQLite data API post request\n * @param {String} path The path for the request i.e. /db/query\n * @param {String} sql The SQL query\n * @param {HttpRequestOptions} [options={}] RQLite API options\n */\n async post (path, sql, options = {}) {\n const { useLeader } = options\n if (!path) {\n throw new Error('The path argument is required')\n }\n return super.post({\n useLeader,\n uri: path,\n httpMethod: HTTP_METHOD_POST,\n query: createQuery(options),\n body: Array.isArray(sql) ? sql : [sql],\n })\n }\n}\n"],"mappings":";;;;AAIA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA,oCAAmF,SAAAE,QAAAC,CAAA,EAAAC,CAAA,OAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,MAAAG,MAAA,CAAAE,qBAAA,OAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,EAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,UAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAAAQ,UAAA,MAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,CAAA,UAAAJ,CAAA,WAAAU,cAAAZ,CAAA,YAAAC,CAAA,MAAAA,CAAA,GAAAY,SAAA,CAAAC,MAAA,EAAAb,CAAA,SAAAC,CAAA,WAAAW,SAAA,CAAAZ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,CAACC,OAAO,CAAC;QAC3BkC,IAAI,EAAEC,KAAK,CAACC,OAAO,CAACjB,GAAG,CAAC,GAAGA,GAAG,GAAG,CAACA,GAAG;MACvC,CAAC,CAAC;EACJ;AACF,CAACkB,OAAA,CAAA1C,OAAA,GAAAoB,SAAA","ignoreList":[]}
@@ -1,38 +1,44 @@
1
- "use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports, "__esModule", { value: true });exports.default = exports.PATH_QUERY = exports.PATH_EXECUTE = exports.CONSISTENCY_LEVEL_WEAK = exports.CONSISTENCY_LEVEL_STRONG = exports.CONSISTENCY_LEVEL_NONE = void 0;var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
1
+ "use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports, "__esModule", { value: true });exports.default = exports.PATH_QUERY = exports.PATH_EXECUTE = exports.CONSISTENCY_LEVEL_WEAK = exports.CONSISTENCY_LEVEL_STRONG = exports.CONSISTENCY_LEVEL_NONE = exports.CONSISTENCY_LEVEL_LINEARIZABLE = void 0;var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
2
2
 
3
3
 
4
4
 
5
5
 
6
6
  var _client = _interopRequireDefault(require("../client"));
7
- var _results = require("../results");function ownKeys(object, enumerableOnly) {var keys = Object.keys(object);if (Object.getOwnPropertySymbols) {var symbols = Object.getOwnPropertySymbols(object);enumerableOnly && (symbols = symbols.filter(function (sym) {return Object.getOwnPropertyDescriptor(object, sym).enumerable;})), keys.push.apply(keys, symbols);}return keys;}function _objectSpread(target) {for (var i = 1; i < arguments.length; i++) {var source = null != arguments[i] ? arguments[i] : {};i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {(0, _defineProperty2.default)(target, key, source[key]);}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));});}return target;} /**
7
+ var _results = require("../results");function ownKeys(e, r) {var t = Object.keys(e);if (Object.getOwnPropertySymbols) {var o = Object.getOwnPropertySymbols(e);r && (o = o.filter(function (r) {return Object.getOwnPropertyDescriptor(e, r).enumerable;})), t.push.apply(t, o);}return t;}function _objectSpread(e) {for (var r = 1; r < arguments.length; r++) {var t = null != arguments[r] ? arguments[r] : {};r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {(0, _defineProperty2.default)(e, r, t[r]);}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));});}return e;} /**
8
8
  * Data api client to perform RQLite data operations such
9
9
  * as query and execute
10
10
  * @module api/data
11
11
  */ /**
12
12
  * The RQLite query api path
13
- */const PATH_QUERY = '/db/query';
13
+ */const PATH_QUERY = exports.PATH_QUERY = '/db/query';
14
14
  /**
15
15
  * The RQLite execute api path
16
- */exports.PATH_QUERY = PATH_QUERY;
17
- const PATH_EXECUTE = '/db/execute';
16
+ */
17
+ const PATH_EXECUTE = exports.PATH_EXECUTE = '/db/execute';
18
18
 
19
19
  /**
20
20
  * Read query consistency level none which means
21
21
  * any node can respond
22
- */exports.PATH_EXECUTE = PATH_EXECUTE;
23
- const CONSISTENCY_LEVEL_NONE = 'none';
22
+ */
23
+ const CONSISTENCY_LEVEL_NONE = exports.CONSISTENCY_LEVEL_NONE = 'none';
24
24
 
25
25
  /**
26
26
  * Read query consistency strong which must come from
27
27
  * the master node
28
- */exports.CONSISTENCY_LEVEL_NONE = CONSISTENCY_LEVEL_NONE;
29
- const CONSISTENCY_LEVEL_STRONG = 'strong';
28
+ */
29
+ const CONSISTENCY_LEVEL_STRONG = exports.CONSISTENCY_LEVEL_STRONG = 'strong';
30
+
31
+ /**
32
+ * Read query consistency linearizable which must come from
33
+ * the master node
34
+ */
35
+ const CONSISTENCY_LEVEL_LINEARIZABLE = exports.CONSISTENCY_LEVEL_LINEARIZABLE = 'linearizable';
30
36
 
31
37
  /**
32
38
  * Read query consistency weak which must come from
33
39
  * the master node
34
- */exports.CONSISTENCY_LEVEL_STRONG = CONSISTENCY_LEVEL_STRONG;
35
- const CONSISTENCY_LEVEL_WEAK = 'weak';
40
+ */
41
+ const CONSISTENCY_LEVEL_WEAK = exports.CONSISTENCY_LEVEL_WEAK = 'weak';
36
42
 
37
43
  /**
38
44
  * @typedef HttpRequestOptions
@@ -70,7 +76,7 @@ const CONSISTENCY_LEVEL_WEAK = 'weak';
70
76
  * Send an RQLite query API request to the RQLite server
71
77
  * @param {String} sql The SQL string to excute on the server
72
78
  * @param {DataRequestBaseOptions} [options={}] RQLite api options
73
- */exports.CONSISTENCY_LEVEL_WEAK = CONSISTENCY_LEVEL_WEAK;
79
+ */
74
80
  function handleResponse(response, options = {}) {
75
81
  const raw = options.raw;
76
82
  const body = response.body;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_client","_interopRequireDefault","require","_results","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","PATH_QUERY","exports","PATH_EXECUTE","CONSISTENCY_LEVEL_NONE","CONSISTENCY_LEVEL_STRONG","CONSISTENCY_LEVEL_WEAK","handleResponse","response","options","raw","body","DataResults","DataApiClient","ApiClient","query","sql","_superprop_getPost","post","_superprop_getGet","get","_this","_asyncToGenerator2","level","useLeader","Array","isArray","call","setNextActiveHostIndex","execute","_superprop_getPost2","_this2"],"sources":["../../../es6/api/data/index.js"],"sourcesContent":["/**\n * Data api client to perform RQLite data operations such\n * as query and execute\n * @module api/data\n */\nimport ApiClient from '../client'\nimport { DataResults } from '../results'\n\n/**\n * The RQLite query api path\n */\nexport const PATH_QUERY = '/db/query'\n\n/**\n * The RQLite execute api path\n */\nexport const PATH_EXECUTE = '/db/execute'\n\n/**\n * Read query consistency level none which means\n * any node can respond\n */\nexport const CONSISTENCY_LEVEL_NONE = 'none'\n\n/**\n * Read query consistency strong which must come from\n * the master node\n */\nexport const CONSISTENCY_LEVEL_STRONG = 'strong'\n\n/**\n * Read query consistency weak which must come from\n * the master node\n */\nexport const CONSISTENCY_LEVEL_WEAK = 'weak'\n\n/**\n * @typedef HttpRequestOptions\n * @type {import('../../http-request').HttpRequestOptions}\n */\n\n/**\n * Data request base options\n * @typedef DataRequestBaseOptions\n * @type {Object}\n * @property {Boolean} [raw] If true return the raw http response from\n * RQLite response\n */\n\n/**\n * Data query request base options\n * @typedef QueryRequestBaseOptions\n * @type {Object}\n * @property {String} level The api consistency level\n */\n\n/**\n * Data query request options\n * @typedef QueryRequestOptions\n * @type {HttpRequestOptions & DataRequestBaseOptions & QueryRequestBaseOptions}\n */\n\n/**\n * Data execute request options\n * @typedef ExecuteRequestOptions\n * @type {HttpRequestOptions & DataRequestBaseOptions}\n */\n\n/**\n * Send an RQLite query API request to the RQLite server\n * @param {String} sql The SQL string to excute on the server\n * @param {DataRequestBaseOptions} [options={}] RQLite api options\n */\nfunction handleResponse (response, options = {}) {\n const { raw } = options\n const { body } = response\n if (raw) {\n return response\n }\n return new DataResults(body)\n}\n\n/**\n * Data api client to perform RQLite queries\n */\nexport default class DataApiClient extends ApiClient {\n /**\n * Send an RQLite query API request to the RQLite server\n * @param {String} sql The SQL string to excute on the server\n * @param {QueryRequestOptions} [options={}] RQLite api options\n */\n async query (sql, options = {}) {\n const { level } = options\n let { useLeader } = options\n // Weak and strong consistency will be redirect to the master anyway\n // so skip the redirect HTTP response and got right to the master\n if (level !== CONSISTENCY_LEVEL_NONE) {\n useLeader = true\n }\n let response\n if (Array.isArray(sql)) {\n response = await super.post(PATH_QUERY, sql, { ...options, useLeader })\n } else {\n response = await super.get(PATH_QUERY, sql, { ...options, useLeader })\n }\n // If round robin is true try and balance selects across hosts when\n // the master node is not queried directly\n if (!useLeader) {\n this.setNextActiveHostIndex()\n }\n return handleResponse(response, options)\n }\n\n /**\n * Send an RQLite execute API request to the RQLite server\n * @param {String} sql The SQL string to excute on the server\n * @param {ExecuteRequestOptions} [options={}] RQLite execute api options\n */\n async execute (sql, options = {}) {\n const response = await super.post(PATH_EXECUTE, sql, options)\n return handleResponse(response, options)\n }\n}\n"],"mappings":";;;;;AAKA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA,eAAwC,SAAAE,QAAAC,MAAA,EAAAC,cAAA,OAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,MAAAG,MAAA,CAAAC,qBAAA,OAAAC,OAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAJ,MAAA,EAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,UAAAJ,MAAA,CAAAK,wBAAA,CAAAR,MAAA,EAAAO,GAAA,EAAAE,UAAA,MAAAP,IAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,IAAA,EAAAG,OAAA,UAAAH,IAAA,WAAAU,cAAAC,MAAA,YAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,SAAAG,MAAA,WAAAF,SAAA,CAAAD,CAAA,IAAAC,SAAA,CAAAD,CAAA,OAAAA,CAAA,OAAAf,OAAA,CAAAI,MAAA,CAAAc,MAAA,OAAAC,OAAA,WAAAC,GAAA,OAAAC,gBAAA,CAAAC,OAAA,EAAAR,MAAA,EAAAM,GAAA,EAAAF,MAAA,CAAAE,GAAA,QAAAhB,MAAA,CAAAmB,yBAAA,GAAAnB,MAAA,CAAAoB,gBAAA,CAAAV,MA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,CAACC,QAAQ,EAAEC,OAAO,CAAC;EAC1C;AACF,CAACP,OAAA,CAAAL,OAAA,GAAAgB,aAAA"}
1
+ {"version":3,"file":"index.js","names":["_client","_interopRequireDefault","require","_results","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","PATH_QUERY","exports","PATH_EXECUTE","CONSISTENCY_LEVEL_NONE","CONSISTENCY_LEVEL_STRONG","CONSISTENCY_LEVEL_LINEARIZABLE","CONSISTENCY_LEVEL_WEAK","handleResponse","response","options","raw","body","DataResults","DataApiClient","ApiClient","query","sql","_superprop_getPost","post","_superprop_getGet","get","_this","_asyncToGenerator2","level","useLeader","Array","isArray","call","setNextActiveHostIndex","execute","_superprop_getPost2","_this2"],"sources":["../../../es6/api/data/index.js"],"sourcesContent":["/**\n * Data api client to perform RQLite data operations such\n * as query and execute\n * @module api/data\n */\nimport ApiClient from '../client'\nimport { DataResults } from '../results'\n\n/**\n * The RQLite query api path\n */\nexport const PATH_QUERY = '/db/query'\n\n/**\n * The RQLite execute api path\n */\nexport const PATH_EXECUTE = '/db/execute'\n\n/**\n * Read query consistency level none which means\n * any node can respond\n */\nexport const CONSISTENCY_LEVEL_NONE = 'none'\n\n/**\n * Read query consistency strong which must come from\n * the master node\n */\nexport const CONSISTENCY_LEVEL_STRONG = 'strong'\n\n/**\n * Read query consistency linearizable which must come from\n * the master node\n */\nexport const CONSISTENCY_LEVEL_LINEARIZABLE = 'linearizable'\n\n/**\n * Read query consistency weak which must come from\n * the master node\n */\nexport const CONSISTENCY_LEVEL_WEAK = 'weak'\n\n/**\n * @typedef HttpRequestOptions\n * @type {import('../../http-request').HttpRequestOptions}\n */\n\n/**\n * Data request base options\n * @typedef DataRequestBaseOptions\n * @type {Object}\n * @property {Boolean} [raw] If true return the raw http response from\n * RQLite response\n */\n\n/**\n * Data query request base options\n * @typedef QueryRequestBaseOptions\n * @type {Object}\n * @property {String} level The api consistency level\n */\n\n/**\n * Data query request options\n * @typedef QueryRequestOptions\n * @type {HttpRequestOptions & DataRequestBaseOptions & QueryRequestBaseOptions}\n */\n\n/**\n * Data execute request options\n * @typedef ExecuteRequestOptions\n * @type {HttpRequestOptions & DataRequestBaseOptions}\n */\n\n/**\n * Send an RQLite query API request to the RQLite server\n * @param {String} sql The SQL string to excute on the server\n * @param {DataRequestBaseOptions} [options={}] RQLite api options\n */\nfunction handleResponse (response, options = {}) {\n const { raw } = options\n const { body } = response\n if (raw) {\n return response\n }\n return new DataResults(body)\n}\n\n/**\n * Data api client to perform RQLite queries\n */\nexport default class DataApiClient extends ApiClient {\n /**\n * Send an RQLite query API request to the RQLite server\n * @param {String} sql The SQL string to excute on the server\n * @param {QueryRequestOptions} [options={}] RQLite api options\n */\n async query (sql, options = {}) {\n const { level } = options\n let { useLeader } = options\n // Weak and strong consistency will be redirect to the master anyway\n // so skip the redirect HTTP response and got right to the master\n if (level !== CONSISTENCY_LEVEL_NONE) {\n useLeader = true\n }\n let response\n if (Array.isArray(sql)) {\n response = await super.post(PATH_QUERY, sql, { ...options, useLeader })\n } else {\n response = await super.get(PATH_QUERY, sql, { ...options, useLeader })\n }\n // If round robin is true try and balance selects across hosts when\n // the master node is not queried directly\n if (!useLeader) {\n this.setNextActiveHostIndex()\n }\n return handleResponse(response, options)\n }\n\n /**\n * Send an RQLite execute API request to the RQLite server\n * @param {String} sql The SQL string to excute on the server\n * @param {ExecuteRequestOptions} [options={}] RQLite execute api options\n */\n async execute (sql, options = {}) {\n const response = await super.post(PATH_EXECUTE, sql, options)\n return handleResponse(response, options)\n }\n}\n"],"mappings":";;;;;AAKA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA,eAAwC,SAAAE,QAAAC,CAAA,EAAAC,CAAA,OAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAA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,EAAAzB,aAAA,CAAAA,aAAA,KAAOkB,OAAO,SAAEe,SAAS,GAAE,CAAC;MACzE,CAAC,MAAM;QACLhB,QAAQ,SAASW,iBAAA,GAAAQ,IAAA,CAAAN,KAAA,EAAUrB,UAAU,EAAEgB,GAAG,EAAAzB,aAAA,CAAAA,aAAA,KAAOkB,OAAO,SAAEe,SAAS,GAAE,CAAC;MACxE;MACA;MACA;MACA,IAAI,CAACA,SAAS,EAAE;QACdH,KAAI,CAACO,sBAAsB,CAAC,CAAC;MAC/B;MACA,OAAOrB,cAAc,CAACC,QAAQ,EAAEC,OAAO,CAAC;EAC1C;;EAEA;AACF;AACA;AACA;AACA;EACQoB,OAAOA,CAAEb,GAAG,EAAEP,OAAO,GAAG,CAAC,CAAC,EAAE,KAAAqB,mBAAA,GAAAA,CAAA,WAAAZ,IAAA,CAAAa,MAAA,mBAAAT,kBAAA,CAAA1B,OAAA;MAChC,MAAMY,QAAQ,SAASsB,mBAAA,GAAAH,IAAA,CAAAI,MAAA,EAAW7B,YAAY,EAAEc,GAAG,EAAEP,OAAO,CAAC;MAC7D,OAAOF,cAAc,CAACC,QAAQ,EAAEC,OAAO,CAAC;EAC1C;AACF,CAACR,OAAA,CAAAL,OAAA,GAAAiB,aAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"data-result-error.js","names":["DataResultError","Error","constructor","args","name","code","toObject","error","message","toString","JSON","stringify","exports","default","module"],"sources":["../../../es6/api/results/data-result-error.js"],"sourcesContent":["/**\n * Class for handling RQLite data api result error\n * @module api/results/data-results\n */\n\n/**\n * A class that represents one data error result from an RQLite query or execute\n * API call\n */\nexport default class DataResultError extends Error {\n constructor (...args) {\n super(...args)\n this.name = this.constructor.name\n this.code = this.constructor.name\n }\n\n /**\n * Get the result data error as plain object\n * @returns {Object} The data as an object\n */\n toObject () {\n return { error: this.message }\n }\n\n /**\n * Convert the result data error to a JSON string\n * @returns {String} The JSON string for the data object\n */\n toString () {\n return JSON.stringify(this.toObject())\n }\n}\n"],"mappings":"qGAAA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACe,MAAMA,eAAe,SAASC,KAAK,CAAC;EACjDC,WAAWA,CAAE,GAAGC,IAAI,EAAE;IACpB,KAAK,CAAC,GAAGA,IAAI,CAAC;IACd,IAAI,CAACC,IAAI,GAAG,IAAI,CAACF,WAAW,CAACE,IAAI;IACjC,IAAI,CAACC,IAAI,GAAG,IAAI,CAACH,WAAW,CAACE,IAAI;EACnC;;EAEA;AACF;AACA;AACA;EACEE,QAAQA,CAAA,EAAI;IACV,OAAO,EAAEC,KAAK,EAAE,IAAI,CAACC,OAAO,CAAC,CAAC;EAChC;;EAEA;AACF;AACA;AACA;EACEC,QAAQA,CAAA,EAAI;IACV,OAAOC,IAAI,CAACC,SAAS,CAAC,IAAI,CAACL,QAAQ,CAAC,CAAC,CAAC;EACxC;AACF,CAACM,OAAA,CAAAC,OAAA,GAAAb,eAAA,CAAAc,MAAA,CAAAF,OAAA,GAAAA,OAAA,CAAAC,OAAA"}
1
+ {"version":3,"file":"data-result-error.js","names":["DataResultError","Error","constructor","args","name","code","toObject","error","message","toString","JSON","stringify","exports","default","module"],"sources":["../../../es6/api/results/data-result-error.js"],"sourcesContent":["/**\n * Class for handling RQLite data api result error\n * @module api/results/data-results\n */\n\n/**\n * A class that represents one data error result from an RQLite query or execute\n * API call\n */\nexport default class DataResultError extends Error {\n constructor (...args) {\n super(...args)\n this.name = this.constructor.name\n this.code = this.constructor.name\n }\n\n /**\n * Get the result data error as plain object\n * @returns {Object} The data as an object\n */\n toObject () {\n return { error: this.message }\n }\n\n /**\n * Convert the result data error to a JSON string\n * @returns {String} The JSON string for the data object\n */\n toString () {\n return JSON.stringify(this.toObject())\n }\n}\n"],"mappings":"qGAAA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACe,MAAMA,eAAe,SAASC,KAAK,CAAC;EACjDC,WAAWA,CAAE,GAAGC,IAAI,EAAE;IACpB,KAAK,CAAC,GAAGA,IAAI,CAAC;IACd,IAAI,CAACC,IAAI,GAAG,IAAI,CAACF,WAAW,CAACE,IAAI;IACjC,IAAI,CAACC,IAAI,GAAG,IAAI,CAACH,WAAW,CAACE,IAAI;EACnC;;EAEA;AACF;AACA;AACA;EACEE,QAAQA,CAAA,EAAI;IACV,OAAO,EAAEC,KAAK,EAAE,IAAI,CAACC,OAAO,CAAC,CAAC;EAChC;;EAEA;AACF;AACA;AACA;EACEC,QAAQA,CAAA,EAAI;IACV,OAAOC,IAAI,CAACC,SAAS,CAAC,IAAI,CAACL,QAAQ,CAAC,CAAC,CAAC;EACxC;AACF,CAACM,OAAA,CAAAC,OAAA,GAAAb,eAAA,CAAAc,MAAA,CAAAF,OAAA,GAAAA,OAAA,CAAAC,OAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"data-result.js","names":["DataResult","constructor","result","valuesIndex","_defineProperty2","default","Error","Number","isFinite","time","parseFloat","rowsAffected","parseInt","rows_affected","lastInsertId","last_insert_id","columns","resultValues","values","data","reduce","acc","val","i","col","get","property","getTime","getLastInsertId","getRowsAffected","toObject","JSON","parse","stringify","toArray","Object","toColumnsArray","keys","toString","exports","module"],"sources":["../../../es6/api/results/data-result.js"],"sourcesContent":["/**\n * Class for handling single RQLite data api result\n * @module api/results/data-result\n */\n\n/**\n * A class that represents one data result from an RQLite query or execute\n * API call\n */\nexport default class DataResult {\n /**\n * The time the results query took to complete\n * @type {Number}\n */\n time = 0.0\n\n /**\n * The last insert id\n * @type {Number}\n */\n lastInsertId\n\n /**\n * The rows affected\n * @type {Number}\n */\n rowsAffected = 0\n\n /**\n * An array of DataResult and/or DataResultError instances\n * @type {Array<DataResult|DataResultError>}\n */\n results = []\n\n /**\n * An object after the columns and values are mapped from\n * an RQLite response\n */\n data = {}\n\n /**\n * The data result constructor\n * @param {Array} result An API response individual result\n * @param {Array} [valuesIndex] The index to get the values from the result\n */\n constructor (result, valuesIndex) {\n if (typeof result !== 'object') {\n throw new Error('The result argument is required to be an object')\n }\n if (typeof valuesIndex !== 'undefined' && !Number.isFinite(valuesIndex)) {\n throw new Error('The valuesIndex argument is required to be a finite number when provided')\n }\n this.time = parseFloat(result.time || 0.0)\n this.rowsAffected = parseInt(result.rows_affected || 0, 10)\n this.lastInsertId = result.last_insert_id\n // Map the values array to an object where columns are the properties\n if (Number.isFinite(valuesIndex)) {\n const { columns } = result\n const resultValues = result.values[valuesIndex]\n if (resultValues) {\n this.data = resultValues.reduce((acc, val, i) => {\n const col = columns[i]\n acc[col] = val\n return acc\n }, {})\n }\n }\n }\n\n /**\n * Return the value a property or undefined if it does not exist\n * @returns {*} The value of the property or undefined\n */\n get (property) {\n return this.data[property]\n }\n\n /**\n * Get the time the result took\n * @returns {Number} The time the query took\n */\n getTime () {\n return this.time\n }\n\n /**\n * Get the last insert id\n * @returns {Number|undefined}\n */\n getLastInsertId () {\n return this.lastInsertId\n }\n\n /**\n * Get the row affected\n * @returns {Number|undefined}\n */\n getRowsAffected () {\n return this.rowsAffected\n }\n\n /**\n * Get the result data as plain object\n * @returns {Object} The data as an object\n */\n toObject () {\n // Clone deep\n return JSON.parse(JSON.stringify(this.data))\n }\n\n /**\n * Map the data values to an array\n * @returns {Array}\n */\n toArray () {\n return Object.values(this.data)\n }\n\n /**\n * Map the data properites to an array\n * @returns {String[]}\n */\n toColumnsArray () {\n return Object.keys(this.data)\n }\n\n /**\n * Convert the result data to a JSON string\n * @returns {String} The JSON string for the data object\n */\n toString () {\n return JSON.stringify(this.data)\n }\n}\n"],"mappings":"0RAAA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACe,MAAMA,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+B9B;AACF;AACA;AACA;AACA;EACEC,WAAWA,CAAEC,MAAM,EAAEC,WAAW,EAAE,CAnClC;AACF;AACA;AACA,OAHE,IAAAC,gBAAA,CAAAC,OAAA,gBAIO,GAAG,GAEV;AACF;AACA;AACA,OAHE,IAAAD,gBA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,IAAI,CAACO,QAAQ,CAAC;EAC5B;;EAEA;AACF;AACA;AACA;EACEC,OAAOA,CAAA,EAAI;IACT,OAAO,IAAI,CAAClB,IAAI;EAClB;;EAEA;AACF;AACA;AACA;EACEmB,eAAeA,CAAA,EAAI;IACjB,OAAO,IAAI,CAACd,YAAY;EAC1B;;EAEA;AACF;AACA;AACA;EACEe,eAAeA,CAAA,EAAI;IACjB,OAAO,IAAI,CAAClB,YAAY;EAC1B;;EAEA;AACF;AACA;AACA;EACEmB,QAAQA,CAAA,EAAI;IACV;IACA,OAAOC,IAAI,CAACC,KAAK,CAACD,IAAI,CAACE,SAAS,CAAC,IAAI,CAACd,IAAI,CAAC,CAAC;EAC9C;;EAEA;AACF;AACA;AACA;EACEe,OAAOA,CAAA,EAAI;IACT,OAAOC,MAAM,CAACjB,MAAM,CAAC,IAAI,CAACC,IAAI,CAAC;EACjC;;EAEA;AACF;AACA;AACA;EACEiB,cAAcA,CAAA,EAAI;IAChB,OAAOD,MAAM,CAACE,IAAI,CAAC,IAAI,CAAClB,IAAI,CAAC;EAC/B;;EAEA;AACF;AACA;AACA;EACEmB,QAAQA,CAAA,EAAI;IACV,OAAOP,IAAI,CAACE,SAAS,CAAC,IAAI,CAACd,IAAI,CAAC;EAClC;AACF,CAACoB,OAAA,CAAAlC,OAAA,GAAAL,UAAA,CAAAwC,MAAA,CAAAD,OAAA,GAAAA,OAAA,CAAAlC,OAAA"}
1
+ {"version":3,"file":"data-result.js","names":["DataResult","constructor","result","valuesIndex","_defineProperty2","default","Error","Number","isFinite","time","parseFloat","rowsAffected","parseInt","rows_affected","lastInsertId","last_insert_id","columns","resultValues","values","data","reduce","acc","val","i","col","get","property","getTime","getLastInsertId","getRowsAffected","toObject","JSON","parse","stringify","toArray","Object","toColumnsArray","keys","toString","exports","module"],"sources":["../../../es6/api/results/data-result.js"],"sourcesContent":["/**\n * Class for handling single RQLite data api result\n * @module api/results/data-result\n */\n\n/**\n * A class that represents one data result from an RQLite query or execute\n * API call\n */\nexport default class DataResult {\n /**\n * The time the results query took to complete\n * @type {Number}\n */\n time = 0.0\n\n /**\n * The last insert id\n * @type {Number}\n */\n lastInsertId\n\n /**\n * The rows affected\n * @type {Number}\n */\n rowsAffected = 0\n\n /**\n * An array of DataResult and/or DataResultError instances\n * @type {Array<DataResult|DataResultError>}\n */\n results = []\n\n /**\n * An object after the columns and values are mapped from\n * an RQLite response\n */\n data = {}\n\n /**\n * The data result constructor\n * @param {Array} result An API response individual result\n * @param {Array} [valuesIndex] The index to get the values from the result\n */\n constructor (result, valuesIndex) {\n if (typeof result !== 'object') {\n throw new Error('The result argument is required to be an object')\n }\n if (typeof valuesIndex !== 'undefined' && !Number.isFinite(valuesIndex)) {\n throw new Error('The valuesIndex argument is required to be a finite number when provided')\n }\n this.time = parseFloat(result.time || 0.0)\n this.rowsAffected = parseInt(result.rows_affected || 0, 10)\n this.lastInsertId = result.last_insert_id\n // Map the values array to an object where columns are the properties\n if (Number.isFinite(valuesIndex)) {\n const { columns } = result\n const resultValues = result.values[valuesIndex]\n if (resultValues) {\n this.data = resultValues.reduce((acc, val, i) => {\n const col = columns[i]\n acc[col] = val\n return acc\n }, {})\n }\n }\n }\n\n /**\n * Return the value a property or undefined if it does not exist\n * @returns {*} The value of the property or undefined\n */\n get (property) {\n return this.data[property]\n }\n\n /**\n * Get the time the result took\n * @returns {Number} The time the query took\n */\n getTime () {\n return this.time\n }\n\n /**\n * Get the last insert id\n * @returns {Number|undefined}\n */\n getLastInsertId () {\n return this.lastInsertId\n }\n\n /**\n * Get the row affected\n * @returns {Number|undefined}\n */\n getRowsAffected () {\n return this.rowsAffected\n }\n\n /**\n * Get the result data as plain object\n * @returns {Object} The data as an object\n */\n toObject () {\n // Clone deep\n return JSON.parse(JSON.stringify(this.data))\n }\n\n /**\n * Map the data values to an array\n * @returns {Array}\n */\n toArray () {\n return Object.values(this.data)\n }\n\n /**\n * Map the data properites to an array\n * @returns {String[]}\n */\n toColumnsArray () {\n return Object.keys(this.data)\n }\n\n /**\n * Convert the result data to a JSON string\n * @returns {String} The JSON string for the data object\n */\n toString () {\n return JSON.stringify(this.data)\n }\n}\n"],"mappings":"0RAAA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACe,MAAMA,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+B9B;AACF;AACA;AACA;AACA;EACEC,WAAWA,CAAEC,MAAM,EAAEC,WAAW,EAAE,CAnClC;AACF;AACA;AACA,OAHE,IAAAC,gBAAA,CAAAC,OAAA,gBAIO,GAAG,GAEV;AACF;AACA;AACA,OAHE,IAAAD,gBAAA,CAAAC,OAAA,iCAMA;AACF;AACA;AACA,OAHE,IAAAD,gBAAA,CAAAC,OAAA,wBAIe,CAAC,GAEhB;AACF;AACA;AACA,OAHE,IAAAD,gBAAA,CAAAC,OAAA,mBAIU,EAAE,GAEZ;AACF;AACA;AACA,OAHE,IAAAD,gBAAA,CAAAC,OAAA,gBAIO,CAAC,CAAC,EAQP,IAAI,OAAOH,MAAM,KAAK,QAAQ,EAAE,CAC9B,MAAM,IAAII,KAAK,CAAC,iDAAiD,CAAC,CACpE,CACA,IAAI,OAAOH,WAAW,KAAK,WAAW,IAAI,CAACI,MAAM,CAACC,QAAQ,CAACL,WAAW,CAAC,EAAE,CACvE,MAAM,IAAIG,KAAK,CAAC,0EAA0E,CAAC,CAC7F,CACA,IAAI,CAACG,IAAI,GAAGC,UAAU,CAACR,MAAM,CAACO,IAAI,IAAI,GAAG,CAAC,CAC1C,IAAI,CAACE,YAAY,GAAGC,QAAQ,CAACV,MAAM,CAACW,aAAa,IAAI,CAAC,EAAE,EAAE,CAAC,CAC3D,IAAI,CAACC,YAAY,GAAGZ,MAAM,CAACa,cAAc,EACzC;IACA,IAAIR,MAAM,CAACC,QAAQ,CAACL,WAAW,CAAC,EAAE,CAChC,MAAQa,OAAO,GAAKd,MAAM,CAAlBc,OAAO,CACf,MAAMC,YAAY,GAAGf,MAAM,CAACgB,MAAM,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AAAD,OAAA,GAAAA,OAAA,CAAAlC,OAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"data-results.js","names":["_dataResult","_interopRequireDefault","require","_dataResultError","DataResults","constructor","data","_defineProperty2","default","setApiData","Error","results","time","parseFloat","_data$results","reduce","acc","result","error","concat","DataResultError","vals","values","DataResult","dataResults","map","_v","valuesIndex","hasError","getFirstError","find","v","getTime","get","index","getResults","toArray","toObject","toString","list","JSON","stringify","exports","module"],"sources":["../../../es6/api/results/data-results.js"],"sourcesContent":["/**\n * Class for handling many RQLite data api results\n * @module api/results/data-results\n */\nimport DataResult from './data-result'\nimport DataResultError from './data-result-error'\n\n/**\n * A class to manage a list of results from an RQLite query or execute API response\n */\nexport default class DataResults {\n /**\n * The time the results took to return from the\n * RQLite api\n * @type {Number}\n */\n time = 0.0\n\n /**\n * The results which is an empty arry to start\n * @type {DataResult[]}\n */\n results = []\n\n /**\n * The data result list constructor\n * @param {Object} data The data object sent from a RQLite API response\n * @param {Number} data.time The time the API response took to complete\n * @param {Object[{error:String,values:Object}]} data.results The results array\n */\n constructor (data) {\n this.setApiData(data)\n }\n\n /**\n * Set the api as results\n * @param {Object} data Api data\n */\n setApiData (data) {\n if (typeof data !== 'object') {\n throw new Error('The data argument is required to be an object')\n }\n if (!data.results) {\n throw new Error('The data object is required to have a results property')\n }\n this.time = parseFloat(data.time || 0.0)\n const { results = [] } = data\n this.results = results.reduce((acc, result) => {\n // If there is an error property this is an error\n if (typeof result === 'object' && result.error) {\n return acc.concat(new DataResultError(result.error))\n }\n const { values: vals } = result\n // We don't have values so this is a single result row\n if (!vals) {\n return acc.concat(new DataResult(result))\n }\n // Map the values to DataResult instances\n const dataResults = vals.map((_v, valuesIndex) => new DataResult(result, valuesIndex))\n return acc.concat(dataResults)\n }, [])\n }\n\n /**\n * Returns true if an instance of DataResultError exists in the results\n * @returns {Boolean} True if a DataResultError instance exists\n */\n hasError () {\n return !!this.getFirstError()\n }\n\n /**\n * Get the first error that occured\n * @returns {DataResultError|undefined}\n */\n getFirstError () {\n return this.results.find((v) => v instanceof DataResultError)\n }\n\n /**\n * Get the time the results took\n * @returns {Number} The time the query took\n */\n getTime () {\n return this.time\n }\n\n /**\n * Return one result at a specific index or undefined it it does not exist\n * @returns {DataResult|DataResultError|undefined}\n */\n get (index) {\n return this.results[index]\n }\n\n /**\n * Return the results array\n * @returns {Array<DataResult|DataResultError>}\n */\n getResults () {\n return this.results\n }\n\n /**\n * Get the result data list as array of plain objects\n * @returns {Object[]} The data as an array or objects\n */\n toArray () {\n return this.results.map((result) => result.toObject())\n }\n\n /**\n * Convert the result data list to a JSON string that is an\n * array of objects\n * @returns {String} A JSON string\n */\n toString () {\n const list = this.results.map((result) => result.toObject())\n return JSON.stringify(list)\n }\n}\n"],"mappings":";;;;AAIA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAF,sBAAA,CAAAC,OAAA,yBAAiD,CALjD;AACA;AACA;AACA,GAHA,CAOA;AACA;AACA,GACe,MAAME,WAAW,CAAC;;;;;;;;;;;;;;EAc/B;AACF;AACA;AACA;AACA;AACA;EACEC,WAAWA,CAAEC,IAAI,EAAE,CAnBnB;AACF;AACA;AACA;AACA,OAJE,IAAAC,gBAAA,CAAAC,OAAA,gBAKO,GAAG,GAEV;AACF;AACA;AACA,OAHE,IAAAD,gBAAA,CAAAC,OAAA,mBAIU,EAAE,EASV,IAAI,CAACC,UAAU,CAACH,IAAI,CAAC,CACvB,CAAC,CAED;AACF;AACA;AACA,KACEG,UAAUA,CAAEH,IAAI,EAAE,CAChB,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE,CAC5B,MAAM,IAAII,KAAK,CAAC,+CAA+C,CAAC;IAClE;IACA,IAAI,CAACJ,IAAI,CAACK,OAAO,EAAE;MACjB,MAAM,IAAID,KAAK,CAAC,wDAAwD,CAAC;IAC3E;IACA,IAAI,CAACE,IAAI,GAAGC,UAAU,CAACP,IAAI,CAAC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ACA;AACA;EACEC,UAAUA,CAAA,EAAI;IACZ,OAAO,IAAI,CAACxB,OAAO;EACrB;;EAEA;AACF;AACA;AACA;EACEyB,OAAOA,CAAA,EAAI;IACT,OAAO,IAAI,CAACzB,OAAO,CAACc,GAAG,CAAC,CAACR,MAAM,KAAKA,MAAM,CAACoB,QAAQ,CAAC,CAAC,CAAC;EACxD;;EAEA;AACF;AACA;AACA;AACA;EACEC,QAAQA,CAAA,EAAI;IACV,MAAMC,IAAI,GAAG,IAAI,CAAC5B,OAAO,CAACc,GAAG,CAAC,CAACR,MAAM,KAAKA,MAAM,CAACoB,QAAQ,CAAC,CAAC,CAAC;IAC5D,OAAOG,IAAI,CAACC,SAAS,CAACF,IAAI,CAAC;EAC7B;AACF,CAACG,OAAA,CAAAlC,OAAA,GAAAJ,WAAA,CAAAuC,MAAA,CAAAD,OAAA,GAAAA,OAAA,CAAAlC,OAAA"}
1
+ {"version":3,"file":"data-results.js","names":["_dataResult","_interopRequireDefault","require","_dataResultError","DataResults","constructor","data","_defineProperty2","default","setApiData","Error","results","time","parseFloat","_data$results","reduce","acc","result","error","concat","DataResultError","vals","values","DataResult","dataResults","map","_v","valuesIndex","hasError","getFirstError","find","v","getTime","get","index","getResults","toArray","toObject","toString","list","JSON","stringify","exports","module"],"sources":["../../../es6/api/results/data-results.js"],"sourcesContent":["/**\n * Class for handling many RQLite data api results\n * @module api/results/data-results\n */\nimport DataResult from './data-result'\nimport DataResultError from './data-result-error'\n\n/**\n * A class to manage a list of results from an RQLite query or execute API response\n */\nexport default class DataResults {\n /**\n * The time the results took to return from the\n * RQLite api\n * @type {Number}\n */\n time = 0.0\n\n /**\n * The results which is an empty arry to start\n * @type {DataResult[]}\n */\n results = []\n\n /**\n * The data result list constructor\n * @param {Object} data The data object sent from a RQLite API response\n * @param {Number} data.time The time the API response took to complete\n * @param {Object[{error:String,values:Object}]} data.results The results array\n */\n constructor (data) {\n this.setApiData(data)\n }\n\n /**\n * Set the api as results\n * @param {Object} data Api data\n */\n setApiData (data) {\n if (typeof data !== 'object') {\n throw new Error('The data argument is required to be an object')\n }\n if (!data.results) {\n throw new Error('The data object is required to have a results property')\n }\n this.time = parseFloat(data.time || 0.0)\n const { results = [] } = data\n this.results = results.reduce((acc, result) => {\n // If there is an error property this is an error\n if (typeof result === 'object' && result.error) {\n return acc.concat(new DataResultError(result.error))\n }\n const { values: vals } = result\n // We don't have values so this is a single result row\n if (!vals) {\n return acc.concat(new DataResult(result))\n }\n // Map the values to DataResult instances\n const dataResults = vals.map((_v, valuesIndex) => new DataResult(result, valuesIndex))\n return acc.concat(dataResults)\n }, [])\n }\n\n /**\n * Returns true if an instance of DataResultError exists in the results\n * @returns {Boolean} True if a DataResultError instance exists\n */\n hasError () {\n return !!this.getFirstError()\n }\n\n /**\n * Get the first error that occured\n * @returns {DataResultError|undefined}\n */\n getFirstError () {\n return this.results.find((v) => v instanceof DataResultError)\n }\n\n /**\n * Get the time the results took\n * @returns {Number} The time the query took\n */\n getTime () {\n return this.time\n }\n\n /**\n * Return one result at a specific index or undefined it it does not exist\n * @returns {DataResult|DataResultError|undefined}\n */\n get (index) {\n return this.results[index]\n }\n\n /**\n * Return the results array\n * @returns {Array<DataResult|DataResultError>}\n */\n getResults () {\n return this.results\n }\n\n /**\n * Get the result data list as array of plain objects\n * @returns {Object[]} The data as an array or objects\n */\n toArray () {\n return this.results.map((result) => result.toObject())\n }\n\n /**\n * Convert the result data list to a JSON string that is an\n * array of objects\n * @returns {String} A JSON string\n */\n toString () {\n const list = this.results.map((result) => result.toObject())\n return JSON.stringify(list)\n }\n}\n"],"mappings":";;;;AAIA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAF,sBAAA,CAAAC,OAAA,yBAAiD,CALjD;AACA;AACA;AACA,GAHA,CAOA;AACA;AACA,GACe,MAAME,WAAW,CAAC;;;;;;;;;;;;;;EAc/B;AACF;AACA;AACA;AACA;AACA;EACEC,WAAWA,CAAEC,I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IAChC,CAAC,EAAE,EAAE,CAAC;EACR;;EAEA;AACF;AACA;AACA;EACEI,QAAQA,CAAA,EAAI;IACV,OAAO,CAAC,CAAC,IAAI,CAACC,aAAa,CAAC,CAAC;EAC/B;;EAEA;AACF;AACA;AACA;EACEA,aAAaA,CAAA,EAAI;IACf,OAAO,IAAI,CAAClB,OAAO,CAACmB,IAAI,CAAC,CAACC,CAAC,KAAKA,CAAC,YAAYX,wBAAe,CAAC;EAC/D;;EAEA;AACF;AACA;AACA;EACEY,OAAOA,CAAA,EAAI;IACT,OAAO,IAAI,CAACpB,IAAI;EAClB;;EAEA;AACF;AACA;AACA;EACEqB,GAAGA,CAAEC,KAAK,EAAE;IACV,OAAO,IAAI,CAACvB,OAAO,CAACuB,KAAK,CAAC;EAC5B;;EAEA;AACF;AACA;AACA;EACEC,UAAUA,CAAA,EAAI;IACZ,OAAO,IAAI,CAACxB,OAAO;EACrB;;EAEA;AACF;AACA;AACA;EACEyB,OAAOA,CAAA,EAAI;IACT,OAAO,IAAI,CAACzB,OAAO,CAACc,GAAG,CAAC,CAACR,MAAM,KAAKA,MAAM,CAACoB,QAAQ,CAAC,CAAC,CAAC;EACxD;;EAEA;AACF;AACA;AACA;AACA;EACEC,QAAQA,CAAA,EAAI;IACV,MAAMC,IAAI,GAAG,IAAI,CAAC5B,OAAO,CAACc,GAAG,CAAC,CAACR,MAAM,KAAKA,MAAM,CAACoB,QAAQ,CAAC,CAAC,CAAC;IAC5D,OAAOG,IAAI,CAACC,SAAS,CAACF,IAAI,CAAC;EAC7B;AACF,CAACG,OAAA,CAAAlC,OAAA,GAAAJ,WAAA,CAAAuC,MAAA,CAAAD,OAAA,GAAAA,OAAA,CAAAlC,OAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_dataResult","_interopRequireDefault","require","_dataResultError","_dataResults"],"sources":["../../../es6/api/results/index.js"],"sourcesContent":["/**\n * Features for handle RQLite data api responses for success and errors\n * @module api/results\n */\nexport { default as DataResult } from './data-result'\nexport { default as DataResultError } from './data-result-error'\nexport { default as DataResults } from './data-results'\n"],"mappings":";;;;AAIA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,YAAA,GAAAH,sBAAA,CAAAC,OAAA"}
1
+ {"version":3,"file":"index.js","names":["_dataResult","_interopRequireDefault","require","_dataResultError","_dataResults"],"sources":["../../../es6/api/results/index.js"],"sourcesContent":["/**\n * Features for handle RQLite data api responses for success and errors\n * @module api/results\n */\nexport { default as DataResult } from './data-result'\nexport { default as DataResultError } from './data-result-error'\nexport { default as DataResults } from './data-results'\n"],"mappings":";;;;AAIA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,YAAA,GAAAH,sBAAA,CAAAC,OAAA","ignoreList":[]}
@@ -2,7 +2,7 @@
2
2
 
3
3
 
4
4
 
5
- var _client = _interopRequireDefault(require("../client"));function ownKeys(object, enumerableOnly) {var keys = Object.keys(object);if (Object.getOwnPropertySymbols) {var symbols = Object.getOwnPropertySymbols(object);enumerableOnly && (symbols = symbols.filter(function (sym) {return Object.getOwnPropertyDescriptor(object, sym).enumerable;})), keys.push.apply(keys, symbols);}return keys;}function _objectSpread(target) {for (var i = 1; i < arguments.length; i++) {var source = null != arguments[i] ? arguments[i] : {};i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {(0, _defineProperty2.default)(target, key, source[key]);}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));});}return target;} /**
5
+ var _client = _interopRequireDefault(require("../client"));function ownKeys(e, r) {var t = Object.keys(e);if (Object.getOwnPropertySymbols) {var o = Object.getOwnPropertySymbols(e);r && (o = o.filter(function (r) {return Object.getOwnPropertyDescriptor(e, r).enumerable;})), t.push.apply(t, o);}return t;}function _objectSpread(e) {for (var r = 1; r < arguments.length; r++) {var t = null != arguments[r] ? arguments[r] : {};r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {(0, _defineProperty2.default)(e, r, t[r]);}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));});}return e;} /**
6
6
  * Status api client to perform RQLite status and diagnostics operations
7
7
  * @module api/status
8
8
  */ /**
@@ -19,11 +19,11 @@ var _client = _interopRequireDefault(require("../client"));function ownKeys(obje
19
19
  /**
20
20
  * The RQLite status api path
21
21
  */
22
- const PATH_STATUS = '/status';
22
+ const PATH_STATUS = exports.PATH_STATUS = '/status';
23
23
 
24
24
  /**
25
25
  * Data api client to perform RQLite queries
26
- */exports.PATH_STATUS = PATH_STATUS;
26
+ */
27
27
  class StatusApiClient extends _client.default {
28
28
  /**
29
29
  * Get the RQLite server status which defaults to the master host
@@ -45,7 +45,7 @@ class StatusApiClient extends _client.default {
45
45
  statusAllHosts(options = {}) {var _this2 = this;return (0, _asyncToGenerator2.default)(function* () {
46
46
  const hosts = _this2.getHosts();
47
47
  // Get the status for all of the hosts
48
- const promises = hosts.map( /*#__PURE__*/function () {var _ref = (0, _asyncToGenerator2.default)(function* (_host, activeHostIndex) {
48
+ const promises = hosts.map(/*#__PURE__*/function () {var _ref = (0, _asyncToGenerator2.default)(function* (_host, activeHostIndex) {
49
49
  const response = yield _this2.status(_objectSpread(_objectSpread({}, options), {}, { activeHostIndex }));
50
50
  return { response, host: hosts[activeHostIndex] };
51
51
  });return function (_x, _x2) {return _ref.apply(this, arguments);};}());
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_client","_interopRequireDefault","require","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","PATH_STATUS","exports","StatusApiClient","ApiClient","status","options","_superprop_getGet","get","_this","_asyncToGenerator2","call","useLeader","statusAllHosts","_this2","hosts","getHosts","promises","map","_ref","_host","activeHostIndex","response","host","_x","_x2","Promise","all"],"sources":["../../../es6/api/status/index.js"],"sourcesContent":["/**\n * Status api client to perform RQLite status and diagnostics operations\n * @module api/status\n */\nimport ApiClient from '../client'\n\n/**\n * @typedef {Object} HttpResponse\n * @property {Object} Body The HTTP response body parsed by JSON.parse()\n * @property {Number} statusCode The HTTP response code\n */\n\n/**\n * @typedef {Object} StatusAllHostsResponse\n * @property {HttpResponse} response An HTTP response\n * @property {String} host The host name\n */\n\n/**\n * The RQLite status api path\n */\nexport const PATH_STATUS = '/status'\n\n/**\n * Data api client to perform RQLite queries\n */\nexport default class StatusApiClient extends ApiClient {\n /**\n * Get the RQLite server status which defaults to the master host\n * @param {Object} [options={}] RQLite api options\n * @returns {HttpResponse} An HTTP response object\n */\n async status (options = {}) {\n return super.get(PATH_STATUS, { useLeader: true, ...options })\n }\n\n /**\n * Get the RQLite server status for all hosts as an array of object with\n * the host and their status\n * @param {Object} [options={}] RQLite api options\n * @param {Object} [options.raw] If true return the raw http response from\n * RQLite response\n * @returns {StatusAllHostsResponse[]} An array of http response for the provide hosts\n */\n async statusAllHosts (options = {}) {\n const hosts = this.getHosts()\n // Get the status for all of the hosts\n const promises = hosts.map(async (_host, activeHostIndex) => {\n const response = await this.status({ ...options, activeHostIndex })\n return { response, host: hosts[activeHostIndex] }\n })\n return Promise.all(promises)\n }\n}\n"],"mappings":";;;;AAIA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA,eAAiC,SAAAC,QAAAC,MAAA,EAAAC,cAAA,OAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,MAAAG,MAAA,CAAAC,qBAAA,OAAAC,OAA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AAC,kBAAA,CAAAb,OAAA;MAC1B,OAAOU,iBAAA,GAAAI,IAAA,CAAAF,KAAA,EAAUR,WAAW,EAAAb,aAAA,GAAIwB,SAAS,EAAE,IAAI,IAAKN,OAAO,CAAE,CAAC;EAChE;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACQO,cAAcA,CAAEP,OAAO,GAAG,CAAC,CAAC,EAAE,KAAAQ,MAAA,mBAAAJ,kBAAA,CAAAb,OAAA;MAClC,MAAMkB,KAAK,GAAGD,MAAI,CAACE,QAAQ,CAAC,CAAC;MAC7B;MACA,MAAMC,QAAQ,GAAGF,KAAK,CAACG,GAAG,gCAAAC,IAAA,OAAAT,kBAAA,CAAAb,OAAA,EAAC,WAAOuB,KAAK,EAAEC,eAAe,EAAK;UAC3D,MAAMC,QAAQ,SAASR,MAAI,CAACT,MAAM,CAAAjB,aAAA,CAAAA,aAAA,KAAMkB,OAAO,SAAEe,eAAe,GAAE,CAAC;UACnE,OAAO,EAAEC,QAAQ,EAAEC,IAAI,EAAER,KAAK,CAACM,eAAe,CAAC,CAAC,CAAC;QACnD,CAAC,mBAAAG,EAAA,EAAAC,GAAA,UAAAN,IAAA,CAAAhC,KAAA,OAAAI,SAAA,QAAC;MACF,OAAOmC,OAAO,CAACC,GAAG,CAACV,QAAQ,CAAC;EAC9B;AACF,CAACf,OAAA,CAAAL,OAAA,GAAAM,eAAA"}
1
+ {"version":3,"file":"index.js","names":["_client","_interopRequireDefault","require","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","PATH_STATUS","exports","StatusApiClient","ApiClient","status","options","_superprop_getGet","get","_this","_asyncToGenerator2","call","useLeader","statusAllHosts","_this2","hosts","getHosts","promises","map","_ref","_host","activeHostIndex","response","host","_x","_x2","Promise","all"],"sources":["../../../es6/api/status/index.js"],"sourcesContent":["/**\n * Status api client to perform RQLite status and diagnostics operations\n * @module api/status\n */\nimport ApiClient from '../client'\n\n/**\n * @typedef {Object} HttpResponse\n * @property {Object} Body The HTTP response body parsed by JSON.parse()\n * @property {Number} statusCode The HTTP response code\n */\n\n/**\n * @typedef {Object} StatusAllHostsResponse\n * @property {HttpResponse} response An HTTP response\n * @property {String} host The host name\n */\n\n/**\n * The RQLite status api path\n */\nexport const PATH_STATUS = '/status'\n\n/**\n * Data api client to perform RQLite queries\n */\nexport default class StatusApiClient extends ApiClient {\n /**\n * Get the RQLite server status which defaults to the master host\n * @param {Object} [options={}] RQLite api options\n * @returns {HttpResponse} An HTTP response object\n */\n async status (options = {}) {\n return super.get(PATH_STATUS, { useLeader: true, ...options })\n }\n\n /**\n * Get the RQLite server status for all hosts as an array of object with\n * the host and their status\n * @param {Object} [options={}] RQLite api options\n * @param {Object} [options.raw] If true return the raw http response from\n * RQLite response\n * @returns {StatusAllHostsResponse[]} An array of http response for the provide hosts\n */\n async statusAllHosts (options = {}) {\n const hosts = this.getHosts()\n // Get the status for all of the hosts\n const promises = hosts.map(async (_host, activeHostIndex) => {\n const response = await this.status({ ...options, activeHostIndex })\n return { response, host: hosts[activeHostIndex] }\n })\n return Promise.all(promises)\n }\n}\n"],"mappings":";;;;AAIA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA,eAAiC,SAAAC,QAAAC,CAAA,EAAAC,CAAA,OAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,MAAAG,MAAA,CAAAE,qBAAA,OAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,EAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,UAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAAAQ,UAAA,MAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,CAAA,UAAAJ,CAAA,WAA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A,CAAAb,OAAA;MAClC,MAAMkB,KAAK,GAAGD,MAAI,CAACE,QAAQ,CAAC,CAAC;MAC7B;MACA,MAAMC,QAAQ,GAAGF,KAAK,CAACG,GAAG,+BAAAC,IAAA,OAAAT,kBAAA,CAAAb,OAAA,EAAC,WAAOuB,KAAK,EAAEC,eAAe,EAAK;UAC3D,MAAMC,QAAQ,SAASR,MAAI,CAACT,MAAM,CAAAb,aAAA,CAAAA,aAAA,KAAMc,OAAO,SAAEe,eAAe,GAAE,CAAC;UACnE,OAAO,EAAEC,QAAQ,EAAEC,IAAI,EAAER,KAAK,CAACM,eAAe,CAAC,CAAC,CAAC;QACnD,CAAC,mBAAAG,EAAA,EAAAC,GAAA,UAAAN,IAAA,CAAA5B,KAAA,OAAAE,SAAA,QAAC;MACF,OAAOiC,OAAO,CAACC,GAAG,CAACV,QAAQ,CAAC;EAC9B;AACF,CAACf,OAAA,CAAAL,OAAA,GAAAM,eAAA","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", { value: true });exports.CONTENT_TYPE_TEXT_PLAIN = exports.CONTENT_TYPE_APPLICATION_X_WWW_FORM_URLENCODED = exports.CONTENT_TYPE_APPLICATION_OCTET_STREAM = exports.CONTENT_TYPE_APPLICATION_JSON = void 0;const CONTENT_TYPE_TEXT_PLAIN = 'text/plain';exports.CONTENT_TYPE_TEXT_PLAIN = CONTENT_TYPE_TEXT_PLAIN;
2
- const CONTENT_TYPE_APPLICATION_JSON = 'application/json';exports.CONTENT_TYPE_APPLICATION_JSON = CONTENT_TYPE_APPLICATION_JSON;
3
- const CONTENT_TYPE_APPLICATION_X_WWW_FORM_URLENCODED = 'application/x-www-form-urlencoded';exports.CONTENT_TYPE_APPLICATION_X_WWW_FORM_URLENCODED = CONTENT_TYPE_APPLICATION_X_WWW_FORM_URLENCODED;
4
- const CONTENT_TYPE_APPLICATION_OCTET_STREAM = 'application/octet-stream';exports.CONTENT_TYPE_APPLICATION_OCTET_STREAM = CONTENT_TYPE_APPLICATION_OCTET_STREAM;
1
+ "use strict";Object.defineProperty(exports, "__esModule", { value: true });exports.CONTENT_TYPE_TEXT_PLAIN = exports.CONTENT_TYPE_APPLICATION_X_WWW_FORM_URLENCODED = exports.CONTENT_TYPE_APPLICATION_OCTET_STREAM = exports.CONTENT_TYPE_APPLICATION_JSON = void 0;const CONTENT_TYPE_TEXT_PLAIN = exports.CONTENT_TYPE_TEXT_PLAIN = 'text/plain';
2
+ const CONTENT_TYPE_APPLICATION_JSON = exports.CONTENT_TYPE_APPLICATION_JSON = 'application/json';
3
+ const CONTENT_TYPE_APPLICATION_X_WWW_FORM_URLENCODED = exports.CONTENT_TYPE_APPLICATION_X_WWW_FORM_URLENCODED = 'application/x-www-form-urlencoded';
4
+ const CONTENT_TYPE_APPLICATION_OCTET_STREAM = exports.CONTENT_TYPE_APPLICATION_OCTET_STREAM = 'application/octet-stream';
5
5
  //# sourceMappingURL=content-types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"content-types.js","names":["CONTENT_TYPE_TEXT_PLAIN","exports","CONTENT_TYPE_APPLICATION_JSON","CONTENT_TYPE_APPLICATION_X_WWW_FORM_URLENCODED","CONTENT_TYPE_APPLICATION_OCTET_STREAM"],"sources":["../../es6/http-request/content-types.js"],"sourcesContent":["export const CONTENT_TYPE_TEXT_PLAIN = 'text/plain'\nexport const CONTENT_TYPE_APPLICATION_JSON = 'application/json'\nexport const CONTENT_TYPE_APPLICATION_X_WWW_FORM_URLENCODED = 'application/x-www-form-urlencoded'\nexport const CONTENT_TYPE_APPLICATION_OCTET_STREAM = 'application/octet-stream'\n"],"mappings":"qQAAO,MAAMA,uBAAuB,GAAG,YAAY,CAAAC,OAAA,CAAAD,uBAAA,GAAAA,uBAAA;AAC5C,MAAME,6BAA6B,GAAG,kBAAkB,CAAAD,OAAA,CAAAC,6BAAA,GAAAA,6BAAA;AACxD,MAAMC,8CAA8C,GAAG,mCAAmC,CAAAF,OAAA,CAAAE,8CAAA,GAAAA,8CAAA;AAC1F,MAAMC,qCAAqC,GAAG,0BAA0B,CAAAH,OAAA,CAAAG,qCAAA,GAAAA,qCAAA"}
1
+ {"version":3,"file":"content-types.js","names":["CONTENT_TYPE_TEXT_PLAIN","exports","CONTENT_TYPE_APPLICATION_JSON","CONTENT_TYPE_APPLICATION_X_WWW_FORM_URLENCODED","CONTENT_TYPE_APPLICATION_OCTET_STREAM"],"sources":["../../es6/http-request/content-types.js"],"sourcesContent":["export const CONTENT_TYPE_TEXT_PLAIN = 'text/plain'\nexport const CONTENT_TYPE_APPLICATION_JSON = 'application/json'\nexport const CONTENT_TYPE_APPLICATION_X_WWW_FORM_URLENCODED = 'application/x-www-form-urlencoded'\nexport const CONTENT_TYPE_APPLICATION_OCTET_STREAM = 'application/octet-stream'\n"],"mappings":"qQAAO,MAAMA,uBAAuB,GAAAC,OAAA,CAAAD,uBAAA,GAAG,YAAY;AAC5C,MAAME,6BAA6B,GAAAD,OAAA,CAAAC,6BAAA,GAAG,kBAAkB;AACxD,MAAMC,8CAA8C,GAAAF,OAAA,CAAAE,8CAAA,GAAG,mCAAmC;AAC1F,MAAMC,qCAAqC,GAAAH,OAAA,CAAAG,qCAAA,GAAG,0BAA0B","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","names":["ERROR_HTTP_REQUEST_MAX_REDIRECTS","Error","constructor","args","name","code","exports"],"sources":["../../es6/http-request/errors.js"],"sourcesContent":["/* eslint-disable import/prefer-default-export */\n/**\n * Http request errors\n * @module http-request/errors\n */\n\n/**\n * Error when max rediret attempts have been reached\n */\nexport class ERROR_HTTP_REQUEST_MAX_REDIRECTS extends Error {\n constructor (...args) {\n super(...args)\n this.name = this.constructor.name\n this.code = this.constructor.name\n }\n}\n"],"mappings":"8HAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACO,MAAMA,gCAAgC,SAASC,KAAK,CAAC;EAC1DC,WAAWA,CAAE,GAAGC,IAAI,EAAE;IACpB,KAAK,CAAC,GAAGA,IAAI,CAAC;IACd,IAAI,CAACC,IAAI,GAAG,IAAI,CAACF,WAAW,CAACE,IAAI;IACjC,IAAI,CAACC,IAAI,GAAG,IAAI,CAACH,WAAW,CAACE,IAAI;EACnC;AACF,CAACE,OAAA,CAAAN,gCAAA,GAAAA,gCAAA"}
1
+ {"version":3,"file":"errors.js","names":["ERROR_HTTP_REQUEST_MAX_REDIRECTS","Error","constructor","args","name","code","exports"],"sources":["../../es6/http-request/errors.js"],"sourcesContent":["/* eslint-disable import/prefer-default-export */\n/**\n * Http request errors\n * @module http-request/errors\n */\n\n/**\n * Error when max rediret attempts have been reached\n */\nexport class ERROR_HTTP_REQUEST_MAX_REDIRECTS extends Error {\n constructor (...args) {\n super(...args)\n this.name = this.constructor.name\n this.code = this.constructor.name\n }\n}\n"],"mappings":"8HAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACO,MAAMA,gCAAgC,SAASC,KAAK,CAAC;EAC1DC,WAAWA,CAAE,GAAGC,IAAI,EAAE;IACpB,KAAK,CAAC,GAAGA,IAAI,CAAC;IACd,IAAI,CAACC,IAAI,GAAG,IAAI,CAACF,WAAW,CAACE,IAAI;IACjC,IAAI,CAACC,IAAI,GAAG,IAAI,CAACH,WAAW,CAACE,IAAI;EACnC;AACF,CAACE,OAAA,CAAAN,gCAAA,GAAAA,gCAAA","ignoreList":[]}
@@ -6,35 +6,35 @@
6
6
  /**
7
7
  * Http DELETE method
8
8
  */
9
- const HTTP_METHOD_DELETE = 'DELETE';
9
+ const HTTP_METHOD_DELETE = exports.HTTP_METHOD_DELETE = 'DELETE';
10
10
 
11
11
  /**
12
12
  * Http GET method
13
- */exports.HTTP_METHOD_DELETE = HTTP_METHOD_DELETE;
14
- const HTTP_METHOD_GET = 'GET';
13
+ */
14
+ const HTTP_METHOD_GET = exports.HTTP_METHOD_GET = 'GET';
15
15
 
16
16
  /**
17
17
  * Http HEAD method
18
- */exports.HTTP_METHOD_GET = HTTP_METHOD_GET;
19
- const HTTP_METHOD_HEAD = 'HEAD';
18
+ */
19
+ const HTTP_METHOD_HEAD = exports.HTTP_METHOD_HEAD = 'HEAD';
20
20
 
21
21
  /**
22
22
  * Http OPTIONS method
23
- */exports.HTTP_METHOD_HEAD = HTTP_METHOD_HEAD;
24
- const HTTP_METHOD_OPTIONS = 'OPTIONS';
23
+ */
24
+ const HTTP_METHOD_OPTIONS = exports.HTTP_METHOD_OPTIONS = 'OPTIONS';
25
25
 
26
26
  /**
27
27
  * Http PATCH method
28
- */exports.HTTP_METHOD_OPTIONS = HTTP_METHOD_OPTIONS;
29
- const HTTP_METHOD_PATCH = 'PATCH';
28
+ */
29
+ const HTTP_METHOD_PATCH = exports.HTTP_METHOD_PATCH = 'PATCH';
30
30
 
31
31
  /**
32
32
  * Http POST method
33
- */exports.HTTP_METHOD_PATCH = HTTP_METHOD_PATCH;
34
- const HTTP_METHOD_POST = 'POST';
33
+ */
34
+ const HTTP_METHOD_POST = exports.HTTP_METHOD_POST = 'POST';
35
35
 
36
36
  /**
37
37
  * Http PUT method
38
- */exports.HTTP_METHOD_POST = HTTP_METHOD_POST;
39
- const HTTP_METHOD_PUT = 'PUT';exports.HTTP_METHOD_PUT = HTTP_METHOD_PUT;
38
+ */
39
+ const HTTP_METHOD_PUT = exports.HTTP_METHOD_PUT = 'PUT';
40
40
  //# sourceMappingURL=http-methods.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"http-methods.js","names":["HTTP_METHOD_DELETE","exports","HTTP_METHOD_GET","HTTP_METHOD_HEAD","HTTP_METHOD_OPTIONS","HTTP_METHOD_PATCH","HTTP_METHOD_POST","HTTP_METHOD_PUT"],"sources":["../../es6/http-request/http-methods.js"],"sourcesContent":["/**\n * Http methods\n * @module http-request/http-methods\n */\n\n/**\n * Http DELETE method\n */\nexport const HTTP_METHOD_DELETE = 'DELETE'\n\n/**\n * Http GET method\n */\nexport const HTTP_METHOD_GET = 'GET'\n\n/**\n * Http HEAD method\n */\nexport const HTTP_METHOD_HEAD = 'HEAD'\n\n/**\n * Http OPTIONS method\n */\nexport const HTTP_METHOD_OPTIONS = 'OPTIONS'\n\n/**\n * Http PATCH method\n */\nexport const HTTP_METHOD_PATCH = 'PATCH'\n\n/**\n * Http POST method\n */\nexport const HTTP_METHOD_POST = 'POST'\n\n/**\n * Http PUT method\n */\nexport const HTTP_METHOD_PUT = 'PUT'\n"],"mappings":"oRAAA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACO,MAAMA,kBAAkB,GAAG,QAAQ;;AAE1C;AACA;AACA,GAFAC,OAAA,CAAAD,kBAAA,GAAAA,kBAAA;AAGO,MAAME,eAAe,GAAG,KAAK;;AAEpC;AACA;AACA,GAFAD,OAAA,CAAAC,eAAA,GAAAA,eAAA;AAGO,MAAMC,gBAAgB,GAAG,MAAM;;AAEtC;AACA;AACA,GAFAF,OAAA,CAAAE,gBAAA,GAAAA,gBAAA;AAGO,MAAMC,mBAAmB,GAAG,SAAS;;AAE5C;AACA;AACA,GAFAH,OAAA,CAAAG,mBAAA,GAAAA,mBAAA;AAGO,MAAMC,iBAAiB,GAAG,OAAO;;AAExC;AACA;AACA,GAFAJ,OAAA,CAAAI,iBAAA,GAAAA,iBAAA;AAGO,MAAMC,gBAAgB,GAAG,MAAM;;AAEtC;AACA;AACA,GAFAL,OAAA,CAAAK,gBAAA,GAAAA,gBAAA;AAGO,MAAMC,eAAe,GAAG,KAAK,CAAAN,OAAA,CAAAM,eAAA,GAAAA,eAAA"}
1
+ {"version":3,"file":"http-methods.js","names":["HTTP_METHOD_DELETE","exports","HTTP_METHOD_GET","HTTP_METHOD_HEAD","HTTP_METHOD_OPTIONS","HTTP_METHOD_PATCH","HTTP_METHOD_POST","HTTP_METHOD_PUT"],"sources":["../../es6/http-request/http-methods.js"],"sourcesContent":["/**\n * Http methods\n * @module http-request/http-methods\n */\n\n/**\n * Http DELETE method\n */\nexport const HTTP_METHOD_DELETE = 'DELETE'\n\n/**\n * Http GET method\n */\nexport const HTTP_METHOD_GET = 'GET'\n\n/**\n * Http HEAD method\n */\nexport const HTTP_METHOD_HEAD = 'HEAD'\n\n/**\n * Http OPTIONS method\n */\nexport const HTTP_METHOD_OPTIONS = 'OPTIONS'\n\n/**\n * Http PATCH method\n */\nexport const HTTP_METHOD_PATCH = 'PATCH'\n\n/**\n * Http POST method\n */\nexport const HTTP_METHOD_POST = 'POST'\n\n/**\n * Http PUT method\n */\nexport const HTTP_METHOD_PUT = 'PUT'\n"],"mappings":"oRAAA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACO,MAAMA,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAG,QAAQ;;AAE1C;AACA;AACA;AACO,MAAME,eAAe,GAAAD,OAAA,CAAAC,eAAA,GAAG,KAAK;;AAEpC;AACA;AACA;AACO,MAAMC,gBAAgB,GAAAF,OAAA,CAAAE,gBAAA,GAAG,MAAM;;AAEtC;AACA;AACA;AACO,MAAMC,mBAAmB,GAAAH,OAAA,CAAAG,mBAAA,GAAG,SAAS;;AAE5C;AACA;AACA;AACO,MAAMC,iBAAiB,GAAAJ,OAAA,CAAAI,iBAAA,GAAG,OAAO;;AAExC;AACA;AACA;AACO,MAAMC,gBAAgB,GAAAL,OAAA,CAAAK,gBAAA,GAAG,MAAM;;AAEtC;AACA;AACA;AACO,MAAMC,eAAe,GAAAN,OAAA,CAAAM,eAAA,GAAG,KAAK","ignoreList":[]}
@@ -14,7 +14,7 @@ var _contentTypes = require("./content-types");
14
14
 
15
15
 
16
16
  var _errors = require("./errors");
17
- var _retryable = require("./retryable");function ownKeys(object, enumerableOnly) {var keys = Object.keys(object);if (Object.getOwnPropertySymbols) {var symbols = Object.getOwnPropertySymbols(object);enumerableOnly && (symbols = symbols.filter(function (sym) {return Object.getOwnPropertyDescriptor(object, sym).enumerable;})), keys.push.apply(keys, symbols);}return keys;}function _objectSpread(target) {for (var i = 1; i < arguments.length; i++) {var source = null != arguments[i] ? arguments[i] : {};i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {(0, _defineProperty2.default)(target, key, source[key]);}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));});}return target;} /**
17
+ var _retryable = require("./retryable");function ownKeys(e, r) {var t = Object.keys(e);if (Object.getOwnPropertySymbols) {var o = Object.getOwnPropertySymbols(e);r && (o = o.filter(function (r) {return Object.getOwnPropertyDescriptor(e, r).enumerable;})), t.push.apply(t, o);}return t;}function _objectSpread(e) {for (var r = 1; r < arguments.length; r++) {var t = null != arguments[r] ? arguments[r] : {};r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {(0, _defineProperty2.default)(e, r, t[r]);}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));});}return e;} /**
18
18
  * Plain HTTP client to be used when creating RQLite specific API HTTP clients
19
19
  * @module http-request
20
20
  */
@@ -58,18 +58,18 @@ var _retryable = require("./retryable");function ownKeys(object, enumerableOnly)
58
58
  /**
59
59
  * The default timeout value
60
60
  */
61
- const DEAULT_TIMEOUT = 30000;
61
+ const DEAULT_TIMEOUT = exports.DEAULT_TIMEOUT = 30000;
62
62
 
63
63
  /**
64
64
  * The default to retry a request using the next host in the chain
65
- */exports.DEAULT_TIMEOUT = DEAULT_TIMEOUT;
66
- const DEAULT_RETRY_DELAY = 30000;
65
+ */
66
+ const DEAULT_RETRY_DELAY = exports.DEAULT_RETRY_DELAY = 30000;
67
67
 
68
68
  /**
69
69
  * Create default header for all HTTP requests
70
70
  * @param {Object} [headers={}] HTTP headers to send with the request
71
71
  * @returns {Object} The headers with defaults applied
72
- */exports.DEAULT_RETRY_DELAY = DEAULT_RETRY_DELAY;
72
+ */
73
73
  function createDefaultHeaders(headers = {}) {
74
74
  const _headers$Accept = headers.Accept,Accept = _headers$Accept === void 0 ? _contentTypes.CONTENT_TYPE_APPLICATION_JSON : _headers$Accept;
75
75
  return _objectSpread(_objectSpread({}, headers), {}, { Accept });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_axios","_interopRequireDefault","require","_qs","_url","_httpMethods","_contentTypes","_errors","_retryable","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","DEAULT_TIMEOUT","exports","DEAULT_RETRY_DELAY","createDefaultHeaders","headers","_headers$Accept","Accept","CONTENT_TYPE_APPLICATION_JSON","cleanPath","path","String","replace","getWaitTimeExponential","attempt","base","exponent","Math","pow","HttpRequest","constructor","hosts","options","RETRYABLE_ERROR_CODES","RETRYABLE_STATUS_CODES","RETRYABLE_HTTP_METHODS","Map","setHosts","getTotalHosts","Error","_options$activeHostRo","activeHostRoundRobin","httpAgent","httpsAgent","retryableErrorCodes","retryableStatusCodes","retryableHttpMethods","exponentailBackoffExponent","exponentailBackoffBase","authentication","username","password","set","setActiveHostRoundRobin","setHttpAgent","setHttpsAgent","Set","Array","isArray","setRetryableErrorCodes","setRetryableStatusCodes","setRetryableHttpMethods","Number","isFinite","setExponentailBackoffBase","setExponentailBackoffExponent","setAuthentication","getExponentailBackoffBase","getExponentailBackoffExponent","getRetryableErrorCodes","getRetryableStatusCodes","getRetryableHttpMethods","getHttpAgent","getHttpsAgent","split","reduce","acc","v","host","trim","concat","getHosts","findHostIndex","parsedHostToFind","parseUrl","findIndex","parsedHost","every","field","getActiveHost","useLeader","activeHostIndex","getLeaderHostIndex","getActiveHostIndex","setActiveHostIndex","totalHosts","leaderHostIndex","setLeaderHostIndex","getActiveHostRoundRobin","getNextActiveHostIndex","nextIndex","setNextActiveHostIndex","uriIsAbsolute","uri","absoluteUriPattern","test","requestIsRetryable","statusCode","errorCode","httpMethod","has","fetch","_this","_asyncToGenerator2","body","_options$headers","_options$httpMethod","HTTP_METHOD_GET","query","_options$stream","stream","_options$timeout","timeout","_options$useLeader","_options$retries","retries","_options$maxRedirects","maxRedirects","_options$attempt","_options$retryAttempt","retryAttempt","_options$redirectAtte","redirectAttempt","attemptHostIndex","_options$exponentailB","_options$exponentailB2","_options$httpAgent","_options$httpsAgent","activeHost","auth","size","get","response","axios","url","data","responseType","method","params","paramsSerializer","stringifyQuery","arrayFormat","status","e","_e$response","code","responseStatus","_response$headers","responseHeaders","retryable","nextAttemptHostIndex","ERROR_HTTP_REQUEST_MAX_REDIRECTS","location","undefined","newLeaderHostIndex","waitTime","Promise","resolve","setTimeout","_this2","post","_this3","HTTP_METHOD_POST"],"sources":["../../es6/http-request/index.js"],"sourcesContent":["/**\n * Plain HTTP client to be used when creating RQLite specific API HTTP clients\n * @module http-request\n */\nimport axios from 'axios'\nimport { stringify as stringifyQuery } from 'qs'\nimport { parse as parseUrl } from 'url'\nimport {\n HTTP_METHOD_GET,\n HTTP_METHOD_POST,\n} from './http-methods'\nimport {\n CONTENT_TYPE_APPLICATION_JSON,\n // CONTENT_TYPE_APPLICATION_OCTET_STREAM,\n} from './content-types'\nimport { ERROR_HTTP_REQUEST_MAX_REDIRECTS } from './errors'\nimport {\n RETRYABLE_ERROR_CODES,\n RETRYABLE_HTTP_METHODS,\n RETRYABLE_STATUS_CODES,\n} from './retryable'\n\n/**\n * RQliteJS HTTP Request options\n * @typedef HttpRequestOptions\n * @type {Object}\n * @property {Object} [auth] A object for user authentication\n * @property {String} [auth.username] The username for authentication\n * @property {String} [auth.password] The username for authentication\n * @property {Object} [body] The body of the HTTP request\n * @property {Object} [headers={}] HTTP headers to send with the request\n * @property {String} [httpMethod=HTTP_METHOD_GET] The HTTP method for the request\n * i.e. GET or POST\n * @property {Object} [query] An object with the query to send with the HTTP request\n * @property {Boolean} [stream=false] When true the returned value is a request object with\n * stream support instead of a request-promise result\n * @property {Number} [timeout=DEAULT_TIMEOUT] Optional timeout to override default\n * @property {String} uri The uri for the request which can be a relative path to use\n * the currently active host or a full i.e. http://localhost:4001/db/query which is used\n * literally\n * @property {Boolean} [useLeader=false] When true the request will use the master host, the\n * first host in this.hosts, this is ideal for write operations to skip the redirect\n * @property {Number} [retries] The number of retries, defaults to the number of\n * hosts times 3\n * @property {Number} [maxRedirects=10] The maximum number of HTTP redirects to follow before\n * throwing an error\n * @property {Number} [attempt=0] The current attempt count when retrying or redirecting\n * @property {Number} [retryAttempt=0] The current attempt based on retry logic\n * @property {Number} [redirectAttempt=0] The current attempt based on redirect logic\n * @property {Number} [attemptHostIndex] When in a retry state the host index of the last\n * attempt which is used to get the next host index\n * @property {import('http').Agent} [httpAgent] An option http agent, useful for\n * keepalive pools using plain HTTP\n * @property {import('https').Agent} [httpsAgent] An option http agent, useful\n * for keepalive pools using SSL\n */\n\n/**\n * The default timeout value\n */\nexport const DEAULT_TIMEOUT = 30000\n\n/**\n * The default to retry a request using the next host in the chain\n */\nexport const DEAULT_RETRY_DELAY = 30000\n\n/**\n * Create default header for all HTTP requests\n * @param {Object} [headers={}] HTTP headers to send with the request\n * @returns {Object} The headers with defaults applied\n */\nexport function createDefaultHeaders (headers = {}) {\n const { Accept = CONTENT_TYPE_APPLICATION_JSON } = headers\n return { ...headers, Accept }\n}\n\n/**\n * Clean the request path remove / from the beginning\n * @param {String} path The path to clean\n * @returns {String} The clean path\n */\nfunction cleanPath (path) {\n return String(path).replace(/^\\//, '')\n}\n\n/**\n * Returns the next wait interval, in milliseconds, using an exponential\n * backoff algorithm.\n * @param {Number} attempt The retry attempt\n * @param {Number} base The base of the exponential backoff\n * @param {Number} exponent The exponential power\n * @returns {Number} The time to wait in milliseconds\n */\nexport function getWaitTimeExponential (attempt = 0, base = 100, exponent = 2) {\n if (attempt === 0) {\n return 0\n }\n return (exponent ** attempt) * base\n}\n\n/**\n * Generic HTTP Request class which all RQLiteJS client\n * should extend for consistent communitication with an RQLite\n * server\n */\nexport default class HttpRequest {\n /**\n * The index of the host in this.hosts which will be tried\n * first before attempting other hosts\n * @type {Number}\n */\n activeHostIndex = 0\n\n /**\n * Whether or not the setNextActiveHostIndex() should\n * perform a round robin strategy\n */\n activeHostRoundRobin = true\n\n /**\n * The regex pattern to check if a uri is absolute or relative,\n * if it is absolute the host is not appended\n */\n absoluteUriPattern = /^https?:\\/\\//\n\n /**\n * A list of hosts that are tried in round robin fashion\n * when certain HTTP responses are received\n * @type {String[]}\n */\n hosts = []\n\n /**\n * @type {import('http').Agent} The http agent if it is set\n */\n httpAgent\n\n /**\n * @type {import('https').Agent} The https agent if it is set\n */\n httpsAgent\n\n /**\n * The host list index of the leader node defaults\n * to the first host\n * @type {Number}\n */\n leaderHostIndex = 0\n\n /**\n * Http error codes which are considered retryable\n * @type {Set}\n */\n retryableErrorCodes = RETRYABLE_ERROR_CODES\n\n /**\n * Http status codes which are considered retryable\n * @type {Set}\n */\n retryableStatusCodes = RETRYABLE_STATUS_CODES\n\n /**\n * Http methods which are considered retryable\n * @type {Set}\n */\n retryableHttpMethods = RETRYABLE_HTTP_METHODS\n\n /**\n * The exponential backoff base for retries\n */\n exponentailBackoffBase = 100\n\n /**\n * The exponent to increase backoff each try\n */\n exponentailBackoffExponent = 1.1\n\n /**\n * Authentication Map\n * @type {Map}\n * @property {String} username\n * @property {String} password\n */\n authentication = new Map()\n\n /**\n * Construtor for HttpRequest\n * @param {String[]|String} hosts An array of RQLite hosts or a string\n * that will be split on \",\" to create an array of hosts, the first\n * host will be tried first when there are multiple hosts\n * @param {Object} [options={}] Additional options\n * @param {Object} [options.authentication] Authentication options\n * @param {String} [options.authentication.username] The host authentication username\n * @param {String} [options.authentication.password] The host authentication password\n * @param {Boolean} [options.activeHostRoundRobin=true] If true this.setNextActiveHostIndex()\n * will perform a round robin when called\n * @param {import('http').Agent} [options.httpAgent] An option http agent, useful for\n * keepalive pools using plain HTTP\n * @param {import('https').Agent} [options.httpsAgent] An option http agent, useful\n * for keepalive pools using SSL\n * @param {Set|String[]} [options.retryableErrorCodes] The list of retryable error codes\n * @param {Set|Number[]} [options.retryableStatusCodes] The list of retryable http status codes\n * @param {Set|String[]} [options.retryableHttpMethods] The list of retryable http methods\n * @param {Number} [options.exponentailBackoffBase] The value for exponentail backoff base\n * for retry exponential backoff\n * @param {Number} [options.exponentailBackoffExponent] Exponent to increase backoff each try\n */\n constructor (hosts, options = {}) {\n this.setHosts(hosts)\n if (this.getTotalHosts() === 0) {\n throw new Error('At least one host must be provided')\n }\n const {\n activeHostRoundRobin = true,\n httpAgent,\n httpsAgent,\n retryableErrorCodes,\n retryableStatusCodes,\n retryableHttpMethods,\n exponentailBackoffExponent,\n exponentailBackoffBase,\n authentication,\n } = options\n if (typeof authentication === 'object') {\n const { username, password } = authentication\n if (username) {\n this.authentication.set('username', username)\n }\n if (password) {\n this.authentication.set('password', password)\n }\n }\n if (typeof activeHostRoundRobin !== 'undefined') {\n this.setActiveHostRoundRobin(activeHostRoundRobin)\n }\n if (typeof httpAgent !== 'undefined') {\n this.setHttpAgent(httpAgent)\n }\n if (typeof httpsAgent !== 'undefined') {\n this.setHttpsAgent(httpsAgent)\n }\n if (retryableErrorCodes instanceof Set || Array.isArray(retryableErrorCodes)) {\n this.setRetryableErrorCodes(\n Array.isArray(retryableErrorCodes) ? Set(retryableErrorCodes) : retryableErrorCodes,\n )\n }\n if (retryableStatusCodes instanceof Set || Array.isArray(retryableStatusCodes)) {\n this.setRetryableStatusCodes(\n Array.isArray(retryableStatusCodes) ? Set(retryableStatusCodes) : retryableStatusCodes,\n )\n }\n if (retryableHttpMethods instanceof Set || Array.isArray(retryableHttpMethods)) {\n this.setRetryableHttpMethods(\n Array.isArray(retryableHttpMethods) ? Set(retryableHttpMethods) : retryableHttpMethods,\n )\n }\n if (Number.isFinite(exponentailBackoffBase)) {\n this.setExponentailBackoffBase(exponentailBackoffBase)\n }\n if (Number.isFinite(exponentailBackoffExponent)) {\n this.setExponentailBackoffExponent(exponentailBackoffExponent)\n }\n }\n\n /**\n * Set authentication information\n * @param {Object} [authentication] Authentication data\n * @param {String} [authentication.username] The host authentication username\n * @param {String} [authentication.password] The host authentication password\n */\n setAuthentication (authentication = {}) {\n const { username, password } = authentication\n if (username) {\n this.authentication.set('username', username)\n }\n if (password) {\n this.authentication.set('password', password)\n }\n }\n\n /**\n * Set the exponentail backoff base\n * @param {Number} exponentailBackoffBase\n */\n setExponentailBackoffBase (exponentailBackoffBase) {\n this.exponentailBackoffBase = exponentailBackoffBase\n }\n\n /**\n * Get the exponentail backoff base\n * @return {Number} The exponentail backoff base\n */\n getExponentailBackoffBase () {\n return this.exponentailBackoffBase\n }\n\n /**\n * Set the exponentail backoff exponent\n * @param {Number} exponentailBackoffExponent\n */\n setExponentailBackoffExponent (exponentailBackoffExponent) {\n this.exponentailBackoffExponent = exponentailBackoffExponent\n }\n\n /**\n * Get the exponentail backoff exponent\n * @return {Number} The exponentail backoff exponent\n */\n getExponentailBackoffExponent () {\n return this.exponentailBackoffExponent\n }\n\n /**\n * Set the retryable error codes\n * @param {Set} retryableErrorCodes\n */\n setRetryableErrorCodes (retryableErrorCodes) {\n this.retryableErrorCodes = retryableErrorCodes\n }\n\n /**\n * Get the retryable error codes\n * @returns {Set}\n */\n getRetryableErrorCodes () {\n return this.retryableErrorCodes\n }\n\n /**\n * Set the retryable status codes\n * @param {Set} retryableStatusCodes\n */\n setRetryableStatusCodes (retryableStatusCodes) {\n this.retryableStatusCodes = retryableStatusCodes\n }\n\n /**\n * Get the retryable status codes\n * @returns {Set}\n */\n getRetryableStatusCodes () {\n return this.retryableStatusCodes\n }\n\n /**\n * Set the retryable http methods\n * @param {Set} retryableHttpMethods\n */\n setRetryableHttpMethods (retryableHttpMethods) {\n this.retryableHttpMethods = retryableHttpMethods\n }\n\n /**\n * Get the retryable http methods\n * @returns {Set}\n */\n getRetryableHttpMethods () {\n return this.retryableHttpMethods\n }\n\n /**\n * Set an http agent which is useful for http keepalive requests\n * @param {import('http').Agent} httpAgent An http agent\n */\n setHttpAgent (httpAgent) {\n this.httpAgent = httpAgent\n }\n\n /**\n * Get the set http agent\n * @returns {import('http').Agent|undefined} The https agent if it is set\n */\n getHttpAgent () {\n return this.httpAgent\n }\n\n /**\n * Set an https agent which is useful for https keepalive requests\n * @param {import('https').Agent} httpsAgent An https agent\n */\n setHttpsAgent (httpsAgent) {\n this.httpsAgent = httpsAgent\n }\n\n /**\n * Get the set https agent\n * @returns {import('https').Agent|undefined} The https agent if it is set\n */\n getHttpsAgent () {\n return this.httpsAgent\n }\n\n /**\n * Set the list of hosts\n * @param {String[]|String} hosts An array of RQLite hosts or a string\n * that will be split on \",\" to create an array of hosts, the first\n * host will be tried first when there are multiple hosts\n */\n setHosts (hosts) {\n this.hosts = !Array.isArray(hosts) ? String(hosts).split(',') : hosts\n this.hosts = this.hosts.reduce((acc, v) => {\n // Remove trailing slashed from hosts\n const host = String(v).trim().replace(/\\/$/, '')\n if (!host) {\n return acc\n }\n return acc.concat(host)\n }, [])\n }\n\n /**\n * Get the list of hosts\n * @returns {String[]} The list of hosts\n */\n getHosts () {\n return this.hosts\n }\n\n /**\n * Given a host string find the index of that host in the hosts\n * @param {String} host A host to find in hosts\n * @returns {Number} The found host index or -1 if not found\n */\n findHostIndex (host) {\n const parsedHostToFind = parseUrl(host)\n return this.getHosts().findIndex((v) => {\n const parsedHost = parseUrl(v)\n // Find a host where all the parsed fields match the requested host\n return ['hostname', 'protocol', 'port', 'path'].every((field) => parsedHostToFind[field] === parsedHost[field])\n })\n }\n\n /**\n * Get the current active host from the hosts array\n * @param {Boolean} useLeader If true use the first host which is always\n * the master, this is prefered for write operations\n * @returns {String} The active host\n */\n getActiveHost (useLeader) {\n // When useLeader is true we should just use the first host\n const activeHostIndex = useLeader ? this.getLeaderHostIndex() : this.getActiveHostIndex()\n return this.getHosts()[activeHostIndex]\n }\n\n /**\n * Set the active host index with check based on this.hosts\n * @param {Number} activeHostIndex The index\n * @returns {Number} The active host index\n */\n setActiveHostIndex (activeHostIndex) {\n if (!Number.isFinite(activeHostIndex)) {\n throw new Error('The activeHostIndex should be a finite number')\n }\n const totalHosts = this.getTotalHosts()\n if (activeHostIndex < 0) {\n // Don't allow an index less then zero\n this.activeHostIndex = 0\n } else if (activeHostIndex >= totalHosts) {\n // Don't allow an index greater then the length of the hosts\n this.activeHostIndex = totalHosts - 1\n } else {\n this.activeHostIndex = activeHostIndex\n }\n return this.activeHostIndex\n }\n\n /**\n * Get the host index for the leader node\n * @returns {Number} The host index for the leader node\n */\n getLeaderHostIndex () {\n return this.leaderHostIndex\n }\n\n /**\n * Set the index in the host array for the leader node\n * @param {Number} leaderHostIndex The index of the host that is the leader node\n * @returns {Number} The host index for the leader node\n */\n setLeaderHostIndex (leaderHostIndex) {\n if (!Number.isFinite(leaderHostIndex)) {\n throw new Error('The leaderHostIndex should be a finite number')\n }\n const totalHosts = this.getTotalHosts()\n if (leaderHostIndex < 0) {\n this.leaderHostIndex = 0\n } else if (leaderHostIndex > totalHosts) {\n this.leaderHostIndex = totalHosts - 1\n } else {\n this.leaderHostIndex = leaderHostIndex\n }\n return this.leaderHostIndex\n }\n\n /**\n * Get the active host index\n * @returns {Number} The active host index\n */\n getActiveHostIndex () {\n return this.activeHostIndex\n }\n\n /**\n * Set active host round robin value\n * @param {Boolean} activeHostRoundRobin If true setActiveHostIndex() will\n * perform a round robin\n */\n setActiveHostRoundRobin (activeHostRoundRobin) {\n if (typeof activeHostRoundRobin !== 'boolean') {\n throw new Error('The activeHostRoundRobin argument must be boolean')\n }\n this.activeHostRoundRobin = activeHostRoundRobin\n }\n\n /**\n * Get active host round robin value\n * @returns {Boolean} The value of activeHostRoundRobin\n */\n getActiveHostRoundRobin () {\n return this.activeHostRoundRobin\n }\n\n /**\n * Get the next active host index\n * @param {Number} [activeHostIndex] An optional paramater to provide the active host index\n * @returns {Number} The next active host index which will wrap around to zero\n */\n getNextActiveHostIndex (activeHostIndex = this.getActiveHostIndex()) {\n const totalHosts = this.getTotalHosts()\n const nextIndex = activeHostIndex + 1\n // If we are past the last index start back over at 1\n if (totalHosts === nextIndex) {\n return 0\n }\n return nextIndex\n }\n\n /**\n * Set the active host index to the next host using a\n * round robin strategy\n */\n setNextActiveHostIndex () {\n // Don't bother if we only have one host\n if (!this.getActiveHostRoundRobin()) {\n return\n }\n const totalHosts = this.getTotalHosts()\n if (this.getActiveHostRoundRobin() && totalHosts <= 1) {\n return\n }\n this.setActiveHostIndex(this.getNextActiveHostIndex())\n }\n\n /**\n * Get the total number of hosts\n * @returns {Number} The total number of hosts\n */\n getTotalHosts () {\n return this.getHosts().length\n }\n\n /**\n * Returns whether or not the uri passes a test for this.absoluteUriPattern\n * @returns {Boolean} True if the path is absolute\n */\n uriIsAbsolute (uri) {\n return this.absoluteUriPattern.test(uri)\n }\n\n /**\n * Returns true when the HTTP request is retryable\n * @param {Object} options The options\n * @param {Number} options.statusCode The HTTP status code\n * @param {String} options.errorCode The error code\n * @param {String} options.httpMethod The http method\n * @returns {Boolean} True if the request is retry able\n */\n requestIsRetryable (options = {}) {\n const {\n statusCode,\n errorCode,\n httpMethod,\n } = options\n // Honor strictly the http method\n if (!this.getRetryableHttpMethods().has(httpMethod)) {\n return false\n }\n if (statusCode && this.getRetryableStatusCodes().has(statusCode)) {\n return true\n }\n if (errorCode && this.getRetryableErrorCodes().has(errorCode)) {\n return true\n }\n return false\n }\n\n /**\n * Perform an HTTP request using the provided options\n * @param {HttpRequestOptions} [options={}] Options for the HTTP client\n * @returns {Promise<{status: Number, body: Object|String}>} An object with a status and body\n * property when stream is false and a stream when the stream option is true\n * @throws {ERROR_HTTP_REQUEST_MAX_REDIRECTS} When the maximum number of redirect has been reached\n */\n async fetch (options = {}) {\n const {\n body,\n headers = {},\n httpMethod = HTTP_METHOD_GET,\n query,\n stream = false,\n timeout = DEAULT_TIMEOUT,\n useLeader = false,\n retries = this.getTotalHosts() * 3,\n maxRedirects = 10,\n attempt = 0,\n retryAttempt = 0,\n redirectAttempt = 0,\n attemptHostIndex,\n exponentailBackoffExponent = this.getExponentailBackoffExponent(),\n exponentailBackoffBase = this.getExponentailBackoffBase(),\n httpAgent = this.getHttpAgent(),\n httpsAgent = this.getHttpsAgent(),\n } = options\n // Honor the supplied attemptHostIndex or get the active host\n const activeHost = Number.isFinite(attemptHostIndex) ? this.getHosts()[attemptHostIndex]\n : this.getActiveHost(useLeader)\n let { uri } = options\n if (!uri) {\n throw new Error('The uri option is required')\n }\n uri = this.uriIsAbsolute(uri) ? uri : `${activeHost}/${cleanPath(uri)}`\n try {\n let auth\n if (this.authentication.size) {\n auth = {\n username: this.authentication.get('username'),\n password: this.authentication.get('password'),\n }\n }\n const response = await axios({\n url: uri,\n auth,\n data: body,\n maxRedirects: 0, // Handle redirects manually to allow reposting data\n headers: createDefaultHeaders(headers),\n responseType: stream ? 'stream' : 'json',\n method: httpMethod,\n params: query,\n timeout,\n httpsAgent,\n httpAgent,\n paramsSerializer (params) {\n return stringifyQuery(params, { arrayFormat: 'brackets' })\n },\n })\n if (stream) {\n return response.data\n }\n return {\n body: response.data,\n status: response.status,\n }\n } catch (e) {\n const { response = {}, code: errorCode } = e\n const { status: responseStatus, headers: responseHeaders = {} } = response\n // Check if the error was a redirect\n const retryable = this.requestIsRetryable({\n statusCode: responseStatus,\n errorCode,\n httpMethod,\n })\n // Save the next active host index and pass it to retry manually\n let nextAttemptHostIndex = Number.isFinite(attemptHostIndex) ? attemptHostIndex\n : this.getActiveHostIndex()\n nextAttemptHostIndex += 1\n // We go past the last index start from zero\n if (nextAttemptHostIndex === this.getTotalHosts()) {\n nextAttemptHostIndex = 0\n }\n // First check if this is a redirect error\n if (responseStatus === 301 || responseStatus === 302) {\n // We maxed out on redirect attempts\n if (redirectAttempt >= maxRedirects) {\n throw ERROR_HTTP_REQUEST_MAX_REDIRECTS(`The maximum number of redirects ${maxRedirects} has been reached`)\n }\n const location = typeof responseHeaders === 'object' ? responseHeaders.location : undefined\n // If we were asked to use the leader, but got redirect the leader moved so remember it\n if (useLeader) {\n const newLeaderHostIndex = this.findHostIndex(location)\n // If the redirect exists in the hosts list remember it for next time\n if (newLeaderHostIndex > -1) {\n this.setLeaderHostIndex(newLeaderHostIndex)\n }\n }\n return this.fetch({\n ...options,\n uri: location,\n attempt: attempt + 1,\n redirectAttempt: redirectAttempt + 1,\n attemptHostIndex: nextAttemptHostIndex,\n })\n }\n if (retryable && retryAttempt < retries) {\n const waitTime = getWaitTimeExponential(\n retryAttempt,\n exponentailBackoffBase,\n exponentailBackoffExponent,\n )\n await new Promise((resolve) => {\n setTimeout(() => {\n resolve(undefined)\n }, waitTime)\n })\n return this.fetch({\n ...options,\n attempt: attempt + 1,\n retryAttempt: retryAttempt + 1,\n attemptHostIndex: nextAttemptHostIndex,\n })\n }\n throw e\n }\n }\n\n /**\n * Perform an HTTP GET request\n * @param {HttpRequestOptions} [options={}] The options\n * @see this.fetch() for options\n */\n async get (options = {}) {\n return this.fetch({ ...options, httpMethod: HTTP_METHOD_GET })\n }\n\n /**\n * Perform an HTTP POST request\n * @param {HttpRequestOptions} [options={}] The options\n * @see this.fetch() for options\n */\n async post (options = {}) {\n return this.fetch({ ...options, httpMethod: HTTP_METHOD_POST })\n }\n}\n"],"mappings":";;;;AAIA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,GAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;;;;AAIA,IAAAI,aAAA,GAAAJ,OAAA;;;;AAIA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA,gBAIoB,SAAAO,QAAAC,MAAA,EAAAC,cAAA,OAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,MAAAG,MAAA,CAAAC,qBAAA,OAAAC,OAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAJ,MAAA,EAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAA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AE;UACvC,MAAMwC,QAAQ,GAAG9I,sBAAsB;YACrC2G,YAAY;YACZlF,sBAAsB;YACtBD;UACF,CAAC;UACD,MAAM,IAAIuH,OAAO,CAAC,CAACC,OAAO,KAAK;YAC7BC,UAAU,CAAC,MAAM;cACfD,OAAO,CAACJ,SAAS,CAAC;YACpB,CAAC,EAAEE,QAAQ,CAAC;UACd,CAAC,CAAC;UACF,OAAOrD,KAAI,CAACD,KAAK,CAAAjH,aAAA,CAAAA,aAAA;UACZkC,OAAO;YACVR,OAAO,EAAEA,OAAO,GAAG,CAAC;YACpB0G,YAAY,EAAEA,YAAY,GAAG,CAAC;YAC9BG,gBAAgB,EAAE2B,oBAAoB;UACvC,CAAC;QACJ;QACA,MAAMP,CAAC;MACT,CAAC;EACH;;EAEA;AACF;AACA;AACA;AACA;EACQZ,GAAGA,CAAE7G,OAAO,GAAG,CAAC,CAAC,EAAE,KAAAyI,MAAA,mBAAAxD,kBAAA,CAAA1G,OAAA;MACvB,OAAOkK,MAAI,CAAC1D,KAAK,CAAAjH,aAAA,CAAAA,aAAA,KAAMkC,OAAO,SAAE6E,UAAU,EAAEQ,4BAAe,GAAE,CAAC;EAChE;;EAEA;AACF;AACA;AACA;AACA;EACQqD,IAAIA,CAAE1I,OAAO,GAAG,CAAC,CAAC,EAAE,KAAA2I,MAAA,mBAAA1D,kBAAA,CAAA1G,OAAA;MACxB,OAAOoK,MAAI,CAAC5D,KAAK,CAAAjH,aAAA,CAAAA,aAAA,KAAMkC,OAAO,SAAE6E,UAAU,EAAE+D,6BAAgB,GAAE,CAAC;EACjE;AACF,CAAChK,OAAA,CAAAL,OAAA,GAAAsB,WAAA"}
1
+ {"version":3,"file":"index.js","names":["_axios","_interopRequireDefault","require","_qs","_url","_httpMethods","_contentTypes","_errors","_retryable","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","DEAULT_TIMEOUT","exports","DEAULT_RETRY_DELAY","createDefaultHeaders","headers","_headers$Accept","Accept","CONTENT_TYPE_APPLICATION_JSON","cleanPath","path","String","replace","getWaitTimeExponential","attempt","base","exponent","Math","pow","HttpRequest","constructor","hosts","options","RETRYABLE_ERROR_CODES","RETRYABLE_STATUS_CODES","RETRYABLE_HTTP_METHODS","Map","setHosts","getTotalHosts","Error","_options$activeHostRo","activeHostRoundRobin","httpAgent","httpsAgent","retryableErrorCodes","retryableStatusCodes","retryableHttpMethods","exponentailBackoffExponent","exponentailBackoffBase","authentication","username","password","set","setActiveHostRoundRobin","setHttpAgent","setHttpsAgent","Set","Array","isArray","setRetryableErrorCodes","setRetryableStatusCodes","setRetryableHttpMethods","Number","isFinite","setExponentailBackoffBase","setExponentailBackoffExponent","setAuthentication","getExponentailBackoffBase","getExponentailBackoffExponent","getRetryableErrorCodes","getRetryableStatusCodes","getRetryableHttpMethods","getHttpAgent","getHttpsAgent","split","reduce","acc","v","host","trim","concat","getHosts","findHostIndex","parsedHostToFind","parseUrl","findIndex","parsedHost","every","field","getActiveHost","useLeader","activeHostIndex","getLeaderHostIndex","getActiveHostIndex","setActiveHostIndex","totalHosts","leaderHostIndex","setLeaderHostIndex","getActiveHostRoundRobin","getNextActiveHostIndex","nextIndex","setNextActiveHostIndex","uriIsAbsolute","uri","absoluteUriPattern","test","requestIsRetryable","statusCode","errorCode","httpMethod","has","fetch","_this","_asyncToGenerator2","body","_options$headers","_options$httpMethod","HTTP_METHOD_GET","query","_options$stream","stream","_options$timeout","timeout","_options$useLeader","_options$retries","retries","_options$maxRedirects","maxRedirects","_options$attempt","_options$retryAttempt","retryAttempt","_options$redirectAtte","redirectAttempt","attemptHostIndex","_options$exponentailB","_options$exponentailB2","_options$httpAgent","_options$httpsAgent","activeHost","auth","size","get","response","axios","url","data","responseType","method","params","paramsSerializer","stringifyQuery","arrayFormat","status","_e$response","code","responseStatus","_response$headers","responseHeaders","retryable","nextAttemptHostIndex","ERROR_HTTP_REQUEST_MAX_REDIRECTS","location","undefined","newLeaderHostIndex","waitTime","Promise","resolve","setTimeout","_this2","post","_this3","HTTP_METHOD_POST"],"sources":["../../es6/http-request/index.js"],"sourcesContent":["/**\n * Plain HTTP client to be used when creating RQLite specific API HTTP clients\n * @module http-request\n */\nimport axios from 'axios'\nimport { stringify as stringifyQuery } from 'qs'\nimport { parse as parseUrl } from 'url'\nimport {\n HTTP_METHOD_GET,\n HTTP_METHOD_POST,\n} from './http-methods'\nimport {\n CONTENT_TYPE_APPLICATION_JSON,\n // CONTENT_TYPE_APPLICATION_OCTET_STREAM,\n} from './content-types'\nimport { ERROR_HTTP_REQUEST_MAX_REDIRECTS } from './errors'\nimport {\n RETRYABLE_ERROR_CODES,\n RETRYABLE_HTTP_METHODS,\n RETRYABLE_STATUS_CODES,\n} from './retryable'\n\n/**\n * RQliteJS HTTP Request options\n * @typedef HttpRequestOptions\n * @type {Object}\n * @property {Object} [auth] A object for user authentication\n * @property {String} [auth.username] The username for authentication\n * @property {String} [auth.password] The username for authentication\n * @property {Object} [body] The body of the HTTP request\n * @property {Object} [headers={}] HTTP headers to send with the request\n * @property {String} [httpMethod=HTTP_METHOD_GET] The HTTP method for the request\n * i.e. GET or POST\n * @property {Object} [query] An object with the query to send with the HTTP request\n * @property {Boolean} [stream=false] When true the returned value is a request object with\n * stream support instead of a request-promise result\n * @property {Number} [timeout=DEAULT_TIMEOUT] Optional timeout to override default\n * @property {String} uri The uri for the request which can be a relative path to use\n * the currently active host or a full i.e. http://localhost:4001/db/query which is used\n * literally\n * @property {Boolean} [useLeader=false] When true the request will use the master host, the\n * first host in this.hosts, this is ideal for write operations to skip the redirect\n * @property {Number} [retries] The number of retries, defaults to the number of\n * hosts times 3\n * @property {Number} [maxRedirects=10] The maximum number of HTTP redirects to follow before\n * throwing an error\n * @property {Number} [attempt=0] The current attempt count when retrying or redirecting\n * @property {Number} [retryAttempt=0] The current attempt based on retry logic\n * @property {Number} [redirectAttempt=0] The current attempt based on redirect logic\n * @property {Number} [attemptHostIndex] When in a retry state the host index of the last\n * attempt which is used to get the next host index\n * @property {import('http').Agent} [httpAgent] An option http agent, useful for\n * keepalive pools using plain HTTP\n * @property {import('https').Agent} [httpsAgent] An option http agent, useful\n * for keepalive pools using SSL\n */\n\n/**\n * The default timeout value\n */\nexport const DEAULT_TIMEOUT = 30000\n\n/**\n * The default to retry a request using the next host in the chain\n */\nexport const DEAULT_RETRY_DELAY = 30000\n\n/**\n * Create default header for all HTTP requests\n * @param {Object} [headers={}] HTTP headers to send with the request\n * @returns {Object} The headers with defaults applied\n */\nexport function createDefaultHeaders (headers = {}) {\n const { Accept = CONTENT_TYPE_APPLICATION_JSON } = headers\n return { ...headers, Accept }\n}\n\n/**\n * Clean the request path remove / from the beginning\n * @param {String} path The path to clean\n * @returns {String} The clean path\n */\nfunction cleanPath (path) {\n return String(path).replace(/^\\//, '')\n}\n\n/**\n * Returns the next wait interval, in milliseconds, using an exponential\n * backoff algorithm.\n * @param {Number} attempt The retry attempt\n * @param {Number} base The base of the exponential backoff\n * @param {Number} exponent The exponential power\n * @returns {Number} The time to wait in milliseconds\n */\nexport function getWaitTimeExponential (attempt = 0, base = 100, exponent = 2) {\n if (attempt === 0) {\n return 0\n }\n return (exponent ** attempt) * base\n}\n\n/**\n * Generic HTTP Request class which all RQLiteJS client\n * should extend for consistent communitication with an RQLite\n * server\n */\nexport default class HttpRequest {\n /**\n * The index of the host in this.hosts which will be tried\n * first before attempting other hosts\n * @type {Number}\n */\n activeHostIndex = 0\n\n /**\n * Whether or not the setNextActiveHostIndex() should\n * perform a round robin strategy\n */\n activeHostRoundRobin = true\n\n /**\n * The regex pattern to check if a uri is absolute or relative,\n * if it is absolute the host is not appended\n */\n absoluteUriPattern = /^https?:\\/\\//\n\n /**\n * A list of hosts that are tried in round robin fashion\n * when certain HTTP responses are received\n * @type {String[]}\n */\n hosts = []\n\n /**\n * @type {import('http').Agent} The http agent if it is set\n */\n httpAgent\n\n /**\n * @type {import('https').Agent} The https agent if it is set\n */\n httpsAgent\n\n /**\n * The host list index of the leader node defaults\n * to the first host\n * @type {Number}\n */\n leaderHostIndex = 0\n\n /**\n * Http error codes which are considered retryable\n * @type {Set}\n */\n retryableErrorCodes = RETRYABLE_ERROR_CODES\n\n /**\n * Http status codes which are considered retryable\n * @type {Set}\n */\n retryableStatusCodes = RETRYABLE_STATUS_CODES\n\n /**\n * Http methods which are considered retryable\n * @type {Set}\n */\n retryableHttpMethods = RETRYABLE_HTTP_METHODS\n\n /**\n * The exponential backoff base for retries\n */\n exponentailBackoffBase = 100\n\n /**\n * The exponent to increase backoff each try\n */\n exponentailBackoffExponent = 1.1\n\n /**\n * Authentication Map\n * @type {Map}\n * @property {String} username\n * @property {String} password\n */\n authentication = new Map()\n\n /**\n * Construtor for HttpRequest\n * @param {String[]|String} hosts An array of RQLite hosts or a string\n * that will be split on \",\" to create an array of hosts, the first\n * host will be tried first when there are multiple hosts\n * @param {Object} [options={}] Additional options\n * @param {Object} [options.authentication] Authentication options\n * @param {String} [options.authentication.username] The host authentication username\n * @param {String} [options.authentication.password] The host authentication password\n * @param {Boolean} [options.activeHostRoundRobin=true] If true this.setNextActiveHostIndex()\n * will perform a round robin when called\n * @param {import('http').Agent} [options.httpAgent] An option http agent, useful for\n * keepalive pools using plain HTTP\n * @param {import('https').Agent} [options.httpsAgent] An option http agent, useful\n * for keepalive pools using SSL\n * @param {Set|String[]} [options.retryableErrorCodes] The list of retryable error codes\n * @param {Set|Number[]} [options.retryableStatusCodes] The list of retryable http status codes\n * @param {Set|String[]} [options.retryableHttpMethods] The list of retryable http methods\n * @param {Number} [options.exponentailBackoffBase] The value for exponentail backoff base\n * for retry exponential backoff\n * @param {Number} [options.exponentailBackoffExponent] Exponent to increase backoff each try\n */\n constructor (hosts, options = {}) {\n this.setHosts(hosts)\n if (this.getTotalHosts() === 0) {\n throw new Error('At least one host must be provided')\n }\n const {\n activeHostRoundRobin = true,\n httpAgent,\n httpsAgent,\n retryableErrorCodes,\n retryableStatusCodes,\n retryableHttpMethods,\n exponentailBackoffExponent,\n exponentailBackoffBase,\n authentication,\n } = options\n if (typeof authentication === 'object') {\n const { username, password } = authentication\n if (username) {\n this.authentication.set('username', username)\n }\n if (password) {\n this.authentication.set('password', password)\n }\n }\n if (typeof activeHostRoundRobin !== 'undefined') {\n this.setActiveHostRoundRobin(activeHostRoundRobin)\n }\n if (typeof httpAgent !== 'undefined') {\n this.setHttpAgent(httpAgent)\n }\n if (typeof httpsAgent !== 'undefined') {\n this.setHttpsAgent(httpsAgent)\n }\n if (retryableErrorCodes instanceof Set || Array.isArray(retryableErrorCodes)) {\n this.setRetryableErrorCodes(\n Array.isArray(retryableErrorCodes) ? Set(retryableErrorCodes) : retryableErrorCodes,\n )\n }\n if (retryableStatusCodes instanceof Set || Array.isArray(retryableStatusCodes)) {\n this.setRetryableStatusCodes(\n Array.isArray(retryableStatusCodes) ? Set(retryableStatusCodes) : retryableStatusCodes,\n )\n }\n if (retryableHttpMethods instanceof Set || Array.isArray(retryableHttpMethods)) {\n this.setRetryableHttpMethods(\n Array.isArray(retryableHttpMethods) ? Set(retryableHttpMethods) : retryableHttpMethods,\n )\n }\n if (Number.isFinite(exponentailBackoffBase)) {\n this.setExponentailBackoffBase(exponentailBackoffBase)\n }\n if (Number.isFinite(exponentailBackoffExponent)) {\n this.setExponentailBackoffExponent(exponentailBackoffExponent)\n }\n }\n\n /**\n * Set authentication information\n * @param {Object} [authentication] Authentication data\n * @param {String} [authentication.username] The host authentication username\n * @param {String} [authentication.password] The host authentication password\n */\n setAuthentication (authentication = {}) {\n const { username, password } = authentication\n if (username) {\n this.authentication.set('username', username)\n }\n if (password) {\n this.authentication.set('password', password)\n }\n }\n\n /**\n * Set the exponentail backoff base\n * @param {Number} exponentailBackoffBase\n */\n setExponentailBackoffBase (exponentailBackoffBase) {\n this.exponentailBackoffBase = exponentailBackoffBase\n }\n\n /**\n * Get the exponentail backoff base\n * @return {Number} The exponentail backoff base\n */\n getExponentailBackoffBase () {\n return this.exponentailBackoffBase\n }\n\n /**\n * Set the exponentail backoff exponent\n * @param {Number} exponentailBackoffExponent\n */\n setExponentailBackoffExponent (exponentailBackoffExponent) {\n this.exponentailBackoffExponent = exponentailBackoffExponent\n }\n\n /**\n * Get the exponentail backoff exponent\n * @return {Number} The exponentail backoff exponent\n */\n getExponentailBackoffExponent () {\n return this.exponentailBackoffExponent\n }\n\n /**\n * Set the retryable error codes\n * @param {Set} retryableErrorCodes\n */\n setRetryableErrorCodes (retryableErrorCodes) {\n this.retryableErrorCodes = retryableErrorCodes\n }\n\n /**\n * Get the retryable error codes\n * @returns {Set}\n */\n getRetryableErrorCodes () {\n return this.retryableErrorCodes\n }\n\n /**\n * Set the retryable status codes\n * @param {Set} retryableStatusCodes\n */\n setRetryableStatusCodes (retryableStatusCodes) {\n this.retryableStatusCodes = retryableStatusCodes\n }\n\n /**\n * Get the retryable status codes\n * @returns {Set}\n */\n getRetryableStatusCodes () {\n return this.retryableStatusCodes\n }\n\n /**\n * Set the retryable http methods\n * @param {Set} retryableHttpMethods\n */\n setRetryableHttpMethods (retryableHttpMethods) {\n this.retryableHttpMethods = retryableHttpMethods\n }\n\n /**\n * Get the retryable http methods\n * @returns {Set}\n */\n getRetryableHttpMethods () {\n return this.retryableHttpMethods\n }\n\n /**\n * Set an http agent which is useful for http keepalive requests\n * @param {import('http').Agent} httpAgent An http agent\n */\n setHttpAgent (httpAgent) {\n this.httpAgent = httpAgent\n }\n\n /**\n * Get the set http agent\n * @returns {import('http').Agent|undefined} The https agent if it is set\n */\n getHttpAgent () {\n return this.httpAgent\n }\n\n /**\n * Set an https agent which is useful for https keepalive requests\n * @param {import('https').Agent} httpsAgent An https agent\n */\n setHttpsAgent (httpsAgent) {\n this.httpsAgent = httpsAgent\n }\n\n /**\n * Get the set https agent\n * @returns {import('https').Agent|undefined} The https agent if it is set\n */\n getHttpsAgent () {\n return this.httpsAgent\n }\n\n /**\n * Set the list of hosts\n * @param {String[]|String} hosts An array of RQLite hosts or a string\n * that will be split on \",\" to create an array of hosts, the first\n * host will be tried first when there are multiple hosts\n */\n setHosts (hosts) {\n this.hosts = !Array.isArray(hosts) ? String(hosts).split(',') : hosts\n this.hosts = this.hosts.reduce((acc, v) => {\n // Remove trailing slashed from hosts\n const host = String(v).trim().replace(/\\/$/, '')\n if (!host) {\n return acc\n }\n return acc.concat(host)\n }, [])\n }\n\n /**\n * Get the list of hosts\n * @returns {String[]} The list of hosts\n */\n getHosts () {\n return this.hosts\n }\n\n /**\n * Given a host string find the index of that host in the hosts\n * @param {String} host A host to find in hosts\n * @returns {Number} The found host index or -1 if not found\n */\n findHostIndex (host) {\n const parsedHostToFind = parseUrl(host)\n return this.getHosts().findIndex((v) => {\n const parsedHost = parseUrl(v)\n // Find a host where all the parsed fields match the requested host\n return ['hostname', 'protocol', 'port', 'path'].every((field) => parsedHostToFind[field] === parsedHost[field])\n })\n }\n\n /**\n * Get the current active host from the hosts array\n * @param {Boolean} useLeader If true use the first host which is always\n * the master, this is prefered for write operations\n * @returns {String} The active host\n */\n getActiveHost (useLeader) {\n // When useLeader is true we should just use the first host\n const activeHostIndex = useLeader ? this.getLeaderHostIndex() : this.getActiveHostIndex()\n return this.getHosts()[activeHostIndex]\n }\n\n /**\n * Set the active host index with check based on this.hosts\n * @param {Number} activeHostIndex The index\n * @returns {Number} The active host index\n */\n setActiveHostIndex (activeHostIndex) {\n if (!Number.isFinite(activeHostIndex)) {\n throw new Error('The activeHostIndex should be a finite number')\n }\n const totalHosts = this.getTotalHosts()\n if (activeHostIndex < 0) {\n // Don't allow an index less then zero\n this.activeHostIndex = 0\n } else if (activeHostIndex >= totalHosts) {\n // Don't allow an index greater then the length of the hosts\n this.activeHostIndex = totalHosts - 1\n } else {\n this.activeHostIndex = activeHostIndex\n }\n return this.activeHostIndex\n }\n\n /**\n * Get the host index for the leader node\n * @returns {Number} The host index for the leader node\n */\n getLeaderHostIndex () {\n return this.leaderHostIndex\n }\n\n /**\n * Set the index in the host array for the leader node\n * @param {Number} leaderHostIndex The index of the host that is the leader node\n * @returns {Number} The host index for the leader node\n */\n setLeaderHostIndex (leaderHostIndex) {\n if (!Number.isFinite(leaderHostIndex)) {\n throw new Error('The leaderHostIndex should be a finite number')\n }\n const totalHosts = this.getTotalHosts()\n if (leaderHostIndex < 0) {\n this.leaderHostIndex = 0\n } else if (leaderHostIndex > totalHosts) {\n this.leaderHostIndex = totalHosts - 1\n } else {\n this.leaderHostIndex = leaderHostIndex\n }\n return this.leaderHostIndex\n }\n\n /**\n * Get the active host index\n * @returns {Number} The active host index\n */\n getActiveHostIndex () {\n return this.activeHostIndex\n }\n\n /**\n * Set active host round robin value\n * @param {Boolean} activeHostRoundRobin If true setActiveHostIndex() will\n * perform a round robin\n */\n setActiveHostRoundRobin (activeHostRoundRobin) {\n if (typeof activeHostRoundRobin !== 'boolean') {\n throw new Error('The activeHostRoundRobin argument must be boolean')\n }\n this.activeHostRoundRobin = activeHostRoundRobin\n }\n\n /**\n * Get active host round robin value\n * @returns {Boolean} The value of activeHostRoundRobin\n */\n getActiveHostRoundRobin () {\n return this.activeHostRoundRobin\n }\n\n /**\n * Get the next active host index\n * @param {Number} [activeHostIndex] An optional paramater to provide the active host index\n * @returns {Number} The next active host index which will wrap around to zero\n */\n getNextActiveHostIndex (activeHostIndex = this.getActiveHostIndex()) {\n const totalHosts = this.getTotalHosts()\n const nextIndex = activeHostIndex + 1\n // If we are past the last index start back over at 1\n if (totalHosts === nextIndex) {\n return 0\n }\n return nextIndex\n }\n\n /**\n * Set the active host index to the next host using a\n * round robin strategy\n */\n setNextActiveHostIndex () {\n // Don't bother if we only have one host\n if (!this.getActiveHostRoundRobin()) {\n return\n }\n const totalHosts = this.getTotalHosts()\n if (this.getActiveHostRoundRobin() && totalHosts <= 1) {\n return\n }\n this.setActiveHostIndex(this.getNextActiveHostIndex())\n }\n\n /**\n * Get the total number of hosts\n * @returns {Number} The total number of hosts\n */\n getTotalHosts () {\n return this.getHosts().length\n }\n\n /**\n * Returns whether or not the uri passes a test for this.absoluteUriPattern\n * @returns {Boolean} True if the path is absolute\n */\n uriIsAbsolute (uri) {\n return this.absoluteUriPattern.test(uri)\n }\n\n /**\n * Returns true when the HTTP request is retryable\n * @param {Object} options The options\n * @param {Number} options.statusCode The HTTP status code\n * @param {String} options.errorCode The error code\n * @param {String} options.httpMethod The http method\n * @returns {Boolean} True if the request is retry able\n */\n requestIsRetryable (options = {}) {\n const {\n statusCode,\n errorCode,\n httpMethod,\n } = options\n // Honor strictly the http method\n if (!this.getRetryableHttpMethods().has(httpMethod)) {\n return false\n }\n if (statusCode && this.getRetryableStatusCodes().has(statusCode)) {\n return true\n }\n if (errorCode && this.getRetryableErrorCodes().has(errorCode)) {\n return true\n }\n return false\n }\n\n /**\n * Perform an HTTP request using the provided options\n * @param {HttpRequestOptions} [options={}] Options for the HTTP client\n * @returns {Promise<{status: Number, body: Object|String}>} An object with a status and body\n * property when stream is false and a stream when the stream option is true\n * @throws {ERROR_HTTP_REQUEST_MAX_REDIRECTS} When the maximum number of redirect has been reached\n */\n async fetch (options = {}) {\n const {\n body,\n headers = {},\n httpMethod = HTTP_METHOD_GET,\n query,\n stream = false,\n timeout = DEAULT_TIMEOUT,\n useLeader = false,\n retries = this.getTotalHosts() * 3,\n maxRedirects = 10,\n attempt = 0,\n retryAttempt = 0,\n redirectAttempt = 0,\n attemptHostIndex,\n exponentailBackoffExponent = this.getExponentailBackoffExponent(),\n exponentailBackoffBase = this.getExponentailBackoffBase(),\n httpAgent = this.getHttpAgent(),\n httpsAgent = this.getHttpsAgent(),\n } = options\n // Honor the supplied attemptHostIndex or get the active host\n const activeHost = Number.isFinite(attemptHostIndex) ? this.getHosts()[attemptHostIndex]\n : this.getActiveHost(useLeader)\n let { uri } = options\n if (!uri) {\n throw new Error('The uri option is required')\n }\n uri = this.uriIsAbsolute(uri) ? uri : `${activeHost}/${cleanPath(uri)}`\n try {\n let auth\n if (this.authentication.size) {\n auth = {\n username: this.authentication.get('username'),\n password: this.authentication.get('password'),\n }\n }\n const response = await axios({\n url: uri,\n auth,\n data: body,\n maxRedirects: 0, // Handle redirects manually to allow reposting data\n headers: createDefaultHeaders(headers),\n responseType: stream ? 'stream' : 'json',\n method: httpMethod,\n params: query,\n timeout,\n httpsAgent,\n httpAgent,\n paramsSerializer (params) {\n return stringifyQuery(params, { arrayFormat: 'brackets' })\n },\n })\n if (stream) {\n return response.data\n }\n return {\n body: response.data,\n status: response.status,\n }\n } catch (e) {\n const { response = {}, code: errorCode } = e\n const { status: responseStatus, headers: responseHeaders = {} } = response\n // Check if the error was a redirect\n const retryable = this.requestIsRetryable({\n statusCode: responseStatus,\n errorCode,\n httpMethod,\n })\n // Save the next active host index and pass it to retry manually\n let nextAttemptHostIndex = Number.isFinite(attemptHostIndex) ? attemptHostIndex\n : this.getActiveHostIndex()\n nextAttemptHostIndex += 1\n // We go past the last index start from zero\n if (nextAttemptHostIndex === this.getTotalHosts()) {\n nextAttemptHostIndex = 0\n }\n // First check if this is a redirect error\n if (responseStatus === 301 || responseStatus === 302) {\n // We maxed out on redirect attempts\n if (redirectAttempt >= maxRedirects) {\n throw ERROR_HTTP_REQUEST_MAX_REDIRECTS(`The maximum number of redirects ${maxRedirects} has been reached`)\n }\n const location = typeof responseHeaders === 'object' ? responseHeaders.location : undefined\n // If we were asked to use the leader, but got redirect the leader moved so remember it\n if (useLeader) {\n const newLeaderHostIndex = this.findHostIndex(location)\n // If the redirect exists in the hosts list remember it for next time\n if (newLeaderHostIndex > -1) {\n this.setLeaderHostIndex(newLeaderHostIndex)\n }\n }\n return this.fetch({\n ...options,\n uri: location,\n attempt: attempt + 1,\n redirectAttempt: redirectAttempt + 1,\n attemptHostIndex: nextAttemptHostIndex,\n })\n }\n if (retryable && retryAttempt < retries) {\n const waitTime = getWaitTimeExponential(\n retryAttempt,\n exponentailBackoffBase,\n exponentailBackoffExponent,\n )\n await new Promise((resolve) => {\n setTimeout(() => {\n resolve(undefined)\n }, waitTime)\n })\n return this.fetch({\n ...options,\n attempt: attempt + 1,\n retryAttempt: retryAttempt + 1,\n attemptHostIndex: nextAttemptHostIndex,\n })\n }\n throw e\n }\n }\n\n /**\n * Perform an HTTP GET request\n * @param {HttpRequestOptions} [options={}] The options\n * @see this.fetch() for options\n */\n async get (options = {}) {\n return this.fetch({ ...options, httpMethod: HTTP_METHOD_GET })\n }\n\n /**\n * Perform an HTTP POST request\n * @param {HttpRequestOptions} [options={}] The options\n * @see this.fetch() for options\n */\n async post (options = {}) {\n return this.fetch({ ...options, httpMethod: HTTP_METHOD_POST })\n }\n}\n"],"mappings":";;;;AAIA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,GAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;;;;AAIA,IAAAI,aAAA,GAAAJ,OAAA;;;;AAIA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA,gBAIoB,SAAAO,QAAAC,CAAA,EAAAC,CAAA,OAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,MAAAG,MAAA,CAAAE,qBAAA,OAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,EAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,UAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAAAQ,UAAA,MAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,CAAA,UAAAJ,CAAA,WAAAU,cAAAZ,CAAA,YAAAC,CAAA,MAAAA,CAAA,GAAAY,SAAA,CAAAC,MAAA,EAAAb,CAAA,SAAAC,CAAA,WAAAW,SAAA,CAAAZ,CAAA,IAAAY,SAAA,CAAAZ,CAAA,OAAAA,CAAA,OAAAF,OAAA,CAAAI,MAAA,C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Y,EAAEA,YAAY,GAAG,CAAC;YAC9BG,gBAAgB,EAAE0B,oBAAoB;UACvC,CAAC;QACJ;QACA,MAAMzK,CAAC;MACT,CAAC;EACH;;EAEA;AACF;AACA;AACA;AACA;EACQuJ,GAAGA,CAAE7G,OAAO,GAAG,CAAC,CAAC,EAAE,KAAAwI,MAAA,mBAAAvD,kBAAA,CAAA1G,OAAA;MACvB,OAAOiK,MAAI,CAACzD,KAAK,CAAA7G,aAAA,CAAAA,aAAA,KAAM8B,OAAO,SAAE6E,UAAU,EAAEQ,4BAAe,GAAE,CAAC;EAChE;;EAEA;AACF;AACA;AACA;AACA;EACQoD,IAAIA,CAAEzI,OAAO,GAAG,CAAC,CAAC,EAAE,KAAA0I,MAAA,mBAAAzD,kBAAA,CAAA1G,OAAA;MACxB,OAAOmK,MAAI,CAAC3D,KAAK,CAAA7G,aAAA,CAAAA,aAAA,KAAM8B,OAAO,SAAE6E,UAAU,EAAE8D,6BAAgB,GAAE,CAAC;EACjE;AACF,CAAC/J,OAAA,CAAAL,OAAA,GAAAsB,WAAA","ignoreList":[]}
@@ -11,7 +11,7 @@
11
11
  /**
12
12
  * Error codes which can be retried
13
13
  */
14
- const RETRYABLE_ERROR_CODES = new Set([
14
+ const RETRYABLE_ERROR_CODES = exports.RETRYABLE_ERROR_CODES = new Set([
15
15
  'EADDRINUSE',
16
16
  'EAI_AGAIN',
17
17
  'ECONNREFUSED',
@@ -24,13 +24,13 @@ const RETRYABLE_ERROR_CODES = new Set([
24
24
 
25
25
  /**
26
26
  * HTTP status codes which can be retried
27
- */exports.RETRYABLE_ERROR_CODES = RETRYABLE_ERROR_CODES;
28
- const RETRYABLE_STATUS_CODES = new Set([408, 413, 429, 500, 502, 503, 504, 521, 522, 524]);
27
+ */
28
+ const RETRYABLE_STATUS_CODES = exports.RETRYABLE_STATUS_CODES = new Set([408, 413, 429, 500, 502, 503, 504, 521, 522, 524]);
29
29
 
30
30
  /**
31
31
  * HTTP methods which can be retried
32
- */exports.RETRYABLE_STATUS_CODES = RETRYABLE_STATUS_CODES;
33
- const RETRYABLE_HTTP_METHODS = new Set([
32
+ */
33
+ const RETRYABLE_HTTP_METHODS = exports.RETRYABLE_HTTP_METHODS = new Set([
34
34
  _httpMethods.HTTP_METHOD_DELETE,
35
35
  _httpMethods.HTTP_METHOD_GET,
36
36
  _httpMethods.HTTP_METHOD_HEAD,
@@ -38,5 +38,5 @@ _httpMethods.HTTP_METHOD_OPTIONS,
38
38
  _httpMethods.HTTP_METHOD_PATCH,
39
39
  _httpMethods.HTTP_METHOD_POST,
40
40
  _httpMethods.HTTP_METHOD_PUT]
41
- );exports.RETRYABLE_HTTP_METHODS = RETRYABLE_HTTP_METHODS;
41
+ );
42
42
  //# sourceMappingURL=retryable.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"retryable.js","names":["_httpMethods","require","RETRYABLE_ERROR_CODES","Set","exports","RETRYABLE_STATUS_CODES","RETRYABLE_HTTP_METHODS","HTTP_METHOD_DELETE","HTTP_METHOD_GET","HTTP_METHOD_HEAD","HTTP_METHOD_OPTIONS","HTTP_METHOD_PATCH","HTTP_METHOD_POST","HTTP_METHOD_PUT"],"sources":["../../es6/http-request/retryable.js"],"sourcesContent":["import {\n HTTP_METHOD_DELETE,\n HTTP_METHOD_GET,\n HTTP_METHOD_HEAD,\n HTTP_METHOD_OPTIONS,\n HTTP_METHOD_PATCH,\n HTTP_METHOD_POST,\n HTTP_METHOD_PUT,\n} from './http-methods'\n\n/**\n * Error codes which can be retried\n */\nexport const RETRYABLE_ERROR_CODES = new Set([\n 'EADDRINUSE',\n 'EAI_AGAIN',\n 'ECONNREFUSED',\n 'ECONNRESET',\n 'ENETUNREACH',\n 'ENOTFOUND',\n 'EPIPE',\n 'ETIMEDOUT',\n])\n\n/**\n * HTTP status codes which can be retried\n */\nexport const RETRYABLE_STATUS_CODES = new Set([408, 413, 429, 500, 502, 503, 504, 521, 522, 524])\n\n/**\n * HTTP methods which can be retried\n */\nexport const RETRYABLE_HTTP_METHODS = new Set([\n HTTP_METHOD_DELETE,\n HTTP_METHOD_GET,\n HTTP_METHOD_HEAD,\n HTTP_METHOD_OPTIONS,\n HTTP_METHOD_PATCH,\n HTTP_METHOD_POST,\n HTTP_METHOD_PUT,\n])\n"],"mappings":"oLAAA,IAAAA,YAAA,GAAAC,OAAA;;;;;;;;;;AAUA;AACA;AACA;AACO,MAAMC,qBAAqB,GAAG,IAAIC,GAAG,CAAC;AAC3C,YAAY;AACZ,WAAW;AACX,cAAc;AACd,YAAY;AACZ,aAAa;AACb,WAAW;AACX,OAAO;AACP,WAAW;AACZ,CAAC;;AAEF;AACA;AACA,GAFAC,OAAA,CAAAF,qBAAA,GAAAA,qBAAA;AAGO,MAAMG,sBAAsB,GAAG,IAAIF,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;;AAEjG;AACA;AACA,GAFAC,OAAA,CAAAC,sBAAA,GAAAA,sBAAA;AAGO,MAAMC,sBAAsB,GAAG,IAAIH,GAAG,CAAC;AAC5CI,+BAAkB;AAClBC,4BAAe;AACfC,6BAAgB;AAChBC,gCAAmB;AACnBC,8BAAiB;AACjBC,6BAAgB;AAChBC,4BAAe;AAChB,CAAC,CAAAT,OAAA,CAAAE,sBAAA,GAAAA,sBAAA"}
1
+ {"version":3,"file":"retryable.js","names":["_httpMethods","require","RETRYABLE_ERROR_CODES","exports","Set","RETRYABLE_STATUS_CODES","RETRYABLE_HTTP_METHODS","HTTP_METHOD_DELETE","HTTP_METHOD_GET","HTTP_METHOD_HEAD","HTTP_METHOD_OPTIONS","HTTP_METHOD_PATCH","HTTP_METHOD_POST","HTTP_METHOD_PUT"],"sources":["../../es6/http-request/retryable.js"],"sourcesContent":["import {\n HTTP_METHOD_DELETE,\n HTTP_METHOD_GET,\n HTTP_METHOD_HEAD,\n HTTP_METHOD_OPTIONS,\n HTTP_METHOD_PATCH,\n HTTP_METHOD_POST,\n HTTP_METHOD_PUT,\n} from './http-methods'\n\n/**\n * Error codes which can be retried\n */\nexport const RETRYABLE_ERROR_CODES = new Set([\n 'EADDRINUSE',\n 'EAI_AGAIN',\n 'ECONNREFUSED',\n 'ECONNRESET',\n 'ENETUNREACH',\n 'ENOTFOUND',\n 'EPIPE',\n 'ETIMEDOUT',\n])\n\n/**\n * HTTP status codes which can be retried\n */\nexport const RETRYABLE_STATUS_CODES = new Set([408, 413, 429, 500, 502, 503, 504, 521, 522, 524])\n\n/**\n * HTTP methods which can be retried\n */\nexport const RETRYABLE_HTTP_METHODS = new Set([\n HTTP_METHOD_DELETE,\n HTTP_METHOD_GET,\n HTTP_METHOD_HEAD,\n HTTP_METHOD_OPTIONS,\n HTTP_METHOD_PATCH,\n HTTP_METHOD_POST,\n HTTP_METHOD_PUT,\n])\n"],"mappings":"oLAAA,IAAAA,YAAA,GAAAC,OAAA;;;;;;;;;;AAUA;AACA;AACA;AACO,MAAMC,qBAAqB,GAAAC,OAAA,CAAAD,qBAAA,GAAG,IAAIE,GAAG,CAAC;AAC3C,YAAY;AACZ,WAAW;AACX,cAAc;AACd,YAAY;AACZ,aAAa;AACb,WAAW;AACX,OAAO;AACP,WAAW;AACZ,CAAC;;AAEF;AACA;AACA;AACO,MAAMC,sBAAsB,GAAAF,OAAA,CAAAE,sBAAA,GAAG,IAAID,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;;AAEjG;AACA;AACA;AACO,MAAME,sBAAsB,GAAAH,OAAA,CAAAG,sBAAA,GAAG,IAAIF,GAAG,CAAC;AAC5CG,+BAAkB;AAClBC,4BAAe;AACfC,6BAAgB;AAChBC,gCAAmB;AACnBC,8BAAiB;AACjBC,6BAAgB;AAChBC,4BAAe;AAChB,CAAC","ignoreList":[]}
package/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;
1
+ "use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports, "__esModule", { value: true });Object.defineProperty(exports, "BackupApiClient", { enumerable: true, get: function get() {return _backup.default;} });Object.defineProperty(exports, "DataApiClient", { enumerable: true, get: function get() {return _data.default;} });Object.defineProperty(exports, "StatusApiClient", { enumerable: true, get: function get() {return _status.default;} });exports.default = void 0;
2
2
 
3
3
 
4
4
 
@@ -7,8 +7,14 @@ var _backup = _interopRequireDefault(require("./api/backup"));
7
7
  var _status = _interopRequireDefault(require("./api/status")); /**
8
8
  * RQLite JS client which export all of the api clients
9
9
  * @module rqlite-js
10
- */var _default = { DataApiClient: _data.default,
10
+ */var _default = exports.default =
11
+
12
+
13
+
14
+
15
+ {
16
+ DataApiClient: _data.default,
11
17
  BackupApiClient: _backup.default,
12
18
  StatusApiClient: _status.default
13
- };exports.default = _default;module.exports = exports.default;
19
+ };
14
20
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_data","_interopRequireDefault","require","_backup","_status","_default","DataApiClient","BackupApiClient","StatusApiClient","exports","default","module"],"sources":["../es6/index.js"],"sourcesContent":["/**\n * RQLite JS client which export all of the api clients\n * @module rqlite-js\n */\nimport DataApiClient from './api/data'\nimport BackupApiClient from './api/backup'\nimport StatusApiClient from './api/status'\n\nexport default {\n DataApiClient,\n BackupApiClient,\n StatusApiClient,\n}\n"],"mappings":";;;;AAIA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAH,sBAAA,CAAAC,OAAA,kBAA0C,CAN1C;AACA;AACA;AACA,GAHA,IAAAG,QAAA,GAQe,EACbC,aAAa,EAAbA,aAAa;EACbC,eAAe,EAAfA,eAAe;EACfC,eAAe,EAAfA;AACF,CAAC,CAAAC,OAAA,CAAAC,OAAA,GAAAL,QAAA,CAAAM,MAAA,CAAAF,OAAA,GAAAA,OAAA,CAAAC,OAAA"}
1
+ {"version":3,"file":"index.js","names":["_data","_interopRequireDefault","require","_backup","_status","_default","exports","default","DataApiClient","BackupApiClient","StatusApiClient"],"sources":["../es6/index.js"],"sourcesContent":["/**\n * RQLite JS client which export all of the api clients\n * @module rqlite-js\n */\nimport DataApiClient from './api/data'\nimport BackupApiClient from './api/backup'\nimport StatusApiClient from './api/status'\n\nexport {\n DataApiClient,\n BackupApiClient,\n StatusApiClient,\n}\n\nexport default {\n DataApiClient,\n BackupApiClient,\n StatusApiClient,\n}\n"],"mappings":";;;;AAIA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAH,sBAAA,CAAAC,OAAA,kBAA0C,CAN1C;AACA;AACA;AACA,GAHA,IAAAG,QAAA,GAAAC,OAAA,CAAAC,OAAA;;;;;AAce;EACbC,aAAa,EAAbA,aAAa;EACbC,eAAe,EAAfA,eAAe;EACfC,eAAe,EAAfA;AACF,CAAC","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rqlite-js",
3
- "version": "2.5.6",
3
+ "version": "2.5.7",
4
4
  "description": "A client library for RQLite written in Javascript that works in NodeJS or the browser.",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -37,28 +37,30 @@
37
37
  },
38
38
  "homepage": "https://github.com/rqlite/rqlite-js#readme",
39
39
  "devDependencies": {
40
- "@babel/cli": "^7.22.5",
41
- "@babel/core": "^7.22.5",
42
- "@babel/eslint-parser": "^7.22.5",
40
+ "@babel/cli": "^7.26.4",
41
+ "@babel/core": "^7.26.0",
42
+ "@babel/eslint-parser": "^7.25.9",
43
43
  "@babel/plugin-proposal-class-properties": "^7.18.6",
44
- "@babel/plugin-transform-runtime": "^7.22.5",
45
- "@babel/preset-env": "^7.22.5",
46
- "@babel/register": "^7.22.5",
47
- "@babel/runtime": "^7.22.5",
44
+ "@babel/plugin-transform-runtime": "^7.25.9",
45
+ "@babel/preset-env": "^7.26.0",
46
+ "@babel/register": "^7.25.9",
47
+ "@babel/runtime": "^7.26.0",
48
48
  "babel-plugin-add-module-exports": "^1.0.4",
49
- "chai": "^4.3.7",
50
- "chai-as-promised": "^7.1.1",
51
- "eslint": "^8.43.0",
49
+ "chai": "^4.5.0",
50
+ "chai-as-promised": "^7.1.2",
51
+ "eslint": "^8.57.1",
52
52
  "eslint-config-airbnb-base": "^15.0.0",
53
53
  "eslint-plugin-babel": "^5.3.1",
54
- "eslint-plugin-import": "^2.22.1",
55
- "eslint-plugin-mocha": "^10.1.0",
56
- "mocha": "^10.2.0",
57
- "nock": "^13.3.1",
58
- "standard-version": "^9.3.0"
54
+ "eslint-plugin-import": "^2.31.0",
55
+ "eslint-plugin-mocha": "^10.5.0",
56
+ "mocha": "^10.8.2",
57
+ "nock": "^13.5.6",
58
+ "retry-as-promised": "^7.0.4",
59
+ "standard-version": "^9.5.0"
59
60
  },
60
61
  "dependencies": {
61
- "axios": "^1.4.0",
62
- "qs": "^6.11.2"
62
+ "axios": "^1.7.9",
63
+ "install": "^0.13.0",
64
+ "qs": "^6.13.1"
63
65
  }
64
66
  }