rqlite-js 2.5.7 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/README.md +174 -155
  2. package/lib/api/backup/index.js +46 -46
  3. package/lib/api/backup/index.js.map +1 -1
  4. package/lib/api/backup/test.unit.js +45 -0
  5. package/lib/api/backup/test.unit.js.map +1 -0
  6. package/lib/api/backup-formats.js +16 -0
  7. package/lib/api/backup-formats.js.map +1 -0
  8. package/lib/api/client/index.js +63 -42
  9. package/lib/api/client/index.js.map +1 -1
  10. package/lib/api/client/test.unit.js +53 -0
  11. package/lib/api/client/test.unit.js.map +1 -0
  12. package/lib/api/consistency-levels.js +30 -0
  13. package/lib/api/consistency-levels.js.map +1 -0
  14. package/lib/api/data/index.js +50 -72
  15. package/lib/api/data/index.js.map +1 -1
  16. package/lib/api/data/test.unit.js +98 -0
  17. package/lib/api/data/test.unit.js.map +1 -0
  18. package/lib/api/paths.js +33 -0
  19. package/lib/api/paths.js.map +1 -0
  20. package/lib/api/query-params.js +43 -0
  21. package/lib/api/query-params.js.map +1 -0
  22. package/lib/api/results/data-result-error.js +39 -10
  23. package/lib/api/results/data-result-error.js.map +1 -1
  24. package/lib/api/results/data-result.js +57 -51
  25. package/lib/api/results/data-result.js.map +1 -1
  26. package/lib/api/results/data-results.js +50 -30
  27. package/lib/api/results/data-results.js.map +1 -1
  28. package/lib/api/results/index.js +1 -1
  29. package/lib/api/results/result-fields.js +47 -0
  30. package/lib/api/results/result-fields.js.map +1 -0
  31. package/lib/api/results/test.unit.js +238 -0
  32. package/lib/api/results/test.unit.js.map +1 -0
  33. package/lib/api/status/index.js +40 -28
  34. package/lib/api/status/index.js.map +1 -1
  35. package/lib/api/status/test.unit.js +57 -0
  36. package/lib/api/status/test.unit.js.map +1 -0
  37. package/lib/http-request/auth-keys.js +15 -0
  38. package/lib/http-request/auth-keys.js.map +1 -0
  39. package/lib/http-request/http-headers.js +20 -0
  40. package/lib/http-request/http-headers.js.map +1 -0
  41. package/lib/http-request/index.js +291 -271
  42. package/lib/http-request/index.js.map +1 -1
  43. package/lib/http-request/test.unit.js +560 -0
  44. package/lib/http-request/test.unit.js.map +1 -0
  45. package/lib/index.js +23 -4
  46. package/lib/index.js.map +1 -1
  47. package/lib/test/api-data-execute-nock.js +142 -0
  48. package/lib/test/api-data-execute-nock.js.map +1 -0
  49. package/lib/test/api-data-query-nock.js +210 -0
  50. package/lib/test/api-data-query-nock.js.map +1 -0
  51. package/lib/test/backups/backup-nock.js +29 -0
  52. package/lib/test/backups/backup-nock.js.map +1 -0
  53. package/lib/test/backups/restore-nock.js +30 -0
  54. package/lib/test/backups/restore-nock.js.map +1 -0
  55. package/lib/test/env.js +15 -0
  56. package/lib/test/env.js.map +1 -0
  57. package/lib/test/unit/index.unit.js +27 -0
  58. package/lib/test/unit/index.unit.js.map +1 -0
  59. package/lib/test.integration.js +238 -0
  60. package/lib/test.integration.js.map +1 -0
  61. package/package.json +33 -23
  62. package/.eslintrc +0 -20
  63. package/.travis.yml +0 -24
  64. package/es6/api/backup/index.js +0 -71
  65. package/es6/api/client/index.js +0 -83
  66. package/es6/api/data/index.js +0 -129
  67. package/es6/api/results/data-result-error.js +0 -32
  68. package/es6/api/results/data-result.js +0 -134
  69. package/es6/api/results/data-results.js +0 -121
  70. package/es6/api/results/index.js +0 -7
  71. package/es6/api/status/index.js +0 -54
  72. package/es6/http-request/content-types.js +0 -4
  73. package/es6/http-request/errors.js +0 -16
  74. package/es6/http-request/http-methods.js +0 -39
  75. package/es6/http-request/index.js +0 -743
  76. package/es6/http-request/retryable.js +0 -41
  77. package/es6/index.js +0 -19
  78. package/jsconfig.json +0 -19
