@nubase/frontend 0.1.11 → 0.1.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.
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as React$1 from 'react';
2
2
  import React__default, { ReactElement, FC, ReactNode, Key, RefObject } from 'react';
3
3
  import * as _nubase_core from '@nubase/core';
4
- import { ObjectSchema, Infer, ObjectShape, ObjectOutput, SchemaMetadata, Layout, ArraySchema, SeriesWidgetRequestSchema, ProportionalWidgetRequestSchema, KpiWidgetRequestSchema, TableWidgetRequestSchema, RequestSchema, InferRequestParams, InferRequestBody, InferResponseBody, BaseSchema } from '@nubase/core';
4
+ import { ObjectSchema, Infer, ObjectShape, ObjectOutput, SchemaMetadata, Layout, ArraySchema, RequestSchema, InferRequestParams, InferRequestBody, InferResponseBody, BaseSchema } from '@nubase/core';
5
5
  import * as _tanstack_react_query from '@tanstack/react-query';
6
6
  import { UseMutationOptions, UseQueryOptions, QueryClient } from '@tanstack/react-query';
7
7
  import { AnyRouter } from '@tanstack/react-router';
@@ -861,34 +861,6 @@ interface WidgetLayoutConfig {
861
861
  /** Whether the widget cannot be moved or resized */
862
862
  static?: boolean;
863
863
  }
