@salesforce/webapp-template-app-react-byo-experimental 1.3.3
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/LICENSE.txt +82 -0
- package/dist/.a4drules/build-validation.md +81 -0
- package/dist/.a4drules/code-quality.md +150 -0
- package/dist/.a4drules/graphql/tools/knowledge/lds-explore-graphql-schema.md +227 -0
- package/dist/.a4drules/graphql/tools/knowledge/lds-generate-graphql-mutationquery.md +211 -0
- package/dist/.a4drules/graphql/tools/knowledge/lds-generate-graphql-readquery.md +185 -0
- package/dist/.a4drules/graphql/tools/knowledge/lds-guide-graphql.md +205 -0
- package/dist/.a4drules/graphql/tools/schemas/shared.graphqls +1150 -0
- package/dist/.a4drules/graphql.md +98 -0
- package/dist/.a4drules/images.md +13 -0
- package/dist/.a4drules/react.md +361 -0
- package/dist/.a4drules/react_image_processing.md +45 -0
- package/dist/.a4drules/typescript.md +224 -0
- package/dist/.forceignore +15 -0
- package/dist/.husky/pre-commit +4 -0
- package/dist/.prettierignore +11 -0
- package/dist/.prettierrc +17 -0
- package/dist/CHANGELOG.md +11 -0
- package/dist/README.md +18 -0
- package/dist/config/project-scratch-def.json +13 -0
- package/dist/force-app/main/default/digitalExperienceConfigs/appreactbyo1.digitalExperienceConfig +8 -0
- package/dist/force-app/main/default/digitalExperiences/site/appreactbyo1/appreactbyo1.digitalExperience-meta.xml +11 -0
- package/dist/force-app/main/default/digitalExperiences/site/appreactbyo1/sfdc_cms__site/appreactbyo1/_meta.json +5 -0
- package/dist/force-app/main/default/digitalExperiences/site/appreactbyo1/sfdc_cms__site/appreactbyo1/content.json +10 -0
- package/dist/force-app/main/default/networks/appreactbyo.network +60 -0
- package/dist/force-app/main/default/package.xml +20 -0
- package/dist/force-app/main/default/sites/appreactbyo.site +31 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/.prettierignore +9 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/.prettierrc +11 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/appreactbyo.webapplication-meta.xml +7 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/eslint.config.js +113 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/index.html +13 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/package.json +42 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/api/graphql-operations-types.ts +127 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/api/utils/query/highRevenueAccountsQuery.graphql +29 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/app.tsx +16 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/appLayout.tsx +11 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/assets/icons/book.svg +3 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/assets/icons/copy.svg +4 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/assets/icons/rocket.svg +3 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/assets/icons/star.svg +3 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/assets/images/codey-1.png +0 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/assets/images/codey-2.png +0 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/assets/images/codey-3.png +0 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/assets/images/vibe-codey.svg +194 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/components/alerts/status-alert.tsx +45 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/components/auth/authentication-route.tsx +21 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/components/auth/private-route.tsx +36 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/components/footers/footer-link.tsx +36 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/components/forms/auth-form.tsx +79 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/components/forms/submit-button.tsx +49 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/components/layout/card-layout.tsx +23 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/components/layout/centered-page-layout.tsx +73 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/components/layout/loading-page.tsx +46 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/components/ui/alert.tsx +65 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/components/ui/button.tsx +56 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/components/ui/card.tsx +77 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/components/ui/field.tsx +111 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/components/ui/index.ts +71 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/components/ui/input.tsx +19 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/components/ui/label.tsx +19 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/components/ui/pagination.tsx +99 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/components/ui/select.tsx +151 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/components/ui/skeleton.tsx +7 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/components/ui/spinner.tsx +21 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/components/ui/table.tsx +114 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/components/ui/tabs.tsx +115 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/context/AuthContext.tsx +83 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/hooks/form.tsx +116 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/lib/utils.ts +6 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/navigationMenu.tsx +81 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/pages/About.tsx +12 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/pages/ChangePassword.tsx +105 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/pages/ForgotPassword.tsx +67 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/pages/Home.tsx +12 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/pages/Login.tsx +84 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/pages/NotFound.tsx +18 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/pages/Profile.tsx +146 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/pages/Register.tsx +117 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/pages/ResetPassword.tsx +101 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/pages/about.tsx +10 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/pages/new.tsx +10 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/router-utils.tsx +34 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/routes.tsx +88 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/styles/global.css +94 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/utils/authenticationConfig.ts +52 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/src/utils/helpers.ts +161 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/tsconfig.json +36 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/tsconfig.node.json +13 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/vite-env.d.ts +1 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/vite.config.ts +82 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/vitest-env.d.ts +2 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/vitest.config.ts +11 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/vitest.setup.ts +1 -0
- package/dist/force-app/main/default/webapplications/appreactbyo/webapplication.json +7 -0
- package/dist/jest.config.js +6 -0
- package/dist/package.json +37 -0
- package/dist/scripts/apex/hello.apex +10 -0
- package/dist/scripts/soql/account.soql +6 -0
- package/dist/sfdx-project.json +12 -0
- package/package.json +28 -0
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
Terms of Use
|
|
2
|
+
|
|
3
|
+
Copyright 2026 Salesforce, Inc. All rights reserved.
|
|
4
|
+
|
|
5
|
+
These Terms of Use govern the download, installation, and/or use of this
|
|
6
|
+
software provided by Salesforce, Inc. ("Salesforce") (the "Software"), were
|
|
7
|
+
last updated on April 15, 2025, and constitute a legally binding
|
|
8
|
+
agreement between you and Salesforce. If you do not agree to these Terms of
|
|
9
|
+
Use, do not install or use the Software.
|
|
10
|
+
|
|
11
|
+
Salesforce grants you a worldwide, non-exclusive, no-charge, royalty-free
|
|
12
|
+
copyright license to reproduce, prepare derivative works of, publicly
|
|
13
|
+
display, publicly perform, sublicense, and distribute the Software and
|
|
14
|
+
derivative works subject to these Terms. These Terms shall be included in
|
|
15
|
+
all copies or substantial portions of the Software.
|
|
16
|
+
|
|
17
|
+
Subject to the limited rights expressly granted hereunder, Salesforce
|
|
18
|
+
reserves all rights, title, and interest in and to all intellectual
|
|
19
|
+
property subsisting in the Software. No rights are granted to you hereunder
|
|
20
|
+
other than as expressly set forth herein. Users residing in countries on
|
|
21
|
+
the United States Office of Foreign Assets Control sanction list, or which
|
|
22
|
+
are otherwise subject to a US export embargo, may not use the Software.
|
|
23
|
+
|
|
24
|
+
Implementation of the Software may require development work, for which you
|
|
25
|
+
are responsible. The Software may contain bugs, errors and
|
|
26
|
+
incompatibilities and is made available on an AS IS basis without support,
|
|
27
|
+
updates, or service level commitments.
|
|
28
|
+
|
|
29
|
+
Salesforce reserves the right at any time to modify, suspend, or
|
|
30
|
+
discontinue, the Software (or any part thereof) with or without notice. You
|
|
31
|
+
agree that Salesforce shall not be liable to you or to any third party for
|
|
32
|
+
any modification, suspension, or discontinuance.
|
|
33
|
+
|
|
34
|
+
You agree to defend Salesforce against any claim, demand, suit or
|
|
35
|
+
proceeding made or brought against Salesforce by a third party arising out
|
|
36
|
+
of or accruing from (a) your use of the Software, and (b) any application
|
|
37
|
+
you develop with the Software that infringes any copyright, trademark,
|
|
38
|
+
trade secret, trade dress, patent, or other intellectual property right of
|
|
39
|
+
any person or defames any person or violates their rights of publicity or
|
|
40
|
+
privacy (each a "Claim Against Salesforce"), and will indemnify Salesforce
|
|
41
|
+
from any damages, attorney fees, and costs finally awarded against
|
|
42
|
+
Salesforce as a result of, or for any amounts paid by Salesforce under a
|
|
43
|
+
settlement approved by you in writing of, a Claim Against Salesforce,
|
|
44
|
+
provided Salesforce (x) promptly gives you written notice of the Claim
|
|
45
|
+
Against Salesforce, (y) gives you sole control of the defense and
|
|
46
|
+
settlement of the Claim Against Salesforce (except that you may not settle
|
|
47
|
+
any Claim Against Salesforce unless it unconditionally releases Salesforce
|
|
48
|
+
of all liability), and (z) gives you all reasonable assistance, at your
|
|
49
|
+
expense.
|
|
50
|
+
|
|
51
|
+
WITHOUT LIMITING THE GENERALITY OF THE FOREGOING, THE SOFTWARE IS NOT
|
|
52
|
+
SUPPORTED AND IS PROVIDED "AS IS," WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
53
|
+
IMPLIED. IN NO EVENT SHALL SALESFORCE HAVE ANY LIABILITY FOR ANY DAMAGES,
|
|
54
|
+
INCLUDING, BUT NOT LIMITED TO, DIRECT, INDIRECT, SPECIAL, INCIDENTAL,
|
|
55
|
+
PUNITIVE, OR CONSEQUENTIAL DAMAGES, OR DAMAGES BASED ON LOST PROFITS, DATA,
|
|
56
|
+
OR USE, IN CONNECTION WITH THE SOFTWARE, HOWEVER CAUSED AND WHETHER IN
|
|
57
|
+
CONTRACT, TORT, OR UNDER ANY OTHER THEORY OF LIABILITY, WHETHER OR NOT YOU
|
|
58
|
+
HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
|
59
|
+
|
|
60
|
+
These Terms of Use shall be governed exclusively by the internal laws of
|
|
61
|
+
the State of California, without regard to its conflicts of laws
|
|
62
|
+
rules. Each party hereby consents to the exclusive jurisdiction of the
|
|
63
|
+
state and federal courts located in San Francisco County, California to
|
|
64
|
+
adjudicate any dispute arising out of or relating to these Terms of Use and
|
|
65
|
+
the download, installation, and/or use of the Software. Except as expressly
|
|
66
|
+
stated herein, these Terms of Use constitute the entire agreement between
|
|
67
|
+
the parties, and supersede all prior and contemporaneous agreements,
|
|
68
|
+
proposals, or representations, written or oral, concerning their subject
|
|
69
|
+
matter. No modification, amendment, or waiver of any provision of these
|
|
70
|
+
Terms of Use shall be effective unless it is by an update to these Terms of
|
|
71
|
+
Use that Salesforce makes available, or is in writing and signed by the
|
|
72
|
+
party against whom the modification, amendment, or waiver is to be
|
|
73
|
+
asserted.
|
|
74
|
+
|
|
75
|
+
Data Privacy: Salesforce may collect, process, and store device,
|
|
76
|
+
system, and other information related to your use of the Software. This
|
|
77
|
+
information includes, but is not limited to, IP address, user metrics, and
|
|
78
|
+
other data ("Usage Data"). Salesforce may use Usage Data for analytics,
|
|
79
|
+
product development, and marketing purposes. You acknowledge that files
|
|
80
|
+
generated in conjunction with the Software may contain sensitive or
|
|
81
|
+
confidential data, and you are solely responsible for anonymizing and
|
|
82
|
+
protecting such data.
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# AI Rule: Build Validation
|
|
2
|
+
|
|
3
|
+
Build validation for successful deployments with minimal friction.
|
|
4
|
+
|
|
5
|
+
## Targets
|
|
6
|
+
- `force-app/main/default/webapplications/*/**/*`
|
|
7
|
+
- `**/*.{js,ts,jsx,tsx}`
|
|
8
|
+
|
|
9
|
+
## MANDATORY: Build Success
|
|
10
|
+
|
|
11
|
+
**Before completing any coding session:**
|
|
12
|
+
```bash
|
|
13
|
+
npm run build # MUST succeed with no errors
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Quick Quality Checks
|
|
17
|
+
```bash
|
|
18
|
+
npm run format:check # Auto-fixable
|
|
19
|
+
npm run lint # Most issues auto-fixable
|
|
20
|
+
tsc -b # Catches major issues
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Requirements
|
|
24
|
+
|
|
25
|
+
**Must Pass:**
|
|
26
|
+
- `npm run build` completes successfully
|
|
27
|
+
- No TypeScript compilation errors
|
|
28
|
+
- No critical ESLint errors
|
|
29
|
+
|
|
30
|
+
**Can Be Warnings:**
|
|
31
|
+
- ESLint warnings
|
|
32
|
+
- Prettier formatting issues
|
|
33
|
+
- Minor TypeScript warnings
|
|
34
|
+
|
|
35
|
+
## Auto-Fix Commands
|
|
36
|
+
```bash
|
|
37
|
+
npm run fix-all # Fix formatting + linting
|
|
38
|
+
npm run format # Fix Prettier issues
|
|
39
|
+
npm run lint:fix # Fix ESLint issues
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Workflow
|
|
43
|
+
|
|
44
|
+
**During Development:**
|
|
45
|
+
1. Write code with AI assistance
|
|
46
|
+
2. Save frequently (auto-format on save)
|
|
47
|
+
3. Check periodically: `npm run lint` (optional)
|
|
48
|
+
|
|
49
|
+
**Before Completion:**
|
|
50
|
+
1. Run `npm run build`
|
|
51
|
+
2. If fails: Run `npm run fix-all`, fix TypeScript errors, retry build
|
|
52
|
+
|
|
53
|
+
## Error Priority
|
|
54
|
+
|
|
55
|
+
**Fix Immediately:**
|
|
56
|
+
- TypeScript compilation errors
|
|
57
|
+
- Import/export errors
|
|
58
|
+
- Syntax errors
|
|
59
|
+
|
|
60
|
+
**Fix When Convenient:**
|
|
61
|
+
- ESLint warnings
|
|
62
|
+
- Prettier formatting
|
|
63
|
+
- Unused variables
|
|
64
|
+
|
|
65
|
+
## Hard Requirements
|
|
66
|
+
- Build must complete without errors
|
|
67
|
+
- No broken imports
|
|
68
|
+
- Basic TypeScript type safety
|
|
69
|
+
|
|
70
|
+
## Key Commands
|
|
71
|
+
```bash
|
|
72
|
+
npm run dev # Start development
|
|
73
|
+
npm run build # Check deployment readiness
|
|
74
|
+
npm run fix-all # Fix common issues
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Troubleshooting Import Errors
|
|
78
|
+
```bash
|
|
79
|
+
npm install # Check missing dependencies
|
|
80
|
+
# Verify file exists, case sensitivity, export/import match
|
|
81
|
+
```
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# AI Rule: Code Quality Standards
|
|
2
|
+
|
|
3
|
+
Enforces ESLint, Prettier, and coding best practices for consistent, maintainable code.
|
|
4
|
+
|
|
5
|
+
## Targets
|
|
6
|
+
- `force-app/main/default/webapplications/*/**/*`
|
|
7
|
+
- `**/*.{js,ts,jsx,tsx,json,md}`
|
|
8
|
+
|
|
9
|
+
## MANDATORY Checks
|
|
10
|
+
|
|
11
|
+
**Before writing code:**
|
|
12
|
+
```bash
|
|
13
|
+
npm run lint # MUST result in: 0 problems (0 errors, 0 warnings)
|
|
14
|
+
npm run format:check # MUST result in: All matched files use Prettier code style!
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Prettier Config (.prettierrc)
|
|
18
|
+
```json
|
|
19
|
+
{
|
|
20
|
+
"semi": true,
|
|
21
|
+
"trailingComma": "es5",
|
|
22
|
+
"singleQuote": true,
|
|
23
|
+
"printWidth": 80,
|
|
24
|
+
"tabWidth": 2,
|
|
25
|
+
"useTabs": false,
|
|
26
|
+
"bracketSpacing": true,
|
|
27
|
+
"arrowParens": "avoid",
|
|
28
|
+
"endOfLine": "lf"
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Auto-Fix Commands
|
|
33
|
+
```bash
|
|
34
|
+
npm run fix-all # Fix formatting + linting (recommended)
|
|
35
|
+
npm run format # Fix Prettier issues
|
|
36
|
+
npm run lint:fix # Fix ESLint issues
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Import Order (MANDATORY)
|
|
40
|
+
```typescript
|
|
41
|
+
// 1. React ecosystem
|
|
42
|
+
import { useState, useEffect } from 'react';
|
|
43
|
+
|
|
44
|
+
// 2. External libraries (alphabetical)
|
|
45
|
+
import axios from 'axios';
|
|
46
|
+
import clsx from 'clsx';
|
|
47
|
+
|
|
48
|
+
// 3. UI components (alphabetical)
|
|
49
|
+
import { Button } from '@/components/ui/button';
|
|
50
|
+
import { Card } from '@/components/ui/card';
|
|
51
|
+
|
|
52
|
+
// 4. Internal utilities (alphabetical)
|
|
53
|
+
import { useAuth } from '../hooks/useAuth';
|
|
54
|
+
import { formatDate } from '../utils/dateUtils';
|
|
55
|
+
|
|
56
|
+
// 5. Relative imports
|
|
57
|
+
import { ComponentA } from './ComponentA';
|
|
58
|
+
|
|
59
|
+
// 6. Type imports (separate, at end)
|
|
60
|
+
import type { User, ApiResponse } from '../types';
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Naming Conventions
|
|
64
|
+
```typescript
|
|
65
|
+
// PascalCase: Components, classes
|
|
66
|
+
const UserProfile = () => {};
|
|
67
|
+
const ApiClient = class {};
|
|
68
|
+
|
|
69
|
+
// camelCase: Variables, functions, properties
|
|
70
|
+
const userName = 'john';
|
|
71
|
+
const fetchUserData = async () => {};
|
|
72
|
+
|
|
73
|
+
// SCREAMING_SNAKE_CASE: Constants
|
|
74
|
+
const API_BASE_URL = 'https://api.example.com';
|
|
75
|
+
|
|
76
|
+
// kebab-case: Files
|
|
77
|
+
// user-profile.tsx, api-client.ts
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## React Component Structure
|
|
81
|
+
```typescript
|
|
82
|
+
interface ComponentProps {
|
|
83
|
+
// Props interface first
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const Component: React.FC<ComponentProps> = ({ prop1, prop2 }) => {
|
|
87
|
+
// 1. Hooks
|
|
88
|
+
// 2. Computed values
|
|
89
|
+
// 3. Event handlers
|
|
90
|
+
// 4. JSX return
|
|
91
|
+
|
|
92
|
+
return <div />;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export default Component;
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## JSX Standards
|
|
99
|
+
```typescript
|
|
100
|
+
// Self-closing tags
|
|
101
|
+
<Button onClick={handleClick} />
|
|
102
|
+
|
|
103
|
+
// Conditional rendering
|
|
104
|
+
{isLoading && <Spinner />}
|
|
105
|
+
{error ? <ErrorMessage error={error} /> : <Content />}
|
|
106
|
+
|
|
107
|
+
// Lists with keys
|
|
108
|
+
{items.map(item => <Item key={item.id} data={item} />)}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Error Handling
|
|
112
|
+
```typescript
|
|
113
|
+
// Async functions with try-catch
|
|
114
|
+
const fetchData = async (id: string): Promise<Data> => {
|
|
115
|
+
try {
|
|
116
|
+
const response = await api.get(`/data/${id}`);
|
|
117
|
+
return response.data;
|
|
118
|
+
} catch (error) {
|
|
119
|
+
console.error('Failed to fetch data:', error);
|
|
120
|
+
throw error;
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Anti-Patterns (FORBIDDEN)
|
|
126
|
+
```typescript
|
|
127
|
+
// NEVER disable ESLint without justification
|
|
128
|
+
// eslint-disable-next-line
|
|
129
|
+
|
|
130
|
+
// NEVER mutate state directly
|
|
131
|
+
state.items.push(newItem); // Wrong
|
|
132
|
+
setItems(prev => [...prev, newItem]); // Correct
|
|
133
|
+
|
|
134
|
+
// NEVER use magic numbers/strings
|
|
135
|
+
setTimeout(() => {}, 5000); // Wrong
|
|
136
|
+
const DEBOUNCE_DELAY = 5000; // Correct
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Quality Workflow
|
|
140
|
+
|
|
141
|
+
**Before Committing:**
|
|
142
|
+
1. `npm run check-all` - All checks must pass
|
|
143
|
+
2. `npm run fix-all` - Auto-fix issues if needed
|
|
144
|
+
3. `npm run build` - Build must succeed
|
|
145
|
+
|
|
146
|
+
## Zero Tolerance Policy
|
|
147
|
+
- ESLint errors: MUST be 0
|
|
148
|
+
- ESLint warnings: MUST be 0
|
|
149
|
+
- Prettier violations: MUST be 0
|
|
150
|
+
- TypeScript errors: MUST be 0
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
# GraphQL Schema Reference
|
|
2
|
+
|
|
3
|
+
This document provides guidance for AI agents working with the Salesforce GraphQL API schema in this project.
|
|
4
|
+
|
|
5
|
+
## Schema File Location
|
|
6
|
+
|
|
7
|
+
**The complete GraphQL schema is located at: `@schema.graphql`** (in the project root)
|
|
8
|
+
|
|
9
|
+
> ⚠️ **Important**: The schema file is very large (~265,000+ lines). Do NOT read it entirely. Instead, use targeted searches to find specific types, fields, or operations.
|
|
10
|
+
|
|
11
|
+
If the file is not present, generate it by running:
|
|
12
|
+
```bash
|
|
13
|
+
npm run graphql:get-schema
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Required Pre-Flight Check
|
|
17
|
+
|
|
18
|
+
**BEFORE generating any GraphQL query, you MUST:**
|
|
19
|
+
|
|
20
|
+
1. **Check if schema exists**: Look for `schema.graphql` in the project root
|
|
21
|
+
2. **If schema is missing**:
|
|
22
|
+
- Run `npm run graphql:get-schema` to download it
|
|
23
|
+
- Wait for the command to complete successfully
|
|
24
|
+
- Then proceed with schema exploration
|
|
25
|
+
3. **If schema exists**: Proceed with targeted searches as described below
|
|
26
|
+
|
|
27
|
+
> ⚠️ **DO NOT** generate GraphQL queries without first having access to the schema. Standard field assumptions may not match the target org's configuration.
|
|
28
|
+
|
|
29
|
+
## Schema Structure Overview
|
|
30
|
+
|
|
31
|
+
The schema follows the Salesforce GraphQL Wire Adapter pattern with these main entry points:
|
|
32
|
+
|
|
33
|
+
### Query Entry Point
|
|
34
|
+
```graphql
|
|
35
|
+
type Query {
|
|
36
|
+
uiapi: UIAPI!
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### UIAPI Structure
|
|
41
|
+
```graphql
|
|
42
|
+
type UIAPI {
|
|
43
|
+
query: RecordQuery! # For querying records
|
|
44
|
+
aggregate: RecordQueryAggregate! # For aggregate queries
|
|
45
|
+
objectInfos: [ObjectInfo] # For metadata
|
|
46
|
+
relatedListByName: RelatedListInfo
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Mutation Entry Point
|
|
51
|
+
```graphql
|
|
52
|
+
type Mutation {
|
|
53
|
+
uiapi(input: UIAPIMutationsInput): UIAPIMutations!
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## How to Explore the Schema
|
|
58
|
+
|
|
59
|
+
When you need to build a GraphQL query, use these search patterns:
|
|
60
|
+
|
|
61
|
+
### 1. Find Available Fields for a Record Type
|
|
62
|
+
Search for `type <ObjectName> implements Record` to find all queryable fields:
|
|
63
|
+
```bash
|
|
64
|
+
# Example: Find Account fields
|
|
65
|
+
grep "^type Account implements Record" schema.graphql -A 50
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### 2. Find Filter Options for a Record Type
|
|
69
|
+
Search for `input <ObjectName>_Filter` to find filterable fields and operators:
|
|
70
|
+
```bash
|
|
71
|
+
# Example: Find Account filter options
|
|
72
|
+
grep "^input Account_Filter" schema.graphql -A 30
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### 3. Find OrderBy Options
|
|
76
|
+
Search for `input <ObjectName>_OrderBy` for sorting options:
|
|
77
|
+
```bash
|
|
78
|
+
# Example: Find Account ordering options
|
|
79
|
+
grep "^input Account_OrderBy" schema.graphql -A 20
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### 4. Find Mutation Operations
|
|
83
|
+
Search for operations in `UIAPIMutations`:
|
|
84
|
+
```bash
|
|
85
|
+
# Example: Find Account mutations
|
|
86
|
+
grep "Account.*Create\|Account.*Update\|Account.*Delete" schema.graphql
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### 5. Find Input Types for Mutations
|
|
90
|
+
Search for `input <ObjectName>CreateInput` or `input <ObjectName>UpdateInput`:
|
|
91
|
+
```bash
|
|
92
|
+
# Example: Find Account create input
|
|
93
|
+
grep "^input AccountCreateInput" schema.graphql -A 30
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Common Operator Types
|
|
97
|
+
|
|
98
|
+
### StringOperators (for text fields)
|
|
99
|
+
```graphql
|
|
100
|
+
input StringOperators {
|
|
101
|
+
eq: String # equals
|
|
102
|
+
ne: String # not equals
|
|
103
|
+
like: String # pattern matching (use % as wildcard)
|
|
104
|
+
lt: String # less than
|
|
105
|
+
gt: String # greater than
|
|
106
|
+
lte: String # less than or equal
|
|
107
|
+
gte: String # greater than or equal
|
|
108
|
+
in: [String] # in list
|
|
109
|
+
nin: [String] # not in list
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### OrderByClause
|
|
114
|
+
```graphql
|
|
115
|
+
input OrderByClause {
|
|
116
|
+
order: ResultOrder # ASC or DESC
|
|
117
|
+
nulls: NullOrder # FIRST or LAST
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Query Pattern Examples
|
|
122
|
+
|
|
123
|
+
### Basic Query Structure
|
|
124
|
+
All record queries follow this pattern:
|
|
125
|
+
```graphql
|
|
126
|
+
query {
|
|
127
|
+
uiapi {
|
|
128
|
+
query {
|
|
129
|
+
<ObjectName>(
|
|
130
|
+
first: Int # pagination limit
|
|
131
|
+
after: String # pagination cursor
|
|
132
|
+
where: <Object>_Filter
|
|
133
|
+
orderBy: <Object>_OrderBy
|
|
134
|
+
) {
|
|
135
|
+
edges {
|
|
136
|
+
node {
|
|
137
|
+
Id
|
|
138
|
+
<Field> { value }
|
|
139
|
+
# ... more fields
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Example: Query Accounts with Filter
|
|
149
|
+
```graphql
|
|
150
|
+
query GetHighRevenueAccounts($minRevenue: Currency) {
|
|
151
|
+
uiapi {
|
|
152
|
+
query {
|
|
153
|
+
Account(
|
|
154
|
+
where: { AnnualRevenue: { gt: $minRevenue } }
|
|
155
|
+
orderBy: { AnnualRevenue: { order: DESC } }
|
|
156
|
+
first: 50
|
|
157
|
+
) {
|
|
158
|
+
edges {
|
|
159
|
+
node {
|
|
160
|
+
Id
|
|
161
|
+
Name { value }
|
|
162
|
+
AnnualRevenue { value }
|
|
163
|
+
Industry { value }
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Mutation Pattern
|
|
173
|
+
```graphql
|
|
174
|
+
mutation CreateAccount($input: AccountCreateInput!) {
|
|
175
|
+
uiapi(input: { AccountCreate: { input: $input } }) {
|
|
176
|
+
AccountCreate {
|
|
177
|
+
Record {
|
|
178
|
+
Id
|
|
179
|
+
Name { value }
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Field Value Wrappers
|
|
187
|
+
|
|
188
|
+
Salesforce GraphQL returns field values wrapped in typed objects:
|
|
189
|
+
|
|
190
|
+
| Wrapper Type | Access Pattern |
|
|
191
|
+
|-------------|----------------|
|
|
192
|
+
| `StringValue` | `FieldName { value }` |
|
|
193
|
+
| `IntValue` | `FieldName { value }` |
|
|
194
|
+
| `BooleanValue` | `FieldName { value }` |
|
|
195
|
+
| `DateTimeValue` | `FieldName { value displayValue }` |
|
|
196
|
+
| `PicklistValue` | `FieldName { value displayValue }` |
|
|
197
|
+
| `CurrencyValue` | `FieldName { value displayValue }` |
|
|
198
|
+
|
|
199
|
+
## Agent Workflow for Building Queries
|
|
200
|
+
|
|
201
|
+
**Pre-requisites (MANDATORY):**
|
|
202
|
+
- [ ] Verified `schema.graphql` exists in project root
|
|
203
|
+
- [ ] If missing, ran `npm run graphql:get-schema` and waited for completion
|
|
204
|
+
- [ ] Confirmed connection to correct Salesforce org (if downloading fresh schema)
|
|
205
|
+
|
|
206
|
+
**Workflow Steps:**
|
|
207
|
+
|
|
208
|
+
1. **Identify the target object** (e.g., Account, Contact, Opportunity)
|
|
209
|
+
2. **Search the schema** for the object type to discover available fields
|
|
210
|
+
3. **Search for filter input** (`<Object>_Filter`) to understand filtering options
|
|
211
|
+
4. **Search for orderBy input** (`<Object>_OrderBy`) for sorting capabilities
|
|
212
|
+
5. **Build the query** following the patterns above
|
|
213
|
+
6. **Validate field names** match exactly as defined in the schema (case-sensitive)
|
|
214
|
+
|
|
215
|
+
## Tips for Agents
|
|
216
|
+
|
|
217
|
+
- **Always verify field names** by searching the schema before generating queries
|
|
218
|
+
- **Use grep/search** to explore the schema efficiently—never read the entire file
|
|
219
|
+
- **Check relationships** by looking for `parentRelationship` and `childRelationship` comments in type definitions
|
|
220
|
+
- **Look for Connection types** (e.g., `AccountConnection`) to understand pagination structure
|
|
221
|
+
- **Custom objects** end with `__c` (e.g., `CustomObject__c`)
|
|
222
|
+
- **Custom fields** also end with `__c` (e.g., `Custom_Field__c`)
|
|
223
|
+
|
|
224
|
+
## Related Documentation
|
|
225
|
+
|
|
226
|
+
- For generating mutations and queries, see `lds-generate-graphql-mutationquery.md`
|
|
227
|
+
- For GraphQL best practices, see `lds-guide-graphql.md`
|