@mastra/playground-ui 72.0.0-alpha.11 → 72.0.0-alpha.12

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.
@@ -7,13 +7,33 @@ const require_icons_central_IconArrowRotateCounterClockwise = require("../../../
7
7
  let react_jsx_runtime = require("react/jsx-runtime");
8
8
  let _mastra_react_hooks_query = require("@mastra/react/hooks/query");
9
9
  // src/domains/metrics/components/chart-card-error.tsx
10
+ function isRecord(value) {
11
+ return typeof value === "object" && value !== null;
12
+ }
13
+ /**
14
+ * Why the server refused the query as asked: the first message of a 422's `issues`, such as a range
15
+ * over what it reads at once. Retrying gets the same answer, so the card says this instead.
16
+ */
17
+ function refusalReason(error) {
18
+ if (!isRecord(error) || error.status !== 422 || !isRecord(error.body)) return void 0;
19
+ const { issues } = error.body;
20
+ if (!Array.isArray(issues)) return void 0;
21
+ const message = issues.find((issue) => isRecord(issue) && typeof issue.message === "string")?.message;
22
+ return typeof message === "string" && message.trim() ? message : void 0;
23
+ }
10
24
  /**
11
25
  * Fills a chart card's body when its data failed to load. Pass `error` and `onRetry` to explain
12
- * an expired session or missing permission, and to let the user try a failed request again.
26
+ * an expired session, missing permission or a query the server refuses, and to let the user try a
27
+ * failed request again.
13
28
  */
14
29
  function ChartCardError({ error, onRetry }) {
15
30
  if ((0, _mastra_react_hooks_query.is401UnauthorizedError)(error)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_domains_auth_components_session_expired.SessionExpired, {});
16
31
  if ((0, _mastra_react_hooks_query.is403ForbiddenError)(error)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_domains_auth_components_permission_denied.PermissionDenied, { resource: "traces" });
32
+ const refused = refusalReason(error);
33
+ if (refused) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
34
+ className: "flex h-full items-center justify-center",
35
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MetricsCard.MetricsCard.Error, { message: refused })
36
+ });
17
37
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
18
38
  className: "flex h-full flex-col items-center justify-center gap-3",