864
- /**
865
- * Extract endpoint keys that return SeriesData.
866
- * Matches endpoints created with createSeriesWidgetEndpoint.
867
- */
868
- type SeriesEndpointKeys<TApiEndpoints> = {
869
- [K in keyof TApiEndpoints]: TApiEndpoints[K] extends SeriesWidgetRequestSchema ? K : never;
870
- }[keyof TApiEndpoints];
871
- /**
872
- * Extract endpoint keys that return ProportionalData.
873
- * Matches endpoints created with createProportionalWidgetEndpoint.
874
- */
875
- type ProportionalEndpointKeys<TApiEndpoints> = {
876
- [K in keyof TApiEndpoints]: TApiEndpoints[K] extends ProportionalWidgetRequestSchema ? K : never;
877
- }[keyof TApiEndpoints];
878
- /**
879
- * Extract endpoint keys that return KpiData.
880
- * Matches endpoints created with createKpiWidgetEndpoint.
881
- */
882
- type KpiEndpointKeys<TApiEndpoints> = {
883
- [K in keyof TApiEndpoints]: TApiEndpoints[K] extends KpiWidgetRequestSchema ? K : never;
884
- }[keyof TApiEndpoints];
885
- /**
886
- * Extract endpoint keys that return TableData.
887
- * Matches endpoints created with createTableWidgetEndpoint.
888
- */
889
- type TableEndpointKeys<TApiEndpoints> = {
890
- [K in keyof TApiEndpoints]: TApiEndpoints[K] extends TableWidgetRequestSchema ? K : never;
891
- }[keyof TApiEndpoints];
892
864
  interface BaseWidgetDescriptor {
893
865
  /** Unique identifier for this widget */
894
866
  id: string;
@@ -906,42 +878,50 @@ interface SeriesWidgetDescriptor<TApiEndpoints> extends BaseWidgetDescriptor {
906
878
  /** The chart variant to render */
907
879
  variant: SeriesChartVariant;
908
880
  /**
909
- * The API endpoint key that provides data for this widget.
910
- * TypeScript will only allow endpoints that return SeriesData.
881
+ * Loads the series data for this widget.
882
+ * Called when the widget mounts and on refresh.
911
883
  */
912
- endpoint: SeriesEndpointKeys<TApiEndpoints>;
884
+ onLoad: (args: {
885
+ context: NubaseContextData<TApiEndpoints>;
886
+ }) => Promise<HttpResponse<any>>;
913
887
  }
914
888
  interface ProportionalWidgetDescriptor<TApiEndpoints> extends BaseWidgetDescriptor {
915
889
  type: "proportional";
916
890
  /** The chart variant to render */
917
891
  variant: ProportionalChartVariant;
918
892
  /**
919
- * The API endpoint key that provides data for this widget.
920
- * TypeScript will only allow endpoints that return ProportionalData.
893
+ * Loads the proportional data for this widget.
894
+ * Called when the widget mounts and on refresh.
921
895
  */
922
- endpoint: ProportionalEndpointKeys<TApiEndpoints>;
896
+ onLoad: (args: {
897
+ context: NubaseContextData<TApiEndpoints>;
898
+ }) => Promise<HttpResponse<any>>;
923
899
  }
924
900
  interface KpiWidgetDescriptor<TApiEndpoints> extends BaseWidgetDescriptor {
925
901
  type: "kpi";
926
902
  /**
927
- * The API endpoint key that provides data for this widget.
928
- * TypeScript will only allow endpoints that return KpiData.
903
+ * Loads the KPI data for this widget.
904
+ * Called when the widget mounts and on refresh.
929
905
  */
930
- endpoint: KpiEndpointKeys<TApiEndpoints>;
906
+ onLoad: (args: {
907
+ context: NubaseContextData<TApiEndpoints>;
908
+ }) => Promise<HttpResponse<any>>;
931
909
  }
932
910
  interface TableWidgetDescriptor<TApiEndpoints> extends BaseWidgetDescriptor {
933
911
  type: "table";
934
- /**
935
- * The API endpoint key that provides data for this widget.
936
- * TypeScript will only allow endpoints that return TableData.
937
- */
938
- endpoint: TableEndpointKeys<TApiEndpoints>;
939
912
  /** Maximum rows to display */
940
913
  maxRows?: number;
914
+ /**
915
+ * Loads the table data for this widget.
916
+ * Called when the widget mounts and on refresh.
917
+ */
918
+ onLoad: (args: {
919
+ context: NubaseContextData<TApiEndpoints>;
920
+ }) => Promise<HttpResponse<any>>;
941
921
  }
942
922
  /**
943
923
  * Union of all widget descriptor types.
944
- * Each widget type enforces that its endpoint returns the correct data shape.
924
+ * Each widget type uses an onLoad callback for data fetching.
945
925
  */
946
926
  type WidgetDescriptor<TApiEndpoints> = SeriesWidgetDescriptor<TApiEndpoints> | ProportionalWidgetDescriptor<TApiEndpoints> | KpiWidgetDescriptor<TApiEndpoints> | TableWidgetDescriptor<TApiEndpoints>;
947
927
  interface DashboardGridConfig {
@@ -1590,7 +1570,7 @@ interface ConnectedWidgetProps {
1590
1570
  * inside a DashboardWidget based on the widget type.
1591
1571
  *
1592
1572
  * This component:
1593
- * 1. Fetches data from the widget's endpoint
1573
+ * 1. Calls the widget's onLoad callback to fetch data
1594
1574
  * 2. Shows loading/error states
1595
1575
  * 3. Renders the appropriate content renderer based on widget type
1596
1576
  * 4. Wraps everything in the DashboardWidget presentation component
@@ -2811,14 +2791,18 @@ declare const Widget: React$1.ForwardRefExoticComponent<WidgetProps & React$1.Re
2811
2791
  * id: "revenue-chart",
2812
2792
  * title: "Revenue Trend",
2813
2793
  * variant: "area",
2814
- * endpoint: "getRevenueChart", // TypeScript validates this!
2794
+ * onLoad: async ({ context }) => {
2795
+ * return context.http.getRevenueChart({ params: {} });
2796
+ * },
2815
2797
  * defaultLayout: { x: 0, y: 0, w: 8, h: 3 },
2816
2798
  * },
2817
2799
  * {
2818
2800
  * type: "kpi",
2819
2801
  * id: "total-revenue",
2820
2802
  * title: "Total Revenue",
2821
- * endpoint: "getTotalRevenue", // TypeScript validates this!
2803
+ * onLoad: async ({ context }) => {
2804
+ * return context.http.getTotalRevenue({ params: {} });
2805
+ * },
2822
2806
  * defaultLayout: { x: 8, y: 0, w: 4, h: 2 },
2823
2807
  * },
2824
2808
  * ]);
