@nxtedition/lib 23.3.13 → 23.3.15
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
|
@@ -451,7 +451,7 @@ export function makeApp(appConfig, onTerminate) {
|
|
|
451
451
|
}
|
|
452
452
|
|
|
453
453
|
if (appConfig.compiler) {
|
|
454
|
-
compiler = makeTemplateCompiler({ ds, ...appConfig.compiler })
|
|
454
|
+
compiler = makeTemplateCompiler({ ds, logger, ...appConfig.compiler })
|
|
455
455
|
}
|
|
456
456
|
|
|
457
457
|
const monitorProviders = {}
|
package/package.json
CHANGED
package/util/template/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import objectHash from 'object-hash'
|
|
|
7
7
|
import { makeWeakCache } from '../../weakCache.js'
|
|
8
8
|
import firstValueFrom from '../../rxjs/firstValueFrom.js'
|
|
9
9
|
|
|
10
|
-
export function makeTemplateCompiler({ ds, proxify }) {
|
|
10
|
+
export function makeTemplateCompiler({ ds, proxify, logger = globalThis.__nxt_lib_app?.logger }) {
|
|
11
11
|
const compiler = {
|
|
12
12
|
current: null,
|
|
13
13
|
resolveTemplate,
|
|
@@ -17,8 +17,8 @@ export function makeTemplateCompiler({ ds, proxify }) {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
const compilers = {
|
|
20
|
-
nxt: getNxtpressionsCompiler({ ds }),
|
|
21
|
-
js: getJavascriptCompiler({ ds, proxify, compiler }),
|
|
20
|
+
nxt: getNxtpressionsCompiler({ ds, logger }),
|
|
21
|
+
js: getJavascriptCompiler({ ds, proxify, compiler, logger }),
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
function inner(str) {
|
|
@@ -212,7 +212,7 @@ function makeWrapper(expression) {
|
|
|
212
212
|
return (value, suspend = true) => proxify(value, expression, handler, suspend)
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
-
export default function ({ ds, proxify, compiler }) {
|
|
215
|
+
export default function ({ ds, proxify, compiler, logger }) {
|
|
216
216
|
class Expression {
|
|
217
217
|
constructor(script, expression, args, observer) {
|
|
218
218
|
this._expression = expression
|
|
@@ -405,7 +405,11 @@ export default function ({ ds, proxify, compiler }) {
|
|
|
405
405
|
})
|
|
406
406
|
|
|
407
407
|
if (this._suspended) {
|
|
408
|
-
|
|
408
|
+
if (logger) {
|
|
409
|
+
logger.error({ err })
|
|
410
|
+
} else {
|
|
411
|
+
process.emitWarning(error)
|
|
412
|
+
}
|
|
409
413
|
} else {
|
|
410
414
|
this._observer.error(error)
|
|
411
415
|
}
|
|
@@ -27,7 +27,7 @@ function asFilter(transform, predicate, obj) {
|
|
|
27
27
|
)
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
export default function ({ ds } = {}) {
|
|
30
|
+
export default function ({ ds, logger } = {}) {
|
|
31
31
|
const FILTERS = {
|
|
32
32
|
// any
|
|
33
33
|
...asFilter(null, null, {
|
|
@@ -587,8 +587,8 @@ export default function ({ ds } = {}) {
|
|
|
587
587
|
rxjs.switchMap((value) => reduceValue(value, 0, filters, options)),
|
|
588
588
|
rxjs.distinctUntilChanged(),
|
|
589
589
|
rxjs.catchError((err) => {
|
|
590
|
-
options?.logger?.error(
|
|
591
|
-
{ err,
|
|
590
|
+
;(options?.logger ?? logger)?.error(
|
|
591
|
+
{ err, data: { expression, context: JSON.stringify(context) } },
|
|
592
592
|
'expression failed',
|
|
593
593
|
)
|
|
594
594
|
return rxjs.of(null)
|