@bobannomi/client 0.5.0 → 0.6.1
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.ts +5 -43
- package/dist/index.js +11 -118
- package/dist/index.js.map +3 -3
- package/dist/service.js +11 -6
- package/dist/service.js.map +2 -2
- package/package.json +2 -2
package/dist/service.js
CHANGED
|
@@ -2072,9 +2072,6 @@ var PLUGIN_APP_DATA_LIMITS = Object.freeze({ maxArgsBytes: 64 * 1024 * 1024, jso
|
|
|
2072
2072
|
// ../domain-contracts/src/plugin-apps/limits.ts
|
|
2073
2073
|
var PLUGIN_APP_INPUT_LIMITS = Object.freeze({ handoffBytes: 32 * 1024, messageCharacters: 4096, maxComposerContexts: 8 });
|
|
2074
2074
|
|
|
2075
|
-
// ../domain-contracts/src/plugin-apps/history.ts
|
|
2076
|
-
var PLUGIN_UI_LIMITS = { dataBytes: 256 * 1024, actionArgsBytes: 64 * 1024 };
|
|
2077
|
-
|
|
2078
2075
|
// ../protocol/src/serialization/json.ts
|
|
2079
2076
|
function isUuid(value) {
|
|
2080
2077
|
return typeof value === "string" && /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(
|
|
@@ -3519,10 +3516,11 @@ var ProtocolClient = class {
|
|
|
3519
3516
|
|
|
3520
3517
|
// src/transport/http-transport.ts
|
|
3521
3518
|
var BobanNomiApiError = class extends Error {
|
|
3522
|
-
constructor(message, status, body) {
|
|
3519
|
+
constructor(message, status, body, traceId) {
|
|
3523
3520
|
super(message);
|
|
3524
3521
|
this.status = status;
|
|
3525
3522
|
this.body = body;
|
|
3523
|
+
this.traceId = traceId;
|
|
3526
3524
|
this.name = "BobanNomiApiError";
|
|
3527
3525
|
if (!body || typeof body !== "object" || Array.isArray(body)) return;
|
|
3528
3526
|
const { code, error } = body;
|
|
@@ -3533,6 +3531,7 @@ var BobanNomiApiError = class extends Error {
|
|
|
3533
3531
|
}
|
|
3534
3532
|
status;
|
|
3535
3533
|
body;
|
|
3534
|
+
traceId;
|
|
3536
3535
|
};
|
|
3537
3536
|
function responseField(value, field) {
|
|
3538
3537
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
@@ -3609,14 +3608,20 @@ function assertPositiveSafeInteger(value, field) {
|
|
|
3609
3608
|
}
|
|
3610
3609
|
}
|
|
3611
3610
|
async function throwResponseError(response) {
|
|
3611
|
+
const traceHeader = response.headers.get("x-bobannomi-trace-id");
|
|
3612
|
+
const traceId = traceHeader && /^[A-Za-z0-9._:-]{1,128}$/.test(traceHeader) ? traceHeader : void 0;
|
|
3612
3613
|
const text3 = await response.text().catch(() => "");
|
|
3613
3614
|
let body = text3;
|
|
3614
3615
|
try {
|
|
3615
3616
|
body = JSON.parse(text3);
|
|
3616
3617
|
} catch {
|
|
3617
3618
|
}
|
|
3618
|
-
|
|
3619
|
-
|
|
3619
|
+
let message = `BobanNomi API request failed with ${response.status}`;
|
|
3620
|
+
if (body && typeof body === "object") {
|
|
3621
|
+
if ("message" in body && typeof body.message === "string") message = body.message;
|
|
3622
|
+
else if ("error" in body && typeof body.error === "string") message = body.error;
|
|
3623
|
+
}
|
|
3624
|
+
throw new BobanNomiApiError(message, response.status, body, traceId);
|
|
3620
3625
|
}
|
|
3621
3626
|
var HttpTransport = class {
|
|
3622
3627
|
protocolHandshake;
|