@nubase/create 0.1.12 → 0.1.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nubase/create",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "Create a new Nubase application",
5
5
  "type": "module",
6
6
  "bin": {
@@ -5,8 +5,8 @@ import { apiEndpoints } from "schema";
5
5
  * Analytics dashboard configuration.
6
6
  *
7
7
  * This dashboard demonstrates the type-safe widget system:
8
- * - Each widget references an endpoint that returns the correct data type
9
- * - TypeScript will error if you try to use a non-matching endpoint
8
+ * - Each widget uses an onLoad callback for data fetching
9
+ * - context.http provides type-safe API access
10
10
  * - Layout is defined using react-grid-layout coordinates (x, y, w, h)
11
11
  */
12
12
  export const analyticsDashboard = createDashboard("analytics")
@@ -19,7 +19,9 @@ export const analyticsDashboard = createDashboard("analytics")
19
19
  id: "revenue-chart",
20
20
  title: "Revenue Trend",
21
21
  variant: "area",
22
- endpoint: "getRevenueChart",
22
+ onLoad: async ({ context }) => {
23
+ return context.http.getRevenueChart({ params: {} });
24
+ },
23
25
  defaultLayout: { x: 0, y: 0, w: 8, h: 3 },
24
26
  },
25
27
  // Browser stats - donut chart on the right
@@ -28,7 +30,9 @@ export const analyticsDashboard = createDashboard("analytics")
28
30
  id: "browser-stats",
29
31
  title: "Browser Usage",
30
32
  variant: "donut",
31
- endpoint: "getBrowserStats",
33
+ onLoad: async ({ context }) => {
34
+ return context.http.getBrowserStats({ params: {} });
35
+ },
32
36
  defaultLayout: { x: 8, y: 0, w: 4, h: 3 },
33
37
  },
34
38
  // KPI cards - second row
@@ -36,14 +40,18 @@ export const analyticsDashboard = createDashboard("analytics")
36
40
  type: "kpi",
37
41
  id: "total-revenue",
38
42
  title: "Total Revenue",
39
- endpoint: "getTotalRevenue",
43
+ onLoad: async ({ context }) => {
44
+ return context.http.getTotalRevenue({ params: {} });
45
+ },
40
46
  defaultLayout: { x: 0, y: 3, w: 3, h: 2 },
41
47
  },
42
48
  {
43
49
  type: "kpi",
44
50
  id: "active-users",
45
51
  title: "Active Users",
46
- endpoint: "getActiveUsers",
52
+ onLoad: async ({ context }) => {
53
+ return context.http.getActiveUsers({ params: {} });
54
+ },
47
55
  defaultLayout: { x: 3, y: 3, w: 3, h: 2 },
48
56
  },
49
57
  // Sales chart - bar chart
@@ -52,7 +60,9 @@ export const analyticsDashboard = createDashboard("analytics")
52
60
  id: "sales-chart",
53
61
  title: "Weekly Sales",
54
62
  variant: "bar",
55
- endpoint: "getSalesChart",
63
+ onLoad: async ({ context }) => {
64
+ return context.http.getSalesChart({ params: {} });
65
+ },
56
66
  defaultLayout: { x: 6, y: 3, w: 6, h: 2 },
57
67
  },
58
68
  // Recent activity table - bottom row
@@ -60,7 +70,9 @@ export const analyticsDashboard = createDashboard("analytics")
60
70
  type: "table",
61
71
  id: "recent-activity",
62
72
  title: "Recent Activity",
63
- endpoint: "getRecentActivity",
73
+ onLoad: async ({ context }) => {
74
+ return context.http.getRecentActivity({ params: {} });
75
+ },
64
76
  maxRows: 5,
65
77
  defaultLayout: { x: 0, y: 5, w: 12, h: 3 },
66
78
  },
@@ -14,7 +14,7 @@ export const ticketResource = createResource("ticket")
14
14
  "Create Ticket",
15
15
  ],
16
16
  onSubmit: async ({ data, context }) => {
17
- return context.http.postTicket({ data });
17
+ return context.http.doesNotExist({ data }); // doesn't throw error
18
18
  },
19
19
  },
20
20
  view: {