@@ -2828,7 +2812,7 @@ declare class DashboardBuilder<TId extends string, TApiEndpoints = never> {
2828
2812
  private config;
2829
2813
  constructor(id: TId);
2830
2814
  /**
2831
- * Configure API endpoints for type-safe widget endpoint references.
2815
+ * Configure API endpoints for type-safe widget data fetching.
2832
2816
  * This must be called before withWidgets() to enable type checking.
2833
2817
  */
2834
2818
  withApiEndpoints<T>(apiEndpoints: T): DashboardBuilder<TId, T>;
@@ -2848,11 +2832,8 @@ declare class DashboardBuilder<TId extends string, TApiEndpoints = never> {
2848
2832
  * Configure widgets for this dashboard.
2849
2833
  * This is the final step that produces the DashboardDescriptor.
2850
2834
  *
2851
- * TypeScript will validate that each widget's endpoint matches its expected data type:
2852
- * - Series widgets must reference endpoints returning SeriesData
2853
- * - Proportional widgets must reference endpoints returning ProportionalData
2854
- * - KPI widgets must reference endpoints returning KpiData
2855
- * - Table widgets must reference endpoints returning TableData
2835
+ * Each widget must provide an `onLoad` callback that fetches data
2836
+ * using `context.http` for type-safe API calls.
2856
2837
  */
2857
2838
  withWidgets(widgets: WidgetDescriptor<TApiEndpoints>[]): DashboardDescriptor<TApiEndpoints>;
2858
2839
  }
@@ -2862,7 +2843,7 @@ declare class DashboardBuilder<TId extends string, TApiEndpoints = never> {
2862
2843
  * The builder pattern enables sequential type inference:
2863
2844
  * 1. First, call `.withApiEndpoints(apiEndpoints)` to provide the API type context
2864
2845
  * 2. Then, configure the dashboard with `.withTitle()`, `.withGridConfig()`, etc.
2865
- * 3. Finally, call `.withWidgets([...])` to define the widgets with type-safe endpoint references
2846
+ * 3. Finally, call `.withWidgets([...])` to define the widgets with `onLoad` callbacks
2866
2847
  *
2867
2848
  * @param id Unique identifier for the dashboard
2868
2849
  * @returns A DashboardBuilder instance
@@ -2881,7 +2862,9 @@ declare class DashboardBuilder<TId extends string, TApiEndpoints = never> {
2881
2862
  * id: "revenue",
2882
2863
  * title: "Revenue",
2883
2864
  * variant: "area",
2884
- * endpoint: "getRevenueChart",
2865
+ * onLoad: async ({ context }) => {
2866
+ * return context.http.getRevenueChart({ params: {} });
2867
+ * },
2885
2868
  * defaultLayout: { x: 0, y: 0, w: 8, h: 3 },
2886
2869
  * },
2887
2870
  * ]);
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as React$1 from 'react';
2
2
  import React__default, { ReactElement, FC, ReactNode, Key, RefObject } from 'react';
3
3
  import * as _nubase_core from '@nubase/core';
4
- import { ObjectSchema, Infer, ObjectShape, ObjectOutput, SchemaMetadata, Layout, ArraySchema, SeriesWidgetRequestSchema, ProportionalWidgetRequestSchema, KpiWidgetRequestSchema, TableWidgetRequestSchema, RequestSchema, InferRequestParams, InferRequestBody, InferResponseBody, BaseSchema } from '@nubase/core';
4
+ import { ObjectSchema, Infer, ObjectShape, ObjectOutput, SchemaMetadata, Layout, ArraySchema, RequestSchema, InferRequestParams, InferRequestBody, InferResponseBody, BaseSchema } from '@nubase/core';
5
5
  import * as _tanstack_react_query from '@tanstack/react-query';
6
6
  import { UseMutationOptions, UseQueryOptions, QueryClient } from '@tanstack/react-query';
7
7
  import { AnyRouter } from '@tanstack/react-router';
@@ -861,34 +861,6 @@ interface WidgetLayoutConfig {
861
861
  /** Whether the widget cannot be moved or resized */
862
862
  static?: boolean;
863
863
  }
