Skip to content

Commit 01c96f1

Browse files
authored
Ability to provide a custom record context besides the standard record Id (#220)
1 parent 0c91682 commit 01c96f1

30 files changed

+929
-215
lines changed

.idea/copilot.data.migration.agent.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/copilot.data.migration.ask.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/copilot.data.migration.ask2agent.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/copilot.data.migration.edit.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apexdocs.config.ts

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,53 @@
1-
import {readFileSync, writeFileSync} from "fs";
2-
import {defineMarkdownConfig, skip} from "@cparra/apexdocs";
1+
import { readFileSync, writeFileSync } from "fs";
2+
import { defineMarkdownConfig, skip } from "@cparra/apexdocs";
33

44
export default defineMarkdownConfig({
5-
sourceDir: 'expression-src',
6-
targetDir: 'docs/src/app/docs/api',
7-
scope: ['global'],
8-
namespace: 'expression',
9-
transformReference: (reference) => {
10-
return {
11-
outputDocPath: reference.outputDocPath.replace('.md', '/page.md'),
12-
referencePath: reference.referencePath.replace('.md', ''),
13-
};
14-
},
15-
transformReferenceGuide: () => {
16-
return skip();
17-
},
18-
transformDocPage: (docPage) => {
19-
return {
20-
frontmatter: {
21-
nextjs: {
22-
metadata: {
23-
title: docPage.source.name,
24-
description: `Api documentation for the ${docPage.source.name} ${docPage.source.type}}`,
25-
}
26-
}
27-
},
28-
};
29-
},
30-
transformDocs: (docs) => {
31-
const navFileContents = readFileSync("docs/src/lib/navigation.json", "utf8");
32-
const navItems = JSON.parse(navFileContents);
33-
// Find an object whose title is "Api"
34-
let apiNavObject = navItems.find((navObject: any) => navObject.title === "Api");
35-
apiNavObject = apiNavObject ?? {title: "Api", links: []};
5+
sourceDir: "expression-src",
6+
targetDir: "docs/src/app/docs/api",
7+
scope: ["global"],
8+
namespace: "expression",
9+
transformReference: (reference) => {
10+
return {
11+
outputDocPath: reference.outputDocPath.replace(".md", "/page.md"),
12+
referencePath: reference.referencePath.replace(".md", ""),
13+
};
14+
},
15+
transformReferenceGuide: () => {
16+
return skip();
17+
},
18+
transformDocPage: (docPage) => {
19+
return {
20+
frontmatter: {
21+
nextjs: {
22+
metadata: {
23+
title: docPage.source.name,
24+
description: `Api documentation for the ${ docPage.source.name } ${ docPage.source.type }`,
25+
}
26+
}
27+
},
28+
};
29+
},
30+
transformDocs: (docs) => {
31+
const navFileContents = readFileSync("docs/src/lib/navigation.json", "utf8");
32+
const navItems = JSON.parse(navFileContents);
33+
// Find an object whose title is "Api"
34+
let apiNavObject = navItems.find((navObject: any) => navObject.title === "Api");
35+
apiNavObject = apiNavObject ?? { title: "Api", links: [] };
3636

37-
apiNavObject.links = docs.map((doc) => {
38-
return {
39-
title: doc.source.name, href: `/docs/api/${doc.outputDocPath.replace('page.md', '').replace(/\/$/, '')}`
40-
};
41-
});
37+
apiNavObject.links = docs.map((doc) => {
38+
return {
39+
title: doc.source.name, href: `/docs/api/${ doc.outputDocPath.replace("page.md", "").replace(/\/$/, "") }`
40+
};
41+
});
4242

43-
// replace the Api object with the new one (or add it if it didn't exist)
44-
const newNavItems = navItems.filter((navObject: any) => navObject.title !== "Api");
45-
newNavItems.push(apiNavObject);
43+
// replace the Api object with the new one (or add it if it didn't exist)
44+
const newNavItems = navItems.filter((navObject: any) => navObject.title !== "Api");
45+
newNavItems.push(apiNavObject);
4646

47-
// Write the new navigation.json file
48-
const newNavFileContents = JSON.stringify(newNavItems, null, 2);
49-
writeFileSync("docs/src/lib/navigation.json", newNavFileContents);
47+
// Write the new navigation.json file
48+
const newNavFileContents = JSON.stringify(newNavItems, null, 2);
49+
writeFileSync("docs/src/lib/navigation.json", newNavFileContents);
5050

51-
return docs;
52-
},
51+
return docs;
52+
},
5353
});

cirrus.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ test = "sf apex test run --test-level RunLocalTests --wait 20"
1010
docs = "apexdocs markdown"
1111
generate-library-docs = "bun scripts/generate-library-docs.mjs"
1212
prep-package = "bun scripts/prepare-for-packaging.mjs"
13-
package = "cirrus package -p Expression -t minor -x -c --promote -w 60"
13+
run-package = "cirrus package create -p Expression -t minor -x -c --promote -w 60"
1414
post-package = "bun scripts/post-packaging.mjs"
1515

1616
[flow.start-dev]
@@ -25,6 +25,6 @@ steps = [
2525
description = "Create a managed package version for Expression"
2626
steps = [
2727
{ type = "command", name = "prep-package" },
28-
{ type = "command", name = "package" },
28+
{ type = "command", name = "run-package" },
2929
{ type = "command", name = "post-package" },
3030
]

docs/public/packages.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"packageId": "04tRb000003UxfFIAS",
2+
"packageId": "04tRb000003tVPdIAM",
33
"componentPackageId": "04tRb0000012Mv8IAE"
44
}

docs/src/app/docs/api/miscellaneous/Configuration/page.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
nextjs:
33
metadata:
44
title: Configuration
5-
description: Api documentation for the Configuration class}
5+
description: Api documentation for the Configuration class
66
---
77

