@salesforce/mcp-provider-lwc-experts 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/LICENSE.txt +21 -0
  2. package/README.md +82 -0
  3. package/agents/lds/resources/lwc/guides/reference/reference-create-list-info.md +53 -0
  4. package/agents/lds/resources/lwc/guides/reference/reference-create-record.md +52 -0
  5. package/agents/lds/resources/lwc/guides/reference/reference-delete-list-info.md +56 -0
  6. package/agents/lds/resources/lwc/guides/reference/reference-delete-record.md +78 -0
  7. package/agents/lds/resources/lwc/guides/reference/reference-get-list-info-by-name.md +60 -0
  8. package/agents/lds/resources/lwc/guides/reference/reference-get-list-infos-by-name.md +55 -0
  9. package/agents/lds/resources/lwc/guides/reference/reference-get-list-infos-by-object-name.md +64 -0
  10. package/agents/lds/resources/lwc/guides/reference/reference-get-list-object-info.md +55 -0
  11. package/agents/lds/resources/lwc/guides/reference/reference-get-list-preferences.md +60 -0
  12. package/agents/lds/resources/lwc/guides/reference/reference-get-list-records-by-name.md +84 -0
  13. package/agents/lds/resources/lwc/guides/reference/reference-update-list-info.md +64 -0
  14. package/agents/lds/resources/lwc/guides/reference/reference-update-list-preferences.md +68 -0
  15. package/agents/lds/resources/lwc/guides/reference/reference-update-record.md +75 -0
  16. package/agents/lds/resources/lwc/guides/reference/wire-adapters/lds-wire-adapter-types.json +1330 -0
  17. package/agents/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-get-related-list-count.md +58 -0
  18. package/agents/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-get-related-list-info-batch.md +29 -0
  19. package/agents/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-get-related-list-info.md +36 -0
  20. package/agents/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-get-related-list-records-batch.md +48 -0
  21. package/agents/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-get-related-list-records.md +34 -0
  22. package/agents/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-get-related-lists-info.md +28 -0
  23. package/agents/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-object-info.md +51 -0
  24. package/agents/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-object-infos.md +54 -0
  25. package/agents/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-picklist-values-record.md +29 -0
  26. package/agents/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-picklist-values.md +78 -0
  27. package/agents/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-record.md +114 -0
  28. package/agents/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-records.md +142 -0
  29. package/index.bundle.d.ts +10 -0
  30. package/index.bundle.js +375 -0
  31. package/package.json +49 -0