864
- /**
865
- * Extract endpoint keys that return SeriesData.
866
- * Matches endpoints created with createSeriesWidgetEndpoint.
867
- */
868
- type SeriesEndpointKeys<TApiEndpoints> = {
869
- [K in keyof TApiEndpoints]: TApiEndpoints[K] extends SeriesWidgetRequestSchema ? K : never;
870
- }[keyof TApiEndpoints];
871
- /**
872
- * Extract endpoint keys that return ProportionalData.
873
- * Matches endpoints created with createProportionalWidgetEndpoint.
874
- */
875
- type ProportionalEndpointKeys<TApiEndpoints> = {
876
- [K in keyof TApiEndpoints]: TApiEndpoints[K] extends ProportionalWidgetRequestSchema ? K : never;
877
- }[keyof TApiEndpoints];
878
- /**
879
- * Extract endpoint keys that return KpiData.
880
- * Matches endpoints created with createKpiWidgetEndpoint.
881
- */
882
- type KpiEndpointKeys<TApiEndpoints> = {
883
- [K in keyof TApiEndpoints]: TApiEndpoints[K] extends KpiWidgetRequestSchema ? K : never;
884
- }[keyof TApiEndpoints];
885
- /**
886
- * Extract endpoint keys that return TableData.
887
- * Matches endpoints created with createTableWidgetEndpoint.
888
- */
889
- type TableEndpointKeys<TApiEndpoints> = {
890
- [K in keyof TApiEndpoints]: TApiEndpoints[K] extends TableWidgetRequestSchema ? K : never;
891
- }[keyof TApiEndpoints];
892
864
  interface BaseWidgetDescriptor {
893
865
  /** Unique identifier for this widget */
894
866
  id: string;
@@ -906,42 +878,50 @@ interface SeriesWidgetDescriptor<TApiEndpoints> extends BaseWidgetDescriptor {
906
878
  /** The chart variant to render */
907
879
  variant: SeriesChartVariant;
908
880
  /**
909
- * The API endpoint key that provides data for this widget.
910
- * TypeScript will only allow endpoints that return SeriesData.
881
+ * Loads the series data for this widget.
882
+ * Called when the widget mounts and on refresh.
911
883
  */
912
- endpoint: SeriesEndpointKeys<TApiEndpoints>;
884
+ onLoad: (args: {
885
+ context: NubaseContextData<TApiEndpoints>;
886
+ }) => Promise<HttpResponse<any>>;
913
887
  }
914
888
  interface ProportionalWidgetDescriptor<TApiEndpoints> extends BaseWidgetDescriptor {
915
889
  type: "proportional";
916
890
  /** The chart variant to render */
917
891
  variant: ProportionalChartVariant;
918
892
  /**
919
- * The API endpoint key that provides data for this widget.
920
- * TypeScript will only allow endpoints that return ProportionalData.
893
+ * Loads the proportional data for this widget.
894
+ * Called when the widget mounts and on refresh.
921
895
  */
922
- endpoint: ProportionalEndpointKeys<TApiEndpoints>;
896
+ onLoad: (args: {
897
+ context: NubaseContextData<TApiEndpoints>;
898
+ }) => Promise<HttpResponse<any>>;
923
899
  }
924
900
  interface KpiWidgetDescriptor<TApiEndpoints> extends BaseWidgetDescriptor {
925
901
  type: "kpi";
926
902
  /**
927
- * The API endpoint key that provides data for this widget.
928
- * TypeScript will only allow endpoints that return KpiData.
903
+ * Loads the KPI data for this widget.
904
+ * Called when the widget mounts and on refresh.
929
905
  */
930
- endpoint: KpiEndpointKeys<TApiEndpoints>;
906
+ onLoad: (args: {
907
+ context: NubaseContextData<TApiEndpoints>;
908
+ }) => Promise<HttpResponse<any>>;
931
909
  }
932
910
  interface TableWidgetDescriptor<TApiEndpoints> extends BaseWidgetDescriptor {
933
911
  type: "table";
934
- /**
935
- * The API endpoint key that provides data for this widget.
936
- * TypeScript will only allow endpoints that return TableData.
937
- */
938
- endpoint: TableEndpointKeys<TApiEndpoints>;
939
912
  /** Maximum rows to display */
940
913
  maxRows?: number;
914
+ /**
915
+ * Loads the table data for this widget.
916
+ * Called when the widget mounts and on refresh.
917
+ */
918
+ onLoad: (args: {
919
+ context: NubaseContextData<TApiEndpoints>;
920
+ }) => Promise<HttpResponse<any>>;
941
921
  }
942
922
  /**
943
923
  * Union of all widget descriptor types.
944
- * Each widget type enforces that its endpoint returns the correct data shape.
924
+ * Each widget type uses an onLoad callback for data fetching.
945
925
  */
946
926
  type WidgetDescriptor<TApiEndpoints> = SeriesWidgetDescriptor<TApiEndpoints> | ProportionalWidgetDescriptor<TApiEndpoints> | KpiWidgetDescriptor<TApiEndpoints> | TableWidgetDescriptor<TApiEndpoints>;
947
927
  interface DashboardGridConfig {
@@ -1590,7 +1570,7 @@ interface ConnectedWidgetProps {
1590
1570
  * inside a DashboardWidget based on the widget type.
1591
1571
  *
1592
1572
  * This component:
1593
- * 1. Fetches data from the widget's endpoint
1573
+ * 1. Calls the widget's onLoad callback to fetch data
1594
1574
  * 2. Shows loading/error states
1595
1575
  * 3. Renders the appropriate content renderer based on widget type
1596
1576
  * 4. Wraps everything in the DashboardWidget presentation component
@@ -2811,14 +2791,18 @@ declare const Widget: React$1.ForwardRefExoticComponent<WidgetProps & React$1.Re
2811
2791
  * id: "revenue-chart",
2812
2792
  * title: "Revenue Trend",
2813
2793
  * variant: "area",
2814
- * endpoint: "getRevenueChart", // TypeScript validates this!
2794
+ * onLoad: async ({ context }) => {
2795
+ * return context.http.getRevenueChart({ params: {} });
2796
+ * },
2815
2797
  * defaultLayout: { x: 0, y: 0, w: 8, h: 3 },
2816
2798
  * },
2817
2799
  * {
2818
2800
  * type: "kpi",
2819
2801
  * id: "total-revenue",
2820
2802
  * title: "Total Revenue",
2821
- * endpoint: "getTotalRevenue", // TypeScript validates this!
2803
+ * onLoad: async ({ context }) => {
2804
+ * return context.http.getTotalRevenue({ params: {} });
2805
+ * },
2822
2806
  * defaultLayout: { x: 8, y: 0, w: 4, h: 2 },
2823
2807
  * },
2824
2808
  * ]);
