@nxtedition/lib 21.10.1 → 22.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 +7 -3
- package/http.js +17 -11
- package/package.json +1 -1
package/app.js
CHANGED
|
@@ -47,7 +47,7 @@ export function makeApp(appConfig, onTerminate) {
|
|
|
47
47
|
let trace
|
|
48
48
|
|
|
49
49
|
try {
|
|
50
|
-
mkdirSync('
|
|
50
|
+
mkdirSync('./.nxt')
|
|
51
51
|
} catch (err) {
|
|
52
52
|
if (err.code !== 'EEXIST') {
|
|
53
53
|
throw err
|
|
@@ -329,7 +329,7 @@ export function makeApp(appConfig, onTerminate) {
|
|
|
329
329
|
if (appConfig.couchdb || appConfig.couch) {
|
|
330
330
|
const couchConfig = fp.mergeAll(
|
|
331
331
|
[
|
|
332
|
-
{ userAgent, url: isProduction ?
|
|
332
|
+
{ userAgent, url: isProduction ? 'http://couchdb:5984/nxt' : 'http://127.0.0.1:5984/nxt' },
|
|
333
333
|
appConfig.couchdb,
|
|
334
334
|
appConfig.couch,
|
|
335
335
|
config.couchdb,
|
|
@@ -356,7 +356,10 @@ export function makeApp(appConfig, onTerminate) {
|
|
|
356
356
|
if (appConfig.deepstream) {
|
|
357
357
|
let dsConfig = fp.mergeAll(
|
|
358
358
|
[
|
|
359
|
-
{
|
|
359
|
+
{
|
|
360
|
+
userAgent,
|
|
361
|
+
url: isProduction ? 'ws://deepstream:6020/deepstream' : 'ws://127.0.0.1:6020/deepstream',
|
|
362
|
+
},
|
|
360
363
|
appConfig.deepstream,
|
|
361
364
|
config.deepstream,
|
|
362
365
|
].map((x) => {
|
|
@@ -582,6 +585,7 @@ export function makeApp(appConfig, onTerminate) {
|
|
|
582
585
|
[
|
|
583
586
|
status$.pipe(
|
|
584
587
|
rx.filter(Boolean),
|
|
588
|
+
rx.map((xs) => (Array.isArray(xs) ? { messages: xs } : xs)),
|
|
585
589
|
rx.catchError((err) => {
|
|
586
590
|
logger.error({ err }, 'monitor.status')
|
|
587
591
|
return rxjs.of([
|
package/http.js
CHANGED
|
@@ -65,20 +65,20 @@ export class Context {
|
|
|
65
65
|
return this.#userAgent
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
get signal() {
|
|
73
|
-
this.#ac ??= new AbortController()
|
|
74
|
-
return this.#ac.signal
|
|
68
|
+
/** @deprecated */
|
|
69
|
+
get method() {
|
|
70
|
+
return this.#req.method
|
|
75
71
|
}
|
|
76
72
|
|
|
73
|
+
/** @deprecated */
|
|
77
74
|
get url() {
|
|
78
|
-
this.#url
|
|
75
|
+
if (this.#url === undefined) {
|
|
76
|
+
this.#url = requestTarget(this.#req)
|
|
77
|
+
}
|
|
79
78
|
return this.#url
|
|
80
79
|
}
|
|
81
80
|
|
|
81
|
+
/** @deprecated */
|
|
82
82
|
set url(value) {
|
|
83
83
|
if (typeof value !== 'string') {
|
|
84
84
|
throw new Error('url must be a string')
|
|
@@ -89,6 +89,7 @@ export class Context {
|
|
|
89
89
|
this.#query = undefined
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
+
/** @deprecated */
|
|
92
93
|
get query() {
|
|
93
94
|
if (this.#query === undefined) {
|
|
94
95
|
this.#query = this.url.search.length > 1 ? querystring.parse(this.url.search.slice(1)) : {}
|
|
@@ -108,8 +109,13 @@ export class Context {
|
|
|
108
109
|
return this.#res
|
|
109
110
|
}
|
|
110
111
|
|
|
111
|
-
get
|
|
112
|
-
return this.#
|
|
112
|
+
get [kAbortController]() {
|
|
113
|
+
return this.#ac
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
get signal() {
|
|
117
|
+
this.#ac ??= new AbortController()
|
|
118
|
+
return this.#ac.signal
|
|
113
119
|
}
|
|
114
120
|
}
|
|
115
121
|
|
|
@@ -117,7 +123,7 @@ function noop() {}
|
|
|
117
123
|
|
|
118
124
|
const pendingSet = (globalThis._nxt_lib_http_pending ??= new Set())
|
|
119
125
|
|
|
120
|
-
export async function
|
|
126
|
+
export async function requestMiddleware(ctx, next) {
|
|
121
127
|
const { req, res, logger } = ctx
|
|
122
128
|
const startTime = performance.now()
|
|
123
129
|
|