@dbx-tools/appkit-mastra 0.6.61 → 0.6.63
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/lib/src/chart.js +7 -8
- package/lib/src/pagination.js +4 -5
- package/lib/src/plugin.js +6 -6
- package/lib/src/statement.js +9 -8
- package/package.json +13 -13
- package/src/chart.ts +15 -7
- package/src/pagination.ts +4 -3
- package/src/plugin.ts +5 -5
- package/src/statement.ts +8 -6
package/package.json
CHANGED
|
@@ -31,18 +31,18 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@databricks/appkit": "^0.43.0",
|
|
33
33
|
"@databricks/sdk-experimental": "^0.17.0",
|
|
34
|
-
"@dbx-tools/appkit": "0.6.
|
|
35
|
-
"@dbx-tools/core": "0.6.
|
|
36
|
-
"@dbx-tools/databricks": "0.6.
|
|
37
|
-
"@dbx-tools/fs": "0.6.
|
|
38
|
-
"@dbx-tools/genie": "0.6.
|
|
39
|
-
"@dbx-tools/model": "0.6.
|
|
40
|
-
"@dbx-tools/path": "0.6.
|
|
41
|
-
"@dbx-tools/shared-core": "0.6.
|
|
42
|
-
"@dbx-tools/shared-fs": "0.6.
|
|
43
|
-
"@dbx-tools/shared-genie": "0.6.
|
|
44
|
-
"@dbx-tools/shared-mastra": "0.6.
|
|
45
|
-
"@dbx-tools/shared-model": "0.6.
|
|
34
|
+
"@dbx-tools/appkit": "0.6.63",
|
|
35
|
+
"@dbx-tools/core": "0.6.63",
|
|
36
|
+
"@dbx-tools/databricks": "0.6.63",
|
|
37
|
+
"@dbx-tools/fs": "0.6.63",
|
|
38
|
+
"@dbx-tools/genie": "0.6.63",
|
|
39
|
+
"@dbx-tools/model": "0.6.63",
|
|
40
|
+
"@dbx-tools/path": "0.6.63",
|
|
41
|
+
"@dbx-tools/shared-core": "0.6.63",
|
|
42
|
+
"@dbx-tools/shared-fs": "0.6.63",
|
|
43
|
+
"@dbx-tools/shared-genie": "0.6.63",
|
|
44
|
+
"@dbx-tools/shared-mastra": "0.6.63",
|
|
45
|
+
"@dbx-tools/shared-model": "0.6.63",
|
|
46
46
|
"@mastra/ai-sdk": "^1.6.0",
|
|
47
47
|
"@mastra/core": "^1.47.0",
|
|
48
48
|
"@mastra/express": "^1.4.2",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"./package.json": "./package.json"
|
|
72
72
|
}
|
|
73
73
|
},
|
|
74
|
-
"version": "0.6.
|
|
74
|
+
"version": "0.6.63",
|
|
75
75
|
"types": "./lib/index.d.ts",
|
|
76
76
|
"type": "module",
|
|
77
77
|
"exports": {
|
package/src/chart.ts
CHANGED
|
@@ -28,7 +28,16 @@
|
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
30
|
import { AppKitError, CacheManager, ExecutionError } from "@databricks/appkit";
|
|
31
|
-
import {
|
|
31
|
+
import {
|
|
32
|
+
async,
|
|
33
|
+
error,
|
|
34
|
+
hash,
|
|
35
|
+
json,
|
|
36
|
+
log,
|
|
37
|
+
object,
|
|
38
|
+
string,
|
|
39
|
+
type BrandContext,
|
|
40
|
+
} from "@dbx-tools/shared-core";
|
|
32
41
|
import { marker, wire, type Chart, type ChartResult } from "@dbx-tools/shared-mastra";
|
|
33
42
|
import { model } from "@dbx-tools/shared-model";
|
|
34
43
|
import { Agent } from "@mastra/core/agent";
|
|
@@ -99,19 +108,18 @@ const chartDataPointSchema = z
|
|
|
99
108
|
if (v === null || v === undefined) return null;
|
|
100
109
|
if (typeof v === "number") return Number.isFinite(v) ? v : null;
|
|
101
110
|
if (typeof v === "string") {
|
|
102
|
-
|
|
103
|
-
return Number.isFinite(n) ? n : null;
|
|
111
|
+
return object.toNumber(v) ?? null;
|
|
104
112
|
}
|
|
105
113
|
// Scatter `[x, y]` or heatmap `[xIndex, yIndex, value]`. Coerce
|
|
106
114
|
// stringified components; reject if any component is non-finite.
|
|
107
115
|
if (Array.isArray(v) && (v.length === 2 || v.length === 3)) {
|
|
108
|
-
const nums = v.map((c) => (
|
|
109
|
-
return nums.every((n) =>
|
|
116
|
+
const nums = v.map((c) => object.toNumber(c));
|
|
117
|
+
return nums.every((n) => n !== undefined) ? nums : null;
|
|
110
118
|
}
|
|
111
119
|
if (typeof v === "object" && v !== null && "value" in v) {
|
|
112
120
|
const obj = v as { name?: unknown; value: unknown };
|
|
113
|
-
const val =
|
|
114
|
-
if (
|
|
121
|
+
const val = object.toNumber(obj.value);
|
|
122
|
+
if (val === undefined) return null;
|
|
115
123
|
// Coerce numeric / boolean / nullish names to strings so a
|
|
116
124
|
// pie slice keyed on a year (`2024`) or category id is
|
|
117
125
|
// accepted without round-tripping through the catch arm.
|
package/src/pagination.ts
CHANGED
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
* @module
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
import { object } from "@dbx-tools/shared-core";
|
|
11
|
+
|
|
10
12
|
/** Bounds for {@link clampPerPage}. */
|
|
11
13
|
export interface PerPageBounds {
|
|
12
14
|
/** Page size used for empty / non-positive / non-numeric inputs. */
|
|
@@ -29,8 +31,7 @@ export function clampPerPage(value: number | undefined, bounds: PerPageBounds):
|
|
|
29
31
|
* can apply its built-in defaults.
|
|
30
32
|
*/
|
|
31
33
|
export function parseIntParam(value: string | undefined): number | undefined {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
if (!Number.isFinite(n) || n < 0) return undefined;
|
|
34
|
+
const n = object.toNumber(value);
|
|
35
|
+
if (n === undefined || n < 0) return undefined;
|
|
35
36
|
return Math.trunc(n);
|
|
36
37
|
}
|
package/src/plugin.ts
CHANGED
|
@@ -58,7 +58,7 @@ import {
|
|
|
58
58
|
} from "@databricks/appkit";
|
|
59
59
|
import { plugin } from "@dbx-tools/appkit";
|
|
60
60
|
import { serving as nodeServing } from "@dbx-tools/model";
|
|
61
|
-
import { async, error, log, string } from "@dbx-tools/shared-core";
|
|
61
|
+
import { async, error, log, object, string } from "@dbx-tools/shared-core";
|
|
62
62
|
import {
|
|
63
63
|
feedback,
|
|
64
64
|
routes,
|
|
@@ -1164,8 +1164,8 @@ type EmbedResolver = (
|
|
|
1164
1164
|
function parseTimeoutMs(raw: unknown): number | undefined {
|
|
1165
1165
|
const v = Array.isArray(raw) ? raw[0] : raw;
|
|
1166
1166
|
if (typeof v !== "string") return undefined;
|
|
1167
|
-
const n =
|
|
1168
|
-
if (
|
|
1167
|
+
const n = object.toNumber(v);
|
|
1168
|
+
if (n === undefined || n <= 0) return undefined;
|
|
1169
1169
|
return Math.min(Math.floor(n), MAX_EMBED_POLL_TIMEOUT_MS);
|
|
1170
1170
|
}
|
|
1171
1171
|
|
|
@@ -1179,8 +1179,8 @@ function parseTimeoutMs(raw: unknown): number | undefined {
|
|
|
1179
1179
|
function parseStatementLimit(raw: unknown): number | undefined {
|
|
1180
1180
|
const v = Array.isArray(raw) ? raw[0] : raw;
|
|
1181
1181
|
if (typeof v !== "string") return undefined;
|
|
1182
|
-
const n =
|
|
1183
|
-
if (
|
|
1182
|
+
const n = object.toNumber(v);
|
|
1183
|
+
if (n === undefined || n < 0) return undefined;
|
|
1184
1184
|
return Math.floor(n);
|
|
1185
1185
|
}
|
|
1186
1186
|
|
package/src/statement.ts
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
import { WorkspaceClient } from "@databricks/sdk-experimental";
|
|
23
23
|
import { databricks } from "@dbx-tools/appkit";
|
|
24
|
+
import { object } from "@dbx-tools/shared-core";
|
|
24
25
|
import type { GenieDatasetData } from "@dbx-tools/shared-mastra";
|
|
25
26
|
|
|
26
27
|
/**
|
|
@@ -35,15 +36,16 @@ export const STATEMENT_ROW_CAP = 500;
|
|
|
35
36
|
/**
|
|
36
37
|
* Best-effort numeric coercion for the Statement Execution API's
|
|
37
38
|
* all-strings cells. Leaves non-numeric strings (and explicit
|
|
38
|
-
* `null`s) intact
|
|
39
|
+
* `null`s) intact.
|
|
40
|
+
*
|
|
41
|
+
* Both of {@link object.toNumber}'s string leniencies are disabled, because a
|
|
42
|
+
* cell's other characters belong to the VALUE: a `"1,000"` in a text column is
|
|
43
|
+
* the string the query returned, and a `"25%"` must not silently arrive as
|
|
44
|
+
* `0.25` in a table the user is reading.
|
|
39
45
|
*/
|
|
40
46
|
function coerceCell(cell: string | null): unknown {
|
|
41
47
|
if (cell === null) return null;
|
|
42
|
-
|
|
43
|
-
const n = Number(cell);
|
|
44
|
-
if (Number.isFinite(n)) return n;
|
|
45
|
-
}
|
|
46
|
-
return cell;
|
|
48
|
+
return object.toNumber(cell, { separators: false, percent: false }) ?? cell;
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
/**
|