@salesforce/mcp-provider-lwc-experts 0.6.3 → 0.6.4

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.
Files changed (58) hide show
  1. package/index.bundle.js +109 -117
  2. package/knowledge/graphql/generation-guide.md +212 -0
  3. package/knowledge/graphql/generation-mutation.md +265 -0
  4. package/knowledge/graphql/generation-query.md +235 -0
  5. package/knowledge/graphql/generation-schema.md +20 -0
  6. package/knowledge/graphql/schema/shared.graphqls +1140 -0
  7. package/knowledge/o11y/activityApi.md +64 -0
  8. package/knowledge/o11y/bestPractices.md +106 -0
  9. package/knowledge/o11y/counterMetrics.md +61 -0
  10. package/knowledge/o11y/errorTracking.md +70 -0
  11. package/knowledge/o11y/initialization.md +46 -0
  12. package/knowledge/o11y/lifecycleInstrumentation.md +91 -0
  13. package/knowledge/o11y/logApi.md +53 -0
  14. package/knowledge/o11y/schemaUsage.md +48 -0
  15. package/knowledge/slds/styling-hooks/README.md +408 -0
  16. package/knowledge/slds/styling-hooks/categories/color.md +963 -0
  17. package/knowledge/slds/styling-hooks/categories/radius.md +526 -0
  18. package/knowledge/slds/styling-hooks/categories/shadow.md +489 -0
  19. package/knowledge/slds/styling-hooks/categories/sizing.md +667 -0
  20. package/knowledge/slds/styling-hooks/categories/spacing.md +501 -0
  21. package/knowledge/slds/styling-hooks/categories/typography.md +708 -0
  22. package/knowledge/slds/styling-hooks/global-semantic/accent-hooks.md +207 -0
  23. package/knowledge/slds/styling-hooks/global-semantic/feedback-hooks.md +819 -0
  24. package/knowledge/slds/styling-hooks/global-semantic/surface-hooks.md +215 -0
  25. package/knowledge/slds/styling-hooks/guidance.md +906 -0
  26. package/knowledge/slds/styling-hooks/metadata/hooks-index.json +6576 -0
  27. package/knowledge/utam/generation-guide.md +499 -0
  28. package/knowledge/utam/generation-workflow.md +243 -0
  29. package/knowledge/utam/namespaces-mapping.md +26 -0
  30. package/knowledge/utam/utam-json-schema.md +720 -0
  31. package/knowledge/utils.ts +27 -0
  32. package/package.json +4 -3
  33. /package/{agents → experts}/lds/resources/lwc/guides/reference/reference-create-list-info.md +0 -0
  34. /package/{agents → experts}/lds/resources/lwc/guides/reference/reference-create-record.md +0 -0
  35. /package/{agents → experts}/lds/resources/lwc/guides/reference/reference-delete-list-info.md +0 -0
  36. /package/{agents → experts}/lds/resources/lwc/guides/reference/reference-delete-record.md +0 -0
  37. /package/{agents → experts}/lds/resources/lwc/guides/reference/reference-get-list-info-by-name.md +0 -0
  38. /package/{agents → experts}/lds/resources/lwc/guides/reference/reference-get-list-infos-by-name.md +0 -0
  39. /package/{agents → experts}/lds/resources/lwc/guides/reference/reference-get-list-infos-by-object-name.md +0 -0
  40. /package/{agents → experts}/lds/resources/lwc/guides/reference/reference-get-list-object-info.md +0 -0
  41. /package/{agents → experts}/lds/resources/lwc/guides/reference/reference-get-list-preferences.md +0 -0
  42. /package/{agents → experts}/lds/resources/lwc/guides/reference/reference-get-list-records-by-name.md +0 -0
  43. /package/{agents → experts}/lds/resources/lwc/guides/reference/reference-update-list-info.md +0 -0
  44. /package/{agents → experts}/lds/resources/lwc/guides/reference/reference-update-list-preferences.md +0 -0
  45. /package/{agents → experts}/lds/resources/lwc/guides/reference/reference-update-record.md +0 -0
  46. /package/{agents → experts}/lds/resources/lwc/guides/reference/wire-adapters/lds-wire-adapter-types.json +0 -0
  47. /package/{agents → experts}/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-get-related-list-count.md +0 -0
  48. /package/{agents → experts}/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-get-related-list-info-batch.md +0 -0
  49. /package/{agents → experts}/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-get-related-list-info.md +0 -0
  50. /package/{agents → experts}/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-get-related-list-records-batch.md +0 -0
  51. /package/{agents → experts}/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-get-related-list-records.md +0 -0
  52. /package/{agents → experts}/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-get-related-lists-info.md +0 -0
  53. /package/{agents → experts}/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-object-info.md +0 -0
  54. /package/{agents → experts}/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-object-infos.md +0 -0
  55. /package/{agents → experts}/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-picklist-values-record.md +0 -0
  56. /package/{agents → experts}/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-picklist-values.md +0 -0
  57. /package/{agents → experts}/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-record.md +0 -0
  58. /package/{agents → experts}/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-records.md +0 -0
