@salesforce/templates 66.10.1 → 66.10.3
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/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/package-lock.json +472 -638
- package/lib/templates/project/reactinternalapp/CHANGELOG.md +121 -0
- package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/package-lock.json +610 -822
- package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/package.json +4 -3
- package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/scripts/get-graphql-schema.mjs +8 -5
- package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/api/graphqlClient.ts +24 -8
- package/lib/templates/project/reactinternalapp/_p_/_m_/permissionsets/reactinternalapp_Access.permissionset-meta.xml +4 -0
- package/lib/templates/project/reactinternalapp/package.json +1 -1
- package/lib/templates/project/reactinternalapp/scripts/org-setup.mjs +5 -2
- package/lib/templates/uiBundles/reactbasic/package-lock.json +610 -822
- package/lib/templates/uiBundles/reactbasic/package.json +4 -3
- package/lib/templates/uiBundles/reactbasic/scripts/get-graphql-schema.mjs +8 -5
- package/lib/templates/uiBundles/reactbasic/src/api/graphqlClient.ts +24 -8
- package/package.json +5 -5
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"graphql:schema": "node scripts/get-graphql-schema.mjs"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@salesforce/platform-sdk": "^10.
|
|
22
|
-
"@salesforce/ui-bundle": "^10.
|
|
21
|
+
"@salesforce/platform-sdk": "^10.19.0",
|
|
22
|
+
"@salesforce/ui-bundle": "^10.19.0",
|
|
23
23
|
"@tailwindcss/vite": "^4.1.17",
|
|
24
24
|
"class-variance-authority": "^0.7.1",
|
|
25
25
|
"clsx": "^2.1.1",
|
|
@@ -44,7 +44,8 @@
|
|
|
44
44
|
"@graphql-eslint/eslint-plugin": "^4.1.0",
|
|
45
45
|
"@graphql-tools/utils": "^11.0.0",
|
|
46
46
|
"@playwright/test": "^1.49.0",
|
|
47
|
-
"@salesforce/
|
|
47
|
+
"@salesforce/graphiti": "^10.19.0",
|
|
48
|
+
"@salesforce/vite-plugin-ui-bundle": "^10.19.0",
|
|
48
49
|
"@testing-library/jest-dom": "^6.6.3",
|
|
49
50
|
"@testing-library/react": "^16.1.0",
|
|
50
51
|
"@testing-library/user-event": "^14.5.2",
|
|
@@ -15,13 +15,16 @@ import { buildClientSchema, getIntrospectionQuery, printSchema } from 'graphql';
|
|
|
15
15
|
import { pruneSchema } from '@graphql-tools/utils';
|
|
16
16
|
|
|
17
17
|
const DEFAULT_SCHEMA_PATH = '../../../../../schema.graphql';
|
|
18
|
+
const TARGET_ORG = process.env.SF_TARGET_ORG || undefined;
|
|
18
19
|
|
|
19
20
|
async function executeSalesforceGraphQLQuery(query, variables, operationName) {
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
const orgInfo = await getOrgInfo(TARGET_ORG);
|
|
22
|
+
if (!orgInfo) {
|
|
23
|
+
throw new Error(
|
|
24
|
+
'Could not resolve a Salesforce org. Set SF_TARGET_ORG or a default org.'
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
const { rawInstanceUrl: instanceUrl, apiVersion, accessToken } = orgInfo;
|
|
25
28
|
|
|
26
29
|
const targetUrl = `${instanceUrl}/services/data/v${apiVersion}/graphql`;
|
|
27
30
|
|
|
@@ -1,19 +1,35 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Thin GraphQL client: createDataSDK + sdk.graphql
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Thin GraphQL client: createDataSDK + sdk.graphql with centralized error
|
|
3
|
+
* handling. Mutations are routed to sdk.graphql.mutate and everything else to
|
|
4
|
+
* sdk.graphql.query (the SDK rejects an operation sent to the wrong method).
|
|
5
|
+
* Use with gql-tagged queries and generated operation types for type-safe calls.
|
|
5
6
|
*/
|
|
6
7
|
import { createDataSDK } from '@salesforce/platform-sdk';
|
|
7
8
|
|
|
9
|
+
/**
|
|
10
|
+
* True when the operation's first definition is a `mutation`. Strips GraphQL
|
|
11
|
+
* comments first so a leading `# ...` line can't mask the keyword. Queries
|
|
12
|
+
* (named or anonymous `{ ... }` shorthand) and subscriptions fall through to
|
|
13
|
+
* query().
|
|
14
|
+
*/
|
|
15
|
+
function isMutation(operation: string): boolean {
|
|
16
|
+
return /^\s*mutation\b/.test(operation.replace(/#[^\n\r]*/g, ''));
|
|
17
|
+
}
|
|
18
|
+
|
|
8
19
|
export async function executeGraphQL<TData, TVariables>(
|
|
9
|
-
|
|
20
|
+
operation: string,
|
|
10
21
|
variables?: TVariables
|
|
11
22
|
): Promise<TData> {
|
|
12
23
|
const data = await createDataSDK();
|
|
13
|
-
const result =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
24
|
+
const result = isMutation(operation)
|
|
25
|
+
? await data.graphql!.mutate<TData, TVariables>({
|
|
26
|
+
mutation: operation,
|
|
27
|
+
variables: variables,
|
|
28
|
+
})
|
|
29
|
+
: await data.graphql!.query<TData, TVariables>({
|
|
30
|
+
query: operation,
|
|
31
|
+
variables: variables,
|
|
32
|
+
});
|
|
17
33
|
|
|
18
34
|
if (result.errors?.length) {
|
|
19
35
|
const msg = result.errors.map(e => e.message).join('; ');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/templates",
|
|
3
|
-
"version": "66.10.
|
|
3
|
+
"version": "66.10.3",
|
|
4
4
|
"description": "Salesforce JS library for templates",
|
|
5
5
|
"bugs": "https://github.com/forcedotcom/salesforcedx-templates/issues",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -18,17 +18,17 @@
|
|
|
18
18
|
"hpagent": "^1.2.0",
|
|
19
19
|
"mime-types": "^3.0.2",
|
|
20
20
|
"proxy-from-env": "^1.1.0",
|
|
21
|
-
"tar": "^7.5.
|
|
21
|
+
"tar": "^7.5.19",
|
|
22
22
|
"tslib": "^2.8.1"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@salesforce/dev-config": "^4.3.3",
|
|
26
26
|
"@salesforce/dev-scripts": "^11.0.2",
|
|
27
27
|
"@salesforce/prettier-config": "^0.0.4",
|
|
28
|
-
"@salesforce/ui-bundle-template-app-react-template-b2e": "^10.
|
|
28
|
+
"@salesforce/ui-bundle-template-app-react-template-b2e": "^10.19.0",
|
|
29
29
|
"@salesforce/ui-bundle-template-app-react-template-b2x": "^10.12.2",
|
|
30
|
-
"@salesforce/ui-bundle-template-base-react-app": "^10.
|
|
31
|
-
"@salesforce/ui-bundle-template-base-web-app": "^10.
|
|
30
|
+
"@salesforce/ui-bundle-template-base-react-app": "^10.19.0",
|
|
31
|
+
"@salesforce/ui-bundle-template-base-web-app": "^10.19.0",
|
|
32
32
|
"@types/chai-as-promised": "^7.1.8",
|
|
33
33
|
"@types/ejs": "^3.1.5",
|
|
34
34
|
"@types/mime-types": "^3.0.1",
|