@neurosity/sdk 6.5.10 → 6.5.11

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 (130) hide show
  1. package/dist/browser/neurosity.iife.js +118 -49
  2. package/dist/browser/neurosity.js +112 -112
  3. package/dist/browser/neurosity.js.map +1 -1
  4. package/dist/cjs/__tests__/Neurosity.test.d.ts +1 -0
  5. package/dist/cjs/__tests__/Neurosity.test.js +201 -0
  6. package/dist/cjs/__tests__/WebBluetoothTransport.test.d.ts +1 -0
  7. package/dist/cjs/__tests__/WebBluetoothTransport.test.js +201 -0
  8. package/dist/cjs/__tests__/accelerometer.test.d.ts +1 -0
  9. package/dist/cjs/__tests__/accelerometer.test.js +158 -0
  10. package/dist/cjs/__tests__/auth.test.d.ts +1 -0
  11. package/dist/cjs/__tests__/auth.test.js +239 -0
  12. package/dist/cjs/__tests__/brainwaves.test.d.ts +1 -0
  13. package/dist/cjs/__tests__/brainwaves.test.js +291 -0
  14. package/dist/cjs/__tests__/device.test.d.ts +1 -0
  15. package/dist/cjs/__tests__/device.test.js +281 -0
  16. package/dist/cjs/__tests__/haptics.test.d.ts +1 -0
  17. package/dist/cjs/__tests__/haptics.test.js +162 -0
  18. package/dist/cjs/__tests__/metrics.test.d.ts +1 -0
  19. package/dist/cjs/__tests__/metrics.test.js +178 -0
  20. package/dist/cjs/__tests__/oauth.test.d.ts +1 -0
  21. package/dist/cjs/__tests__/oauth.test.js +138 -0
  22. package/dist/cjs/__tests__/settings.test.d.ts +1 -0
  23. package/dist/cjs/__tests__/settings.test.js +130 -0
  24. package/dist/cjs/__tests__/setup/webBluetooth.setup.d.ts +11 -0
  25. package/dist/cjs/__tests__/setup/webBluetooth.setup.js +35 -0
  26. package/dist/cjs/__tests__/setup.d.ts +0 -0
  27. package/dist/cjs/__tests__/setup.js +7 -0
  28. package/dist/cjs/__tests__/streaming.test.d.ts +1 -0
  29. package/dist/cjs/__tests__/streaming.test.js +259 -0
  30. package/dist/cjs/__tests__/timesync.test.d.ts +1 -0
  31. package/dist/cjs/__tests__/timesync.test.js +54 -0
  32. package/dist/cjs/__tests__/utils.test.d.ts +1 -0
  33. package/dist/cjs/__tests__/utils.test.js +281 -0
  34. package/dist/cjs/api/bluetooth/BluetoothClient.d.ts +6 -6
  35. package/dist/cjs/api/bluetooth/BluetoothTransport.d.ts +1 -1
  36. package/dist/cjs/api/bluetooth/react-native/ReactNativeTransport.d.ts +4 -4
  37. package/dist/cjs/api/bluetooth/react-native/types/ReactNativeTypes.d.ts +2 -2
  38. package/dist/cjs/api/bluetooth/types/index.d.ts +2 -2
  39. package/dist/cjs/api/bluetooth/utils/decodeJSONChunks.d.ts +1 -1
  40. package/dist/cjs/api/bluetooth/utils/stitch.d.ts +1 -1
  41. package/dist/cjs/api/bluetooth/utils/textCodec.d.ts +1 -1
  42. package/dist/cjs/api/bluetooth/web/WebBluetoothTransport.d.ts +1 -1
  43. package/dist/cjs/api/firebase/FirebaseDevice.d.ts +1 -1
  44. package/dist/cjs/api/firebase/FirebaseUser.d.ts +1 -1
  45. package/dist/cjs/api/index.js +1 -1
  46. package/dist/cjs/timesync/Timesync.d.ts +1 -1
  47. package/dist/cjs/types/awareness.d.ts +1 -1
  48. package/dist/cjs/types/brainwaves.d.ts +25 -12
  49. package/dist/cjs/types/credentials.d.ts +4 -4
  50. package/dist/cjs/types/deviceInfo.d.ts +4 -4
  51. package/dist/cjs/types/epoch.d.ts +1 -1
  52. package/dist/cjs/types/experiment.d.ts +1 -1
  53. package/dist/cjs/types/hapticEffects.d.ts +1 -1
  54. package/dist/cjs/types/marker.d.ts +1 -1
  55. package/dist/cjs/types/metrics.d.ts +2 -2
  56. package/dist/cjs/types/oauth.d.ts +4 -4
  57. package/dist/cjs/types/sample.d.ts +2 -2
  58. package/dist/cjs/types/signalQuality.d.ts +1 -1
  59. package/dist/cjs/types/skill.d.ts +2 -2
  60. package/dist/cjs/types/user.d.ts +3 -3
  61. package/dist/cjs/utils/oauth.d.ts +1 -1
  62. package/dist/cjs/utils/transferDevice.d.ts +3 -3
  63. package/dist/cjs/utils/whileOnline.d.ts +1 -1
  64. package/dist/electron/index.js +1 -1
  65. package/dist/electron/index.js.map +1 -1
  66. package/dist/esm/__tests__/Neurosity.test.d.ts +1 -0
  67. package/dist/esm/__tests__/Neurosity.test.js +199 -0
  68. package/dist/esm/__tests__/WebBluetoothTransport.test.d.ts +1 -0
  69. package/dist/esm/__tests__/WebBluetoothTransport.test.js +199 -0
  70. package/dist/esm/__tests__/accelerometer.test.d.ts +1 -0
  71. package/dist/esm/__tests__/accelerometer.test.js +156 -0
  72. package/dist/esm/__tests__/auth.test.d.ts +1 -0
  73. package/dist/esm/__tests__/auth.test.js +237 -0
  74. package/dist/esm/__tests__/brainwaves.test.d.ts +1 -0
  75. package/dist/esm/__tests__/brainwaves.test.js +289 -0
  76. package/dist/esm/__tests__/device.test.d.ts +1 -0
  77. package/dist/esm/__tests__/device.test.js +279 -0
  78. package/dist/esm/__tests__/haptics.test.d.ts +1 -0
  79. package/dist/esm/__tests__/haptics.test.js +160 -0
  80. package/dist/esm/__tests__/metrics.test.d.ts +1 -0
  81. package/dist/esm/__tests__/metrics.test.js +176 -0
  82. package/dist/esm/__tests__/oauth.test.d.ts +1 -0
  83. package/dist/esm/__tests__/oauth.test.js +133 -0
  84. package/dist/esm/__tests__/settings.test.d.ts +1 -0
  85. package/dist/esm/__tests__/settings.test.js +128 -0
  86. package/dist/esm/__tests__/setup/webBluetooth.setup.d.ts +11 -0
  87. package/dist/esm/__tests__/setup/webBluetooth.setup.js +35 -0
  88. package/dist/esm/__tests__/setup.d.ts +0 -0
  89. package/dist/esm/__tests__/setup.js +7 -0
  90. package/dist/esm/__tests__/streaming.test.d.ts +1 -0
  91. package/dist/esm/__tests__/streaming.test.js +257 -0
  92. package/dist/esm/__tests__/timesync.test.d.ts +1 -0
  93. package/dist/esm/__tests__/timesync.test.js +52 -0
  94. package/dist/esm/__tests__/utils.test.d.ts +1 -0
  95. package/dist/esm/__tests__/utils.test.js +279 -0
  96. package/dist/esm/api/bluetooth/BluetoothClient.d.ts +6 -6
  97. package/dist/esm/api/bluetooth/BluetoothTransport.d.ts +1 -1
  98. package/dist/esm/api/bluetooth/react-native/ReactNativeTransport.d.ts +4 -4
  99. package/dist/esm/api/bluetooth/react-native/types/ReactNativeTypes.d.ts +2 -2
  100. package/dist/esm/api/bluetooth/types/index.d.ts +2 -2
  101. package/dist/esm/api/bluetooth/utils/decodeJSONChunks.d.ts +1 -1
  102. package/dist/esm/api/bluetooth/utils/stitch.d.ts +1 -1
  103. package/dist/esm/api/bluetooth/utils/textCodec.d.ts +1 -1
  104. package/dist/esm/api/bluetooth/web/WebBluetoothTransport.d.ts +1 -1
  105. package/dist/esm/api/firebase/FirebaseDevice.d.ts +1 -1
  106. package/dist/esm/api/firebase/FirebaseUser.d.ts +1 -1
  107. package/dist/esm/api/index.js +2 -2
  108. package/dist/esm/neurosity.mjs +118 -49
  109. package/dist/esm/timesync/Timesync.d.ts +1 -1
  110. package/dist/esm/types/awareness.d.ts +1 -1
  111. package/dist/esm/types/brainwaves.d.ts +25 -12
  112. package/dist/esm/types/credentials.d.ts +4 -4
  113. package/dist/esm/types/deviceInfo.d.ts +4 -4
  114. package/dist/esm/types/epoch.d.ts +1 -1
  115. package/dist/esm/types/experiment.d.ts +1 -1
  116. package/dist/esm/types/hapticEffects.d.ts +1 -1
  117. package/dist/esm/types/marker.d.ts +1 -1
  118. package/dist/esm/types/metrics.d.ts +2 -2
  119. package/dist/esm/types/oauth.d.ts +4 -4
  120. package/dist/esm/types/sample.d.ts +2 -2
  121. package/dist/esm/types/signalQuality.d.ts +1 -1
  122. package/dist/esm/types/skill.d.ts +2 -2
  123. package/dist/esm/types/user.d.ts +3 -3
  124. package/dist/esm/utils/oauth.d.ts +1 -1
  125. package/dist/esm/utils/transferDevice.d.ts +3 -3
  126. package/dist/esm/utils/whileOnline.d.ts +1 -1
  127. package/dist/examples/neurosity.iife.js +118 -49
  128. package/dist/examples/neurosity.js +112 -112
  129. package/dist/examples/neurosity.mjs +118 -49
  130. package/package.json +16 -4
