@salesforce/ui-bundle-template-base-angular-app 11.35.5 → 11.36.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.
- package/CHANGELOG.md +10 -0
- package/package.json +1 -1
- package/src/force-app/main/default/uiBundles/base-angular-app/.graphqlrc.yml +2 -0
- package/src/force-app/main/default/uiBundles/base-angular-app/angular.json +3 -1
- package/src/force-app/main/default/uiBundles/base-angular-app/codegen.yml +95 -0
- package/src/force-app/main/default/uiBundles/base-angular-app/esbuild/graphql-codegen.mjs +13 -0
- package/src/force-app/main/default/uiBundles/base-angular-app/package.json +9 -2
- package/src/force-app/main/default/uiBundles/base-angular-app/scripts/get-graphql-schema.mjs +69 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [11.36.0](https://github.com/salesforce-experience-platform-emu/webapps/compare/v11.35.6...v11.36.0) (2026-07-24)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- @W-23438702: Implementing codegen for typescript safety ([#767](https://github.com/salesforce-experience-platform-emu/webapps/issues/767)) ([99f116c](https://github.com/salesforce-experience-platform-emu/webapps/commit/99f116c2c15904c0511a4d1b105d954be2e378b1))
|
|
11
|
+
|
|
12
|
+
## [11.35.6](https://github.com/salesforce-experience-platform-emu/webapps/compare/v11.35.5...v11.35.6) (2026-07-23)
|
|
13
|
+
|
|
14
|
+
**Note:** Version bump only for package @salesforce/ui-bundle-template-base-angular-app
|
|
15
|
+
|
|
6
16
|
## [11.35.5](https://github.com/salesforce-experience-platform-emu/webapps/compare/v11.35.4...v11.35.5) (2026-07-23)
|
|
7
17
|
|
|
8
18
|
**Note:** Version bump only for package @salesforce/ui-bundle-template-base-angular-app
|
package/package.json
CHANGED
|
@@ -43,10 +43,11 @@
|
|
|
43
43
|
"silenceDeprecations": ["import"]
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
|
-
"plugins": [
|
|
46
|
+
"plugins": []
|
|
47
47
|
},
|
|
48
48
|
"configurations": {
|
|
49
49
|
"production": {
|
|
50
|
+
"plugins": ["./esbuild/api-version.mjs"],
|
|
50
51
|
"budgets": [
|
|
51
52
|
{
|
|
52
53
|
"type": "anyComponentStyle",
|
|
@@ -64,6 +65,7 @@
|
|
|
64
65
|
}
|
|
65
66
|
},
|
|
66
67
|
"development": {
|
|
68
|
+
"plugins": ["./esbuild/graphql-codegen.mjs"],
|
|
67
69
|
"optimization": false,
|
|
68
70
|
"extractLicenses": false,
|
|
69
71
|
"sourceMap": true
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
schema: '../../../../../schema.graphql'
|
|
2
|
+
documents: 'src/**/*.{graphql,ts}'
|
|
3
|
+
generates:
|
|
4
|
+
src/app/api/graphql-operations-types.ts:
|
|
5
|
+
plugins:
|
|
6
|
+
- 'graphql-codegen-typescript-operation-types'
|
|
7
|
+
- 'typescript-operations'
|
|
8
|
+
config:
|
|
9
|
+
onlyOperationTypes: true
|
|
10
|
+
skipTypename: true
|
|
11
|
+
preResolveTypes: true
|
|
12
|
+
scalars:
|
|
13
|
+
# String-serialized scalars
|
|
14
|
+
JSON:
|
|
15
|
+
input: 'string'
|
|
16
|
+
output: 'string'
|
|
17
|
+
Date:
|
|
18
|
+
input: 'string'
|
|
19
|
+
output: 'string'
|
|
20
|
+
DateTime:
|
|
21
|
+
input: 'string'
|
|
22
|
+
output: 'string'
|
|
23
|
+
Time:
|
|
24
|
+
input: 'string'
|
|
25
|
+
output: 'string'
|
|
26
|
+
Email:
|
|
27
|
+
input: 'string'
|
|
28
|
+
output: 'string'
|
|
29
|
+
Url:
|
|
30
|
+
input: 'string'
|
|
31
|
+
output: 'string'
|
|
32
|
+
PhoneNumber:
|
|
33
|
+
input: 'string'
|
|
34
|
+
output: 'string'
|
|
35
|
+
Picklist:
|
|
36
|
+
input: 'string'
|
|
37
|
+
output: 'string'
|
|
38
|
+
MultiPicklist:
|
|
39
|
+
input: 'string'
|
|
40
|
+
output: 'string'
|
|
41
|
+
TextArea:
|
|
42
|
+
input: 'string'
|
|
43
|
+
output: 'string'
|
|
44
|
+
LongTextArea:
|
|
45
|
+
input: 'string'
|
|
46
|
+
output: 'string'
|
|
47
|
+
RichTextArea:
|
|
48
|
+
input: 'string'
|
|
49
|
+
output: 'string'
|
|
50
|
+
EncryptedString:
|
|
51
|
+
input: 'string'
|
|
52
|
+
output: 'string'
|
|
53
|
+
Base64:
|
|
54
|
+
input: 'string'
|
|
55
|
+
output: 'string'
|
|
56
|
+
IdOrRef:
|
|
57
|
+
input: 'string'
|
|
58
|
+
output: 'string'
|
|
59
|
+
# BigDecimal-serialized scalars (accepts number or string, returns number)
|
|
60
|
+
Currency:
|
|
61
|
+
input: 'number | string'
|
|
62
|
+
output: 'number'
|
|
63
|
+
BigDecimal:
|
|
64
|
+
input: 'number | string'
|
|
65
|
+
output: 'number'
|
|
66
|
+
Double:
|
|
67
|
+
input: 'number | string'
|
|
68
|
+
output: 'number'
|
|
69
|
+
Percent:
|
|
70
|
+
input: 'number | string'
|
|
71
|
+
output: 'number'
|
|
72
|
+
Longitude:
|
|
73
|
+
input: 'number | string'
|
|
74
|
+
output: 'number'
|
|
75
|
+
Latitude:
|
|
76
|
+
input: 'number | string'
|
|
77
|
+
output: 'number'
|
|
78
|
+
# Integer-like scalars
|
|
79
|
+
Long:
|
|
80
|
+
input: 'number'
|
|
81
|
+
output: 'number'
|
|
82
|
+
BigInteger:
|
|
83
|
+
input: 'number'
|
|
84
|
+
output: 'number'
|
|
85
|
+
Short:
|
|
86
|
+
input: 'number'
|
|
87
|
+
output: 'number'
|
|
88
|
+
Byte:
|
|
89
|
+
input: 'number'
|
|
90
|
+
output: 'number'
|
|
91
|
+
Char:
|
|
92
|
+
input: 'number'
|
|
93
|
+
output: 'number'
|
|
94
|
+
overwrite: true
|
|
95
|
+
ignoreNoDocuments: true
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GraphQL Codegen esbuild plugin — runs codegen on build start.
|
|
3
|
+
*
|
|
4
|
+
* Resolves GraphQL operations into typed TypeScript at build time using the
|
|
5
|
+
* project's `codegen.yml` configuration. Re-runs on every rebuild during
|
|
6
|
+
* `ng serve` so generated types stay in sync with schema/document changes.
|
|
7
|
+
*
|
|
8
|
+
* Referenced from angular.json: architect.build.options.plugins[].
|
|
9
|
+
*/
|
|
10
|
+
import { createGraphQLCodegenPlugin } from '@salesforce/angular-plugin-ui-bundle';
|
|
11
|
+
|
|
12
|
+
const plugin = createGraphQLCodegenPlugin();
|
|
13
|
+
export default plugin;
|
|
@@ -14,7 +14,9 @@
|
|
|
14
14
|
"test": "ng test",
|
|
15
15
|
"lint": "ng lint",
|
|
16
16
|
"build:e2e": "ng build && node scripts/rewrite-e2e-assets.mjs",
|
|
17
|
-
"e2e": "playwright test"
|
|
17
|
+
"e2e": "playwright test",
|
|
18
|
+
"graphql:schema": "node scripts/get-graphql-schema.mjs",
|
|
19
|
+
"graphql:codegen": "graphql-codegen"
|
|
18
20
|
},
|
|
19
21
|
"dependencies": {
|
|
20
22
|
"@angular/animations": "^21.2.0",
|
|
@@ -48,7 +50,12 @@
|
|
|
48
50
|
"tailwindcss": "^4.0.0",
|
|
49
51
|
"typescript": "~5.9.2",
|
|
50
52
|
"typescript-eslint": "^8.0.0",
|
|
51
|
-
"vitest": "^4.1.0"
|
|
53
|
+
"vitest": "^4.1.0",
|
|
54
|
+
"@graphql-codegen/cli": "^6.1.0",
|
|
55
|
+
"@graphql-codegen/typescript-operations": "^5.0.6",
|
|
56
|
+
"graphql": "^16.11.0",
|
|
57
|
+
"graphql-codegen-typescript-operation-types": "^2.0.2",
|
|
58
|
+
"@graphql-eslint/eslint-plugin": "^4.1.0"
|
|
52
59
|
},
|
|
53
60
|
"overrides": {
|
|
54
61
|
"undici": "^7.28.0"
|
|
@@ -0,0 +1,69 @@
|
|
|
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/ui-bundle/app';
|
|
14
|
+
import { buildClientSchema, getIntrospectionQuery, printSchema } from 'graphql';
|
|
15
|
+
import { pruneSchema } from '@graphql-tools/utils';
|
|
16
|
+
|
|
17
|
+
const DEFAULT_SCHEMA_PATH = '../../../../../schema.graphql';
|
|
18
|
+
const TARGET_ORG = process.env.SF_TARGET_ORG || undefined;
|
|
19
|
+
|
|
20
|
+
async function executeSalesforceGraphQLQuery(query, variables, operationName) {
|
|
21
|
+
const orgInfo = await getOrgInfo(TARGET_ORG);
|
|
22
|
+
if (!orgInfo) {
|
|
23
|
+
throw new Error('Could not resolve a Salesforce org. Set SF_TARGET_ORG or a default org.');
|
|
24
|
+
}
|
|
25
|
+
const { rawInstanceUrl: instanceUrl, apiVersion, accessToken } = orgInfo;
|
|
26
|
+
|
|
27
|
+
const targetUrl = `${instanceUrl}/services/data/v${apiVersion}/graphql`;
|
|
28
|
+
|
|
29
|
+
console.log(`Executing introspection query against ${targetUrl}`);
|
|
30
|
+
const response = await fetch(targetUrl, {
|
|
31
|
+
method: 'POST',
|
|
32
|
+
headers: {
|
|
33
|
+
Authorization: `Bearer ${accessToken}`,
|
|
34
|
+
'Content-Type': 'application/json',
|
|
35
|
+
'X-Chatter-Entity-Encoding': 'false',
|
|
36
|
+
},
|
|
37
|
+
body: JSON.stringify({ query, variables, operationName }),
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
if (!response.ok) {
|
|
41
|
+
const errorText = await response.text();
|
|
42
|
+
throw new Error(
|
|
43
|
+
`Salesforce GraphQL request failed: ${response.status} ${response.statusText} - ${errorText}`,
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return response.json();
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
try {
|
|
51
|
+
const outputPath = resolve(process.argv[2] || DEFAULT_SCHEMA_PATH);
|
|
52
|
+
|
|
53
|
+
const introspectionResult = await executeSalesforceGraphQLQuery(
|
|
54
|
+
getIntrospectionQuery(),
|
|
55
|
+
{},
|
|
56
|
+
'IntrospectionQuery',
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
const schema = buildClientSchema(introspectionResult.data);
|
|
60
|
+
const prunedSchema = pruneSchema(schema);
|
|
61
|
+
const sdl = printSchema(prunedSchema);
|
|
62
|
+
|
|
63
|
+
writeFileSync(outputPath, sdl);
|
|
64
|
+
|
|
65
|
+
console.log(`Schema saved to ${outputPath}`);
|
|
66
|
+
} catch (error) {
|
|
67
|
+
console.error('Error:', error.message);
|
|
68
|
+
process.exit(1);
|
|
69
|
+
}
|