@nxtedition/lib 19.0.17 → 19.0.19
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 +2 -2
- package/couch.js +1 -1
- package/deepstream.js +32 -0
- package/mime.js +9 -9
- package/package.json +1 -1
package/app.js
CHANGED
|
@@ -653,7 +653,7 @@ export function makeApp(appConfig, onTerminate) {
|
|
|
653
653
|
}
|
|
654
654
|
})
|
|
655
655
|
|
|
656
|
-
appDestroyers.
|
|
656
|
+
appDestroyers.unshift(() => {
|
|
657
657
|
if (unprovide) {
|
|
658
658
|
unprovide()
|
|
659
659
|
}
|
|
@@ -661,7 +661,7 @@ export function makeApp(appConfig, onTerminate) {
|
|
|
661
661
|
}
|
|
662
662
|
}
|
|
663
663
|
|
|
664
|
-
if (appConfig.trace) {
|
|
664
|
+
if (appConfig.trace && isProduction) {
|
|
665
665
|
const traceConfig = { ...appConfig.trace, ...config.trace }
|
|
666
666
|
if (traceConfig.url) {
|
|
667
667
|
trace = makeTrace({ ...traceConfig, destroyers: appDestroyers, logger, serviceName })
|
package/couch.js
CHANGED
package/deepstream.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import qs from 'qs'
|
|
2
2
|
import cached from './util/cached.js'
|
|
3
|
+
import * as rxjs from 'rxjs'
|
|
3
4
|
|
|
4
5
|
function provide(ds, domain, callback, options) {
|
|
5
6
|
if (domain instanceof RegExp) {
|
|
@@ -117,6 +118,34 @@ function get(ds, name, ...args) {
|
|
|
117
118
|
)
|
|
118
119
|
}
|
|
119
120
|
|
|
121
|
+
function query(ds, designId, options) {
|
|
122
|
+
const next = (startkey, prevRows, limit) =>
|
|
123
|
+
!limit
|
|
124
|
+
? rxjs.of({ rows: prevRows ?? [] })
|
|
125
|
+
: ds.nxt.record
|
|
126
|
+
.observe(
|
|
127
|
+
designId,
|
|
128
|
+
{
|
|
129
|
+
...options,
|
|
130
|
+
startkey,
|
|
131
|
+
limit: Number.isFinite(limit) ? limit : null,
|
|
132
|
+
},
|
|
133
|
+
ds.record.PROVIDER,
|
|
134
|
+
)
|
|
135
|
+
.pipe(
|
|
136
|
+
rxjs.switchMap(({ rows, finished }) =>
|
|
137
|
+
rows.length < limit && finished
|
|
138
|
+
? rxjs.of({ rows: prevRows ? [...prevRows, ...rows] : rows })
|
|
139
|
+
: next(
|
|
140
|
+
rows.findLast((x) => x.key), // TODO (fix): Is this correct, is it include or exclusive?
|
|
141
|
+
rows,
|
|
142
|
+
limit - rows.length,
|
|
143
|
+
),
|
|
144
|
+
),
|
|
145
|
+
)
|
|
146
|
+
return next(options.startkey, null, options.limit ?? Infinity)
|
|
147
|
+
}
|
|
148
|
+
|
|
120
149
|
export function makeDeepstream(ds) {
|
|
121
150
|
const nxt = {
|
|
122
151
|
ds,
|
|
@@ -124,6 +153,7 @@ export function makeDeepstream(ds) {
|
|
|
124
153
|
provide: (...args) => provide(ds, ...args),
|
|
125
154
|
observe: (...args) => observe(ds, ...args),
|
|
126
155
|
observe2: (...args) => observe2(ds, ...args),
|
|
156
|
+
query: (...args) => query(ds, ...args),
|
|
127
157
|
set: (...args) => ds.record.set(...args),
|
|
128
158
|
get: (...args) => get(ds, ...args),
|
|
129
159
|
update: (...args) => ds.record.update(...args),
|
|
@@ -137,11 +167,13 @@ Object.assign(makeDeepstream, {
|
|
|
137
167
|
provide,
|
|
138
168
|
observe,
|
|
139
169
|
observe2,
|
|
170
|
+
query,
|
|
140
171
|
get,
|
|
141
172
|
record: {
|
|
142
173
|
provide,
|
|
143
174
|
observe,
|
|
144
175
|
observe2,
|
|
176
|
+
query,
|
|
145
177
|
get,
|
|
146
178
|
},
|
|
147
179
|
})
|
package/mime.js
CHANGED
|
@@ -29,29 +29,29 @@ export function lookup(name) {
|
|
|
29
29
|
return mime.getType(name)
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
export function extension(
|
|
33
|
-
if (typeof
|
|
32
|
+
export function extension(mimeType, fileName) {
|
|
33
|
+
if (typeof mimeType !== 'string' || mimeType.length === 0) {
|
|
34
34
|
return null
|
|
35
35
|
}
|
|
36
|
-
if (/video\/(x-)?nut/.test(
|
|
36
|
+
if (/video\/(x-)?nut/.test(mimeType)) {
|
|
37
37
|
return 'nut'
|
|
38
38
|
}
|
|
39
|
-
if (/video\/(x-)?dnxhd/.test(
|
|
39
|
+
if (/video\/(x-)?dnxhd/.test(mimeType)) {
|
|
40
40
|
return 'dnxhd'
|
|
41
41
|
}
|
|
42
|
-
if (/audio\/(x-)?pcm-s32le/.test(
|
|
42
|
+
if (/audio\/(x-)?pcm-s32le/.test(mimeType)) {
|
|
43
43
|
return 'pcm-s32le'
|
|
44
44
|
}
|
|
45
|
-
if (/audio\/(x-)?pcm-s24le/.test(
|
|
45
|
+
if (/audio\/(x-)?pcm-s24le/.test(mimeType)) {
|
|
46
46
|
return 'pcm-s24le'
|
|
47
47
|
}
|
|
48
|
-
if (/audio\/(x-)?pcm-s16le/.test(
|
|
48
|
+
if (/audio\/(x-)?pcm-s16le/.test(mimeType)) {
|
|
49
49
|
return 'pcm-s16le'
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
const extension = mime.getExtension(
|
|
52
|
+
const extension = mime.getExtension(mimeType) || (mimeType || '').split('/').pop()
|
|
53
53
|
|
|
54
|
-
if (extension === 'qt' && typeof
|
|
54
|
+
if (extension === 'qt' && typeof fileName === 'string' && fileName.endsWith('.mov')) {
|
|
55
55
|
return 'mov'
|
|
56
56
|
}
|
|
57
57
|
|