@salesforce/webapp-template-feature-graphql-experimental 1.58.1 → 1.58.2
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/README.md
CHANGED
|
@@ -74,7 +74,7 @@ cp rules/graphql-data-access-rule.md ~/.clinerules/
|
|
|
74
74
|
|
|
75
75
|
The base React app includes reference examples:
|
|
76
76
|
|
|
77
|
-
-
|
|
77
|
+
- `@salesforce/sdk-data` — Core `getDataSDK()`, `gql`, and `NodeOfConnection`
|
|
78
78
|
- `src/api/utils/accounts.ts` — Pattern 1 (external `.graphql` file + codegen types)
|
|
79
79
|
- `src/api/utils/user.ts` — Pattern 2 (inline `gql` tag)
|
|
80
80
|
- `src/components/AccountsTable.tsx` — Component using GraphQL to fetch and render Accounts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/webapp-template-feature-graphql-experimental",
|
|
3
|
-
"version": "1.58.
|
|
3
|
+
"version": "1.58.2",
|
|
4
4
|
"description": "GraphQL documentation, agent skills, and rules for Salesforce web applications",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"author": "",
|
|
@@ -16,5 +16,5 @@
|
|
|
16
16
|
"scripts": {
|
|
17
17
|
"clean": "echo 'No build artifacts to clean'"
|
|
18
18
|
},
|
|
19
|
-
"gitHead": "
|
|
19
|
+
"gitHead": "0dda7fdd05f5b8fd9870e57cc796663555166a90"
|
|
20
20
|
}
|
|
@@ -36,10 +36,10 @@ For a GraphQL operation named `GetHighRevenueAccounts`:
|
|
|
36
36
|
|
|
37
37
|
### getDataSDK Function
|
|
38
38
|
|
|
39
|
-
Available from `@salesforce/
|
|
39
|
+
Available from `@salesforce/sdk-data`:
|
|
40
40
|
|
|
41
41
|
```typescript
|
|
42
|
-
import { getDataSDK } from "@salesforce/
|
|
42
|
+
import { getDataSDK } from "@salesforce/sdk-data";
|
|
43
43
|
|
|
44
44
|
const data = await getDataSDK();
|
|
45
45
|
const response = await data.graphql?.<ResponseType, VariablesType>(query, variables);
|
|
@@ -49,10 +49,10 @@ const response = await data.graphql?.<ResponseType, VariablesType>(query, variab
|
|
|
49
49
|
|
|
50
50
|
### gql Template Tag
|
|
51
51
|
|
|
52
|
-
Also available from `@salesforce/
|
|
52
|
+
Also available from `@salesforce/sdk-data` for inline query definitions:
|
|
53
53
|
|
|
54
54
|
```typescript
|
|
55
|
-
import { gql } from "@salesforce/
|
|
55
|
+
import { gql } from "@salesforce/sdk-data";
|
|
56
56
|
|
|
57
57
|
const MY_QUERY = gql`
|
|
58
58
|
query MyQuery {
|
|
@@ -120,7 +120,7 @@ For mutation-specific partial responses, see `docs/generate-mutation-query.md` w
|
|
|
120
120
|
Extract the node type from a connection (edges/node pattern):
|
|
121
121
|
|
|
122
122
|
```typescript
|
|
123
|
-
import { type NodeOfConnection } from "@salesforce/
|
|
123
|
+
import { type NodeOfConnection } from "@salesforce/sdk-data";
|
|
124
124
|
|
|
125
125
|
// Extract Account node type from the query response
|
|
126
126
|
type AccountNode = NodeOfConnection<GetHighRevenueAccountsQuery["uiapi"]["query"]["Account"]>;
|
|
@@ -196,7 +196,7 @@ This generates types in `graphql-operations-types.ts`:
|
|
|
196
196
|
#### Step 3: Import and Use
|
|
197
197
|
|
|
198
198
|
```typescript
|
|
199
|
-
import { getDataSDK, type NodeOfConnection } from "@salesforce/
|
|
199
|
+
import { getDataSDK, type NodeOfConnection } from "@salesforce/sdk-data";
|
|
200
200
|
import MY_QUERY from "./query/myQuery.graphql?raw";
|
|
201
201
|
import type { GetMyDataQuery, GetMyDataQueryVariables } from "../graphql-operations-types";
|
|
202
202
|
|
|
@@ -249,7 +249,7 @@ export async function getMyData(variables: GetMyDataQueryVariables): Promise<MyN
|
|
|
249
249
|
For simpler queries without variables or when colocation is preferred:
|
|
250
250
|
|
|
251
251
|
```typescript
|
|
252
|
-
import { getDataSDK, gql } from "@salesforce/
|
|
252
|
+
import { getDataSDK, gql } from "@salesforce/sdk-data";
|
|
253
253
|
import { type CurrentUserQuery } from "../graphql-operations-types";
|
|
254
254
|
|
|
255
255
|
const CURRENT_USER_QUERY = gql`
|
|
@@ -369,7 +369,7 @@ fragment ContactFields on Account {
|
|
|
369
369
|
### Usage
|
|
370
370
|
|
|
371
371
|
```typescript
|
|
372
|
-
import { getDataSDK } from "@salesforce/
|
|
372
|
+
import { getDataSDK } from "@salesforce/sdk-data";
|
|
373
373
|
import QUERY from "./query/getAccountDetails.graphql?raw";
|
|
374
374
|
import type {
|
|
375
375
|
GetAccountDetailsQuery,
|
|
@@ -25,7 +25,7 @@ The base React app (`base-react-app`) ships with all GraphQL dependencies and to
|
|
|
25
25
|
|
|
26
26
|
Before using this skill, ensure:
|
|
27
27
|
|
|
28
|
-
1. The `@salesforce/
|
|
28
|
+
1. The `@salesforce/sdk-data` package is available (provides `getDataSDK`, `gql`, `NodeOfConnection`)
|
|
29
29
|
2. A `schema.graphql` file exists at the project root. If missing, generate it:
|
|
30
30
|
```bash
|
|
31
31
|
npm run graphql:schema
|
|
@@ -96,7 +96,7 @@ This updates `src/api/graphql-operations-types.ts` with:
|
|
|
96
96
|
|
|
97
97
|
```typescript
|
|
98
98
|
// Pattern 1
|
|
99
|
-
import { getDataSDK, type NodeOfConnection } from "@salesforce/
|
|
99
|
+
import { getDataSDK, type NodeOfConnection } from "@salesforce/sdk-data";
|
|
100
100
|
import MY_QUERY from "./query/myQuery.graphql?raw";
|
|
101
101
|
import type { GetMyDataQuery, GetMyDataQueryVariables } from "../graphql-operations-types";
|
|
102
102
|
|
|
@@ -120,7 +120,7 @@ export async function getMyData(variables: GetMyDataQueryVariables): Promise<MyN
|
|
|
120
120
|
|
|
121
121
|
```typescript
|
|
122
122
|
// Pattern 2
|
|
123
|
-
import { getDataSDK, gql } from "@salesforce/
|
|
123
|
+
import { getDataSDK, gql } from "@salesforce/sdk-data";
|
|
124
124
|
import type { MySimpleQuery } from "../graphql-operations-types";
|
|
125
125
|
|
|
126
126
|
const MY_QUERY = gql`
|