@@ -2828,7 +2812,7 @@ declare class DashboardBuilder<TId extends string, TApiEndpoints = never> {
2828
2812
  private config;
2829
2813
  constructor(id: TId);
2830
2814
  /**
2831
- * Configure API endpoints for type-safe widget endpoint references.
2815
+ * Configure API endpoints for type-safe widget data fetching.
2832
2816
  * This must be called before withWidgets() to enable type checking.
2833
2817
  */
2834
2818
  withApiEndpoints<T>(apiEndpoints: T): DashboardBuilder<TId, T>;
@@ -2848,11 +2832,8 @@ declare class DashboardBuilder<TId extends string, TApiEndpoints = never> {
2848
2832
  * Configure widgets for this dashboard.
2849
2833
  * This is the final step that produces the DashboardDescriptor.
2850
2834
  *
2851
- * TypeScript will validate that each widget's endpoint matches its expected data type:
2852
- * - Series widgets must reference endpoints returning SeriesData
2853
- * - Proportional widgets must reference endpoints returning ProportionalData
2854
- * - KPI widgets must reference endpoints returning KpiData
2855
- * - Table widgets must reference endpoints returning TableData
2835
+ * Each widget must provide an `onLoad` callback that fetches data
2836
+ * using `context.http` for type-safe API calls.
2856
2837
  */
2857
2838
  withWidgets(widgets: WidgetDescriptor<TApiEndpoints>[]): DashboardDescriptor<TApiEndpoints>;
2858
2839
  }
@@ -2862,7 +2843,7 @@ declare class DashboardBuilder<TId extends string, TApiEndpoints = never> {
2862
2843
  * The builder pattern enables sequential type inference:
2863
2844
  * 1. First, call `.withApiEndpoints(apiEndpoints)` to provide the API type context
2864
2845
  * 2. Then, configure the dashboard with `.withTitle()`, `.withGridConfig()`, etc.
2865
- * 3. Finally, call `.withWidgets([...])` to define the widgets with type-safe endpoint references
2846
+ * 3. Finally, call `.withWidgets([...])` to define the widgets with `onLoad` callbacks
2866
2847
  *
2867
2848
  * @param id Unique identifier for the dashboard
2868
2849
  * @returns A DashboardBuilder instance
@@ -2881,7 +2862,9 @@ declare class DashboardBuilder<TId extends string, TApiEndpoints = never> {
2881
2862
  * id: "revenue",
2882
2863
  * title: "Revenue",
2883
2864
  * variant: "area",
2884
- * endpoint: "getRevenueChart",
2865
+ * onLoad: async ({ context }) => {
2866
+ * return context.http.getRevenueChart({ params: {} });
2867
+ * },
2885
2868
  * defaultLayout: { x: 0, y: 0, w: 8, h: 3 },
2886
2869
  * },
2887
2870
  * ]);
