@nxtedition/lib 20.0.8 → 20.1.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/app.js CHANGED
@@ -440,9 +440,11 @@ export function makeApp(appConfig, onTerminate) {
440
440
  stats$ = rxjs.timer(0, 10e3).pipe(rx.map(() => ({})))
441
441
  }
442
442
 
443
+ const startTime = Date.now()
443
444
  stats$ = stats$.pipe(
444
445
  rx.map((x) => ({
445
446
  ...x,
447
+ uptime: Date.now() - startTime,
446
448
  timestamp: Date.now(),
447
449
  })),
448
450
  rx.auditTime(1e3),
package/couch.js CHANGED
@@ -130,7 +130,7 @@ export function makeCouch(opts) {
130
130
  * @param {number} [options.heartbeat=60000] - The interval at which to send a heartbeat.
131
131
  * @param {function} [options.retry=null] - The function to retry the request on error.
132
132
  * @param {string} [options.since=null] - The sequence number to start from.
133
- * @yields {Array<{ id: string, seq?: string, doc?: string, deleted?: boolean, changes: Array<{ rev: string }> }>}
133
+ * @yields {Array<{ id: string, seq?: string, doc?: Object, deleted?: boolean, changes: Array<{ rev: string }> }>}
134
134
  */
135
135
  async function* changes({ client = defaultClient, signal = null, ...options } = {}) {
136
136
  const params = {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/lib",
3
- "version": "20.0.8",
3
+ "version": "20.1.0",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "type": "module",
package/sequence.js CHANGED
@@ -24,9 +24,36 @@ export class Sequence {
24
24
  #parts = []
25
25
  #identity
26
26
 
27
+ // TODO (perf): Optimize
28
+ static compare(a, b) {
29
+ if (!a && !b) {
30
+ return 0
31
+ }
32
+
33
+ if (a && !b) {
34
+ return 1
35
+ }
36
+
37
+ if (!a && b) {
38
+ return -1
39
+ }
40
+
41
+ if (typeof a === 'string') {
42
+ a = new Sequence(a)
43
+ }
44
+
45
+ if (typeof b === 'string') {
46
+ b = new Sequence(b)
47
+ }
48
+
49
+ return a.compare(b)
50
+ }
51
+
27
52
  constructor(value, identity) {
28
53
  try {
29
- if (Array.isArray(value)) {
54
+ if (!value) {
55
+ this.#value = '0'
56
+ } else if (Array.isArray(value)) {
30
57
  for (const part of value) {
31
58
  if (typeof part === 'string') {
32
59
  const [sequenceStr, id] = part.split(ID_SEP)