@@ -0,0 +1,238 @@
1
+ "use strict";var _chai = require("chai");
2
+ var _ = require(".");
3
+
4
+ describe('api data results', () => {
5
+ describe('DataResultError', () => {
6
+ it('should create a JS object', () => {
7
+ const message = 'test';
8
+ const dataResultError = new _.DataResultError(message);
9
+ _chai.assert.deepEqual(dataResultError.toObject(), { error: message });
10
+ });
11
+ it('should create a JSON object', () => {
12
+ const message = 'test';
13
+ const dataResultError = new _.DataResultError(message);
14
+ _chai.assert.equal(dataResultError.toString(), JSON.stringify({ error: message }));
15
+ });
16
+ it('should have the error name and code DataResultError', () => {
17
+ const message = 'test';
18
+ const dataResultError = new _.DataResultError(message);
19
+ _chai.assert.propertyVal(dataResultError, 'name', 'DataResultError');
20
+ _chai.assert.propertyVal(dataResultError, 'code', 'DataResultError');
21
+ });
22
+ it('should include error_v2 when provided', () => {
23
+ const message = 'incomplete input';
24
+ const errorV2 = {
25
+ message,
26
+ sqlite: { code: 1, extended_code: 1 }
27
+ };
28
+ const dataResultError = new _.DataResultError(message, errorV2);
29
+ _chai.assert.deepEqual(dataResultError.getErrorV2(), errorV2);
30
+ _chai.assert.deepEqual(dataResultError.toObject(), {
31
+ error: message,
32
+ error_v2: errorV2
33
+ });
34
+ });
35
+ });
36
+ describe('DataResult', () => {
37
+ it('should throw an error when a result argument is missing', () => {
38
+ _chai.assert.throws(() => new _.DataResult(), 'The result argument is required to be an object');
39
+ });
40
+ it('should throw an error when a valuesIndex argument is provided a letter', () => {
41
+ _chai.assert.throws(() => new _.DataResult({}, 'a'), 'The valuesIndex argument is required to be a finite number when provided');
42
+ });
43
+ it('should create a JS object', () => {
44
+ const result = {
45
+ columns: ['id', 'name'],
46
+ types: ['integer', 'text'],
47
+ values: [
48
+ [1, 'fiona'],
49
+ [2, 'justin']],
50
+
51
+ time: 0.0150043
52
+ };
53
+ const dataResult = new _.DataResult(result, 0);
54
+ _chai.assert.deepEqual(dataResult.toObject(), { id: 1, name: 'fiona' });
55
+ });
56
+ it('should create a an Array of values', () => {
57
+ const result = {
58
+ columns: ['id', 'name'],
59
+ types: ['integer', 'text'],
60
+ values: [
61
+ [1, 'fiona'],
62
+ [2, 'justin']],
63
+
64
+ time: 0.0150043
65
+ };
66
+ const dataResult = new _.DataResult(result, 0);
67
+ _chai.assert.deepEqual(dataResult.toArray(), [1, 'fiona']);
68
+ });
69
+ it('should create a an array of columns', () => {
70
+ const result = {
71
+ columns: ['id', 'name'],
72
+ types: ['integer', 'text'],
73
+ values: [
74
+ [1, 'fiona'],
75
+ [2, 'justin']],
76
+
77
+ time: 0.0150043
78
+ };
79
+ const dataResult = new _.DataResult(result, 0);
80
+ _chai.assert.deepEqual(dataResult.toColumnsArray(), ['id', 'name']);
81
+ });
82
+ it('should get the last_insert_id, last insert id, and rows affected', () => {
83
+ const time = 0.123424324;
84
+ const rowsAffected = 2;
85
+ const lastInsertId = 201;
86
+ const result = {
87
+ columns: ['id', 'name'],
88
+ types: ['integer', 'text'],
89
+ values: [
90
+ [1, 'fiona'],
91
+ [2, 'justin']],
92
+
93
+ time,
94
+ rows_affected: rowsAffected,
95
+ last_insert_id: lastInsertId
96
+ };
97
+ const dataResult = new _.DataResult(result, 0);
98
+ _chai.assert.equal(dataResult.getTime(), time, 'time');
99
+ _chai.assert.equal(dataResult.getRowsAffected(), rowsAffected, 'rows_affected');
100
+ _chai.assert.equal(dataResult.getLastInsertId(), lastInsertId, 'last_insert_id');
101
+ });
102
+ });
103
+ describe('DataResults', () => {
104
+ it('should throw an error when a data argument is not provided to the constructor', () => {
105
+ _chai.assert.throws(() => new _.DataResults(), 'The data argument is required to be an object');
106
+ });
107
+ it('should return false on method hasError when results are empty', () => {
108
+ const dataResults = new _.DataResults({ results: [] });
109
+ _chai.assert.isFalse(dataResults.hasError());
110
+ });
111
+ it('should return true on method hasError when results have an error', () => {
112
+ const dataResults = new _.DataResults({
113
+ results: [{
114
+ error: 'There was an error'
115
+ }]
116
+ });
117
+ _chai.assert.isTrue(dataResults.hasError());
118
+ });
119
+ it('should return true on method hasError when results have an error', () => {
120
+ const error = 'There was an error';
121
+ const dataResults = new _.DataResults({
122
+ results: [{
123
+ error
124
+ }]
125
+ });
126
+ const dataResultError = dataResults.getFirstError();
127
+ _chai.assert.instanceOf(dataResultError, _.DataResultError);
128
+ _chai.assert.equal(dataResultError.message, error);
129
+ });
130
+ it('should capture error_v2 from rqlite v10+ responses', () => {
131
+ const error = 'incomplete input';
132
+ const errorV2 = {
133
+ message: error,
134
+ sqlite: { code: 1, extended_code: 1 }
135
+ };
136
+ const dataResults = new _.DataResults({
137
+ results: [{
138
+ error,
139
+ error_v2: errorV2
140
+ }]
141
+ });
142
+ const dataResultError = dataResults.getFirstError();
143
+ _chai.assert.instanceOf(dataResultError, _.DataResultError);
144
+ _chai.assert.deepEqual(dataResultError.getErrorV2(), errorV2);
145
+ _chai.assert.deepEqual(dataResultError.toObject(), {
146
+ error,
147
+ error_v2: errorV2
148
+ });
149
+ });
150
+ it('should create a list of data results and get the time', () => {
151
+ const time = 0.8234;
152
+ const results = [
153
+ {
154
+ columns: ['id', 'name'],
155
+ types: ['integer', 'text'],
156
+ values: [
157
+ [1, 'fiona'],
158
+ [2, 'justin']],
159
+
160
+ time: 0.0150043
161
+ },
162
+ {
163
+ columns: ['id', 'name'],
164
+ types: ['integer', 'text'],
165
+ values: [
166
+ [5, 'bob'],
167
+ [10, 'sally']],
168
+
169
+ time: 0.0150043
170
+ }];
171
+
172
+ const dataResults = new _.DataResults({ results, time });
173
+ const expected = [
174
+ { id: 1, name: 'fiona' },
175
+ { id: 2, name: 'justin' },
176
+ { id: 5, name: 'bob' },
177
+ { id: 10, name: 'sally' }];
178
+
179
+ _chai.assert.deepEqual(dataResults.toArray(), expected);
180
+ _chai.assert.equal(dataResults.getTime(), time);
181
+ });
182
+ it('should create a list of data result errors', () => {
183
+ const results = [
184
+ { error: 'Test error 1' },
185
+ { error: 'Test error 2' }];
186
+
187
+ const dataResults = new _.DataResults({ results });
188
+ const expected = [
189
+ { error: 'Test error 1' },
190
+ { error: 'Test error 2' }];
191
+
192
+ _chai.assert.deepEqual(dataResults.toArray(), expected);
193
+ });
194
+ it('should create a list of data results and errors', () => {
195
+ const results = [
196
+ {
197
+ columns: ['id', 'name'],
198
+ types: ['integer', 'text'],
199
+ values: [
200
+ [1, 'fiona'],
201
+ [2, 'justin']],
202
+
203
+ time: 0.0150043
204
+ },
205
+ { error: 'Test error 2' }];
206
+
207
+ const dataResults = new _.DataResults({ results });
208
+ const expected = [
209
+ { id: 1, name: 'fiona' },
210
+ { id: 2, name: 'justin' },
211
+ { error: 'Test error 2' }];
212
+
213
+ _chai.assert.deepEqual(dataResults.toArray(), expected);
214
+ });
215
+ it('should create a string of data results and errors', () => {
216
+ const results = [
217
+ {
218
+ columns: ['id', 'name'],
219
+ types: ['integer', 'text'],
220
+ values: [
221
+ [1, 'fiona'],
222
+ [2, 'justin']],
223
+
224
+ time: 0.0150043
225
+ },
226
+ { error: 'Test error 2' }];
227
+
228
+ const dataResults = new _.DataResults({ results });
229
+ const expected = [
230
+ { id: 1, name: 'fiona' },
231
+ { id: 2, name: 'justin' },
232
+ { error: 'Test error 2' }];
233
+
234
+ _chai.assert.equal(dataResults.toString(), JSON.stringify(expected));
235
+ });
236
+ });
237
+ });
238
+ //# sourceMappingURL=test.unit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test.unit.js","names":["_chai","require","_","describe","it","message","dataResultError","DataResultError","assert","deepEqual","toObject","error","equal","toString","JSON","stringify","propertyVal","errorV2","sqlite","code","extended_code","getErrorV2","error_v2","throws","DataResult","result","columns","types","values","time","dataResult","id","name","toArray","toColumnsArray","rowsAffected","lastInsertId","rows_affected","last_insert_id","getTime","getRowsAffected","getLastInsertId","DataResults","dataResults","results","isFalse","hasError","isTrue","getFirstError","instanceOf","expected"],"sources":["../../../es6/api/results/test.unit.js"],"sourcesContent":["import { assert } from 'chai'\nimport { DataResult, DataResultError, DataResults } from '.'\n\ndescribe('api data results', () => {\n describe('DataResultError', () => {\n it('should create a JS object', () => {\n const message = 'test'\n const dataResultError = new DataResultError(message)\n assert.deepEqual(dataResultError.toObject(), { error: message })\n })\n it('should create a JSON object', () => {\n const message = 'test'\n const dataResultError = new DataResultError(message)\n assert.equal(dataResultError.toString(), JSON.stringify({ error: message }))\n })\n it('should have the error name and code DataResultError', () => {\n const message = 'test'\n const dataResultError = new DataResultError(message)\n assert.propertyVal(dataResultError, 'name', 'DataResultError')\n assert.propertyVal(dataResultError, 'code', 'DataResultError')\n })\n it('should include error_v2 when provided', () => {\n const message = 'incomplete input'\n const errorV2 = {\n message,\n sqlite: { code: 1, extended_code: 1 },\n }\n const dataResultError = new DataResultError(message, errorV2)\n assert.deepEqual(dataResultError.getErrorV2(), errorV2)\n assert.deepEqual(dataResultError.toObject(), {\n error: message,\n error_v2: errorV2,\n })\n })\n })\n describe('DataResult', () => {\n it('should throw an error when a result argument is missing', () => {\n assert.throws(() => new DataResult(), 'The result argument is required to be an object')\n })\n it('should throw an error when a valuesIndex argument is provided a letter', () => {\n assert.throws(() => new DataResult({}, 'a'), 'The valuesIndex argument is required to be a finite number when provided')\n })\n it('should create a JS object', () => {\n const result = {\n columns: ['id', 'name'],\n types: ['integer', 'text'],\n values: [\n [1, 'fiona'],\n [2, 'justin'],\n ],\n time: 0.0150043,\n }\n const dataResult = new DataResult(result, 0)\n assert.deepEqual(dataResult.toObject(), { id: 1, name: 'fiona' })\n })\n it('should create a an Array of values', () => {\n const result = {\n columns: ['id', 'name'],\n types: ['integer', 'text'],\n values: [\n [1, 'fiona'],\n [2, 'justin'],\n ],\n time: 0.0150043,\n }\n const dataResult = new DataResult(result, 0)\n assert.deepEqual(dataResult.toArray(), [1, 'fiona'])\n })\n it('should create a an array of columns', () => {\n const result = {\n columns: ['id', 'name'],\n types: ['integer', 'text'],\n values: [\n [1, 'fiona'],\n [2, 'justin'],\n ],\n time: 0.0150043,\n }\n const dataResult = new DataResult(result, 0)\n assert.deepEqual(dataResult.toColumnsArray(), ['id', 'name'])\n })\n it('should get the last_insert_id, last insert id, and rows affected', () => {\n const time = 0.123424324\n const rowsAffected = 2\n const lastInsertId = 201\n const result = {\n columns: ['id', 'name'],\n types: ['integer', 'text'],\n values: [\n [1, 'fiona'],\n [2, 'justin'],\n ],\n time,\n rows_affected: rowsAffected,\n last_insert_id: lastInsertId,\n }\n const dataResult = new DataResult(result, 0)\n assert.equal(dataResult.getTime(), time, 'time')\n assert.equal(dataResult.getRowsAffected(), rowsAffected, 'rows_affected')\n assert.equal(dataResult.getLastInsertId(), lastInsertId, 'last_insert_id')\n })\n })\n describe('DataResults', () => {\n it('should throw an error when a data argument is not provided to the constructor', () => {\n assert.throws(() => new DataResults(), 'The data argument is required to be an object')\n })\n it('should return false on method hasError when results are empty', () => {\n const dataResults = new DataResults({ results: [] })\n assert.isFalse(dataResults.hasError())\n })\n it('should return true on method hasError when results have an error', () => {\n const dataResults = new DataResults({\n results: [{\n error: 'There was an error',\n }],\n })\n assert.isTrue(dataResults.hasError())\n })\n it('should return true on method hasError when results have an error', () => {\n const error = 'There was an error'\n const dataResults = new DataResults({\n results: [{\n error,\n }],\n })\n const dataResultError = dataResults.getFirstError()\n assert.instanceOf(dataResultError, DataResultError)\n assert.equal(dataResultError.message, error)\n })\n it('should capture error_v2 from rqlite v10+ responses', () => {\n const error = 'incomplete input'\n const errorV2 = {\n message: error,\n sqlite: { code: 1, extended_code: 1 },\n }\n const dataResults = new DataResults({\n results: [{\n error,\n error_v2: errorV2,\n }],\n })\n const dataResultError = dataResults.getFirstError()\n assert.instanceOf(dataResultError, DataResultError)\n assert.deepEqual(dataResultError.getErrorV2(), errorV2)\n assert.deepEqual(dataResultError.toObject(), {\n error,\n error_v2: errorV2,\n })\n })\n it('should create a list of data results and get the time', () => {\n const time = 0.8234\n const results = [\n {\n columns: ['id', 'name'],\n types: ['integer', 'text'],\n values: [\n [1, 'fiona'],\n [2, 'justin'],\n ],\n time: 0.0150043,\n },\n {\n columns: ['id', 'name'],\n types: ['integer', 'text'],\n values: [\n [5, 'bob'],\n [10, 'sally'],\n ],\n time: 0.0150043,\n },\n ]\n const dataResults = new DataResults({ results, time })\n const expected = [\n { id: 1, name: 'fiona' },\n { id: 2, name: 'justin' },\n { id: 5, name: 'bob' },\n { id: 10, name: 'sally' },\n ]\n assert.deepEqual(dataResults.toArray(), expected)\n assert.equal(dataResults.getTime(), time)\n })\n it('should create a list of data result errors', () => {\n const results = [\n { error: 'Test error 1' },\n { error: 'Test error 2' },\n ]\n const dataResults = new DataResults({ results })\n const expected = [\n { error: 'Test error 1' },\n { error: 'Test error 2' },\n ]\n assert.deepEqual(dataResults.toArray(), expected)\n })\n it('should create a list of data results and errors', () => {\n const results = [\n {\n columns: ['id', 'name'],\n types: ['integer', 'text'],\n values: [\n [1, 'fiona'],\n [2, 'justin'],\n ],\n time: 0.0150043,\n },\n { error: 'Test error 2' },\n ]\n const dataResults = new DataResults({ results })\n const expected = [\n { id: 1, name: 'fiona' },\n { id: 2, name: 'justin' },\n { error: 'Test error 2' },\n ]\n assert.deepEqual(dataResults.toArray(), expected)\n })\n it('should create a string of data results and errors', () => {\n const results = [\n {\n columns: ['id', 'name'],\n types: ['integer', 'text'],\n values: [\n [1, 'fiona'],\n [2, 'justin'],\n ],\n time: 0.0150043,\n },\n { error: 'Test error 2' },\n ]\n const dataResults = new DataResults({ results })\n const expected = [\n { id: 1, name: 'fiona' },\n { id: 2, name: 'justin' },\n { error: 'Test error 2' },\n ]\n assert.equal(dataResults.toString(), JSON.stringify(expected))\n })\n })\n})\n"],"mappings":"aAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,CAAA,GAAAD,OAAA;;AAEAE,QAAQ,CAAC,kBAAkB,EAAE,MAAM;EACjCA,QAAQ,CAAC,iBAAiB,EAAE,MAAM;IAChCC,EAAE,CAAC,2BAA2B,EAAE,MAAM;MACpC,MAAMC,OAAO,GAAG,MAAM;MACtB,MAAMC,eAAe,GAAG,IAAIC,iBAAe,CAACF,OAAO,CAAC;MACpDG,YAAM,CAACC,SAAS,CAACH,eAAe,CAACI,QAAQ,CAAC,CAAC,EAAE,EAAEC,KAAK,EAAEN,OAAO,CAAC,CAAC,CAAC;IAClE,CAAC,CAAC;IACFD,EAAE,CAAC,6BAA6B,EAAE,MAAM;MACtC,MAAMC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Default = require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports, "__esModule", { value: true });exports.default = exports.PATH_STATUS = 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 });Object.defineProperty(exports, "PATH_STATUS", { enumerable: true, get: function () {return _paths.PATH_STATUS;} });exports.default = void 0;
2
2
 