88
# Configuration Class
@@ -13,6 +13,18 @@ Configuration class for the evaluator.
1313
expression
1414

1515
## Fields
16+
### `globalContextVariablePrefix`
17+
18+
#### Signature
19+
```apex
20+
global globalContextVariablePrefix
21+
```
22+
23+
#### Type
24+
String
25+
26+
---
27+
1628
### `sharing`
1729

1830
#### Signature
@@ -104,6 +116,23 @@ global Configuration withCustomContext(Map<String,Object> objectsByStrings)
104116
#### Return Type
105117
**[Configuration](Configuration)**
106118

119+
---
120+
121+
### `withGlobalContextVariablePrefix(prefix)`
122+
123+
#### Signature
124+
```apex
125+
global Configuration withGlobalContextVariablePrefix(String prefix)
126+
```
127+
128+
#### Parameters
129+
| Name | Type | Description |
130+
|------|------|-------------|
131+
| prefix | String | |
132+
133+
#### Return Type
134+
**[Configuration](Configuration)**
135+
107136
## Enums
108137
### SharingMode Enum
109138

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
nextjs:
3+
metadata:
4+
title: CustomRecordContext
5+
description: Api documentation for the CustomRecordContext class
6+
---
7+
8+
# CustomRecordContext Class
9+
10+
## Namespace
11+
expression
12+
13+
## Fields
14+
### `key`
15+
16+
#### Signature
17+
```apex
18+
global final key
19+
```
20+
21+
#### Type
22+
String
23+
24+
---
25+
26+
### `recordId`
27+
28+
#### Signature
29+
```apex
30+
global final recordId
31+
```
32+
33+
#### Type
34+
Id
35+
36+
---
37+
38+
### `prequeriedRecord`
39+
40+
#### Signature
41+
```apex
42+
global final prequeriedRecord
43+
```
44+
45+
#### Type
46+
SObject
47+
48+
## Constructors
49+
### `CustomRecordContext(key, recordId)`
50+
51+
#### Signature
52+
```apex
53+
global CustomRecordContext(String key, Id recordId)
54+
```
55+
56+
#### Parameters
57+
| Name | Type | Description |
58+
|------|------|-------------|
59+
| key | String | |
60+
| recordId | Id | |
61+
62+
---
63+
64+
### `CustomRecordContext(key, recordId, prequeriedRecord)`
65+
66+
#### Signature
67+
```apex
68+
global CustomRecordContext(String key, Id recordId, SObject prequeriedRecord)
69+
```
70+
71+
#### Parameters
72+
| Name | Type | Description |
73+
|------|------|-------------|
74+
| key | String | |
75+
| recordId | Id | |
76+
| prequeriedRecord | SObject | |

0 commit comments

Comments
 (0)