@@ -0,0 +1,84 @@
1
+ # `getListRecordsByName`
2
+
3
+ Use this wire adapter to get record data for a list view.
4
+
5
+ ## Syntax
6
+
7
+ ```js
8
+ import { LightningElement, wire } from 'lwc';
9
+ import { getListRecordsByName } from 'lightning/uiListsApi';
10
+ import ACCOUNT_OBJECT from '@salesforce/schema/Account';
11
+
12
+ export default class Example extends LightningElement {
13
+ @wire(getListRecordsByName, {
14
+ objectApiName: ACCOUNT_OBJECT,
15
+ listViewApiName: 'AllAccounts',
16
+ fields: ['Account.Name', 'Account.Id'],
17
+ sortBy: ['Account.Name'],
18
+ })
19
+ propertyOrFunction;
20
+ }
21
+ ```
22
+
23
+ ## Parameters
24
+
25
+ - **`objectApiName`** (String, Required) - The API name of a supported object.
26
+ - **`listViewApiName`** (String, Required) - The API name of a list view, such as `"AllAccounts"`.
27
+ - **`fields`** (String[]) - Additional fields queried for the records returned. These fields don’t create visible columns. If the field isn’t available to the user, an error occurs.
28
+ - **`optionalFields`** (String[]) - Additional fields queried for the records returned. These fields don’t create visible columns. If the field isn’t available to the user, no error occurs, and the field isn’t included in the records.
29
+ - **`pageSize`** (Integer) - The number of list records viewed at one time. The default value is `50`. Valid values are `1–2000`.
30
+ - **`searchTerm`** (String) - A search term to filter the results. Wildcards are supported.
31
+ - **`sortBy`** (String) - The API name of the field the list view is sorted by. Preceding with `-` sorts in descending order (e.g., `"-CreatedDate"`).
32
+ - **`where`** (String) - The filter applied to returned records using GraphQL syntax.
33
+ - **`pageToken`** (Integer) - A token that represents the page offset. Use with `pageSize` to control pagination.
34
+
35
+ ## Returns
36
+
37
+ - **`data`** – List Record Collection
38
+ - **`error`** – FetchResponse
39
+
40
+ ## Usage
41
+
42
+ This example fetches list view records by API name and iterates through the records. The `handleNextPage` click handler retrieves the next set of records.
43
+
44
+ ### **JavaScript**
45
+
46
+ ```js
47
+ import { LightningElement, wire } from 'lwc';
48
+ import { getListRecordsByName } from 'lightning/uiListsApi';
49
+ import ACCOUNT_OBJECT from '@salesforce/schema/Account';
50
+
51
+ export default class GetListRecords extends LightningElement {
52
+ error;
53
+ records;
54
+ pageToken;
55
+ nextPageToken;
56
+
57
+ @wire(getListRecordsByName, {
58
+ objectApiName: ACCOUNT_OBJECT.objectApiName,
59
+ listViewApiName: 'AllAccounts',
60
+ fields: ['Account.Id', 'Account.Name'],
61
+ sortBy: ['Account.Name'],
62
+ pageSize: 10,
63
+ pageToken: '$pageToken',
64
+ })
65
+ listRecords({ error, data }) {
66
+ if (data) {
67
+ this.records = data.records;
68
+ this.nextPageToken = data?.nextPageToken;
69
+ this.error = undefined;
70
+ } else if (error) {
71
+ this.error = error;
72
+ }
73
+ }
74
+
75
+ handleNextPage(event) {
76
+ event.stopPropagation();
77
+ if (this.nextPageToken) {
78
+ this.pageToken = this.nextPageToken;
79
+ }
80
+ }
81
+ }
82
+ ```
83
+
84
+ For backward pagination, use the `previousPageToken` property returned by `getListRecordsByName`.
@@ -0,0 +1,64 @@
1
+ # `updateListInfoByName`
2
+
3
+ Use this function to update a list view’s metadata.
4
+
5
+ ## Syntax
6
+
7
+ ```js
8
+ import { updateListInfoByName } from 'lightning/uiListsApi';
9
+ import ACCOUNT_OBJECT from '@salesforce/schema/Account';
10
+
11
+ updateListInfoByName({
12
+ objectApiName: ACCOUNT_OBJECT,
13
+ listViewApiName: 'MyAccountListView',
14
+ label: 'NewListViewLabel',
15
+ });
16
+ ```
17
+
18
+ ## Parameters
19
+
20
+ - **`objectApiName`** (String, Required) - The API name of a supported object.
21
+ - **`listViewApiName`** (String, Required) - The API name of a list view, such as `"AllAccounts"`.
22
+ - **`displayColumns`** (String[]) - The display columns (field API names) for the list.
23
+ - **`filterLogicString`** (String) - The filter logic string, such as `"(1 OR 2) and 3"`. Indexes start with 1.
24
+ - **`filteredByInfo`** (Object) - Filtering information for the list. See List Filter By Info Input.
25
+ - **`label`** (String) - The list’s display label. For example, `"All Accounts"`.
26
+ - **`listShares`** (String[]) - Objects the list is shared with, if `visibility` is set to `Shared`.
27
+ - **`scope`** (Object) - The scope information for the list. See List Scope Input.
28
+ - **`visibility`** (String) - The list’s visibility. Valid values are: `"Private"`, `"Public"`, `"Shared"`.
29
+
30
+ ## Returns
31
+
32
+ - **`data`** – List Info
33
+ - **`error`** – FetchResponse
34
+
35
+ ## Usage
36
+
37
+ This example updates the list view’s label when the button is clicked.
38
+
39
+ ### **JavaScript**
40
+
41
+ ```js
42
+ import { updateListInfoByName } from 'lightning/uiListsApi';
43
+ import { LightningElement, api } from 'lwc';
44
+ import ACCOUNT_OBJECT from '@salesforce/schema/Account';
45
+
46
+ export default class UpdateListInfo extends LightningElement {
47
+ error;
48
+ label;
49
+
50
+ @api async updateListView() {
51
+ updateListInfoByName({
52
+ objectApiName: ACCOUNT_OBJECT.objectApiName,
53
+ listViewApiName: 'AllAccounts',
54
+ label: 'New Label',
55
+ })
56
+ .then((result) => {
57
+ this.label = result.data.label;
58
+ })
59
+ .catch((error) => {
60
+ this.error = error;
61
+ });
62
+ }
63
+ }
64
+ ```
@@ -0,0 +1,68 @@
1
+ # `updateListPreferences`
2
+
3
+ Use this function to update the preferences for a list view.
4
+
5
+ ## Syntax
6
+
7
+ ```js
8
+ import { updateListPreferences } from "lightning/uiListsApi";
9
+ import ACCOUNT_OBJECT from "@salesforce/schema/Account";
10
+
11
+ export default class UpdateListPrefExample extends LightningElement {
12
+ updateListPreferences({
13
+ objectApiName: ACCOUNT_OBJECT,
14
+ listViewApiName: "AllAccounts",
15
+ });
16
+ }
17
+ ```
18
+
19
+ ## Parameters
20
+
21
+ - **`objectApiName`** (String, Required) - The API name of a supported object.
22
+ - **`listViewApiName`** (String, Required) - The API name of a list view, such as `"AllAccounts"`.
23
+ - **`columnWidths`** (Object) - The column-width preferences for the list. Pass in a key-value pair with the name of the column and an integer.
24
+ - **`columnWrap`** (Object) - The column-wrapping preferences for the list. Pass in a key-value pair with the name of the column and a boolean.
25
+ - **`listReference`** (Object) - The reference information for the list.
26
+ - **`orderedBy`** (String[]) - The ordering preference for the list. See List Order Input.
27
+
28
+ ## Returns
29
+
30
+ - **`data`** – List Info
31
+ - **`error`** – FetchResponse
32
+
33
+ ## Usage
34
+
35
+ This example updates a list view’s preferences and displays the updated values.
36
+
37
+ ### **JavaScript**
38
+
39
+ ```js
40
+ import { updateListPreferences } from 'lightning/uiListsApi';
41
+ import { LightningElement, api } from 'lwc';
42
+ import ACCOUNT_OBJECT from '@salesforce/schema/Account';
43
+
44
+ export default class UpdateListPrefs extends LightningElement {
45
+ error;
46
+ columnWidths;
47
+
48
+ @api async updateListViewPrefs() {
49
+ updateListPreferences({
50
+ objectApiName: ACCOUNT_OBJECT.objectApiName,
51
+ listViewApiName: 'AllAccounts',
52
+ columnWidths: {
53
+ Type: 200,
54
+ 'Owner.Alias': 200,
55
+ Phone: 200,
56
+ BillingState: 250,
57
+ Name: 250,
58
+ },
59
+ })
60
+ .then((result) => {
61
+ this.columnWidths = Object.entries(result.data.columnWidths);
62
+ })
63
+ .catch((error) => {
64
+ this.error = error;
65
+ });
66
+ }
67
+ }
68
+ ```
@@ -0,0 +1,75 @@
1
+ # `updateRecord(recordInput, clientOptions)`
2
+
3
+ Updates a record. Provide the record ID in `recordInput`.
4
+
5
+ ## Syntax
6
+
7
+ ```js
8
+ import { updateRecord } from 'lightning/uiRecordApi';
9
+ updateRecord(recordInput: Record, clientOptions?: Object): Promise<Record>;
10
+ ```
11
+
12
+ ## Parameters
13
+
14
+ - **`recordInput`** (Object, Required) – A RecordInput object used to update the record.
15
+ - **`clientOptions`** (Object, Optional) – To check for conflicts before updating, pass `{'ifUnmodifiedSince' : lastModifiedDate}` using the `LastModifiedDate` value.
16
+
17
+ ### `recordInput` Properties
18
+
19
+ - **`fields`** (Object, Required) – Map of field names to field values.
20
+ - **`apiName`** (String) – Use `null` or omit this property when updating a record.
21
+ - **`triggerOtherEmail`** (Boolean) – For cases, specifies whether to send email to external users. Default: `false`.
22
+ - **`triggerUserEmail`** (Boolean) – For cases or leads, specifies whether to send internal user email notifications. Default: `false`.
23
+ - **`useDefaultRule`** (Boolean) – For cases or leads, specifies whether to use default assignment rules. Default: `false`.
24
+ - **`allowSaveOnDuplicate`** (Boolean) – Specifies whether to save a duplicate record. Default: `false`.
25
+
26
+ ## Returns
27
+
28
+ A Promise that resolves with the updated record containing field data.
29
+
30
+ ## Usage
31
+
32
+ ```js
33
+ import { LightningElement, wire } from 'lwc';
34
+ import { ShowToastEvent } from 'lightning/platformShowToastEvent';
35
+ import { updateRecord } from 'lightning/uiRecordApi';
36
+ import { refreshApex } from '@salesforce/apex';
37
+ import getSingleContact from '@salesforce/apex/ContactController.getSingleContact';
38
+ import FIRSTNAME_FIELD from '@salesforce/schema/Contact.FirstName';
39
+ import LASTNAME_FIELD from '@salesforce/schema/Contact.LastName';
40
+ import ID_FIELD from '@salesforce/schema/Contact.Id';
41
+
42
+ export default class UpdateRecordExample extends LightningElement {
43
+ @wire(getSingleContact) contact;
44
+ contactId;
45
+
46
+ updateContact() {
47
+ const fields = {
48
+ [ID_FIELD.fieldApiName]: this.contactId,
49
+ [FIRSTNAME_FIELD.fieldApiName]: this.template.querySelector("[data-field='FirstName']").value,
50
+ [LASTNAME_FIELD.fieldApiName]: this.template.querySelector("[data-field='LastName']").value,
51
+ };
52
+
53
+ updateRecord({ fields })
54
+ .then(() => {
55
+ this.dispatchEvent(
56
+ new ShowToastEvent({
57
+ title: 'Success',
58
+ message: 'Contact updated',
59
+ variant: 'success',
60
+ }),
61
+ );
62
+ return refreshApex(this.contact);
63
+ })
64
+ .catch((error) => {
65
+ this.dispatchEvent(
66
+ new ShowToastEvent({
67
+ title: 'Error updating record',
68
+ message: error.body.message,
69
+ variant: 'error',
70
+ }),
71
+ );
72
+ });
73
+ }
74
+ }
75
+ ```