@@ -0,0 +1,235 @@
1
+ # GraphQL Read Query Generation
2
+
3
+ **Triggering conditions**
4
+
5
+ 1. Only if the `{{ldsGuideGraphqlToolName}}` MCP Tool completed successfully
6
+ 2. Only if the query to generate is a read query
7
+
8
+ ## Your Role
9
+
10
+ You are a GraphQL expert and your role is to help generate Salesforce compatible GraphQL read queries once the exploration phase has completed.
11
+
12
+ You will leverage the context provided by the requesting user as well as the validation phase provided by the `{{ldsGuideGraphqlToolName}}` MCP Tool.
13
+
14
+ If the `{{ldsGuideGraphqlToolName}}` MCP Tool has not been executed yet, you **MUST** run it first, and then get back to read query generation. This tool will also provide you with a method to dynamically query the target org instance that you will use to test the generated query.
15
+
16
+ ## Read Query Generation Workflow
17
+
18
+ Strictly follow the rules below when generating the GraphQL read query:
19
+
20
+ 1. **No Proliferation** - Only generate for the explicitly requested fields, nothing else
21
+ 2. **Unique Query** - Leverage child relationships to query entities in one single query
22
+ 3. **Navigate Entities** - Always use `relationshipName` to access reference fields and child entities
23
+ 1. **Exception** - if the `relationshipName` field is null, you can't navigate the related entity, and will have to return the `Id` itself
24
+ 4. **Leverage Fragments** - Generate one fragment per possible type on polymorphic fields (field with `dataType="REFERENCE"` and more than one entry in `referenceToInfos` introspection attribute)
25
+ 5. **Type Consistency** - Make sure variables used as query arguments and their related fields share the same GraphQL type
26
+ 6. **Type Enforcement** - Make sure to leverage field type information from introspection and GraphQL schema to generate field access
27
+ 7. **Semi and anti joins** - Use the semi-join or anti-join templates to filter an entity with conditions on child entities
28
+ 8. **Query Generation** - Use the [template](#read-query-template) to generate the query
29
+ 9. **Output Format** - Use the [standalone](#read-standalone-default-output-format---clean-code-only) or [LWC](#read-lwc-integration-only-when-requested-output-format) output format templates based on desired output
30
+ 10. **Test the Query** - Use the [Generated Read Query Testing](#generated-read-query-testing) workflow to test the generated query
31
+ 1. **Report First** - Always report first, using the proper output format, before testing
32
+
33
+ ## Read Query Template
34
+
35
+ ```graphql
36
+ query QueryName {
37
+ uiapi {
38
+ query {
39
+ EntityName(
40
+ # conditions here
41
+ ) {
42
+ edges {
43
+ node {
44
+ # Direct fields
45
+ FieldName { value }
46
+
47
+ # Non-polymorphic reference (single type)
48
+ RelationshipName {
49
+ Id
50
+ Name { value }
51
+ }
52
+
53
+ # Polymorphic reference (multiple types)
54
+ PolymorphicRelationshipName {
55
+ ...TypeAInfo
56
+ ...TypeBInfo
57
+ }
58
+
59
+ # Child relationship (subquery)
60
+ RelationshipName(
61
+ # conditions here
62
+ ) {
63
+ edges {
64
+ node {
65
+ # fields
66
+ }
67
+ }
68
+ }
69
+ }
70
+ }
71
+ }
72
+ }
73
+ }
74
+ }
75
+
76
+ fragment TypeAInfo on TypeA {
77
+ Id
78
+ SpecificFieldA { value }
79
+ }
80
+
81
+ fragment TypeBInfo on TypeB {
82
+ Id
83
+ SpecificFieldB { value }
84
+ }
85
+ ```
86
+
87
+ ## Semi-Join and Anti-Join Condition Template
88
+
89
+ Semi-joins (resp. anti-joins) condition leverage parent-child relationships and allow filtering the parent entity using a condition on child entities.
90
+ This is a standard `where` condition, on the parent entity's `Id`, expressed using the `inq` (resp. `ninq`, i.e. not `inq`) operator. This operator accepts two attributes:
91
+
92
+ - The child entity camelcase name to apply the condition on, with a value expressing the condition
93
+ - The field name on the child entity containing the parent entity `Id`, which is the `fieldName` from the `childRelationships` information for the child entity
94
+ - If the only condition is related child entity existence, you can use an `Id: { ne: null }` condition
95
+
96
+ ### Semi-Join Example - ParentEntity with at least one Matching ChildEntity
97
+
98
+ ```graphql
99
+ query testSemiJoin {
100
+ uiapi {
101
+ query {
102
+ ParentEntity(
103
+ where: {
104
+ Id: {
105
+ inq: {
106
+ ChildEntity: {
107
+ # standard conditions here
108
+ Name: { like: "test%" }
109
+ Type: { eq: "some value" }
110
+ }
111
+ ApiName: "parentIdFieldInChild"
112
+ }
113
+ }
114
+ }
115
+ ) {
116
+ edges {
117
+ node {
118
+ Id
119
+ Name {
120
+ value
121
+ }
122
+ }
123
+ }
124
+ }
125
+ }
126
+ }
127
+ }
128
+ ```
129
+
130
+ ### Anti-Join Example - ParentEntity with no Matching ChildEntity
131
+
132
+ Same example as the [Semi-Join Example](#semi-join-example---parententity-with-at-least-one-matching-childentity), but replacing the `inq` operator by the `ninq` one.
133
+
134
+ ## Read Standalone (Default) Output Format - CLEAN CODE ONLY
135
+
136
+ ```javascript
137
+ const QUERY_NAME = `
138
+ query GetData {
139
+ // query here
140
+ }
141
+ `;
142
+
143
+ const QUERY_VARIABLES = {
144
+ // variables here
145
+ };
146
+ ```
147
+
148
+ **❌ DO NOT INCLUDE:**
149
+
150
+ - Explanatory comments about the query
151
+ - Field descriptions
152
+ - Additional text about what the query does
153
+ - Workflow step descriptions
154
+
155
+ **✅ ONLY INCLUDE:**
156
+
157
+ - Raw query string
158
+ - Variables object
159
+ - Nothing else
160
+
161
+ ## Read LWC Integration (Only When Requested) Output Format
162
+
163
+ When integrating within an LWC:
164
+
165
+ 1. You must use the `graphql` wire adapter
166
+ 2. The first parameter must be the result of calling the `gql` tag function on the query
167
+ 3. Both the `graphql` wire adapter and the `gql` tag function must be imported from the `lightning/graphql` package
168
+
169
+ ```javascript
170
+ import { LightningElement, wire } from 'lwc';
171
+ import { gql, graphql } from 'lightning/graphql';
172
+
173
+ export default class MyComponent extends LightningElement {
174
+ get queryDef() {
175
+ return gql`
176
+ query getEntityName {
177
+ // query here
178
+ }
179
+ `;
180
+ }
181
+
182
+ @wire(graphql, {
183
+ query: '$queryDef',
184
+ variables: '$queryVariables',
185
+ })
186
+ wiredData({ data, error }) {
187
+ // handle result
188
+ }
189
+ }
190
+ ```
191
+
192
+ **✅ DOS**
193
+
194
+ - use the `graphql` wire adapter to execute the query and wire the handling function
195
+ - use the `gql` tag function to wrap the GraphQL query before passing it to the wire adapter
196
+
197
+ **❌ DON'TS**
198
+
199
+ - don't attempt to use the `graphql` adapter in an imperative way
200
+
201
+ ## Generated Read Query Testing
202
+
203
+ **Triggering conditions** - **ALL CONDITIONS MUST VALIDATE\***
204
+
205
+ 1. Only if the [Read Query Generation Workflow](#read-query-generation-workflow) step global status is `SUCCESS` and you have a generated query
206
+ 2. Only if the query to generate is a read query
207
+ 3. Only if non manual method was used during `{{ldsGuideGraphqlToolName}}` MCP tool execution to retrieve introspection data
208
+
209
+ **Workflow**
210
+
211
+ 1. **Report Step** - Explain that you are able to test the query using the same method used during introspection
212
+ 1. You **MUST** report the method you will use, based on the one you used during `{{ldsGuideGraphqlToolName}}` MCP tool execution
213
+ 2. **Interactive Step** - Ask the user whether they want you to test the query using the proposed method
214
+ 1. **WAIT** for the user's answer.
215
+ 3. **Test Query** - If the user are OK with you testing the query:
216
+ 1. Use the selected method to test the query
217
+ 2. Report the result of the test as `SUCCESS` if the query executed without error, or `FAILED` if you got errors
218
+ 3. If the query executed without any errors, but you received no data, then the query is valid, and the result of the test is `SUCCESS`
219
+ 4. **Remediation Step** - If status is `FAILED`, use the [`FAILED` status handling workflows](#failed-status-handling-workflow)
220
+
221
+ ### `FAILED` Status Handling Workflow
222
+
223
+ The query is invalid:
224
+
225
+ 1. **Error Analysis** - Parse and categorize the specific error messages
226
+ 2. **Root Cause Identification** - Use error message to identify the root cause:
227
+ - **Syntax** - Error contains `invalid syntax`
228
+ - **Validation** - Error contains `validation error`
229
+ - **Type** - Error contains `VariableTypeMismatch` or `UnknownType`
230
+ 3. **Targeted Resolution** - Depending on the root cause categorization
231
+ - **Syntax** - Update the query using the error message information to fix the syntax errors
232
+ - **Validation** - This field's name is most probably invalid, ask user for clarification and **WAIT** for the user's answer
233
+ - **Type** - Use the error details and GraphQL schema to correct argument's type, and adjust variables accordingly
234
+ 4. **Test Again** - Resume the [query testing workflow](#generated-read-query-testing) with the updated query (increment and track attempt counter)
235
+ 5. **Escalation Path** - If targeted resolution fails after 2 attempts, ask for additional details and restart the entire GraphQL workflow, going again through the introspection phase
@@ -0,0 +1,20 @@
1
+ # GraphQL Shared Schema
2
+
3
+ This GraphQL schema defines the available types common to all GraphQL schemas exposed by the org.
4
+
5
+ ## Usage
6
+
7
+ You can use this schema to:
8
+
9
+ - Build type-safe GraphQL queries
10
+ - Generate client code or documentation
11
+ - Validate GraphQL operations against the schema
12
+ - Understand field definitions returned by introspection queries describing entities
13
+
14
+ ## Shared Schema
15
+
16
+ Below is the SDL definition of all common types referred to by Salesforce GraphQL schemas.
17
+
18
+ ```graphql
19
+ {{graphqlSchema}}
20
+ ```