@@ -42868,7 +42868,7 @@ class CloudClient {
42868
42868
  this.firebaseApp = new FirebaseApp(options);
42869
42869
  this.firebaseUser = new FirebaseUser(this.firebaseApp);
42870
42870
  this._selectedDevice.next(undefined);
42871
- this.status$ = heartbeatAwareStatus(this.observeNamespace("status").pipe(share())).pipe(filterInternalKeys(), shareReplay(1));
42871
+ this.status$ = heartbeatAwareStatus(this.observeNamespace("status").pipe(shareReplay(1))).pipe(filterInternalKeys(), shareReplay(1));
42872
42872
  this.osVersion$ = this.observeNamespace("info/osVersion").pipe(shareReplay(1));
42873
42873
  this.firebaseUser.onAuthStateChanged().subscribe((user) => {
42874
42874
  this.user = user;
@@ -44508,7 +44508,7 @@ AxiosError.from = (error, code, config, request, response, customProps) => {
44508
44508
  };
44509
44509
 
44510
44510
  // eslint-disable-next-line strict
44511
- var PlatformFormData = null;
44511
+ var httpAdapter = null;
44512
44512
 
44513
44513
  /**
44514
44514
  * Determines if the given thing is a array or js object.
@@ -46025,7 +46025,7 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
46025
46025
  };
46026
46026
 
46027
46027
  const knownAdapters = {
46028
- http: PlatformFormData,
46028
+ http: httpAdapter,
46029
46029
  xhr: xhrAdapter
46030
46030
  };
46031
46031
 
@@ -47341,7 +47341,6 @@ function from (value, encodingOrOffset, length) {
47341
47341
  return fromArrayBuffer(value, encodingOrOffset, length)
47342
47342
  }
47343
47343
 
47344
-
47345
47344
  if (typeof value === 'number') {
47346
47345
  throw new TypeError(
47347
47346
  'The "value" argument must not be of type number. Received type number'
@@ -47524,7 +47523,6 @@ function fromObject (obj) {
47524
47523
  }
47525
47524
  }
47526
47525
 
47527
-
47528
47526
  function checked (length) {
47529
47527
  // Note: cannot use `length < K_MAX_LENGTH` here because that fails when
47530
47528
  // length is NaN (which is otherwise coerced to zero.)
@@ -47635,7 +47633,6 @@ Buffer.concat = function concat (list, length) {
47635
47633
  return buffer
47636
47634
  };
47637
47635
 
47638
-
47639
47636
  function byteLength (string, encoding) {
47640
47637
  if (Buffer.isBuffer(string)) {
47641
47638
  return string.length
@@ -48232,7 +48229,6 @@ function utf8Slice (buf, start, end) {
48232
48229
  return decodeCodePointsArray(res)
48233
48230
  }
48234
48231
 
48235
-
48236
48232
  // Based on http://stackoverflow.com/a/22747272/680742, the browser with
48237
48233
  // the lowest limit is Chrome, with 0x10000 args.
48238
48234
  // We go 1 magnitude less, for safety
@@ -50702,30 +50698,78 @@ const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
50702
50698
  // Max safe segment length for coercion.
50703
50699
  const MAX_SAFE_COMPONENT_LENGTH = 16;
50704
50700
 
50701
+ // Max safe length for a build identifier. The max length minus 6 characters for
50702
+ // the shortest version with a build 0.0.0+BUILD.
50703
+ const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6;
50704
+
50705
+ const RELEASE_TYPES = [
50706
+ 'major',
50707
+ 'premajor',
50708
+ 'minor',
50709
+ 'preminor',
50710
+ 'patch',
50711
+ 'prepatch',
50712
+ 'prerelease',
50713
+ ];
50714
+
50705
50715
  var constants = {
50706
- SEMVER_SPEC_VERSION,
50707
50716
  MAX_LENGTH,
50708
- MAX_SAFE_INTEGER,
50709
50717
  MAX_SAFE_COMPONENT_LENGTH,
50718
+ MAX_SAFE_BUILD_LENGTH,
50719
+ MAX_SAFE_INTEGER,
50720
+ RELEASE_TYPES,
50721
+ SEMVER_SPEC_VERSION,
50722
+ FLAG_INCLUDE_PRERELEASE: 0b001,
50723
+ FLAG_LOOSE: 0b010,
50710
50724
  };
50711
50725
 
50712
50726
  var re_1 = createCommonjsModule(function (module, exports) {
50713
- const { MAX_SAFE_COMPONENT_LENGTH } = constants;
50727
+ const {
50728
+ MAX_SAFE_COMPONENT_LENGTH,
50729
+ MAX_SAFE_BUILD_LENGTH,
50730
+ MAX_LENGTH,
50731
+ } = constants;
50714
50732
 
50715
50733
  exports = module.exports = {};
50716
50734
 
50717
50735
  // The actual regexps go on exports.re
50718
50736
  const re = exports.re = [];
50737
+ const safeRe = exports.safeRe = [];
50719
50738
  const src = exports.src = [];
50720
50739
  const t = exports.t = {};
50721
50740
  let R = 0;
50722
50741
 
50742
+ const LETTERDASHNUMBER = '[a-zA-Z0-9-]';
50743
+
50744
+ // Replace some greedy regex tokens to prevent regex dos issues. These regex are
50745
+ // used internally via the safeRe object since all inputs in this library get
50746
+ // normalized first to trim and collapse all extra whitespace. The original
50747
+ // regexes are exported for userland consumption and lower level usage. A
50748
+ // future breaking change could export the safer regex only with a note that
50749
+ // all input should have extra whitespace removed.
50750
+ const safeRegexReplacements = [
50751
+ ['\\s', 1],
50752
+ ['\\d', MAX_LENGTH],
50753
+ [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH],
50754
+ ];
50755
+
50756
+ const makeSafeRegex = (value) => {
50757
+ for (const [token, max] of safeRegexReplacements) {
50758
+ value = value
50759
+ .split(`${token}*`).join(`${token}{0,${max}}`)
50760
+ .split(`${token}+`).join(`${token}{1,${max}}`);
50761
+ }
50762
+ return value
50763
+ };
50764
+
50723
50765
  const createToken = (name, value, isGlobal) => {
50766
+ const safe = makeSafeRegex(value);
50724
50767
  const index = R++;
50725
50768
  debug_1(name, index, value);
50726
50769
  t[name] = index;
50727
50770
  src[index] = value;
50728
50771
  re[index] = new RegExp(value, isGlobal ? 'g' : undefined);
50772
+ safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined);
50729
50773
  };
50730
50774
 
50731
50775
  // The following Regular Expressions can be used for tokenizing,
@@ -50735,13 +50779,13 @@ const createToken = (name, value, isGlobal) => {
50735
50779
  // A single `0`, or a non-zero digit followed by zero or more digits.
50736
50780
 
50737
50781
  createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*');
50738
- createToken('NUMERICIDENTIFIERLOOSE', '[0-9]+');
50782
+ createToken('NUMERICIDENTIFIERLOOSE', '\\d+');
50739
50783
 
50740
50784
  // ## Non-numeric Identifier
50741
50785
  // Zero or more digits, followed by a letter or hyphen, and then zero or
50742
50786
  // more letters, digits, or hyphens.
50743
50787
 
50744
- createToken('NONNUMERICIDENTIFIER', '\\d*[a-zA-Z-][a-zA-Z0-9-]*');
50788
+ createToken('NONNUMERICIDENTIFIER', `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
50745
50789
 
50746
50790
  // ## Main Version
50747
50791
  // Three dot-separated numeric identifiers.
@@ -50776,7 +50820,7 @@ createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]
50776
50820
  // ## Build Metadata Identifier
50777
50821
  // Any combination of digits, letters, or hyphens.
50778
50822
 
50779
- createToken('BUILDIDENTIFIER', '[0-9A-Za-z-]+');
50823
+ createToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`);
50780
50824
 
50781
50825
  // ## Build Metadata
50782
50826
  // Plus sign, followed by one or more period-separated build metadata
@@ -50836,12 +50880,17 @@ createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
50836
50880
 
50837
50881
  // Coercion.
50838
50882
  // Extract anything that could conceivably be a part of a valid semver
50839
- createToken('COERCE', `${'(^|[^\\d])' +
50883
+ createToken('COERCEPLAIN', `${'(^|[^\\d])' +
50840
50884
  '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +
50841
50885
  `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
50842
- `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
50886
+ `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
50887
+ createToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
50888
+ createToken('COERCEFULL', src[t.COERCEPLAIN] +
50889
+ `(?:${src[t.PRERELEASE]})?` +
50890
+ `(?:${src[t.BUILD]})?` +
50843
50891
  `(?:$|[^\\d])`);
50844
50892
  createToken('COERCERTL', src[t.COERCE], true);
50893
+ createToken('COERCERTLFULL', src[t.COERCEFULL], true);
50845
50894
 
50846
50895
  // Tilde ranges.
50847
50896
  // Meaning is "reasonably at or greater than"
@@ -50894,22 +50943,27 @@ createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$');
50894
50943
  createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$');
50895
50944
  });
50896
50945
  var re_2 = re_1.re;
50897
- var re_3 = re_1.src;
50898
- var re_4 = re_1.t;
50899
- var re_5 = re_1.tildeTrimReplace;
50900
- var re_6 = re_1.caretTrimReplace;
50901
- var re_7 = re_1.comparatorTrimReplace;
50902
-
50903
- // parse out just the options we care about so we always get a consistent
50904
- // obj with keys in a consistent order.
50905
- const opts = ['includePrerelease', 'loose', 'rtl'];
50906
- const parseOptions = options =>
50907
- !options ? {}
50908
- : typeof options !== 'object' ? { loose: true }
50909
- : opts.filter(k => options[k]).reduce((o, k) => {
50910
- o[k] = true;
50911
- return o
50912
- }, {});
50946
+ var re_3 = re_1.safeRe;
50947
+ var re_4 = re_1.src;
50948
+ var re_5 = re_1.t;
50949
+ var re_6 = re_1.tildeTrimReplace;
50950
+ var re_7 = re_1.caretTrimReplace;
50951
+ var re_8 = re_1.comparatorTrimReplace;
50952
+
50953
+ // parse out just the options we care about
50954
+ const looseOption = Object.freeze({ loose: true });
50955
+ const emptyOpts = Object.freeze({ });
50956
+ const parseOptions = options => {
50957
+ if (!options) {
50958
+ return emptyOpts
50959
+ }
50960
+
50961
+ if (typeof options !== 'object') {
50962
+ return looseOption
50963
+ }
50964
+
50965
+ return options
50966
+ };
50913
50967
  var parseOptions_1 = parseOptions;
50914
50968
 
50915
50969
  const numeric = /^[0-9]+$/;
@@ -50937,7 +50991,7 @@ var identifiers = {
50937
50991
  };
50938
50992
 
50939
50993
  const { MAX_LENGTH: MAX_LENGTH$1, MAX_SAFE_INTEGER: MAX_SAFE_INTEGER$1 } = constants;
50940
- const { re: re$1, t: t$1 } = re_1;
50994
+ const { safeRe: re$1, t: t$1 } = re_1;
50941
50995
 
50942
50996
 
50943
50997
  const { compareIdentifiers: compareIdentifiers$1 } = identifiers;
@@ -50953,7 +51007,7 @@ class SemVer {
50953
51007
  version = version.version;
50954
51008
  }
50955
51009
  } else if (typeof version !== 'string') {
50956
- throw new TypeError(`Invalid Version: ${version}`)
51010
+ throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`)
50957
51011
  }
50958
51012
 
50959
51013
  if (version.length > MAX_LENGTH$1) {
@@ -51095,7 +51149,7 @@ class SemVer {
51095
51149
  do {
51096
51150
  const a = this.build[i];
51097
51151
  const b = other.build[i];
51098
- debug_1('prerelease compare', i, a, b);
51152
+ debug_1('build compare', i, a, b);
51099
51153
  if (a === undefined && b === undefined) {
51100
51154
  return 0
51101
51155
  } else if (b === undefined) {
@@ -51112,36 +51166,36 @@ class SemVer {
51112
51166
 
51113
51167
  // preminor will bump the version up to the next minor release, and immediately
51114
51168
  // down to pre-release. premajor and prepatch work the same way.
51115
- inc (release, identifier) {
51169
+ inc (release, identifier, identifierBase) {
51116
51170
  switch (release) {
51117
51171
  case 'premajor':
51118
51172
  this.prerelease.length = 0;
51119
51173
  this.patch = 0;
51120
51174
  this.minor = 0;
51121
51175
  this.major++;
51122
- this.inc('pre', identifier);
51176
+ this.inc('pre', identifier, identifierBase);
51123
51177
  break
51124
51178
  case 'preminor':
51125
51179
  this.prerelease.length = 0;
51126
51180
  this.patch = 0;
51127
51181
  this.minor++;
51128
- this.inc('pre', identifier);
51182
+ this.inc('pre', identifier, identifierBase);
51129
51183
  break
51130
51184
  case 'prepatch':
51131
51185
  // If this is already a prerelease, it will bump to the next version
51132
51186
  // drop any prereleases that might already exist, since they are not
51133
51187
  // relevant at this point.
51134
51188
  this.prerelease.length = 0;
51135
- this.inc('patch', identifier);
51136
- this.inc('pre', identifier);
51189
+ this.inc('patch', identifier, identifierBase);
51190
+ this.inc('pre', identifier, identifierBase);
51137
51191
  break
51138
51192
  // If the input is a non-prerelease version, this acts the same as
51139
51193
  // prepatch.
51140
51194
  case 'prerelease':
51141
51195
  if (this.prerelease.length === 0) {
51142
- this.inc('patch', identifier);
51196
+ this.inc('patch', identifier, identifierBase);
51143
51197
  }
51144
- this.inc('pre', identifier);
51198
+ this.inc('pre', identifier, identifierBase);
51145
51199
  break
51146
51200
 
51147
51201
  case 'major':
@@ -51183,9 +51237,15 @@ class SemVer {
51183
51237
  break
51184
51238
  // This probably shouldn't be used publicly.
51185
51239
  // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
51186
- case 'pre':
51240
+ case 'pre': {
51241
+ const base = Number(identifierBase) ? 1 : 0;
51242
+
51243
+ if (!identifier && identifierBase === false) {
51244
+ throw new Error('invalid increment argument: identifier is empty')
51245
+ }
51246
+
51187
51247
  if (this.prerelease.length === 0) {
51188
- this.prerelease = [0];
51248
+ this.prerelease = [base];
51189
51249
  } else {
51190
51250
  let i = this.prerelease.length;
51191
51251
  while (--i >= 0) {
@@ -51196,27 +51256,36 @@ class SemVer {
51196
51256
  }
51197
51257
  if (i === -1) {
51198
51258
  // didn't increment anything
51199
- this.prerelease.push(0);
51259
+ if (identifier === this.prerelease.join('.') && identifierBase === false) {
51260
+ throw new Error('invalid increment argument: identifier already exists')
51261
+ }
51262
+ this.prerelease.push(base);
51200
51263
  }
51201
51264
  }
51202
51265
  if (identifier) {
51203
51266
  // 1.2.0-beta.1 bumps to 1.2.0-beta.2,
51204
51267
  // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
51268
+ let prerelease = [identifier, base];
51269
+ if (identifierBase === false) {
51270
+ prerelease = [identifier];
51271
+ }
51205
51272
  if (compareIdentifiers$1(this.prerelease[0], identifier) === 0) {
51206
51273
  if (isNaN(this.prerelease[1])) {
51207
- this.prerelease = [identifier, 0];
51274
+ this.prerelease = prerelease;
51208
51275
  }
51209
51276
  } else {
51210
- this.prerelease = [identifier, 0];
51277
+ this.prerelease = prerelease;
51211
51278
  }
51212
51279
  }
51213
51280
  break
51214
-
51281
+ }
51215
51282
  default:
51216
51283
  throw new Error(`invalid increment argument: ${release}`)
51217
51284
  }
51218
- this.format();
51219
- this.raw = this.version;
51285
+ this.raw = this.format();
51286
+ if (this.build.length) {
51287
+ this.raw += `+${this.build.join('.')}`;
51288
+ }
51220
51289
  return this
51221
51290
  }
51222
51291
  }
@@ -1,6 +1,6 @@
1
1
  import { Observable } from "rxjs";
2
2
  import { DeviceStatus } from "../types/status";
3
- declare type Options = {
3
+ type Options = {
4
4
  getTimesync: () => Promise<number>;
5
5
  status$: Observable<DeviceStatus>;
6
6
  bufferSize?: number;
@@ -1 +1 @@
1
- export declare type AwarenessLabels = "calm" | "focus";
1
+ export type AwarenessLabels = "calm" | "focus";
@@ -1,26 +1,39 @@
1
- export declare type BrainwavesLabel = "raw" | "rawUnfiltered" | "powerByBand" | "psd";
2
- export declare type AmplitudeByChannel = number[][];
1
+ export type BrainwavesLabel = "raw" | "rawUnfiltered" | "powerByBand" | "psd";
2
+ export type AmplitudeByChannel = number[][];
3
+ export interface BaseInfo {
4
+ samplingRate: number;
5
+ startTime: number;
6
+ channelNames: string[];
7
+ }
8
+ export interface EpochInfo extends BaseInfo {
9
+ notchFrequency?: string;
10
+ }
3
11
  export interface Epoch {
4
12
  data: AmplitudeByChannel;
5
- info: {
6
- samplingRate: number;
7
- startTime: number;
8
- };
13
+ info: EpochInfo;
14
+ }
15
+ export interface RawUnfilteredEpochInfo extends BaseInfo {
16
+ }
17
+ export interface RawUnfilteredEpoch {
18
+ data: AmplitudeByChannel;
19
+ info: RawUnfilteredEpochInfo;
20
+ }
21
+ export type PSDByChannel = number[][];
22
+ export interface PSDInfo extends BaseInfo {
23
+ notchFrequency: string;
9
24
  }
10
- export declare type PSDByChannel = number[][];
11
25
  export interface PSD {
26
+ label: "psd";
12
27
  psd: PSDByChannel;
13
28
  freqs: number[];
14
- info: {
15
- samplingRate: number;
16
- startTime: number;
17
- };
29
+ info: PSDInfo;
18
30
  }
19
- export declare type BandName = "gamma" | "beta" | "alpha" | "theta" | "delta";
31
+ export type BandName = "gamma" | "beta" | "alpha" | "theta" | "delta";
20
32
  export interface PowerByBand {
21
33
  gamma: number[];
22
34
  beta: number[];
23
35
  alpha: number[];
24
36
  theta: number[];
25
37
  delta: number[];
38
+ info: BaseInfo;
26
39
  }
@@ -1,12 +1,12 @@
1
- export declare type CustomToken = {
1
+ export type CustomToken = {
2
2
  customToken: string;
3
3
  };
4
- export declare type EmailAndPassword = {
4
+ export type EmailAndPassword = {
5
5
  email: string;
6
6
  password: string;
7
7
  };
8
- export declare type OAuthCredentials = {
8
+ export type OAuthCredentials = {
9
9
  idToken: string;
10
10
  providerId: string;
11
11
  };
12
- export declare type Credentials = EmailAndPassword | OAuthCredentials | CustomToken;
12
+ export type Credentials = EmailAndPassword | OAuthCredentials | CustomToken;
@@ -1,4 +1,4 @@
1
- export declare type OSVersion = string;
1
+ export type OSVersion = string;
2
2
  export interface DeviceInfo {
3
3
  deviceId: string;
4
4
  deviceNickname: string;
@@ -13,7 +13,7 @@ export interface DeviceInfo {
13
13
  apiVersion: string;
14
14
  emulator?: boolean;
15
15
  }
16
- declare type DeviceSelectorKeyValue = [string, string | number | string[]];
17
- declare type DeviceSelectorFunction = (devices: DeviceInfo[]) => DeviceInfo;
18
- export declare type DeviceSelector = DeviceSelectorKeyValue | DeviceSelectorFunction;
16
+ type DeviceSelectorKeyValue = [string, string | number | string[]];
17
+ type DeviceSelectorFunction = (devices: DeviceInfo[]) => DeviceInfo;
18
+ export type DeviceSelector = DeviceSelectorKeyValue | DeviceSelectorFunction;
19
19
  export {};
@@ -2,7 +2,7 @@ import { Marker } from "./marker";
2
2
  /**
3
3
  * @hidden
4
4
  */
5
- export declare type Epoch = {
5
+ export type Epoch = {
6
6
  data: number[];
7
7
  info?: {
8
8
  channelNames?: string[];
@@ -1,4 +1,4 @@
1
- export declare type Experiment = {
1
+ export type Experiment = {
2
2
  deviceId: string;
3
3
  id: string;
4
4
  labels: string[];
@@ -1,4 +1,4 @@
1
- export declare type HapticEffects = {
1
+ export type HapticEffects = {
2
2
  strongClick100: string;
3
3
  strongClick60: string;
4
4
  strongClick30: string;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @hidden
3
3
  */
4
- export declare type Marker = {
4
+ export type Marker = {
5
5
  label: string;
6
6
  timestamp: number;
7
7
  };
@@ -2,11 +2,11 @@ import { PendingSubscription, Subscription } from "./subscriptions";
2
2
  /**
3
3
  * @hidden
4
4
  */
5
- declare type SubscriptionListener = Function;
5
+ type SubscriptionListener = Function;
6
6
  /**
7
7
  * @hidden
8
8
  */
9
- export declare type MetricValue = {
9
+ export type MetricValue = {
10
10
  [label: string]: any;
11
11
  };
12
12
  /**
@@ -1,4 +1,4 @@
1
- export declare type OAuthConfig = {
1
+ export type OAuthConfig = {
2
2
  clientId: string;
3
3
  clientSecret?: string;
4
4
  responseType: "token" | "code";
@@ -6,15 +6,15 @@ export declare type OAuthConfig = {
6
6
  scope: string[];
7
7
  state: string;
8
8
  };
9
- export declare type OAuthQuery = {
9
+ export type OAuthQuery = {
10
10
  clientId: string;
11
11
  clientSecret: string;
12
12
  userId: string;
13
13
  };
14
- export declare type OAuthQueryResult = {
14
+ export type OAuthQueryResult = {
15
15
  customToken: string;
16
16
  userId: string;
17
17
  };
18
- export declare type OAuthRemoveResponse = {
18
+ export type OAuthRemoveResponse = {
19
19
  ok: boolean;
20
20
  };
@@ -2,7 +2,7 @@ import { Marker } from "./marker";
2
2
  /**
3
3
  * @hidden
4
4
  */
5
- export declare type Sample = {
5
+ export type Sample = {
6
6
  data: number[];
7
7
  timestamp: number;
8
8
  count?: number;
@@ -12,4 +12,4 @@ export declare type Sample = {
12
12
  /**
13
13
  * @hidden
14
14
  */
15
- export declare type CSVSample = number[];
15
+ export type CSVSample = number[];
@@ -1,4 +1,4 @@
1
- declare type ChannelQuality = {
1
+ type ChannelQuality = {
2
2
  standardDeviation: number;
3
3
  status: "great" | "good" | "bad" | "noContact";
4
4
  };
@@ -2,7 +2,7 @@ import { Observable } from "rxjs";
2
2
  /**
3
3
  * @hidden
4
4
  */
5
- declare type SkillProps = {
5
+ type SkillProps = {
6
6
  [key: string]: string | number | boolean;
7
7
  };
8
8
  /**
@@ -37,7 +37,7 @@ export interface DeviceSkill {
37
37
  /**
38
38
  * @hidden
39
39
  */
40
- declare type SkillMetric = {
40
+ type SkillMetric = {
41
41
  [key: string]: any;
42
42
  };
43
43
  /**
@@ -1,12 +1,12 @@
1
- export declare type UserDevice = {
1
+ export type UserDevice = {
2
2
  claimedOn: number;
3
3
  };
4
- export declare type UserDevices = {
4
+ export type UserDevices = {
5
5
  [deviceId: string]: UserDevice;
6
6
  };
7
7
  /**
8
8
  * @hidden
9
9
  */
10
- export declare type UserClaims = {
10
+ export type UserClaims = {
11
11
  [claimName: string]: boolean | string;
12
12
  };
@@ -1,5 +1,5 @@
1
1
  import { Action } from "../types/actions";
2
- declare type OAuthClaims = {
2
+ type OAuthClaims = {
3
3
  oauth?: true;
4
4
  authId?: string;
5
5
  scopes?: string;
@@ -1,9 +1,9 @@
1
- export declare type TransferDeviceByEmail = {
1
+ export type TransferDeviceByEmail = {
2
2
  recipientsEmail: string;
3
3
  deviceId: string;
4
4
  };
5
- export declare type TransferDeviceByUserId = {
5
+ export type TransferDeviceByUserId = {
6
6
  recipientsUserId: string;
7
7
  deviceId: string;
8
8
  };
9
- export declare type TransferDeviceOptions = TransferDeviceByEmail | TransferDeviceByUserId;
9
+ export type TransferDeviceOptions = TransferDeviceByEmail | TransferDeviceByUserId;
@@ -1,6 +1,6 @@
1
1
  import { Observable } from "rxjs";
2
2
  import { DeviceStatus } from "../types/status";
3
- declare type Options = {
3
+ type Options = {
4
4
  status$: Observable<DeviceStatus>;
5
5
  allowWhileOnSleepMode: boolean;
6
6
  };