@salesforce/templates 66.1.1 → 66.2.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.
Files changed (238) hide show
  1. package/lib/generators/projectGenerator.d.ts +6 -0
  2. package/lib/generators/projectGenerator.js +43 -4
  3. package/lib/generators/projectGenerator.js.map +1 -1
  4. package/lib/templates/project/react-b2e/.a4drules/README.md +35 -0
  5. package/lib/templates/project/react-b2e/.a4drules/a4d-webapp-generate.md +27 -0
  6. package/lib/templates/project/react-b2e/.a4drules/build-validation.md +78 -0
  7. package/lib/templates/project/react-b2e/.a4drules/code-quality.md +137 -0
  8. package/lib/templates/project/react-b2e/.a4drules/graphql/tools/knowledge/lds-explore-graphql-schema.md +227 -0
  9. package/lib/templates/project/react-b2e/.a4drules/graphql/tools/knowledge/lds-generate-graphql-mutationquery.md +212 -0
  10. package/lib/templates/project/react-b2e/.a4drules/graphql/tools/knowledge/lds-generate-graphql-readquery.md +185 -0
  11. package/lib/templates/project/react-b2e/.a4drules/graphql/tools/knowledge/lds-guide-graphql.md +205 -0
  12. package/lib/templates/project/react-b2e/.a4drules/graphql/tools/schemas/shared.graphqls +1150 -0
  13. package/lib/templates/project/react-b2e/.a4drules/graphql.md +409 -0
  14. package/lib/templates/project/react-b2e/.a4drules/images.md +13 -0
  15. package/lib/templates/project/react-b2e/.a4drules/react.md +387 -0
  16. package/lib/templates/project/react-b2e/.a4drules/react_image_processing.md +45 -0
  17. package/lib/templates/project/react-b2e/.a4drules/typescript.md +224 -0
  18. package/lib/templates/project/react-b2e/.a4drules/ui-layout.md +23 -0
  19. package/lib/templates/project/react-b2e/.a4drules/webapp-nav-and-placeholders.md +33 -0
  20. package/lib/templates/project/react-b2e/.a4drules/webapp-no-node-e.md +25 -0
  21. package/lib/templates/project/react-b2e/.a4drules/webapp-ui-first.md +32 -0
  22. package/lib/templates/project/react-b2e/.a4drules/webapp.md +75 -0
  23. package/lib/templates/project/react-b2e/.forceignore +15 -0
  24. package/lib/templates/project/react-b2e/.husky/pre-commit +4 -0
  25. package/lib/templates/project/react-b2e/.prettierignore +11 -0
  26. package/lib/templates/project/react-b2e/.prettierrc +17 -0
  27. package/lib/templates/project/react-b2e/AGENT.md +75 -0
  28. package/lib/templates/project/react-b2e/CHANGELOG.md +696 -0
  29. package/lib/templates/project/react-b2e/README.md +18 -0
  30. package/lib/templates/project/react-b2e/config/project-scratch-def.json +13 -0
  31. package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/.graphqlrc.yml +2 -0
  32. package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/.prettierignore +9 -0
  33. package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/.prettierrc +11 -0
  34. package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/appreacttemplateb2e.webapplication-meta.xml +7 -0
  35. package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/build/vite.config.d.ts +2 -0
  36. package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/build/vite.config.js +93 -0
  37. package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/codegen.yml +94 -0
  38. package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/e2e/app.spec.ts +17 -0
  39. package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/eslint.config.js +141 -0
  40. package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/index.html +13 -0
  41. package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/package-lock.json +14392 -0
  42. package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/package.json +58 -0
  43. package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/playwright.config.ts +24 -0
  44. package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/scripts/get-graphql-schema.mjs +68 -0
  45. package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/scripts/rewrite-e2e-assets.mjs +23 -0
  46. package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/src/api/graphql-operations-types.ts +116 -0
  47. package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/src/api/utils/accounts.ts +33 -0
  48. package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/src/api/utils/query/highRevenueAccountsQuery.graphql +29 -0
  49. package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/src/app.tsx +22 -0
  50. package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/src/appLayout.tsx +19 -0
  51. package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/src/assets/icons/book.svg +3 -0
  52. package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/src/assets/icons/copy.svg +4 -0
  53. package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/src/assets/icons/rocket.svg +3 -0
  54. package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/src/assets/icons/star.svg +3 -0
  55. package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/src/assets/images/codey-1.png +0 -0
  56. package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/src/assets/images/codey-2.png +0 -0
  57. package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/src/assets/images/codey-3.png +0 -0
  58. package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/src/assets/images/vibe-codey.svg +194 -0
  59. package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/src/components/AgentforceConversationClient.tsx +127 -0
  60. package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/src/index.ts +6 -0
  61. package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/src/navigationMenu.tsx +80 -0
  62. package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/src/pages/Home.tsx +12 -0
  63. package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/src/pages/NotFound.tsx +18 -0
  64. package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/src/router-utils.tsx +35 -0
  65. package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/src/routes.tsx +22 -0
  66. package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/src/styles/global.css +13 -0
  67. package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/src/types/conversation.ts +21 -0
  68. package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/tsconfig.json +36 -0
  69. package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/tsconfig.node.json +13 -0
  70. package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/vite-env.d.ts +1 -0
  71. package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/vite.config.ts +102 -0
  72. package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/vitest-env.d.ts +2 -0
  73. package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/vitest.config.ts +11 -0
  74. package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/vitest.setup.ts +1 -0
  75. package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/webapplication.json +7 -0
  76. package/lib/templates/project/react-b2e/jest.config.js +6 -0
  77. package/lib/templates/project/react-b2e/package.json +38 -0
  78. package/lib/templates/project/react-b2e/scripts/apex/hello.apex +10 -0
  79. package/lib/templates/project/react-b2e/scripts/soql/account.soql +6 -0
  80. package/lib/templates/project/react-b2e/sfdx-project.json +12 -0
  81. package/lib/templates/project/react-b2x/.a4drules/README.md +35 -0
  82. package/lib/templates/project/react-b2x/.a4drules/a4d-webapp-generate.md +27 -0
  83. package/lib/templates/project/react-b2x/.a4drules/build-validation.md +78 -0
  84. package/lib/templates/project/react-b2x/.a4drules/code-quality.md +137 -0
  85. package/lib/templates/project/react-b2x/.a4drules/graphql/tools/knowledge/lds-explore-graphql-schema.md +227 -0
  86. package/lib/templates/project/react-b2x/.a4drules/graphql/tools/knowledge/lds-generate-graphql-mutationquery.md +212 -0
  87. package/lib/templates/project/react-b2x/.a4drules/graphql/tools/knowledge/lds-generate-graphql-readquery.md +185 -0
  88. package/lib/templates/project/react-b2x/.a4drules/graphql/tools/knowledge/lds-guide-graphql.md +205 -0
  89. package/lib/templates/project/react-b2x/.a4drules/graphql/tools/schemas/shared.graphqls +1150 -0
  90. package/lib/templates/project/react-b2x/.a4drules/graphql.md +409 -0
  91. package/lib/templates/project/react-b2x/.a4drules/images.md +13 -0
  92. package/lib/templates/project/react-b2x/.a4drules/react.md +387 -0
  93. package/lib/templates/project/react-b2x/.a4drules/react_image_processing.md +45 -0
  94. package/lib/templates/project/react-b2x/.a4drules/typescript.md +224 -0
  95. package/lib/templates/project/react-b2x/.a4drules/ui-layout.md +23 -0
  96. package/lib/templates/project/react-b2x/.a4drules/webapp-nav-and-placeholders.md +33 -0
  97. package/lib/templates/project/react-b2x/.a4drules/webapp-no-node-e.md +25 -0
  98. package/lib/templates/project/react-b2x/.a4drules/webapp-ui-first.md +32 -0
  99. package/lib/templates/project/react-b2x/.a4drules/webapp.md +75 -0
  100. package/lib/templates/project/react-b2x/.forceignore +15 -0
  101. package/lib/templates/project/react-b2x/.husky/pre-commit +4 -0
  102. package/lib/templates/project/react-b2x/.prettierignore +11 -0
  103. package/lib/templates/project/react-b2x/.prettierrc +17 -0
  104. package/lib/templates/project/react-b2x/AGENT.md +75 -0
  105. package/lib/templates/project/react-b2x/CHANGELOG.md +696 -0
  106. package/lib/templates/project/react-b2x/README.md +18 -0
  107. package/lib/templates/project/react-b2x/config/project-scratch-def.json +13 -0
  108. package/lib/templates/project/react-b2x/force-app/main/default/classes/WebAppAuthUtils.cls +68 -0
  109. package/lib/templates/project/react-b2x/force-app/main/default/classes/WebAppAuthUtils.cls-meta.xml +5 -0
  110. package/lib/templates/project/react-b2x/force-app/main/default/classes/WebAppChangePassword.cls +77 -0
  111. package/lib/templates/project/react-b2x/force-app/main/default/classes/WebAppChangePassword.cls-meta.xml +5 -0
  112. package/lib/templates/project/react-b2x/force-app/main/default/classes/WebAppForgotPassword.cls +71 -0
  113. package/lib/templates/project/react-b2x/force-app/main/default/classes/WebAppForgotPassword.cls-meta.xml +5 -0
  114. package/lib/templates/project/react-b2x/force-app/main/default/classes/WebAppLogin.cls +105 -0
  115. package/lib/templates/project/react-b2x/force-app/main/default/classes/WebAppLogin.cls-meta.xml +5 -0
  116. package/lib/templates/project/react-b2x/force-app/main/default/classes/WebAppRegistration.cls +162 -0
  117. package/lib/templates/project/react-b2x/force-app/main/default/classes/WebAppRegistration.cls-meta.xml +5 -0
  118. package/lib/templates/project/react-b2x/force-app/main/default/digitalExperienceConfigs/appreacttemplateb2x1.digitalExperienceConfig +8 -0
  119. package/lib/templates/project/react-b2x/force-app/main/default/digitalExperiences/site/appreacttemplateb2x1/appreacttemplateb2x1.digitalExperience-meta.xml +11 -0
  120. package/lib/templates/project/react-b2x/force-app/main/default/digitalExperiences/site/appreacttemplateb2x1/sfdc_cms__site/appreacttemplateb2x1/_meta.json +5 -0
  121. package/lib/templates/project/react-b2x/force-app/main/default/digitalExperiences/site/appreacttemplateb2x1/sfdc_cms__site/appreacttemplateb2x1/content.json +10 -0
  122. package/lib/templates/project/react-b2x/force-app/main/default/networks/appreacttemplateb2x.network +60 -0
  123. package/lib/templates/project/react-b2x/force-app/main/default/package.xml +20 -0
  124. package/lib/templates/project/react-b2x/force-app/main/default/sites/appreacttemplateb2x.site +31 -0
  125. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/.graphqlrc.yml +2 -0
  126. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/.prettierignore +9 -0
  127. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/.prettierrc +11 -0
  128. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/appreacttemplateb2x.webapplication-meta.xml +7 -0
  129. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/build/vite.config.d.ts +2 -0
  130. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/build/vite.config.js +93 -0
  131. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/codegen.yml +94 -0
  132. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/e2e/app.spec.ts +17 -0
  133. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/eslint.config.js +141 -0
  134. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/index.html +13 -0
  135. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/package-lock.json +18408 -0
  136. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/package.json +66 -0
  137. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/playwright.config.ts +24 -0
  138. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/scripts/get-graphql-schema.mjs +68 -0
  139. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/scripts/rewrite-e2e-assets.mjs +23 -0
  140. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/api/graphql-operations-types.ts +116 -0
  141. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/api/utils/accounts.ts +33 -0
  142. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/api/utils/query/highRevenueAccountsQuery.graphql +29 -0
  143. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/app.tsx +13 -0
  144. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/appLayout.tsx +11 -0
  145. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/assets/icons/book.svg +3 -0
  146. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/assets/icons/copy.svg +4 -0
  147. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/assets/icons/rocket.svg +3 -0
  148. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/assets/icons/star.svg +3 -0
  149. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/assets/images/codey-1.png +0 -0
  150. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/assets/images/codey-2.png +0 -0
  151. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/assets/images/codey-3.png +0 -0
  152. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/assets/images/vibe-codey.svg +194 -0
  153. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/alerts/status-alert.tsx +45 -0
  154. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/auth/authHelpers.ts +73 -0
  155. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/auth/authenticationConfig.ts +61 -0
  156. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/auth/authenticationRouteLayout.tsx +21 -0
  157. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/auth/privateRouteLayout.tsx +36 -0
  158. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/auth/sessionTimeout/SessionTimeoutValidator.tsx +616 -0
  159. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/auth/sessionTimeout/sessionTimeService.ts +161 -0
  160. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/auth/sessionTimeout/sessionTimeoutConfig.ts +77 -0
  161. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/footers/footer-link.tsx +36 -0
  162. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/forms/auth-form.tsx +81 -0
  163. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/forms/submit-button.tsx +49 -0
  164. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/layout/card-layout.tsx +23 -0
  165. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/layout/card-skeleton.tsx +38 -0
  166. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/layout/centered-page-layout.tsx +73 -0
  167. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/alert.tsx +69 -0
  168. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/button.tsx +67 -0
  169. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/card.tsx +92 -0
  170. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/dialog.tsx +143 -0
  171. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/field.tsx +222 -0
  172. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/index.ts +72 -0
  173. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/input.tsx +19 -0
  174. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/label.tsx +19 -0
  175. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/pagination.tsx +112 -0
  176. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/select.tsx +183 -0
  177. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/separator.tsx +26 -0
  178. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/skeleton.tsx +14 -0
  179. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/spinner.tsx +15 -0
  180. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/table.tsx +87 -0
  181. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/tabs.tsx +78 -0
  182. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components.json +18 -0
  183. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/context/AuthContext.tsx +95 -0
  184. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/hooks/form.tsx +116 -0
  185. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/hooks/useCountdownTimer.ts +266 -0
  186. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/hooks/useRetryWithBackoff.ts +109 -0
  187. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/layouts/AuthAppLayout.tsx +12 -0
  188. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/lib/data-sdk.ts +21 -0
  189. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/lib/utils.ts +6 -0
  190. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/navigationMenu.tsx +80 -0
  191. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/pages/ChangePassword.tsx +107 -0
  192. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/pages/ForgotPassword.tsx +73 -0
  193. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/pages/Home.tsx +12 -0
  194. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/pages/Login.tsx +97 -0
  195. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/pages/NotFound.tsx +18 -0
  196. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/pages/Profile.tsx +178 -0
  197. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/pages/Register.tsx +138 -0
  198. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/pages/ResetPassword.tsx +107 -0
  199. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/router-utils.tsx +35 -0
  200. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/routes.tsx +71 -0
  201. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/styles/global.css +135 -0
  202. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/utils/helpers.ts +121 -0
  203. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/tsconfig.json +36 -0
  204. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/tsconfig.node.json +13 -0
  205. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/vite-env.d.ts +1 -0
  206. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/vite.config.ts +102 -0
  207. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/vitest-env.d.ts +2 -0
  208. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/vitest.config.ts +11 -0
  209. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/vitest.setup.ts +1 -0
  210. package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/webapplication.json +7 -0
  211. package/lib/templates/project/react-b2x/jest.config.js +6 -0
  212. package/lib/templates/project/react-b2x/package.json +38 -0
  213. package/lib/templates/project/react-b2x/scripts/apex/hello.apex +10 -0
  214. package/lib/templates/project/react-b2x/scripts/soql/account.soql +6 -0
  215. package/lib/templates/project/react-b2x/sfdx-project.json +12 -0
  216. package/lib/templates/webapplication/reactbasic/.graphqlrc.yml +2 -0
  217. package/lib/templates/webapplication/reactbasic/build/vite.config.js +20 -1
  218. package/lib/templates/webapplication/reactbasic/codegen.yml +94 -0
  219. package/lib/templates/webapplication/reactbasic/e2e/app.spec.ts +0 -7
  220. package/lib/templates/webapplication/reactbasic/eslint.config.js +28 -0
  221. package/lib/templates/webapplication/reactbasic/package-lock.json +10090 -2874
  222. package/lib/templates/webapplication/reactbasic/package.json +16 -4
  223. package/lib/templates/webapplication/reactbasic/scripts/get-graphql-schema.mjs +68 -0
  224. package/lib/templates/webapplication/reactbasic/src/api/graphql-operations-types.ts +23 -34
  225. package/lib/templates/webapplication/reactbasic/src/api/utils/accounts.ts +33 -0
  226. package/lib/templates/webapplication/reactbasic/src/app.tsx +10 -1
  227. package/lib/templates/webapplication/reactbasic/src/appLayout.tsx +2 -0
  228. package/lib/templates/webapplication/reactbasic/src/navigationMenu.tsx +80 -0
  229. package/lib/templates/webapplication/reactbasic/src/router-utils.tsx +35 -0
  230. package/lib/templates/webapplication/reactbasic/src/routes.tsx +1 -7
  231. package/lib/templates/webapplication/reactbasic/vite.config.ts +20 -1
  232. package/lib/tsconfig.tsbuildinfo +1 -1
  233. package/lib/utils/types.d.ts +1 -1
  234. package/lib/utils/webappTemplateUtils.d.ts +49 -0
  235. package/lib/utils/webappTemplateUtils.js +210 -0
  236. package/lib/utils/webappTemplateUtils.js.map +1 -0
  237. package/package.json +7 -5
  238. package/lib/templates/webapplication/reactbasic/src/pages/About.tsx +0 -12