19
39
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MetricsCard.MetricsCard.Error, { message: "Couldn't load this data. Try again in a moment." }), onRetry && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Button.Button, {
@@ -1 +1 @@
1
- {"version":3,"file":"chart-card-error.cjs.js","names":["is401UnauthorizedError","SessionExpired","is403ForbiddenError","PermissionDenied","MetricsCard","Button","IconArrowRotateCounterClockwise"],"sources":["../../../../src/domains/metrics/components/chart-card-error.tsx"],"sourcesContent":["import { is401UnauthorizedError, is403ForbiddenError } from '@mastra/react/hooks/query';\nimport { PermissionDenied } from '@/domains/auth/components/permission-denied';\nimport { SessionExpired } from '@/domains/auth/components/session-expired';\nimport { Button } from '@/ds/components/Button';\nimport { MetricsCard } from '@/ds/components/MetricsCard';\nimport { IconArrowRotateCounterClockwise } from '@/ds/icons/central/IconArrowRotateCounterClockwise';\n\n/**\n * Fills a chart card's body when its data failed to load. Pass `error` and `onRetry` to explain\n * an expired session or missing permission, and to let the user try a failed request again.\n */\nexport function ChartCardError({ error, onRetry }: { error?: unknown; onRetry?: () => void }) {\n if (is401UnauthorizedError(error)) return <SessionExpired />;\n if (is403ForbiddenError(error)) return <PermissionDenied resource=\"traces\" />;\n return (\n <div className=\"flex h-full flex-col items-center justify-center gap-3\">\n <MetricsCard.Error message=\"Couldn't load this data. Try again in a moment.\" />\n {onRetry && (\n <Button size=\"sm\" icon={<IconArrowRotateCounterClockwise />} onClick={onRetry}>\n Retry\n </Button>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAWA,SAAgB,eAAe,EAAE,OAAO,WAAsD;CAC5F,KAAA,GAAIA,0BAAAA,uBAAAA,CAAuB,KAAK,GAAG,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACC,gDAAAA,gBAAD,CAAiB,CAAA;CAC3D,KAAA,GAAIC,0BAAAA,oBAAAA,CAAoB,KAAK,GAAG,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACC,kDAAAA,kBAAD,EAAkB,UAAS,SAAU,CAAA;CAC5E,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,oBAAAA,YAAY,OAAb,EAAmB,SAAQ,kDAAmD,CAAA,GAC7E,WACC,iBAAA,GAAA,kBAAA,IAAA,CAACC,eAAAA,QAAD;GAAQ,MAAK;GAAK,MAAM,iBAAA,GAAA,kBAAA,IAAA,CAACC,sDAAAA,iCAAD,CAAkC,CAAA;GAAG,SAAS;GAAS,UAAA;EAEvE,CAAA,CAEP;;AAET"}
1
+ {"version":3,"file":"chart-card-error.cjs.js","names":["is401UnauthorizedError","SessionExpired","is403ForbiddenError","PermissionDenied","MetricsCard","Button","IconArrowRotateCounterClockwise"],"sources":["../../../../src/domains/metrics/components/chart-card-error.tsx"],"sourcesContent":["import { is401UnauthorizedError, is403ForbiddenError } from '@mastra/react/hooks/query';\nimport { PermissionDenied } from '@/domains/auth/components/permission-denied';\nimport { SessionExpired } from '@/domains/auth/components/session-expired';\nimport { Button } from '@/ds/components/Button';\nimport { MetricsCard } from '@/ds/components/MetricsCard';\nimport { IconArrowRotateCounterClockwise } from '@/ds/icons/central/IconArrowRotateCounterClockwise';\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n\n/**\n * Why the server refused the query as asked: the first message of a 422's `issues`, such as a range\n * over what it reads at once. Retrying gets the same answer, so the card says this instead.\n */\nfunction refusalReason(error: unknown): string | undefined {\n if (!isRecord(error) || error.status !== 422 || !isRecord(error.body)) return undefined;\n const { issues } = error.body;\n if (!Array.isArray(issues)) return undefined;\n const message = issues.find(issue => isRecord(issue) && typeof issue.message === 'string')?.message;\n return typeof message === 'string' && message.trim() ? message : undefined;\n}\n\n/**\n * Fills a chart card's body when its data failed to load. Pass `error` and `onRetry` to explain\n * an expired session, missing permission or a query the server refuses, and to let the user try a\n * failed request again.\n */\nexport function ChartCardError({ error, onRetry }: { error?: unknown; onRetry?: () => void }) {\n if (is401UnauthorizedError(error)) return <SessionExpired />;\n if (is403ForbiddenError(error)) return <PermissionDenied resource=\"traces\" />;\n const refused = refusalReason(error);\n if (refused) {\n return (\n <div className=\"flex h-full items-center justify-center\">\n <MetricsCard.Error message={refused} />\n </div>\n );\n }\n return (\n <div className=\"flex h-full flex-col items-center justify-center gap-3\">\n <MetricsCard.Error message=\"Couldn't load this data. Try again in a moment.\" />\n {onRetry && (\n <Button size=\"sm\" icon={<IconArrowRotateCounterClockwise />} onClick={onRetry}>\n Retry\n </Button>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;AAOA,SAAS,SAAS,OAAkD;CAClE,OAAO,OAAO,UAAU,YAAY,UAAU;AAChD;;;;;AAMA,SAAS,cAAc,OAAoC;CACzD,IAAI,CAAC,SAAS,KAAK,KAAK,MAAM,WAAW,OAAO,CAAC,SAAS,MAAM,IAAI,GAAG,OAAO,KAAA;CAC9E,MAAM,EAAE,WAAW,MAAM;CACzB,IAAI,CAAC,MAAM,QAAQ,MAAM,GAAG,OAAO,KAAA;CACnC,MAAM,UAAU,OAAO,MAAK,UAAS,SAAS,KAAK,KAAK,OAAO,MAAM,YAAY,QAAQ,CAAC,EAAE;CAC5F,OAAO,OAAO,YAAY,YAAY,QAAQ,KAAK,IAAI,UAAU,KAAA;AACnE;;;;;;AAOA,SAAgB,eAAe,EAAE,OAAO,WAAsD;CAC5F,KAAA,GAAIA,0BAAAA,uBAAAA,CAAuB,KAAK,GAAG,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACC,gDAAAA,gBAAD,CAAiB,CAAA;CAC3D,KAAA,GAAIC,0BAAAA,oBAAAA,CAAoB,KAAK,GAAG,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACC,kDAAAA,kBAAD,EAAkB,UAAS,SAAU,CAAA;CAC5E,MAAM,UAAU,cAAc,KAAK;CACnC,IAAI,SACF,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EAAK,WAAU;EACb,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACC,oBAAAA,YAAY,OAAb,EAAmB,SAAS,QAAU,CAAA;CACnC,CAAA;CAGT,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,iBAAA,GAAA,kBAAA,IAAA,CAACA,oBAAAA,YAAY,OAAb,EAAmB,SAAQ,kDAAmD,CAAA,GAC7E,WACC,iBAAA,GAAA,kBAAA,IAAA,CAACC,eAAAA,QAAD;GAAQ,MAAK;GAAK,MAAM,iBAAA,GAAA,kBAAA,IAAA,CAACC,sDAAAA,iCAAD,CAAkC,CAAA;GAAG,SAAS;GAAS,UAAA;EAEvE,CAAA,CAEP;;AAET"}
@@ -6,13 +6,33 @@ import { IconArrowRotateCounterClockwise } from "../../../icons/central/IconArro
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
7
7
  import { is401UnauthorizedError, is403ForbiddenError } from "@mastra/react/hooks/query";
8
8
  // src/domains/metrics/components/chart-card-error.tsx
9
+ function isRecord(value) {
10
+ return typeof value === "object" && value !== null;
11
+ }
12
+ /**
13
+ * Why the server refused the query as asked: the first message of a 422's `issues`, such as a range
14
+ * over what it reads at once. Retrying gets the same answer, so the card says this instead.
15
+ */
16
+ function refusalReason(error) {
17
+ if (!isRecord(error) || error.status !== 422 || !isRecord(error.body)) return void 0;
18
+ const { issues } = error.body;
19
+ if (!Array.isArray(issues)) return void 0;
20
+ const message = issues.find((issue) => isRecord(issue) && typeof issue.message === "string")?.message;
21
+ return typeof message === "string" && message.trim() ? message : void 0;
22
+ }
9
23
  /**
10
24
  * Fills a chart card's body when its data failed to load. Pass `error` and `onRetry` to explain
11
- * an expired session or missing permission, and to let the user try a failed request again.
25
+ * an expired session, missing permission or a query the server refuses, and to let the user try a
26
+ * failed request again.
12
27
  */
13
28
  function ChartCardError({ error, onRetry }) {
14
29
  if (is401UnauthorizedError(error)) return /* @__PURE__ */ jsx(SessionExpired, {});
15
30
  if (is403ForbiddenError(error)) return /* @__PURE__ */ jsx(PermissionDenied, { resource: "traces" });
31
+ const refused = refusalReason(error);
32
+ if (refused) return /* @__PURE__ */ jsx("div", {
33
+ className: "flex h-full items-center justify-center",
34
+ children: /* @__PURE__ */ jsx(MetricsCard.Error, { message: refused })
35
+ });
16
36
  return /* @__PURE__ */ jsxs("div", {
17
37
  className: "flex h-full flex-col items-center justify-center gap-3",
18
38
  children: [/* @__PURE__ */ jsx(MetricsCard.Error, { message: "Couldn't load this data. Try again in a moment." }), onRetry && /* @__PURE__ */ jsx(Button, {
@@ -1 +1 @@
1
- {"version":3,"file":"chart-card-error.es.js","names":[],"sources":["../../../../src/domains/metrics/components/chart-card-error.tsx"],"sourcesContent":["import { is401UnauthorizedError, is403ForbiddenError } from '@mastra/react/hooks/query';\nimport { PermissionDenied } from '@/domains/auth/components/permission-denied';\nimport { SessionExpired } from '@/domains/auth/components/session-expired';\nimport { Button } from '@/ds/components/Button';\nimport { MetricsCard } from '@/ds/components/MetricsCard';\nimport { IconArrowRotateCounterClockwise } from '@/ds/icons/central/IconArrowRotateCounterClockwise';\n\n/**\n * Fills a chart card's body when its data failed to load. Pass `error` and `onRetry` to explain\n * an expired session or missing permission, and to let the user try a failed request again.\n */\nexport function ChartCardError({ error, onRetry }: { error?: unknown; onRetry?: () => void }) {\n if (is401UnauthorizedError(error)) return <SessionExpired />;\n if (is403ForbiddenError(error)) return <PermissionDenied resource=\"traces\" />;\n return (\n <div className=\"flex h-full flex-col items-center justify-center gap-3\">\n <MetricsCard.Error message=\"Couldn't load this data. Try again in a moment.\" />\n {onRetry && (\n <Button size=\"sm\" icon={<IconArrowRotateCounterClockwise />} onClick={onRetry}>\n Retry\n </Button>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAWA,SAAgB,eAAe,EAAE,OAAO,WAAsD;CAC5F,IAAI,uBAAuB,KAAK,GAAG,OAAO,oBAAC,gBAAD,CAAiB,CAAA;CAC3D,IAAI,oBAAoB,KAAK,GAAG,OAAO,oBAAC,kBAAD,EAAkB,UAAS,SAAU,CAAA;CAC5E,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,oBAAC,YAAY,OAAb,EAAmB,SAAQ,kDAAmD,CAAA,GAC7E,WACC,oBAAC,QAAD;GAAQ,MAAK;GAAK,MAAM,oBAAC,iCAAD,CAAkC,CAAA;GAAG,SAAS;GAAS,UAAA;EAEvE,CAAA,CAEP;;AAET"}
1
+ {"version":3,"file":"chart-card-error.es.js","names":[],"sources":["../../../../src/domains/metrics/components/chart-card-error.tsx"],"sourcesContent":["import { is401UnauthorizedError, is403ForbiddenError } from '@mastra/react/hooks/query';\nimport { PermissionDenied } from '@/domains/auth/components/permission-denied';\nimport { SessionExpired } from '@/domains/auth/components/session-expired';\nimport { Button } from '@/ds/components/Button';\nimport { MetricsCard } from '@/ds/components/MetricsCard';\nimport { IconArrowRotateCounterClockwise } from '@/ds/icons/central/IconArrowRotateCounterClockwise';\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n\n/**\n * Why the server refused the query as asked: the first message of a 422's `issues`, such as a range\n * over what it reads at once. Retrying gets the same answer, so the card says this instead.\n */\nfunction refusalReason(error: unknown): string | undefined {\n if (!isRecord(error) || error.status !== 422 || !isRecord(error.body)) return undefined;\n const { issues } = error.body;\n if (!Array.isArray(issues)) return undefined;\n const message = issues.find(issue => isRecord(issue) && typeof issue.message === 'string')?.message;\n return typeof message === 'string' && message.trim() ? message : undefined;\n}\n\n/**\n * Fills a chart card's body when its data failed to load. Pass `error` and `onRetry` to explain\n * an expired session, missing permission or a query the server refuses, and to let the user try a\n * failed request again.\n */\nexport function ChartCardError({ error, onRetry }: { error?: unknown; onRetry?: () => void }) {\n if (is401UnauthorizedError(error)) return <SessionExpired />;\n if (is403ForbiddenError(error)) return <PermissionDenied resource=\"traces\" />;\n const refused = refusalReason(error);\n if (refused) {\n return (\n <div className=\"flex h-full items-center justify-center\">\n <MetricsCard.Error message={refused} />\n </div>\n );\n }\n return (\n <div className=\"flex h-full flex-col items-center justify-center gap-3\">\n <MetricsCard.Error message=\"Couldn't load this data. Try again in a moment.\" />\n {onRetry && (\n <Button size=\"sm\" icon={<IconArrowRotateCounterClockwise />} onClick={onRetry}>\n Retry\n </Button>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAOA,SAAS,SAAS,OAAkD;CAClE,OAAO,OAAO,UAAU,YAAY,UAAU;AAChD;;;;;AAMA,SAAS,cAAc,OAAoC;CACzD,IAAI,CAAC,SAAS,KAAK,KAAK,MAAM,WAAW,OAAO,CAAC,SAAS,MAAM,IAAI,GAAG,OAAO,KAAA;CAC9E,MAAM,EAAE,WAAW,MAAM;CACzB,IAAI,CAAC,MAAM,QAAQ,MAAM,GAAG,OAAO,KAAA;CACnC,MAAM,UAAU,OAAO,MAAK,UAAS,SAAS,KAAK,KAAK,OAAO,MAAM,YAAY,QAAQ,CAAC,EAAE;CAC5F,OAAO,OAAO,YAAY,YAAY,QAAQ,KAAK,IAAI,UAAU,KAAA;AACnE;;;;;;AAOA,SAAgB,eAAe,EAAE,OAAO,WAAsD;CAC5F,IAAI,uBAAuB,KAAK,GAAG,OAAO,oBAAC,gBAAD,CAAiB,CAAA;CAC3D,IAAI,oBAAoB,KAAK,GAAG,OAAO,oBAAC,kBAAD,EAAkB,UAAS,SAAU,CAAA;CAC5E,MAAM,UAAU,cAAc,KAAK;CACnC,IAAI,SACF,OACE,oBAAC,OAAD;EAAK,WAAU;EACb,UAAA,oBAAC,YAAY,OAAb,EAAmB,SAAS,QAAU,CAAA;CACnC,CAAA;CAGT,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,oBAAC,YAAY,OAAb,EAAmB,SAAQ,kDAAmD,CAAA,GAC7E,WACC,oBAAC,QAAD;GAAQ,MAAK;GAAK,MAAM,oBAAC,iCAAD,CAAkC,CAAA;GAAG,SAAS;GAAS,UAAA;EAEvE,CAAA,CAEP;;AAET"}
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Fills a chart card's body when its data failed to load. Pass `error` and `onRetry` to explain
3
- * an expired session or missing permission, and to let the user try a failed request again.
3
+ * an expired session, missing permission or a query the server refuses, and to let the user try a
4
+ * failed request again.
4
5
  */
5
6
  export declare function ChartCardError({ error, onRetry }: {
6
7
  error?: unknown;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mastra/playground-ui",
3
3
  "type": "module",
4
- "version": "72.0.0-alpha.11",
4
+ "version": "72.0.0-alpha.12",
5
5
  "description": "Mastra Playground components",
6
6
  "sideEffects": [
7
7
  "**/*.css"
@@ -232,8 +232,8 @@
232
232
  "react-dom": ">=19.2.0",
233
233
  "tailwindcss": "^4.0.0",
234
234
  "@mastra/ai-sdk": "^1.12.2-alpha.1",
235
- "@mastra/client-js": "^1.63.0-alpha.10",
236
- "@mastra/react": "1.17.0-alpha.10"
235
+ "@mastra/client-js": "^1.63.0-alpha.11",
236
+ "@mastra/react": "1.17.0-alpha.11"
237
237
  },
238
238
  "devDependencies": {
239
239
  "@modelcontextprotocol/client": "2.4.0",
@@ -279,13 +279,13 @@
279
279
  "vite": "^8.3.5",
280
280
  "vite-plugin-lib-inject-css": "^2.2.2",
281
281
  "vitest": "5.1.0",
282
- "@mastra/ai-sdk": "1.12.2-alpha.1",
283
- "@mastra/client-js": "^1.63.0-alpha.10",
284
- "@internal/lint": "0.0.152",
285
282
  "@internal/ai-sdk-v5": "0.0.99",
286
- "@mastra/core": "1.87.0-alpha.10",
287
- "@mastra/memory": "1.41.4-alpha.1",
288
- "@mastra/react": "1.17.0-alpha.10",
283
+ "@internal/lint": "0.0.152",
284
+ "@mastra/ai-sdk": "1.12.2-alpha.1",
285
+ "@mastra/client-js": "^1.63.0-alpha.11",
286
+ "@mastra/core": "1.87.0-alpha.11",
287
+ "@mastra/memory": "1.42.0-alpha.2",
288
+ "@mastra/react": "1.17.0-alpha.11",
289
289
  "@mastra/schema-compat": "1.4.1"
290
290
  },
291
291
  "homepage": "https://mastra.ai",