@salesforce/webapp-template-feature-react-chart-experimental 1.35.2 → 1.36.1

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.
@@ -9,12 +9,15 @@
9
9
  "build:e2e": "npm run build && node scripts/rewrite-e2e-assets.mjs",
10
10
  "lint": "eslint .",
11
11
  "preview": "vite preview",
12
- "test": "vitest"
12
+ "test": "vitest",
13
+ "graphql:codegen": "graphql-codegen",
14
+ "graphql:schema": "node scripts/get-graphql-schema.mjs"
13
15
  },
14
16
  "dependencies": {
15
17
  "@radix-ui/react-label": "^2.1.8",
16
18
  "@radix-ui/react-select": "^2.2.6",
17
19
  "@radix-ui/react-slot": "^1.2.4",
20
+ "@salesforce/sdk-data": "^1.11.2",
18
21
  "@salesforce/webapp-experimental": "*",
19
22
  "@tailwindcss/vite": "^4.1.17",
20
23
  "class-variance-authority": "^0.7.1",
@@ -29,6 +32,11 @@
29
32
  },
30
33
  "devDependencies": {
31
34
  "@eslint/js": "^9.39.1",
35
+ "@graphql-codegen/cli": "^6.1.0",
36
+ "@graphql-codegen/typescript": "^5.0.6",
37
+ "@graphql-codegen/typescript-operations": "^5.0.6",
38
+ "@graphql-eslint/eslint-plugin": "^4.1.0",
39
+ "@graphql-tools/utils": "^11.0.0",
32
40
  "@playwright/test": "^1.49.0",
33
41
  "@salesforce/vite-plugin-webapp-experimental": "*",
34
42
  "@testing-library/jest-dom": "^6.6.3",
@@ -40,14 +48,18 @@
40
48
  "@vitejs/plugin-react": "^5.1.1",
41
49
  "@vitest/ui": "^4.0.17",
42
50
  "eslint": "^9.39.1",
51
+ "eslint-plugin-react": "^7.37.2",
43
52
  "eslint-plugin-react-hooks": "^7.0.1",
44
53
  "eslint-plugin-react-refresh": "^0.4.24",
45
54
  "globals": "^16.5.0",
55
+ "graphql": "^16.11.0",
56
+ "graphql-codegen-typescript-operation-types": "^2.0.2",
46
57
  "jsdom": "^25.0.1",
47
58
  "serve": "^14.2.5",
48
59
  "typescript": "~5.9.3",
49
60
  "typescript-eslint": "^8.46.4",
50
61
  "vite": "^7.2.4",
62
+ "vite-plugin-graphql-codegen": "^3.6.3",
51
63
  "vitest": "^4.0.17"
52
64
  }
