@salesforce/templates 66.10.2 → 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",
|
|
@@ -45,7 +45,8 @@
|
|
|
45
45
|
"@graphql-eslint/eslint-plugin": "^4.1.0",
|
|
46
46
|
"@graphql-tools/utils": "^11.0.0",
|
|
47
47
|
"@playwright/test": "^1.49.0",
|
|
48
|
-
"@salesforce/
|
|
48
|
+
"@salesforce/graphiti": "^10.19.0",
|
|
49
|
+
"@salesforce/vite-plugin-ui-bundle": "^10.19.0",
|
|
49
50
|
"@testing-library/jest-dom": "^6.6.3",
|
|
50
51
|
"@testing-library/react": "^16.1.0",
|
|
51
52
|
"@testing-library/user-event": "^14.5.2",
|
package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/scripts/get-graphql-schema.mjs
CHANGED
|
@@ -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('; ');
|
|
@@ -773,6 +773,7 @@ function run(name, cmd, args, opts = {}) {
|
|
|
773
773
|
cwd,
|
|
774
774
|
stdio: 'inherit',
|
|
775
775
|
shell: true,
|
|
776
|
+
...(opts.env && { env: opts.env }),
|
|
776
777
|
...(opts.timeout && { timeout: opts.timeout }),
|
|
777
778
|
});
|
|
778
779
|
if (result.status !== 0 && !optional) {
|
|
@@ -1140,8 +1141,10 @@ async function main() {
|
|
|
1140
1141
|
|
|
1141
1142
|
if (!skipGraphql) {
|
|
1142
1143
|
run('UI Bundle npm install', 'npm', ['install'], { cwd: uiBundleDir });
|
|
1143
|
-
run('
|
|
1144
|
-
|
|
1144
|
+
run('GraphQL schema (introspect)', 'npm', ['run', 'graphql:schema'], {
|
|
1145
|
+
cwd: uiBundleDir,
|
|
1146
|
+
env: { ...process.env, SF_TARGET_ORG: targetOrg },
|
|
1147
|
+
});
|
|
1145
1148
|
run('GraphQL codegen', 'npm', ['run', 'graphql:codegen'], { cwd: uiBundleDir });
|
|
1146
1149
|
run('UI Bundle build (post-codegen)', 'npm', ['run', 'build'], { cwd: uiBundleDir });
|
|
1147
1150
|
} else if (!skipUIBundleBuild && skipDeploy) {
|