@salesforce/webapp-template-feature-react-file-upload-experimental 1.106.2 → 1.107.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/dist/.a4drules/skills/{salesforce-data-access → accessing-data}/SKILL.md +8 -8
- package/dist/.a4drules/skills/{webapp-metadata-and-config → configuring-webapp-metadata}/SKILL.md +1 -1
- package/dist/.a4drules/skills/{webapp-creation → creating-webapp}/SKILL.md +2 -1
- package/dist/.a4drules/skills/{salesforce-graphql-explore-schema → exploring-graphql-schema}/SKILL.md +4 -4
- package/dist/.a4drules/skills/{salesforce-rest-api-fetch → fetching-rest-api}/SKILL.md +3 -3
- package/dist/.a4drules/skills/{salesforce-graphql-mutation-query → generating-graphql-mutation-query}/SKILL.md +10 -10
- package/dist/.a4drules/skills/{salesforce-graphql-read-query → generating-graphql-read-query}/SKILL.md +10 -10
- package/dist/.a4drules/skills/{salesforce-graphql → using-graphql}/SKILL.md +11 -11
- package/dist/.a4drules/webapp-code-quality.md +1 -1
- package/dist/.a4drules/webapp-react.md +3 -3
- package/dist/AGENT.md +4 -4
- package/dist/CHANGELOG.md +11 -0
- package/dist/README.md +10 -0
- package/dist/package.json +2 -1
- package/dist/scripts/sf-project-setup.mjs +66 -0
- package/package.json +2 -2
- /package/dist/.a4drules/skills/{salesforce-graphql → using-graphql}/shared-schema.graphqls +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
2
|
+
name: accessing-data
|
|
3
3
|
description: Salesforce data access patterns. Use when adding or modifying any code that fetches data from Salesforce (records, Chatter, Connect API, etc.).
|
|
4
4
|
paths:
|
|
5
5
|
- "**/*.ts"
|
|
@@ -42,7 +42,7 @@ For GraphQL, if `sdk.graphql` is undefined, the call returns `undefined` — han
|
|
|
42
42
|
- Creating, updating, or deleting records (when GraphQL supports the operation)
|
|
43
43
|
- Fetching related data, filters, sorting, pagination
|
|
44
44
|
|
|
45
|
-
**Use `sdk.fetch` only when GraphQL is not sufficient.** For REST API usage, invoke the `
|
|
45
|
+
**Use `sdk.fetch` only when GraphQL is not sufficient.** For REST API usage, invoke the `fetching-rest-api` skill, which documents:
|
|
46
46
|
|
|
47
47
|
- Chatter API (e.g., `/services/data/v65.0/chatter/users/me`)
|
|
48
48
|
- Connect REST API (e.g., `/services/data/v65.0/connect/file/upload/config`)
|
|
@@ -64,7 +64,7 @@ const sdk = await createDataSDK();
|
|
|
64
64
|
|
|
65
65
|
## Example 1: GraphQL (Preferred)
|
|
66
66
|
|
|
67
|
-
For record queries and mutations, use GraphQL via the Data SDK. Invoke the `
|
|
67
|
+
For record queries and mutations, use GraphQL via the Data SDK. Invoke the `using-graphql` skill for the full workflow (schema exploration, query authoring, codegen, lint validate).
|
|
68
68
|
|
|
69
69
|
```typescript
|
|
70
70
|
import { createDataSDK, gql } from "@salesforce/sdk-data";
|
|
@@ -103,7 +103,7 @@ export async function getAccounts() {
|
|
|
103
103
|
|
|
104
104
|
## Example 2: Fetch (When GraphQL Is Not Sufficient)
|
|
105
105
|
|
|
106
|
-
For REST endpoints that have no GraphQL equivalent, use `sdk.fetch`. **Invoke the `
|
|
106
|
+
For REST endpoints that have no GraphQL equivalent, use `sdk.fetch`. **Invoke the `fetching-rest-api` skill** for full documentation of Chatter, Connect REST, Apex REST, UI API REST, and Einstein LLM endpoints.
|
|
107
107
|
|
|
108
108
|
```typescript
|
|
109
109
|
import { createDataSDK } from "@salesforce/sdk-data";
|
|
@@ -151,15 +151,15 @@ const res = await sdk.fetch?.("/services/data/v65.0/chatter/users/me");
|
|
|
151
151
|
|
|
152
152
|
## Decision Flow
|
|
153
153
|
|
|
154
|
-
1. **Need to query or mutate Salesforce records?** → Use GraphQL via the Data SDK. Invoke the `
|
|
155
|
-
2. **Need Chatter, Connect REST, Apex REST, UI API REST, or Einstein LLM?** → Use `sdk.fetch`. Invoke the `
|
|
154
|
+
1. **Need to query or mutate Salesforce records?** → Use GraphQL via the Data SDK. Invoke the `using-graphql` skill.
|
|
155
|
+
2. **Need Chatter, Connect REST, Apex REST, UI API REST, or Einstein LLM?** → Use `sdk.fetch`. Invoke the `fetching-rest-api` skill.
|
|
156
156
|
3. **Never** use `fetch`, `axios`, or similar directly for Salesforce API calls.
|
|
157
157
|
|
|
158
158
|
---
|
|
159
159
|
|
|
160
160
|
## Reference
|
|
161
161
|
|
|
162
|
-
- GraphQL workflow: invoke the `
|
|
163
|
-
- REST API via fetch: invoke the `
|
|
162
|
+
- GraphQL workflow: invoke the `using-graphql` skill (`.a4drules/skills/using-graphql/`)
|
|
163
|
+
- REST API via fetch: invoke the `fetching-rest-api` skill (`.a4drules/skills/fetching-rest-api/`)
|
|
164
164
|
- Data SDK package: `@salesforce/sdk-data` (`createDataSDK`, `gql`, `NodeOfConnection`)
|
|
165
165
|
- `createRecord` for UI API record creation: `@salesforce/webapp-experimental/api` (uses Data SDK internally)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
+
name: creating-webapp
|
|
2
3
|
description: Core web application rules for SFDX React apps
|
|
3
4
|
paths:
|
|
4
5
|
- "**/webapplications/**/*"
|
|
@@ -81,7 +82,7 @@ Agents consistently miss these. **You must not leave them default.**
|
|
|
81
82
|
|
|
82
83
|
# Shell Command Safety (MUST FOLLOW)
|
|
83
84
|
|
|
84
|
-
**Never use complex `node -e` one-liners** for file edits or multi-line transforms. They break in Zsh due to `!` history expansion and backtick interpolation. Use a temporary `.js` file, `sed`/`awk`, `jq`, or IDE file-editing tools instead.
|
|
85
|
+
**Never use complex `node -e` one-liners** for file edits or multi-line transforms. They break in Zsh due to `!` history expansion and backtick interpolation. Use a temporary `.js` file, `sed`/`awk`, `jq`, or IDE file-editing tools instead.
|
|
85
86
|
|
|
86
87
|
# Development Cycle
|
|
87
88
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
2
|
+
name: exploring-graphql-schema
|
|
3
3
|
description: Explore the Salesforce GraphQL schema via grep-only lookups. Use before generating any GraphQL query — schema exploration must complete first.
|
|
4
4
|
paths:
|
|
5
5
|
- "**/*.ts"
|
|
@@ -125,7 +125,7 @@ Salesforce GraphQL returns field values wrapped in typed objects:
|
|
|
125
125
|
2. **Run the "Find Available Fields" grep command** for your object (copy only the field names visible in the grep output; do not open the file)
|
|
126
126
|
3. **Run the "Find Filter Options" grep command** (`<Object>_Filter`) to understand filtering options
|
|
127
127
|
4. **Run the "Find OrderBy Options" grep command** (`<Object>_OrderBy`) for sorting capabilities
|
|
128
|
-
5. **Build the query** following the patterns in the `
|
|
128
|
+
5. **Build the query** following the patterns in the `generating-graphql-read-query` or `generating-graphql-mutation-query` skill using only values returned by grep
|
|
129
129
|
6. **Validate field names** using grep matches (case-sensitive). Do not open or parse the file beyond grep.
|
|
130
130
|
|
|
131
131
|
## Tips for Agents
|
|
@@ -156,5 +156,5 @@ If any of the above occurs, stop and replace the action with one of the Allowed
|
|
|
156
156
|
|
|
157
157
|
## Related Skills
|
|
158
158
|
|
|
159
|
-
- For generating read queries, invoke the `
|
|
160
|
-
- For generating mutation queries, invoke the `
|
|
159
|
+
- For generating read queries, invoke the `generating-graphql-read-query` skill
|
|
160
|
+
- For generating mutation queries, invoke the `generating-graphql-mutation-query` skill
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
2
|
+
name: fetching-rest-api
|
|
3
3
|
description: REST API usage via the Data SDK fetch method. Use when implementing Chatter, Connect REST, Apex REST, UI API REST, or Einstein LLM calls — only when GraphQL is not sufficient.
|
|
4
4
|
paths:
|
|
5
5
|
- "**/*.ts"
|
|
@@ -162,6 +162,6 @@ const data = await response.json();
|
|
|
162
162
|
|
|
163
163
|
## Reference
|
|
164
164
|
|
|
165
|
-
- Parent: `
|
|
166
|
-
- GraphQL: `
|
|
165
|
+
- Parent: `accessing-data` — enforces Data SDK usage for all Salesforce data fetches
|
|
166
|
+
- GraphQL: `using-graphql` — use for record queries and mutations when possible
|
|
167
167
|
- `createRecord` from `@salesforce/webapp-experimental/api` for UI API record creation (uses SDK internally)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
3
|
-
description: Generate Salesforce GraphQL mutation queries. Use when the query to generate is a mutation query. Schema exploration must complete first — invoke
|
|
2
|
+
name: generating-graphql-mutation-query
|
|
3
|
+
description: Generate Salesforce GraphQL mutation queries. Use when the query to generate is a mutation query. Schema exploration must complete first — invoke exploring-graphql-schema first.
|
|
4
4
|
paths:
|
|
5
5
|
- "**/*.ts"
|
|
6
6
|
- "**/*.tsx"
|
|
@@ -11,16 +11,16 @@ paths:
|
|
|
11
11
|
|
|
12
12
|
**Triggering conditions**
|
|
13
13
|
|
|
14
|
-
1. Only if the schema exploration phase completed successfully (invoke `
|
|
14
|
+
1. Only if the schema exploration phase completed successfully (invoke `exploring-graphql-schema` first)
|
|
15
15
|
2. Only if the query to generate is a mutation query
|
|
16
16
|
|
|
17
17
|
## Schema Access Policy
|
|
18
18
|
|
|
19
|
-
> ⚠️ **GREP ONLY** — During mutation generation you may need to verify field names, input types, or representations. All schema lookups **MUST** use the grep-only commands defined in the `
|
|
19
|
+
> ⚠️ **GREP ONLY** — During mutation generation you may need to verify field names, input types, or representations. All schema lookups **MUST** use the grep-only commands defined in the `exploring-graphql-schema` skill. Do NOT open, read, stream, or parse `./schema.graphql` with any tool other than grep.
|
|
20
20
|
|
|
21
21
|
## Your Role
|
|
22
22
|
|
|
23
|
-
You are a GraphQL expert. Generate Salesforce-compatible mutation queries. Schema exploration must complete first. If the schema exploration has not been executed yet, you **MUST** run the full exploration workflow from the `
|
|
23
|
+
You are a GraphQL expert. Generate Salesforce-compatible mutation queries. Schema exploration must complete first. If the schema exploration has not been executed yet, you **MUST** run the full exploration workflow from the `exploring-graphql-schema` skill first, then return here for mutation query generation.
|
|
24
24
|
|
|
25
25
|
## Mutation Queries General Information
|
|
26
26
|
|
|
@@ -186,7 +186,7 @@ npx eslint <path-to-file-containing-mutation>
|
|
|
186
186
|
|
|
187
187
|
**On failure:** Fix the reported issues, re-run `npx eslint <file>` until clean, then proceed to testing.
|
|
188
188
|
|
|
189
|
-
> ⚠️ **Prerequisites**: The `schema.graphql` file must exist (invoke `
|
|
189
|
+
> ⚠️ **Prerequisites**: The `schema.graphql` file must exist (invoke `exploring-graphql-schema` first) and project dependencies must be installed (`npm install`).
|
|
190
190
|
|
|
191
191
|
## Generated Mutation Query Testing
|
|
192
192
|
|
|
@@ -234,12 +234,12 @@ The query is invalid:
|
|
|
234
234
|
3. **Targeted Resolution** - Depending on the root cause categorization
|
|
235
235
|
- **Execution** - You're trying to update or delete an unknown/no longer available entity: either create an entity first, if you have generated the related query, or ask for a valid entity id to use. **STOP and WAIT** for the user to provide a valid Id
|
|
236
236
|
- **Syntax** - Update the query using the error message information to fix the syntax errors
|
|
237
|
-
- **Validation** - The field name is most probably invalid. Re-run the relevant grep command from the `
|
|
237
|
+
- **Validation** - The field name is most probably invalid. Re-run the relevant grep command from the `exploring-graphql-schema` skill to verify the correct field name. If still unclear, ask the user for clarification and **STOP and WAIT** for their answer
|
|
238
238
|
- **Type** - Use the error details and re-verify the type via grep lookup in the schema. Correct the argument type and adjust variables accordingly
|
|
239
239
|
- **Navigation** - Use the [`PARTIAL` status handling workflow](#partial-status-handling-workflow) below
|
|
240
240
|
- **API Version** - `Record` selection is only available with API version 64 and higher, **report** the issue, and try again with API version 64
|
|
241
241
|
4. **Test Again** - Resume the [query testing workflow](#generated-mutation-query-testing) with the updated query (increment and track attempt counter)
|
|
242
|
-
5. **Escalation Path** - If targeted resolution fails after 2 attempts, ask for additional details and restart the entire GraphQL workflow from the `
|
|
242
|
+
5. **Escalation Path** - If targeted resolution fails after 2 attempts, ask for additional details and restart the entire GraphQL workflow from the `exploring-graphql-schema` skill
|
|
243
243
|
|
|
244
244
|
### `PARTIAL` Status Handling Workflow
|
|
245
245
|
|
|
@@ -254,5 +254,5 @@ The query can be improved:
|
|
|
254
254
|
|
|
255
255
|
## Related Skills
|
|
256
256
|
|
|
257
|
-
- Schema exploration: `
|
|
258
|
-
- Read query generation: `
|
|
257
|
+
- Schema exploration: `exploring-graphql-schema` (must complete first)
|
|
258
|
+
- Read query generation: `generating-graphql-read-query`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
3
|
-
description: Generate Salesforce GraphQL read queries. Use when the query to generate is a read query. Schema exploration must complete first — invoke
|
|
2
|
+
name: generating-graphql-read-query
|
|
3
|
+
description: Generate Salesforce GraphQL read queries. Use when the query to generate is a read query. Schema exploration must complete first — invoke exploring-graphql-schema first.
|
|
4
4
|
paths:
|
|
5
5
|
- "**/*.ts"
|
|
6
6
|
- "**/*.tsx"
|
|
@@ -11,12 +11,12 @@ paths:
|
|
|
11
11
|
|
|
12
12
|
**Triggering conditions**
|
|
13
13
|
|
|
14
|
-
1. Only if the schema exploration phase completed successfully (invoke `
|
|
14
|
+
1. Only if the schema exploration phase completed successfully (invoke `exploring-graphql-schema` first)
|
|
15
15
|
2. Only if the query to generate is a read query
|
|
16
16
|
|
|
17
17
|
## Schema Access Policy
|
|
18
18
|
|
|
19
|
-
> ⚠️ **GREP ONLY** — During query generation you may need to verify field names, types, or relationships. All schema lookups **MUST** use the grep-only commands defined in the `
|
|
19
|
+
> ⚠️ **GREP ONLY** — During query generation you may need to verify field names, types, or relationships. All schema lookups **MUST** use the grep-only commands defined in the `exploring-graphql-schema` skill. Do NOT open, read, stream, or parse `./schema.graphql` with any tool other than grep.
|
|
20
20
|
|
|
21
21
|
## Field-Level Security and @optional
|
|
22
22
|
|
|
@@ -35,7 +35,7 @@ const name = node.Name.value;
|
|
|
35
35
|
|
|
36
36
|
## Your Role
|
|
37
37
|
|
|
38
|
-
You are a GraphQL expert. Generate Salesforce-compatible read queries. Schema exploration must complete first. If the schema exploration has not been executed yet, you **MUST** run the full exploration workflow from the `
|
|
38
|
+
You are a GraphQL expert. Generate Salesforce-compatible read queries. Schema exploration must complete first. If the schema exploration has not been executed yet, you **MUST** run the full exploration workflow from the `exploring-graphql-schema` skill first, then return here for read query generation.
|
|
39
39
|
|
|
40
40
|
## Read Query Generation Workflow
|
|
41
41
|
|
|
@@ -202,7 +202,7 @@ npx eslint <path-to-file-containing-query>
|
|
|
202
202
|
|
|
203
203
|
**On failure:** Fix the reported issues, re-run `npx eslint <file>` until clean, then proceed to testing.
|
|
204
204
|
|
|
205
|
-
> ⚠️ **Prerequisites**: The `schema.graphql` file must exist (invoke `
|
|
205
|
+
> ⚠️ **Prerequisites**: The `schema.graphql` file must exist (invoke `exploring-graphql-schema` first) and project dependencies must be installed (`npm install`).
|
|
206
206
|
|
|
207
207
|
## Generated Read Query Testing
|
|
208
208
|
|
|
@@ -242,12 +242,12 @@ The query is invalid:
|
|
|
242
242
|
- **Type** - Error contains `VariableTypeMismatch` or `UnknownType`
|
|
243
243
|
3. **Targeted Resolution** - Depending on the root cause categorization
|
|
244
244
|
- **Syntax** - Update the query using the error message information to fix the syntax errors
|
|
245
|
-
- **Validation** - The field name is most probably invalid. Re-run the relevant grep command from the `
|
|
245
|
+
- **Validation** - The field name is most probably invalid. Re-run the relevant grep command from the `exploring-graphql-schema` skill to verify the correct field name. If still unclear, ask the user for clarification and **STOP and WAIT** for their answer
|
|
246
246
|
- **Type** - Use the error details and re-verify the type via grep lookup in the schema. Correct the argument type and adjust variables accordingly
|
|
247
247
|
4. **Test Again** - Resume the [query testing workflow](#generated-read-query-testing) with the updated query (increment and track attempt counter)
|
|
248
|
-
5. **Escalation Path** - If targeted resolution fails after 2 attempts, ask for additional details and restart the entire GraphQL workflow from the `
|
|
248
|
+
5. **Escalation Path** - If targeted resolution fails after 2 attempts, ask for additional details and restart the entire GraphQL workflow from the `exploring-graphql-schema` skill
|
|
249
249
|
|
|
250
250
|
## Related Skills
|
|
251
251
|
|
|
252
|
-
- Schema exploration: `
|
|
253
|
-
- Mutation generation: `
|
|
252
|
+
- Schema exploration: `exploring-graphql-schema` (must complete first)
|
|
253
|
+
- Mutation generation: `generating-graphql-mutation-query`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
2
|
+
name: using-graphql
|
|
3
3
|
description: Salesforce GraphQL data access. Use when the user asks to fetch, query, or mutate Salesforce data, or add a GraphQL operation for an object like Account, Contact, or Opportunity.
|
|
4
4
|
paths:
|
|
5
5
|
- "**/*.ts"
|
|
@@ -20,7 +20,7 @@ Guidance for querying and mutating Salesforce data via the Salesforce GraphQL AP
|
|
|
20
20
|
|
|
21
21
|
## Schema Access Policy (GREP ONLY)
|
|
22
22
|
|
|
23
|
-
> **GREP ONLY** — The `schema.graphql` file is very large (~265,000+ lines). All schema lookups **MUST** use the grep-only commands defined in the `
|
|
23
|
+
> **GREP ONLY** — The `schema.graphql` file is very large (~265,000+ lines). All schema lookups **MUST** use the grep-only commands defined in the `exploring-graphql-schema` skill. Do NOT open, read, stream, or parse `./schema.graphql` with any tool other than grep.
|
|
24
24
|
|
|
25
25
|
## Directory Context
|
|
26
26
|
|
|
@@ -80,9 +80,9 @@ Ensure `schema.graphql` exists at the project root. If missing, run `npm run gra
|
|
|
80
80
|
|
|
81
81
|
Before writing any query, verify the target object and its fields exist in the schema.
|
|
82
82
|
|
|
83
|
-
**Invoke the `
|
|
83
|
+
**Invoke the `exploring-graphql-schema` skill** for the full exploration workflow and **mandatory grep-only access policy**.
|
|
84
84
|
|
|
85
|
-
> **GREP ONLY** — All schema lookups MUST use the grep commands defined in the `
|
|
85
|
+
> **GREP ONLY** — All schema lookups MUST use the grep commands defined in the `exploring-graphql-schema` skill. Do NOT open, read, stream, or parse `./schema.graphql` with any tool other than grep.
|
|
86
86
|
|
|
87
87
|
Key actions (all via grep):
|
|
88
88
|
|
|
@@ -113,8 +113,8 @@ For **Pattern 1**:
|
|
|
113
113
|
|
|
114
114
|
1. Create a `.graphql` file under `src/api/utils/query/`
|
|
115
115
|
2. Follow UIAPI structure: `query { uiapi { query { ObjectName(...) { edges { node { ... } } } } } }`
|
|
116
|
-
3. For mutations, invoke the `
|
|
117
|
-
4. For read queries, invoke the `
|
|
116
|
+
3. For mutations, invoke the `generating-graphql-mutation-query` skill
|
|
117
|
+
4. For read queries, invoke the `generating-graphql-read-query` skill
|
|
118
118
|
|
|
119
119
|
For **Pattern 2**:
|
|
120
120
|
|
|
@@ -123,7 +123,7 @@ For **Pattern 2**:
|
|
|
123
123
|
|
|
124
124
|
### Step 5: Test Queries Against Live Org
|
|
125
125
|
|
|
126
|
-
Use the testing workflows in the `
|
|
126
|
+
Use the testing workflows in the `generating-graphql-read-query` and `generating-graphql-mutation-query` skills to validate queries against the connected org before integrating into the app.
|
|
127
127
|
|
|
128
128
|
### Step 6: Generate Types
|
|
129
129
|
|
|
@@ -284,7 +284,7 @@ Before completing GraphQL data access code:
|
|
|
284
284
|
|
|
285
285
|
### For Pattern 1 (.graphql files):
|
|
286
286
|
|
|
287
|
-
1. [ ] All field names verified via grep against `schema.graphql` (invoke `
|
|
287
|
+
1. [ ] All field names verified via grep against `schema.graphql` (invoke `exploring-graphql-schema`)
|
|
288
288
|
2. [ ] Create `.graphql` file for the query/mutation
|
|
289
289
|
3. [ ] Run `npm run graphql:codegen` to generate types
|
|
290
290
|
4. [ ] Import query with `?raw` suffix
|
|
@@ -315,9 +315,9 @@ Before completing GraphQL data access code:
|
|
|
315
315
|
|
|
316
316
|
## Reference
|
|
317
317
|
|
|
318
|
-
- Schema exploration: invoke the `
|
|
319
|
-
- Read query generation: invoke the `
|
|
320
|
-
- Mutation query generation: invoke the `
|
|
318
|
+
- Schema exploration: invoke the `exploring-graphql-schema` skill
|
|
319
|
+
- Read query generation: invoke the `generating-graphql-read-query` skill
|
|
320
|
+
- Mutation query generation: invoke the `generating-graphql-mutation-query` skill
|
|
321
321
|
- Shared GraphQL schema types: `shared-schema.graphqls` (in this skill directory)
|
|
322
322
|
- Schema download: `npm run graphql:schema` (run from webapp dir)
|
|
323
323
|
- Type generation: `npm run graphql:codegen` (run from webapp dir)
|
|
@@ -15,7 +15,7 @@ Enforces ESLint, TypeScript, and build validation for consistent, maintainable c
|
|
|
15
15
|
```bash
|
|
16
16
|
npm run lint # MUST result in 0 errors
|
|
17
17
|
npm run build # MUST succeed (includes TypeScript check)
|
|
18
|
-
npm run graphql:
|
|
18
|
+
npm run graphql:codegen # MUST succeed (verifies graphql queries)
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
**Must Pass:**
|
|
@@ -23,12 +23,12 @@ React apps must NOT import Salesforce platform modules like `lightning/*` or `@w
|
|
|
23
23
|
|
|
24
24
|
## Data Access (CRITICAL)
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
For all Salesforce data access (GraphQL, REST, Chatter, Connect, Apex REST, UI API, Einstein LLM), invoke the **`accessing-data`** skill (`.a4drules/skills/accessing-data/`). It enforces Data SDK usage, GraphQL-first preference, optional chaining, and documents when to use `sdk.fetch` via the `fetching-rest-api` skill.
|
|
27
27
|
|
|
28
28
|
### GraphQL (Preferred)
|
|
29
29
|
|
|
30
|
-
For queries and mutations,
|
|
30
|
+
For queries and mutations, invoke the **`using-graphql`** skill (`.a4drules/skills/using-graphql/`). It covers schema exploration, query patterns, codegen, type generation, and guardrails.
|
|
31
31
|
|
|
32
32
|
### UI API (Fallback)
|
|
33
33
|
|
|
34
|
-
When GraphQL cannot cover the use case, use `sdk.fetch
|
|
34
|
+
When GraphQL cannot cover the use case, use `sdk.fetch?.()` for UI API endpoints. See the **`fetching-rest-api`** skill (`.a4drules/skills/fetching-rest-api/`) for full REST API documentation.
|
package/dist/AGENT.md
CHANGED
|
@@ -58,9 +58,9 @@ cd <sfdx-source>/webapplications/<appName>
|
|
|
58
58
|
|
|
59
59
|
This project includes **.a4drules/** at the project root. Follow them when generating or editing code.
|
|
60
60
|
|
|
61
|
-
- **
|
|
62
|
-
- **
|
|
63
|
-
- **
|
|
61
|
+
- **Accessing Data** (`.a4drules/skills/accessing-data/`): Use for all Salesforce data fetches. Enforces Data SDK usage (`createDataSDK()` + `sdk.graphql` or `sdk.fetch`); GraphQL preferred, fetch when GraphQL is not sufficient.
|
|
62
|
+
- **Fetching REST API** (`.a4drules/skills/fetching-rest-api/`): Use when implementing Chatter, Connect REST, Apex REST, UI API REST, or Einstein LLM calls via `sdk.fetch`.
|
|
63
|
+
- **Using GraphQL** (`.a4drules/skills/using-graphql/`): Use when implementing Salesforce GraphQL queries or mutations. Sub-skills: `exploring-graphql-schema`, `generating-graphql-read-query`, `generating-graphql-mutation-query`.
|
|
64
64
|
|
|
65
65
|
When rules refer to "web app directory" or `<sfdx-source>/webapplications/<appName>/`, resolve `<sfdx-source>` from `sfdx-project.json` and use the **actual app folder name** for this project.
|
|
66
66
|
|
|
@@ -83,4 +83,4 @@ sf project deploy start --source-dir <packageDir> --target-org <alias>
|
|
|
83
83
|
|
|
84
84
|
- **UI**: shadcn/ui + Tailwind. Import from `@/components/ui/...`.
|
|
85
85
|
- **Entry**: Keep `App.tsx` and routes in `src/`; add features as new routes or sections, don't replace the app shell but you may modify it to match the requested design.
|
|
86
|
-
- **Data (Salesforce)**: Invoke the `
|
|
86
|
+
- **Data (Salesforce)**: Invoke the `accessing-data` skill for all Salesforce data fetches. The skill enforces use of the Data SDK (`createDataSDK()` + `sdk.graphql` or `sdk.fetch`) — never use `fetch` or `axios` directly. GraphQL is preferred; use `sdk.fetch` when GraphQL is not sufficient (e.g., Chatter, Connect REST). For GraphQL implementation, invoke the `using-graphql` skill.
|
package/dist/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [1.107.0](https://github.com/salesforce-experience-platform-emu/webapps/compare/v1.106.2...v1.107.0) (2026-03-17)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **template:** add sf-project-setup command at SFDX project root ([#301](https://github.com/salesforce-experience-platform-emu/webapps/issues/301)) ([5a187cd](https://github.com/salesforce-experience-platform-emu/webapps/commit/5a187cd2faeadcab6c8f206d8c110c29763983ec))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [1.106.2](https://github.com/salesforce-experience-platform-emu/webapps/compare/v1.106.1...v1.106.2) (2026-03-17)
|
|
7
18
|
|
|
8
19
|
|
package/dist/README.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
Now that you’ve created a Salesforce DX project, what’s next? Here are some documentation resources to get you started.
|
|
4
4
|
|
|
5
|
+
## Web app: install, build, and dev server
|
|
6
|
+
|
|
7
|
+
From the **SFDX project root** (this directory), run:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm run sf-project-setup
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
This installs dependencies in the web app, builds it, and starts the Vite dev server. Use this after cloning or extracting the project.
|
|
14
|
+
|
|
5
15
|
## How Do You Plan to Deploy Your Changes?
|
|
6
16
|
|
|
7
17
|
Do you want to deploy a set of changes, or create a self-contained application? Choose a [development model](https://developer.salesforce.com/tools/vscode/en/user-guide/development-models).
|
package/dist/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/webapp-template-base-sfdx-project-experimental",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.107.0",
|
|
4
4
|
"description": "Base SFDX project template",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
|
+
"sf-project-setup": "node scripts/sf-project-setup.mjs",
|
|
10
11
|
"build": "echo 'No build required for base-sfdx-project'",
|
|
11
12
|
"clean": "echo 'No clean required for base-sfdx-project'",
|
|
12
13
|
"lint": "eslint **/{aura,lwc}/**/*.js",
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Run from SFDX project root: install dependencies, build, and launch the dev server
|
|
4
|
+
* for the web app in force-app/main/default/webapplications/.
|
|
5
|
+
*
|
|
6
|
+
* Usage: npm run sf-project-setup
|
|
7
|
+
* (from the directory that contains force-app/ and sfdx-project.json)
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { spawnSync } from 'node:child_process';
|
|
11
|
+
import { resolve, dirname } from 'node:path';
|
|
12
|
+
import { fileURLToPath } from 'node:url';
|
|
13
|
+
import { readdirSync, existsSync, readFileSync } from 'node:fs';
|
|
14
|
+
|
|
15
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
16
|
+
const ROOT = resolve(__dirname, '..');
|
|
17
|
+
|
|
18
|
+
function resolveWebapplicationsDir() {
|
|
19
|
+
const sfdxPath = resolve(ROOT, 'sfdx-project.json');
|
|
20
|
+
if (!existsSync(sfdxPath)) {
|
|
21
|
+
console.error('Error: sfdx-project.json not found at project root.');
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
const sfdxProject = JSON.parse(readFileSync(sfdxPath, 'utf8'));
|
|
25
|
+
const pkgDir = sfdxProject?.packageDirectories?.[0]?.path;
|
|
26
|
+
if (!pkgDir) {
|
|
27
|
+
console.error('Error: No packageDirectories[].path found in sfdx-project.json.');
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
return resolve(ROOT, pkgDir, 'main', 'default', 'webapplications');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function discoverWebappDir() {
|
|
34
|
+
const webapplicationsDir = resolveWebapplicationsDir();
|
|
35
|
+
if (!existsSync(webapplicationsDir)) {
|
|
36
|
+
console.error(`Error: webapplications directory not found: ${webapplicationsDir}`);
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
39
|
+
const entries = readdirSync(webapplicationsDir, { withFileTypes: true });
|
|
40
|
+
const dirs = entries.filter((e) => e.isDirectory() && !e.name.startsWith('.'));
|
|
41
|
+
if (dirs.length === 0) {
|
|
42
|
+
console.error(`Error: No web app folder found under ${webapplicationsDir}`);
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
45
|
+
if (dirs.length > 1) {
|
|
46
|
+
console.log(`Multiple web apps found; using first: ${dirs[0].name}`);
|
|
47
|
+
}
|
|
48
|
+
return resolve(webapplicationsDir, dirs[0].name);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function run(label, cmd, args, opts) {
|
|
52
|
+
console.log(`\n--- ${label} ---\n`);
|
|
53
|
+
const result = spawnSync(cmd, args, { stdio: 'inherit', ...opts });
|
|
54
|
+
if (result.status !== 0) {
|
|
55
|
+
process.exit(result.status ?? 1);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const webappDir = discoverWebappDir();
|
|
60
|
+
console.log('SFDX project root:', ROOT);
|
|
61
|
+
console.log('Web app directory:', webappDir);
|
|
62
|
+
|
|
63
|
+
run('npm install', 'npm', ['install'], { cwd: webappDir });
|
|
64
|
+
run('npm run build', 'npm', ['run', 'build'], { cwd: webappDir });
|
|
65
|
+
console.log('\n--- Launching dev server (Ctrl+C to stop) ---\n');
|
|
66
|
+
run('npm run dev', 'npm', ['run', 'dev'], { cwd: webappDir });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/webapp-template-feature-react-file-upload-experimental",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.107.0",
|
|
4
4
|
"description": "File upload feature with a component to upload files to core",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"author": "",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@salesforce/webapp-experimental": "^1.
|
|
44
|
+
"@salesforce/webapp-experimental": "^1.107.0",
|
|
45
45
|
"@types/react": "^19.2.7",
|
|
46
46
|
"@types/react-dom": "^19.2.3",
|
|
47
47
|
"nodemon": "^3.1.0",
|
|
File without changes
|