@schandlergarcia/sf-web-components 1.9.88 → 2.1.0
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/.a4drules/features/command-center-dashboard-rule.md +1 -1
- package/.a4drules/skills/command-center-builder/SKILL.md +33 -36
- package/.a4drules/skills/command-center-builder/getting-started.md +64 -104
- package/.a4drules/skills/command-center-builder/improved-build-process.md +28 -34
- package/.a4drules/skills/command-center-guide/SKILL.md +9 -9
- package/.a4drules/skills/command-center-project/SKILL.md +4 -5
- package/.a4drules/skills/component-library/SKILL.md +8 -10
- package/.a4drules/skills/component-library/card-components.md +3 -3
- package/.a4drules/skills/component-library/chat-data.md +4 -6
- package/.a4drules/troubleshooting/codegen-overwrites-types.md +21 -162
- package/.a4drules/troubleshooting/graphql-introspection-failure.md +13 -264
- package/.a4drules/validation-requirements.md +3 -5
- package/.a4drules/webapp-data.md +1 -1
- package/CHANGELOG.md +33 -0
- package/CLAUDE.md +42 -39
- package/brands/engine/brand.css +40 -0
- package/brands/engine/global.css +234 -0
- package/dist/components/library/cards/ActivityCard.js +9 -9
- package/dist/components/library/cards/ActivityCard.js.map +1 -1
- package/dist/styles/base.css +112 -27
- package/dist/styles/global.css +15 -30
- package/package.json +7 -4
- package/scripts/apply-brand.mjs +178 -0
- package/scripts/postinstall.mjs +24 -201
- package/scripts/reset-command-center.sh +53 -411
- package/scripts/validate-dashboard.sh +4 -4
- package/src/components/library/cards/ActivityCard.jsx +2 -2
- package/src/styles/base.css +223 -0
- package/src/styles/global.css +223 -0
- package/src/templates/config/vite.config.ts.template +0 -18
- package/.a4drules/features/engine-dashboard-rule.md +0 -63
- package/.a4drules/features/phase2-data-pattern.md +0 -15
- package/data/README.md +0 -202
- package/data/USAGE.md +0 -81
- package/data/copy-to-webapp.sh +0 -61
- package/scripts/generate-schema-from-sample.mjs +0 -370
- /package/{data → brands/engine}/agentApiConfig.ts +0 -0
- /package/{data → brands/engine}/engine-command-center-prd.md +0 -0
- /package/{data → brands/engine}/engine-live-data.js +0 -0
- /package/{data → brands/engine}/engine-sample-data.js +0 -0
- /package/{assets/images → brands/engine}/engine_logo.png +0 -0
- /package/{data → brands/engine}/schema.graphql +0 -0
- /package/{data → brands/engine}/useEngineLiveData.ts +0 -0
- /package/{data → brands/engine}/useEvaAgent.ts +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: command-center-guide
|
|
3
3
|
description: >-
|
|
4
|
-
Overview of the development workflow for
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
Overview of the development workflow for Command Center dashboards.
|
|
5
|
+
Maps tasks to the right skills: component-library for API reference,
|
|
6
|
+
command-center-builder for layout and conventions, command-center-project
|
|
7
|
+
for file structure and routing. Also covers Salesforce GraphQL data
|
|
8
|
+
integration and Agentforce agent setup.
|
|
9
9
|
---
|
|
10
10
|
|
|
11
11
|
# Command Center Development Guide
|
|
@@ -15,14 +15,14 @@ description: >-
|
|
|
15
15
|
**Read these two files, then start building. Do not load other skills or explore component source files.**
|
|
16
16
|
|
|
17
17
|
1. **`.a4drules/skills/command-center-builder/SKILL.md`** — has the wiring steps, conventions, component APIs, and everything you need
|
|
18
|
-
2.
|
|
18
|
+
2. **Your PRD / spec document** — the product spec (layout, data model, brand tokens)
|
|
19
19
|
|
|
20
20
|
That's it. The builder skill already contains the component API reference inline. Do NOT separately load `component-library`, `command-center-project`, or `outer-app` skills — they add latency and you don't need them for the initial build. Do NOT read individual component source files (GeoMap.jsx, Avatar.jsx, etc.) — the builder skill documents all the props.
|
|
21
21
|
|
|
22
22
|
## Build Order (write files in this exact order)
|
|
23
23
|
|
|
24
24
|
1. **Read** the PRD and builder skill
|
|
25
|
-
2. **Write** `src/pages/
|
|
25
|
+
2. **Write** `src/pages/MyDashboard.tsx` (or your dashboard name) — the full dashboard in one pass
|
|
26
26
|
3. **Write** `src/components/workspace/CommandCenter.tsx` — import your dashboard
|
|
27
27
|
4. **Write** `src/pages/Home.tsx` — REPLACE with CommandCenter (it ships as Account Search):
|
|
28
28
|
```tsx
|
|
@@ -42,13 +42,13 @@ That's it. The builder skill already contains the component API reference inline
|
|
|
42
42
|
|
|
43
43
|
## Salesforce Data Integration
|
|
44
44
|
|
|
45
|
-
For live data
|
|
45
|
+
For live data, use these global skills:
|
|
46
46
|
- **exploring-webapp-graphql-schema** — Look up objects and fields in `schema.graphql`
|
|
47
47
|
- **generating-webapp-graphql-read-query** — Generate typed GraphQL queries
|
|
48
48
|
- **using-webapp-graphql** — Create data hooks with `{ data, loading, error }`
|
|
49
49
|
|
|
50
50
|
## Agentforce Integration
|
|
51
51
|
|
|
52
|
-
For AI agent features
|
|
52
|
+
For AI agent features, use:
|
|
53
53
|
- **managing-webapp-agentforce-conversation-client** — Full Agentforce setup
|
|
54
54
|
- **component-library** (`chat-data.md`) — ChatBar component API
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: command-center-project
|
|
3
3
|
description: >-
|
|
4
|
-
Project architecture, tech stack, and file conventions for
|
|
5
|
-
Command Center
|
|
4
|
+
Project architecture, tech stack, and file conventions for
|
|
5
|
+
Command Center apps. Vite + React 19 + TypeScript + Tailwind CSS 4. Covers
|
|
6
6
|
project structure, route architecture, path aliases, two UI systems
|
|
7
7
|
(shadcn for outer app, component library for command center), and how
|
|
8
8
|
dashboards wire into CommandCenter.tsx and the route tree.
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
-
#
|
|
11
|
+
# Command Center App — Project Context
|
|
12
12
|
|
|
13
13
|
Vite 7 + React 19 + TypeScript 5.9 + Tailwind CSS 4 + React Router 7. SPA (not Next.js).
|
|
14
14
|
|
|
@@ -84,7 +84,7 @@ Configured in both `vite.config.ts` and `tsconfig.json`:
|
|
|
84
84
|
- **Dashboard pages** go in `src/pages/` (NOT `src/components/pages/`). Wire into `CommandCenter.tsx` by importing and rendering.
|
|
85
85
|
- **Outer app pages** go in `src/pages/` or `src/features/*/pages/`. Wire into `src/routes.tsx`.
|
|
86
86
|
- **TypeScript** preferred for all code (`.tsx`/`.ts`). Core UI components converted to TypeScript. Legacy `.jsx` files being migrated.
|
|
87
|
-
- **Component library** is a vendored copy
|
|
87
|
+
- **Component library** is a vendored copy installed by the package postinstall — not loaded at runtime.
|
|
88
88
|
- Vite config has `loader: { '.js': 'jsx' }` in `optimizeDeps` to support the `.js`→JSX library files.
|
|
89
89
|
- **Reset script:** `npm run reset:command-center` wipes custom dashboards and restores blank canvas.
|
|
90
90
|
|
|
@@ -99,7 +99,6 @@ Configured in both `vite.config.ts` and `tsconfig.json`:
|
|
|
99
99
|
## Scripts
|
|
100
100
|
|
|
101
101
|
- `npm run dev` — Start dev server
|
|
102
|
-
- `npm run dev:design` — Design mode (standalone)
|
|
103
102
|
- `npm run build` — TypeScript check + Vite build
|
|
104
103
|
- `npm run test` — Vitest
|
|
105
104
|
- `npm run reset:command-center` — Reset dashboard to blank canvas
|
|
@@ -119,7 +119,7 @@ import type { MetricCardProps } from "@/components/library";
|
|
|
119
119
|
subtitle="Currently on trips" // secondary text
|
|
120
120
|
change="+5.2%" // change amount string
|
|
121
121
|
changeType="positive" // "positive" | "negative" | "neutral"
|
|
122
|
-
icon={<UsersIcon className="h-5 w-5 text-
|
|
122
|
+
icon={<UsersIcon className="h-5 w-5 text-brand-500" />}
|
|
123
123
|
color="default" // "default" | "primary" | "success" | "warning" | "danger"
|
|
124
124
|
trend="vs last month" // trend label text
|
|
125
125
|
layout="default" // "default" | "compact"
|
|
@@ -247,7 +247,7 @@ Status icons: `"complete"` → green check, `"working"` → spinning (indigo), `
|
|
|
247
247
|
|
|
248
248
|
```jsx
|
|
249
249
|
<SectionCard
|
|
250
|
-
title="
|
|
250
|
+
title="AI Assistant"
|
|
251
251
|
description="Powered by Agentforce"
|
|
252
252
|
label="LIVE" // small pill badge
|
|
253
253
|
variant="default" // "default" | "primary" | "secondary" | "accent"
|
|
@@ -291,11 +291,11 @@ Status icons: `"complete"` → green check, `"working"` → spinning (indigo), `
|
|
|
291
291
|
// Single-section wrapper for custom interactive content (e.g., expandable list)
|
|
292
292
|
// NOTE: BaseCard already applies p-4 padding — do NOT add extra p-* to header/section content
|
|
293
293
|
<WidgetCard
|
|
294
|
-
header={<h2 className="text-lg font-semibold text-
|
|
294
|
+
header={<h2 className="text-lg font-semibold text-slate-900 dark:text-slate-50">Active Items</h2>}
|
|
295
295
|
sections={[{
|
|
296
296
|
id: "travelers",
|
|
297
297
|
content: (
|
|
298
|
-
<div className="divide-y divide-
|
|
298
|
+
<div className="divide-y divide-slate-200 dark:divide-slate-800">
|
|
299
299
|
{travelers.map(t => (
|
|
300
300
|
<div key={t.id} onClick={() => toggle(t.id)}>
|
|
301
301
|
{/* collapsed row + expanded details — any JSX works here */}
|
|
@@ -494,8 +494,8 @@ Integrates with AppThemeProvider automatically.
|
|
|
494
494
|
### ChatBar (command palette — use on dashboards)
|
|
495
495
|
```jsx
|
|
496
496
|
<ChatBar
|
|
497
|
-
title="
|
|
498
|
-
placeholder="Ask
|
|
497
|
+
title="AI Assistant"
|
|
498
|
+
placeholder="Ask me anything..."
|
|
499
499
|
suggestions={["Show spend", "Who has flags?", "Active trips"]}
|
|
500
500
|
onSend={async (userMsg, allMessages, helpers) => {
|
|
501
501
|
// Return message object to add to chat:
|
|
@@ -672,12 +672,10 @@ Dropdown select. Value `"all"` skips filtering.
|
|
|
672
672
|
## Data Utilities
|
|
673
673
|
|
|
674
674
|
### DataModeToggle
|
|
675
|
-
> ⚠️ **Do NOT use in the Engine Command Center dashboard.** The Engine dashboard controls data mode via `ENABLE_SAMPLE_DATA_CACHE` in `src/lib/dataStrategy.ts` — there is no UI toggle. Only use `DataModeToggle` in non-Engine dashboards that explicitly need a manual toggle.
|
|
676
|
-
|
|
677
675
|
```jsx
|
|
678
676
|
<DataModeToggle className="ml-4" />
|
|
679
677
|
```
|
|
680
|
-
Pill button switching between "Sample" (beaker icon, amber) and "Live" (signal icon, emerald). Reads/writes to `DataModeProvider` context.
|
|
678
|
+
Pill button switching between "Sample" (beaker icon, amber) and "Live" (signal icon, emerald). Reads/writes to `DataModeProvider` context. Use only if your dashboard needs a manual sample/live toggle in the UI. If data mode is controlled via `ENABLE_SAMPLE_DATA_CACHE` in `src/lib/dataStrategy.ts`, you do not need this toggle.
|
|
681
679
|
|
|
682
680
|
### usePageFilters
|
|
683
681
|
**When:** Complete filtering + sorting state for a data page.
|
|
@@ -780,7 +778,7 @@ Row of sparkle-icon pill buttons for quick prompts. Returns null if empty.
|
|
|
780
778
|
### ChatToolCall
|
|
781
779
|
```jsx
|
|
782
780
|
<ChatToolCall
|
|
783
|
-
toolCall={{ id: "tc1", name: "queryRecords", args: { object: "
|
|
781
|
+
toolCall={{ id: "tc1", name: "queryRecords", args: { object: "Account" },
|
|
784
782
|
status: "complete", result: "Found 6 records" }}
|
|
785
783
|
/>
|
|
786
784
|
```
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
subtitle="Currently on trips" // secondary text
|
|
11
11
|
change="+5.2%" // change amount string
|
|
12
12
|
changeType="positive" // "positive" | "negative" | "neutral"
|
|
13
|
-
icon={<UsersIcon className="h-5 w-5 text-
|
|
13
|
+
icon={<UsersIcon className="h-5 w-5 text-brand-500" />}
|
|
14
14
|
color="default" // "default" | "primary" | "success" | "warning" | "danger"
|
|
15
15
|
trend="vs last month" // trend label text
|
|
16
16
|
layout="default" // "default" | "compact"
|
|
@@ -182,11 +182,11 @@ Status icons: `"complete"` → green check, `"working"` → spinning (indigo), `
|
|
|
182
182
|
// Single-section wrapper for custom interactive content (e.g., expandable list)
|
|
183
183
|
// NOTE: BaseCard already applies p-4 padding — do NOT add extra p-* to header/section content
|
|
184
184
|
<WidgetCard
|
|
185
|
-
header={<h2 className="text-lg font-semibold text-
|
|
185
|
+
header={<h2 className="text-lg font-semibold text-slate-900 dark:text-slate-50">Active Items</h2>}
|
|
186
186
|
sections={[{
|
|
187
187
|
id: "travelers",
|
|
188
188
|
content: (
|
|
189
|
-
<div className="divide-y divide-
|
|
189
|
+
<div className="divide-y divide-slate-200 dark:divide-slate-700">
|
|
190
190
|
{travelers.map(t => (
|
|
191
191
|
<div key={t.id} onClick={() => toggle(t.id)}>
|
|
192
192
|
{/* collapsed row + expanded details — any JSX works here */}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
### ChatBar (command palette — use on dashboards)
|
|
4
4
|
```jsx
|
|
5
5
|
<ChatBar
|
|
6
|
-
title="
|
|
7
|
-
placeholder="Ask
|
|
6
|
+
title="AI Assistant"
|
|
7
|
+
placeholder="Ask me anything..."
|
|
8
8
|
suggestions={["Show spend", "Who has flags?", "Active trips"]}
|
|
9
9
|
onSend={async (userMsg, allMessages, helpers) => {
|
|
10
10
|
// Return message object to add to chat:
|
|
@@ -54,12 +54,10 @@ Wraps app. Provides `useDataMode()` → `{ mode, isSample, isLive, toggle, setMo
|
|
|
54
54
|
## Data Utilities
|
|
55
55
|
|
|
56
56
|
### DataModeToggle
|
|
57
|
-
> ⚠️ **Do NOT use in the Engine Command Center dashboard.** The Engine dashboard controls data mode via `ENABLE_SAMPLE_DATA_CACHE` in `src/lib/dataStrategy.ts` — there is no UI toggle. Only use `DataModeToggle` in non-Engine dashboards that explicitly need a manual toggle.
|
|
58
|
-
|
|
59
57
|
```jsx
|
|
60
58
|
<DataModeToggle className="ml-4" />
|
|
61
59
|
```
|
|
62
|
-
Pill button switching between "Sample" (beaker icon, amber) and "Live" (signal icon, emerald). Reads/writes to `DataModeProvider` context.
|
|
60
|
+
Pill button switching between "Sample" (beaker icon, amber) and "Live" (signal icon, emerald). Reads/writes to `DataModeProvider` context. Use only if your dashboard needs a manual sample/live toggle in the UI. If data mode is controlled via `ENABLE_SAMPLE_DATA_CACHE` in `src/lib/dataStrategy.ts`, you do not need this toggle.
|
|
63
61
|
|
|
64
62
|
### usePageFilters
|
|
65
63
|
**When:** Complete filtering + sorting state for a data page.
|
|
@@ -162,7 +160,7 @@ Row of sparkle-icon pill buttons for quick prompts. Returns null if empty.
|
|
|
162
160
|
### ChatToolCall
|
|
163
161
|
```jsx
|
|
164
162
|
<ChatToolCall
|
|
165
|
-
toolCall={{ id: "tc1", name: "queryRecords", args: { object: "
|
|
163
|
+
toolCall={{ id: "tc1", name: "queryRecords", args: { object: "Account" },
|
|
166
164
|
status: "complete", result: "Found 6 records" }}
|
|
167
165
|
/>
|
|
168
166
|
```
|
|
@@ -1,181 +1,40 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Codegen Overwrites Types
|
|
2
2
|
|
|
3
3
|
## Problem
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
**Symptoms:**
|
|
8
|
-
- TypeScript errors like "Cannot find name 'NullOrder'"
|
|
9
|
-
- Missing type definitions for Account fields
|
|
10
|
-
- graphql-operations-types.ts file suddenly shrinks from ~11,000 lines to ~50 lines
|
|
11
|
-
- Errors appear after running `npm run dev`
|
|
5
|
+
Running `npm run dev` or `npm run build` triggers GraphQL codegen, which regenerates the types file from `schema.graphql`. If the schema is minimal (only a subset of objects), codegen will overwrite a complete types file with a partial one — breaking imports for objects not in the schema.
|
|
12
6
|
|
|
13
7
|
## Root Cause
|
|
14
8
|
|
|
15
|
-
The
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
codegen({
|
|
19
|
-
runOnStart: true, // ❌ Runs codegen when dev server starts
|
|
20
|
-
runOnBuild: true, // ❌ Runs codegen during build
|
|
21
|
-
enableWatcher: true, // ❌ Watches for schema changes and re-runs
|
|
22
|
-
})
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
**What happens:**
|
|
26
|
-
|
|
27
|
-
1. Vite config has codegen enabled with auto-run settings
|
|
28
|
-
2. When you run `npm run dev`, codegen regenerates types from `schema.graphql`
|
|
29
|
-
3. The minimal `schema.graphql` only has Engine objects (Trip__c, Flight__c, etc.)
|
|
30
|
-
4. It's missing standard objects like Account and their types
|
|
31
|
-
5. Codegen overwrites the good ~11,000 line types file with a bad ~50 line file
|
|
32
|
-
6. TypeScript errors: "Cannot find name 'NullOrder'" and other missing types
|
|
33
|
-
|
|
34
|
-
## Why This Happens
|
|
35
|
-
|
|
36
|
-
**Two different schema sources:**
|
|
37
|
-
|
|
38
|
-
1. **Minimal schema.graphql** (6KB)
|
|
39
|
-
- Pre-built from Engine sample data field names
|
|
40
|
-
- Only has Engine custom objects (Trip__c, Flight__c, Booking__c, etc.)
|
|
41
|
-
- Missing standard objects (Account, Contact, etc.)
|
|
42
|
-
- Missing standard types (NullOrder, etc.)
|
|
43
|
-
- Used when org introspection is broken
|
|
44
|
-
- Good for: GraphQL skills, IDE autocomplete for Engine objects
|
|
45
|
-
- Bad for: Complete type generation
|
|
46
|
-
|
|
47
|
-
2. **Complete org schema** (from working org introspection)
|
|
48
|
-
- Has all standard objects (Account, Contact, Lead, etc.)
|
|
49
|
-
- Has all custom objects
|
|
50
|
-
- Has all standard types (NullOrder, etc.)
|
|
51
|
-
- Generates complete ~11,000 line types file
|
|
52
|
-
- Used when: `npm run graphql:schema` works on a different org
|
|
9
|
+
1. The codegen plugin in `vite.config.ts` watches for changes and auto-regenerates
|
|
10
|
+
2. If `schema.graphql` only has custom objects, standard objects (Account, Contact, etc.) get dropped
|
|
11
|
+
3. The generated types file loses type definitions that other code depends on
|
|
53
12
|
|
|
54
13
|
## Solution
|
|
55
14
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
```typescript
|
|
59
|
-
codegen({
|
|
60
|
-
configFilePathOverride: resolve(__dirname, 'codegen.yml'),
|
|
61
|
-
runOnStart: false, // ✅ Disabled - no auto-run on dev server start
|
|
62
|
-
runOnBuild: false, // ✅ Disabled - no auto-run on build
|
|
63
|
-
enableWatcher: false, // ✅ Disabled - no watching for changes
|
|
64
|
-
throwOnBuild: false,
|
|
65
|
-
})
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
**This prevents codegen from auto-running** and overwriting your complete types file.
|
|
69
|
-
|
|
70
|
-
## When to Run Codegen Manually
|
|
71
|
-
|
|
72
|
-
**Only run codegen manually when you WANT to regenerate types from the minimal schema:**
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
npm run graphql:codegen
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
**Use cases for manual codegen:**
|
|
79
|
-
- After adding new fields to the minimal schema.graphql
|
|
80
|
-
- When building Engine dashboard with only Engine objects
|
|
81
|
-
- When you want to use the minimal Engine-only types
|
|
82
|
-
|
|
83
|
-
**DO NOT run codegen if:**
|
|
84
|
-
- You have a complete types file from another org (like react5)
|
|
85
|
-
- You need Account or other standard object types
|
|
86
|
-
- Your current types file is working correctly
|
|
87
|
-
|
|
88
|
-
## Recovery Steps
|
|
89
|
-
|
|
90
|
-
If codegen already overwrote your complete types file:
|
|
91
|
-
|
|
92
|
-
### Option 1: Copy from Working Project
|
|
15
|
+
The `vite.config.ts` template ships with codegen **disabled** (`runOnStart: false`, `runOnBuild: false`, `enableWatcher: false`). This prevents automatic overwrites.
|
|
93
16
|
|
|
94
|
-
|
|
17
|
+
### When to Enable Codegen
|
|
95
18
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
```
|
|
19
|
+
- After running full introspection (`npm run graphql:schema`) successfully
|
|
20
|
+
- When `schema.graphql` contains all objects your app queries
|
|
21
|
+
- Set `runOnBuild: true` only if you want types regenerated on each build
|
|
100
22
|
|
|
101
|
-
###
|
|
23
|
+
### When NOT to Enable Codegen
|
|
102
24
|
|
|
103
|
-
If
|
|
25
|
+
- If `schema.graphql` is minimal or partial
|
|
26
|
+
- If you have a manually curated types file
|
|
27
|
+
- If introspection fails (see `graphql-introspection-failure.md`)
|
|
104
28
|
|
|
105
|
-
|
|
106
|
-
npm run graphql:schema # Fetch complete schema from org
|
|
107
|
-
npm run graphql:codegen # Generate types from complete schema
|
|
108
|
-
```
|
|
29
|
+
## Quick Fix
|
|
109
30
|
|
|
110
|
-
|
|
31
|
+
If codegen overwrote your types:
|
|
111
32
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
```bash
|
|
115
|
-
npm run graphql:codegen # Generates from minimal schema.graphql
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
This is fine for Engine Travel dashboard since it only queries Engine objects.
|
|
119
|
-
|
|
120
|
-
## Prevention
|
|
121
|
-
|
|
122
|
-
**The package now prevents this automatically** (v1.9.53+):
|
|
123
|
-
|
|
124
|
-
1. ✅ vite.config.ts template has codegen auto-run disabled
|
|
125
|
-
2. ✅ Postinstall only installs vite.config.ts if it doesn't exist (doesn't overwrite)
|
|
126
|
-
3. ✅ Documentation explains when to run codegen manually
|
|
127
|
-
|
|
128
|
-
**For existing projects:**
|
|
129
|
-
|
|
130
|
-
If your vite.config.ts has codegen enabled with auto-run, update it:
|
|
131
|
-
|
|
132
|
-
```typescript
|
|
133
|
-
// Find this in your vite.config.ts
|
|
134
|
-
codegen({
|
|
135
|
-
configFilePathOverride: resolve(__dirname, 'codegen.yml'),
|
|
136
|
-
runOnStart: false, // Change from true to false
|
|
137
|
-
runOnBuild: false, // Change from true to false
|
|
138
|
-
enableWatcher: false, // Change from true to false
|
|
139
|
-
throwOnBuild: false,
|
|
140
|
-
})
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
## For Agent Building Engine Dashboard
|
|
144
|
-
|
|
145
|
-
**The complete types file is not required for Engine dashboard.** The Engine dashboard only queries Engine objects (Trip__c, Flight__c, etc.), which are in the minimal schema.graphql.
|
|
146
|
-
|
|
147
|
-
If you encounter "Cannot find name 'NullOrder'" errors:
|
|
148
|
-
|
|
149
|
-
1. Check if the error is in Engine dashboard code or other code
|
|
150
|
-
2. If it's in Engine dashboard code: You shouldn't be using NullOrder (it's for Account queries)
|
|
151
|
-
3. If it's in other code (like Account search): You need the complete types file
|
|
152
|
-
|
|
153
|
-
**Two strategies:**
|
|
154
|
-
|
|
155
|
-
**Strategy 1: Engine Dashboard Only (Minimal Types)**
|
|
156
|
-
- Use the minimal schema.graphql and types
|
|
157
|
-
- Only query Engine objects
|
|
158
|
-
- NullOrder not needed
|
|
159
|
-
|
|
160
|
-
**Strategy 2: Engine + Account Search (Complete Types)**
|
|
161
|
-
- Get complete types file from working project or org
|
|
162
|
-
- Don't run codegen (it will overwrite)
|
|
163
|
-
- Both Engine and standard object queries work
|
|
33
|
+
1. Restore the complete types file from git: `git checkout -- src/api/graphql-operations-types.ts`
|
|
34
|
+
2. Ensure codegen is disabled in `vite.config.ts` (`runOnStart: false`)
|
|
164
35
|
|
|
165
36
|
## Related Files
|
|
166
37
|
|
|
167
|
-
- `vite.config.ts`
|
|
168
|
-
- `schema.graphql`
|
|
169
|
-
- `src/api/graphql-operations-types.ts`
|
|
170
|
-
- `codegen.yml` - Codegen configuration file
|
|
171
|
-
- `.a4drules/troubleshooting/graphql-introspection-failure.md` - Why minimal schema exists
|
|
172
|
-
|
|
173
|
-
## Success Indicators
|
|
174
|
-
|
|
175
|
-
You've successfully prevented the issue when:
|
|
176
|
-
|
|
177
|
-
- ✅ vite.config.ts has codegen with auto-run disabled
|
|
178
|
-
- ✅ `npm run dev` doesn't regenerate types file
|
|
179
|
-
- ✅ Types file stays at ~11,000 lines (or whatever size you want)
|
|
180
|
-
- ✅ No "Cannot find name 'NullOrder'" errors
|
|
181
|
-
- ✅ TypeScript compilation succeeds
|
|
38
|
+
- `vite.config.ts` — Codegen plugin configuration
|
|
39
|
+
- `schema.graphql` — GraphQL schema used for type generation
|
|
40
|
+
- `src/api/graphql-operations-types.ts` — Generated types file
|