3
3
 
4
4
 
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;} /**
5
+
6
+ var _client = _interopRequireDefault(require("../client"));
7
+ var _httpMethods = require("../../http-request/http-methods");
8
+ var _paths = require("../paths"); /**
6
9
  * Status api client to perform RQLite status and diagnostics operations
7
10
  * @module api/status
11
+ * @see https://rqlite.io/docs/guides/monitoring-rqlite/
8
12
  */ /**
9
13
  * @typedef {Object} HttpResponse
10
- * @property {Object} Body The HTTP response body parsed by JSON.parse()
11
- * @property {Number} statusCode The HTTP response code
14
+ * @property {Object|String} body The HTTP response body
15
+ * @property {Number} status The HTTP response status code
12
16
  */
17
+
13
18
  /**
14
- * @typedef {Object} StatusAllHostsResponse
15
- * @property {HttpResponse} response An HTTP response
16
- * @property {String} host The host name
19
+ * @typedef {Object} StatusRequestOptions
20
+ * @property {Boolean} [raw] If true return the raw http response
21
+ * @property {Number} [attemptHostIndex] Host index to query (used by statusAllHosts)
22
+ * @property {Boolean} [useLeader] Prefer the leader host
17
23
  */
18
24
 
19
25
  /**
20
- * The RQLite status api path
26
+ * @typedef {Object} StatusAllHostsResponse
27
+ * @property {HttpResponse} response An HTTP response
28
+ * @property {String} host The host name
21
29
  */
