scc-universal 1.1.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/.claude-plugin/plugin.json +44 -0
- package/.cursor/agents/deep-researcher.md +142 -0
- package/.cursor/agents/doc-updater.md +219 -0
- package/.cursor/agents/eval-runner.md +335 -0
- package/.cursor/agents/learning-engine.md +210 -0
- package/.cursor/agents/loop-operator.md +245 -0
- package/.cursor/agents/refactor-cleaner.md +119 -0
- package/.cursor/agents/sf-admin-agent.md +127 -0
- package/.cursor/agents/sf-agentforce-agent.md +126 -0
- package/.cursor/agents/sf-apex-agent.md +117 -0
- package/.cursor/agents/sf-architect.md +426 -0
- package/.cursor/agents/sf-aura-reviewer.md +369 -0
- package/.cursor/agents/sf-bugfix-agent.md +101 -0
- package/.cursor/agents/sf-flow-agent.md +155 -0
- package/.cursor/agents/sf-integration-agent.md +141 -0
- package/.cursor/agents/sf-lwc-agent.md +123 -0
- package/.cursor/agents/sf-review-agent.md +357 -0
- package/.cursor/agents/sf-visualforce-reviewer.md +465 -0
- package/.cursor/hooks/adapter.js +81 -0
- package/.cursor/hooks/after-file-edit.js +26 -0
- package/.cursor/hooks/after-mcp-execution.js +12 -0
- package/.cursor/hooks/after-shell-execution.js +30 -0
- package/.cursor/hooks/after-tab-file-edit.js +12 -0
- package/.cursor/hooks/before-mcp-execution.js +11 -0
- package/.cursor/hooks/before-read-file.js +13 -0
- package/.cursor/hooks/before-shell-execution.js +29 -0
- package/.cursor/hooks/before-submit-prompt.js +23 -0
- package/.cursor/hooks/pre-compact.js +7 -0
- package/.cursor/hooks/session-end.js +10 -0
- package/.cursor/hooks/session-start.js +10 -0
- package/.cursor/hooks/stop.js +18 -0
- package/.cursor/hooks/subagent-start.js +10 -0
- package/.cursor/hooks/subagent-stop.js +10 -0
- package/.cursor/hooks.json +107 -0
- package/.cursor/skills/aside/SKILL.md +115 -0
- package/.cursor/skills/checkpoint/SKILL.md +50 -0
- package/.cursor/skills/configure-scc/SKILL.md +160 -0
- package/.cursor/skills/continuous-agent-loop/SKILL.md +260 -0
- package/.cursor/skills/mcp-server-patterns/SKILL.md +142 -0
- package/.cursor/skills/model-route/SKILL.md +81 -0
- package/.cursor/skills/prompt-optimizer/SKILL.md +366 -0
- package/.cursor/skills/refactor-clean/SKILL.md +133 -0
- package/.cursor/skills/resume-session/SKILL.md +111 -0
- package/.cursor/skills/save-session/SKILL.md +183 -0
- package/.cursor/skills/search-first/SKILL.md +140 -0
- package/.cursor/skills/security-scan/SKILL.md +142 -0
- package/.cursor/skills/sessions/SKILL.md +124 -0
- package/.cursor/skills/sf-agentforce-development/SKILL.md +449 -0
- package/.cursor/skills/sf-apex-async-patterns/SKILL.md +324 -0
- package/.cursor/skills/sf-apex-best-practices/SKILL.md +421 -0
- package/.cursor/skills/sf-apex-constraints/SKILL.md +79 -0
- package/.cursor/skills/sf-apex-cursor/SKILL.md +336 -0
- package/.cursor/skills/sf-apex-enterprise-patterns/SKILL.md +344 -0
- package/.cursor/skills/sf-apex-testing/SKILL.md +407 -0
- package/.cursor/skills/sf-api-design/SKILL.md +237 -0
- package/.cursor/skills/sf-approval-processes/SKILL.md +312 -0
- package/.cursor/skills/sf-aura-development/SKILL.md +260 -0
- package/.cursor/skills/sf-build-fix/SKILL.md +120 -0
- package/.cursor/skills/sf-data-modeling/SKILL.md +274 -0
- package/.cursor/skills/sf-debugging/SKILL.md +362 -0
- package/.cursor/skills/sf-deployment/SKILL.md +291 -0
- package/.cursor/skills/sf-deployment-constraints/SKILL.md +153 -0
- package/.cursor/skills/sf-devops-ci-cd/SKILL.md +322 -0
- package/.cursor/skills/sf-docs-lookup/SKILL.md +100 -0
- package/.cursor/skills/sf-e2e-testing/SKILL.md +321 -0
- package/.cursor/skills/sf-experience-cloud/SKILL.md +248 -0
- package/.cursor/skills/sf-flow-development/SKILL.md +376 -0
- package/.cursor/skills/sf-governor-limits/SKILL.md +319 -0
- package/.cursor/skills/sf-harness-audit/SKILL.md +139 -0
- package/.cursor/skills/sf-help/SKILL.md +156 -0
- package/.cursor/skills/sf-integration/SKILL.md +479 -0
- package/.cursor/skills/sf-lwc-constraints/SKILL.md +128 -0
- package/.cursor/skills/sf-lwc-development/SKILL.md +302 -0
- package/.cursor/skills/sf-lwc-testing/SKILL.md +387 -0
- package/.cursor/skills/sf-metadata-management/SKILL.md +285 -0
- package/.cursor/skills/sf-platform-events-cdc/SKILL.md +372 -0
- package/.cursor/skills/sf-quickstart/SKILL.md +170 -0
- package/.cursor/skills/sf-security/SKILL.md +330 -0
- package/.cursor/skills/sf-security-constraints/SKILL.md +125 -0
- package/.cursor/skills/sf-soql-constraints/SKILL.md +129 -0
- package/.cursor/skills/sf-soql-optimization/SKILL.md +353 -0
- package/.cursor/skills/sf-tdd-workflow/SKILL.md +332 -0
- package/.cursor/skills/sf-testing-constraints/SKILL.md +198 -0
- package/.cursor/skills/sf-trigger-constraints/SKILL.md +88 -0
- package/.cursor/skills/sf-trigger-frameworks/SKILL.md +343 -0
- package/.cursor/skills/sf-visualforce-development/SKILL.md +259 -0
- package/.cursor/skills/strategic-compact/SKILL.md +205 -0
- package/.cursor/skills/update-docs/SKILL.md +162 -0
- package/.cursor/skills/update-platform-docs/SKILL.md +86 -0
- package/.cursor-plugin/plugin.json +26 -0
- package/LICENSE +21 -0
- package/README.md +522 -0
- package/agents/deep-researcher.md +145 -0
- package/agents/doc-updater.md +222 -0
- package/agents/eval-runner.md +340 -0
- package/agents/learning-engine.md +211 -0
- package/agents/loop-operator.md +247 -0
- package/agents/refactor-cleaner.md +122 -0
- package/agents/sf-admin-agent.md +131 -0
- package/agents/sf-agentforce-agent.md +132 -0
- package/agents/sf-apex-agent.md +124 -0
- package/agents/sf-architect.md +435 -0
- package/agents/sf-aura-reviewer.md +372 -0
- package/agents/sf-bugfix-agent.md +105 -0
- package/agents/sf-flow-agent.md +159 -0
- package/agents/sf-integration-agent.md +146 -0
- package/agents/sf-lwc-agent.md +127 -0
- package/agents/sf-review-agent.md +366 -0
- package/agents/sf-visualforce-reviewer.md +468 -0
- package/assets/logo.svg +18 -0
- package/docs/ARCHITECTURE.md +133 -0
- package/docs/authoring-guide.md +373 -0
- package/docs/hook-development.md +578 -0
- package/docs/token-optimization.md +139 -0
- package/docs/workflow-examples.md +645 -0
- package/examples/agentforce-action/README.md +227 -0
- package/examples/apex-trigger-handler/README.md +114 -0
- package/examples/devops-pipeline/README.md +325 -0
- package/examples/flow-automation/README.md +188 -0
- package/examples/integration-pattern/README.md +416 -0
- package/examples/lwc-component/README.md +180 -0
- package/examples/platform-events/README.md +492 -0
- package/examples/scratch-org-setup/README.md +138 -0
- package/examples/security-audit/README.md +244 -0
- package/examples/visualforce-migration/README.md +314 -0
- package/hooks/hooks.json +338 -0
- package/hooks/memory-persistence/README.md +73 -0
- package/manifests/install-modules.json +217 -0
- package/manifests/install-profiles.json +17 -0
- package/mcp-configs/mcp-servers.json +19 -0
- package/package.json +89 -0
- package/schemas/hooks.schema.json +123 -0
- package/schemas/install-modules.schema.json +76 -0
- package/schemas/install-profiles.schema.json +28 -0
- package/schemas/install-state.schema.json +73 -0
- package/schemas/package-manager.schema.json +18 -0
- package/schemas/plugin.schema.json +112 -0
- package/schemas/scc-install-config.schema.json +29 -0
- package/schemas/state-store.schema.json +111 -0
- package/scripts/cli/install-apply.js +170 -0
- package/scripts/cli/uninstall.js +193 -0
- package/scripts/hooks/check-console-log.js +101 -0
- package/scripts/hooks/check-hook-enabled.js +17 -0
- package/scripts/hooks/check-platform-docs-age.js +48 -0
- package/scripts/hooks/cost-tracker.js +78 -0
- package/scripts/hooks/doc-file-warning.js +63 -0
- package/scripts/hooks/evaluate-session.js +98 -0
- package/scripts/hooks/governor-check.js +220 -0
- package/scripts/hooks/learning-observe.sh +206 -0
- package/scripts/hooks/mcp-health-check.js +588 -0
- package/scripts/hooks/post-bash-build-complete.js +34 -0
- package/scripts/hooks/post-bash-pr-created.js +43 -0
- package/scripts/hooks/post-edit-console-warn.js +61 -0
- package/scripts/hooks/post-edit-format.js +79 -0
- package/scripts/hooks/post-edit-typecheck.js +98 -0
- package/scripts/hooks/post-write.js +168 -0
- package/scripts/hooks/pre-bash-git-push-reminder.js +35 -0
- package/scripts/hooks/pre-bash-tmux-reminder.js +47 -0
- package/scripts/hooks/pre-compact.js +51 -0
- package/scripts/hooks/pre-tool-use.js +163 -0
- package/scripts/hooks/pre-write-doc-warn.js +9 -0
- package/scripts/hooks/quality-gate.js +251 -0
- package/scripts/hooks/run-with-flags-shell.sh +32 -0
- package/scripts/hooks/run-with-flags.js +135 -0
- package/scripts/hooks/session-end-marker.js +29 -0
- package/scripts/hooks/session-end.js +311 -0
- package/scripts/hooks/session-start.js +202 -0
- package/scripts/hooks/sfdx-scanner-check.js +142 -0
- package/scripts/hooks/sfdx-validate.js +119 -0
- package/scripts/hooks/stop-hook.js +170 -0
- package/scripts/hooks/suggest-compact.js +67 -0
- package/scripts/lib/agent-adapter.js +82 -0
- package/scripts/lib/apex-analysis.js +194 -0
- package/scripts/lib/hook-flags.js +74 -0
- package/scripts/lib/install-config.js +73 -0
- package/scripts/lib/install-executor.js +363 -0
- package/scripts/lib/install-state.js +121 -0
- package/scripts/lib/orchestration-session.js +299 -0
- package/scripts/lib/package-manager.js +124 -0
- package/scripts/lib/project-detect.js +228 -0
- package/scripts/lib/schema-validator.js +190 -0
- package/scripts/lib/skill-adapter.js +100 -0
- package/scripts/lib/state-store.js +376 -0
- package/scripts/lib/tmux-worktree-orchestrator.js +598 -0
- package/scripts/lib/utils.js +313 -0
- package/scripts/scc.js +164 -0
- package/skills/_reference/AGENTFORCE_PATTERNS.md +112 -0
- package/skills/_reference/APEX_CURSOR.md +159 -0
- package/skills/_reference/API_VERSIONS.md +78 -0
- package/skills/_reference/APPROVAL_PROCESSES.md +105 -0
- package/skills/_reference/ASYNC_PATTERNS.md +163 -0
- package/skills/_reference/AURA_COMPONENTS.md +146 -0
- package/skills/_reference/DATA_MIGRATION_PATTERNS.md +151 -0
- package/skills/_reference/DATA_MODELING.md +124 -0
- package/skills/_reference/DEBUGGING_TOOLS.md +140 -0
- package/skills/_reference/DEPLOYMENT_CHECKLIST.md +87 -0
- package/skills/_reference/DEPRECATIONS.md +79 -0
- package/skills/_reference/DOCKER_CI_PATTERNS.md +138 -0
- package/skills/_reference/ENTERPRISE_PATTERNS.md +122 -0
- package/skills/_reference/EXPERIENCE_CLOUD.md +143 -0
- package/skills/_reference/FLOW_PATTERNS.md +113 -0
- package/skills/_reference/GOVERNOR_LIMITS.md +77 -0
- package/skills/_reference/INTEGRATION_PATTERNS.md +105 -0
- package/skills/_reference/LWC_PATTERNS.md +79 -0
- package/skills/_reference/METADATA_TYPES.md +115 -0
- package/skills/_reference/NAMING_CONVENTIONS.md +84 -0
- package/skills/_reference/PACKAGE_DEVELOPMENT.md +150 -0
- package/skills/_reference/PLATFORM_EVENTS.md +121 -0
- package/skills/_reference/REPORTING_API.md +143 -0
- package/skills/_reference/SCRATCH_ORG_PATTERNS.md +126 -0
- package/skills/_reference/SECURITY_PATTERNS.md +127 -0
- package/skills/_reference/SHARING_MODEL.md +120 -0
- package/skills/_reference/SOQL_PATTERNS.md +119 -0
- package/skills/_reference/TESTING_STANDARDS.md +96 -0
- package/skills/_reference/TRIGGER_PATTERNS.md +114 -0
- package/skills/_reference/VISUALFORCE_PATTERNS.md +121 -0
- package/skills/aside/SKILL.md +118 -0
- package/skills/checkpoint/SKILL.md +53 -0
- package/skills/configure-scc/SKILL.md +163 -0
- package/skills/continuous-agent-loop/SKILL.md +264 -0
- package/skills/mcp-server-patterns/SKILL.md +146 -0
- package/skills/model-route/SKILL.md +84 -0
- package/skills/prompt-optimizer/SKILL.md +369 -0
- package/skills/refactor-clean/SKILL.md +136 -0
- package/skills/resume-session/SKILL.md +114 -0
- package/skills/save-session/SKILL.md +186 -0
- package/skills/search-first/SKILL.md +144 -0
- package/skills/security-scan/SKILL.md +146 -0
- package/skills/sessions/SKILL.md +127 -0
- package/skills/sf-agentforce-development/SKILL.md +450 -0
- package/skills/sf-apex-async-patterns/SKILL.md +326 -0
- package/skills/sf-apex-best-practices/SKILL.md +425 -0
- package/skills/sf-apex-constraints/SKILL.md +81 -0
- package/skills/sf-apex-cursor/SKILL.md +338 -0
- package/skills/sf-apex-enterprise-patterns/SKILL.md +348 -0
- package/skills/sf-apex-testing/SKILL.md +409 -0
- package/skills/sf-api-design/SKILL.md +238 -0
- package/skills/sf-approval-processes/SKILL.md +315 -0
- package/skills/sf-aura-development/SKILL.md +263 -0
- package/skills/sf-build-fix/SKILL.md +121 -0
- package/skills/sf-data-modeling/SKILL.md +278 -0
- package/skills/sf-debugging/SKILL.md +363 -0
- package/skills/sf-deployment/SKILL.md +295 -0
- package/skills/sf-deployment-constraints/SKILL.md +155 -0
- package/skills/sf-devops-ci-cd/SKILL.md +325 -0
- package/skills/sf-docs-lookup/SKILL.md +103 -0
- package/skills/sf-e2e-testing/SKILL.md +324 -0
- package/skills/sf-experience-cloud/SKILL.md +249 -0
- package/skills/sf-flow-development/SKILL.md +377 -0
- package/skills/sf-governor-limits/SKILL.md +323 -0
- package/skills/sf-harness-audit/SKILL.md +142 -0
- package/skills/sf-help/SKILL.md +159 -0
- package/skills/sf-integration/SKILL.md +483 -0
- package/skills/sf-lwc-constraints/SKILL.md +130 -0
- package/skills/sf-lwc-development/SKILL.md +303 -0
- package/skills/sf-lwc-testing/SKILL.md +388 -0
- package/skills/sf-metadata-management/SKILL.md +288 -0
- package/skills/sf-platform-events-cdc/SKILL.md +375 -0
- package/skills/sf-quickstart/SKILL.md +173 -0
- package/skills/sf-security/SKILL.md +334 -0
- package/skills/sf-security-constraints/SKILL.md +127 -0
- package/skills/sf-soql-constraints/SKILL.md +131 -0
- package/skills/sf-soql-optimization/SKILL.md +354 -0
- package/skills/sf-tdd-workflow/SKILL.md +336 -0
- package/skills/sf-testing-constraints/SKILL.md +200 -0
- package/skills/sf-trigger-constraints/SKILL.md +90 -0
- package/skills/sf-trigger-frameworks/SKILL.md +347 -0
- package/skills/sf-visualforce-development/SKILL.md +260 -0
- package/skills/strategic-compact/SKILL.md +208 -0
- package/skills/update-docs/SKILL.md +165 -0
- package/skills/update-platform-docs/SKILL.md +90 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Integration Patterns — Reference
|
|
2
|
+
|
|
3
|
+
> Source: <https://architect.salesforce.com/fundamentals/integration-patterns>
|
|
4
|
+
> Source: <https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_callouts_timeouts.htm>
|
|
5
|
+
> Source: <https://help.salesforce.com/s/articleView?id=xcloud.nc_auth_protocols.htm>
|
|
6
|
+
> Last verified: API v66.0, Spring '26 (2026-03-28)
|
|
7
|
+
|
|
8
|
+
## Apex Callout Limits
|
|
9
|
+
|
|
10
|
+
| Limit | Value |
|
|
11
|
+
|---|---|
|
|
12
|
+
| Max callouts per transaction | 100 |
|
|
13
|
+
| Max cumulative timeout (all callouts) | 120 s |
|
|
14
|
+
| Default timeout per callout | 10 s |
|
|
15
|
+
| Max configurable timeout per callout | 120 s (120,000 ms) |
|
|
16
|
+
| Max request size (sync) | 6 MB |
|
|
17
|
+
| Max request size (async) | 12 MB |
|
|
18
|
+
| Max response size (sync) | 6 MB |
|
|
19
|
+
| Max response size (async) | 12 MB |
|
|
20
|
+
| Continuation max timeout | 120 s |
|
|
21
|
+
| Continuation max callouts per request | 3 |
|
|
22
|
+
| Max redirects followed | 5 |
|
|
23
|
+
|
|
24
|
+
## Composite API Limits
|
|
25
|
+
|
|
26
|
+
| Resource | Max Subrequests | Notes |
|
|
27
|
+
|---|---|---|
|
|
28
|
+
| **Composite** | 25 | Supports references between subrequests; max 5 query/sObject Collections ops |
|
|
29
|
+
| **Composite Batch** | 25 | Independent subrequests; no inter-reference |
|
|
30
|
+
| **Composite Graph** | 500 | Up to 500 nodes across all graphs in one request |
|
|
31
|
+
| **sObject Tree** | 200 records | Insert only; max 5 levels deep |
|
|
32
|
+
| **sObject Collections** | 200 records | Create/update/upsert/delete per request |
|
|
33
|
+
|
|
34
|
+
Each full Composite request counts as **1 API call** against org limits regardless of subrequest count.
|
|
35
|
+
|
|
36
|
+
## Named Credentials Architecture (New Model, Winter '23+)
|
|
37
|
+
|
|
38
|
+
Legacy Named Credentials are deprecated. New model splits into two components:
|
|
39
|
+
|
|
40
|
+
| Component | Purpose |
|
|
41
|
+
|---|---|
|
|
42
|
+
| **Named Credential** | Defines callout endpoint URL + HTTP transport protocol |
|
|
43
|
+
| **External Credential** | Defines authentication protocol + user identity mapping |
|
|
44
|
+
|
|
45
|
+
One External Credential can back multiple Named Credentials.
|
|
46
|
+
|
|
47
|
+
### External Credential — Authentication Protocols
|
|
48
|
+
|
|
49
|
+
| Protocol | Variants |
|
|
50
|
+
|---|---|
|
|
51
|
+
| **OAuth 2.0** | Client Credentials (client secret), Client Credentials (JWT assertion), JWT Bearer, Browser Flow |
|
|
52
|
+
| **JWT** | Signing certificate from subscriber org |
|
|
53
|
+
| **AWS Signature V4** | Standard (access key + secret), STS (temporary credentials), STS Roles Anywhere (certificate-based) |
|
|
54
|
+
| **Custom** | User-defined headers/tokens; populated via API or per-user |
|
|
55
|
+
| **No Authentication** | Anonymous callouts |
|
|
56
|
+
|
|
57
|
+
### Identity Types
|
|
58
|
+
|
|
59
|
+
| Type | Behavior |
|
|
60
|
+
|---|---|
|
|
61
|
+
| **Named Principal** | Single credential shared across all users |
|
|
62
|
+
| **Per User** | Each user maps to their own external credential |
|
|
63
|
+
| **Anonymous** | No authentication sent |
|
|
64
|
+
|
|
65
|
+
## Integration Pattern Decision Matrix
|
|
66
|
+
|
|
67
|
+
| Pattern | Direction | Timing | Protocols / Mechanisms | Volume | Use When |
|
|
68
|
+
|---|---|---|---|---|---|
|
|
69
|
+
| **Request and Reply** | SF -> External | Sync | Apex REST/SOAP callout, External Services | Small | Need response in same transaction |
|
|
70
|
+
| **Fire and Forget** | SF -> External | Async | Platform Events, CDC, Outbound Messages, Pub/Sub API | Small-Med | No response needed; eventual consistency OK |
|
|
71
|
+
| **Batch Data Sync** | Bidirectional | Async | Bulk API 2.0, Data Loader, Composite API, ETL | Large (2K+) | Scheduled bulk data movement |
|
|
72
|
+
| **Remote Call-In** | External -> SF | Sync | REST API, SOAP API, Composite, Bulk API 2.0, Pub/Sub API | Any | External system initiates CRUD or event publish |
|
|
73
|
+
| **UI Update on Data Change** | Internal | Async | CDC, Platform Events, Streaming API, Emp API (LWC) | Real-time | Push UI updates without polling |
|
|
74
|
+
| **Data Virtualization** | SF -> External | Sync | Apex HTTP callouts, Salesforce Connect (OData), External Objects | Small | Real-time read without persisting external data |
|
|
75
|
+
|
|
76
|
+
## Platform Event Limits (Reference)
|
|
77
|
+
|
|
78
|
+
| Limit | Value |
|
|
79
|
+
|---|---|
|
|
80
|
+
| Event publish (Apex) | 150 per transaction |
|
|
81
|
+
| Event publish (Flow) | 150 per transaction |
|
|
82
|
+
| Event publish (API) | Based on API limits |
|
|
83
|
+
| Event delivery retention | 72 hours (standard), 24 hours (high-volume) |
|
|
84
|
+
| CometD subscribers per org | 2,000 |
|
|
85
|
+
| Max event message size | 1 MB |
|
|
86
|
+
|
|
87
|
+
## External Services Limits
|
|
88
|
+
|
|
89
|
+
| Limit | Value |
|
|
90
|
+
|---|---|
|
|
91
|
+
| Schema format | OpenAPI 2.0 and 3.0 |
|
|
92
|
+
| Max schema upload size | 10 MB |
|
|
93
|
+
| Callouts per Apex transaction | 100 (shared with all Apex callouts) |
|
|
94
|
+
| Supported invocation | Flow, Apex, Agentforce Actions |
|
|
95
|
+
| Inbound webhooks | Not supported |
|
|
96
|
+
|
|
97
|
+
## Callout Best Practices (Quick Reference)
|
|
98
|
+
|
|
99
|
+
- Always use **Named Credentials** — never hard-code endpoints or tokens in Apex.
|
|
100
|
+
- Use **Continuations** for long-running callouts in LWC/Aura to avoid holding a thread.
|
|
101
|
+
- Use **Queueable** or **@future(callout=true)** to move callouts out of trigger context.
|
|
102
|
+
- Use **Composite API** (not individual REST calls) when external systems call into Salesforce to reduce API consumption.
|
|
103
|
+
- Use **Platform Events** or **CDC** for fire-and-forget; prefer over Outbound Messages for new builds.
|
|
104
|
+
- Use **Bulk API 2.0** (not REST/SOAP) for anything over 2,000 records.
|
|
105
|
+
- Set explicit **timeout values** — the 10 s default is often too short for third-party APIs.
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# LWC Patterns — Reference
|
|
2
|
+
|
|
3
|
+
> Source: <https://developer.salesforce.com/docs/platform/lwc/guide/>
|
|
4
|
+
> Last verified: API v66.0, Spring '26 (2026-03-28)
|
|
5
|
+
|
|
6
|
+
## Lifecycle Hooks (Execution Order)
|
|
7
|
+
|
|
8
|
+
| # | Hook | Fires when | Direction | Key constraints |
|
|
9
|
+
|---|------|-----------|-----------|----------------|
|
|
10
|
+
| 1 | `constructor()` | Component instantiated | — | No DOM access. No attributes/public props. Call `super()` first. |
|
|
11
|
+
| 2 | `connectedCallback()` | Inserted into DOM | Parent → child | Can fire more than once (reorder/reinsert). Cannot access child elements. Use `this.isConnected` to check. |
|
|
12
|
+
| 3 | `render()` | Before each render | — | Return alternate template import. Rarely needed. |
|
|
13
|
+
| 4 | `renderedCallback()` | Render complete | Child → parent | Fires every render. Guard one-time logic with a boolean. Updating state here risks infinite loops. |
|
|
14
|
+
| 5 | `disconnectedCallback()` | Removed from DOM | Parent → child | Clean up listeners, caches, message-channel subscriptions. |
|
|
15
|
+
| 6 | `errorCallback(error, stack)` | Descendant error | Child → parent | Catches errors in descendant lifecycle/render. Acts as boundary. |
|
|
16
|
+
|
|
17
|
+
## Reactive Property Rules
|
|
18
|
+
|
|
19
|
+
| Decorator | Reactivity scope | When required |
|
|
20
|
+
|-----------|-----------------|---------------|
|
|
21
|
+
| *(none)* | Shallow (`===`) on primitives, new assignment on objects/arrays | Default since Spring '20. All fields are reactive. |
|
|
22
|
+
| `@track` | Deep — observes internal mutations on plain `{}` and `[]` | Mutating object properties or array elements in place. Does NOT observe `Date`, `Set`, `Map`, or class instances. |
|
|
23
|
+
| `@api` | Shallow — reactive when parent sets new value | Exposing public properties/methods. Defines component API. |
|
|
24
|
+
| `@wire` | Reactive via `$`-prefixed params | Binding to wire adapters or Apex methods. |
|
|
25
|
+
|
|
26
|
+
**Re-render trigger**: only fields accessed during the previous render cycle. New/unaccessed properties do not trigger re-render even with `@track`.
|
|
27
|
+
|
|
28
|
+
## Wire Service Rules
|
|
29
|
+
|
|
30
|
+
- `@wire` provisions an **immutable stream**; data objects are read-only (shallow-copy to mutate).
|
|
31
|
+
- `$`-prefixed params are reactive; changes re-provision data. Only top-level config values use `$`.
|
|
32
|
+
- Wire evaluates only when **all** dynamic params are defined (non-`undefined`).
|
|
33
|
+
- Data may come from LDS cache (no network call). Arrival time is **non-deterministic**.
|
|
34
|
+
- Do NOT update wire config in `renderedCallback()` (infinite loop).
|
|
35
|
+
- Wire chains: one `@wire` output can feed another via `$record.data.fieldName`.
|
|
36
|
+
- On init: `constructor` → LDS provisions `{data: undefined, error: undefined}` → `connectedCallback` → `render` → `renderedCallback` → data arrives → re-render.
|
|
37
|
+
|
|
38
|
+
## Wire Adapters by Module
|
|
39
|
+
|
|
40
|
+
| Module | Wire adapters | Functions |
|
|
41
|
+
|--------|--------------|-----------|
|
|
42
|
+
| `lightning/uiRecordApi` | `getRecord`, `getRecords`, `getRecordCreateDefaults` | `createRecord`, `updateRecord`, `deleteRecord`, `notifyRecordUpdateAvailable`, `getFieldValue`, `getFieldDisplayValue`, `generateRecordInputForCreate`, `generateRecordInputForUpdate`, `createRecordInputFilteredByEditedFields` |
|
|
43
|
+
| `lightning/uiObjectInfoApi` | `getObjectInfo`, `getObjectInfos`, `getPicklistValues`, `getPicklistValuesByRecordType` | — |
|
|
44
|
+
| `lightning/uiListApi` *(deprecated)* | `getListUi` | — |
|
|
45
|
+
| `lightning/uiListsApi` | `getListInfoByName`, `getListInfosByListReference` | — |
|
|
46
|
+
| `lightning/uiRelatedListApi` | `getRelatedListRecords`, `getRelatedListCount`, `getRelatedListInfo`, `getRelatedListsInfo`, `getRelatedListRecordsBatch`, `getRelatedListInfoBatch` | — |
|
|
47
|
+
| `lightning/uiLayoutApi` | `getLayoutUserState` | `updateLayoutUserState` |
|
|
48
|
+
| `lightning/graphql` | `graphql` | — |
|
|
49
|
+
| `lightning/messageService` | — | `publish`, `subscribe`, `unsubscribe`, `createMessageContext`, `releaseMessageContext` |
|
|
50
|
+
| `@salesforce/apex` | Apex methods via `@wire` | Imperative `method({params})` |
|
|
51
|
+
|
|
52
|
+
## Event Propagation
|
|
53
|
+
|
|
54
|
+
| `bubbles` | `composed` | Behavior |
|
|
55
|
+
|-----------|-----------|----------|
|
|
56
|
+
| `false` | `false` | **Default / recommended.** Does not bubble. Does not cross shadow boundary. Listener must be on dispatching element. |
|
|
57
|
+
| `true` | `false` | Bubbles within owner's shadow tree. Stops at shadow boundary. Works across slots. |
|
|
58
|
+
| `true` | `true` | Bubbles to document root, crosses all shadow boundaries. Becomes public API — namespace event names. |
|
|
59
|
+
| `false` | `true` | Uncommon. Does not bubble but crosses shadow boundary. |
|
|
60
|
+
|
|
61
|
+
- **Retargeting**: `Event.target` is retargeted at each shadow boundary to the host element.
|
|
62
|
+
- `Event.composedPath()` returns the full propagation path.
|
|
63
|
+
- Always use `CustomEvent` with a `detail` property for data payload.
|
|
64
|
+
- Event names: lowercase, no spaces, use hyphens if needed.
|
|
65
|
+
|
|
66
|
+
## Slot Rules
|
|
67
|
+
|
|
68
|
+
| Rule | Detail |
|
|
69
|
+
|------|--------|
|
|
70
|
+
| Unnamed slot | `<slot></slot>` — receives any unslotted child markup. One per component recommended. |
|
|
71
|
+
| Named slot | `<slot name="header"></slot>` — parent targets via `slot="header"`. `name` must be a static string. |
|
|
72
|
+
| Fallback content | Markup inside `<slot>` renders when no content is passed. |
|
|
73
|
+
| Ownership | Slotted content is owned by the **parent** (provider), not the component declaring the `<slot>`. |
|
|
74
|
+
| CSS | Parent styles apply to slotted content. Component styles do not pierce into slotted content. |
|
|
75
|
+
| DOM access | Slotted elements: `this.querySelector()`. Shadow elements: `this.template.querySelector()`. |
|
|
76
|
+
| `slotchange` event | Fires when direct children of a slot change. Does NOT fire for nested child changes. Bubbles but does not cross shadow boundary. |
|
|
77
|
+
| Aura interop | Cannot pass Aura components into LWC slots. |
|
|
78
|
+
| Conditional slots | Use `lwc:if` / `lwc:else` on `<template>` wrapping slots. Avoid deprecated `if:true`. |
|
|
79
|
+
| No ID selectors | IDs are transformed at render time; never use `querySelector('#id')` for slotted or shadow elements. |
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# Metadata Types — Salesforce Reference
|
|
2
|
+
|
|
3
|
+
> Source: <https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_types_list.htm>
|
|
4
|
+
> Registry: <https://github.com/forcedotcom/source-deploy-retrieve> (metadataRegistry.json)
|
|
5
|
+
> Last verified: API v66.0, Spring '26 (2026-03-28)
|
|
6
|
+
|
|
7
|
+
## Common Metadata Types
|
|
8
|
+
|
|
9
|
+
| package.xml Name | directoryName | suffix | inFolder | Wildcard (`*`) |
|
|
10
|
+
|---|---|---|---|---|
|
|
11
|
+
| ApexClass | classes | .cls | No | Yes |
|
|
12
|
+
| ApexTrigger | triggers | .trigger | No | Yes |
|
|
13
|
+
| ApexComponent | components | .component | No | Yes |
|
|
14
|
+
| ApexPage | pages | .page | No | Yes |
|
|
15
|
+
| AuraDefinitionBundle | aura | (bundle) | No | Yes |
|
|
16
|
+
| LightningComponentBundle | lwc | (bundle) | No | Yes |
|
|
17
|
+
| CustomObject | objects | .object | No | Yes |
|
|
18
|
+
| CustomField | fields | .field | No | No (child of CustomObject) |
|
|
19
|
+
| CustomMetadata | customMetadata | .md | No | Yes |
|
|
20
|
+
| CustomLabels | labels | .labels | No | Yes |
|
|
21
|
+
| CustomTab | tabs | .tab | No | Yes |
|
|
22
|
+
| CustomApplication | applications | .app | No | Yes |
|
|
23
|
+
| CustomPermission | customPermissions | .customPermission | No | Yes |
|
|
24
|
+
| Layout | layouts | .layout | No | Yes |
|
|
25
|
+
| CompactLayout | compactLayouts | .compactLayout | No | No (child of CustomObject) |
|
|
26
|
+
| FlexiPage | flexipages | .flexipage | No | Yes |
|
|
27
|
+
| Flow | flows | .flow | No | Yes |
|
|
28
|
+
| Profile | profiles | .profile | No | Yes |
|
|
29
|
+
| PermissionSet | permissionsets | .permissionset | No | Yes |
|
|
30
|
+
| PermissionSetGroup | permissionsetgroups | .permissionsetgroup | No | Yes |
|
|
31
|
+
| StaticResource | staticresources | .resource | No | Yes |
|
|
32
|
+
| Report | reports | .report | Yes | No (use folder paths) |
|
|
33
|
+
| Dashboard | dashboards | .dashboard | Yes | No (use folder paths) |
|
|
34
|
+
| Document | documents | (varies) | Yes | No (use folder paths) |
|
|
35
|
+
| EmailTemplate | email | .email | Yes | No (use folder paths) |
|
|
36
|
+
| Workflow | workflows | .workflow | No | Yes |
|
|
37
|
+
| ValidationRule | validationRules | .validationRule | No | No (child of CustomObject) |
|
|
38
|
+
| RecordType | recordTypes | .recordType | No | No (child of CustomObject) |
|
|
39
|
+
| ListView | listViews | .listView | No | No (child of CustomObject) |
|
|
40
|
+
| QuickAction | quickActions | .quickAction | No | Yes |
|
|
41
|
+
| GlobalValueSet | globalValueSets | .globalValueSet | No | Yes |
|
|
42
|
+
| StandardValueSet | standardValueSets | .standardValueSet | No | Yes |
|
|
43
|
+
| ConnectedApp | connectedApps | .connectedApp | No | Yes |
|
|
44
|
+
| RemoteSiteSetting | remoteSiteSettings | .remoteSite | No | Yes |
|
|
45
|
+
| NamedCredential | namedCredentials | .namedCredential | No | Yes |
|
|
46
|
+
| ExternalDataSource | dataSources | .dataSource | No | Yes |
|
|
47
|
+
| SharingRules | sharingRules | .sharingRules | No | No |
|
|
48
|
+
| AssignmentRules | assignmentRules | .assignmentRules | No | No |
|
|
49
|
+
| ApprovalProcess | approvalProcesses | .approvalProcess | No | Yes |
|
|
50
|
+
| ExperienceBundle | experiences | (bundle) | No | Yes |
|
|
51
|
+
| PlatformEventChannel | platformEventChannels | .platformEventChannel | No | Yes |
|
|
52
|
+
| PathAssistant | pathAssistants | .pathAssistant | No | Yes |
|
|
53
|
+
|
|
54
|
+
## Wildcard Rules
|
|
55
|
+
|
|
56
|
+
- **Yes** — `<members>*</members>` retrieves all components of that type.
|
|
57
|
+
- **No (child)** — child metadata (CustomField, ValidationRule, RecordType, ListView, CompactLayout) must be qualified: `ObjectName.FieldName`.
|
|
58
|
+
- **No (inFolder)** — folder-based types (Report, Dashboard, Document, EmailTemplate) require folder-qualified members: `FolderName` or `FolderName/ReportName`.
|
|
59
|
+
- **AssignmentRules / SharingRules / EscalationRules** — must specify the object: `Case`, `Lead`.
|
|
60
|
+
|
|
61
|
+
## Deployment Order (Recommended)
|
|
62
|
+
|
|
63
|
+
Deploy in this sequence to avoid reference errors:
|
|
64
|
+
|
|
65
|
+
| Order | Types | Reason |
|
|
66
|
+
|---|---|---|
|
|
67
|
+
| 1 | CustomObject, CustomField, GlobalValueSet, StandardValueSet, RecordType | Schema must exist before anything references it |
|
|
68
|
+
| 2 | CustomMetadata, CustomLabels, CustomPermission, CustomTab | Referenced by code and configuration |
|
|
69
|
+
| 3 | ApexClass (non-test) | Business logic depends on schema |
|
|
70
|
+
| 4 | ApexTrigger | Triggers depend on classes and schema |
|
|
71
|
+
| 5 | Flow, Workflow, ApprovalProcess, AssignmentRules, SharingRules | Automation depends on schema + classes |
|
|
72
|
+
| 6 | Layout, CompactLayout, FlexiPage, PathAssistant, QuickAction | UI depends on fields and actions |
|
|
73
|
+
| 7 | LightningComponentBundle, AuraDefinitionBundle, ApexPage, ApexComponent, StaticResource | UI components |
|
|
74
|
+
| 8 | Profile, PermissionSet, PermissionSetGroup | Access control references all of the above |
|
|
75
|
+
| 9 | Report, Dashboard, Document, EmailTemplate | Content depends on schema + access |
|
|
76
|
+
| 10 | ConnectedApp, NamedCredential, RemoteSiteSetting, ExternalDataSource | Integration config (often environment-specific) |
|
|
77
|
+
| 11 | ApexClass (test), ExperienceBundle | Tests and experiences deployed last |
|
|
78
|
+
|
|
79
|
+
## Bundle Types (No Single Suffix)
|
|
80
|
+
|
|
81
|
+
| Type | Directory | Contents |
|
|
82
|
+
|---|---|---|
|
|
83
|
+
| LightningComponentBundle | lwc/`componentName`/ | `.js`, `.html`, `.css`, `.js-meta.xml` |
|
|
84
|
+
| AuraDefinitionBundle | aura/`componentName`/ | `.cmp`, `.js`, `.css`, `.design`, `.svg`, `-meta.xml` |
|
|
85
|
+
| ExperienceBundle | experiences/`siteName`/ | Multiple config files and directories |
|
|
86
|
+
|
|
87
|
+
## package.xml Snippet
|
|
88
|
+
|
|
89
|
+
```xml
|
|
90
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
91
|
+
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
92
|
+
<types>
|
|
93
|
+
<members>*</members>
|
|
94
|
+
<name>ApexClass</name>
|
|
95
|
+
</types>
|
|
96
|
+
<types>
|
|
97
|
+
<members>*</members>
|
|
98
|
+
<name>ApexTrigger</name>
|
|
99
|
+
</types>
|
|
100
|
+
<types>
|
|
101
|
+
<members>*</members>
|
|
102
|
+
<name>CustomObject</name>
|
|
103
|
+
</types>
|
|
104
|
+
<types>
|
|
105
|
+
<members>MyFolder</members>
|
|
106
|
+
<members>MyFolder/MyReport</members>
|
|
107
|
+
<name>Report</name>
|
|
108
|
+
</types>
|
|
109
|
+
<types>
|
|
110
|
+
<members>Account.MyField__c</members>
|
|
111
|
+
<name>CustomField</name>
|
|
112
|
+
</types>
|
|
113
|
+
<version>66.0</version>
|
|
114
|
+
</Package>
|
|
115
|
+
```
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Naming Conventions — Salesforce Reference
|
|
2
|
+
|
|
3
|
+
> Last verified: API v66.0 (Spring '26)
|
|
4
|
+
> Source: Salesforce Apex Developer Guide + community standards
|
|
5
|
+
|
|
6
|
+
## Apex Naming
|
|
7
|
+
|
|
8
|
+
### Casing Rules
|
|
9
|
+
|
|
10
|
+
| Element | Casing | Example |
|
|
11
|
+
|---|---|---|
|
|
12
|
+
| Class names | PascalCase | `AccountService`, `OrderProcessor` |
|
|
13
|
+
| Interface names | PascalCase (prefix `I` optional) | `IAccountsSelector` |
|
|
14
|
+
| Method names | camelCase (start with verb) | `getActiveAccounts()`, `isEligible()` |
|
|
15
|
+
| Constants | UPPER_SNAKE_CASE | `MAX_RETRY_COUNT`, `STATUS_ACTIVE` |
|
|
16
|
+
| Variables / parameters | camelCase | `accountName`, `recordCount` |
|
|
17
|
+
| Instance fields | camelCase (no underscore prefix) | `private String accountName` |
|
|
18
|
+
| Enum values | UPPER_SNAKE_CASE | `Status.ACTIVE`, `Priority.HIGH` |
|
|
19
|
+
|
|
20
|
+
### Class Suffixes by Role
|
|
21
|
+
|
|
22
|
+
| Role | Suffix | Example |
|
|
23
|
+
|---|---|---|
|
|
24
|
+
| Service layer | `Service` | `AccountService` |
|
|
25
|
+
| Selector / data access | `Selector` | `AccountsSelector` |
|
|
26
|
+
| Domain / business logic | (object name, no suffix) | `Accounts` (FFLIB) |
|
|
27
|
+
| Trigger handler | `TriggerHandler` | `AccountTriggerHandler` |
|
|
28
|
+
| Batch job | `Batch` | `AccountAnnualReviewBatch` |
|
|
29
|
+
| Queueable job | `Job` or `Queueable` | `AccountProcessorJob` |
|
|
30
|
+
| Schedulable | `Scheduler` or `Schedule` | `AccountReviewScheduler` |
|
|
31
|
+
| Controller (LWC/Aura/VF) | `Controller` | `AccountPaginationController` |
|
|
32
|
+
| Test class | `Test` (suffix, not prefix) | `AccountServiceTest` |
|
|
33
|
+
| Exception | `Exception` | `AccountServiceException` |
|
|
34
|
+
| Utility / helper | `Util` or `Helper` | `StringUtil`, `QueryHelper` |
|
|
35
|
+
|
|
36
|
+
### Test Method Naming
|
|
37
|
+
|
|
38
|
+
Format: `test{MethodName}_{scenario}_{expectedResult}`
|
|
39
|
+
|
|
40
|
+
| Example | Pattern |
|
|
41
|
+
|---|---|
|
|
42
|
+
| `testCalculateDiscount_premiumTier_returns20Percent()` | Method + scenario + outcome |
|
|
43
|
+
| `testCreateAccount_duplicateName_throwsException()` | Method + edge case + error |
|
|
44
|
+
| `testProcessOrders_emptyList_noExceptionThrown()` | Method + boundary + success |
|
|
45
|
+
|
|
46
|
+
### Trigger Naming
|
|
47
|
+
|
|
48
|
+
One trigger per object: `{ObjectName}Trigger`
|
|
49
|
+
|
|
50
|
+
| Object | Trigger | Handler |
|
|
51
|
+
|---|---|---|
|
|
52
|
+
| Account | `AccountTrigger` | `AccountTriggerHandler` |
|
|
53
|
+
| Contact | `ContactTrigger` | `ContactTriggerHandler` |
|
|
54
|
+
| Opportunity | `OpportunityTrigger` | `OpportunityTriggerHandler` |
|
|
55
|
+
|
|
56
|
+
## LWC Naming
|
|
57
|
+
|
|
58
|
+
| Element | Convention | Example |
|
|
59
|
+
|---|---|---|
|
|
60
|
+
| Component folder | camelCase | `accountCard/` |
|
|
61
|
+
| Component files | Match folder name | `accountCard.js`, `accountCard.html` |
|
|
62
|
+
| HTML in markup | kebab-case with namespace | `<c-account-card>` |
|
|
63
|
+
| Properties | camelCase | `accountName`, `isLoading` |
|
|
64
|
+
| Event names | lowercase, no separators | `itemselected`, `recordchange` |
|
|
65
|
+
| CSS classes | kebab-case | `.account-header`, `.card-body` |
|
|
66
|
+
|
|
67
|
+
## Custom Object / Field Naming
|
|
68
|
+
|
|
69
|
+
| Element | Convention | Example |
|
|
70
|
+
|---|---|---|
|
|
71
|
+
| Custom object | PascalCase + `__c` | `Invoice__c`, `Order_Line_Item__c` |
|
|
72
|
+
| Custom field | PascalCase + `__c` | `Annual_Revenue__c`, `Is_Active__c` |
|
|
73
|
+
| Relationship name | PascalCase + `__r` | `Account__r`, `Primary_Contact__r` |
|
|
74
|
+
| Custom metadata type | PascalCase + `__mdt` | `Integration_Config__mdt` |
|
|
75
|
+
| Custom setting | PascalCase + `__c` | `Feature_Flags__c` |
|
|
76
|
+
| Platform event | PascalCase + `__e` | `Order_Status_Change__e` |
|
|
77
|
+
|
|
78
|
+
## General Rules
|
|
79
|
+
|
|
80
|
+
- Avoid abbreviations unless universally understood (`Id`, `URL`, `API`)
|
|
81
|
+
- No Hungarian notation (`strName`, `lstAccounts`)
|
|
82
|
+
- Boolean fields/methods: prefix with `is`, `has`, `can`, `should`
|
|
83
|
+
- Collections: use plural nouns (`accounts`, `contactsByAccountId`)
|
|
84
|
+
- Maps: name by pattern `{valueType}By{keyDescription}` (`accountById`, `contactsByAccountId`)
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
<!-- Source: https://developer.salesforce.com/docs/atlas.en-us.pkg2_dev.meta/pkg2_dev/sfdx_dev2gp.htm -->
|
|
2
|
+
<!-- Last verified: API v66.0 — 2026-03-29 -->
|
|
3
|
+
<!-- ⚠️ UNVERIFIED — Salesforce docs site returned JS-only content; facts sourced from Trailhead + skill knowledge -->
|
|
4
|
+
|
|
5
|
+
# Package Development — Salesforce Reference
|
|
6
|
+
|
|
7
|
+
## Package Types
|
|
8
|
+
|
|
9
|
+
| Type | Installable | Upgradeable | Namespace Required | IP Protected | Best For |
|
|
10
|
+
|---|---|---|---|---|---|
|
|
11
|
+
| Unmanaged | Yes | No | No | No | One-off sharing, templates, samples |
|
|
12
|
+
| Unlocked (2GP) | Yes | Yes | Optional | No | Internal modular orgs, team packages |
|
|
13
|
+
| Managed (2GP) | Yes | Yes | Yes | Yes | AppExchange ISV, commercial products |
|
|
14
|
+
| Managed (1GP) | Yes | Yes | Yes | Yes | Legacy AppExchange packages |
|
|
15
|
+
| Source (no package) | N/A | N/A | No | No | Direct org-to-org development |
|
|
16
|
+
|
|
17
|
+
## 1GP vs 2GP
|
|
18
|
+
|
|
19
|
+
| Aspect | 1GP (First-Generation) | 2GP (Second-Generation) |
|
|
20
|
+
|---|---|---|
|
|
21
|
+
| Version creation | Upload in packaging org UI | CLI: `sf package version create` |
|
|
22
|
+
| Dev Hub required | No | Yes |
|
|
23
|
+
| Scratch org development | Not natively supported | Full support |
|
|
24
|
+
| Source-driven | No | Yes |
|
|
25
|
+
| Dependency management | Manual | Declarative in `sfdx-project.json` |
|
|
26
|
+
| CI/CD automation | Limited | Full CLI automation |
|
|
27
|
+
|
|
28
|
+
## Salesforce ID Prefixes
|
|
29
|
+
|
|
30
|
+
| Object | Prefix | Example |
|
|
31
|
+
|---|---|---|
|
|
32
|
+
| Package (container) | `0Ho` | `0Ho5e000000XXXXX` |
|
|
33
|
+
| Package Version (installable) | `04t` | `04t5e000000XXXXX` |
|
|
34
|
+
| Subscriber Package | `033` | `0335e000000XXXXX` |
|
|
35
|
+
|
|
36
|
+
## Version Number Format
|
|
37
|
+
|
|
38
|
+
Format: `Major.Minor.Patch.Build`
|
|
39
|
+
|
|
40
|
+
| Component | Meaning | Example |
|
|
41
|
+
|---|---|---|
|
|
42
|
+
| Major | Breaking changes | `2.0.0.NEXT` |
|
|
43
|
+
| Minor | New features, backward-compatible | `1.3.0.NEXT` |
|
|
44
|
+
| Patch | Bug fixes | `1.3.1.NEXT` |
|
|
45
|
+
| Build | Auto-increment with `NEXT` or explicit integer | `1.0.0.NEXT` / `1.0.0.5` |
|
|
46
|
+
|
|
47
|
+
## Version Promotion States
|
|
48
|
+
|
|
49
|
+
| State | Install Targets | Transition |
|
|
50
|
+
|---|---|---|
|
|
51
|
+
| Beta (created, not promoted) | Scratch orgs, sandboxes, Developer Edition orgs | `sf package version create` |
|
|
52
|
+
| Released (promoted) | Production, sandboxes, any org | `sf package version promote` |
|
|
53
|
+
| Deprecated | Cannot be newly installed; remains in existing orgs | `sf package version update --deprecated` |
|
|
54
|
+
|
|
55
|
+
## Code Coverage Requirement
|
|
56
|
+
|
|
57
|
+
| Context | Minimum Coverage |
|
|
58
|
+
|---|---|
|
|
59
|
+
| Create version with `--code-coverage` | 75% Apex code coverage |
|
|
60
|
+
| Promote to released | Must have been created with `--code-coverage` passing |
|
|
61
|
+
| Install in production | Released version required (which requires 75% coverage) |
|
|
62
|
+
| Beta install (scratch/sandbox) | No coverage requirement |
|
|
63
|
+
|
|
64
|
+
## Namespace Rules
|
|
65
|
+
|
|
66
|
+
| Decision | Namespace? | When |
|
|
67
|
+
|---|---|---|
|
|
68
|
+
| AppExchange / commercial distribution | Yes (required) | Managed packages for external customers |
|
|
69
|
+
| IP protection needed | Yes | Obfuscated Apex in managed packages |
|
|
70
|
+
| Internal org modularity | No | Unlocked packages, simpler API names |
|
|
71
|
+
| No AppExchange plans | No | Avoids naming complexity |
|
|
72
|
+
|
|
73
|
+
### Namespace Impact on API Names
|
|
74
|
+
|
|
75
|
+
| Component Type | Without Namespace | With Namespace (`myns`) |
|
|
76
|
+
|---|---|---|
|
|
77
|
+
| Apex class | `AccountService` | `myns.AccountService` |
|
|
78
|
+
| Custom field | `Status__c` | `myns__Status__c` |
|
|
79
|
+
| Custom object | `Project__c` | `myns__Project__c` |
|
|
80
|
+
|
|
81
|
+
> **Irreversible:** Once a namespace is assigned to a managed package and a released version is created, the namespace is permanent.
|
|
82
|
+
|
|
83
|
+
## Managed Package Upgrade Constraints
|
|
84
|
+
|
|
85
|
+
| Action | Allowed After Release? |
|
|
86
|
+
|---|---|
|
|
87
|
+
| Add new fields (optional) | Yes |
|
|
88
|
+
| Add new Apex methods | Yes |
|
|
89
|
+
| Add new objects | Yes |
|
|
90
|
+
| Add new metadata | Yes |
|
|
91
|
+
| Delete fields or objects | **No** |
|
|
92
|
+
| Change field types | **No** |
|
|
93
|
+
| Remove `global` Apex methods | **No** |
|
|
94
|
+
| Change namespace | **No** |
|
|
95
|
+
| Add required fields | **Risky** — breaks subscribers creating records |
|
|
96
|
+
|
|
97
|
+
## Apex Visibility in Managed Packages
|
|
98
|
+
|
|
99
|
+
| Keyword | Subscriber Access |
|
|
100
|
+
|---|---|
|
|
101
|
+
| `global` | Fully accessible from subscriber Apex and Flows |
|
|
102
|
+
| `@namespaceAccessible` + `public` | Accessible from subscriber Apex only |
|
|
103
|
+
| `public` (no annotation) | Hidden from subscribers |
|
|
104
|
+
| `private` | Hidden; IP protected |
|
|
105
|
+
|
|
106
|
+
## Package CLI Commands
|
|
107
|
+
|
|
108
|
+
| Command | Purpose |
|
|
109
|
+
|---|---|
|
|
110
|
+
| `sf package create --name <n> --type Unlocked --path <dir> --no-namespace --target-dev-hub devhub` | Create package (one-time) |
|
|
111
|
+
| `sf package version create --package <n> --installation-key "$KEY" --code-coverage --wait 20 --target-dev-hub devhub` | Create beta version |
|
|
112
|
+
| `sf package version promote --package "<n>@1.0.0-1" --target-dev-hub devhub` | Promote to released |
|
|
113
|
+
| `sf package install --package "<n>@1.0.0-1" --installation-key "$KEY" --target-org <org> --wait 10` | Install in target org |
|
|
114
|
+
| `sf package version list --packages <n> --verbose --target-dev-hub devhub` | List all versions |
|
|
115
|
+
| `sf package installed list --target-org <org>` | List installed packages |
|
|
116
|
+
| `sf package install --security-type AdminsOnly` | Restrict to admin profiles |
|
|
117
|
+
| `sf package install --security-type AllUsers` | Grant to all profiles |
|
|
118
|
+
|
|
119
|
+
## sfdx-project.json Dependency Declaration
|
|
120
|
+
|
|
121
|
+
| Field | Purpose |
|
|
122
|
+
|---|---|
|
|
123
|
+
| `packageDirectories[].dependencies[]` | Array of `{ package, versionNumber }` |
|
|
124
|
+
| `packageAliases` | Map: alias name to `0Ho` (package) or `04t` (version) ID |
|
|
125
|
+
| `versionNumber` in dependency | Use `X.Y.Z.LATEST` to pick latest build of that version |
|
|
126
|
+
|
|
127
|
+
Dependencies must be installed in dependency order (base packages first). No `--all` flag exists.
|
|
128
|
+
|
|
129
|
+
## Package Architecture Best Practice
|
|
130
|
+
|
|
131
|
+
| Pattern | Components | Layer |
|
|
132
|
+
|---|---|---|
|
|
133
|
+
| Shared Utilities | ~30 | Base (no dependencies) |
|
|
134
|
+
| Sales Core | ~80 | Depends on Shared Utilities |
|
|
135
|
+
| Service Core | ~60 | Depends on Shared Utilities |
|
|
136
|
+
| Integrations | ~40 | Depends on Sales Core + Service Core |
|
|
137
|
+
|
|
138
|
+
Smaller packages = faster version creation, independent deployment, clear ownership.
|
|
139
|
+
|
|
140
|
+
## Subscriber Testing Workflow
|
|
141
|
+
|
|
142
|
+
| Step | Command / Action |
|
|
143
|
+
|---|---|
|
|
144
|
+
| 1. Install beta in scratch org | `sf package install --package "04t..." --target-org myScratch --wait 20` |
|
|
145
|
+
| 2. Run all tests | `sf apex run test --test-level RunAllTestsInOrg --code-coverage --target-org myScratch` |
|
|
146
|
+
| 3. Verify >= 75% coverage | Check test results |
|
|
147
|
+
| 4. Promote | `sf package version promote --package "<name>@X.Y.Z-N" --target-dev-hub devhub` |
|
|
148
|
+
| 5. Install in subscriber sandbox | `sf package install --package "<name>@X.Y.Z-N" --target-org subscriber-sandbox --wait 30` |
|
|
149
|
+
| 6. Run subscriber tests | `sf apex run test --test-level RunLocalTests --target-org subscriber-sandbox` |
|
|
150
|
+
| 7. Install in production | `sf package install --package "<name>@X.Y.Z-N" --target-org production --wait 30` |
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# Platform Events & CDC — Reference
|
|
2
|
+
|
|
3
|
+
> Source: <https://developer.salesforce.com/docs/atlas.en-us.platform_events.meta/platform_events/platform_event_limits.htm>
|
|
4
|
+
> Source: <https://developer.salesforce.com/docs/atlas.en-us.change_data_capture.meta/change_data_capture/cdc_allocations.htm>
|
|
5
|
+
> Last verified: API v66.0, Spring '26 (2026-03-28)
|
|
6
|
+
|
|
7
|
+
## Platform Event Definitions
|
|
8
|
+
|
|
9
|
+
| Allocation | DE | EE / PE+API | UE / Perf |
|
|
10
|
+
|---|---|---|---|
|
|
11
|
+
| Max event definitions per org | 5 | 50 | 100 |
|
|
12
|
+
| Max event message size | 1 MB | 1 MB | 1 MB |
|
|
13
|
+
| Max concurrent CometD clients (all event types) | 20 | 1,000 | 2,000 |
|
|
14
|
+
| Max flows/processes subscribing to a PE | 4,000 | 4,000 | 4,000 |
|
|
15
|
+
| Max **active** flows/processes subscribing | 2,000 | 2,000 | 2,000 |
|
|
16
|
+
| Custom channels (PE, excl. RTEM) | 100 | 100 | 100 |
|
|
17
|
+
| Custom channels (CDC) | 100 | 100 | 100 |
|
|
18
|
+
| Distinct PE per channel | 5 | 50 | 50 |
|
|
19
|
+
|
|
20
|
+
## Publishing Allocations (per hour, rolling)
|
|
21
|
+
|
|
22
|
+
| Allocation | DE | EE / PE+API | UE / Perf |
|
|
23
|
+
|---|---|---|---|
|
|
24
|
+
| Event publishing (all methods) | 50,000 | 250,000 | 250,000 |
|
|
25
|
+
| With add-on license | +25,000 | +25,000 | +25,000 |
|
|
26
|
+
|
|
27
|
+
Applies to: Apex `EventBus.publish()`, Pub/Sub API, REST/SOAP API, Bulk API, Flows, Process Builder. Exceeding returns `LIMIT_EXCEEDED`.
|
|
28
|
+
|
|
29
|
+
## Delivery Allocations (per 24h, rolling)
|
|
30
|
+
|
|
31
|
+
| Allocation | DE | EE / PE+API | UE / Perf |
|
|
32
|
+
|---|---|---|---|
|
|
33
|
+
| Event delivery (shared PE + CDC) | 10,000 | 25,000 | 50,000 |
|
|
34
|
+
| With add-on license | +100,000/day (3M/month entitlement) | same | same |
|
|
35
|
+
|
|
36
|
+
Applies to: Pub/Sub API, CometD, empApi LWC, Event Relays. **Does NOT apply to**: Apex triggers, Flows, Process Builder -- these have no delivery cap.
|
|
37
|
+
|
|
38
|
+
## Event Retention
|
|
39
|
+
|
|
40
|
+
| Event Type | Retention |
|
|
41
|
+
|---|---|
|
|
42
|
+
| High-volume platform events (default since Spring '19) | **72 hours** |
|
|
43
|
+
| Legacy standard-volume events (API v44.0 and earlier) | 24 hours (retiring Summer '27) |
|
|
44
|
+
| Change Data Capture events | **72 hours** |
|
|
45
|
+
|
|
46
|
+
Subscribers replay missed events via Replay ID within the retention window. Replay IDs are not guaranteed contiguous. After org migration or sandbox refresh, pre-activity Replay IDs are invalid.
|
|
47
|
+
|
|
48
|
+
## EventBus.publish() Behavior
|
|
49
|
+
|
|
50
|
+
| Publish Behavior Setting | Transaction | Rollback | Governor Limit |
|
|
51
|
+
|---|---|---|---|
|
|
52
|
+
| **Publish Immediately** (default) | Independent of DML transaction | Cannot roll back | 150 `EventBus.publish()` calls (separate limit) |
|
|
53
|
+
| **Publish After Commit** | Honors transaction boundary | Supports `Database.setSavepoint()` / `rollback()` | Counts as DML statement (against 150 DML limit) |
|
|
54
|
+
|
|
55
|
+
- Publishing is **asynchronous** -- `Database.SaveResult.isSuccess()` = true means enqueued, not delivered.
|
|
56
|
+
- Status code `OPERATION_ENQUEUED` returned on success.
|
|
57
|
+
- Publish behavior setting does **not** apply to Pub/Sub API publishes.
|
|
58
|
+
- `allOrNone` header is ignored for Publish Immediately; respected for initial enqueue of Publish After Commit.
|
|
59
|
+
|
|
60
|
+
## Apex Publish Callbacks
|
|
61
|
+
|
|
62
|
+
- Implement `EventBus.EventPublishFailureCallback` and/or `EventBus.EventPublishSuccessCallback`.
|
|
63
|
+
- Pass callback instance as second arg: `EventBus.publish(eventList, callbackInstance)`.
|
|
64
|
+
- Callback runs under **Automated Process** user.
|
|
65
|
+
- Limit: 5 MB cumulative callback usage in last 30 minutes; max 10 callback invocations per publish.
|
|
66
|
+
|
|
67
|
+
## Pub/Sub API Allocations
|
|
68
|
+
|
|
69
|
+
| Allocation | Value |
|
|
70
|
+
|---|---|
|
|
71
|
+
| Max event message size | 1 MB |
|
|
72
|
+
| Max PublishRequest payload | 4 MB (recommend < 3 MB) |
|
|
73
|
+
| Recommended events per publish request | 200 |
|
|
74
|
+
| Max events per FetchRequest | 100 |
|
|
75
|
+
| Max managed subscriptions per org | 200 |
|
|
76
|
+
| Max concurrent gRPC streams per channel | 1,000 |
|
|
77
|
+
|
|
78
|
+
## Change Data Capture (CDC)
|
|
79
|
+
|
|
80
|
+
### CDC Entity Selection Limits
|
|
81
|
+
|
|
82
|
+
| Allocation | DE | EE | UE / Perf |
|
|
83
|
+
|---|---|---|---|
|
|
84
|
+
| Max selected entities (all channels combined) | 5 | 5 | 5 |
|
|
85
|
+
| With add-on license | No limit | No limit | No limit |
|
|
86
|
+
| Max custom channels | 100 | 100 | 100 |
|
|
87
|
+
|
|
88
|
+
CDC is available for **all custom objects** and a **subset of standard objects** (Account, Contact, Lead, Opportunity, Case, Task, Event, User, Order, Product2, Pricebook2, PricebookEntry, and others -- see Object Reference for full list).
|
|
89
|
+
|
|
90
|
+
### CDC Event Types
|
|
91
|
+
|
|
92
|
+
| changeType | Meaning |
|
|
93
|
+
|---|---|
|
|
94
|
+
| `CREATE`, `UPDATE`, `DELETE`, `UNDELETE` | Normal change events with full field data |
|
|
95
|
+
| `GAP_CREATE`, `GAP_UPDATE`, `GAP_DELETE`, `GAP_UNDELETE` | Header only, no field data -- retrieve record via ID |
|
|
96
|
+
| `GAP_OVERFLOW` | Single transaction exceeded 100,000 changes; one overflow event per entity type |
|
|
97
|
+
|
|
98
|
+
Gap events are caused by: event > 1 MB, field type conversions, internal errors, or database-level changes outside app server transactions.
|
|
99
|
+
|
|
100
|
+
### Overflow Threshold
|
|
101
|
+
|
|
102
|
+
First 100,000 changes in a single transaction produce normal change events. Beyond that, one overflow event per entity type. Each field change in an update counts separately toward the 100K threshold.
|
|
103
|
+
|
|
104
|
+
## Testing Patterns
|
|
105
|
+
|
|
106
|
+
| Method | Purpose |
|
|
107
|
+
|---|---|
|
|
108
|
+
| `Test.getEventBus().deliver()` | Deliver queued test events to subscribers (triggers, flows) |
|
|
109
|
+
| `Test.getEventBus().fail()` | Simulate publish failure -- invokes `onFailure()` callback |
|
|
110
|
+
| `Test.enableChangeDataCapture()` | Enable CDC in test context for all entities |
|
|
111
|
+
| `Test.startTest()` / `Test.stopTest()` | Events delivered after `stopTest()` |
|
|
112
|
+
|
|
113
|
+
- Test event bus is **separate** from production event bus.
|
|
114
|
+
- Test publish limit: **500 events per test method**.
|
|
115
|
+
- Replay IDs reset to 0 in test context.
|
|
116
|
+
- `EventBusSubscriber.Position` and `.Tip` reset to 0 in test context.
|
|
117
|
+
- Apex triggers, flows, processes fire in test context; CometD/Pub/Sub API subscribers do **not**.
|
|
118
|
+
|
|
119
|
+
## Apex Trigger Batch Size
|
|
120
|
+
|
|
121
|
+
Platform event and CDC triggers receive up to **2,000 records per batch** (vs. 200 for standard DML triggers). Use `EventBus.TriggerContext.currentContext().setResumeCheckpoint(replayId)` to checkpoint and resume on failure. Throw `EventBus.RetryableException` to retry from last checkpoint.
|