@nxtedition/lib 15.0.26 → 15.0.27
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/package.json +1 -1
- package/util/template/index.js +8 -7
package/package.json
CHANGED
package/util/template/index.js
CHANGED
|
@@ -108,7 +108,7 @@ module.exports = ({ ds, proxify }) => {
|
|
|
108
108
|
ret[indices[n]] = values[n]
|
|
109
109
|
}
|
|
110
110
|
return ret
|
|
111
|
-
})
|
|
111
|
+
}),
|
|
112
112
|
)
|
|
113
113
|
}
|
|
114
114
|
: null
|
|
@@ -145,7 +145,7 @@ module.exports = ({ ds, proxify }) => {
|
|
|
145
145
|
ret[indices[n]] = values[n]
|
|
146
146
|
}
|
|
147
147
|
return ret
|
|
148
|
-
})
|
|
148
|
+
}),
|
|
149
149
|
)
|
|
150
150
|
}
|
|
151
151
|
: null
|
|
@@ -174,7 +174,7 @@ module.exports = ({ ds, proxify }) => {
|
|
|
174
174
|
compileStringTemplate(post)?.(str, args$) ?? rxjs.of(post),
|
|
175
175
|
])
|
|
176
176
|
.pipe(
|
|
177
|
-
rx.map(([pre, body, post]) => (pre || post ? `${pre}${stringify(body)}${post}` : body))
|
|
177
|
+
rx.map(([pre, body, post]) => (pre || post ? `${pre}${stringify(body)}${post}` : body)),
|
|
178
178
|
)
|
|
179
179
|
} else if (type === 'nxt') {
|
|
180
180
|
const expr = compilers.nxt(body)
|
|
@@ -185,7 +185,7 @@ module.exports = ({ ds, proxify }) => {
|
|
|
185
185
|
|
|
186
186
|
return (str, args$) =>
|
|
187
187
|
expr(args$).pipe(
|
|
188
|
-
rx.switchMap((body) => onResolveTemplate(`${pre}${stringify(body, true)}${post}`, args$))
|
|
188
|
+
rx.switchMap((body) => onResolveTemplate(`${pre}${stringify(body, true)}${post}`, args$)),
|
|
189
189
|
)
|
|
190
190
|
} else {
|
|
191
191
|
throw new Error('unknown expression type: ' + type)
|
|
@@ -219,12 +219,13 @@ module.exports = ({ ds, proxify }) => {
|
|
|
219
219
|
return null
|
|
220
220
|
}
|
|
221
221
|
},
|
|
222
|
-
(template, hash) => hash
|
|
222
|
+
(template, hash) => hash,
|
|
223
223
|
)
|
|
224
224
|
|
|
225
225
|
function compileTemplate(template) {
|
|
226
226
|
const hash = hashTemplate(template)
|
|
227
|
-
|
|
227
|
+
const resolver = hash ? compileTemplateCache(template, hash) : null
|
|
228
|
+
return resolver ? (args$) => resolver(template, args$) : null
|
|
228
229
|
}
|
|
229
230
|
|
|
230
231
|
async function resolveTemplate(template, args$, options) {
|
|
@@ -233,7 +234,7 @@ module.exports = ({ ds, proxify }) => {
|
|
|
233
234
|
|
|
234
235
|
function onResolveTemplate(template, args$) {
|
|
235
236
|
try {
|
|
236
|
-
return compileTemplate(template)?.(
|
|
237
|
+
return compileTemplate(template)?.(args$) ?? rxjs.of(template)
|
|
237
238
|
} catch (err) {
|
|
238
239
|
return rxjs.throwError(() => err)
|
|
239
240
|
}
|