authula 0.7.10 → 0.7.11
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-B2PrZi2E.d.ts → index-C-9W0QTR.d.ts} +103 -103
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/plugins/index.d.ts +159 -159
- package/dist/plugins/index.js +16 -6
- package/dist/plugins/index.js.map +1 -1
- package/package.json +3 -3
package/dist/plugins/index.js
CHANGED
|
@@ -17,16 +17,26 @@ function wrapGenerated(mod, client) {
|
|
|
17
17
|
wrapped[key] = value;
|
|
18
18
|
continue;
|
|
19
19
|
}
|
|
20
|
-
if (isHookKey(key)) wrapped[key] = (
|
|
21
|
-
|
|
22
|
-
request: {
|
|
23
|
-
...options?.request,
|
|
20
|
+
if (isHookKey(key)) wrapped[key] = (...args) => {
|
|
21
|
+
const ctx = {
|
|
24
22
|
baseUrl,
|
|
25
23
|
cookies,
|
|
26
24
|
onBeforeFetch,
|
|
27
25
|
onAfterFetch
|
|
28
|
-
}
|
|
29
|
-
|
|
26
|
+
};
|
|
27
|
+
let optionsIdx = Math.max(0, value.length - 2);
|
|
28
|
+
if (args[optionsIdx] != null && typeof args[optionsIdx] !== "object") optionsIdx = Math.max(0, value.length - 1);
|
|
29
|
+
while (args.length <= optionsIdx) args.push(void 0);
|
|
30
|
+
const existing = args[optionsIdx] ?? {};
|
|
31
|
+
args[optionsIdx] = {
|
|
32
|
+
...typeof existing === "object" && existing !== null ? existing : {},
|
|
33
|
+
request: {
|
|
34
|
+
...existing?.request ?? {},
|
|
35
|
+
...ctx
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
return value(...args);
|
|
39
|
+
};
|
|
30
40
|
else wrapped[key] = (...args) => {
|
|
31
41
|
const ctx = {
|
|
32
42
|
baseUrl,
|