@lotics/app-sdk 0.122.3 → 0.122.5
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/{chunk-I2BOTPL6.js → chunk-GXEBJ3RC.js} +22 -6
- package/dist/index.js +11 -2
- package/dist/router.js +1 -1
- package/package.json +3 -3
|
@@ -173,6 +173,13 @@ function transportErrorMessage(status, parsed) {
|
|
|
173
173
|
const authored = typeof parsed.code === "string" && parsed.code.length > 0;
|
|
174
174
|
return status < 500 || authored ? jsonMessage : gatewayErrorMessage(status);
|
|
175
175
|
}
|
|
176
|
+
function telemetryErrorMessage(status, parsed) {
|
|
177
|
+
if (parsed === null || typeof parsed !== "object") return gatewayErrorMessage(status);
|
|
178
|
+
const code = "code" in parsed && typeof parsed.code === "string" && parsed.code.length > 0 ? parsed.code : null;
|
|
179
|
+
const system = "message_source" in parsed && parsed.message_source === "system";
|
|
180
|
+
if (system && "message" in parsed && typeof parsed.message === "string") return parsed.message;
|
|
181
|
+
return code ?? gatewayErrorMessage(status);
|
|
182
|
+
}
|
|
176
183
|
|
|
177
184
|
// ../shared/src/schemas/app_spec_rules.ts
|
|
178
185
|
function tiersAscend(tiers) {
|
|
@@ -1521,11 +1528,13 @@ async function boot() {
|
|
|
1521
1528
|
return attempt;
|
|
1522
1529
|
}
|
|
1523
1530
|
var ApiRefusal = class extends Error {
|
|
1524
|
-
constructor(
|
|
1525
|
-
super(
|
|
1531
|
+
constructor(status, parsed, field_errors) {
|
|
1532
|
+
super(transportErrorMessage(status, parsed));
|
|
1526
1533
|
this.field_errors = field_errors;
|
|
1534
|
+
this.telemetryMessage = telemetryErrorMessage(status, parsed);
|
|
1527
1535
|
}
|
|
1528
1536
|
field_errors;
|
|
1537
|
+
telemetryMessage;
|
|
1529
1538
|
};
|
|
1530
1539
|
function readFieldErrors(parsed) {
|
|
1531
1540
|
if (parsed === null || typeof parsed !== "object" || !("field_errors" in parsed)) {
|
|
@@ -1547,7 +1556,7 @@ async function streamStartError(res) {
|
|
|
1547
1556
|
} catch {
|
|
1548
1557
|
}
|
|
1549
1558
|
}
|
|
1550
|
-
return new
|
|
1559
|
+
return new ApiRefusal(res.status, parsed);
|
|
1551
1560
|
}
|
|
1552
1561
|
var API_TIMEOUT_MS = 3e4;
|
|
1553
1562
|
async function apiCall(method, path, body, opts) {
|
|
@@ -1597,7 +1606,7 @@ async function apiCall(method, path, body, opts) {
|
|
|
1597
1606
|
return new Promise(() => {
|
|
1598
1607
|
});
|
|
1599
1608
|
}
|
|
1600
|
-
throw new ApiRefusal(
|
|
1609
|
+
throw new ApiRefusal(res.status, parsed, readFieldErrors(parsed));
|
|
1601
1610
|
}
|
|
1602
1611
|
return parsed ?? (text ? text : {});
|
|
1603
1612
|
}
|
|
@@ -1766,7 +1775,7 @@ async function sendAskedReads() {
|
|
|
1766
1775
|
const answer = results[k];
|
|
1767
1776
|
if (answer === void 0) read.reject(new Error(`The server answered ${results.length} of ${chunk.length} reads.`));
|
|
1768
1777
|
else if ("result" in answer) read.resolve(answer.result);
|
|
1769
|
-
else read.reject(new ApiRefusal(
|
|
1778
|
+
else read.reject(new ApiRefusal(answer.error.status, answer.error));
|
|
1770
1779
|
});
|
|
1771
1780
|
}).catch((error) => chunk.forEach((read) => read.reject(error)));
|
|
1772
1781
|
}
|
|
@@ -1779,7 +1788,14 @@ function batchResults(answered) {
|
|
|
1779
1788
|
if (answer !== null && typeof answer === "object" && "result" in answer) return { result: answer.result };
|
|
1780
1789
|
const error = answer !== null && typeof answer === "object" && "error" in answer ? answer.error : void 0;
|
|
1781
1790
|
if (error !== null && typeof error === "object" && "status" in error && typeof error.status === "number" && "message" in error && typeof error.message === "string") {
|
|
1782
|
-
return {
|
|
1791
|
+
return {
|
|
1792
|
+
error: {
|
|
1793
|
+
status: error.status,
|
|
1794
|
+
message: error.message,
|
|
1795
|
+
code: "code" in error ? error.code : void 0,
|
|
1796
|
+
message_source: "message_source" in error ? error.message_source : void 0
|
|
1797
|
+
}
|
|
1798
|
+
};
|
|
1783
1799
|
}
|
|
1784
1800
|
throw new Error(`The server's batch answer ${at} is neither a result nor a refusal.`);
|
|
1785
1801
|
});
|
package/dist/index.js
CHANGED
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
sumDecimal,
|
|
41
41
|
tiersAscend,
|
|
42
42
|
urlParam
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-GXEBJ3RC.js";
|
|
44
44
|
|
|
45
45
|
// src/mount.tsx
|
|
46
46
|
import { createRoot } from "react-dom/client";
|
|
@@ -94,6 +94,14 @@ function getMockRecordings() {
|
|
|
94
94
|
// ../shared/src/app_host/app_spec_inline.ts
|
|
95
95
|
var APP_SPEC_ELEMENT_ID = "lotics-app-spec";
|
|
96
96
|
|
|
97
|
+
// ../shared/src/customer_worded.ts
|
|
98
|
+
function isCustomerWorded(error51) {
|
|
99
|
+
return "telemetryMessage" in error51 && typeof error51.telemetryMessage === "string";
|
|
100
|
+
}
|
|
101
|
+
function telemetryMessage(error51) {
|
|
102
|
+
return isCustomerWorded(error51) ? error51.telemetryMessage : error51.message;
|
|
103
|
+
}
|
|
104
|
+
|
|
97
105
|
// src/error_report.ts
|
|
98
106
|
var REPORTS_PER_PAGE = 5;
|
|
99
107
|
var MESSAGE_LIMIT = 300;
|
|
@@ -107,7 +115,8 @@ function reportAppError(kind, error51) {
|
|
|
107
115
|
kind,
|
|
108
116
|
served: document.getElementById(APP_SPEC_ELEMENT_ID) === null ? "bundle" : "spec",
|
|
109
117
|
name: known ? error51.name : typeof error51,
|
|
110
|
-
|
|
118
|
+
// A refusal's own sentence can be a customer's (a table check's); the report says it in ours.
|
|
119
|
+
message: withoutOrigins(known ? telemetryMessage(error51) : String(error51)).slice(0, MESSAGE_LIMIT),
|
|
111
120
|
stack_top: known && error51.stack !== void 0 ? firstFrame(error51, error51.stack) : null
|
|
112
121
|
});
|
|
113
122
|
}
|
package/dist/router.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lotics/app-sdk",
|
|
3
|
-
"version": "0.122.
|
|
3
|
+
"version": "0.122.5",
|
|
4
4
|
"description": "The SDK a Lotics custom-code app reads and writes through — typed hooks over the host bridge, cell readers, mount() and AppRouter",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -42,14 +42,14 @@
|
|
|
42
42
|
"@testing-library/react": "^16.3.0",
|
|
43
43
|
"@types/react": "^19.2.17",
|
|
44
44
|
"@types/react-dom": "~19.2.2",
|
|
45
|
-
"@vitejs/plugin-react": "^
|
|
45
|
+
"@vitejs/plugin-react": "^6.1.2",
|
|
46
46
|
"esbuild": "^0.28.1",
|
|
47
47
|
"jsdom": "^27.0.0",
|
|
48
48
|
"react": "^19.2.0",
|
|
49
49
|
"react-dom": "^19.2.0",
|
|
50
50
|
"react-router": "^7.18.2",
|
|
51
51
|
"typescript": "~6.0.3",
|
|
52
|
-
"vite": "^
|
|
52
|
+
"vite": "^8.3.4"
|
|
53
53
|
},
|
|
54
54
|
"engines": {
|
|
55
55
|
"node": ">=18"
|