@nxtedition/lib 26.8.8 → 27.0.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 +39 -8
- package/couch.d.ts +1 -0
- package/couch.js +1 -1
- package/numa.js +22 -13
- package/package.json +10 -48
- package/rxjs/auditMap.js +0 -111
- package/rxjs/auditMap.test.js +0 -64
- package/rxjs/combineMap.d.ts +0 -6
- package/rxjs/combineMap.js +0 -152
- package/rxjs/combineMap.test.js +0 -199
- package/rxjs/firstValueFrom.d.ts +0 -12
- package/rxjs/firstValueFrom.js +0 -18
- package/rxjs/lastValueFrom.js +0 -14
- package/rxjs/retry.js +0 -112
- package/rxjs/withAbortSignal.js +0 -31
- package/s3.js +0 -339
- package/timeline.js +0 -115
- package/util/template/index-common.d.ts +0 -67
- package/util/template/index-common.js +0 -226
- package/util/template/index-web.d.ts +0 -1
- package/util/template/index-web.js +0 -28
- package/util/template/index.d.ts +0 -1
- package/util/template/index.js +0 -26
- package/util/template/index.test.js +0 -94
- package/util/template/javascript.js +0 -692
- package/util/template/nextpressions.js +0 -600
- package/util/template/nextpressions.test.js +0 -165
- package/util/template/transform.js +0 -22
- package/util/template/transform.test.js +0 -16
- package/weakCache.d.ts +0 -4
- package/weakCache.js +0 -25
- package/yield.js +0 -103
package/rxjs/combineMap.test.js
DELETED
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
import { test } from 'node:test'
|
|
2
|
-
import combineMap from './combineMap.js'
|
|
3
|
-
import * as rxjs from 'rxjs'
|
|
4
|
-
|
|
5
|
-
test('combineMap sync', (t) => {
|
|
6
|
-
t.plan(1, { wait: true })
|
|
7
|
-
rxjs
|
|
8
|
-
.of([1, 2, 3])
|
|
9
|
-
.pipe(combineMap((val) => rxjs.of(val * 2)))
|
|
10
|
-
.subscribe((val) => {
|
|
11
|
-
t.assert.deepStrictEqual(val, [2, 4, 6])
|
|
12
|
-
})
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
test('combineMap async', (t) => {
|
|
16
|
-
t.plan(1, { wait: true })
|
|
17
|
-
rxjs
|
|
18
|
-
.of([1, 2, 3])
|
|
19
|
-
.pipe(combineMap(async (val) => val * 2))
|
|
20
|
-
.subscribe((val) => {
|
|
21
|
-
t.assert.deepStrictEqual(val, [2, 4, 6])
|
|
22
|
-
})
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
test('combineMap empty', (t) => {
|
|
26
|
-
t.plan(1, { wait: true })
|
|
27
|
-
rxjs
|
|
28
|
-
.of([])
|
|
29
|
-
.pipe(combineMap((val) => rxjs.of(val * 2)))
|
|
30
|
-
.subscribe((val) => {
|
|
31
|
-
t.assert.deepStrictEqual(val, [])
|
|
32
|
-
})
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
test('combineMap throw in resolver', (t) => {
|
|
36
|
-
t.plan(1, { wait: true })
|
|
37
|
-
const _err = new Error('asd')
|
|
38
|
-
rxjs
|
|
39
|
-
.of([1, 2, 3])
|
|
40
|
-
.pipe(
|
|
41
|
-
combineMap((val) => {
|
|
42
|
-
throw _err
|
|
43
|
-
}),
|
|
44
|
-
)
|
|
45
|
-
.subscribe({
|
|
46
|
-
error: (err) => {
|
|
47
|
-
t.assert.strictEqual(err, _err)
|
|
48
|
-
},
|
|
49
|
-
})
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
test('combineMap throw in source', (t) => {
|
|
53
|
-
t.plan(1, { wait: true })
|
|
54
|
-
const _err = new Error('asd')
|
|
55
|
-
rxjs
|
|
56
|
-
.throwError(() => _err)
|
|
57
|
-
.pipe(combineMap((val) => rxjs.of(val)))
|
|
58
|
-
.subscribe({
|
|
59
|
-
error: (err) => {
|
|
60
|
-
t.assert.strictEqual(err, _err)
|
|
61
|
-
},
|
|
62
|
-
})
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
test('combineMap bad resolve', (t) => {
|
|
66
|
-
t.plan(1, { wait: true })
|
|
67
|
-
rxjs
|
|
68
|
-
.of([1])
|
|
69
|
-
.pipe(combineMap((val) => val))
|
|
70
|
-
.subscribe({
|
|
71
|
-
error: () => {
|
|
72
|
-
t.assert.ok(true)
|
|
73
|
-
},
|
|
74
|
-
})
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
test('combineMap no change no tick', (t) => {
|
|
78
|
-
t.plan(1, { wait: true })
|
|
79
|
-
rxjs
|
|
80
|
-
.concat(
|
|
81
|
-
rxjs.timer(10).pipe(rxjs.map(() => [1, 2, 3])),
|
|
82
|
-
rxjs.timer(10).pipe(rxjs.map(() => [1, 2, 3])),
|
|
83
|
-
)
|
|
84
|
-
.pipe(combineMap((val) => rxjs.of(val * 2)))
|
|
85
|
-
.subscribe(() => {
|
|
86
|
-
t.assert.ok(true)
|
|
87
|
-
})
|
|
88
|
-
})
|
|
89
|
-
|
|
90
|
-
test('combineMap combine in single tick', (t) => {
|
|
91
|
-
t.plan(2, { wait: true })
|
|
92
|
-
rxjs
|
|
93
|
-
.concat(
|
|
94
|
-
rxjs.timer(10).pipe(rxjs.map(() => [1, 2, 3])),
|
|
95
|
-
rxjs.timer(10).pipe(rxjs.map(() => [4, 5, 6])),
|
|
96
|
-
)
|
|
97
|
-
.pipe(combineMap((val) => rxjs.from([val * 2, val * 2])))
|
|
98
|
-
.subscribe(() => {
|
|
99
|
-
t.assert.ok(true)
|
|
100
|
-
})
|
|
101
|
-
})
|
|
102
|
-
|
|
103
|
-
test('combineLatest completion', (t) => {
|
|
104
|
-
t.plan(1, { wait: true })
|
|
105
|
-
rxjs.combineLatest([1, 2, 3].map((x) => rxjs.of(x))).subscribe({
|
|
106
|
-
complete: () => {
|
|
107
|
-
t.assert.ok(true)
|
|
108
|
-
},
|
|
109
|
-
})
|
|
110
|
-
})
|
|
111
|
-
|
|
112
|
-
test('combineMap completion', (t) => {
|
|
113
|
-
t.plan(1, { wait: true })
|
|
114
|
-
rxjs
|
|
115
|
-
.of([1, 2, 3])
|
|
116
|
-
.pipe(combineMap((x) => rxjs.of(x)))
|
|
117
|
-
.subscribe({
|
|
118
|
-
complete: () => {
|
|
119
|
-
t.assert.ok(true)
|
|
120
|
-
},
|
|
121
|
-
})
|
|
122
|
-
})
|
|
123
|
-
|
|
124
|
-
test('combineLatest no completion', (t) => {
|
|
125
|
-
t.plan(1, { wait: true })
|
|
126
|
-
const subscription = rxjs
|
|
127
|
-
.combineLatest([1, 2, 3].map((x) => rxjs.timer(0, 1e3).pipe(rxjs.map(() => x))))
|
|
128
|
-
.subscribe({
|
|
129
|
-
next: () => {
|
|
130
|
-
t.assert.ok(true)
|
|
131
|
-
},
|
|
132
|
-
complete: () => {
|
|
133
|
-
t.assert.fail()
|
|
134
|
-
},
|
|
135
|
-
})
|
|
136
|
-
t.after(() => subscription.unsubscribe())
|
|
137
|
-
})
|
|
138
|
-
|
|
139
|
-
test('combineMap no completion', (t) => {
|
|
140
|
-
t.plan(1, { wait: true })
|
|
141
|
-
const subscription = rxjs
|
|
142
|
-
.of([1, 2, 3])
|
|
143
|
-
.pipe(combineMap((x) => rxjs.timer(0, 1e3).pipe(rxjs.map(() => x))))
|
|
144
|
-
.subscribe({
|
|
145
|
-
next: () => {
|
|
146
|
-
t.assert.ok(true)
|
|
147
|
-
},
|
|
148
|
-
complete: () => {
|
|
149
|
-
t.assert.fail()
|
|
150
|
-
},
|
|
151
|
-
})
|
|
152
|
-
t.after(() => subscription.unsubscribe())
|
|
153
|
-
})
|
|
154
|
-
|
|
155
|
-
test('combineLatest no value', (t) => {
|
|
156
|
-
t.plan(1, { wait: true })
|
|
157
|
-
rxjs.combineLatest([1, 2, 3].map((x) => rxjs.EMPTY)).subscribe({
|
|
158
|
-
complete: () => {
|
|
159
|
-
t.assert.ok(true)
|
|
160
|
-
},
|
|
161
|
-
})
|
|
162
|
-
})
|
|
163
|
-
|
|
164
|
-
test('combineMap no value', (t) => {
|
|
165
|
-
t.plan(1, { wait: true })
|
|
166
|
-
rxjs
|
|
167
|
-
.of([1, 2, 3])
|
|
168
|
-
.pipe(combineMap((x) => rxjs.EMPTY))
|
|
169
|
-
.subscribe({
|
|
170
|
-
complete: () => {
|
|
171
|
-
t.assert.ok(true)
|
|
172
|
-
},
|
|
173
|
-
})
|
|
174
|
-
})
|
|
175
|
-
|
|
176
|
-
test('combineMap object keys removed', (t) => {
|
|
177
|
-
t.plan(3, { wait: true })
|
|
178
|
-
const a = {}
|
|
179
|
-
const b = {}
|
|
180
|
-
const c = {}
|
|
181
|
-
|
|
182
|
-
let i = 0
|
|
183
|
-
rxjs
|
|
184
|
-
.concat(rxjs.of([a, b, c]), rxjs.of([a, b]).pipe(rxjs.delay(10)))
|
|
185
|
-
.pipe(combineMap((x) => rxjs.of(x)))
|
|
186
|
-
.subscribe({
|
|
187
|
-
next: (value) => {
|
|
188
|
-
if (i === 0) {
|
|
189
|
-
t.assert.deepStrictEqual(value, [a, b, c])
|
|
190
|
-
} else if (i === 1) {
|
|
191
|
-
t.assert.deepStrictEqual(value, [a, b])
|
|
192
|
-
}
|
|
193
|
-
i++
|
|
194
|
-
},
|
|
195
|
-
complete: () => {
|
|
196
|
-
t.assert.ok(true)
|
|
197
|
-
},
|
|
198
|
-
})
|
|
199
|
-
})
|
package/rxjs/firstValueFrom.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Observable } from 'rxjs'
|
|
2
|
-
|
|
3
|
-
interface FirstValueFromConfig<T> {
|
|
4
|
-
signal?: AbortSignal
|
|
5
|
-
timeout?: number
|
|
6
|
-
defaultValue?: T
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export default function firstValueFrom<T>(
|
|
10
|
-
source: Observable<T>,
|
|
11
|
-
config?: FirstValueFromConfig<T>,
|
|
12
|
-
): Promise<T>
|
package/rxjs/firstValueFrom.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import * as rxjs from 'rxjs'
|
|
2
|
-
import withAbortSignal from './withAbortSignal.js'
|
|
3
|
-
|
|
4
|
-
export default function firstValueFrom(x$, config) {
|
|
5
|
-
const hasConfig = config && typeof config === 'object'
|
|
6
|
-
const signal = hasConfig ? config.signal : undefined
|
|
7
|
-
const timeout = hasConfig ? config.timeout : undefined
|
|
8
|
-
|
|
9
|
-
if (signal) {
|
|
10
|
-
x$ = x$.pipe(withAbortSignal(signal))
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
if (timeout) {
|
|
14
|
-
x$ = x$.pipe(rxjs.timeout(timeout))
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return rxjs.firstValueFrom(x$, config)
|
|
18
|
-
}
|
package/rxjs/lastValueFrom.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { EMPTY, fromEvent, takeUntil, throwIfEmpty, last } from 'rxjs'
|
|
2
|
-
import { AbortError } from '../errors'
|
|
3
|
-
|
|
4
|
-
export default function lastValueFrom(x$, config) {
|
|
5
|
-
const hasConfig = config && typeof config === 'object'
|
|
6
|
-
const signal = hasConfig ? config.signal : undefined
|
|
7
|
-
|
|
8
|
-
if (signal) {
|
|
9
|
-
x$ = signal.aborted ? EMPTY : x$.pipe(takeUntil(fromEvent(signal, 'abort')))
|
|
10
|
-
x$ = x$.pipe(throwIfEmpty(() => new AbortError()))
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
return x$.pipe(last(hasConfig ? config.defaultValue : undefined)).toPromise()
|
|
14
|
-
}
|
package/rxjs/retry.js
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { operate } from 'rxjs/internal/util/lift'
|
|
2
|
-
import { createOperatorSubscriber } from 'rxjs/internal/operators/OperatorSubscriber'
|
|
3
|
-
import { identity, timer } from 'rxjs'
|
|
4
|
-
import { innerFrom } from 'rxjs/internal/observable/innerFrom'
|
|
5
|
-
|
|
6
|
-
// This is from https://github.com/ReactiveX/rxjs/blob/7.x/src/internal/operators/retry.ts
|
|
7
|
-
// But with some custom code added to emit a value on each retry attempt.
|
|
8
|
-
// The default delay function is also changed to use exponential backoff, capped at 1 minute.
|
|
9
|
-
//
|
|
10
|
-
// It uses internals from rxjs, but otherwise the code would have to be modified more heavily.
|
|
11
|
-
|
|
12
|
-
const DEFAULT_DELAY = (err, retryCount) => {
|
|
13
|
-
return timer(Math.min(2 ** (retryCount - 1) * 1000, 60_000))
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export function retry(configOrCount) {
|
|
17
|
-
let config
|
|
18
|
-
if (configOrCount && typeof configOrCount === 'object') {
|
|
19
|
-
config = configOrCount
|
|
20
|
-
} else {
|
|
21
|
-
config = {
|
|
22
|
-
count: configOrCount,
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
const { count = Infinity, delay = DEFAULT_DELAY, resetOnSuccess = false, emitOnRetry } = config
|
|
26
|
-
|
|
27
|
-
return count <= 0
|
|
28
|
-
? identity
|
|
29
|
-
: operate((source, subscriber) => {
|
|
30
|
-
let soFar = 0
|
|
31
|
-
let innerSub
|
|
32
|
-
const subscribeForRetry = () => {
|
|
33
|
-
let syncUnsub = false
|
|
34
|
-
innerSub = source.subscribe(
|
|
35
|
-
createOperatorSubscriber(
|
|
36
|
-
subscriber,
|
|
37
|
-
(value) => {
|
|
38
|
-
// If we're resetting on success
|
|
39
|
-
if (resetOnSuccess) {
|
|
40
|
-
soFar = 0
|
|
41
|
-
}
|
|
42
|
-
subscriber.next(value)
|
|
43
|
-
},
|
|
44
|
-
// Completions are passed through to consumer.
|
|
45
|
-
undefined,
|
|
46
|
-
(err) => {
|
|
47
|
-
if (soFar++ < count) {
|
|
48
|
-
// We are still under our retry count
|
|
49
|
-
const resub = () => {
|
|
50
|
-
if (innerSub) {
|
|
51
|
-
innerSub.unsubscribe()
|
|
52
|
-
innerSub = null
|
|
53
|
-
subscribeForRetry()
|
|
54
|
-
} else {
|
|
55
|
-
syncUnsub = true
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// ------- START CUSTOM CODE -------
|
|
60
|
-
if (emitOnRetry) {
|
|
61
|
-
try {
|
|
62
|
-
subscriber.next(emitOnRetry(err, soFar))
|
|
63
|
-
} catch (e) {
|
|
64
|
-
subscriber.error(e)
|
|
65
|
-
return
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
// ------- END CUSTOM CODE -------
|
|
69
|
-
|
|
70
|
-
if (delay != null) {
|
|
71
|
-
// The user specified a retry delay.
|
|
72
|
-
// They gave us a number, use a timer, otherwise, it's a function,
|
|
73
|
-
// and we're going to call it to get a notifier.
|
|
74
|
-
const notifier =
|
|
75
|
-
typeof delay === 'number' ? timer(delay) : innerFrom(delay(err, soFar))
|
|
76
|
-
const notifierSubscriber = createOperatorSubscriber(
|
|
77
|
-
subscriber,
|
|
78
|
-
() => {
|
|
79
|
-
// After we get the first notification, we
|
|
80
|
-
// unsubscribe from the notifier, because we don't want anymore
|
|
81
|
-
// and we resubscribe to the source.
|
|
82
|
-
notifierSubscriber.unsubscribe()
|
|
83
|
-
resub()
|
|
84
|
-
},
|
|
85
|
-
() => {
|
|
86
|
-
// The notifier completed without emitting.
|
|
87
|
-
// The author is telling us they want to complete.
|
|
88
|
-
subscriber.complete()
|
|
89
|
-
},
|
|
90
|
-
)
|
|
91
|
-
notifier.subscribe(notifierSubscriber)
|
|
92
|
-
} else {
|
|
93
|
-
// There was no notifier given. Just resub immediately.
|
|
94
|
-
resub()
|
|
95
|
-
}
|
|
96
|
-
} else {
|
|
97
|
-
// We're past our maximum number of retries.
|
|
98
|
-
// Just send along the error.
|
|
99
|
-
subscriber.error(err)
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
),
|
|
103
|
-
)
|
|
104
|
-
if (syncUnsub) {
|
|
105
|
-
innerSub.unsubscribe()
|
|
106
|
-
innerSub = null
|
|
107
|
-
subscribeForRetry()
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
subscribeForRetry()
|
|
111
|
-
})
|
|
112
|
-
}
|
package/rxjs/withAbortSignal.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Observable } from 'rxjs'
|
|
2
|
-
import { AbortError } from '../errors.js'
|
|
3
|
-
|
|
4
|
-
function withAbortSignalImpl(signal) {
|
|
5
|
-
return new Observable((o) => {
|
|
6
|
-
o.add(this.subscribe(o))
|
|
7
|
-
|
|
8
|
-
if (!signal) {
|
|
9
|
-
return
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const onAbort = () => {
|
|
13
|
-
o.error(signal.reason ?? new AbortError())
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
if (signal.aborted) {
|
|
17
|
-
onAbort()
|
|
18
|
-
} else {
|
|
19
|
-
signal.addEventListener('abort', onAbort)
|
|
20
|
-
o.add(() => {
|
|
21
|
-
signal.removeEventListener('abort', onAbort)
|
|
22
|
-
})
|
|
23
|
-
}
|
|
24
|
-
})
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
Observable.prototype.withAbortSignal = withAbortSignalImpl
|
|
28
|
-
|
|
29
|
-
export default function withAbortSignal(signal) {
|
|
30
|
-
return (o) => withAbortSignalImpl.call(o, signal)
|
|
31
|
-
}
|