@@ -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`
@@ -0,0 +1,212 @@
1
+ # GraphQL Mutation Query Generation
2
+
3
+ **Triggering conditions**
4
+ 1. Only if the `LDS_Guide_GraphQL` rule completed successfully
5
+ 2. Only if the query to generate is a mutation query
6
+
7
+ ## Your Role
8
+
9
+ You are a GraphQL expert and your role is to help generate Salesforce compatible GraphQL mutation queries once the exploration phase has completed.
10
+
11
+ You will leverage the context provided by the requesting user as well as the validation phase provided by the `LDS_Guide_GraphQL` rule. 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.
12
+
13
+ If the `LDS_Guide_GraphQL` rule has not been executed yet, you **MUST** run it first, and then get back to mutation query generation.
14
+
15
+ ## Mutation Queries General Information
16
+
17
+ **IMPORTANT**:
18
+ 1. **Mutation Types**: The GraphQL engine supports `Create`, `Update` and `Delete` operations
19
+ 2. **Id Based Mutations**: `Update` and `Delete` operations operate on Id-based entity identification
20
+ 3. **Mutation Schema**: Defined in the [mutation query schema](#mutation-query-schema) section
21
+
22
+ ## Mutation Query Generation Workflow
23
+
24
+ Strictly follow the rules below when generating the GraphQL mutation query:
25
+ 1. **Input Fields Validation** - Validate that the set of fields validate [input field constraints](#mutation-queries-input-field-constraints)
26
+ 2. **Output Fields Validation** - Validate that the set of fields used in the select part of the query validate the [output fields constraints](#mutation-queries-output-field-constraints)
27
+ 3. **Type Consistency** - Make sure variables used as query arguments and their related fields share the same GraphQL type
28
+ 4. **Report Phase** - Use the [Mutation Query Report Template](#mutation-query-report-template) below to report on the previous validation phases
29
+ 5. **Input Arguments** - `input` is the default name for the argument, unless otherwise specified
30
+ 6. **Output Field** - For `Create` and `Update` operations, the output field is always named `Record`, and is of type EntityName
31
+ 7. **Query Generation** - Use the [mutation query](#mutation-query-templates) template and adjust it based on the selected operation
32
+ 8. **Output Format** - Use the [standalone](#mutation-standalone-default-output-format---clean-code-only)
33
+ 9. **Test the Query** - Use the [Generated Mutation Query Testing](#generated-mutation-query-testing) workflow to test the generated query
34
+ 1. **Report First** - Always report first, using the proper output format, before testing
35
+
36
+ ## Mutation Query Schema
37
+
38
+ **Important**: In the schema fragments below, replace **EntityName** occurrences by the real entity name (i.e. Account, Case...).
39
+ **Important**: `Delete` operations all share the same generic `Record` entity name for both input and payload, only exposing the standard `Id` field.
40
+
41
+ ```graphql
42
+ input EntityNameCreateRepresentation {
43
+ # Subset of EntityName fields here
44
+ }
45
+ input EntityNameCreateInput { EntityName: EntityNameCreateRepresentation! }
46
+ type EntityNameCreatePayload { Record: EntityName! }
47
+
48
+ input EntityNameUpdateRepresentation {
49
+ # Subset of EntityName fields here
50
+ }
51
+ input EntityNameUpdateInput { Id: IdOrRef! EntityName: EntityNameUpdateRepresentation! }
52
+ type EntityNameUpdatePayload { Record: EntityName! }
53
+
54
+ input RecordDeleteInput { Id: IdOrRef! }
55
+ type RecordDeletePayload { Id: ID }
56
+
57
+ type UIAPIMutations {
58
+ EntityNameCreate(input: EntityNameCreateInput!): EntityNameCreatePayload
59
+ EntityNameDelete(input: RecordDeleteInput!): RecordDeletePayload
60
+ EntityNameUpdate(input: EntityNameUpdateInput!): EntityNameUpdatePayload
61
+ }
62
+ ```
63
+
64
+ ## Mutation Queries Input Field Constraints
65
+
66
+ 1. **`Create` Mutation Queries**:
67
+ 1. **MUST** include all required fields
68
+ 2. **MUST** only include createable fields
69
+ 3. Child relationships can't be set and **MUST** be excluded
70
+ 4. Fields with type `REFERENCE` can only be assigned IDs through their `ApiName` name
71
+ 2. **`Update` Mutation Queries**:
72
+ 1. **MUST** include the id of the entity to update
73
+ 2. **MUST** only include updateable fields
74
+ 3. Child relationships can't be set and **MUST** be excluded
75
+ 4. Fields with type `REFERENCE` can only be assigned IDs through their `ApiName` name
76
+ 3. **`Delete` Mutation Queries**:
77
+ 1. **MUST** include the id of the entity to delete
78
+
79
+ ## Mutation Queries Output Field Constraints
80
+
81
+ 1. **`Create` and `Update` Mutation Queries**:
82
+ 1. **MUST** exclude all child relationships
83
+ 2. **MUST** exclude all `REFERENCE` fields, unless accessed through their `ApiName` member (no navigation to referenced entity)
84
+ 3. Inaccessible fields will be reported as part of the `errors` attribute in the returned payload
85
+ 4. Child relationships **CAN'T** be queried as part of a mutation
86
+ 5. Fields with type `REFERENCE` can only be queried through their `ApiName` (no referenced entities navigation, no sub fields)
87
+ 2. **`Delete` Mutation Queries**:
88
+ 1. **MUST** only include the `Id` field
89
+
90
+ ## Mutation Query Report Template
91
+
92
+ Input arguments:
93
+ - Required fields: FieldName1 (Type1), FieldName2 (Type2)...
94
+ - Other fields: FieldName3 (Type3)...
95
+ Output fields: FieldNameA (TypeA), FieldNameB (TypeB)...
96
+
97
+ ## Mutation Query Templates
98
+
99
+ ```graphql
100
+ mutation mutateEntityName(
101
+ # arguments
102
+ ) {
103
+ uiapi {
104
+ EntityNameOperation(input: {
105
+ # the following is for `Create` and `Update` operations only
106
+ EntityName: {
107
+ # Input fields
108
+ }
109
+ # the following is for `Update` and `Delete` operations only
110
+ Id: ... # id here
111
+ }) {
112
+ # the following is for `Create` and `Update` operations only
113
+ Record {
114
+ # Output fields
115
+ }
116
+ # the following is for `Delete` operations only
117
+ Id: ... # id here
118
+ }
119
+ }
120
+ }
121
+ ```
122
+
123
+ ## Mutation Standalone (Default) Output Format - CLEAN CODE ONLY
124
+
125
+ ```javascript
126
+ import { gql } from 'api/graphql.ts';
127
+ const QUERY_NAME = gql`
128
+ mutation mutateEntity($input: EntityNameOperationInput!) {
129
+ uiapi {
130
+ EntityNameOperation(input: $input) {
131
+ # select output fields here depending on operation type
132
+ }
133
+ }
134
+ }
135
+ `;
136
+
137
+ const QUERY_VARIABLES = {
138
+ input: {
139
+ // The following is for `Create` and `Update` operations only
140
+ EntityName: {
141
+ // variables here
142
+ },
143
+ // The following is for `Update` and `Delete` operations only
144
+ Id: ... // id here
145
+ }
146
+ };
147
+ ```
148
+
149
+ **❌ DO NOT INCLUDE:**
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
+ - Raw query string
157
+ - Variables object
158
+ - Nothing else
159
+
160
+ ## Generated Mutation Query Testing
161
+
162
+ **Triggering conditions** - **ALL CONDITIONS MUST VALIDATE***
163
+ 1. Only if the [Mutation Query Generation Workflow](#mutation-query-generation-workflow) step global status is `SUCCESS` and you have a generated query
164
+ 2. Only if the query to generate is a mutation query
165
+ 3. Only if non manual method was used during `LDS_Guide_GraphQL` rule execution to retrieve introspection data
166
+
167
+ **Workflow**
168
+ 1. **Report Step** - Explain that you are able to test the query using the same method used during introspection
169
+ 1. You **MUST** report the method you will use, based on the one you used during `LDS_Guide_GraphQL` rule execution
170
+ 2. **Interactive Step** - Ask the user whether they want you to test the query using the proposed method
171
+ 1. **WAIT** for the user's answer.
172
+ 3. **Input Arguments** - You **MUST** ask the user for the input arguments to use
173
+ 1. **WAIT** for the user's answer.
174
+ 4. **Test Query** - If the user are OK with you testing the query:
175
+ 1. Use the selected method to test the query
176
+ 2. **IMPORTANT** - If you use the Salesforce CLI `sf api request graphql` command, you will need to inject the variable values directly into the query, as this command doesn't accept variables as a parameter
177
+ 5. **Result Analysis** - Retrieve the `data` and `errors` attributes from the returned payload, and report the result of the test as one of the following options:
178
+ 1. `PARTIAL` if `data` is not an empty object, but `errors` is not an empty list - Explanation: some of the queried fields are not accessible on mutations
179
+ 2. `FAILED` if `data` is an empty object - Explanation: the query is not valid
180
+ 3. `SUCCESS` if `errors` is an empty list
181
+ 6. **Remediation Step** - If status is not `SUCCESS`, use the [`FAILED`](#failed-status-handling-workflow) or [`PARTIAL`](#partial-status-handling-workflow) status handling workflows
182
+
183
+ ### `FAILED` Status Handling Workflow
184
+
185
+ The query is invalid:
186
+ 1. **Error Analysis** - Parse and categorize the specific error messages
187
+ 2. **Root Cause Identification** - Use error message to identify the root cause:
188
+ - **Execution** - Error contains `invalid cross reference id` or `entity is deleted`
189
+ - **Syntax** - Error contains `invalid syntax`
190
+ - **Validation** - Error contains `validation error`
191
+ - **Type** - Error contains `VariableTypeMismatch` or `UnknownType`
192
+ - **Navigation** - Error contains `is not currently available in mutation results`
193
+ - **API Version** - Query deals with updates, you're testing with Connect API and error contains `Cannot invoke JsonElement.isJsonObject()`
194
+ 3. **Targeted Resolution** - Depending on the root cause categorization
195
+ - **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
196
+ - **Syntax** - Update the query using the error message information to fix the syntax errors
197
+ - **Validation** - This field's name is most probably invalid, ask user for clarification and **WAIT** for the user's answer
198
+ - **Type** - Use the error details and GraphQL schema to correct argument's type, and adjust variables accordingly
199
+ - **Navigation** - Use the [`PARTIAL` status handling workflow](#partial-status-handling-workflow) below
200
+ - **API Version** - `Record` selection is only available with API version 64 and higher, **report** the issue, and try again with API version 64
201
+ 4. **Test Again** - Resume the [query testing workflow](#generated-mutation-query-testing) with the updated query (increment and track attempt counter)
202
+ 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
203
+
204
+ ### `PARTIAL` Status Handling Workflow
205
+
206
+ The query can be improved:
207
+ 1. Report the fields mentioned in the `errors` list
208
+ 2. Explain that these fields can't be queried as part of a mutation query
209
+ 3. Explain that the query might be considered as failing, as it will report errors
210
+ 4. Offer to remove the offending fields
211
+ 5. **WAIT** for the user's answer
212
+ 6. If they are OK with removing the fields restart the [generation workflow](#mutation-query-generation-workflow) with the new field list
@@ -0,0 +1,185 @@
1
+ # GraphQL Read Query Generation
2
+
3
+ **Triggering conditions**
4
+ 1. Only if the `LDS_Guide_GraphQL` rule completed successfully
5
+ 2. Only if the query to generate is a read query
6
+
7
+ ## Your Role
8
+
9
+ You are a GraphQL expert and your role is to help generate Salesforce compatible GraphQL read queries once the exploration phase has completed.
10
+
11
+ You will leverage the context provided by the requesting user as well as the validation phase provided by the `LDS_Guide_GraphQL` rule.
12
+
13
+ If the `LDS_Guide_GraphQL` rule 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.
14
+
15
+ ## Read Query Generation Workflow
16
+
17
+ Strictly follow the rules below when generating the GraphQL read query:
18
+ 1. **No Proliferation** - Only generate for the explicitly requested fields, nothing else
19
+ 2. **Unique Query** - Leverage child relationships to query entities in one single query
20
+ 3. **Navigate Entities** - Always use `relationshipName` to access reference fields and child entities
21
+ 1. **Exception** - if the `relationshipName` field is null, you can't navigate the related entity, and will have to return the `Id` itself
22
+ 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)
23
+ 5. **Type Consistency** - Make sure variables used as query arguments and their related fields share the same GraphQL type
24
+ 6. **Type Enforcement** - Make sure to leverage field type information from introspection and GraphQL schema to generate field access
25
+ 7. **Semi and anti joins** - Use the semi-join or anti-join templates to filter an entity with conditions on child entities
26
+ 8. **Query Generation** - Use the [template](#read-query-template) to generate the query
27
+ 9. **Output Format** - Use the [standalone](#read-standalone-default-output-format---clean-code-only)
28
+ 10. **Test the Query** - Use the [Generated Read Query Testing](#generated-read-query-testing) workflow to test the generated query
29
+ 1. **Report First** - Always report first, using the proper output format, before testing
30
+
31
+ ## Read Query Template
32
+
33
+ ```graphql
34
+ query QueryName {
35
+ uiapi {
36
+ query {
37
+ EntityName(
38
+ # conditions here
39
+ ) {
40
+ edges {
41
+ node {
42
+ # Direct fields
43
+ FieldName { value }
44
+
45
+ # Non-polymorphic reference (single type)
46
+ RelationshipName {
47
+ Id
48
+ Name { value }
49
+ }
50
+
51
+ # Polymorphic reference (multiple types)
52
+ PolymorphicRelationshipName {
53
+ ...TypeAInfo
54
+ ...TypeBInfo
55
+ }
56
+
57
+ # Child relationship (subquery)
58
+ RelationshipName(
59
+ # conditions here
60
+ ) {
61
+ edges {
62
+ node {
63
+ # fields
64
+ }
65
+ }
66
+ }
67
+ }
68
+ }
69
+ }
70
+ }
71
+ }
72
+ }
73
+
74
+ fragment TypeAInfo on TypeA {
75
+ Id
76
+ SpecificFieldA { value }
77
+ }
78
+
79
+ fragment TypeBInfo on TypeB {
80
+ Id
81
+ SpecificFieldB { value }
82
+ }
83
+ ```
84
+
85
+ ## Semi-Join and Anti-Join Condition Template
86
+
87
+ Semi-joins (resp. anti-joins) condition leverage parent-child relationships and allow filtering the parent entity using a condition on child entities.
88
+ 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:
89
+ - The child entity camelcase name to apply the condition on, with a value expressing the condition
90
+ - The field name on the child entity containing the parent entity `Id`, which is the `fieldName` from the `childRelationships` information for the child entity
91
+ - If the only condition is related child entity existence, you can use an `Id: { ne: null }` condition
92
+
93
+ ### Semi-Join Example - ParentEntity with at least one Matching ChildEntity
94
+
95
+ ```graphql
96
+ query testSemiJoin {
97
+ uiapi {
98
+ query {
99
+ ParentEntity (
100
+ where: {
101
+ Id: {
102
+ inq: {
103
+ ChildEntity: {
104
+ # standard conditions here
105
+ Name: { like: "test%" }
106
+ Type: { eq: "some value" }
107
+ },
108
+ ApiName: "parentIdFieldInChild"
109
+ }
110
+ }
111
+ }
112
+ ) {
113
+ edges {
114
+ node {
115
+ Id
116
+ Name { value }
117
+ }
118
+ }
119
+ }
120
+ }
121
+ }
122
+ }
123
+ ```
124
+
125
+ ### Anti-Join Example - ParentEntity with no Matching ChildEntity
126
+
127
+ 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.
128
+
129
+ ## Read Standalone (Default) Output Format - CLEAN CODE ONLY
130
+
131
+ ```javascript
132
+ const QUERY_NAME = `
133
+ query GetData {
134
+ // query here
135
+ }
136
+ `;
137
+
138
+ const QUERY_VARIABLES = {
139
+ // variables here
140
+ };
141
+ ```
142
+
143
+ **❌ DO NOT INCLUDE:**
144
+ - Explanatory comments about the query
145
+ - Field descriptions
146
+ - Additional text about what the query does
147
+ - Workflow step descriptions
148
+
149
+ **✅ ONLY INCLUDE:**
150
+ - Raw query string
151
+ - Variables object
152
+ - Nothing else
153
+
154
+ ## Generated Read Query Testing
155
+
156
+ **Triggering conditions** - **ALL CONDITIONS MUST VALIDATE***
157
+ 1. Only if the [Read Query Generation Workflow](#read-query-generation-workflow) step global status is `SUCCESS` and you have a generated query
158
+ 2. Only if the query to generate is a read query
159
+ 3. Only if non manual method was used during `LDS_Guide_GraphQL` rule execution to retrieve introspection data
160
+
161
+ **Workflow**
162
+ 1. **Report Step** - Explain that you are able to test the query using the same method used during introspection
163
+ 1. You **MUST** report the method you will use, based on the one you used during `LDS_Guide_GraphQL` rule execution
164
+ 2. **Interactive Step** - Ask the user whether they want you to test the query using the proposed method
165
+ 1. **WAIT** for the user's answer.
166
+ 3. **Test Query** - If the user are OK with you testing the query:
167
+ 1. Use the selected method to test the query
168
+ 2. Report the result of the test as `SUCCESS` if the query executed without error, or `FAILED` if you got errors
169
+ 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`
170
+ 4. **Remediation Step** - If status is `FAILED`, use the [`FAILED` status handling workflows](#failed-status-handling-workflow)
171
+
172
+ ### `FAILED` Status Handling Workflow
173
+
174
+ The query is invalid:
175
+ 1. **Error Analysis** - Parse and categorize the specific error messages
176
+ 2. **Root Cause Identification** - Use error message to identify the root cause:
177
+ - **Syntax** - Error contains `invalid syntax`
178
+ - **Validation** - Error contains `validation error`
179
+ - **Type** - Error contains `VariableTypeMismatch` or `UnknownType`
180
+ 3. **Targeted Resolution** - Depending on the root cause categorization
181
+ - **Syntax** - Update the query using the error message information to fix the syntax errors
182
+ - **Validation** - This field's name is most probably invalid, ask user for clarification and **WAIT** for the user's answer
183
+ - **Type** - Use the error details and GraphQL schema to correct argument's type, and adjust variables accordingly
184
+ 4. **Test Again** - Resume the [query testing workflow](#generated-read-query-testing) with the updated query (increment and track attempt counter)
185
+ 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