├── .eslintignore ├── .forceignore ├── .github ├── ISSUE_TEMPLATE │ ├── bug-report.yml │ └── feature-request.yml ├── dependabot.yml └── workflows │ ├── ci-pr.yml │ ├── ci.yml │ ├── dependabot-approve-and-auto-merge.yml │ ├── new-issue-welcome.yml │ ├── packaging-pr.yml │ └── packaging.yml ├── .gitignore ├── .husky └── pre-commit ├── .idea ├── .gitignore ├── ApexKit.iml ├── codeStyles │ ├── Project.xml │ └── codeStyleConfig.xml ├── dictionaries │ └── project.xml ├── git_toolbox_blame.xml ├── git_toolbox_prj.xml ├── illuminatedCloud.xml ├── inspectionProfiles │ └── Project_Default.xml ├── libraries │ └── ApexKit_lwc_types.xml ├── misc.xml ├── modules.xml ├── prettier.xml └── vcs.xml ├── .prettierignore ├── .prettierrc ├── .vscode ├── extensions.json ├── launch.json └── settings.json ├── CLAUDE.md ├── IlluminatedCloud ├── Apexkit │ └── OfflineSymbolTable.zip └── ApexkitV2_5 │ └── OfflineSymbolTable.zip ├── LICENSE.md ├── README.md ├── apexdox.yml ├── bin └── generate-apex-docs.sh ├── config ├── Apexkit-scratch-def.json ├── ApexkitV2_5-scratch-def.json └── project-scratch-def.json ├── data ├── Accounts.json ├── Contacts.json └── apexkit-data-plan.json ├── doc-assets ├── README.md ├── SetupApexDox.sh ├── files │ ├── README.md │ └── main.html ├── highlight.js └── styling.css ├── docs ├── AsyncRestClient.md ├── AsyncRestLibFinalizer.md ├── BaseRepo.md ├── BaseRepoTests.md ├── CachePartitionType.md ├── CanTheUser.md ├── CanTheUserTests.md ├── CrudType.md ├── CustomMetadataUtilDeployCallbackTests.md ├── CustomMetadataUtilDeploymentCallback.md ├── CustomMetadataUtilities.md ├── CustomMetadataUtilitiesTests.md ├── EnqueueNextQueueableProcessStep.md ├── ExampleQueueableProcessSteps.md ├── FF.md ├── FLSType.md ├── FailsafeExceptionHandler.md ├── FailsafeExceptionHandlerTests.md ├── FeatureFlag.md ├── FeatureFlagCommonTests.md ├── FeatureFlagDataProvider.md ├── FeatureFlagDataProviderTests.md ├── FeatureFlagTests.md ├── FieldSelection.md ├── HttpCalloutMockFactory.md ├── HttpVerb.md ├── IdFactory.md ├── InvokeMetadataDrivenTriggerFramework.md ├── Log.md ├── LogException.md ├── LogMessage.md ├── LogTests.md ├── LogTriggerHandler.md ├── MetadataTriggerFramework.md ├── MetadataTriggerFrameworkException.md ├── MetadataTriggerFrameworkTests.md ├── MetadataTriggerQueryService.md ├── MetadataTriggerQueryServiceTests.md ├── MethodSignature.md ├── MockedMethod.md ├── OrgShape.md ├── OrgShapeTests.md ├── Ouroboros.md ├── OuroborosFinalizer.md ├── OuroborosTests.md ├── Polyfills.md ├── PolyfillsTests.md ├── Query.md ├── QueryTest.md ├── QueueableProcess.md ├── QueueableProcessDataProvider.md ├── QueueableProcessMockDataProvider.md ├── QueueableProcessTests.md ├── QuiddityGuard.md ├── QuiddityGuardTests.md ├── RestClient.md ├── RestClientLib.md ├── RestLib.md ├── RestLibApiCall.md ├── RestLibTests.md ├── SOQL.md ├── SOQLAgregate.md ├── SOQLAgregateTest.md ├── SOQLTest.md ├── SOSL.md ├── SOSLTest.md ├── Safely.md ├── SafelyTests.md ├── SampleHandler.md ├── Stub.md ├── StubUtilities.md ├── TestFactory.md ├── TestPolyfills.md ├── TriggerContext.md ├── TriggerFramework.md ├── TriggerFrameworkException.md ├── TriggerFrameworkLoopCount.md ├── TriggerFrameworkTests.md ├── ULID.md ├── ULIDTests.md └── home.md ├── force-app └── main │ ├── Universal Flow Invocable │ ├── classes │ │ ├── BulkCallable.cls │ │ ├── BulkCallable.cls-meta.xml │ │ ├── CustomInvocable.cls │ │ ├── CustomInvocable.cls-meta.xml │ │ ├── UFInvocable.cls │ │ ├── UFInvocable.cls-meta.xml │ │ ├── UniversalBulkInvocable.cls │ │ ├── UniversalBulkInvocable.cls-meta.xml │ │ ├── UniversalFlowInputOutput.cls │ │ ├── UniversalFlowInputOutput.cls-meta.xml │ │ ├── UniversalFlowInputOutputParameter.cls │ │ ├── UniversalFlowInputOutputParameter.cls-meta.xml │ │ ├── UniversalInvocable.cls │ │ └── UniversalInvocable.cls-meta.xml │ └── flows │ │ ├── Demo_Dynamic_Apex_Actions.flow-meta.xml │ │ ├── Update_Description.flow-meta.xml │ │ └── testflow.flow-meta.xml │ └── default │ ├── applications │ ├── standard__LightningSales.app-meta.xml │ └── standard__Service.app-meta.xml │ ├── aura │ └── .eslintrc.json │ ├── cachePartitions │ └── default.cachePartition-meta.xml │ ├── classes │ ├── Repository │ │ ├── BaseRepo.cls │ │ ├── BaseRepo.cls-meta.xml │ │ ├── BaseRepoTests.cls │ │ └── BaseRepoTests.cls-meta.xml │ ├── ULID │ │ ├── README.md │ │ ├── ULID.cls │ │ ├── ULID.cls-meta.xml │ │ └── tests │ │ │ ├── ULIDTests.cls │ │ │ └── ULIDTests.cls-meta.xml │ ├── custom metadata tools │ │ ├── CustomMetadataUtilDeploymentCallback.cls │ │ ├── CustomMetadataUtilDeploymentCallback.cls-meta.xml │ │ ├── CustomMetadataUtilities.cls │ │ ├── CustomMetadataUtilities.cls-meta.xml │ │ └── tests │ │ │ ├── CustomMetadataUtilDeployCallbackTests.cls │ │ │ ├── CustomMetadataUtilDeployCallbackTests.cls-meta.xml │ │ │ ├── CustomMetadataUtilitiesTests.cls │ │ │ └── CustomMetadataUtilitiesTests.cls-meta.xml │ ├── feature flags │ │ ├── FF.cls │ │ ├── FF.cls-meta.xml │ │ ├── FeatureFlag.cls │ │ ├── FeatureFlag.cls-meta.xml │ │ ├── FeatureFlagDataProvider.cls │ │ ├── FeatureFlagDataProvider.cls-meta.xml │ │ └── tests │ │ │ ├── FeatureFlagCommonTests.cls │ │ │ ├── FeatureFlagCommonTests.cls-meta.xml │ │ │ ├── FeatureFlagDataProviderTests.cls │ │ │ ├── FeatureFlagDataProviderTests.cls-meta.xml │ │ │ ├── FeatureFlagTests.cls │ │ │ └── FeatureFlagTests.cls-meta.xml │ ├── log │ │ ├── Examples │ │ │ └── readme.md │ │ ├── Log.cls │ │ ├── Log.cls-meta.xml │ │ ├── LogException.cls │ │ ├── LogException.cls-meta.xml │ │ ├── LogMessage.cls │ │ ├── LogMessage.cls-meta.xml │ │ ├── LogTriggerHandler.cls │ │ ├── LogTriggerHandler.cls-meta.xml │ │ └── tests │ │ │ ├── LogTests.cls │ │ │ └── LogTests.cls-meta.xml │ ├── orgShape │ │ ├── CachePartitionType.cls │ │ ├── CachePartitionType.cls-meta.xml │ │ ├── OrgShape.cls │ │ ├── OrgShape.cls-meta.xml │ │ └── tests │ │ │ ├── OrgShapeTests.cls │ │ │ └── OrgShapeTests.cls-meta.xml │ ├── ouroboros │ │ ├── Ouroboros.cls │ │ ├── Ouroboros.cls-meta.xml │ │ ├── OuroborosFinalizer.cls │ │ ├── OuroborosFinalizer.cls-meta.xml │ │ └── tests │ │ │ ├── OuroborosTests.cls │ │ │ └── OuroborosTests.cls-meta.xml │ ├── polyfills │ │ ├── FailsafeExceptionHandler.cls │ │ ├── FailsafeExceptionHandler.cls-meta.xml │ │ ├── Polyfills.cls │ │ ├── Polyfills.cls-meta.xml │ │ └── tests │ │ │ ├── FailsafeExceptionHandlerTests.cls │ │ │ ├── FailsafeExceptionHandlerTests.cls-meta.xml │ │ │ ├── PolyfillsTests.cls │ │ │ ├── PolyfillsTests.cls-meta.xml │ │ │ ├── TestPolyfills.cls │ │ │ └── TestPolyfills.cls-meta.xml │ ├── query lib │ │ ├── FieldSelection.cls │ │ ├── FieldSelection.cls-meta.xml │ │ ├── Query.cls │ │ ├── Query.cls-meta.xml │ │ ├── SOQL.cls │ │ ├── SOQL.cls-meta.xml │ │ ├── SOQLAgregate.cls │ │ ├── SOQLAgregate.cls-meta.xml │ │ ├── SOSL.cls │ │ ├── SOSL.cls-meta.xml │ │ └── tests │ │ │ ├── QueryTest.cls │ │ │ ├── QueryTest.cls-meta.xml │ │ │ ├── SOQLAgregateTest.cls │ │ │ ├── SOQLAgregateTest.cls-meta.xml │ │ │ ├── SOQLTest.cls │ │ │ ├── SOQLTest.cls-meta.xml │ │ │ ├── SOSLTest.cls │ │ │ └── SOSLTest.cls-meta.xml │ ├── queueable process │ │ ├── EnqueueNextQueueableProcessStep.cls │ │ ├── EnqueueNextQueueableProcessStep.cls-meta.xml │ │ ├── QueueableProcess.cls │ │ ├── QueueableProcess.cls-meta.xml │ │ ├── QueueableProcessDataProvider.cls │ │ ├── QueueableProcessDataProvider.cls-meta.xml │ │ ├── QueueableProcessMockDataProvider.cls │ │ ├── QueueableProcessMockDataProvider.cls-meta.xml │ │ ├── README.md │ │ └── tests │ │ │ ├── ExampleQueueableProcessSteps.cls │ │ │ ├── ExampleQueueableProcessSteps.cls-meta.xml │ │ │ ├── QueueableProcessTests.cls │ │ │ └── QueueableProcessTests.cls-meta.xml │ ├── quiddity │ │ ├── QuiddityGuard.cls │ │ ├── QuiddityGuard.cls-meta.xml │ │ └── tests │ │ │ ├── QuiddityGuardTests.cls │ │ │ └── QuiddityGuardTests.cls-meta.xml │ ├── rest lib │ │ ├── AsyncRestClient.cls │ │ ├── AsyncRestClient.cls-meta.xml │ │ ├── AsyncRestLibFinalizer.cls │ │ ├── AsyncRestLibFinalizer.cls-meta.xml │ │ ├── HttpVerb.cls │ │ ├── HttpVerb.cls-meta.xml │ │ ├── RestClient.cls │ │ ├── RestClient.cls-meta.xml │ │ ├── RestClientLib.cls │ │ ├── RestClientLib.cls-meta.xml │ │ ├── RestLib.cls │ │ ├── RestLib.cls-meta.xml │ │ ├── RestLibApiCall.cls │ │ ├── RestLibApiCall.cls-meta.xml │ │ └── tests │ │ │ ├── RestLibTests.cls │ │ │ └── RestLibTests.cls-meta.xml │ ├── safely │ │ ├── CanTheUser.cls │ │ ├── CanTheUser.cls-meta.xml │ │ ├── CrudType.cls │ │ ├── CrudType.cls-meta.xml │ │ ├── FLSType.cls │ │ ├── FLSType.cls-meta.xml │ │ ├── Safely.cls │ │ ├── Safely.cls-meta.xml │ │ └── tests │ │ │ ├── CanTheUserTests.cls │ │ │ ├── CanTheUserTests.cls-meta.xml │ │ │ ├── SafelyTests.cls │ │ │ └── SafelyTests.cls-meta.xml │ ├── test utilities │ │ ├── CustomAssert.cls │ │ ├── CustomAssert.cls-meta.xml │ │ ├── HttpCalloutMockFactory.cls │ │ ├── HttpCalloutMockFactory.cls-meta.xml │ │ ├── IdFactory.cls │ │ ├── IdFactory.cls-meta.xml │ │ ├── MethodSignature.cls │ │ ├── MethodSignature.cls-meta.xml │ │ ├── MockedMethod.cls │ │ ├── MockedMethod.cls-meta.xml │ │ ├── ParameterMatcher.cls │ │ ├── ParameterMatcher.cls-meta.xml │ │ ├── ParameterMatcherTest.cls │ │ ├── ParameterMatcherTest.cls-meta.xml │ │ ├── ParameterMatcherTestClass.cls │ │ ├── ParameterMatcherTestClass.cls-meta.xml │ │ ├── PermissionsHelper.cls │ │ ├── PermissionsHelper.cls-meta.xml │ │ ├── SObjectFactory.cls │ │ ├── SObjectFactory.cls-meta.xml │ │ ├── SObjectFactoryDefaults.cls │ │ ├── SObjectFactoryDefaults.cls-meta.xml │ │ ├── SObjectFactoryHelper.cls │ │ ├── SObjectFactoryHelper.cls-meta.xml │ │ ├── SObjectFactoryTests.cls │ │ ├── SObjectFactoryTests.cls-meta.xml │ │ ├── SomeDefaultsClass.cls │ │ ├── SomeDefaultsClass.cls-meta.xml │ │ ├── Stub.cls │ │ ├── Stub.cls-meta.xml │ │ ├── StubUtilities.cls │ │ ├── StubUtilities.cls-meta.xml │ │ ├── UserFactory.cls │ │ ├── UserFactory.cls-meta.xml │ │ ├── UserFactoryHelper.cls │ │ └── UserFactoryHelper.cls-meta.xml │ └── trigger framework │ │ ├── InvokeMetadataDrivenTriggerFramework.cls │ │ ├── InvokeMetadataDrivenTriggerFramework.cls-meta.xml │ │ ├── MetadataTriggerFramework.cls │ │ ├── MetadataTriggerFramework.cls-meta.xml │ │ ├── MetadataTriggerFrameworkException.cls │ │ ├── MetadataTriggerFrameworkException.cls-meta.xml │ │ ├── MetadataTriggerFrameworkTests.cls │ │ ├── MetadataTriggerFrameworkTests.cls-meta.xml │ │ ├── MetadataTriggerQueryService.cls │ │ ├── MetadataTriggerQueryService.cls-meta.xml │ │ ├── MetadataTriggerQueryServiceTests.cls │ │ ├── MetadataTriggerQueryServiceTests.cls-meta.xml │ │ ├── TriggerContext.cls │ │ ├── TriggerContext.cls-meta.xml │ │ ├── TriggerFramework.cls │ │ ├── TriggerFramework.cls-meta.xml │ │ ├── TriggerFrameworkException.cls │ │ ├── TriggerFrameworkException.cls-meta.xml │ │ ├── TriggerFrameworkLoopCount.cls │ │ ├── TriggerFrameworkLoopCount.cls-meta.xml │ │ └── tests │ │ ├── SampleHandler.cls │ │ ├── SampleHandler.cls-meta.xml │ │ ├── TriggerFrameworkTests.cls │ │ └── TriggerFrameworkTests.cls-meta.xml │ ├── customMetadata │ ├── Feature_Flag.test.md-meta.xml │ └── Feature_Flag_Enabled_For.test.md-meta.xml │ ├── customPermissions │ └── ApexKit_Example.customPermission-meta.xml │ ├── flexipages │ └── Log_Event_Record_Page.flexipage-meta.xml │ ├── layouts │ ├── FF_Enabled_For_Custom_Permission__mdt-FF Enabled For Custom Permission Layout.layout-meta.xml │ ├── Feature_Flag_Enabled_For__mdt-Feature Flag Enabled For Layout.layout-meta.xml │ ├── Feature_Flag__mdt-Feature Flag Layout.layout-meta.xml │ └── LogEvent__c-Log Event Layout.layout-meta.xml │ ├── lwc │ └── .eslintrc.json │ ├── objects │ ├── Disabled_For__mdt │ │ ├── Disabled_For__mdt.object-meta.xml │ │ └── fields │ │ │ ├── Metadata_Driven_Trigger__c.field-meta.xml │ │ │ └── User_Email__c.field-meta.xml │ ├── FF_Enabled_For_Custom_Permission__mdt │ │ ├── FF_Enabled_For_Custom_Permission__mdt.object-meta.xml │ │ └── fields │ │ │ └── Feature_Flag__c.field-meta.xml │ ├── Feature_Flag_Enabled_For__mdt │ │ ├── Feature_Flag_Enabled_For__mdt.object-meta.xml │ │ └── fields │ │ │ ├── Feature_Flag__c.field-meta.xml │ │ │ ├── Permission_Set_Id__c.field-meta.xml │ │ │ └── isEnabled__c.field-meta.xml │ ├── Feature_Flag__mdt │ │ ├── Feature_Flag__mdt.object-meta.xml │ │ └── fields │ │ │ ├── Flag_Value__c.field-meta.xml │ │ │ ├── isEnabled_After__c.field-meta.xml │ │ │ └── isEnabled__c.field-meta.xml │ ├── LogEvent__c │ │ ├── LogEvent__c.object-meta.xml │ │ ├── fields │ │ │ ├── Log_Data__c.field-meta.xml │ │ │ ├── Quiddity__c.field-meta.xml │ │ │ ├── Request_Id__c.field-meta.xml │ │ │ └── Severity__c.field-meta.xml │ │ └── listViews │ │ │ ├── All.listView-meta.xml │ │ │ └── All1.listView-meta.xml │ ├── Log__e │ │ ├── Log__e.object-meta.xml │ │ └── fields │ │ │ ├── Log_Message__c.field-meta.xml │ │ │ ├── Quiddity__c.field-meta.xml │ │ │ ├── Request_Id__c.field-meta.xml │ │ │ └── Severity__c.field-meta.xml │ ├── Metadata_Driven_Trigger__mdt │ │ ├── Metadata_Driven_Trigger__mdt.object-meta.xml │ │ └── fields │ │ │ ├── Class__c.field-meta.xml │ │ │ ├── Enabled__c.field-meta.xml │ │ │ ├── Execution_Order__c.field-meta.xml │ │ │ └── Object__c.field-meta.xml │ └── Opportunity │ │ └── listViews │ │ └── Default_Opportunity_Pipeline.listView-meta.xml │ ├── permissionsets │ └── Async_Log_Access.permissionset-meta.xml │ ├── tabs │ └── LogEvent__c.tab-meta.xml │ └── triggers │ ├── Log.trigger │ └── Log.trigger-meta.xml ├── jest.config.js ├── package-lock.json ├── package.json ├── pmd └── ruleset.xml ├── scripts └── orginit.sh └── sfdx-project.json /.eslintignore: -------------------------------------------------------------------------------- 1 | **/lwc/**/*.css 2 | **/lwc/**/*.html 3 | **/lwc/**/*.json 4 | **/lwc/**/*.svg 5 | **/lwc/**/*.xml 6 | **/aura/**/*.auradoc 7 | **/aura/**/*.cmp 8 | **/aura/**/*.css 9 | **/aura/**/*.design 10 | **/aura/**/*.evt 11 | **/aura/**/*.json 12 | **/aura/**/*.svg 13 | **/aura/**/*.tokens 14 | **/aura/**/*.xml 15 | **/aura/**/*.app 16 | .sfdx 17 | -------------------------------------------------------------------------------- /.forceignore: -------------------------------------------------------------------------------- 1 | # List files or directories below to ignore them when running force:source:push, force:source:pull, and force:source:status 2 | # More information: https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_exclude_source.htm 3 | # 4 | 5 | package.xml 6 | 7 | # LWC configuration files 8 | **/jsconfig.json 9 | **/.eslintrc.json 10 | 11 | # LWC Jest 12 | **/__tests__/** 13 | force-app/main/default/profiles/* 14 | 15 | # Added by Illuminated Cloud 16 | /.illuminatedCloud/ 17 | **/*.ts 18 | **/tsconfig*.json 19 | **/*.tsbuildinfo 20 | **/eslint.config.mjs -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug-report.yml: -------------------------------------------------------------------------------- 1 | name: Bug Report 2 | description: File a bug report 3 | labels: ['bug'] 4 | body: 5 | - type: markdown 6 | attributes: 7 | value: | 8 | **NOTICE:** Please use this form only for reporting bugs in ApexKit itself. 9 | - type: textarea 10 | attributes: 11 | label: Summary 12 | description: Short narative of what is going on 13 | validations: 14 | required: true 15 | - type: dropdown 16 | id: orgType 17 | attributes: 18 | label: Salesforce Org Type 19 | description: What type of Salesforce org are you deploying to? 20 | options: 21 | - Scratch Org 22 | - Developer Edition Org 23 | - Trailhead Playground 24 | - Sandbox 25 | - Production Org 26 | validations: 27 | required: true 28 | - type: textarea 29 | attributes: 30 | label: Steps To Reproduce 31 | description: Steps to reproduce the issue. 32 | placeholder: | 33 | 1. In this environment... 34 | 2. With this config... 35 | 3. Run '...' 36 | validations: 37 | required: false 38 | - type: textarea 39 | attributes: 40 | label: Current Behavior 41 | description: A concise description of what you're experiencing. 42 | validations: 43 | required: false 44 | - type: textarea 45 | attributes: 46 | label: Expected Behavior 47 | description: A concise description of what you expected to happen. 48 | validations: 49 | required: false 50 | - type: textarea 51 | id: logs 52 | attributes: 53 | label: Relevant Log Output 54 | description: Please copy and paste any relevant log output. This will be automatically formatted into code. 55 | render: sh 56 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature-request.yml: -------------------------------------------------------------------------------- 1 | name: Feature request 2 | description: Suggest an idea for this project 3 | labels: ['enhancement'] 4 | body: 5 | - type: markdown 6 | attributes: 7 | value: | 8 | **NOTICE:** Please use this form only for requesting features for ApexKit itself. 9 | - type: textarea 10 | attributes: 11 | label: Summary 12 | description: A concise description of what's missing from ApexKit. 13 | placeholder: | 14 | Ex. I'd like to see an implementation of [...] 15 | validations: 16 | required: true 17 | - type: textarea 18 | attributes: 19 | label: Suggested Solution 20 | description: A concise description of what you want to happen. 21 | validations: 22 | required: false 23 | - type: textarea 24 | attributes: 25 | label: Alternative Solutions 26 | description: A concise description of any alternative solutions or features you've considered. 27 | validations: 28 | required: false 29 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: 'npm' # See documentation for possible values 9 | directory: '/' # Location of package manifests 10 | commit-message: 11 | prefix: 'build(npm)' 12 | rebase-strategy: 'auto' 13 | schedule: 14 | interval: 'daily' 15 | - package-ecosystem: 'github-actions' # See documentation for possible values 16 | directory: '/' # Location of package manifests 17 | commit-message: 18 | prefix: 'ci' 19 | include: 'scope' 20 | rebase-strategy: 'auto' 21 | schedule: 22 | interval: 'daily' 23 | -------------------------------------------------------------------------------- /.github/workflows/dependabot-approve-and-auto-merge.yml: -------------------------------------------------------------------------------- 1 | name: Dependabot Pull Request Approve and Merge 2 | on: pull_request_target 3 | permissions: 4 | pull-requests: write 5 | contents: write 6 | jobs: 7 | # Auto merge Dependabot PRs for: 8 | # - patch updates on prod dependencies 9 | # - minor updates on dev dependencies 10 | dependabot-auto-merge: 11 | # Only run for Dependabot PRs 12 | if: ${{ github.actor == 'dependabot[bot]' }} 13 | runs-on: ubuntu-latest 14 | steps: 15 | - name: 'Fetch Dependabot metadata' 16 | id: dependabot 17 | uses: dependabot/fetch-metadata@v2 18 | 19 | - name: 'Check auto merge conditions' 20 | id: auto-merge 21 | if: | 22 | ( 23 | steps.dependabot.outputs.update-type == 'version-update:semver-patch' && 24 | contains('direct:production,indirect:production', steps.dependabot.outputs.dependency-type) 25 | ) || ( 26 | contains('version-update:semver-minor,version-update:semver-patch', steps.dependabot.outputs.update-type) && 27 | contains('direct:development,indirect:development', steps.dependabot.outputs.dependency-type) 28 | ) 29 | run: echo "::notice ::auto-merge conditions satisfied" 30 | 31 | - name: 'Approve and merge PR' 32 | if: ${{ steps.auto-merge.conclusion == 'success' }} 33 | run: | 34 | gh pr review --approve "$PR_URL" 35 | gh pr merge --auto --squash "$PR_URL" 36 | env: 37 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 38 | PR_URL: ${{ github.event.pull_request.html_url }} 39 | -------------------------------------------------------------------------------- /.github/workflows/new-issue-welcome.yml: -------------------------------------------------------------------------------- 1 | name: New issue greeting 2 | 3 | on: 4 | issues: 5 | types: [opened] 6 | 7 | jobs: 8 | comment: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/github-script@v7 12 | with: 13 | script: | 14 | await github.rest.issues.createComment({ 15 | issue_number: context.issue.number, 16 | owner: context.repo.owner, 17 | repo: context.repo.repo, 18 | body: 'Thank you for posting this issue. 🙇🏼‍♂️
We will get back to you shortly.' 19 | }) 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # This file is used for Git repositories to specify intentionally untracked files that Git should ignore. 2 | # If you are not using git, you can delete this file. For more information see: https://git-scm.com/docs/gitignore 3 | # For useful gitignore templates see: https://github.com/github/gitignore 4 | 5 | # Salesforce cache 6 | .sf/ 7 | .sfdx/ 8 | .localdevserver/ 9 | deploy-options.json 10 | 11 | # LWC VSCode autocomplete 12 | **/lwc/jsconfig.json 13 | 14 | # LWC Jest coverage reports 15 | coverage/ 16 | 17 | # Logs 18 | logs 19 | *.log 20 | npm-debug.log* 21 | yarn-debug.log* 22 | yarn-error.log* 23 | 24 | # Dependency directories 25 | node_modules/ 26 | 27 | # Eslint cache 28 | .eslintcache 29 | 30 | # MacOS system files 31 | .DS_Store 32 | 33 | # Windows system files 34 | Thumbs.db 35 | ehthumbs.db 36 | [Dd]esktop.ini 37 | $RECYCLE.BIN/ 38 | 39 | # Local environment variables 40 | .env 41 | 42 | # PMD cache should not be included in GitHub 43 | .pmdCache 44 | /IlluminatedCloud/ApexKit_Company/OfflineSymbolTable.zip 45 | /force-app/main/default/profiles/*.profile-meta.xml 46 | pmd/pmd.csv 47 | /.idea/sonarlint/ 48 | /pmd/*.csv 49 | 50 | # Added by Illuminated Cloud 51 | /out/ 52 | target/ 53 | /.illuminatedCloud/ 54 | **/tsconfig*.json 55 | **/*.tsbuildinfo -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | 2 | npm run precommit 3 | -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Editor-based HTTP Client requests 5 | /httpRequests/ 6 | -------------------------------------------------------------------------------- /.idea/ApexKit.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 26 | -------------------------------------------------------------------------------- /.idea/codeStyles/codeStyleConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /.idea/dictionaries/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | anyvalue 5 | memoizes 6 | ulid 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/git_toolbox_blame.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.idea/git_toolbox_prj.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/illuminatedCloud.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/ApexKit_lwc_types.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/prettier.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | # List files or directories below to ignore them when running prettier 2 | # More information: https://prettier.io/docs/en/ignore.html 3 | # 4 | 5 | .idea/** 6 | 7 | **/staticresources/** 8 | .localdevserver 9 | .sfdx 10 | .sf 11 | .vscode 12 | 13 | coverage/ 14 | 15 | *-meta.xml 16 | 17 | # ApexDox 18 | doc-assets/**/*.js 19 | docs/**/*.js -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "apexInsertFinalNewline": true, 3 | "bracketSameLine": true, 4 | "singleAttributePerLine": false, 5 | "bracketSpacing": true, 6 | "singleQuote": true, 7 | "tabWidth": 4, 8 | "trailingComma": "none", 9 | "useTabs": true, 10 | "htmlWhitespaceSensitivity": "css", 11 | "xmlSelfClosingSpace": true, 12 | "overrides": [ 13 | { 14 | "files": "**/lwc/**/*.html", 15 | "options": { "parser": "lwc" } 16 | }, 17 | { 18 | "files": "*.{cmp,page,component}", 19 | "options": { "parser": "html" } 20 | }, 21 | { 22 | "files": "*.{yml,yaml}", 23 | "options": { "tabWidth": 2, "useTabs": false } 24 | }, 25 | { 26 | "files": "*.cls", 27 | "options": { "parser": "apex", "tabWidth": 2, "useTabs": true } 28 | }, 29 | { 30 | "files": "*.apex", 31 | "options": { "parser": "anonymous-apex" } 32 | }, 33 | { 34 | "files": "docs/*.html", 35 | "options": { 36 | "parser": "html", 37 | "useTabs": true, 38 | "htmlWhitespaceSensitivity": "css", 39 | "singleQuote": false 40 | } 41 | } 42 | ], 43 | "plugins": ["prettier-plugin-apex", "@prettier/plugin-xml"], 44 | "$schema": "https://json.schemastore.org/prettierrc" 45 | } 46 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "salesforce.salesforcedx-vscode", 4 | "redhat.vscode-xml", 5 | "dbaeumer.vscode-eslint", 6 | "esbenp.prettier-vscode", 7 | "financialforce.lana" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "Launch Apex Replay Debugger", 9 | "type": "apex-replay", 10 | "request": "launch", 11 | "logFile": "${command:AskForLogFileName}", 12 | "stopOnEntry": true, 13 | "trace": true 14 | } 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "search.exclude": { 3 | "**/node_modules": true, 4 | "**/bower_components": true, 5 | "**/.sfdx": true, 6 | "**/.sf": true 7 | }, 8 | "salesforcedx-vscode-core.show-cli-success-msg": false, 9 | "cSpell.words": [ 10 | "guaranteednottoexist" 11 | ], 12 | "apexPMD.enableCache": true, 13 | "apexPMD.rulesets": [ 14 | "pmd/ruleset.xml" 15 | ], 16 | "editor.defaultFormatter": "esbenp.prettier-vscode", 17 | } 18 | -------------------------------------------------------------------------------- /IlluminatedCloud/Apexkit/OfflineSymbolTable.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefriar/ApexKit/4c8254db7bfc9612d38581fb57c1d0c3d3938008/IlluminatedCloud/Apexkit/OfflineSymbolTable.zip -------------------------------------------------------------------------------- /IlluminatedCloud/ApexkitV2_5/OfflineSymbolTable.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefriar/ApexKit/4c8254db7bfc9612d38581fb57c1d0c3d3938008/IlluminatedCloud/ApexkitV2_5/OfflineSymbolTable.zip -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2023, Kevin Poorman 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | 3. Neither the name of the copyright holder nor the names of its 16 | contributors may be used to endorse or promote products derived from 17 | this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 23 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 26 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 27 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /apexdox.yml: -------------------------------------------------------------------------------- 1 | engine: 2 | source: 3 | - path: '${workspaceFolder}/force-app/main/default/classes' 4 | sourceUrl: https://github.com/codefriar/ApexKit/blob/main 5 | targetDirectory: '${workspaceFolder}/docs' 6 | # excludes: 7 | # - '*Test.cls' 8 | title: ApexKit Documentation 9 | subtitle: Documentation for ApexKit 10 | sortOrder: alpha 11 | cleanDir: true 12 | showTOCSnippets: true 13 | scope: 14 | - global 15 | - public 16 | - protected 17 | - private 18 | - webService 19 | - testMethod 20 | homePagePath: '${workspaceFolder}/doc-assets/files/main.html' 21 | assets: 22 | #- '${workspaceFolder}/doc-assets/logo.png' 23 | #- '${workspaceFolder}/doc-assets/favicon.png' 24 | #- '${workspaceFolder}/doc-assets/icon.png' 25 | #- '${workspaceFolder}/doc-assets/index.css' 26 | #- '${workspaceFolder}/doc-assets/highlight.css' 27 | - '${workspaceFolder}/doc-assets/styling.css' 28 | - '${workspaceFolder}/doc-assets/highlight.js' 29 | #- '${workspaceFolder}/doc-assets/index.js' 30 | port: 8088 31 | docblock: 32 | alignItems: true 33 | spacious: true 34 | omitDescriptionTag: false 35 | -------------------------------------------------------------------------------- /bin/generate-apex-docs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # shellcheck disable=SC2164 3 | #SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) 4 | # cd $SCRIPT_PATH/.. 5 | 6 | # Remove old docs 7 | rm -fr docs && 8 | # \ 9 | #rm -fr force-app/main/default/staticresources/documentation && \ 10 | 11 | # Generate Apex doc files 12 | ./node_modules/.bin/apexdocs markdown -p global public private protected namespaceaccessible -s force-app/main/default/classes && \ 13 | 14 | # Remove doc index 15 | #rm docs/index.md && \ 16 | 17 | mv docs/index.md docs/home.md && \ 18 | 19 | # Flatten directory structure 20 | find docs/* -mindepth 1 -type f -exec mv -i '{}' docs ';' && \ 21 | 22 | # Remove empty folders 23 | find docs/* -type d -empty -delete && \ 24 | 25 | # Replace relative links and remove .md extension 26 | find docs/ -type f -name "*.md" -print0 | xargs -0 sed -i "" -E "s@]\(\.\/(.*)\.md@](https://github.com/codefriar/ApexKit/wiki/\1@g" && \ 27 | find docs/ -type f -name "*.md" -print0 | xargs -0 sed -i "" -E "s@\]\(\.\.\/.*\/(.*)\.md@](https://github.com/codefriar/ApexKit/wiki/\1@g" && \ 28 | 29 | # Remove first three line with layout header 30 | find docs/ -type f -name "*.md" -print0 | xargs -0 sed -i "" "1,3d" 31 | 32 | # Move docs 33 | #mv docs force-app/main/default/staticresources/documentation -------------------------------------------------------------------------------- /config/Apexkit-scratch-def.json: -------------------------------------------------------------------------------- 1 | { 2 | "orgName": "ApexKit", 3 | "edition": "Developer", 4 | "hasSampleData": false, 5 | "features": ["EinsteinGPTForDevelopers"] 6 | } 7 | -------------------------------------------------------------------------------- /config/ApexkitV2_5-scratch-def.json: -------------------------------------------------------------------------------- 1 | { 2 | "orgName": "ApexKit26", 3 | "edition": "Developer", 4 | "hasSampleData": false, 5 | "features": ["EinsteinGPTForDevelopers"] 6 | } 7 | -------------------------------------------------------------------------------- /config/project-scratch-def.json: -------------------------------------------------------------------------------- 1 | { 2 | "orgName": "Ignoti Et Quasi Occulti", 3 | "description": "ApexKit", 4 | "edition": "Developer", 5 | "hasSampleData": false, 6 | "features": [ 7 | "EinsteinGPTForDevelopers", 8 | "EnableSetPasswordInApi", 9 | "PlatformCache" 10 | ], 11 | "settings": { 12 | "lightningExperienceSettings": { 13 | "enableS1DesktopEnabled": true 14 | }, 15 | "mobileSettings": { 16 | "enableS1EncryptedStoragePref2": false 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /data/apexkit-data-plan.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "sobject": "Account", 4 | "saveRefs": true, 5 | "resolveRefs": false, 6 | "files": ["Accounts.json"] 7 | }, 8 | { 9 | "sobject": "Contact", 10 | "saveRefs": true, 11 | "resolveRefs": true, 12 | "files": ["Contacts.json"] 13 | } 14 | ] 15 | -------------------------------------------------------------------------------- /doc-assets/README.md: -------------------------------------------------------------------------------- 1 | Any overrides for default ApexDox files should go in this directory 2 | 3 | Examples may include updated highlight.js libraries 4 | -------------------------------------------------------------------------------- /doc-assets/SetupApexDox.sh: -------------------------------------------------------------------------------- 1 | FILE=node_modules/@highlightjs/cdn-assets/highlight.min.js 2 | if test -f "$FILE"; then 3 | cat node_modules/@highlightjs/cdn-assets/highlight.min.js > doc-assets/highlight.js 4 | echo "\n" >> doc-assets/highlight.js 5 | cat node_modules/highlightjs-apex/dist/apex.min.js >> doc-assets/highlight.js 6 | else 7 | curl -L "https://cdn.jsdelivr.net/gh/highlightjs/cdn-release/build/highlight.min.js" -o "doc-assets/highlight.js" 8 | echo >> doc-assets/highlight.js 9 | curl -L "https://cdn.jsdelivr.net/npm/highlightjs-apex/dist/apex.min.js" >> "doc-assets/highlight.js" 10 | fi 11 | 12 | printf '' > "doc-assets/files/main.html" 13 | echo >> "doc-assets/files/main.html" 14 | npx marked -i README.md --gfm >> "doc-assets/files/main.html" 15 | -------------------------------------------------------------------------------- /doc-assets/files/README.md: -------------------------------------------------------------------------------- 1 | All extra files & pages for ApexDox should go in this directory 2 | -------------------------------------------------------------------------------- /doc-assets/styling.css: -------------------------------------------------------------------------------- 1 | pre { 2 | background-color: #f6f8fa; 3 | white-space: pre; 4 | } 5 | 6 | code { 7 | font-size: large; 8 | background: rgb(238, 238, 238) !important; 9 | } 10 | 11 | pre code { 12 | white-space: pre-wrap; 13 | } 14 | 15 | .hljs { 16 | background: rgb(238, 238, 238); 17 | } 18 | 19 | .readmeimage { 20 | max-width: 800px; 21 | width: 100%; 22 | } 23 | -------------------------------------------------------------------------------- /docs/AsyncRestClient.md: -------------------------------------------------------------------------------- 1 | **Implements** 2 | 3 | System.Queueable, 4 | Database.AllowsCallouts 5 | 6 | ## Fields 7 | 8 | ### `namedCredentialName` 9 | 10 | the named credential to use for the api call 11 | 12 | #### Signature 13 | 14 | ```apex 15 | private final namedCredentialName 16 | ``` 17 | 18 | #### Type 19 | 20 | String 21 | 22 | --- 23 | 24 | ### `apiCall` 25 | 26 | The RestLibApiCall that describes your callout 27 | 28 | #### Signature 29 | 30 | ```apex 31 | private final apiCall 32 | ``` 33 | 34 | #### Type 35 | 36 | [RestLibApiCall](RestLibApiCall.md) 37 | 38 | --- 39 | 40 | ### `handlerClass` 41 | 42 | The handler class to instantiate to handle the response 43 | 44 | #### Signature 45 | 46 | ```apex 47 | private final handlerClass 48 | ``` 49 | 50 | #### Type 51 | 52 | Type 53 | 54 | ## Constructors 55 | 56 | ### `AsyncRestClient(namedCredentialName, apiCall, handlerClass)` 57 | 58 | Default constructor 59 | 60 | #### Signature 61 | 62 | ```apex 63 | public AsyncRestClient(String namedCredentialName, RestLibApiCall apiCall, Type handlerClass) 64 | ``` 65 | 66 | #### Parameters 67 | 68 | | Name | Type | Description | 69 | | ------------------- | ----------------------------------- | ------------------------------------------------------------- | 70 | | namedCredentialName | String | String representing the named credential to use | 71 | | apiCall | [RestLibApiCall](RestLibApiCall.md) | RestLibApiCall The RestLibApiCall that describes your callout | 72 | | handlerClass | Type | Type a type reference to the finalizer to be used. | 73 | 74 | ## Methods 75 | 76 | ### `execute(qc)` 77 | 78 | This method will be executed by the Queueable system and is responsible for making the Api call. 79 | The finalizer is attached according to the passed in handlerClass 80 | 81 | #### Signature 82 | 83 | ```apex 84 | public void execute(QueueableContext qc) 85 | ``` 86 | 87 | #### Parameters 88 | 89 | | Name | Type | Description | 90 | | ---- | ---------------- | ------------------------------------------------------------ | 91 | | qc | QueueableContext | QueueableContext Dependency Injected by the Queueable system | 92 | 93 | #### Return Type 94 | 95 | **void** 96 | -------------------------------------------------------------------------------- /docs/AsyncRestLibFinalizer.md: -------------------------------------------------------------------------------- 1 | Abstract class defining a common interface with default implementation for finalizers handling 2 | AsyncRestApi calls 3 | 4 | **Implements** 5 | 6 | Finalizer 7 | 8 | ## Fields 9 | 10 | ### `response` 11 | 12 | the HTTP response object 13 | 14 | #### Signature 15 | 16 | ```apex 17 | public response 18 | ``` 19 | 20 | #### Type 21 | 22 | HttpResponse 23 | 24 | ## Methods 25 | 26 | ### `execute(response)` 27 | 28 | The extending class must implement this method to handle the HTTP response 29 | 30 | #### Signature 31 | 32 | ```apex 33 | private abstract void execute(HttpResponse response) 34 | ``` 35 | 36 | #### Parameters 37 | 38 | | Name | Type | Description | 39 | | -------- | ------------ | ------------------------------------------- | 40 | | response | HttpResponse | HttpResponse response object to be handled. | 41 | 42 | #### Return Type 43 | 44 | **void** 45 | 46 | --- 47 | 48 | ### `execute(fc)` 49 | 50 | Execution method of the finalizer. required by the interface. 51 | 52 | #### Signature 53 | 54 | ```apex 55 | private void execute(FinalizerContext fc) 56 | ``` 57 | 58 | #### Parameters 59 | 60 | | Name | Type | Description | 61 | | ---- | ---------------- | ------------------------------------------------------------------ | 62 | | fc | FinalizerContext | FinalizerContext Context object dependency injected by Salesforce. | 63 | 64 | #### Return Type 65 | 66 | **void** 67 | -------------------------------------------------------------------------------- /docs/BaseRepoTests.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefriar/ApexKit/4c8254db7bfc9612d38581fb57c1d0c3d3938008/docs/BaseRepoTests.md -------------------------------------------------------------------------------- /docs/CachePartitionType.md: -------------------------------------------------------------------------------- 1 | ## Values 2 | 3 | | Value | Description | 4 | | ------- | ----------- | 5 | | SESSION | | 6 | | ORG | | 7 | -------------------------------------------------------------------------------- /docs/CrudType.md: -------------------------------------------------------------------------------- 1 | | Value | Description | 2 | | ---------- | ----------- | 3 | | CREATEABLE | | 4 | | READABLE | | 5 | | EDITABLE | | 6 | | DELETABLE | | 7 | | UPSERTABLE | | 8 | -------------------------------------------------------------------------------- /docs/CustomMetadataUtilDeployCallbackTests.md: -------------------------------------------------------------------------------- 1 | Test class for CustomMetadataUtilDeploymentCallback 2 | 3 | **Author** ApexKit Contributors 4 | 5 | ## Methods 6 | 7 | ### `unitHandleResultSuccessPositive()` 8 | 9 | `ISTEST` 10 | 11 | Test successful deployment callback 12 | 13 | #### Signature 14 | 15 | ```apex 16 | private static void unitHandleResultSuccessPositive() 17 | ``` 18 | 19 | #### Return Type 20 | 21 | **void** 22 | 23 | --- 24 | 25 | ### `unitHandleResultFailureNegative()` 26 | 27 | `ISTEST` 28 | 29 | Test failed deployment callback - should throw exception 30 | 31 | #### Signature 32 | 33 | ```apex 34 | private static void unitHandleResultFailureNegative() 35 | ``` 36 | 37 | #### Return Type 38 | 39 | **void** 40 | 41 | --- 42 | 43 | ### `unitHandleResultInProgressNegative()` 44 | 45 | `ISTEST` 46 | 47 | Test deployment callback with InProgress status - should throw exception 48 | 49 | #### Signature 50 | 51 | ```apex 52 | private static void unitHandleResultInProgressNegative() 53 | ``` 54 | 55 | #### Return Type 56 | 57 | **void** 58 | 59 | --- 60 | 61 | ### `unitHandleResultNullNegative()` 62 | 63 | `ISTEST` 64 | 65 | Test deployment callback with null result - should throw exception 66 | 67 | #### Signature 68 | 69 | ```apex 70 | private static void unitHandleResultNullNegative() 71 | ``` 72 | 73 | #### Return Type 74 | 75 | **void** 76 | -------------------------------------------------------------------------------- /docs/CustomMetadataUtilDeploymentCallback.md: -------------------------------------------------------------------------------- 1 | **Author** ApexKit Contributors 2 | 3 | **Implements** 4 | 5 | Metadata.DeployCallback 6 | 7 | ## Methods 8 | 9 | ### `handleResult(result, context)` 10 | 11 | Handles the result of a metadata deployment. 12 | NOTE: This is a stub. This is functional, but bare-minimum implementation. 13 | You should 100% re-write this method to work with your needs. 14 | 15 | #### Signature 16 | 17 | ```apex 18 | public void handleResult(Metadata.DeployResult result, Metadata.DeployCallbackContext context) 19 | ``` 20 | 21 | #### Parameters 22 | 23 | | Name | Type | Description | 24 | | ------- | ------------------------------ | -------------------------------------------------------------------------------------------------- | 25 | | result | Metadata.DeployResult | The DeployResult object containing deployment status and details - this is DI'd by Salesforce | 26 | | context | Metadata.DeployCallbackContext | The DeployCallbackContext for the deployment - this is DI'd by Salesforce | 27 | 28 | #### Return Type 29 | 30 | **void** 31 | 32 | #### Throws 33 | 34 | CustomMetadataUtilDeploymentCallbackException: When deployment fails 35 | 36 | ## Classes 37 | 38 | ### CustomMetadataUtilDeploymentCallbackException Class 39 | 40 | Exception class for deployment callback errors 41 | -------------------------------------------------------------------------------- /docs/FF.md: -------------------------------------------------------------------------------- 1 | **Group** FeatureFlag 2 | 3 | ## Methods 4 | 5 | ### `isEnabled(featureName)` 6 | 7 | Convenience method for checking if a feature is enabled. 8 | 9 | #### Signature 10 | 11 | ```apex 12 | public static Boolean isEnabled(String featureName) 13 | ``` 14 | 15 | #### Parameters 16 | 17 | | Name | Type | Description | 18 | | ----------- | ------ | ---------------------------- | 19 | | featureName | String | String feature name to check | 20 | 21 | #### Return Type 22 | 23 | **Boolean** 24 | 25 | True if the feature is enabled by any of the following: Universally enabled, or enabled for the current,[object Object],user based on permission set, custom permission or time. 26 | 27 | --- 28 | 29 | ### `isNotEnabled(featureName)` 30 | 31 | logical inverse of the isEnabled method. 32 | 33 | #### Signature 34 | 35 | ```apex 36 | public static Boolean isNotEnabled(String featureName) 37 | ``` 38 | 39 | #### Parameters 40 | 41 | | Name | Type | Description | 42 | | ----------- | ------ | ---------------------------- | 43 | | featureName | String | String feature name to check | 44 | 45 | #### Return Type 46 | 47 | **Boolean** 48 | 49 | Boolean, returns inverse of isEnabled. 50 | 51 | --- 52 | 53 | ### `value(featureName)` 54 | 55 | Law of diminishing returns here. This isn't tested, per-say. It's underlying FeatureFlag 56 | implementation _is_ tested, however. 57 | 58 | #### Signature 59 | 60 | ```apex 61 | public static String value(String featureName) 62 | ``` 63 | 64 | #### Parameters 65 | 66 | | Name | Type | Description | 67 | | ----------- | ------ | -------------------------------- | 68 | | featureName | String | String the feature name to check | 69 | 70 | #### Return Type 71 | 72 | **String** 73 | 74 | String the value stored in custom metadata for this feature flag. 75 | -------------------------------------------------------------------------------- /docs/FLSType.md: -------------------------------------------------------------------------------- 1 | | Value | Description | 2 | | ---------- | ----------- | 3 | | ACCESSIBLE | | 4 | | UPDATABLE | | 5 | -------------------------------------------------------------------------------- /docs/FailsafeExceptionHandlerTests.md: -------------------------------------------------------------------------------- 1 | ## Methods 2 | 3 | ### `testDefaultConstructor()` 4 | 5 | `ISTEST` 6 | 7 | #### Signature 8 | 9 | ```apex 10 | private static void testDefaultConstructor() 11 | ``` 12 | 13 | #### Return Type 14 | 15 | **void** 16 | 17 | --- 18 | 19 | ### `testSingleExceptionConstructor()` 20 | 21 | `ISTEST` 22 | 23 | #### Signature 24 | 25 | ```apex 26 | private static void testSingleExceptionConstructor() 27 | ``` 28 | 29 | #### Return Type 30 | 31 | **void** 32 | 33 | --- 34 | 35 | ### `testListExceptionConstructor()` 36 | 37 | `ISTEST` 38 | 39 | #### Signature 40 | 41 | ```apex 42 | private static void testListExceptionConstructor() 43 | ``` 44 | 45 | #### Return Type 46 | 47 | **void** 48 | 49 | --- 50 | 51 | ### `testCallableInterfaceSingleException()` 52 | 53 | `ISTEST` 54 | 55 | #### Signature 56 | 57 | ```apex 58 | private static void testCallableInterfaceSingleException() 59 | ``` 60 | 61 | #### Return Type 62 | 63 | **void** 64 | 65 | --- 66 | 67 | ### `testCallableInterfaceListOfExceptions()` 68 | 69 | `ISTEST` 70 | 71 | #### Signature 72 | 73 | ```apex 74 | private static void testCallableInterfaceListOfExceptions() 75 | ``` 76 | 77 | #### Return Type 78 | 79 | **void** 80 | 81 | --- 82 | 83 | ### `assertLogsGenerated(numberOfLogsExpected, friendlyMessage)` 84 | 85 | #### Signature 86 | 87 | ```apex 88 | private static void assertLogsGenerated(Integer numberOfLogsExpected, String friendlyMessage) 89 | ``` 90 | 91 | #### Parameters 92 | 93 | | Name | Type | Description | 94 | | -------------------- | ------- | ----------- | 95 | | numberOfLogsExpected | Integer | | 96 | | friendlyMessage | String | | 97 | 98 | #### Return Type 99 | 100 | **void** 101 | -------------------------------------------------------------------------------- /docs/FeatureFlagCommonTests.md: -------------------------------------------------------------------------------- 1 | Class serves to DRY code for various testing methods that 2 | require it. It is not intended to be used directly. 3 | 4 | ## Fields 5 | 6 | ### `EXAMPLE_FEATURE_FLAG_ID` 7 | 8 | This is the id of the feature flag that's included with ApexKit. CMDT can be hard to test with 9 | because you can't necessarily know the object prefix until a cmdt record is saved. :( 10 | 11 | #### Signature 12 | 13 | ```apex 14 | private static final EXAMPLE_FEATURE_FLAG_ID 15 | ``` 16 | 17 | #### Type 18 | 19 | Id 20 | 21 | ## Methods 22 | 23 | ### `getTestFlag(flagName, enabled)` 24 | 25 | DRY method to create a test flag with valid-ish id. 26 | 27 | #### Signature 28 | 29 | ```apex 30 | public static Map getTestFlag(String flagName, Boolean enabled) 31 | ``` 32 | 33 | #### Parameters 34 | 35 | | Name | Type | Description | 36 | | -------- | ------- | ------------------------------------------------------ | 37 | | flagName | String | String name of the Flag | 38 | | enabled | Boolean | Boolean whether the flag is enabled universally or not | 39 | 40 | #### Return Type 41 | 42 | **Map<String,Feature_Flag\_\_mdt>** 43 | 44 | Map<String, Feature_Flag\_\_mdt> test flag 45 | 46 | --- 47 | 48 | ### `getExistingPermSetId()` 49 | 50 | fetches a valid permission set id 51 | 52 | #### Signature 53 | 54 | ```apex 55 | public static Id getExistingPermSetId() 56 | ``` 57 | 58 | #### Return Type 59 | 60 | **Id** 61 | 62 | Id the id of the permissionset that's included with ApexKit 63 | 64 | --- 65 | 66 | ### `getOverriddenPerPermSet(flagName, permSetId, enabled)` 67 | 68 | returns a map of feature flags that are enabled just for a specified permission set 69 | 70 | #### Signature 71 | 72 | ```apex 73 | public static Map getOverriddenPerPermSet(String flagName, Id permSetId, Boolean enabled) 74 | ``` 75 | 76 | #### Parameters 77 | 78 | | Name | Type | Description | 79 | | --------- | ------- | ------------------------------------------------------ | 80 | | flagName | String | String name of the flag | 81 | | permSetId | Id | Id the id of the permission set that enables this flag | 82 | | enabled | Boolean | Boolean whether the flag is enabled or not | 83 | 84 | #### Return Type 85 | 86 | **Map<String,Feature_Flag_Enabled_For\_\_mdt>** 87 | 88 | Map<String, Feature_Flag_Enabled_For\_\_mdt> the map of feature flags 89 | -------------------------------------------------------------------------------- /docs/FeatureFlagDataProviderTests.md: -------------------------------------------------------------------------------- 1 | ## Methods 2 | 3 | ### `testEnablingPermissionSetsPositive()` 4 | 5 | `ISTEST` 6 | 7 | #### Signature 8 | 9 | ```apex 10 | private static void testEnablingPermissionSetsPositive() 11 | ``` 12 | 13 | #### Return Type 14 | 15 | **void** 16 | 17 | --- 18 | 19 | ### `testReturnEmptySetWhenNoPermSetOverridesFound()` 20 | 21 | `ISTEST` 22 | 23 | #### Signature 24 | 25 | ```apex 26 | private static void testReturnEmptySetWhenNoPermSetOverridesFound() 27 | ``` 28 | 29 | #### Return Type 30 | 31 | **void** 32 | -------------------------------------------------------------------------------- /docs/FeatureFlagTests.md: -------------------------------------------------------------------------------- 1 | ## Methods 2 | 3 | ### `testDefaultConstructorPositive()` 4 | 5 | `ISTEST` 6 | 7 | #### Signature 8 | 9 | ```apex 10 | private static void testDefaultConstructorPositive() 11 | ``` 12 | 13 | #### Return Type 14 | 15 | **void** 16 | 17 | --- 18 | 19 | ### `testFlagFoundButDisabledReturnsFixedString()` 20 | 21 | `ISTEST` 22 | 23 | #### Signature 24 | 25 | ```apex 26 | private static void testFlagFoundButDisabledReturnsFixedString() 27 | ``` 28 | 29 | #### Return Type 30 | 31 | **void** 32 | 33 | --- 34 | 35 | ### `testFlagNotFoundReturnsFixedString()` 36 | 37 | `ISTEST` 38 | 39 | #### Signature 40 | 41 | ```apex 42 | private static void testFlagNotFoundReturnsFixedString() 43 | ``` 44 | 45 | #### Return Type 46 | 47 | **void** 48 | 49 | --- 50 | 51 | ### `testFlagFoundAndEnabledReturnsValue()` 52 | 53 | `ISTEST` 54 | 55 | #### Signature 56 | 57 | ```apex 58 | private static void testFlagFoundAndEnabledReturnsValue() 59 | ``` 60 | 61 | #### Return Type 62 | 63 | **void** 64 | 65 | --- 66 | 67 | ### `testFeatureFlagNotFoundReturnsFalse()` 68 | 69 | `ISTEST` 70 | 71 | #### Signature 72 | 73 | ```apex 74 | private static void testFeatureFlagNotFoundReturnsFalse() 75 | ``` 76 | 77 | #### Return Type 78 | 79 | **void** 80 | 81 | --- 82 | 83 | ### `testFeatureFlagFoundReturnsTrue()` 84 | 85 | `ISTEST` 86 | 87 | #### Signature 88 | 89 | ```apex 90 | private static void testFeatureFlagFoundReturnsTrue() 91 | ``` 92 | 93 | #### Return Type 94 | 95 | **void** 96 | 97 | --- 98 | 99 | ### `testFeatureFlagFoundIsNotEnabledReturnsTrue()` 100 | 101 | `ISTEST` 102 | 103 | #### Signature 104 | 105 | ```apex 106 | private static void testFeatureFlagFoundIsNotEnabledReturnsTrue() 107 | ``` 108 | 109 | #### Return Type 110 | 111 | **void** 112 | 113 | --- 114 | 115 | ### `testFeatureFlagFoundWrapperIsNotEnabledReturnsTrue()` 116 | 117 | `ISTEST` 118 | 119 | #### Signature 120 | 121 | ```apex 122 | private static void testFeatureFlagFoundWrapperIsNotEnabledReturnsTrue() 123 | ``` 124 | 125 | #### Return Type 126 | 127 | **void** 128 | 129 | --- 130 | 131 | ### `testFeatureFlagEnabledForPermSetFoundReturnsTrue()` 132 | 133 | `ISTEST` 134 | 135 | #### Signature 136 | 137 | ```apex 138 | private static void testFeatureFlagEnabledForPermSetFoundReturnsTrue() 139 | ``` 140 | 141 | #### Return Type 142 | 143 | **void** 144 | 145 | --- 146 | 147 | ### `testFetchUsersAssignedPermissionSetsPositive()` 148 | 149 | `ISTEST` 150 | 151 | #### Signature 152 | 153 | ```apex 154 | private static void testFetchUsersAssignedPermissionSetsPositive() 155 | ``` 156 | 157 | #### Return Type 158 | 159 | **void** 160 | 161 | --- 162 | 163 | ### `testFeatureFoundEnabledViaCustomPermissionPositive()` 164 | 165 | `ISTEST` 166 | 167 | #### Signature 168 | 169 | ```apex 170 | private static void testFeatureFoundEnabledViaCustomPermissionPositive() 171 | ``` 172 | 173 | #### Return Type 174 | 175 | **void** 176 | -------------------------------------------------------------------------------- /docs/FieldSelection.md: -------------------------------------------------------------------------------- 1 | | Value | Description | 2 | | -------- | ----------- | 3 | | ALL | | 4 | | STANDARD | | 5 | | CUSTOM | | 6 | -------------------------------------------------------------------------------- /docs/HttpVerb.md: -------------------------------------------------------------------------------- 1 | and as a result, the ENUM value 'DEL' is used for delete. 2 | 3 | ## Values 4 | 5 | | Value | Description | 6 | | ----- | ----------- | 7 | | GET | | 8 | | POST | | 9 | | PATCH | | 10 | | PUT | | 11 | | HEAD | | 12 | | DEL | | 13 | -------------------------------------------------------------------------------- /docs/InvokeMetadataDrivenTriggerFramework.md: -------------------------------------------------------------------------------- 1 | ## Methods 2 | 3 | ### `invokeMetadataTriggerFramework(inputParams)` 4 | 5 | `INVOCABLEMETHOD` 6 | 7 | Invokes the Metadata Trigger Framework 8 | 9 | #### Signature 10 | 11 | ```apex 12 | public static void invokeMetadataTriggerFramework(List inputParams) 13 | ``` 14 | 15 | #### Parameters 16 | 17 | | Name | Type | Description | 18 | | ----------- | ------------------ | ----------------------------------------------------------------------------- | 19 | | inputParams | List<Inputs> | List<Inputs> - List of inputs to pass to the Metadata Trigger Framework | 20 | 21 | #### Return Type 22 | 23 | **void** 24 | 25 | ## Classes 26 | 27 | ### Inputs Class 28 | 29 | An internal class representing the inputs to the Metadata Trigger Framework 30 | 31 | #### Fields 32 | 33 | ##### `context` 34 | 35 | `INVOCABLEVARIABLE` 36 | 37 | ###### Signature 38 | 39 | ```apex 40 | public context 41 | ``` 42 | 43 | ###### Type 44 | 45 | TriggerOperation 46 | 47 | --- 48 | 49 | ##### `triggerNew` 50 | 51 | `OTHER` 52 | 53 | ###### Signature 54 | 55 | ```apex 56 | public triggerNew 57 | ``` 58 | 59 | ###### Type 60 | 61 | List<SObject> 62 | 63 | --- 64 | 65 | ##### `triggerOld` 66 | 67 | `OTHER` 68 | 69 | ###### Signature 70 | 71 | ```apex 72 | public triggerOld 73 | ``` 74 | 75 | ###### Type 76 | 77 | List<SObject> 78 | -------------------------------------------------------------------------------- /docs/LogException.md: -------------------------------------------------------------------------------- 1 | I create a custom exception for every feature of ApexKit. While 2 | this exception isn't yet used, it's here as a nod to consistency. 3 | 4 | **Inheritance** 5 | 6 | Exception 7 | -------------------------------------------------------------------------------- /docs/LogMessage.md: -------------------------------------------------------------------------------- 1 | like Quiddity and RequestID 2 | 3 | **See** [Log](Log.md) 4 | 5 | **See** [LogException](LogException.md) 6 | 7 | **See** [LogTriggerHandler](LogTriggerHandler.md) 8 | 9 | ## Fields 10 | 11 | ### `EXCEPTION_STRING_FORMAT` 12 | 13 | #### Signature 14 | 15 | ```apex 16 | private static final EXCEPTION_STRING_FORMAT 17 | ``` 18 | 19 | #### Type 20 | 21 | String 22 | 23 | ## Properties 24 | 25 | ### `requestId` 26 | 27 | public read only property for the request ID. Privately set. 28 | 29 | #### Signature 30 | 31 | ```apex 32 | public requestId 33 | ``` 34 | 35 | #### Type 36 | 37 | String 38 | 39 | --- 40 | 41 | ### `quiddity` 42 | 43 | Public read only property for quiddity. Privately set. 44 | 45 | #### Signature 46 | 47 | ```apex 48 | public quiddity 49 | ``` 50 | 51 | #### Type 52 | 53 | Quiddity 54 | 55 | --- 56 | 57 | ### `message` 58 | 59 | Public message property. 60 | 61 | #### Signature 62 | 63 | ```apex 64 | public message 65 | ``` 66 | 67 | #### Type 68 | 69 | String 70 | 71 | --- 72 | 73 | ### `severity` 74 | 75 | Public severity property. 76 | 77 | #### Signature 78 | 79 | ```apex 80 | public severity 81 | ``` 82 | 83 | #### Type 84 | 85 | LoggingLevel 86 | 87 | ## Constructors 88 | 89 | ### `LogMessage(severity, message)` 90 | 91 | Constructor accepting a message to log. 92 | Severity is auto set to info 93 | 94 | #### Signature 95 | 96 | ```apex 97 | public LogMessage(LoggingLevel severity, String message) 98 | ``` 99 | 100 | #### Parameters 101 | 102 | | Name | Type | Description | 103 | | -------- | ------------ | ---------------------------------------- | 104 | | severity | LoggingLevel | LoggingLevel the severity of the message | 105 | | message | String | String the string to log | 106 | 107 | --- 108 | 109 | ### `LogMessage(message)` 110 | 111 | Constructor accepting a message to log. 112 | Severity is auto set to info 113 | 114 | #### Signature 115 | 116 | ```apex 117 | public LogMessage(String message) 118 | ``` 119 | 120 | #### Parameters 121 | 122 | | Name | Type | Description | 123 | | ------- | ------ | ------------------------ | 124 | | message | String | String the string to log | 125 | 126 | --- 127 | 128 | ### `LogMessage(ex)` 129 | 130 | Constructor accepting an exception object. 131 | 132 | #### Signature 133 | 134 | ```apex 135 | public LogMessage(Exception ex) 136 | ``` 137 | 138 | #### Parameters 139 | 140 | | Name | Type | Description | 141 | | ---- | --------- | -------------------- | 142 | | ex | Exception | any exception object | 143 | 144 | ## Methods 145 | 146 | ### `toEvent()` 147 | 148 | converts this object to an event for publishing 149 | 150 | #### Signature 151 | 152 | ```apex 153 | public Log__e toEvent() 154 | ``` 155 | 156 | #### Return Type 157 | 158 | **Log\_\_e** 159 | 160 | ,[object Object] 161 | -------------------------------------------------------------------------------- /docs/LogTests.md: -------------------------------------------------------------------------------- 1 | ## Methods 2 | 3 | ### `testDirectPublishMethodsPositive()` 4 | 5 | `ISTEST` 6 | 7 | #### Signature 8 | 9 | ```apex 10 | private static void testDirectPublishMethodsPositive() 11 | ``` 12 | 13 | #### Return Type 14 | 15 | **void** 16 | 17 | --- 18 | 19 | ### `testLogMultipleItemPositive()` 20 | 21 | `ISTEST` 22 | 23 | #### Signature 24 | 25 | ```apex 26 | private static void testLogMultipleItemPositive() 27 | ``` 28 | 29 | #### Return Type 30 | 31 | **void** 32 | -------------------------------------------------------------------------------- /docs/MetadataTriggerFrameworkException.md: -------------------------------------------------------------------------------- 1 | **Inheritance** 2 | 3 | Exception 4 | -------------------------------------------------------------------------------- /docs/MetadataTriggerFrameworkTests.md: -------------------------------------------------------------------------------- 1 | `SUPPRESSWARNINGS` 2 | 3 | ## Methods 4 | 5 | ### `testMetadataTriggerFrameworkNoOppWithoutRecordsPositive()` 6 | 7 | `ISTEST` 8 | 9 | #### Signature 10 | 11 | ```apex 12 | private static void testMetadataTriggerFrameworkNoOppWithoutRecordsPositive() 13 | ``` 14 | 15 | #### Return Type 16 | 17 | **void** 18 | 19 | --- 20 | 21 | ### `testExecutesBeforeInsertPositive()` 22 | 23 | `ISTEST` 24 | 25 | #### Signature 26 | 27 | ```apex 28 | private static void testExecutesBeforeInsertPositive() 29 | ``` 30 | 31 | #### Return Type 32 | 33 | **void** 34 | 35 | --- 36 | 37 | ### `testExecutesBeforeUpdatePositive()` 38 | 39 | `ISTEST` 40 | 41 | #### Signature 42 | 43 | ```apex 44 | private static void testExecutesBeforeUpdatePositive() 45 | ``` 46 | 47 | #### Return Type 48 | 49 | **void** 50 | 51 | --- 52 | 53 | ### `testExecutesBeforeDeletePositive()` 54 | 55 | `ISTEST` 56 | 57 | #### Signature 58 | 59 | ```apex 60 | private static void testExecutesBeforeDeletePositive() 61 | ``` 62 | 63 | #### Return Type 64 | 65 | **void** 66 | 67 | --- 68 | 69 | ### `testExecutesAfterInsertPositive()` 70 | 71 | `ISTEST` 72 | 73 | #### Signature 74 | 75 | ```apex 76 | private static void testExecutesAfterInsertPositive() 77 | ``` 78 | 79 | #### Return Type 80 | 81 | **void** 82 | 83 | --- 84 | 85 | ### `testExecutesAfterUpdatePositive()` 86 | 87 | `ISTEST` 88 | 89 | #### Signature 90 | 91 | ```apex 92 | private static void testExecutesAfterUpdatePositive() 93 | ``` 94 | 95 | #### Return Type 96 | 97 | **void** 98 | 99 | --- 100 | 101 | ### `testExecutesAfterDeletePositive()` 102 | 103 | `ISTEST` 104 | 105 | #### Signature 106 | 107 | ```apex 108 | private static void testExecutesAfterDeletePositive() 109 | ``` 110 | 111 | #### Return Type 112 | 113 | **void** 114 | 115 | --- 116 | 117 | ### `testExecutesAfterUndeletePositive()` 118 | 119 | `ISTEST` 120 | 121 | #### Signature 122 | 123 | ```apex 124 | private static void testExecutesAfterUndeletePositive() 125 | ``` 126 | 127 | #### Return Type 128 | 129 | **void** 130 | 131 | --- 132 | 133 | ### `exerciseTriggerHandlerPositive(context)` 134 | 135 | #### Signature 136 | 137 | ```apex 138 | private static void exerciseTriggerHandlerPositive(String context) 139 | ``` 140 | 141 | #### Parameters 142 | 143 | | Name | Type | Description | 144 | | ------- | ------ | ----------- | 145 | | context | String | | 146 | 147 | #### Return Type 148 | 149 | **void** 150 | -------------------------------------------------------------------------------- /docs/MetadataTriggerQueryService.md: -------------------------------------------------------------------------------- 1 | MetadataTriggerHandlerClass class. It is not intended to be used directly by developers. 2 | 3 | ## Fields 4 | 5 | ### `objType` 6 | 7 | Initialize objectTypeName as an empty string to avoid null errors 8 | 9 | #### Signature 10 | 11 | ```apex 12 | private objType 13 | ``` 14 | 15 | #### Type 16 | 17 | String 18 | 19 | ## Constructors 20 | 21 | ### `MetadataTriggerQueryService(objectTypeName)` 22 | 23 | Constructor for trigger query service 24 | 25 | #### Signature 26 | 27 | ```apex 28 | public MetadataTriggerQueryService(String objectTypeName) 29 | ``` 30 | 31 | #### Parameters 32 | 33 | | Name | Type | Description | 34 | | -------------- | ------ | --------------------------- | 35 | | objectTypeName | String | String The object Type name | 36 | 37 | ## Methods 38 | 39 | ### `getMetadataTriggers()` 40 | 41 | `SUPPRESSWARNINGS` 42 | 43 | This query finds an ordered list trigger handler classes 44 | to execute. It ignores any classes that are marked as disabled. 45 | 46 | <br>Note: It will exclude any triggerHandler metadata records for which 47 | the user's email address is found in a related `disabled_for__mdt` 48 | record. 49 | 50 | <br>Admins and Developers can selectively disable trigger handlers 51 | for all or selected individuals _without_ deploying. 52 | 53 | #### Signature 54 | 55 | ```apex 56 | public List getMetadataTriggers() 57 | ``` 58 | 59 | #### Return Type 60 | 61 | **List<Metadata_Driven_Trigger\_\_mdt>** 62 | 63 | ,[object Object] 64 | 65 | --- 66 | 67 | ### `getSObjectType(triggerNew, triggerOld)` 68 | 69 | This determines the active sObject type by describing the first 70 | record in the trigger New / Old list 71 | 72 | #### Signature 73 | 74 | ```apex 75 | public static String getSObjectType(List triggerNew, List triggerOld) 76 | ``` 77 | 78 | #### Parameters 79 | 80 | | Name | Type | Description | 81 | | ---------- | ------------------- | ---------------------------------------- | 82 | | triggerNew | List<SObject> | List<sObject> The trigger.new list | 83 | | triggerOld | List<SObject> | List<sObject> The trigger.old list | 84 | 85 | #### Return Type 86 | 87 | **String** 88 | 89 | ,[object Object], the ObjectType name 90 | 91 | #### Throws 92 | 93 | [MetadataTriggerFrameworkException](MetadataTriggerFrameworkException.md): when both triggerNew and triggerOld are null 94 | -------------------------------------------------------------------------------- /docs/MetadataTriggerQueryServiceTests.md: -------------------------------------------------------------------------------- 1 | ## Methods 2 | 3 | ### `testGetMetadataTriggers()` 4 | 5 | `ISTEST` 6 | 7 | #### Signature 8 | 9 | ```apex 10 | private static void testGetMetadataTriggers() 11 | ``` 12 | 13 | #### Return Type 14 | 15 | **void** 16 | 17 | --- 18 | 19 | ### `testGetSObjectTypeNegative()` 20 | 21 | `ISTEST` 22 | 23 | #### Signature 24 | 25 | ```apex 26 | private static void testGetSObjectTypeNegative() 27 | ``` 28 | 29 | #### Return Type 30 | 31 | **void** 32 | 33 | --- 34 | 35 | ### `testGetSObjectTypePositiveFromTriggerNew()` 36 | 37 | `ISTEST` 38 | 39 | #### Signature 40 | 41 | ```apex 42 | private static void testGetSObjectTypePositiveFromTriggerNew() 43 | ``` 44 | 45 | #### Return Type 46 | 47 | **void** 48 | 49 | --- 50 | 51 | ### `testGetSObjectTypePositiveFromTriggerOld()` 52 | 53 | `ISTEST` 54 | 55 | #### Signature 56 | 57 | ```apex 58 | private static void testGetSObjectTypePositiveFromTriggerOld() 59 | ``` 60 | 61 | #### Return Type 62 | 63 | **void** 64 | -------------------------------------------------------------------------------- /docs/OrgShapeTests.md: -------------------------------------------------------------------------------- 1 | ## Fields 2 | 3 | ### `orgShape` 4 | 5 | #### Signature 6 | 7 | ```apex 8 | private static orgShape 9 | ``` 10 | 11 | #### Type 12 | 13 | [OrgShape](OrgShape.md) 14 | 15 | --- 16 | 17 | ### `orgCheck` 18 | 19 | #### Signature 20 | 21 | ```apex 22 | private static orgCheck 23 | ``` 24 | 25 | #### Type 26 | 27 | Organization 28 | 29 | ## Methods 30 | 31 | ### `testOrgShapeProperties()` 32 | 33 | `ISTEST` 34 | 35 | #### Signature 36 | 37 | ```apex 38 | private static void testOrgShapeProperties() 39 | ``` 40 | 41 | #### Return Type 42 | 43 | **void** 44 | 45 | --- 46 | 47 | ### `testAdvancedMultiCurrencyManagement()` 48 | 49 | `ISTEST` 50 | 51 | #### Signature 52 | 53 | ```apex 54 | private static void testAdvancedMultiCurrencyManagement() 55 | ``` 56 | 57 | #### Return Type 58 | 59 | **void** 60 | 61 | --- 62 | 63 | ### `testPlatformCachePositive()` 64 | 65 | `ISTEST` 66 | 67 | #### Signature 68 | 69 | ```apex 70 | private static void testPlatformCachePositive() 71 | ``` 72 | 73 | #### Return Type 74 | 75 | **void** 76 | 77 | --- 78 | 79 | ### `testGetSafeDefaultCachePartitionMemoized()` 80 | 81 | `ISTEST` 82 | 83 | #### Signature 84 | 85 | ```apex 86 | private static void testGetSafeDefaultCachePartitionMemoized() 87 | ``` 88 | 89 | #### Return Type 90 | 91 | **void** 92 | 93 | --- 94 | 95 | ### `testPlatformCacheDisabledWhenSeeAllDataTrue()` 96 | 97 | `ISTEST` 98 | `SUPPRESSWARNINGS` 99 | 100 | #### Signature 101 | 102 | ```apex 103 | private static void testPlatformCacheDisabledWhenSeeAllDataTrue() 104 | ``` 105 | 106 | #### Return Type 107 | 108 | **void** 109 | 110 | --- 111 | 112 | ### `testSeeAllDataPositiveWhenEnabled()` 113 | 114 | `ISTEST` 115 | `SUPPRESSWARNINGS` 116 | 117 | #### Signature 118 | 119 | ```apex 120 | private static void testSeeAllDataPositiveWhenEnabled() 121 | ``` 122 | 123 | #### Return Type 124 | 125 | **void** 126 | 127 | --- 128 | 129 | ### `testSeeAllDataFalseWhenDisabled()` 130 | 131 | `ISTEST` 132 | 133 | #### Signature 134 | 135 | ```apex 136 | private static void testSeeAllDataFalseWhenDisabled() 137 | ``` 138 | 139 | #### Return Type 140 | 141 | **void** 142 | 143 | --- 144 | 145 | ### `testCacheIsUsedPositive()` 146 | 147 | `ISTEST` 148 | 149 | #### Signature 150 | 151 | ```apex 152 | private static void testCacheIsUsedPositive() 153 | ``` 154 | 155 | #### Return Type 156 | 157 | **void** 158 | -------------------------------------------------------------------------------- /docs/Ouroboros.md: -------------------------------------------------------------------------------- 1 | Ouroboros is the ancient mythical symbol of a dragon or serpent eating its own tail. It's often 2 | understood as a reference to the circle of life, or the never ending nature life and death. In this case, it's a 3 | reference to a Queueable object that enqueues itself when it's done executing via a OuroborosFinalizer. This is a 4 | useful pattern when you need to process high volumes of data, but don't care if it's processed in real time. 5 | 6 | **Implements** 7 | 8 | Queueable, 9 | Database.AllowsCallouts 10 | 11 | ## Fields 12 | 13 | ### `passthrough` 14 | 15 | Object that will be passed through to the next iteration of the Ouroboros. 16 | 17 | #### Signature 18 | 19 | ```apex 20 | public passthrough 21 | ``` 22 | 23 | #### Type 24 | 25 | Object 26 | 27 | ## Methods 28 | 29 | ### `hasExitCriteriaBeenMet()` 30 | 31 | This is the method that implementing classes must override. It's the method that will be called 32 | to determine if whether or not to re-enqueue the Ouroboros Queueable. 33 | 34 | #### Signature 35 | 36 | ```apex 37 | public abstract Boolean hasExitCriteriaBeenMet() 38 | ``` 39 | 40 | #### Return Type 41 | 42 | **Boolean** 43 | 44 | Boolean True if the exit criteria has been met. 45 | 46 | --- 47 | 48 | ### `execute()` 49 | 50 | This is the method that will be called as the executable portion of the Queueable. It's the method 51 | developers will populate with their business logic to execute on each iteration of the Ouroboros. 52 | 53 | #### Signature 54 | 55 | ```apex 56 | public abstract void execute() 57 | ``` 58 | 59 | #### Return Type 60 | 61 | **void** 62 | 63 | --- 64 | 65 | ### `className()` 66 | 67 | This method is to be deprecated shortly, in favor of the lookup system built in QueueableProcess. 68 | 69 | #### Signature 70 | 71 | ```apex 72 | public String className() 73 | ``` 74 | 75 | #### Return Type 76 | 77 | **String** 78 | 79 | String class name. Currently only used in the finalizer for logging purposes. 80 | 81 | --- 82 | 83 | ### `execute(context)` 84 | 85 | This is the method that will be executed by the Queueable system. It accepts the context object 86 | and calls the implementing class' `execute` method. It then creates a new instance of the OuroborosFinalizer 87 | class and attaches it to the system context. 88 | 89 | #### Signature 90 | 91 | ```apex 92 | public virtual void execute(QueueableContext context) 93 | ``` 94 | 95 | #### Parameters 96 | 97 | | Name | Type | Description | 98 | | ------- | ---------------- | ------------------------------------------------------------------------------------ | 99 | | context | QueueableContext | QueueableContext The context object dependency injection in by the Queueable system. | 100 | 101 | #### Return Type 102 | 103 | **void** 104 | -------------------------------------------------------------------------------- /docs/OuroborosFinalizer.md: -------------------------------------------------------------------------------- 1 | continue to loop, and if so, enqueueing the next iteration. It also ensure passthrough objects are passed to the 2 | next iteration. 3 | 4 | **Implements** 5 | 6 | Finalizer 7 | 8 | ## Fields 9 | 10 | ### `ouroboros` 11 | 12 | An Ouroboros instance is required to be passed to the constructor. This is the instance that will 13 | be enqueued, if necessary. 14 | 15 | #### Signature 16 | 17 | ```apex 18 | private final ouroboros 19 | ``` 20 | 21 | #### Type 22 | 23 | [Ouroboros](Ouroboros.md) 24 | 25 | --- 26 | 27 | ### `logger` 28 | 29 | An instance of the Log class used to create transaction-rollback safe log entries 30 | 31 | #### Signature 32 | 33 | ```apex 34 | private final logger 35 | ``` 36 | 37 | #### Type 38 | 39 | [Log](Log.md) 40 | 41 | ## Constructors 42 | 43 | ### `OuroborosFinalizer(ouroboros)` 44 | 45 | Constructor. Requires an instance of an Ouroboros implementing class to be passed in. 46 | 47 | #### Signature 48 | 49 | ```apex 50 | public OuroborosFinalizer(Ouroboros ouroboros) 51 | ``` 52 | 53 | #### Parameters 54 | 55 | | Name | Type | Description | 56 | | --------- | ------------------------- | ----------------------------------------------- | 57 | | ouroboros | [Ouroboros](Ouroboros.md) | Ouroboros instance to be enqueued, if necessary | 58 | 59 | ## Methods 60 | 61 | ### `safeToEnqueueAccordingToLimits()` 62 | 63 | Method is responsible for determining if it's safe to enqueue the next iteration of the Ouroboros 64 | at least in accordance with the Queueable Apex limits. If it's not safe, the circuit breaker is tripped and the 65 | next iteration will not be enqueued. 66 | 67 | #### Signature 68 | 69 | ```apex 70 | private static Boolean safeToEnqueueAccordingToLimits() 71 | ``` 72 | 73 | #### Return Type 74 | 75 | **Boolean** 76 | 77 | Boolean True if enqueuing the next iteration will not violate any Apex governor limits 78 | 79 | --- 80 | 81 | ### `execute(context)` 82 | 83 | This is the method that is called by the Apex runtime when the Ouroboros instance has completed. 84 | It's responsible for determining if it's safe to enqueue the next iteration of the Ouroboros, and if so, if it's 85 | also necessary to enqueue the next iteration. If it is, it will enqueue the next iteration. 86 | 87 | #### Signature 88 | 89 | ```apex 90 | public void execute(FinalizerContext context) 91 | ``` 92 | 93 | #### Parameters 94 | 95 | | Name | Type | Description | 96 | | ------- | ---------------- | --------------------------------------------------------------------- | 97 | | context | FinalizerContext | FinalizerContext This is dependency injected by the Queueable system. | 98 | 99 | #### Return Type 100 | 101 | **void** 102 | -------------------------------------------------------------------------------- /docs/OuroborosTests.md: -------------------------------------------------------------------------------- 1 | ## Fields 2 | 3 | ### `codeDidTryToReEnqueue` 4 | 5 | a test only circuit breaker to ensure that the OuroborosFinalizer is called and that 6 | in turn it calls the Ouroboros code again. 7 | 8 | #### Signature 9 | 10 | ```apex 11 | private codeDidTryToReEnqueue 12 | ``` 13 | 14 | #### Type 15 | 16 | Boolean 17 | 18 | ## Methods 19 | 20 | ### `testOuroborosFunctionalNegative()` 21 | 22 | `ISTEST` 23 | 24 | #### Signature 25 | 26 | ```apex 27 | private static void testOuroborosFunctionalNegative() 28 | ``` 29 | 30 | #### Return Type 31 | 32 | **void** 33 | 34 | --- 35 | 36 | ### `testClassName()` 37 | 38 | `ISTEST` 39 | 40 | #### Signature 41 | 42 | ```apex 43 | private static void testClassName() 44 | ``` 45 | 46 | #### Return Type 47 | 48 | **void** 49 | 50 | ## Classes 51 | 52 | ### ExampleOuroborosImplementation Class 53 | 54 | This is an example implementation of Ouroboros that will be used to test the functionality 55 | 56 | #### Fields 57 | 58 | ##### `executionCount` 59 | 60 | ###### Signature 61 | 62 | ```apex 63 | private executionCount 64 | ``` 65 | 66 | ###### Type 67 | 68 | Integer 69 | 70 | --- 71 | 72 | ##### `completedExecutions` 73 | 74 | ###### Signature 75 | 76 | ```apex 77 | private completedExecutions 78 | ``` 79 | 80 | ###### Type 81 | 82 | Integer 83 | 84 | #### Methods 85 | 86 | ##### `hasExitCriteriaBeenMet()` 87 | 88 | Required method that returns true if the exit criteria has been met. 89 | 90 | ###### Signature 91 | 92 | ```apex 93 | public override Boolean hasExitCriteriaBeenMet() 94 | ``` 95 | 96 | ###### Return Type 97 | 98 | **Boolean** 99 | 100 | Boolean - true if the exit criteria has been met, false otherwise. 101 | 102 | --- 103 | 104 | ##### `execute()` 105 | 106 | This is the method that will be called when the Ouroboros executes the job. 107 | 108 | ###### Signature 109 | 110 | ```apex 111 | public override void execute() 112 | ``` 113 | 114 | ###### Return Type 115 | 116 | **void** 117 | -------------------------------------------------------------------------------- /docs/QueueableProcessDataProvider.md: -------------------------------------------------------------------------------- 1 | This helps us mock the data access in our unit tests. 2 | 3 | ## Constructors 4 | 5 | ### `QueueableProcessDataProvider()` 6 | 7 | `SUPPRESSWARNINGS` 8 | 9 | default constructor. Necessary for dynamic instantiation. 10 | 11 | #### Signature 12 | 13 | ```apex 14 | public QueueableProcessDataProvider() 15 | ``` 16 | 17 | ## Methods 18 | 19 | ### `getClassName(jobId)` 20 | 21 | This is the main method that will be called by the QueueableProcessManager. By extracting this 22 | method into a separate class, we can easily mock it in our unit tests. 23 | 24 | #### Signature 25 | 26 | ```apex 27 | public String getClassName(Id jobId) 28 | ``` 29 | 30 | #### Parameters 31 | 32 | | Name | Type | Description | 33 | | ----- | ---- | ------------------------------------------------------------- | 34 | | jobId | Id | Id The Id of the AsyncApexJob record that is being processed. | 35 | 36 | #### Return Type 37 | 38 | **String** 39 | 40 | String The name of the Apex class that just failed. 41 | -------------------------------------------------------------------------------- /docs/QueueableProcessMockDataProvider.md: -------------------------------------------------------------------------------- 1 | `SUPPRESSWARNINGS` 2 | 3 | **Implements** 4 | 5 | System.StubProvider 6 | 7 | ## Fields 8 | 9 | ### `returnString` 10 | 11 | #### Signature 12 | 13 | ```apex 14 | private final returnString 15 | ``` 16 | 17 | #### Type 18 | 19 | String 20 | 21 | ## Constructors 22 | 23 | ### `QueueableProcessMockDataProvider(returnString)` 24 | 25 | #### Signature 26 | 27 | ```apex 28 | public QueueableProcessMockDataProvider(String returnString) 29 | ``` 30 | 31 | #### Parameters 32 | 33 | | Name | Type | Description | 34 | | ------------ | ------ | ----------- | 35 | | returnString | String | | 36 | 37 | ## Methods 38 | 39 | ### `handleMethodCall(stubbedObject, stubbedMethodName, returnType, paramTypes, paramNames, args)` 40 | 41 | `SUPPRESSWARNINGS` 42 | 43 | #### Signature 44 | 45 | ```apex 46 | public Object handleMethodCall(Object stubbedObject, String stubbedMethodName, Type returnType, List paramTypes, List paramNames, List args) 47 | ``` 48 | 49 | #### Parameters 50 | 51 | | Name | Type | Description | 52 | | ----------------- | ------------------ | ----------- | 53 | | stubbedObject | Object | | 54 | | stubbedMethodName | String | | 55 | | returnType | Type | | 56 | | paramTypes | List<Type> | | 57 | | paramNames | List<String> | | 58 | | args | List<Object> | | 59 | 60 | #### Return Type 61 | 62 | **Object** 63 | -------------------------------------------------------------------------------- /docs/QuiddityGuardTests.md: -------------------------------------------------------------------------------- 1 | ## Methods 2 | 3 | ### `testQuiddityGuardFindsTestQuiddityPositive()` 4 | 5 | `ISTEST` 6 | 7 | #### Signature 8 | 9 | ```apex 10 | private static void testQuiddityGuardFindsTestQuiddityPositive() 11 | ``` 12 | 13 | #### Return Type 14 | 15 | **void** 16 | 17 | --- 18 | 19 | ### `testQuiddityOverrideReturnsFalsePositive()` 20 | 21 | `ISTEST` 22 | 23 | #### Signature 24 | 25 | ```apex 26 | private static void testQuiddityOverrideReturnsFalsePositive() 27 | ``` 28 | 29 | #### Return Type 30 | 31 | **void** 32 | 33 | --- 34 | 35 | ### `testQuiddityPositive()` 36 | 37 | `ISTEST` 38 | 39 | #### Signature 40 | 41 | ```apex 42 | private static void testQuiddityPositive() 43 | ``` 44 | 45 | #### Return Type 46 | 47 | **void** 48 | 49 | --- 50 | 51 | ### `testIsNotAcceptableQuiddityPositive()` 52 | 53 | `ISTEST` 54 | 55 | #### Signature 56 | 57 | ```apex 58 | private static void testIsNotAcceptableQuiddityPositive() 59 | ``` 60 | 61 | #### Return Type 62 | 63 | **void** 64 | -------------------------------------------------------------------------------- /docs/RestClient.md: -------------------------------------------------------------------------------- 1 | A virtual class for making REST API calls 2 | 3 | **Inheritance** 4 | 5 | [RestLib](RestLib.md) 6 | 7 | ## Properties 8 | 9 | ### `namedCredentialName` 10 | 11 | _Inherited_ 12 | 13 | `TESTVISIBLE` 14 | 15 | The name of the Named Credential to use 16 | 17 | #### Signature 18 | 19 | ```apex 20 | protected namedCredentialName 21 | ``` 22 | 23 | #### Type 24 | 25 | String 26 | 27 | ## Constructors 28 | 29 | ### `RestClient(namedCredentialName)` 30 | 31 | Constructor for the RestClient class. 32 | 33 | #### Signature 34 | 35 | ```apex 36 | public RestClient(String namedCredentialName) 37 | ``` 38 | 39 | #### Parameters 40 | 41 | | Name | Type | Description | 42 | | ------------------- | ------ | ------------------------------------------- | 43 | | namedCredentialName | String | String value of the named credential to use | 44 | 45 | ## Methods 46 | 47 | ### `makeApiCall(namedCredential, apiCall)` 48 | 49 | `SUPPRESSWARNINGS` 50 | 51 | A static wrapper for the main makeApiCall method 52 | 53 | #### Signature 54 | 55 | ```apex 56 | public static HttpResponse makeApiCall(String namedCredential, RestLibApiCall apiCall) 57 | ``` 58 | 59 | #### Parameters 60 | 61 | | Name | Type | Description | 62 | | --------------- | ----------------------------------- | ----------------------------------- | 63 | | namedCredential | String | The named credential to use | 64 | | apiCall | [RestLibApiCall](RestLibApiCall.md) | HTTPVerb enum value. See Enum above | 65 | 66 | #### Return Type 67 | 68 | **HttpResponse** 69 | 70 | ,[object Object] 71 | 72 | #### Example 73 | 74 | Log.get().publish(RestClient.makeApiCall(new RestLibApiCall('MockBin', 75 | RestClient.HttpVerb.GET, 76 | '4cb453a6-a23b-42ea-a6ba-9be1c1f17050', 77 | '', 78 | '', 79 | new Map<String,String>()))); 80 | -------------------------------------------------------------------------------- /docs/RestLib.md: -------------------------------------------------------------------------------- 1 | A class providing a library of methods for making REST callouts 2 | 3 | ## Properties 4 | 5 | ### `namedCredentialName` 6 | 7 | `TESTVISIBLE` 8 | 9 | The name of the Named Credential to use 10 | 11 | #### Signature 12 | 13 | ```apex 14 | protected namedCredentialName 15 | ``` 16 | 17 | #### Type 18 | 19 | String 20 | 21 | ## Constructors 22 | 23 | ### `RestLib(namedCredential)` 24 | 25 | Constructor that sets Named Credential 26 | 27 | #### Signature 28 | 29 | ```apex 30 | public RestLib(String namedCredential) 31 | ``` 32 | 33 | #### Parameters 34 | 35 | | Name | Type | Description | 36 | | --------------- | ------ | ----------------------------------- | 37 | | namedCredential | String | name of the Named Credential to use | 38 | 39 | --- 40 | 41 | ### `RestLib()` 42 | 43 | `TESTVISIBLE` 44 | `SUPPRESSWARNINGS` 45 | 46 | This constructor isn't intended for use, which is why it's 47 | access modifier is 'Protected'. However, any child class extending 48 | this class will either have to implement constructors matching the one 49 | above, or this constructor must exist. In order to make this abstraction 50 | as useful as possible, we've elected to leave this constructor here, 51 | but unavailable to anything but inner classes and classes that 52 | extend this one. 53 | 54 | #### Signature 55 | 56 | ```apex 57 | protected RestLib() 58 | ``` 59 | 60 | ## Methods 61 | 62 | ### `makeApiCall(apiCall)` 63 | 64 | `TESTVISIBLE` 65 | `SUPPRESSWARNINGS` 66 | 67 | Omnibus callout method. This is the primary method for 68 | making a REST callout. Most of the other methods in this class serve 69 | as convenient, syntactic sugar on this method. 70 | 71 | #### Signature 72 | 73 | ```apex 74 | protected HttpResponse makeApiCall(RestLibApiCall apiCall) 75 | ``` 76 | 77 | #### Parameters 78 | 79 | | Name | Type | Description | 80 | | ------- | ----------------------------------- | ----------------------------------------------------------------------------------- | 81 | | apiCall | [RestLibApiCall](RestLibApiCall.md) | The RestLibApiCall object containing all the information needed to make the callout | 82 | 83 | #### Return Type 84 | 85 | **HttpResponse** 86 | 87 | HttpResponse HttpResponse Obj 88 | -------------------------------------------------------------------------------- /docs/StubUtilities.md: -------------------------------------------------------------------------------- 1 | ## Properties 2 | 3 | ### `counter` 4 | 5 | a static incrementing counter tied to transaction 6 | a new comment 7 | 8 | #### Signature 9 | 10 | ```apex 11 | private static counter 12 | ``` 13 | 14 | #### Type 15 | 16 | Integer 17 | 18 | ## Methods 19 | 20 | ### `generateSObjectIds(sObjectTypeString, size)` 21 | 22 | Used when you want a MockedMethod to return a 23 | set of IDs of a given sObject Type 24 | 25 | #### Signature 26 | 27 | ```apex 28 | public static List generateSObjectIds(String sObjectTypeString, Integer size) 29 | ``` 30 | 31 | #### Parameters 32 | 33 | | Name | Type | Description | 34 | | ----------------- | ------- | ----------------------------- | 35 | | sObjectTypeString | String | Name of type: ie: `Account` | 36 | | size | Integer | Number of valid Ids to return | 37 | 38 | #### Return Type 39 | 40 | **List<Id>** 41 | 42 | ,[object Object] 43 | -------------------------------------------------------------------------------- /docs/TestPolyfills.md: -------------------------------------------------------------------------------- 1 | This class is not a unit test of the polyfills class but a 2 | set of polyfills for unit testing. 3 | 4 | ## Fields 5 | 6 | ### `circuitBreakerTripped` 7 | 8 | #### Signature 9 | 10 | ```apex 11 | public static circuitBreakerTripped 12 | ``` 13 | 14 | #### Type 15 | 16 | Boolean 17 | -------------------------------------------------------------------------------- /docs/TriggerContext.md: -------------------------------------------------------------------------------- 1 | ## Fields 2 | 3 | ### `context` 4 | 5 | the TriggerOperation this context revolves arround 6 | 7 | #### Signature 8 | 9 | ```apex 10 | public context 11 | ``` 12 | 13 | #### Type 14 | 15 | TriggerOperation 16 | 17 | --- 18 | 19 | ### `isTriggerBeingTested` 20 | 21 | A boolean override for testing purposes 22 | 23 | #### Signature 24 | 25 | ```apex 26 | public isTriggerBeingTested 27 | ``` 28 | 29 | #### Type 30 | 31 | Boolean 32 | 33 | ## Constructors 34 | 35 | ### `TriggerContext()` 36 | 37 | A default contstructor that sets the context to null and override to false 38 | 39 | #### Signature 40 | 41 | ```apex 42 | public TriggerContext() 43 | ``` 44 | 45 | ## Methods 46 | 47 | ### `isInvalidExecutionContext()` 48 | 49 | make sure this trigger should continue to run 50 | 51 | #### Signature 52 | 53 | ```apex 54 | public Boolean isInvalidExecutionContext() 55 | ``` 56 | 57 | #### Return Type 58 | 59 | **Boolean** 60 | 61 | ,[object Object], true if the trigger should continue to run 62 | 63 | #### Throws 64 | 65 | [TriggerFrameworkException](TriggerFrameworkException.md): thrown when executing outside of a,[object Object],trigger 66 | 67 | --- 68 | 69 | ### `setTriggerContext(overriddenContext, overrideForTesting)` 70 | 71 | `TESTVISIBLE` 72 | 73 | Internal method for manually setting the trigger context 74 | 75 | #### Signature 76 | 77 | ```apex 78 | private void setTriggerContext(String overriddenContext, Boolean overrideForTesting) 79 | ``` 80 | 81 | #### Parameters 82 | 83 | | Name | Type | Description | 84 | | ------------------ | ------- | ----------------------------------------- | 85 | | overriddenContext | String | The current trigger Context | 86 | | overrideForTesting | Boolean | Is the trigger running in a test context? | 87 | 88 | #### Return Type 89 | 90 | **void** 91 | 92 | --- 93 | 94 | ### `setContextDuringNormalExecution()` 95 | 96 | A method to set the trigger context during normal system execution. 97 | 98 | #### Signature 99 | 100 | ```apex 101 | private void setContextDuringNormalExecution() 102 | ``` 103 | 104 | #### Return Type 105 | 106 | **void** 107 | 108 | --- 109 | 110 | ### `setManuallyOverriddenContext(overriddenContext)` 111 | 112 | A private test visible method for manually overriding the context 113 | 114 | #### Signature 115 | 116 | ```apex 117 | private void setManuallyOverriddenContext(String overriddenContext) 118 | ``` 119 | 120 | #### Parameters 121 | 122 | | Name | Type | Description | 123 | | ----------------- | ------ | ---------------------------- | 124 | | overriddenContext | String | the context to forcibly set. | 125 | 126 | #### Return Type 127 | 128 | **void** 129 | -------------------------------------------------------------------------------- /docs/TriggerFrameworkException.md: -------------------------------------------------------------------------------- 1 | **Inheritance** 2 | 3 | Exception 4 | -------------------------------------------------------------------------------- /docs/TriggerFrameworkLoopCount.md: -------------------------------------------------------------------------------- 1 | ## Fields 2 | 3 | ### `max` 4 | 5 | #### Signature 6 | 7 | ```apex 8 | public max 9 | ``` 10 | 11 | #### Type 12 | 13 | Integer 14 | 15 | --- 16 | 17 | ### `count` 18 | 19 | #### Signature 20 | 21 | ```apex 22 | public count 23 | ``` 24 | 25 | #### Type 26 | 27 | Integer 28 | 29 | ## Constructors 30 | 31 | ### `TriggerFrameworkLoopCount()` 32 | 33 | Loop counter method with default of 5. 34 | 35 | #### Signature 36 | 37 | ```apex 38 | public TriggerFrameworkLoopCount() 39 | ``` 40 | 41 | --- 42 | 43 | ### `TriggerFrameworkLoopCount(max)` 44 | 45 | Sets loop count based on the param. 46 | 47 | #### Signature 48 | 49 | ```apex 50 | public TriggerFrameworkLoopCount(Integer max) 51 | ``` 52 | 53 | #### Parameters 54 | 55 | | Name | Type | Description | 56 | | ---- | ------- | --------------------------------- | 57 | | max | Integer | Maximum number of loops to allow. | 58 | 59 | ## Methods 60 | 61 | ### `increment()` 62 | 63 | Increment the internal counter returning the results of 64 | this.exceeded(). 65 | 66 | #### Signature 67 | 68 | ```apex 69 | public Boolean increment() 70 | ``` 71 | 72 | #### Return Type 73 | 74 | **Boolean** 75 | 76 | ,[object Object], true if count will exceed max count or is less,[object Object],than 0. 77 | 78 | --- 79 | 80 | ### `exceeded()` 81 | 82 | Determines if this we're about to exceed the loop count. 83 | 84 | #### Signature 85 | 86 | ```apex 87 | public Boolean exceeded() 88 | ``` 89 | 90 | #### Return Type 91 | 92 | **Boolean** 93 | 94 | ,[object Object], true if less than 0 or more than max. 95 | 96 | --- 97 | 98 | ### `getMax()` 99 | 100 | Returns the max loop count. 101 | 102 | #### Signature 103 | 104 | ```apex 105 | public Integer getMax() 106 | ``` 107 | 108 | #### Return Type 109 | 110 | **Integer** 111 | 112 | ,[object Object], max loop count. 113 | 114 | --- 115 | 116 | ### `getCount()` 117 | 118 | Returns the current loop count. 119 | 120 | #### Signature 121 | 122 | ```apex 123 | public Integer getCount() 124 | ``` 125 | 126 | #### Return Type 127 | 128 | **Integer** 129 | 130 | ,[object Object], current loop count. 131 | 132 | --- 133 | 134 | ### `setMax(max)` 135 | 136 | Sets the max loop size 137 | 138 | #### Signature 139 | 140 | ```apex 141 | public void setMax(Integer max) 142 | ``` 143 | 144 | #### Parameters 145 | 146 | | Name | Type | Description | 147 | | ---- | ------- | -------------------------- | 148 | | max | Integer | The integer to set max to. | 149 | 150 | #### Return Type 151 | 152 | **void** 153 | -------------------------------------------------------------------------------- /docs/ULIDTests.md: -------------------------------------------------------------------------------- 1 | This seems like a woefully inadequate test class. 2 | However, the ULID class contains no branching logic to test. 3 | The single public method is fully tested by this class' method. 4 | Because ULIDs are intentionally random, there's no way to test 5 | deterministic output. 6 | 7 | ## Methods 8 | 9 | ### `testGenerateMethod()` 10 | 11 | `ISTEST` 12 | 13 | #### Signature 14 | 15 | ```apex 16 | private static void testGenerateMethod() 17 | ``` 18 | 19 | #### Return Type 20 | 21 | **void** 22 | -------------------------------------------------------------------------------- /force-app/main/Universal Flow Invocable/classes/BulkCallable.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * @description Provides a similar interface to Callable, but bulkified to handle multiple sets of parameters. 3 | * 4 | * @author Brian Fear 5 | */ 6 | public interface BulkCallable { 7 | /** 8 | * @description Implementing classes must implement this method signature. 9 | * 10 | * @param methodName String the name of the method to call 11 | * @param parameters List> a list of maps of parameters to pass to the method 12 | * 13 | * @return List The results of the called Apex methods 14 | */ 15 | List call(String methodName, List> parameters); 16 | } 17 | -------------------------------------------------------------------------------- /force-app/main/Universal Flow Invocable/classes/BulkCallable.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/Universal Flow Invocable/classes/CustomInvocable.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/Universal Flow Invocable/classes/UFInvocable.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/Universal Flow Invocable/classes/UniversalBulkInvocable.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * @description This class contains the one and only invocable method that will be displayed in the flow builder. 3 | */ 4 | public with sharing class UniversalBulkInvocable { 5 | /** 6 | * @description This method is what will be displayed in the flow builder. This method can correctly handle bulk 7 | * invocations, even across multiple classes and methods, returning all outputs in the same order as the inputs. 8 | * @param inputs List input objects. The first object in the list will be used. 9 | * 10 | * @return List output objects. Every input receives one output, even if 11 | * non-fatal exceptions are encountered. 12 | */ 13 | @InvocableMethod( 14 | Label='Bulk Universal Invocable' 15 | Description='Bulk Universal Invocable' 16 | ) 17 | public static List> invoke( 18 | List> inputs 19 | ) { 20 | return new UFInvocable.Processor(inputs).executeBulk(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /force-app/main/Universal Flow Invocable/classes/UniversalBulkInvocable.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | -------------------------------------------------------------------------------- /force-app/main/Universal Flow Invocable/classes/UniversalFlowInputOutput.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | -------------------------------------------------------------------------------- /force-app/main/Universal Flow Invocable/classes/UniversalFlowInputOutputParameter.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/Universal Flow Invocable/classes/UniversalInvocable.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * @description This class exposes methods from any class that extends Invocable to flows. 3 | * By adding 'extends Invocable' to your class and adding the call method, any class' methods can be 4 | * invoked by this single invocable method. 5 | * 6 | */ 7 | public class UniversalInvocable { 8 | /** 9 | * @description This method is what will be displayed in the flow builder. This method can correctly handle bulk 10 | * invocations, even across multiple classes and methods, returning all outputs in the same order as the inputs. 11 | * @param inputs List input objects. The first object in the list will be used. 12 | * 13 | * @return List output objects. Every input receives one output, even if 14 | * non-fatal exceptions are encountered. 15 | */ 16 | @InvocableMethod( 17 | Label='Universal Invocable' 18 | Description='Universal Invocable' 19 | ) 20 | public static List invoke( 21 | List inputs 22 | ) { 23 | return new UFInvocable.Processor(inputs).execute(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /force-app/main/Universal Flow Invocable/classes/UniversalInvocable.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/applications/standard__LightningSales.app-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Small 4 | Medium 5 | Large 6 | false 7 | false 8 | false 9 | 10 | Standard 11 | standard-home 12 | standard-Opportunity 13 | standard-Lead 14 | standard-Task 15 | standard-File 16 | standard-Account 17 | standard-Contact 18 | standard-Campaign 19 | standard-Dashboard 20 | standard-report 21 | standard-Feed 22 | standard-CollaborationGroup 23 | standard-Event 24 | standard-OtherUserProfile 25 | standard-Case 26 | standard-Forecasting3 27 | LogEvent__c 28 | Lightning 29 | 30 | -------------------------------------------------------------------------------- /force-app/main/default/applications/standard__Service.app-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | standard-home 4 | Large 5 | false 6 | false 7 | false 8 | standard-Chatter 9 | standard-Account 10 | standard-Contact 11 | standard-Case 12 | standard-Solution 13 | standard-report 14 | standard-Dashboard 15 | LogEvent__c 16 | 17 | -------------------------------------------------------------------------------- /force-app/main/default/aura/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": ["@salesforce/eslint-plugin-aura"], 3 | "extends": ["plugin:@salesforce/eslint-plugin-aura/recommended"], 4 | "rules": { 5 | "vars-on-top": "off", 6 | "no-unused-expressions": "off" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /force-app/main/default/cachePartitions/default.cachePartition-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | false 4 | default 5 | 6 | 0 7 | 0 8 | 0 9 | 0 10 | Session 11 | 12 | 13 | 3 14 | 0 15 | 0 16 | 0 17 | Organization 18 | 19 | 20 | -------------------------------------------------------------------------------- /force-app/main/default/classes/Repository/BaseRepo.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/Repository/BaseRepoTests.cls: -------------------------------------------------------------------------------- 1 | public with sharing class BaseRepoTests { 2 | } 3 | -------------------------------------------------------------------------------- /force-app/main/default/classes/Repository/BaseRepoTests.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/ULID/ULID.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/ULID/tests/ULIDTests.cls: -------------------------------------------------------------------------------- 1 | @IsTest /** 2 | * @description This seems like a woefully inadequate test class. 3 | * However, the ULID class contains no branching logic to test. 4 | * The single public method is fully tested by this class' method. 5 | * Because ULIDs are intentionally random, there's no way to test 6 | * deterministic output. 7 | */ 8 | class ULIDTests { 9 | @IsTest 10 | private static void testGenerateMethod() { 11 | Test.startTest(); 12 | String ulid = ULID.generate(); 13 | Test.stopTest(); 14 | Assert.areNotEqual(null, ulid, 'ulid string should not be null'); 15 | Assert.areEqual( 16 | 26, 17 | ulid.length(), 18 | 'ulid string should be 26 characters long' 19 | ); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /force-app/main/default/classes/ULID/tests/ULIDTests.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/custom metadata tools/CustomMetadataUtilDeploymentCallback.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * @description Callback implementation for Custom Metadata deployment operations 3 | * @author ApexKit Contributors 4 | */ 5 | public with sharing class CustomMetadataUtilDeploymentCallback implements Metadata.DeployCallback { 6 | /** 7 | * @description Exception class for deployment callback errors 8 | */ 9 | public class CustomMetadataUtilDeploymentCallbackException extends Exception { 10 | } 11 | 12 | /** 13 | * @description Handles the result of a metadata deployment. 14 | * NOTE: This is a stub. This is functional, but bare-minimum implementation. 15 | * You should 100% re-write this method to work with your needs. 16 | * 17 | * @param result The DeployResult object containing deployment status and details - this is DI'd by Salesforce 18 | * @param context The DeployCallbackContext for the deployment - this is DI'd by Salesforce 19 | * @throws CustomMetadataUtilDeploymentCallbackException When deployment fails 20 | */ 21 | public void handleResult( 22 | Metadata.DeployResult result, 23 | Metadata.DeployCallbackContext context 24 | ) { 25 | if (result.status == Metadata.DeployStatus.Succeeded) { 26 | System.debug( 27 | 'Callback received a result status that indicated success. Results: ' + 28 | result 29 | ); 30 | } else if (result.status == Metadata.DeployStatus.Failed) { 31 | System.debug( 32 | 'Callback received a result status that indicated failure. Results: ' + 33 | result 34 | ); 35 | throw new CustomMetadataUtilDeploymentCallbackException( 36 | 'Callback received a result status that indicated failure. Results: ' + 37 | result 38 | ); 39 | } else { 40 | throw new CustomMetadataUtilDeploymentCallbackException( 41 | 'Custom Metadata deployment failed. Results: ' + String.valueOf(result) 42 | ); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /force-app/main/default/classes/custom metadata tools/CustomMetadataUtilDeploymentCallback.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/custom metadata tools/CustomMetadataUtilities.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/custom metadata tools/tests/CustomMetadataUtilDeployCallbackTests.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | -------------------------------------------------------------------------------- /force-app/main/default/classes/custom metadata tools/tests/CustomMetadataUtilitiesTests.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | -------------------------------------------------------------------------------- /force-app/main/default/classes/feature flags/FF.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * @description Convenience class for checking feature flags. This is purely Syntactic sugar. 3 | * 4 | * @group FeatureFlag 5 | */ 6 | public with sharing class FF { 7 | /** 8 | * @description Convenience method for checking if a feature is enabled. 9 | * 10 | * @param featureName String feature name to check 11 | * 12 | * @return True if the feature is enabled by any of the following: Universally enabled, or enabled for the current 13 | * user based on permission set, custom permission or time. 14 | */ 15 | public static Boolean isEnabled(String featureName) { 16 | return new FeatureFlag().isEnabled(featureName); 17 | } 18 | 19 | /** 20 | * @description logical inverse of the isEnabled method. 21 | * 22 | * @param featureName String feature name to check 23 | * 24 | * @return Boolean, returns inverse of isEnabled. 25 | */ 26 | public static Boolean isNotEnabled(String featureName) { 27 | return !isEnabled(featureName); 28 | } 29 | 30 | /** 31 | * @description Law of diminishing returns here. This isn't tested, per-say. It's underlying FeatureFlag 32 | * implementation *is* tested, however. 33 | * 34 | * @param featureName String the feature name to check 35 | * 36 | * @return String the value stored in custom metadata for this feature flag. 37 | */ 38 | public static String value(String featureName) { 39 | return new FeatureFlag().value(featureName); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /force-app/main/default/classes/feature flags/FF.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/feature flags/FeatureFlag.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/feature flags/FeatureFlagDataProvider.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/feature flags/tests/FeatureFlagCommonTests.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * @description Class serves to DRY code for various testing methods that 3 | * require it. It is not intended to be used directly. 4 | */ 5 | @IsTest 6 | public class FeatureFlagCommonTests { 7 | /** 8 | * @description This is the id of the feature flag that's included with ApexKit. CMDT can be hard to test with 9 | * because you can't necessarily know the object prefix until a cmdt record is saved. :( 10 | */ 11 | static final Id EXAMPLE_FEATURE_FLAG_ID = [ 12 | SELECT Id 13 | FROM Feature_Flag__mdt 14 | LIMIT 1 15 | ] 16 | .Id; 17 | 18 | /** 19 | * @description DRY method to create a test flag with valid-ish id. 20 | * 21 | * @param flagName String name of the Flag 22 | * @param enabled Boolean whether the flag is enabled universally or not 23 | * 24 | * @return Map test flag 25 | */ 26 | public static Map getTestFlag( 27 | String flagName, 28 | Boolean enabled 29 | ) { 30 | Map testFlag = new Map(); 31 | testFlag.put( 32 | 'TestFlag', 33 | new Feature_Flag__mdt( 34 | Label = flagName, 35 | DeveloperName = flagName, 36 | Id = EXAMPLE_FEATURE_FLAG_ID, 37 | isEnabled__c = enabled, 38 | Flag_Value__c = 'test value' 39 | ) 40 | ); 41 | return testFlag; 42 | } 43 | 44 | /** 45 | * @description fetches a valid permission set id 46 | * 47 | * @return Id the id of the permissionset that's included with ApexKit 48 | */ 49 | public static Id getExistingPermSetId() { 50 | return new SOQL.Builder('PermissionSet') 51 | .selectField('Id') 52 | .whereCondition(new Query.Condition().equals('Name', 'Async_Log_Access')) 53 | .build() 54 | .getRecord() 55 | .Id; 56 | } 57 | 58 | /** 59 | * @description returns a map of feature flags that are enabled just for a specified permission set 60 | * 61 | * @param flagName String name of the flag 62 | * @param permSetId Id the id of the permission set that enables this flag 63 | * @param enabled Boolean whether the flag is enabled or not 64 | * 65 | * @return Map the map of feature flags 66 | */ 67 | public static Map getOverriddenPerPermSet( 68 | String flagName, 69 | Id permSetId, 70 | Boolean enabled 71 | ) { 72 | Map overriddenPerPermSet = new Map(); 73 | overriddenPerPermSet.put( 74 | flagName, 75 | new Feature_Flag_Enabled_For__mdt( 76 | Label = 'TestFlag', 77 | DeveloperName = 'TestFlag', 78 | Feature_Flag__c = EXAMPLE_FEATURE_FLAG_ID, 79 | isEnabled__c = enabled, 80 | Permission_Set_Id__c = permSetId 81 | ) 82 | ); 83 | return overriddenPerPermSet; 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /force-app/main/default/classes/feature flags/tests/FeatureFlagCommonTests.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/feature flags/tests/FeatureFlagDataProviderTests.cls: -------------------------------------------------------------------------------- 1 | @IsTest 2 | class FeatureFlagDataProviderTests { 3 | @IsTest 4 | private static void testEnablingPermissionSetsPositive() { 5 | FeatureFlagDataProvider dataProvider = new FeatureFlagDataProvider(); 6 | Id permSetId = FeatureFlagCommonTests.getExistingPermSetId(); 7 | dataProvider.overrideFlags( 8 | FeatureFlagCommonTests.getTestFlag('TestFlag', true) 9 | ); 10 | dataProvider.overridePerPermSetOverrides( 11 | FeatureFlagCommonTests.getOverriddenPerPermSet( 12 | 'TestFlag', 13 | permSetId, 14 | true 15 | ) 16 | ); 17 | Test.startTest(); 18 | Set result = dataProvider.enablingPermissionSets('TestFlag'); 19 | Test.stopTest(); 20 | Assert.areEqual( 21 | true, 22 | result.contains(permSetId), 23 | 'User should have assigned permission set' 24 | ); 25 | } 26 | 27 | @IsTest 28 | private static void testReturnEmptySetWhenNoPermSetOverridesFound() { 29 | FeatureFlagDataProvider dataProvider = new FeatureFlagDataProvider(); 30 | Test.startTest(); 31 | Set result = dataProvider.enablingPermissionSets('TestFlag'); 32 | Test.stopTest(); 33 | Assert.areEqual( 34 | result.isEmpty(), 35 | true, 36 | 'Should return empty set when no perm set overrides found' 37 | ); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /force-app/main/default/classes/feature flags/tests/FeatureFlagDataProviderTests.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/feature flags/tests/FeatureFlagTests.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/log/Examples/readme.md: -------------------------------------------------------------------------------- 1 | # Using the Log class 2 | 3 | ## What is this? 4 | 5 | Apex Kit's Log class is designed to provide developers a simple way to persist log information that is immune to 6 | database transaction rollbacks. 7 | This means you can safely Log things using this library and not worry about the log being rolled back if the transaction 8 | fails. 9 | 10 | ## Design 11 | 12 | Log is built as a singleton. This means you cannot construct an instance of Log, nor can you have multiple instances of 13 | Log in a single transaction. 14 | Instead, you'll use the Log.get() method to get an existing instance of Log if one exists, and create a new one if it 15 | doesn't. 16 | 17 | At a high level, this logger works by constructing a platform event and publishing it. A trigger on the platform event 18 | then takes the log entry and persists it to the database. 19 | 20 | ## Usage 21 | 22 | There are two main methods of operation for the Log class. The first is to simply publish a log entry immediately. The 23 | second is to queue up log entries and publish them all at once. The Log class has been written with several overriden 24 | methods to make it easy to use. Here are some common use cases. 25 | 26 | > Note, you'll want to use the Log's queue methods to separate out the logging of events and the publishing of those 27 | > events when making callouts. 28 | 29 | ### Publish Immediately 30 | 31 | #### How do I get a Log instance? 32 | 33 | ```apex 34 | Log log = Log.get(); 35 | ``` 36 | 37 | #### How do I log a string immediately? 38 | 39 | ```apex 40 | Log log = Log.get().publish('your string here'); 41 | ``` 42 | 43 | #### How do I log a string with a custom log level? 44 | 45 | ```apex 46 | Log log = Log.get().publish(LogLevel.INFO, 'your string here'); 47 | ``` 48 | 49 | #### How do I log an exception? 50 | 51 | ```apex 52 | Log log = Log.get().publish(yourExceptionObjectHere); 53 | ``` 54 | 55 | ### Queue up log entries and publish them all at once 56 | 57 | #### How do I log a string? 58 | 59 | ```apex 60 | Log log = Log.get(); 61 | log.add('your string here'); 62 | log.publish(); 63 | ``` 64 | 65 | #### How do I log a string with a custom log level? 66 | 67 | ```apex 68 | Log log = Log.get(); 69 | log.add('your string here', LogLevel.DEBUG); 70 | log.publish(); 71 | ``` 72 | 73 | #### How do I log an exception? 74 | 75 | ```apex 76 | Log log = Log.get(); 77 | log.add(yourExceptionObjectHere); 78 | log.publish(); 79 | ``` 80 | 81 | #### Can I mix and match exceptions and strings? YES! 82 | 83 | ```apex 84 | Log log = Log.get(); 85 | log.add('your string here'); 86 | log.add(yourExceptionObjectHere); 87 | log.publish(); 88 | ``` 89 | -------------------------------------------------------------------------------- /force-app/main/default/classes/log/Log.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/log/LogException.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * @description This is a custom exception class for logging purposes. 4 | * I create a custom exception for every feature of ApexKit. While 5 | * this exception isn't yet used, it's here as a nod to consistency. 6 | */ 7 | public class LogException extends Exception { 8 | } 9 | -------------------------------------------------------------------------------- /force-app/main/default/classes/log/LogException.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/log/LogMessage.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * @description A class for automatically attaching metadata to log messages 3 | * like Quiddity and RequestID 4 | * 5 | * @see Log 6 | * @see LogException 7 | * @see LogTriggerHandler 8 | */ 9 | public with sharing class LogMessage { 10 | private static final String EXCEPTION_STRING_FORMAT = 'Exception: [{0}] {1} \n StackTrace: {2}'; 11 | 12 | /** 13 | * @description public read only property for the request ID. Privately set. 14 | */ 15 | public String requestId { 16 | get { 17 | if (requestId == null) { 18 | requestId = Request.getCurrent().getRequestId(); 19 | } 20 | return requestId; 21 | } 22 | private set; 23 | } 24 | 25 | /** 26 | * @description Public read only property for quiddity. Privately set. 27 | */ 28 | public Quiddity quiddity { 29 | get { 30 | if (quiddity == null) { 31 | quiddity = Request.getCurrent().getQuiddity(); 32 | } 33 | return quiddity; 34 | } 35 | private set; 36 | } 37 | 38 | /** 39 | * @description Public message property. 40 | */ 41 | public String message { get; set; } 42 | 43 | /** 44 | * @description Public severity property. 45 | */ 46 | public LoggingLevel severity { get; set; } 47 | 48 | /** 49 | * @description converts this object to an event for publishing 50 | * @return `SObject` 51 | */ 52 | public Log__e toEvent() { 53 | return new Log__e( 54 | Log_Message__c = this.message, 55 | Request_Id__c = this.requestId, 56 | Quiddity__c = this.quiddity?.name(), 57 | Severity__c = this.severity?.name() 58 | ); 59 | } 60 | 61 | /** 62 | * @description Constructor accepting a message to log. 63 | * Severity is auto set to info 64 | * 65 | * @param severity LoggingLevel the severity of the message 66 | * @param message String the string to log 67 | */ 68 | public LogMessage(LoggingLevel severity, String message) { 69 | this.message = message; 70 | this.severity = severity; 71 | } 72 | 73 | /** 74 | * @description Constructor accepting a message to log. 75 | * Severity is auto set to info 76 | * 77 | * @param message String the string to log 78 | */ 79 | public LogMessage(String message) { 80 | this(LoggingLevel.INFO, message); 81 | } 82 | 83 | /** 84 | * @description Constructor accepting an exception object. 85 | * 86 | * @param ex any exception object 87 | */ 88 | public LogMessage(Exception ex) { 89 | this.message = String.format( 90 | EXCEPTION_STRING_FORMAT, 91 | new List{ 92 | ex.getTypeName(), 93 | ex.getMessage(), 94 | ex.getStackTraceString() 95 | } 96 | ); 97 | this.severity = LoggingLevel.ERROR; 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /force-app/main/default/classes/log/LogMessage.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/log/LogTriggerHandler.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * @description Class handles the post-insert processing of Log events 3 | *
Extends the TriggerFramework class 4 | *
Enables the user to define if this handler should silently 5 | * ignore errors thrown by dml, or if it should throw a log 6 | * exception 7 | */ 8 | public with sharing class LogTriggerHandler extends TriggerFramework { 9 | private List logs = new List(); 10 | private Boolean shouldThrow = false; 11 | 12 | /** 13 | * @description Constructor, called by trigger. 14 | * @param logs Logs to process 15 | * @param shouldThrow if true, this class will throw a log exception 16 | * when DML errors occur. 17 | */ 18 | public LogTriggerHandler(List logs, Boolean shouldThrow) { 19 | this.logs = logs; 20 | this.shouldThrow = shouldThrow; 21 | } 22 | 23 | /** 24 | * @description convenience constructor, calls previous constructor 25 | * but will not throw a log exception on dml errors 26 | * @param logs logs to process 27 | */ 28 | public LogTriggerHandler(List logs) { 29 | this(logs, false); 30 | } 31 | 32 | /** 33 | * @description Overridden from TriggerFramework. 34 | * TriggerFramework executes this method when the trigger 35 | * context is after insert 36 | * 37 | * @throws LogException on Database.insert failure 38 | * isSuccess is false 39 | */ 40 | public override void afterInsert() { 41 | List events = new List(); 42 | for (Log__e log : logs) { 43 | events.add( 44 | new LogEvent__c( 45 | Log_Data__c = log.Log_Message__c, 46 | Quiddity__c = log.Quiddity__c, 47 | Request_Id__c = log.Request_Id__c, 48 | Severity__c = log.Severity__c 49 | ) 50 | ); 51 | } 52 | 53 | List results = Database.insert(events, false); 54 | Boolean reasonToThrow = false; 55 | String firstError = ''; 56 | 57 | for (Database.SaveResult result : results) { 58 | if (!result.isSuccess()) { 59 | reasonToThrow = true; 60 | firstError = result.getErrors()[0].getMessage(); 61 | System.debug( 62 | LoggingLevel.ERROR, 63 | 'Failed to Save Log Message + ' + result 64 | ); 65 | } 66 | } 67 | if (reasonToThrow) { 68 | throw new LogException( 69 | 'Failed to save (at least one) LogEvent__c Records. First error: ' + 70 | firstError 71 | ); 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /force-app/main/default/classes/log/LogTriggerHandler.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/log/tests/LogTests.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/orgShape/CachePartitionType.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * Enum for partition type. 3 | */ 4 | public enum CachePartitionType { 5 | SESSION, 6 | ORG 7 | } 8 | -------------------------------------------------------------------------------- /force-app/main/default/classes/orgShape/CachePartitionType.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/orgShape/OrgShape.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/orgShape/tests/OrgShapeTests.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/ouroboros/Ouroboros.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * @description Ouroboros is the ancient mythical symbol of a dragon or serpent eating its own tail. It's often 3 | * understood as a reference to the circle of life, or the never ending nature life and death. In this case, it's a 4 | * reference to a Queueable object that enqueues itself when it's done executing via a OuroborosFinalizer. This is a 5 | * useful pattern when you need to process high volumes of data, but don't care if it's processed in real time. 6 | */ 7 | public with sharing abstract class Ouroboros implements Queueable, Database.AllowsCallouts { 8 | /** 9 | * @description Object that will be passed through to the next iteration of the Ouroboros. 10 | */ 11 | public Object passthrough; 12 | 13 | /** 14 | * @description This is the method that implementing classes must override. It's the method that will be called 15 | * to determine if whether or not to re-enqueue the Ouroboros Queueable. 16 | * 17 | * @return Boolean True if the exit criteria has been met. 18 | */ 19 | abstract public Boolean hasExitCriteriaBeenMet(); 20 | 21 | /** 22 | * @description This is the method that will be called as the executable portion of the Queueable. It's the method 23 | * developers will populate with their business logic to execute on each iteration of the Ouroboros. 24 | */ 25 | abstract public void execute(); 26 | 27 | /** 28 | * @description This method is to be deprecated shortly, in favor of the lookup system built in QueueableProcess. 29 | * 30 | * @return String class name. Currently only used in the finalizer for logging purposes. 31 | */ 32 | public String className() { 33 | return Polyfills.classNameFromInstance(this); 34 | } 35 | 36 | /** 37 | * @description This is the method that will be executed by the Queueable system. It accepts the context object 38 | * and calls the implementing class' `execute` method. It then creates a new instance of the OuroborosFinalizer 39 | * class and attaches it to the system context. 40 | * 41 | * @param context QueueableContext The context object dependency injection in by the Queueable system. 42 | */ 43 | public virtual void execute(QueueableContext context) { 44 | // invoke the abstract method `execute`. see the comment above. 45 | execute(); 46 | // create a new instance of the finalizer class. 47 | Finalizer ouroborosFinalizer = new OuroborosFinalizer(this); 48 | // Attach the finalizer to system context. This will take care 49 | // of enqueueing the next iteration. 50 | System.attachFinalizer(ouroborosFinalizer); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /force-app/main/default/classes/ouroboros/Ouroboros.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/ouroboros/OuroborosFinalizer.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/ouroboros/tests/OuroborosTests.cls: -------------------------------------------------------------------------------- 1 | @IsTest 2 | class OuroborosTests { 3 | /** 4 | * @description a test only circuit breaker to ensure that the OuroborosFinalizer is called and that 5 | * in turn it calls the Ouroboros code again. 6 | */ 7 | private Boolean codeDidTryToReEnqueue = false; 8 | 9 | /** 10 | * @description This is an example implementation of Ouroboros that will be used to test the functionality 11 | */ 12 | public class ExampleOuroborosImplementation extends Ouroboros { 13 | Integer executionCount = 1; 14 | Integer completedExecutions = 0; 15 | /** 16 | * @description Required method that returns true if the exit criteria has been met. 17 | * 18 | * @return Boolean - true if the exit criteria has been met, false otherwise. 19 | */ 20 | public override Boolean hasExitCriteriaBeenMet() { 21 | if ((Integer) this.passthrough >= executionCount) { 22 | return true; 23 | } 24 | return false; 25 | } 26 | 27 | /** 28 | * @description This is the method that will be called when the Ouroboros executes the job. 29 | */ 30 | public override void execute() { 31 | this.completedExecutions++; 32 | } 33 | } 34 | 35 | @IsTest 36 | private static void testOuroborosFunctionalNegative() { 37 | ExampleOuroborosImplementation example = new ExampleOuroborosImplementation(); 38 | example.passthrough = 0; 39 | Test.startTest(); 40 | System.enqueueJob(example); 41 | Test.stopTest(); 42 | Assert.isTrue( 43 | TestPolyfills.circuitBreakerTripped, 44 | 'Expected OuroborosFinalizer to have tripped the circuitBreaker but it was not' 45 | ); 46 | } 47 | 48 | @IsTest 49 | private static void testClassName() { 50 | Test.startTest(); 51 | Assert.areNotEqual( 52 | null, 53 | new OuroborosTests.ExampleOuroborosImplementation().className(), 54 | 'Expected className to return a non-null value' 55 | ); 56 | Test.stopTest(); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /force-app/main/default/classes/ouroboros/tests/OuroborosTests.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/polyfills/FailsafeExceptionHandler.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * @description This class is a polyfill for the handling exceptions. Rather than writing 3 | * boilerplate exception handling code everywhere, this class can be used to log exceptions. 4 | */ 5 | public with sharing class FailsafeExceptionHandler implements System.Callable { 6 | /** 7 | * @description An instance of Log to log exceptions. 8 | */ 9 | @TestVisible 10 | private final Log logger = Log.get(); 11 | 12 | @SuppressWarnings('PMD.EmptyStatementBlock') 13 | public FailsafeExceptionHandler() { 14 | } 15 | 16 | /** 17 | * @description Constructor usage for a single exception. 18 | * 19 | * @param incomingException Exception the Exception to be handled. 20 | * 21 | * @example `new FailsafeExceptionHandler(incomingException);` 22 | */ 23 | public FailsafeExceptionHandler(Exception incomingException) { 24 | this.handledException(incomingException); 25 | logger.publish(); 26 | } 27 | 28 | /** 29 | * @description Constructor usage for a list of exceptions. 30 | * 31 | * @param incomingExceptions List the list of exceptions to be handled. 32 | * 33 | * @example `new FailsafeExceptionHandler(incomingExceptions);` 34 | */ 35 | public FailsafeExceptionHandler(List incomingExceptions) { 36 | this.handleExceptions(incomingExceptions); 37 | logger.publish(); 38 | } 39 | 40 | /** 41 | * @description Handles an incoming exception by adding it to the log list. 42 | * 43 | * @param incomingException Exception the exception to be handled. 44 | */ 45 | public void handledException(Exception incomingException) { 46 | logger.add(incomingException); 47 | } 48 | 49 | /** 50 | * @description handles an list of incoming exceptions 51 | * 52 | * @param exceptions List the list of exceptions to be handled. 53 | */ 54 | public void handleExceptions(List exceptions) { 55 | for (Exception incomingException : exceptions) { 56 | this.handledException(incomingException); 57 | } 58 | } 59 | 60 | /** 61 | * @description Implements the Callable interface. This allows the class to be used outside of a package boundary. 62 | * 63 | * @param action String the action to be performed. The only one handled in this class is 'handleException'. 64 | * @param args Map the arguments to be passed to the action. in this case 65 | * 'incomingException' => Exception 66 | * 67 | * @return Object returns null 68 | */ 69 | public Object call(String action, Map args) { 70 | switch on action { 71 | when 'handleException' { 72 | this.handledException((Exception) args.get('incomingException')); 73 | } 74 | when 'handleExceptions' { 75 | this.handleExceptions((List) args.get('incomingExceptions')); 76 | } 77 | } 78 | logger.publish(); 79 | return null; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /force-app/main/default/classes/polyfills/FailsafeExceptionHandler.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/polyfills/Polyfills.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/polyfills/tests/FailsafeExceptionHandlerTests.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/polyfills/tests/PolyfillsTests.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/polyfills/tests/TestPolyfills.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * @description This class is not a unit test of the polyfills class but a 3 | * set of polyfills for unit testing. 4 | */ 5 | @isTest 6 | public with sharing class TestPolyfills { 7 | public static Boolean circuitBreakerTripped = false; 8 | } 9 | -------------------------------------------------------------------------------- /force-app/main/default/classes/polyfills/tests/TestPolyfills.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/query lib/FieldSelection.cls: -------------------------------------------------------------------------------- 1 | public enum FieldSelection { 2 | ALL, 3 | STANDARD, 4 | CUSTOM 5 | } 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/query lib/FieldSelection.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/query lib/Query.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/query lib/SOQL.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/query lib/SOQLAgregate.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/query lib/SOSL.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/query lib/tests/QueryTest.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/query lib/tests/SOQLAgregateTest.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/query lib/tests/SOQLTest.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/query lib/tests/SOSLTest.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/queueable process/EnqueueNextQueueableProcessStep.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/queueable process/QueueableProcess.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/queueable process/QueueableProcessDataProvider.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * @description A class that separates concerns between the QueueableProcessManager and doing data lookup/access. 3 | * This helps us mock the data access in our unit tests. 4 | */ 5 | public with sharing class QueueableProcessDataProvider { 6 | @SuppressWarnings('PMD.EmptyStatementBlock') 7 | /** 8 | * @description default constructor. Necessary for dynamic instantiation. 9 | */ 10 | public QueueableProcessDataProvider() { 11 | } 12 | 13 | /** 14 | * @description This is the main method that will be called by the QueueableProcessManager. By extracting this 15 | * method into a separate class, we can easily mock it in our unit tests. 16 | * 17 | * @param jobId Id The Id of the AsyncApexJob record that is being processed. 18 | * 19 | * @return String The name of the Apex class that just failed. 20 | */ 21 | public String getClassName(Id jobId) { 22 | return [ 23 | SELECT ApexClass.Name 24 | FROM AsyncApexJob 25 | WHERE Id = :jobId 26 | WITH SYSTEM_MODE 27 | ] 28 | .ApexClass.Name; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /force-app/main/default/classes/queueable process/QueueableProcessDataProvider.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/queueable process/QueueableProcessMockDataProvider.cls: -------------------------------------------------------------------------------- 1 | @IsTest 2 | @SuppressWarnings('PMD.apexdoc') 3 | public class QueueableProcessMockDataProvider implements System.StubProvider { 4 | private final String returnString; 5 | public QueueableProcessMockDataProvider(String returnString) { 6 | this.returnString = returnString; 7 | } 8 | @SuppressWarnings('PMD.ExcessiveParameterList') 9 | public Object handleMethodCall( 10 | Object stubbedObject, 11 | String stubbedMethodName, 12 | Type returnType, 13 | List paramTypes, 14 | List paramNames, 15 | List args 16 | ) { 17 | // We'ere only working with one method here, so this suffices. 18 | return this.returnString; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /force-app/main/default/classes/queueable process/QueueableProcessMockDataProvider.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/queueable process/tests/ExampleQueueableProcessSteps.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/queueable process/tests/QueueableProcessTests.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/quiddity/QuiddityGuard.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/quiddity/tests/QuiddityGuardTests.cls: -------------------------------------------------------------------------------- 1 | @IsTest 2 | private class QuiddityGuardTests { 3 | @IsTest 4 | private static void testQuiddityGuardFindsTestQuiddityPositive() { 5 | Test.startTest(); 6 | Assert.isTrue( 7 | QuiddityGuard.isAcceptableQuiddity(QuiddityGuard.trustedQuiddities), 8 | 'Expected a testQuiddity to be in the Trusted Quiddities list' 9 | ); 10 | Test.stopTest(); 11 | } 12 | 13 | @IsTest 14 | private static void testQuiddityOverrideReturnsFalsePositive() { 15 | QuiddityGuard.testQuiddityOverride = Quiddity.FUTURE; 16 | Test.startTest(); 17 | Assert.areNotEqual( 18 | true, 19 | QuiddityGuard.isAcceptableQuiddity(QuiddityGuard.trustedQuiddities), 20 | 'Expected Future quiddity to not be in trusted quiddities list' 21 | ); 22 | Test.stopTest(); 23 | } 24 | 25 | @IsTest 26 | private static void testQuiddityPositive() { 27 | QuiddityGuard.testQuiddityOverride = Quiddity.FUTURE; 28 | Test.startTest(); 29 | Assert.areNotEqual( 30 | Quiddity.FUTURE, 31 | QuiddityGuard.quiddity(), 32 | 'Expected Future quiddity to not be in trusted quiddities list' 33 | ); 34 | Test.stopTest(); 35 | } 36 | 37 | @IsTest 38 | private static void testIsNotAcceptableQuiddityPositive() { 39 | QuiddityGuard.testQuiddityOverride = Quiddity.VF; 40 | Test.startTest(); 41 | Assert.areNotEqual( 42 | true, 43 | QuiddityGuard.isNotAcceptableQuiddity(QuiddityGuard.trustedQuiddities), 44 | 'Expected a testQuiddity to not be in the Trusted Quiddities list' 45 | ); 46 | Test.stopTest(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /force-app/main/default/classes/quiddity/tests/QuiddityGuardTests.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/rest lib/AsyncRestClient.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * @description wraps a restlib backed api call in a queueable context 3 | */ 4 | public with sharing class AsyncRestClient implements System.Queueable, Database.AllowsCallouts { 5 | /** 6 | * @description the named credential to use for the api call 7 | */ 8 | private final String namedCredentialName; 9 | 10 | /** 11 | * @description The RestLibApiCall that describes your callout 12 | */ 13 | private final RestLibApiCall apiCall; 14 | 15 | /** 16 | * @description The handler class to instantiate to handle the response 17 | */ 18 | private final Type handlerClass; 19 | 20 | /** 21 | * @description Default constructor 22 | * 23 | * @param namedCredentialName String representing the named credential to use 24 | * @param apiCall RestLibApiCall The RestLibApiCall that describes your callout 25 | * @param handlerClass Type a type reference to the finalizer to be used. 26 | */ 27 | public AsyncRestClient( 28 | String namedCredentialName, 29 | RestLibApiCall apiCall, 30 | Type handlerClass 31 | ) { 32 | this.namedCredentialName = namedCredentialName; 33 | this.apiCall = apiCall; 34 | this.handlerClass = handlerClass; 35 | } 36 | 37 | /** 38 | * @description This method will be executed by the Queueable system and is responsible for making the Api call. 39 | * The finalizer is attached according to the passed in handlerClass 40 | * 41 | * @param qc QueueableContext Dependency Injected by the Queueable system 42 | */ 43 | public void execute(QueueableContext qc) { 44 | AsyncRestLibFinalizer theFinalizer = (AsyncRestLibFinalizer) handlerClass.newInstance(); 45 | theFinalizer.response = RestClient.makeApiCall( 46 | this.namedCredentialName, 47 | apiCall 48 | ); 49 | System.attachFinalizer(theFinalizer); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /force-app/main/default/classes/rest lib/AsyncRestClient.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/rest lib/AsyncRestLibFinalizer.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * @description Abstract class defining a common interface with default implementation for finalizers handling 3 | * AsyncRestApi calls 4 | */ 5 | public with sharing abstract class AsyncRestLibFinalizer implements Finalizer { 6 | /** 7 | * @description the HTTP response object 8 | */ 9 | public HttpResponse response; 10 | 11 | /** 12 | * @description The extending class must implement this method to handle the HTTP response 13 | * 14 | * @param response HttpResponse response object to be handled. 15 | */ 16 | abstract void execute(HttpResponse response); 17 | 18 | /** 19 | * @description Execution method of the finalizer. required by the interface. 20 | * 21 | * @param fc FinalizerContext Context object dependency injected by Salesforce. 22 | */ 23 | private void execute(FinalizerContext fc) { 24 | this.execute(this.response); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /force-app/main/default/classes/rest lib/AsyncRestLibFinalizer.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/rest lib/HttpVerb.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * @description This ENUM lists possible HTTP Verbs. Note: 'Delete' is an Apex Keyword (DML) 3 | * and as a result, the ENUM value 'DEL' is used for delete. 4 | */ 5 | public enum HttpVerb { 6 | GET, 7 | POST, 8 | PATCH, 9 | PUT, 10 | HEAD, 11 | DEL 12 | } 13 | -------------------------------------------------------------------------------- /force-app/main/default/classes/rest lib/HttpVerb.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/rest lib/RestClient.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * @description A virtual class for making REST API calls 3 | */ 4 | public virtual class RestClient extends RestLib { 5 | /** 6 | * @description Constructor for the RestClient class. 7 | * 8 | * @param namedCredentialName String value of the named credential to use 9 | */ 10 | public RestClient(String namedCredentialName) { 11 | super(namedCredentialName); 12 | } 13 | 14 | /** 15 | * @description A static wrapper for the main makeApiCall method 16 | * 17 | * @param namedCredential The named credential to use 18 | * @param apiCall HTTPVerb enum value. See Enum above 19 | * 20 | * @return `HTTPResponse` 21 | * 22 | * @example 23 | * Log.get().publish(RestClient.makeApiCall(new RestLibApiCall('MockBin', 24 | * RestClient.HttpVerb.GET, 25 | * '4cb453a6-a23b-42ea-a6ba-9be1c1f17050', 26 | * '', 27 | * '', 28 | * new Map()))); 29 | */ 30 | @SuppressWarnings('PMD.ExcessiveParameterList') 31 | public static HttpResponse makeApiCall( 32 | String namedCredential, 33 | RestLibApiCall apiCall 34 | ) { 35 | return new RestClient(namedCredential).makeApiCall(apiCall); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /force-app/main/default/classes/rest lib/RestClient.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/rest lib/RestClientLib.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/rest lib/RestLib.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * @description A class providing a library of methods for making REST callouts 3 | */ 4 | public with sharing virtual class RestLib { 5 | /** 6 | * @description The name of the Named Credential to use 7 | */ 8 | @TestVisible 9 | protected String namedCredentialName { get; set; } 10 | 11 | /** 12 | * @description Constructor that sets Named Credential 13 | * @param namedCredential name of the Named Credential to use 14 | */ 15 | public RestLib(String namedCredential) { 16 | this.namedCredentialName = namedCredential; 17 | } 18 | 19 | /** 20 | * @description This constructor isn't intended for use, which is why it's 21 | * access modifier is 'Protected'. However, any child class extending 22 | * this class will either have to implement constructors matching the one 23 | * above, or this constructor must exist. In order to make this abstraction 24 | * as useful as possible, we've elected to leave this constructor here, 25 | * but unavailable to anything but inner classes and classes that 26 | * extend this one. 27 | */ 28 | @TestVisible 29 | @SuppressWarnings('PMD.EmptyStatementBlock') 30 | protected RestLib() { 31 | } 32 | 33 | /** 34 | * @description Omnibus callout method. This is the primary method for 35 | * making a REST callout. Most of the other methods in this class serve 36 | * as convenient, syntactic sugar on this method. 37 | * 38 | * @param apiCall The RestLibApiCall object containing all the information needed to make the callout 39 | * 40 | * @return HttpResponse HttpResponse Obj 41 | */ 42 | @TestVisible 43 | @SuppressWarnings('PMD.ExcessiveParameterList') 44 | protected HttpResponse makeApiCall(RestLibApiCall apiCall) { 45 | HttpRequest apiRequest = new HttpRequest(); 46 | if (apiCall.method == HttpVerb.DEL) { 47 | apiRequest.setMethod('DELETE'); 48 | } else { 49 | apiRequest.setMethod(String.valueOf(apiCall.method)); 50 | } 51 | for (String header : apiCall.functionalHeaders.keySet()) { 52 | apiRequest.setHeader(header, apiCall.functionalHeaders.get(header)); 53 | } 54 | if (apiCall.hasBody) { 55 | apiRequest.setBody(apiCall.body); 56 | } 57 | apiRequest.setEndpoint( 58 | 'callout:' + 59 | this.namedCredentialName + 60 | apiCall.path + 61 | apiCall.encodedQuery 62 | ); 63 | Http http = new Http(); 64 | return http.send(apiRequest); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /force-app/main/default/classes/rest lib/RestLib.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/rest lib/RestLibApiCall.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/rest lib/tests/RestLibTests.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/safely/CanTheUser.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/safely/CrudType.cls: -------------------------------------------------------------------------------- 1 | public enum CrudType { 2 | CREATEABLE, 3 | READABLE, 4 | EDITABLE, 5 | DELETABLE, 6 | UPSERTABLE 7 | } 8 | -------------------------------------------------------------------------------- /force-app/main/default/classes/safely/CrudType.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/safely/FLSType.cls: -------------------------------------------------------------------------------- 1 | public enum FLSType { 2 | ACCESSIBLE, 3 | UPDATABLE 4 | } 5 | -------------------------------------------------------------------------------- /force-app/main/default/classes/safely/FLSType.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/safely/Safely.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/safely/tests/CanTheUserTests.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/safely/tests/SafelyTests.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/test utilities/CustomAssert.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/test utilities/HttpCalloutMockFactory.cls: -------------------------------------------------------------------------------- 1 | @isTest 2 | public class HttpCalloutMockFactory implements HttpCalloutMock { 3 | // Holds a list of HTTP Response objects to return. 4 | protected List orderedResponses = new List(); 5 | 6 | /** 7 | * @description This constructor builds the response that will be returned 8 | * @param code HTTP status code (200, 201, 301, 302, 400, 404, 503, etc) 9 | * @param status HTTP text status. ie: "ok" for 200 10 | * @param bodyAsString This is the string that will be returned as the body 11 | * @param headers a map of headers applied to the response object 12 | **/ 13 | @SuppressWarnings('PMD.ExcessiveParameterList') 14 | public HttpCalloutMockFactory( 15 | Integer code, 16 | String status, 17 | String bodyAsString, 18 | Map headers 19 | ) { 20 | this.orderedResponses.add( 21 | HttpCalloutMockFactory.generateHttpResponse( 22 | code, 23 | status, 24 | bodyAsString, 25 | headers 26 | ) 27 | ); 28 | } 29 | 30 | /** 31 | * @description This constructor accepts a list of responses to be returned. 32 | * @param orderedResponses HTTP status code (200, 201, 301, 302, 400, 404, 503, etc) 33 | **/ 34 | public HttpCalloutMockFactory(List orderedResponses) { 35 | this.orderedResponses = orderedResponses; 36 | } 37 | 38 | /** 39 | * @description setMock can only be called once per test so to enable mocking 40 | * multiple callouts, this response method removes the first item on the list of 41 | * callouts, and returns that. additional callouts will respond with the next items 42 | * from the list. 43 | * @param req dependency injected by the system 44 | * @return HttpResponse 45 | **/ 46 | public HttpResponse respond(HttpRequest req) { 47 | return this.orderedResponses.remove(0); 48 | } 49 | 50 | /** 51 | * @description Required method for the HttpCalloutMock interface 52 | * @param code Integer to return as the status code - 200, 301, 404 etc. 53 | * @param status String to return for the status: 'OK' or 'Server Error' 54 | * @param bodyAsString String to return as the body 55 | * @param headers Map of headers to return 56 | * @return `HttpResponse` 57 | */ 58 | @SuppressWarnings('PMD.ExcessiveParameterList') 59 | public static HttpResponse generateHttpResponse( 60 | Integer code, 61 | String status, 62 | String bodyAsString, 63 | Map headers 64 | ) { 65 | HttpResponse res = new HttpResponse(); 66 | res.setStatusCode(code); 67 | res.setStatus(status); 68 | res.setBody(bodyAsString); 69 | for (String headerKey : headers.keySet()) { 70 | res.setHeader(headerKey, headers.get(headerKey)); 71 | } 72 | return res; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /force-app/main/default/classes/test utilities/HttpCalloutMockFactory.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/test utilities/IdFactory.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/test utilities/MethodSignature.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/test utilities/MockedMethod.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/test utilities/ParameterMatcher.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * @description Enum to define special parameter matching behavior for the Stub framework 3 | */ 4 | public enum ParameterMatcher { 5 | /** 6 | * @description Matches any parameter value regardless of the actual runtime value 7 | */ 8 | ANYVALUE 9 | } 10 | -------------------------------------------------------------------------------- /force-app/main/default/classes/test utilities/ParameterMatcher.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | -------------------------------------------------------------------------------- /force-app/main/default/classes/test utilities/ParameterMatcherTest.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | -------------------------------------------------------------------------------- /force-app/main/default/classes/test utilities/ParameterMatcherTestClass.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * @description This class is used to test the ParameterMatcher class. 3 | */ 4 | @IsTest 5 | public class ParameterMatcherTestClass { 6 | public String methodWithParameters(String param1, Integer param2) { 7 | return param1 + String.valueOf(param2); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /force-app/main/default/classes/test utilities/ParameterMatcherTestClass.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/test utilities/PermissionsHelper.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/test utilities/SObjectFactory.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/test utilities/SObjectFactoryDefaults.cls: -------------------------------------------------------------------------------- 1 | @IsTest 2 | public class SObjectFactoryDefaults { 3 | // To specify defaults for objects, use the naming convention [ObjectName]Defaults. 4 | // For custom objects, omit the __c from the Object Name 5 | 6 | /** 7 | * @description Default values for Account object 8 | */ 9 | public class AccountDefaults implements SObjectFactory.FieldDefaults { 10 | /** 11 | * @description Returns a map of field defaults for the Account object. 12 | * 13 | * @return A map containing the default values for specific Account fields. 14 | */ 15 | public Map getFieldDefaults() { 16 | return new Map{ 17 | Account.Name => 'Test Account' 18 | }; 19 | } 20 | } 21 | 22 | /** 23 | * @description This class provides default field values for Contact objects. 24 | */ 25 | public class ContactDefaults implements SObjectFactory.FieldDefaults { 26 | /** 27 | * @description Returns a map of field defaults for the Contact object. 28 | * 29 | * @return A map where keys are Schema.SObjectField representing Contact fields and values are the default values for those fields. 30 | */ 31 | public Map getFieldDefaults() { 32 | return new Map{ 33 | Contact.FirstName => 'First', 34 | Contact.LastName => 'Last' 35 | }; 36 | } 37 | } 38 | 39 | /** 40 | * @description This class provides default field values for Opportunity objects. 41 | */ 42 | public class OpportunityDefaults implements SObjectFactory.FieldDefaults { 43 | /** 44 | * @description Returns a map of default field values for Opportunity. 45 | * 46 | * @return Map A map containing default field values. 47 | */ 48 | public Map getFieldDefaults() { 49 | return new Map{ 50 | Opportunity.Name => 'Test Opportunity', 51 | Opportunity.StageName => 'Closed Won', 52 | Opportunity.CloseDate => System.today() 53 | }; 54 | } 55 | } 56 | 57 | /** 58 | * @description Defaults for Case SObjectFactory 59 | */ 60 | public class CaseDefaults implements SObjectFactory.FieldDefaults { 61 | /** 62 | * @description Returns a map of field defaults for the Case object. 63 | * 64 | * @return A map where the key is the Schema.SObjectField and the value is the default value. 65 | */ 66 | public Map getFieldDefaults() { 67 | return new Map{ 68 | Case.Subject => 'Test Case' 69 | }; 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /force-app/main/default/classes/test utilities/SObjectFactoryDefaults.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/test utilities/SObjectFactoryHelper.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/test utilities/SObjectFactoryTests.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/test utilities/SomeDefaultsClass.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * @description This class provides an example implementation of the FieldDefaults interface. 3 | * It provides default values for the Account object. 4 | */ 5 | @IsTest 6 | public with sharing class SomeDefaultsClass implements SObjectFactory.FieldDefaults { 7 | /** 8 | * @description Returns a map of field defaults for the given object. 9 | * While this specifies the Account object, it could be any object. 10 | * Just ensure that key returned in this map is valid Object.Field syntax 11 | * for an SObject field. 12 | * 13 | * @return Map of Schema.SObjectField to Object containing field defaults 14 | */ 15 | public Map getFieldDefaults() { 16 | return new Map{ 17 | Account.Name => 'Test Account' 18 | }; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /force-app/main/default/classes/test utilities/SomeDefaultsClass.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/test utilities/Stub.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/test utilities/StubUtilities.cls: -------------------------------------------------------------------------------- 1 | @isTest 2 | public with sharing class StubUtilities { 3 | /** 4 | * @description a static incrementing counter tied to transaction 5 | * a new comment 6 | */ 7 | private static Integer counter { 8 | get { 9 | if (counter == null) { 10 | counter = 0; 11 | } 12 | counter++; 13 | 14 | return counter; 15 | } 16 | set; 17 | } 18 | /** 19 | * @description Used when you want a MockedMethod to return a 20 | * set of IDs of a given sObject Type 21 | * @param sObjectTypeString Name of type: ie: `Account` 22 | * @param size Number of valid Ids to return 23 | * @return `List` 24 | */ 25 | public static List generateSObjectIds( 26 | String sObjectTypeString, 27 | Integer size 28 | ) { 29 | SObjectType sObjectType = ((SObject) Type.forName(sObjectTypeString) 30 | .newInstance()) 31 | .getSObjectType(); 32 | 33 | String keyPrefix = sObjectType.getDescribe().getKeyPrefix(); 34 | List ids = new List(); 35 | 36 | for (Integer i = 0; i < size; i++) { 37 | Integer uniqueCounter = counter; 38 | ids.add( 39 | keyPrefix + 40 | '0'.repeat(12 - String.valueOf(uniqueCounter).length()) + 41 | uniqueCounter 42 | ); 43 | } 44 | 45 | return ids; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /force-app/main/default/classes/test utilities/StubUtilities.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/test utilities/UserFactory.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * @description A factory class for generating Users during Unit Tests 3 | * While this class has generic user-building methods, the bulk of this 4 | * class is dedicated to building persona-specific users 5 | */ 6 | @IsTest 7 | public class UserFactory { 8 | /// Persona based factory methods 9 | 10 | /** 11 | * @description Creates a user with the Minimum Access Profile 12 | * @param forceInsert Should this code insert the user? 13 | * @return `User` 14 | */ 15 | public static User createMinAccessPersonaUser(Boolean forceInsert) { 16 | return createTestUser( 17 | UserFactoryHelper.fetchProfileIdByName('Minimum Access - Salesforce'), 18 | forceInsert 19 | ); 20 | } 21 | 22 | /** 23 | * @description creates a Marketing Persona user 24 | * @param forceInsert Boolean should this user be inserted? 25 | * @return User created marketing user 26 | */ 27 | public static User createMarketingPersonaUser(Boolean forceInsert) { 28 | User createdUser = createTestUser('Marketing User', forceInsert); 29 | return createdUser; 30 | } 31 | 32 | /// Generic user factory methods 33 | 34 | /** 35 | * @description creates a test user. Useful for permissions testing 36 | * @param profileId Profile Id to use when creating a user. 37 | * @param forceInsert Boolean, should this code insert the user? 38 | * @return `User` 39 | */ 40 | public static User createTestUser(Id profileId, Boolean forceInsert) { 41 | User userToCreate = new User( 42 | ProfileId = profileId, 43 | LastName = 'last', 44 | Email = 'Testuser@test.example.com', 45 | Username = 'Testuser@test.example.com' + 46 | Math.abs(Crypto.getRandomInteger()), 47 | CompanyName = 'TEST', 48 | Title = 'title', 49 | Alias = 'alias', 50 | TimeZoneSidKey = 'America/Los_Angeles', 51 | EmailEncodingKey = 'UTF-8', 52 | LanguageLocaleKey = 'en_US', 53 | LocaleSidKey = 'en_US' 54 | ); 55 | UserFactoryHelper.forceInsert(userToCreate, forceInsert); 56 | return userToCreate; 57 | } 58 | 59 | /** 60 | * @description Creates a test user with a given profile. 61 | * @param profileName Name of the profile to create the user with. 62 | * @param forceInsert Should this code insert the created user? 63 | * @return `User` 64 | */ 65 | public static User createTestUser(String profileName, Boolean forceInsert) { 66 | return createTestUser( 67 | UserFactoryHelper.fetchProfileIdByName(profileName), 68 | forceInsert 69 | ); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /force-app/main/default/classes/test utilities/UserFactory.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/test utilities/UserFactoryHelper.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * @description Helper class for the UserFactory class. 3 | * Responsible for manipulation of users and permissions 4 | * 5 | * Note: This class does *no* error handling. Because it's used in the setup and preparation of test data, 6 | * it's on the developer to ensure the methods are called with existing, valid data like profile names. 7 | * If, for instance, a developer fat-fingers a profile name, the query on ~ line 20 will fail, and throw 8 | * an exception. 9 | */ 10 | 11 | @IsTest 12 | public class UserFactoryHelper { 13 | /** 14 | * @description Fetches the Profile Id by its name. 15 | * @param profileName The name of the profile to fetch. 16 | * 17 | * @return The Id of the requested profile. 18 | */ 19 | public static Id fetchProfileIdByName(String profileName) { 20 | Profile requestedProfile = [ 21 | SELECT Id 22 | FROM Profile 23 | WHERE Name = :profileName 24 | WITH SYSTEM_MODE 25 | LIMIT 1 26 | ]; 27 | return requestedProfile.Id; 28 | } 29 | 30 | /** 31 | * @description Fetches the Permission Set ID by its name. 32 | * @param permissionSetName The name of the Permission Set to fetch. 33 | * 34 | * @return The ID of the Permission Set. 35 | */ 36 | public static Id fetchPermissionSetIdByName(String permissionSetName) { 37 | Id permSetId = [ 38 | SELECT Id 39 | FROM PermissionSet 40 | WHERE Name = :permissionSetName 41 | WITH SYSTEM_MODE 42 | LIMIT 1 43 | ] 44 | .Id; 45 | return permSetId; 46 | } 47 | 48 | /** 49 | * @description Inserts a User record if forceInsert is true. 50 | * @param userToInsert The User record to insert. 51 | * @param forceInsert Boolean flag to determine if the insert should proceed. 52 | */ 53 | public static void forceInsert(User userToInsert, Boolean forceInsert) { 54 | if (forceInsert) { 55 | insert userToInsert; 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /force-app/main/default/classes/test utilities/UserFactoryHelper.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/trigger framework/InvokeMetadataDrivenTriggerFramework.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * @description class exists to allow the Metadata Trigger Framework to be invoked from a Flow 3 | */ 4 | public with sharing class InvokeMetadataDrivenTriggerFramework { 5 | /** 6 | * @description An internal class representing the inputs to the Metadata Trigger Framework 7 | */ 8 | public class Inputs { 9 | @InvocableVariable( 10 | Label='Invocation Context' 11 | Description='Set this to the invocation context of the current flow. ie: after update' 12 | Required=true 13 | ) 14 | public TriggerOperation context; 15 | 16 | @InvocableVariable( 17 | Label='Trigger New' 18 | Description='New version of the Record(s) to process by Metadata Trigger Framework' 19 | Required=true 20 | ) 21 | public List triggerNew; 22 | 23 | @InvocableVariable( 24 | Label='Trigger Old' 25 | Description='Old version of the Record(s) to process by Metadata Trigger Framework' 26 | Required=true 27 | ) 28 | public List triggerOld; 29 | } 30 | 31 | /** 32 | * @description Invokes the Metadata Trigger Framework 33 | * 34 | * @param inputParams List - List of inputs to pass to the Metadata Trigger Framework 35 | */ 36 | @InvocableMethod( 37 | Label='Fire Metadata Defined Triggers' 38 | Description='Apply existing metadata defined triggers to these records' 39 | ) 40 | public static void invokeMetadataTriggerFramework(List inputParams) { 41 | for (InvokeMetadataDrivenTriggerFramework.Inputs request : inputParams) { 42 | new MetadataTriggerFramework( 43 | request.triggerNew, 44 | request.triggerOld, 45 | request.context 46 | ) 47 | .run(); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /force-app/main/default/classes/trigger framework/InvokeMetadataDrivenTriggerFramework.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/trigger framework/MetadataTriggerFramework.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/trigger framework/MetadataTriggerFrameworkException.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * @description An exception that is thrown when the MetadataTriggerFramework encounters an error. 3 | */ 4 | public with sharing class MetadataTriggerFrameworkException extends Exception { 5 | } 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/trigger framework/MetadataTriggerFrameworkException.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/trigger framework/MetadataTriggerFrameworkTests.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/trigger framework/MetadataTriggerQueryService.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/trigger framework/MetadataTriggerQueryServiceTests.cls: -------------------------------------------------------------------------------- 1 | @isTest 2 | private class MetadataTriggerQueryServiceTests { 3 | @isTest 4 | private static void testGetMetadataTriggers() { 5 | MetadataTriggerQueryService mts = new MetadataTriggerQueryService( 6 | 'Invalid_Object__c' 7 | ); 8 | Test.startTest(); 9 | List triggers = mts.getMetadataTriggers(); 10 | Test.stopTest(); 11 | 12 | Assert.areEqual(triggers.size(), 0, 'Expected to find no metadata records'); 13 | } 14 | 15 | @isTest 16 | private static void testGetSObjectTypeNegative() { 17 | Boolean didCatchProperException = false; 18 | Test.startTest(); 19 | try { 20 | MetadataTriggerQueryService.getSObjectType(null, null); 21 | } catch (MetadataTriggerFrameworkException triggerEx) { 22 | if ( 23 | triggerEx.getMessage() 24 | .containsIgnoreCase( 25 | 'Passed values for triggerNew and triggerOld are both null. Are you exercising this method outside of a trigger context?' 26 | ) 27 | ) { 28 | didCatchProperException = true; 29 | } 30 | } 31 | Test.stopTest(); 32 | Assert.isTrue( 33 | didCatchProperException, 34 | 'executing this method in a unit test should result in an exception' 35 | ); 36 | } 37 | 38 | @isTest 39 | private static void testGetSObjectTypePositiveFromTriggerNew() { 40 | List accounts = new List{ new Account(name = 'test)') }; 41 | Test.startTest(); 42 | String results = MetadataTriggerQueryService.getSObjectType(accounts, null); 43 | Test.stopTest(); 44 | Assert.areEqual('Account', results, 'Expected to see Account returned'); 45 | } 46 | 47 | @isTest 48 | private static void testGetSObjectTypePositiveFromTriggerOld() { 49 | List accounts = new List{ new Account(name = 'test)') }; 50 | Test.startTest(); 51 | String results = MetadataTriggerQueryService.getSObjectType(null, accounts); 52 | Test.stopTest(); 53 | Assert.areEqual('Account', results, 'Expected to see Account returned'); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /force-app/main/default/classes/trigger framework/MetadataTriggerQueryServiceTests.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/trigger framework/TriggerContext.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/trigger framework/TriggerFramework.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/trigger framework/TriggerFrameworkException.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * @description An exception that is thrown when an error occurs in the Trigger Framework 3 | */ 4 | public class TriggerFrameworkException extends Exception { 5 | } 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/trigger framework/TriggerFrameworkException.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/trigger framework/TriggerFrameworkLoopCount.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * @description inner class for managing the loop count per handler 3 | */ 4 | public with sharing class TriggerFrameworkLoopCount { 5 | public Integer max; 6 | public Integer count; 7 | 8 | /** 9 | * @description Loop counter method with default of 5. 10 | */ 11 | public TriggerFrameworkLoopCount() { 12 | this.max = 5; 13 | this.count = 0; 14 | } 15 | 16 | /** 17 | * @description Sets loop count based on the param. 18 | * @param max Maximum number of loops to allow. 19 | */ 20 | public TriggerFrameworkLoopCount(Integer max) { 21 | this.max = max; 22 | this.count = 0; 23 | } 24 | 25 | /** 26 | * @description Increment the internal counter returning the results of 27 | * this.exceeded(). 28 | * @return `Boolean` true if count will exceed max count or is less 29 | * than 0. 30 | */ 31 | public Boolean increment() { 32 | this.count++; 33 | return this.exceeded(); 34 | } 35 | 36 | /** 37 | * @description Determines if this we're about to exceed the loop count. 38 | * @return `Boolean` true if less than 0 or more than max. 39 | */ 40 | public Boolean exceeded() { 41 | if (this.max < 0) { 42 | return false; 43 | } 44 | if (this.count > this.max) { 45 | return true; 46 | } 47 | return false; 48 | } 49 | 50 | /** 51 | * @description Returns the max loop count. 52 | * @return `Integer` max loop count. 53 | */ 54 | public Integer getMax() { 55 | return this.max; 56 | } 57 | 58 | /** 59 | * @description Returns the current loop count. 60 | * @return `Integer` current loop count. 61 | */ 62 | public Integer getCount() { 63 | return this.count; 64 | } 65 | 66 | /** 67 | * @description Sets the max loop size 68 | * @param max The integer to set max to. 69 | */ 70 | public void setMax(Integer max) { 71 | this.max = max; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /force-app/main/default/classes/trigger framework/TriggerFrameworkLoopCount.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/trigger framework/tests/SampleHandler.cls: -------------------------------------------------------------------------------- 1 | @SuppressWarnings('PMD.EmptyStatementBlock') 2 | @isTest 3 | /** 4 | * @description This class is a sample trigger handler for use while testing 5 | * the metadataTriggerHandler. Because custom metadata cannot be inserted, and 6 | * because the MetadataTriggerHandler instantiates handler classes from custom 7 | * metadata records, even when we stub/mock the metadata record retrieval we 8 | * still need an actual class that it can instantiate. 9 | * 10 | * Note, this class is annotated with @isTest to prevent its use outside of 11 | * tests, not because it contains tests. 12 | */ 13 | public without sharing class SampleHandler extends TriggerFramework { 14 | public override void beforeInsert() { 15 | } 16 | public override void beforeUpdate() { 17 | } 18 | public override void afterInsert() { 19 | } 20 | public override void afterUpdate() { 21 | } 22 | public override void beforeDelete() { 23 | } 24 | public override void afterDelete() { 25 | } 26 | public override void afterUndelete() { 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /force-app/main/default/classes/trigger framework/tests/SampleHandler.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/trigger framework/tests/TriggerFrameworkTests.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/customMetadata/Feature_Flag.test.md-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | false 8 | 9 | Flag_Value__c 10 | 11 | 12 | 13 | isEnabled__c 14 | false 15 | 16 | 17 | -------------------------------------------------------------------------------- /force-app/main/default/customMetadata/Feature_Flag_Enabled_For.test.md-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | false 8 | 9 | Feature_Flag__c 10 | test 11 | 12 | 13 | Permission_Set_Id__c 14 | 2F0PS1h000001Ol5m 15 | 16 | 17 | isEnabled__c 18 | false 19 | 20 | 21 | -------------------------------------------------------------------------------- /force-app/main/default/customPermissions/ApexKit_Example.customPermission-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | false 4 | 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/layouts/FF_Enabled_For_Custom_Permission__mdt-FF Enabled For Custom Permission Layout.layout-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | false 5 | false 6 | true 7 | 8 | 9 | 10 | Required 11 | MasterLabel 12 | 13 | 14 | Required 15 | DeveloperName 16 | 17 | 18 | Required 19 | Feature_Flag__c 20 | 21 | 22 | 23 | 24 | Edit 25 | IsProtected 26 | 27 | 28 | Required 29 | NamespacePrefix 30 | 31 | 32 | 33 | 34 | 35 | false 36 | false 37 | true 38 | 39 | 40 | 41 | Readonly 42 | CreatedById 43 | 44 | 45 | 46 | 47 | Readonly 48 | LastModifiedById 49 | 50 | 51 | 52 | 53 | 54 | false 55 | false 56 | false 57 | 58 | 59 | 60 | false 61 | false 62 | false 63 | false 64 | false 65 | 66 | -------------------------------------------------------------------------------- /force-app/main/default/layouts/Feature_Flag_Enabled_For__mdt-Feature Flag Enabled For Layout.layout-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | false 5 | false 6 | true 7 | 8 | 9 | 10 | Required 11 | MasterLabel 12 | 13 | 14 | Required 15 | DeveloperName 16 | 17 | 18 | Required 19 | Feature_Flag__c 20 | 21 | 22 | Required 23 | Permission_Set_Id__c 24 | 25 | 26 | Edit 27 | isEnabled__c 28 | 29 | 30 | 31 | 32 | Edit 33 | IsProtected 34 | 35 | 36 | Required 37 | NamespacePrefix 38 | 39 | 40 | 41 | 42 | 43 | false 44 | false 45 | true 46 | 47 | 48 | 49 | Readonly 50 | CreatedById 51 | 52 | 53 | 54 | 55 | Readonly 56 | LastModifiedById 57 | 58 | 59 | 60 | 61 | 62 | false 63 | false 64 | false 65 | 66 | 67 | 68 | false 69 | false 70 | false 71 | false 72 | false 73 | 74 | -------------------------------------------------------------------------------- /force-app/main/default/lwc/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["@salesforce/eslint-config-lwc/recommended"], 3 | "overrides": [ 4 | { 5 | "files": ["*.test.js"], 6 | "rules": { 7 | "@lwc/lwc/no-unexpected-wire-adapter-usages": "off" 8 | }, 9 | "env": { 10 | "node": true 11 | } 12 | } 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /force-app/main/default/objects/Disabled_For__mdt/Disabled_For__mdt.object-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Disabled For 5 | Public 6 | 7 | -------------------------------------------------------------------------------- /force-app/main/default/objects/Disabled_For__mdt/fields/Metadata_Driven_Trigger__c.field-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Metadata_Driven_Trigger__c 4 | false 5 | DeveloperControlled 6 | 7 | Metadata_Driven_Trigger__mdt 8 | Disabled For 9 | Disabled_For 10 | true 11 | MetadataRelationship 12 | false 13 | 14 | -------------------------------------------------------------------------------- /force-app/main/default/objects/Disabled_For__mdt/fields/User_Email__c.field-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | User_Email__c 4 | false 5 | DeveloperControlled 6 | 7 | true 8 | Email 9 | false 10 | 11 | -------------------------------------------------------------------------------- /force-app/main/default/objects/FF_Enabled_For_Custom_Permission__mdt/FF_Enabled_For_Custom_Permission__mdt.object-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | FF Enabled For Custom Permissions 5 | Public 6 | 7 | -------------------------------------------------------------------------------- /force-app/main/default/objects/FF_Enabled_For_Custom_Permission__mdt/fields/Feature_Flag__c.field-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Feature_Flag__c 4 | false 5 | DeveloperControlled 6 | 7 | Feature_Flag__mdt 8 | FF Enabled For Custom Permissions 9 | FF_Enabled_For_Custom_Permissions 10 | true 11 | MetadataRelationship 12 | false 13 | 14 | -------------------------------------------------------------------------------- /force-app/main/default/objects/Feature_Flag_Enabled_For__mdt/Feature_Flag_Enabled_For__mdt.object-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | FF Enabled For Perm Sets 5 | Public 6 | 7 | -------------------------------------------------------------------------------- /force-app/main/default/objects/Feature_Flag_Enabled_For__mdt/fields/Feature_Flag__c.field-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Feature_Flag__c 4 | false 5 | DeveloperControlled 6 | 7 | Feature_Flag__mdt 8 | Feature_Flags_Enabled_For 9 | true 10 | MetadataRelationship 11 | false 12 | 13 | -------------------------------------------------------------------------------- /force-app/main/default/objects/Feature_Flag_Enabled_For__mdt/fields/Permission_Set_Id__c.field-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Permission_Set_Id__c 4 | false 5 | DeveloperControlled 6 | 7 | 18 8 | true 9 | Text 10 | false 11 | 12 | -------------------------------------------------------------------------------- /force-app/main/default/objects/Feature_Flag_Enabled_For__mdt/fields/isEnabled__c.field-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | isEnabled__c 4 | false 5 | false 6 | DeveloperControlled 7 | 8 | Checkbox 9 | 10 | -------------------------------------------------------------------------------- /force-app/main/default/objects/Feature_Flag__mdt/Feature_Flag__mdt.object-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Feature Flags 5 | Public 6 | 7 | -------------------------------------------------------------------------------- /force-app/main/default/objects/Feature_Flag__mdt/fields/Flag_Value__c.field-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Flag_Value__c 4 | false 5 | DeveloperControlled 6 | 7 | 255 8 | false 9 | Text 10 | false 11 | 12 | -------------------------------------------------------------------------------- /force-app/main/default/objects/Feature_Flag__mdt/fields/isEnabled_After__c.field-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | isEnabled_After__c 4 | true if this feature is enabled on or after a given date 5 | false 6 | SubscriberControlled 7 | 8 | Date 9 | 10 | -------------------------------------------------------------------------------- /force-app/main/default/objects/Feature_Flag__mdt/fields/isEnabled__c.field-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | isEnabled__c 4 | false 5 | Checked if this feature is enabled 6 | false 7 | SubscriberControlled 8 | 9 | Checkbox 10 | 11 | -------------------------------------------------------------------------------- /force-app/main/default/objects/LogEvent__c/fields/Log_Data__c.field-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Log_Data__c 4 | false 5 | 6 | 32768 7 | false 8 | LongTextArea 9 | 5 10 | 11 | -------------------------------------------------------------------------------- /force-app/main/default/objects/LogEvent__c/fields/Quiddity__c.field-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Quiddity__c 4 | false 5 | 6 | 255 7 | false 8 | false 9 | Text 10 | false 11 | 12 | -------------------------------------------------------------------------------- /force-app/main/default/objects/LogEvent__c/fields/Request_Id__c.field-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Request_Id__c 4 | false 5 | 6 | 255 7 | false 8 | false 9 | Text 10 | false 11 | 12 | -------------------------------------------------------------------------------- /force-app/main/default/objects/LogEvent__c/fields/Severity__c.field-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Severity__c 4 | false 5 | 6 | false 7 | false 8 | Picklist 9 | 10 | true 11 | 12 | false 13 | 14 | DEBUG 15 | false 16 | 17 | 18 | 19 | INFO 20 | false 21 | 22 | 23 | 24 | WARN 25 | false 26 | 27 | 28 | 29 | ERROR 30 | false 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /force-app/main/default/objects/LogEvent__c/listViews/All.listView-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | All 4 | NAME 5 | CREATED_DATE 6 | Quiddity__c 7 | Request_Id__c 8 | Severity__c 9 | Everything 10 | 11 | 12 | -------------------------------------------------------------------------------- /force-app/main/default/objects/LogEvent__c/listViews/All1.listView-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | All1 4 | Everything 5 | 6 | 7 | -------------------------------------------------------------------------------- /force-app/main/default/objects/Log__e/Log__e.object-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Deployed 4 | HighVolume 5 | 6 | Logs 7 | PublishImmediately 8 | 9 | -------------------------------------------------------------------------------- /force-app/main/default/objects/Log__e/fields/Log_Message__c.field-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Log_Message__c 4 | false 5 | false 6 | false 7 | false 8 | 9 | 131072 10 | LongTextArea 11 | 3 12 | 13 | -------------------------------------------------------------------------------- /force-app/main/default/objects/Log__e/fields/Quiddity__c.field-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Quiddity__c 4 | false 5 | false 6 | false 7 | false 8 | 9 | 64 10 | true 11 | Text 12 | false 13 | 14 | -------------------------------------------------------------------------------- /force-app/main/default/objects/Log__e/fields/Request_Id__c.field-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Request_Id__c 4 | false 5 | false 6 | false 7 | false 8 | 9 | 255 10 | true 11 | Text 12 | false 13 | 14 | -------------------------------------------------------------------------------- /force-app/main/default/objects/Log__e/fields/Severity__c.field-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Severity__c 4 | false 5 | false 6 | false 7 | false 8 | 9 | 255 10 | true 11 | Text 12 | false 13 | 14 | -------------------------------------------------------------------------------- /force-app/main/default/objects/Metadata_Driven_Trigger__mdt/Metadata_Driven_Trigger__mdt.object-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Metadata Driven Triggerss 5 | Public 6 | 7 | -------------------------------------------------------------------------------- /force-app/main/default/objects/Metadata_Driven_Trigger__mdt/fields/Class__c.field-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Class__c 4 | false 5 | SubscriberControlled 6 | 7 | 255 8 | true 9 | Text 10 | false 11 | 12 | -------------------------------------------------------------------------------- /force-app/main/default/objects/Metadata_Driven_Trigger__mdt/fields/Enabled__c.field-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Enabled__c 4 | true 5 | false 6 | SubscriberControlled 7 | 8 | Checkbox 9 | 10 | -------------------------------------------------------------------------------- /force-app/main/default/objects/Metadata_Driven_Trigger__mdt/fields/Execution_Order__c.field-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Execution_Order__c 4 | false 5 | SubscriberControlled 6 | 7 | 18 8 | true 9 | 0 10 | Number 11 | false 12 | 13 | -------------------------------------------------------------------------------- /force-app/main/default/objects/Metadata_Driven_Trigger__mdt/fields/Object__c.field-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Object__c 4 | false 5 | SubscriberControlled 6 | 7 | EntityDefinition 8 | Metadata_Driven_Triggerss 9 | Metadata_Driven_Triggerss 10 | true 11 | MetadataRelationship 12 | false 13 | 14 | -------------------------------------------------------------------------------- /force-app/main/default/objects/Opportunity/listViews/Default_Opportunity_Pipeline.listView-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Default_Opportunity_Pipeline 4 | Mine 5 | 6 | OPPORTUNITY.CLOSE_DATE 7 | greaterOrEqual 8 | LAST_N_MONTHS:3 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /force-app/main/default/permissionsets/Async_Log_Access.permissionset-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | false 5 | LogEvent__c.Log_Data__c 6 | true 7 | 8 | 9 | false 10 | LogEvent__c.Quiddity__c 11 | true 12 | 13 | 14 | false 15 | LogEvent__c.Request_Id__c 16 | true 17 | 18 | 19 | false 20 | LogEvent__c.Severity__c 21 | true 22 | 23 | false 24 | 25 | 26 | true 27 | true 28 | true 29 | true 30 | true 31 | LogEvent__c 32 | true 33 | 34 | 35 | LogEvent__c 36 | Visible 37 | 38 | 39 | -------------------------------------------------------------------------------- /force-app/main/default/tabs/LogEvent__c.tab-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | true 4 | Custom27: Laptop 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/triggers/Log.trigger: -------------------------------------------------------------------------------- 1 | trigger Log on Log__e(after insert) { 2 | new LogTriggerHandler(Trigger.new, true).run(); 3 | } 4 | -------------------------------------------------------------------------------- /force-app/main/default/triggers/Log.trigger-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 58.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | const { jestConfig } = require('@salesforce/sfdx-lwc-jest/config'); 2 | 3 | module.exports = { 4 | ...jestConfig, 5 | modulePathIgnorePatterns: ['/.localdevserver'] 6 | }; 7 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "apex-kit", 3 | "private": true, 4 | "version": "1.0.0", 5 | "description": "Delightful set of custom APIs for rapid, repeatable, maintainable Salesforce development", 6 | "scripts": { 7 | "docs:setup": ". doc-assets/SetupApexDox.sh", 8 | "docs:clean": "prettier --write \"docs/*.html\"", 9 | "apexdocs": "sh bin/generate-apex-docs.sh", 10 | "apex:local:start": "start-apex-server --host 127.0.0.1", 11 | "apex:local:stop": "stop-apex-server --host 127.0.0.1", 12 | "lint": "eslint **/{aura,lwc}/**", 13 | "test": "npm run test:unit", 14 | "test:unit": "sfdx-lwc-jest", 15 | "test:unit:watch": "sfdx-lwc-jest --watch", 16 | "test:unit:debug": "sfdx-lwc-jest --debug", 17 | "test:unit:coverage": "sfdx-lwc-jest --coverage", 18 | "prettier": "prettier --write \"**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}\"", 19 | "prettier:verify": "prettier --list-different \"**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}\"", 20 | "precommit": "npm run apexdocs && git add docs && lint-staged" 21 | }, 22 | "devDependencies": { 23 | "@cparra/apexdocs": "^3.12.1", 24 | "@lwc/eslint-plugin-lwc": "^3.0.0", 25 | "@prettier/plugin-xml": "^3.4.1", 26 | "@sa11y/jest": "^7.2.6", 27 | "@salesforce/eslint-config-lwc": "^4.0.0", 28 | "@salesforce/eslint-plugin-lightning": "^2.0.0", 29 | "@salesforce/sfdx-lwc-jest": "^7.0.1", 30 | "eslint": "^9.28.0", 31 | "eslint-plugin-import": "^2.31.0", 32 | "eslint-plugin-jest": "^28.12.0", 33 | "husky": "^9.1.7", 34 | "lint-staged": "^16.1.0", 35 | "prettier": "^3.5.3", 36 | "prettier-plugin-apex": "^2.2.6" 37 | }, 38 | "lint-staged": { 39 | "**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}": [ 40 | "prettier --write" 41 | ], 42 | "**/{aura,lwc}/**": [ 43 | "eslint" 44 | ] 45 | }, 46 | "volta": { 47 | "node": "20.15.0" 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /scripts/orginit.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Install script 4 | echo "Cleaning previous scratch org..." 5 | sf org delete scratch --no-prompt --target-org ApexKit 6 | 7 | echo "Creating new scratch org" 8 | sf org create scratch --definition-file config/project-scratch-def.json --duration-days 10 --alias ApexKit --no-namespace --set-default --no-ancestors 9 | 10 | echo "Push unmanaged main metadata" 11 | sf project deploy start 12 | 13 | echo "Assigning permission set" 14 | sf org assign permset --name Async_Log_Access 15 | 16 | # echo "Adding sample data" 17 | # sf apex run --file ./data/Apexkit-data-plan.json 18 | 19 | echo "Opening org" 20 | sf org open 21 | 22 | echo "Org is set up" -------------------------------------------------------------------------------- /sfdx-project.json: -------------------------------------------------------------------------------- 1 | { 2 | "packageDirectories": [ 3 | { 4 | "path": "force-app", 5 | "default": true 6 | } 7 | ], 8 | "name": "ApexKit", 9 | "namespace": "", 10 | "sfdcLoginUrl": "https://login.salesforce.com", 11 | "sourceApiVersion": "63.0" 12 | } 13 | --------------------------------------------------------------------------------