22
- const PATH_STATUS = exports.PATH_STATUS = '/status';
23
30
 
24
31
  /**
25
- * Data api client to perform RQLite queries
32
+ * Data api client to perform RQLite status queries
26
33
  */
27
34
  class StatusApiClient extends _client.default {
28
35
  /**
29
- * Get the RQLite server status which defaults to the master host
30
- * @param {Object} [options={}] RQLite api options
31
- * @returns {HttpResponse} An HTTP response object
36
+ * Get the RQLite server status which defaults to the leader host
37
+ * @param {StatusRequestOptions} [options={}] RQLite api options
38
+ * @returns {Promise<HttpResponse>} An HTTP response object
39
+ * @see https://rqlite.io/docs/guides/monitoring-rqlite/
32
40
  */
33
- status(options = {}) {var _superprop_getGet = () => super.get,_this = this;return (0, _asyncToGenerator2.default)(function* () {
34
- return _superprop_getGet().call(_this, PATH_STATUS, _objectSpread({ useLeader: true }, options));})();
41
+ async status(options = {}) {
42
+ return this.fetch({
43
+ ...options,
44
+ uri: _paths.PATH_STATUS,
45
+ httpMethod: _httpMethods.HTTP_METHOD_GET,
46
+ useLeader: typeof options.useLeader === 'boolean' ? options.useLeader : true
47
+ });
35
48
  }
36
49
 
37
50
  /**
38
- * Get the RQLite server status for all hosts as an array of object with
51
+ * Get the RQLite server status for all hosts as an array of objects with
39
52
  * the host and their status
40
- * @param {Object} [options={}] RQLite api options
41
- * @param {Object} [options.raw] If true return the raw http response from
42
- * RQLite response
43
- * @returns {StatusAllHostsResponse[]} An array of http response for the provide hosts
53
+ * @param {StatusRequestOptions} [options={}] RQLite api options
54
+ * @returns {Promise<StatusAllHostsResponse[]>} An array of http response for the provide hosts
55
+ * @see https://rqlite.io/docs/guides/monitoring-rqlite/
44
56
  */
45
- statusAllHosts(options = {}) {var _this2 = this;return (0, _asyncToGenerator2.default)(function* () {
46
- const hosts = _this2.getHosts();
47
- // Get the status for all of the hosts
48
- const promises = hosts.map(/*#__PURE__*/function () {var _ref = (0, _asyncToGenerator2.default)(function* (_host, activeHostIndex) {
49
- const response = yield _this2.status(_objectSpread(_objectSpread({}, options), {}, { activeHostIndex }));
50
- return { response, host: hosts[activeHostIndex] };
51
- });return function (_x, _x2) {return _ref.apply(this, arguments);};}());
52
- return Promise.all(promises);})();
57
+ async statusAllHosts(options = {}) {
58
+ const hosts = this.getHosts();
59
+ // Get the status for all of the hosts
60
+ const promises = hosts.map(async (_host, attemptHostIndex) => {
61
+ const response = await this.status({ ...options, useLeader: false, attemptHostIndex });
62
+ return { response, host: hosts[attemptHostIndex] };
63
+ });
64
+ return Promise.all(promises);
53
65
  }
54
66
  }exports.default = StatusApiClient;
55
67
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
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,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,CAAAD,CAAA,OAAAa,OAAA,WAAAd,CAAA,OAAAe,gBAAA,CAAAC,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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
+ {"version":3,"file":"index.js","names":["_client","_interopRequireDefault","require","_httpMethods","_paths","StatusApiClient","ApiClient","status","options","fetch","uri","PATH_STATUS","httpMethod","HTTP_METHOD_GET","useLeader","statusAllHosts","hosts","getHosts","promises","map","_host","attemptHostIndex","response","host","Promise","all","exports","default"],"sources":["../../../es6/api/status/index.js"],"sourcesContent":["/**\n * Status api client to perform RQLite status and diagnostics operations\n * @module api/status\n * @see https://rqlite.io/docs/guides/monitoring-rqlite/\n */\nimport ApiClient from '../client'\nimport { HTTP_METHOD_GET } from '../../http-request/http-methods'\nimport { PATH_STATUS } from '../paths'\n\nexport { PATH_STATUS } from '../paths'\n\n/**\n * @typedef {Object} HttpResponse\n * @property {Object|String} body The HTTP response body\n * @property {Number} status The HTTP response status code\n */\n\n/**\n * @typedef {Object} StatusRequestOptions\n * @property {Boolean} [raw] If true return the raw http response\n * @property {Number} [attemptHostIndex] Host index to query (used by statusAllHosts)\n * @property {Boolean} [useLeader] Prefer the leader host\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 * Data api client to perform RQLite status queries\n */\nexport default class StatusApiClient extends ApiClient {\n /**\n * Get the RQLite server status which defaults to the leader host\n * @param {StatusRequestOptions} [options={}] RQLite api options\n * @returns {Promise<HttpResponse>} An HTTP response object\n * @see https://rqlite.io/docs/guides/monitoring-rqlite/\n */\n async status (options = {}) {\n return this.fetch({\n ...options,\n uri: PATH_STATUS,\n httpMethod: HTTP_METHOD_GET,\n useLeader: typeof options.useLeader === 'boolean' ? options.useLeader : true,\n })\n }\n\n /**\n * Get the RQLite server status for all hosts as an array of objects with\n * the host and their status\n * @param {StatusRequestOptions} [options={}] RQLite api options\n * @returns {Promise<StatusAllHostsResponse[]>} An array of http response for the provide hosts\n * @see https://rqlite.io/docs/guides/monitoring-rqlite/\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, attemptHostIndex) => {\n const response = await this.status({ ...options, useLeader: false, attemptHostIndex })\n return { response, host: hosts[attemptHostIndex] }\n })\n return Promise.all(promises)\n }\n}\n"],"mappings":";;;;;AAKA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA,aAAsC,CAPtC;AACA;AACA;AACA;AACA,GAJA,CAWA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACe,MAAMG,eAAe,SAASC,eAAS,CAAC;EACrD;AACF;AACA;AACA;AACA;AACA;EACE,MAAMC,MAAMA,CAAEC,OAAO,GAAG,CAAC,CAAC,EAAE;IAC1B,OAAO,IAAI,CAACC,KAAK,CAAC;MAChB,GAAGD,OAAO;MACVE,GAAG,EAAEC,kBAAW;MAChBC,UAAU,EAAEC,4BAAe;MAC3BC,SAAS,EAAE,OAAON,OAAO,CAACM,SAAS,KAAK,SAAS,GAAGN,OAAO,CAACM,SAAS,GAAG;IAC1E,CAAC,CAAC;EACJ;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACE,MAAMC,cAAcA,CAAEP,OAAO,GAAG,CAAC,CAAC,EAAE;IAClC,MAAMQ,KAAK,GAAG,IAAI,CAACC,QAAQ,CAAC,CAAC;IAC7B;IACA,MAAMC,QAAQ,GAAGF,KAAK,CAACG,GAAG,CAAC,OAAOC,KAAK,EAAEC,gBAAgB,KAAK;MAC5D,MAAMC,QAAQ,GAAG,MAAM,IAAI,CAACf,MAAM,CAAC,EAAE,GAAGC,OAAO,EAAEM,SAAS,EAAE,KAAK,EAAEO,gBAAgB,CAAC,CAAC,CAAC;MACtF,OAAO,EAAEC,QAAQ,EAAEC,IAAI,EAAEP,KAAK,CAACK,gBAAgB,CAAC,CAAC,CAAC;IACpD,CAAC,CAAC;IACF,OAAOG,OAAO,CAACC,GAAG,CAACP,QAAQ,CAAC;EAC9B;AACF,CAACQ,OAAA,CAAAC,OAAA,GAAAtB,eAAA","ignoreList":[]}
@@ -0,0 +1,57 @@
1
+ "use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");var _chai = require("chai");
2
+ var _nock = _interopRequireDefault(require("nock"));
3
+ var _ = _interopRequireWildcard(require("."));
4
+ var _httpHeaders = require("../../http-request/http-headers");
5
+ var _contentTypes = require("../../http-request/content-types");var cache;function _interopRequireWildcard(e, t) {if (!t && e && e.__esModule) return e;var r,c,a = Object.defineProperty,n = { __proto__: null, default: e };if (Object(e) !== e) return n;if (cache || "function" != typeof WeakMap || (cache = new WeakMap()), cache) {if (cache.has(e)) return cache.get(e);cache.set(e, n);}for (c in e) "default" !== c && {}.hasOwnProperty.call(e, c) && ((r = a && Object.getOwnPropertyDescriptor(e, c)) && (r.get || r.set) ? a(n, c, r) : n[c] = e[c]);return n;}
6
+
7
+ const HOST1 = 'http://www.rqlite.com:4001';
8
+ const HOST2 = 'http://www.rqlite.com:4002';
9
+
10
+ const STATUS_BODY = {
11
+ build: { version: '10.6.6' },
12
+ http: { addr: '127.0.0.1:4001' },
13
+ node: {},
14
+ runtime: {},
15
+ store: { ready: true }
16
+ };
17
+
18
+ describe('api status client', () => {
19
+ before(() => _nock.default.disableNetConnect());
20
+ afterEach(() => _nock.default.cleanAll());
21
+ after(() => _nock.default.enableNetConnect());
22
+
23
+ describe('status()', () => {
24
+ it(`should GET ${_.PATH_STATUS} on the leader host`, async () => {
25
+ const scope = (0, _nock.default)(HOST1).
26
+ matchHeader(_httpHeaders.HTTP_HEADER_ACCEPT, _contentTypes.CONTENT_TYPE_APPLICATION_JSON).
27
+ get(_.PATH_STATUS).
28
+ reply(200, STATUS_BODY);
29
+ const client = new _.default(`${HOST1},${HOST2}`);
30
+ const res = await client.status();
31
+ _chai.assert.isTrue(scope.isDone(), 'http request captured by nock');
32
+ _chai.assert.equal(res.status, 200);
33
+ _chai.assert.deepEqual(res.body, STATUS_BODY);
34
+ });
35
+ });
36
+
37
+ describe('statusAllHosts()', () => {
38
+ it('should query each host using attemptHostIndex', async () => {
39
+ const scope1 = (0, _nock.default)(HOST1).
40
+ get(_.PATH_STATUS).
41
+ reply(200, { ...STATUS_BODY, http: { addr: 'host1' } });
42
+ const scope2 = (0, _nock.default)(HOST2).
43
+ get(_.PATH_STATUS).
44
+ reply(200, { ...STATUS_BODY, http: { addr: 'host2' } });
45
+ const client = new _.default(`${HOST1},${HOST2}`);
46
+ const results = await client.statusAllHosts();
47
+ _chai.assert.isTrue(scope1.isDone(), 'host1 request captured');
48
+ _chai.assert.isTrue(scope2.isDone(), 'host2 request captured');
49
+ _chai.assert.lengthOf(results, 2);
50
+ _chai.assert.equal(results[0].host, HOST1);
51
+ _chai.assert.equal(results[1].host, HOST2);
52
+ _chai.assert.equal(results[0].response.body.http.addr, 'host1');
53
+ _chai.assert.equal(results[1].response.body.http.addr, 'host2');
54
+ });
55
+ });
56
+ });
57
+ //# sourceMappingURL=test.unit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test.unit.js","names":["_chai","require","_nock","_interopRequireDefault","_","_interopRequireWildcard","_httpHeaders","_contentTypes","cache","e","t","__esModule","r","c","a","Object","defineProperty","n","__proto__","default","WeakMap","has","get","set","hasOwnProperty","call","getOwnPropertyDescriptor","HOST1","HOST2","STATUS_BODY","build","version","http","addr","node","runtime","store","ready","describe","before","nock","disableNetConnect","afterEach","cleanAll","after","enableNetConnect","it","PATH_STATUS","scope","matchHeader","HTTP_HEADER_ACCEPT","CONTENT_TYPE_APPLICATION_JSON","reply","client","StatusApiClient","res","status","assert","isTrue","isDone","equal","deepEqual","body","scope1","scope2","results","statusAllHosts","lengthOf","host","response"],"sources":["../../../es6/api/status/test.unit.js"],"sourcesContent":["import { assert } from 'chai'\nimport nock from 'nock'\nimport StatusApiClient, { PATH_STATUS } from '.'\nimport { HTTP_HEADER_ACCEPT } from '../../http-request/http-headers'\nimport { CONTENT_TYPE_APPLICATION_JSON } from '../../http-request/content-types'\n\nconst HOST1 = 'http://www.rqlite.com:4001'\nconst HOST2 = 'http://www.rqlite.com:4002'\n\nconst STATUS_BODY = {\n build: { version: '10.6.6' },\n http: { addr: '127.0.0.1:4001' },\n node: {},\n runtime: {},\n store: { ready: true },\n}\n\ndescribe('api status client', () => {\n before(() => nock.disableNetConnect())\n afterEach(() => nock.cleanAll())\n after(() => nock.enableNetConnect())\n\n describe('status()', () => {\n it(`should GET ${PATH_STATUS} on the leader host`, async () => {\n const scope = nock(HOST1)\n .matchHeader(HTTP_HEADER_ACCEPT, CONTENT_TYPE_APPLICATION_JSON)\n .get(PATH_STATUS)\n .reply(200, STATUS_BODY)\n const client = new StatusApiClient(`${HOST1},${HOST2}`)\n const res = await client.status()\n assert.isTrue(scope.isDone(), 'http request captured by nock')\n assert.equal(res.status, 200)\n assert.deepEqual(res.body, STATUS_BODY)\n })\n })\n\n describe('statusAllHosts()', () => {\n it('should query each host using attemptHostIndex', async () => {\n const scope1 = nock(HOST1)\n .get(PATH_STATUS)\n .reply(200, { ...STATUS_BODY, http: { addr: 'host1' } })\n const scope2 = nock(HOST2)\n .get(PATH_STATUS)\n .reply(200, { ...STATUS_BODY, http: { addr: 'host2' } })\n const client = new StatusApiClient(`${HOST1},${HOST2}`)\n const results = await client.statusAllHosts()\n assert.isTrue(scope1.isDone(), 'host1 request captured')\n assert.isTrue(scope2.isDone(), 'host2 request captured')\n assert.lengthOf(results, 2)\n assert.equal(results[0].host, HOST1)\n assert.equal(results[1].host, HOST2)\n assert.equal(results[0].response.body.http.addr, 'host1')\n assert.equal(results[1].response.body.http.addr, 'host2')\n })\n })\n})\n"],"mappings":"kGAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,CAAA,GAAAC,uBAAA,CAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,aAAA,GAAAN,OAAA,qCAAgF,IAAAO,KAAA,UAAAH,wBAAAI,CAAA,EAAAC,CAAA,QAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAE,UAAA,SAAAF,CAAA,KAAAG,CAAA,CAAAC,CAAA,CAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,CAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,OAAAM,MAAA,CAAAN,CAAA,MAAAA,CAAA,SAAAQ,CAAA,KAAAT,KAAA,yBAAAY,OAAA,KAAAZ,KAAA,OAAAY,OAAA,KAAAZ,KAAA,OAAAA,KAAA,CAAAa,GAAA,CAAAZ,CAAA,UAAAD,KAAA,CAAAc,GAAA,CAAAb,CAAA,CAAAD,CAAA,MAAAe,GAAA,CAAAd,CAAA,EAAAQ,CAAA,QAAAJ,CAAA,IAAAJ,CAAA,gBAAAI,CAAA,OAAAW,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAI,CAAA,OAAAD,CAAA,GAAAE,CAAA,IAAAC,MAAA,CAAAW,wBAAA,CAAAjB,CAAA,EAAAI,CAAA,OAAAD,CAAA,CAAAU,GAAA,IAAAV,CAAA,CAAAW,GAAA,IAAAT,CAAA,CAAAG,CAAA,EAAAJ,CAAA,EAAAD,CAAA,IAAAK,CAAA,CAAAJ,CAAA,IAAAJ,CAAA,CAAAI,CAAA,UAAAI,CAAA;;AAEhF,MAAMU,KAAK,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G,KAAK,CAACK,OAAO,CAAC,CAAC,CAAC,CAACI,QAAQ,CAACP,IAAI,CAAC9B,IAAI,CAACC,IAAI,EAAE,OAAO,CAAC;IAC3D,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,15 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", { value: true });exports.AUTH_USERNAME = exports.AUTH_PASSWORD = void 0; /**
2
+ * Authentication Map / axios auth property key constants
3
+ * @module http-request/auth-keys
4
+ */
5
+
6
+ /**
7
+ * Username key for authentication
8
+ */
9
+ const AUTH_USERNAME = exports.AUTH_USERNAME = 'username';
10
+
11
+ /**
12
+ * Password key for authentication
13
+ */
14
+ const AUTH_PASSWORD = exports.AUTH_PASSWORD = 'password';
15
+ //# sourceMappingURL=auth-keys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-keys.js","names":["AUTH_USERNAME","exports","AUTH_PASSWORD"],"sources":["../../es6/http-request/auth-keys.js"],"sourcesContent":["/**\n * Authentication Map / axios auth property key constants\n * @module http-request/auth-keys\n */\n\n/**\n * Username key for authentication\n */\nexport const AUTH_USERNAME = 'username'\n\n/**\n * Password key for authentication\n */\nexport const AUTH_PASSWORD = 'password'\n"],"mappings":"mIAAA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACO,MAAMA,aAAa,GAAAC,OAAA,CAAAD,aAAA,GAAG,UAAU;;AAEvC;AACA;AACA;AACO,MAAME,aAAa,GAAAD,OAAA,CAAAC,aAAA,GAAG,UAAU","ignoreList":[]}
@@ -0,0 +1,20 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", { value: true });exports.HTTP_HEADER_LOCATION = exports.HTTP_HEADER_CONTENT_TYPE = exports.HTTP_HEADER_ACCEPT = void 0; /**
2
+ * HTTP header name constants used by RQLite clients
3
+ * @module http-request/http-headers
4
+ */
5
+
6
+ /**
7
+ * Accept request header
8
+ */
9
+ const HTTP_HEADER_ACCEPT = exports.HTTP_HEADER_ACCEPT = 'Accept';
10
+
11
+ /**
12
+ * Content-Type request header
13
+ */
14
+ const HTTP_HEADER_CONTENT_TYPE = exports.HTTP_HEADER_CONTENT_TYPE = 'Content-Type';
15
+
16
+ /**
17
+ * Location response header (redirects)
18
+ */
19
+ const HTTP_HEADER_LOCATION = exports.HTTP_HEADER_LOCATION = 'Location';
20
+ //# sourceMappingURL=http-headers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-headers.js","names":["HTTP_HEADER_ACCEPT","exports","HTTP_HEADER_CONTENT_TYPE","HTTP_HEADER_LOCATION"],"sources":["../../es6/http-request/http-headers.js"],"sourcesContent":["/**\n * HTTP header name constants used by RQLite clients\n * @module http-request/http-headers\n */\n\n/**\n * Accept request header\n */\nexport const HTTP_HEADER_ACCEPT = 'Accept'\n\n/**\n * Content-Type request header\n */\nexport const HTTP_HEADER_CONTENT_TYPE = 'Content-Type'\n\n/**\n * Location response header (redirects)\n */\nexport const HTTP_HEADER_LOCATION = 'Location'\n"],"mappings":"kLAAA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACO,MAAMA,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAG,QAAQ;;AAE1C;AACA;AACA;AACO,MAAME,wBAAwB,GAAAD,OAAA,CAAAC,wBAAA,GAAG,cAAc;;AAEtD;AACA;AACA;AACO,MAAMC,oBAAoB,GAAAF,OAAA,CAAAE,oBAAA,GAAG,UAAU","ignoreList":[]}