@influxdata/influxdb-client-browser 1.18.0 → 1.19.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.
package/dist/influxdb.js CHANGED
@@ -1218,16 +1218,20 @@ var influxdb = (function (exports) {
1218
1218
  * @param name - field name
1219
1219
  * @param value - field value
1220
1220
  * @returns this
1221
+ * @throws NaN or out of int64 range value is supplied
1221
1222
  */
1222
1223
  Point.prototype.intField = function (name, value) {
1223
- if (typeof value !== 'number') {
1224
- var val = void 0;
1225
- if (isNaN((val = parseInt(String(value))))) {
1226
- throw new Error("Expected integer value for field " + name + ", but got '" + value + "'!");
1227
- }
1228
- value = val;
1224
+ var val;
1225
+ if (typeof value === 'number') {
1226
+ val = value;
1227
+ }
1228
+ else {
1229
+ val = parseInt(String(value));
1230
+ }
1231
+ if (isNaN(val) || val <= -9223372036854776e3 || val >= 9223372036854776e3) {
1232
+ throw new Error("invalid integer value for field '" + name + "': '" + value + "'!");
1229
1233
  }
1230
- this.fields[name] = Math.floor(value) + "i";
1234
+ this.fields[name] = Math.floor(val) + "i";
1231
1235
  return this;
1232
1236
  };
1233
1237
  /**
@@ -1236,11 +1240,12 @@ var influxdb = (function (exports) {
1236
1240
  * @param name - field name
1237
1241
  * @param value - field value
1238
1242
  * @returns this
1243
+ * @throws NaN out of range value is supplied
1239
1244
  */
1240
1245
  Point.prototype.uintField = function (name, value) {
1241
1246
  if (typeof value === 'number') {
1242
- if (value < 0 || value > Number.MAX_SAFE_INTEGER) {
1243
- throw new Error("uint value out of js unsigned integer range: " + value);
1247
+ if (isNaN(value) || value < 0 || value > Number.MAX_SAFE_INTEGER) {
1248
+ throw new Error("uint value for field '" + name + "' out of range: " + value);
1244
1249
  }
1245
1250
  this.fields[name] = Math.floor(value) + "u";
1246
1251
  }
@@ -1255,7 +1260,7 @@ var influxdb = (function (exports) {
1255
1260
  if (strVal.length > 20 ||
1256
1261
  (strVal.length === 20 &&
1257
1262
  strVal.localeCompare('18446744073709551615') > 0)) {
1258
- throw new Error("uint value out of range: " + strVal);
1263
+ throw new Error("uint value for field '" + name + "' out of range: " + strVal);
1259
1264
  }
1260
1265
  this.fields[name] = strVal + "u";
1261
1266
  }
@@ -1267,16 +1272,20 @@ var influxdb = (function (exports) {
1267
1272
  * @param name - field name
1268
1273
  * @param value - field value
1269
1274
  * @returns this
1275
+ * @throws NaN/Infinity/-Infinity is supplied
1270
1276
  */
1271
1277
  Point.prototype.floatField = function (name, value) {
1272
- if (typeof value !== 'number') {
1273
- var val = void 0;
1274
- if (isNaN((val = parseFloat(value)))) {
1275
- throw new Error("Expected float value for field " + name + ", but got '" + value + "'!");
1276
- }
1277
- value = val;
1278
+ var val;
1279
+ if (typeof value === 'number') {
1280
+ val = value;
1281
+ }
1282
+ else {
1283
+ val = parseFloat(value);
1284
+ }
1285
+ if (!isFinite(val)) {
1286
+ throw new Error("invalid float value for field '" + name + "': " + value);
1278
1287
  }
1279
- this.fields[name] = String(value);
1288
+ this.fields[name] = String(val);
1280
1289
  return this;
1281
1290
  };
1282
1291
  /**
Binary file