@niledatabase/server 5.0.0-alpha.16 → 5.0.0-alpha.17
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/dist/index.d.mts +2 -6
- package/dist/index.d.ts +2 -6
- package/dist/index.js +24 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -3223,6 +3223,19 @@ var Server = class {
|
|
|
3223
3223
|
* @returns undefined
|
|
3224
3224
|
*/
|
|
3225
3225
|
setContext = (req, ...remaining) => {
|
|
3226
|
+
let ok = false;
|
|
3227
|
+
if (req && typeof req === "object" && "tenantId" in req) {
|
|
3228
|
+
ok = true;
|
|
3229
|
+
this.#config.tenantId = req.tenantId;
|
|
3230
|
+
}
|
|
3231
|
+
if (req && typeof req === "object" && "userId" in req) {
|
|
3232
|
+
ok = true;
|
|
3233
|
+
this.#config.userId = req.userId;
|
|
3234
|
+
}
|
|
3235
|
+
if (req && typeof req === "object" && "preserveHeaders" in req) {
|
|
3236
|
+
ok = true;
|
|
3237
|
+
this.#preserveHeaders = Boolean(req.preserveHeaders);
|
|
3238
|
+
}
|
|
3226
3239
|
let atLeastOne = false;
|
|
3227
3240
|
if (this.#config?.extensions) {
|
|
3228
3241
|
for (const create2 of this.#config.extensions) {
|
|
@@ -3255,19 +3268,6 @@ var Server = class {
|
|
|
3255
3268
|
}
|
|
3256
3269
|
} catch {
|
|
3257
3270
|
}
|
|
3258
|
-
let ok = false;
|
|
3259
|
-
if (req && typeof req === "object" && "tenantId" in req) {
|
|
3260
|
-
ok = true;
|
|
3261
|
-
this.#config.tenantId = req.tenantId;
|
|
3262
|
-
}
|
|
3263
|
-
if (req && typeof req === "object" && "userId" in req) {
|
|
3264
|
-
ok = true;
|
|
3265
|
-
this.#config.userId = req.userId;
|
|
3266
|
-
}
|
|
3267
|
-
if (req && typeof req === "object" && "preserveHeaders" in req) {
|
|
3268
|
-
ok = true;
|
|
3269
|
-
this.#preserveHeaders = Boolean(req.preserveHeaders);
|
|
3270
|
-
}
|
|
3271
3271
|
if (ok) {
|
|
3272
3272
|
return;
|
|
3273
3273
|
}
|
|
@@ -3290,6 +3290,17 @@ var Server = class {
|
|
|
3290
3290
|
}
|
|
3291
3291
|
};
|
|
3292
3292
|
getContext() {
|
|
3293
|
+
if (this.#config?.extensions) {
|
|
3294
|
+
for (const create2 of this.#config.extensions) {
|
|
3295
|
+
if (typeof create2 !== "function") {
|
|
3296
|
+
continue;
|
|
3297
|
+
}
|
|
3298
|
+
const ext = create2(this);
|
|
3299
|
+
if (typeof ext.onGetContext === "function") {
|
|
3300
|
+
return ext.onGetContext();
|
|
3301
|
+
}
|
|
3302
|
+
}
|
|
3303
|
+
}
|
|
3293
3304
|
return {
|
|
3294
3305
|
headers: this.#headers,
|
|
3295
3306
|
userId: this.#config?.userId,
|