@stackfactor/agent-utils 1.1.7 → 1.1.8
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/cjs/serve.d.ts.map +1 -1
- package/dist/cjs/serve.js +5 -3
- package/dist/esm/serve.d.ts.map +1 -1
- package/dist/esm/serve.js +5 -3
- package/package.json +1 -1
package/dist/cjs/serve.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../src/serve.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,eAAe,CAAC;AAMtC;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;AAE/D;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,
|
|
1
|
+
{"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../src/serve.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,eAAe,CAAC;AAMtC;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;AAE/D;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,CAC1B,OAAO,EAAE,GAAG,KACT,OAAO,CAAC;IAAE,IAAI,EAAE,GAAG,CAAC;IAAC,MAAM,EAAE,GAAG,CAAA;CAAE,CAAC,CAAC;AAEzC,MAAM,WAAW,YAAY;IAC3B,4EAA4E;IAC5E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,2CAA2C;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wFAAwF;IACxF,YAAY,CAAC,EAAE,aAAa,CAAC;CAC9B;AAkDD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,KAAK,GAChB,MAAM,SAAS,EACf,UAAS,YAAiB,KACzB,IAAI,CAAC,MA6IP,CAAC"}
|
package/dist/cjs/serve.js
CHANGED
|
@@ -54,13 +54,13 @@ class UnauthenticatedError extends Error {
|
|
|
54
54
|
const defaultAuthenticate = async (request) => {
|
|
55
55
|
const token = request?.authToken ?? request?.authorization;
|
|
56
56
|
if (!token) {
|
|
57
|
-
throw new UnauthenticatedError("Missing auth token");
|
|
57
|
+
throw new UnauthenticatedError("Missing StackFactor auth token");
|
|
58
58
|
}
|
|
59
59
|
try {
|
|
60
60
|
return await client_api_1.session.getSession(token);
|
|
61
61
|
}
|
|
62
62
|
catch (error) {
|
|
63
|
-
throw new UnauthenticatedError(`Invalid auth token: ${error?.message ?? error}`);
|
|
63
|
+
throw new UnauthenticatedError(`Invalid StackFactor auth token: ${error?.message ?? error}`);
|
|
64
64
|
}
|
|
65
65
|
};
|
|
66
66
|
const safeParse = (value, fallback) => {
|
|
@@ -151,7 +151,9 @@ const serve = (main, options = {}) => {
|
|
|
151
151
|
try {
|
|
152
152
|
const result = await (0, runtimeContext_js_1.runWithContext)(context, () => main(abort.signal));
|
|
153
153
|
if (!abort.signal.aborted) {
|
|
154
|
-
call.write({
|
|
154
|
+
call.write({
|
|
155
|
+
result: { result_json: JSON.stringify(result ?? null) },
|
|
156
|
+
});
|
|
155
157
|
}
|
|
156
158
|
}
|
|
157
159
|
catch (error) {
|
package/dist/esm/serve.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../src/serve.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,eAAe,CAAC;AAMtC;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;AAE/D;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,
|
|
1
|
+
{"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../src/serve.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,eAAe,CAAC;AAMtC;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;AAE/D;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,CAC1B,OAAO,EAAE,GAAG,KACT,OAAO,CAAC;IAAE,IAAI,EAAE,GAAG,CAAC;IAAC,MAAM,EAAE,GAAG,CAAA;CAAE,CAAC,CAAC;AAEzC,MAAM,WAAW,YAAY;IAC3B,4EAA4E;IAC5E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,2CAA2C;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wFAAwF;IACxF,YAAY,CAAC,EAAE,aAAa,CAAC;CAC9B;AAkDD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,KAAK,GAChB,MAAM,SAAS,EACf,UAAS,YAAiB,KACzB,IAAI,CAAC,MA6IP,CAAC"}
|
package/dist/esm/serve.js
CHANGED
|
@@ -15,13 +15,13 @@ class UnauthenticatedError extends Error {
|
|
|
15
15
|
const defaultAuthenticate = async (request) => {
|
|
16
16
|
const token = request?.authToken ?? request?.authorization;
|
|
17
17
|
if (!token) {
|
|
18
|
-
throw new UnauthenticatedError("Missing auth token");
|
|
18
|
+
throw new UnauthenticatedError("Missing StackFactor auth token");
|
|
19
19
|
}
|
|
20
20
|
try {
|
|
21
21
|
return await clientSession.getSession(token);
|
|
22
22
|
}
|
|
23
23
|
catch (error) {
|
|
24
|
-
throw new UnauthenticatedError(`Invalid auth token: ${error?.message ?? error}`);
|
|
24
|
+
throw new UnauthenticatedError(`Invalid StackFactor auth token: ${error?.message ?? error}`);
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
const safeParse = (value, fallback) => {
|
|
@@ -112,7 +112,9 @@ export const serve = (main, options = {}) => {
|
|
|
112
112
|
try {
|
|
113
113
|
const result = await runWithContext(context, () => main(abort.signal));
|
|
114
114
|
if (!abort.signal.aborted) {
|
|
115
|
-
call.write({
|
|
115
|
+
call.write({
|
|
116
|
+
result: { result_json: JSON.stringify(result ?? null) },
|
|
117
|
+
});
|
|
116
118
|
}
|
|
117
119
|
}
|
|
118
120
|
catch (error) {
|