package/dist/index.js CHANGED
@@ -4609,7 +4609,9 @@ var import_react3 = require("react");
4609
4609
  // src/components/nubase-app/NubaseContextProvider.tsx
4610
4610
  var import_react = require("react");
4611
4611
  var import_jsx_runtime = require("react/jsx-runtime");
4612
- var NubaseContext = (0, import_react.createContext)(void 0);
4612
+ var NubaseContext = (0, import_react.createContext)(
4613
+ void 0
4614
+ );
4613
4615
  var NubaseContextProvider = ({
4614
4616
  context,
4615
4617
  children
@@ -12333,16 +12335,10 @@ DashboardWidget.displayName = "DashboardWidget";
12333
12335
  var import_jsx_runtime80 = require("react/jsx-runtime");
12334
12336
  function ConnectedWidget({ widget }) {
12335
12337
  const context = useNubaseContext();
12336
- const endpointKey = widget.endpoint;
12337
- const httpClient = context.http;
12338
- const endpointFn = httpClient[endpointKey];
12339
12338
  const { data, isLoading, error } = (0, import_react_query3.useQuery)({
12340
- queryKey: ["dashboard-widget", widget.id, endpointKey],
12339
+ queryKey: ["dashboard-widget", widget.id],
12341
12340
  queryFn: async () => {
12342
- if (typeof endpointFn !== "function") {
12343
- throw new Error(`Endpoint ${endpointKey} not found`);
12344
- }
12345
- const response = await endpointFn({ params: {} });
12341
+ const response = await widget.onLoad({ context });
12346
12342
  return response.data;
12347
12343
  },
12348
12344
  refetchInterval: widget.refreshInterval
@@ -17493,7 +17489,10 @@ function useCreateNubaseContext({
17493
17489
 
17494
17490
  // src/components/nubase-app/ServicesProvider.tsx
17495
17491
  var import_jsx_runtime117 = require("react/jsx-runtime");
17496
- var ServicesProvider = ({ config, children }) => {
17492
+ function ServicesProvider({
17493
+ config,
17494
+ children
17495
+ }) {
17497
17496
  const {
17498
17497
  data: nubaseContext,
17499
17498
  isLoading,
@@ -17522,7 +17521,7 @@ var ServicesProvider = ({ config, children }) => {
17522
17521
  ] }) });
17523
17522
  }
17524
17523
  return /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(NubaseContextProvider, { context: nubaseContext, children });
17525
- };
17524
+ }
17526
17525
 
17527
17526
  // src/components/nubase-app/NubaseApp.tsx
17528
17527
  var import_jsx_runtime118 = require("react/jsx-runtime");
@@ -18116,7 +18115,7 @@ var DashboardBuilder = class _DashboardBuilder {
18116
18115
  this.config = { id };
18117
18116
  }
18118
18117
  /**
18119
- * Configure API endpoints for type-safe widget endpoint references.
18118
+ * Configure API endpoints for type-safe widget data fetching.
18120
18119
  * This must be called before withWidgets() to enable type checking.
18121
18120
  */
18122
18121
  withApiEndpoints(apiEndpoints) {
@@ -18152,11 +18151,8 @@ var DashboardBuilder = class _DashboardBuilder {
18152
18151
  * Configure widgets for this dashboard.
18153
18152
  * This is the final step that produces the DashboardDescriptor.
18154
18153
  *
18155
- * TypeScript will validate that each widget's endpoint matches its expected data type:
18156
- * - Series widgets must reference endpoints returning SeriesData
18157
- * - Proportional widgets must reference endpoints returning ProportionalData
18158
- * - KPI widgets must reference endpoints returning KpiData
18159
- * - Table widgets must reference endpoints returning TableData
18154
+ * Each widget must provide an `onLoad` callback that fetches data
18155
+ * using `context.http` for type-safe API calls.
18160
18156
  */
18161
18157
  withWidgets(widgets) {
18162
18158
  return {