53
65
  }
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Downloads the full GraphQL schema from a connected Salesforce org via introspection.
3
+ *
4
+ * Usage:
5
+ * npm run graphql:schema
6
+ * node scripts/get-graphql-schema.mjs [output-path]
7
+ *
8
+ * The default output path matches the schema location expected by codegen.yml
9
+ * and .graphqlrc.yml so that codegen and IDE tooling resolve it automatically.
10
+ */
11
+ import { writeFileSync } from 'node:fs';
12
+ import { resolve } from 'node:path';
13
+ import { getOrgInfo } from '@salesforce/webapp-experimental/app';
14
+ import { buildClientSchema, getIntrospectionQuery, printSchema } from 'graphql';
15
+ import { pruneSchema } from '@graphql-tools/utils';
16
+
17
+ const DEFAULT_SCHEMA_PATH = '../../../../../schema.graphql';
18
+
19
+ async function executeSalesforceGraphQLQuery(query, variables, operationName) {
20
+ const {
21
+ rawInstanceUrl: instanceUrl,
22
+ apiVersion,
23
+ accessToken,
24
+ } = await getOrgInfo();
25
+
26
+ const targetUrl = `${instanceUrl}/services/data/v${apiVersion}/graphql`;
27
+
28
+ console.log(`Executing introspection query against ${targetUrl}`);
29
+ const response = await fetch(targetUrl, {
30
+ method: 'POST',
31
+ headers: {
32
+ Authorization: `Bearer ${accessToken}`,
33
+ 'Content-Type': 'application/json',
34
+ 'X-Chatter-Entity-Encoding': 'false',
35
+ },
36
+ body: JSON.stringify({ query, variables, operationName }),
37
+ });
38
+
39
+ if (!response.ok) {
40
+ const errorText = await response.text();
41
+ throw new Error(
42
+ `Salesforce GraphQL request failed: ${response.status} ${response.statusText} - ${errorText}`
43
+ );
44
+ }
45
+
46
+ return response.json();
47
+ }
48
+
49
+ try {
50
+ const outputPath = resolve(process.argv[2] || DEFAULT_SCHEMA_PATH);
51
+
52
+ const introspectionResult = await executeSalesforceGraphQLQuery(
53
+ getIntrospectionQuery(),
54
+ {},
55
+ 'IntrospectionQuery'
56
+ );
57
+
58
+ const schema = buildClientSchema(introspectionResult.data);
59
+ const prunedSchema = pruneSchema(schema);
60
+ const sdl = printSchema(prunedSchema);
61
+
62
+ writeFileSync(outputPath, sdl);
63
+
64
+ console.log(`Schema saved to ${outputPath}`);
65
+ } catch (error) {
66
+ console.error('Error:', error.message);
67
+ process.exit(1);
68
+ }
@@ -12,7 +12,9 @@ export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & {
12
12
  export type MakeEmpty<
13
13
  T extends { [key: string]: unknown },
14
14
  K extends keyof T,
15
- > = { [_ in K]?: never };
15
+ > = {
16
+ [_ in K]?: never;
17
+ };
16
18
  export type Incremental<T> =
17
19
  | T
18
20
  | {
@@ -0,0 +1,33 @@
1
+ import { executeGraphQL } from '@salesforce/webapp-experimental/api';
2
+ import HIGH_REVENUE_ACCOUNTS_QUERY from './query/highRevenueAccountsQuery.graphql?raw';
3
+ import type {
4
+ GetHighRevenueAccountsQuery,
5
+ GetHighRevenueAccountsQueryVariables,
6
+ } from '../graphql-operations-types';
7
+
8
+ type AccountNode = NonNullable<
9
+ NonNullable<
10
+ NonNullable<
11
+ NonNullable<
12
+ GetHighRevenueAccountsQuery['uiapi']['query']['Account']
13
+ >['edges']
14
+ >[number]
15
+ >['node']
16
+ >;
17
+
18
+ /**
19
+ * Fetch accounts with annual revenue greater than the specified amount
20
+ *
21
+ * @param minRevenue - Minimum annual revenue threshold (default: 100000)
22
+ * @returns Array of accounts matching the criteria
23
+ */
24
+ export async function getHighRevenueAccounts(
25
+ variables: GetHighRevenueAccountsQueryVariables
26
+ ): Promise<(AccountNode | null | undefined)[]> {
27
+ const response = await executeGraphQL<GetHighRevenueAccountsQuery>(
28
+ HIGH_REVENUE_ACCOUNTS_QUERY,
29
+ variables
30
+ );
31
+
32
+ return response.uiapi?.query?.Account?.edges?.map(edge => edge?.node) || [];
33
+ }
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/webapp-template-base-sfdx-project-experimental",
3
- "version": "1.35.2",
3
+ "version": "1.36.1",
4
4
  "description": "Base SFDX project template",
5
5
  "private": true,
6
6
  "files": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/webapp-template-feature-react-chart-experimental",
3
- "version": "1.35.2",
3
+ "version": "1.36.1",
4
4
  "description": "Chart feature with analytics chart components, agent skills, and rules (Recharts)",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "author": "",
@@ -32,7 +32,7 @@
32
32
  "watch": "npx tsx ../../cli/src/index.ts watch-patches packages/template/feature/feature-react-chart packages/template/base-app/base-react-app packages/template/feature/feature-react-chart/dist"
33
33
  },
34
34
  "devDependencies": {
35
- "@salesforce/webapp-experimental": "^1.35.2",
35
+ "@salesforce/webapp-experimental": "^1.36.1",
36
36
  "@types/react": "^19.2.7",
37
37
  "@types/react-dom": "^19.2.3",
38
38
  "react-dom": "^19.2.1",
@@ -50,5 +50,5 @@
50
50
  }
51
51
  }
52
52
  },
53
- "gitHead": "b76cec0816888528ccb040ecb91964fe45b9e843"
53
+ "gitHead": "ccecb5e9c4f0ae3823d3cc7e05386d19bb3abf4f"
54
54
  }