Skip to content

Commit

Permalink
Spring '22 release - v4.7.0 (#274)
Browse files Browse the repository at this point in the history
[LoggerSettings__c changes]

* Closed #279 by adding a new settings field DefaultLogScenario__c and new method Logger.getScenario()

* Closed #258 by adding 2 new fields to LoggerSettings__c (IsSavingEnabled__c and IsPlatformEventStorageEnabled__c)

* Cleaned up help text in several LoggerSettings__c fields

* Added new field LoggerSettings__c.DefaultLogOwner__c that can be used to specify a default owner of Log__c records, using a user ID, username, queue ID or queue developer name

* Renamed LoggerSettings__c field StripInaccessibleRecordFields__c to IsRecordFieldStrippingEnabled__c for consistency



[Log__c UI changes]

* Renamed "View JSON" quickAction to "Open Viewer", and added tabs within logViewer lwc to provide views for both JSON (existing) and log file (new) - a new 'download' button now allows exporting the content to a file

  - For the unlocked package, the logJSON lwc was renamed back to logViewer

* Fixed a conditional render rule on LogEntryRecordpage.flexipage, added an extra check in parseStackTrace() method to handle some problematic lines within a string that is otherwise valid, removed namespace filter when querying ApexClass in LogEntryHandler

* Added picklist values for API Versions in calendar year 2022



[Managed Package changes]

* Changed visibility of LoggerParameter__mdt object from 'Protected' to 'Public'

* Made most LoggerParameter__mdt records non-protected so they can be updated in the managed package

* Worked with @jamessimone to implement a custom approach for dynamically retrieving objects & fields (including namespace) in loggerSettings and logEntryEventStream LWCs, using the new Apex class LoggerSObjectMetadata

  - LWC does not officially support platform events, custom settings, or custom metadata types, so LoggerSObjectMetadata will be used instead

* Re-added skeleton of the deprecated quick action ViewJSON and aura cmp logJSONViewer for the managed package



[Bugfixes]

* Fixed #272 by explicitly delcaring the list as List<Schema.PicklistEntry> instead of just List<PicklistEntry>



[Improvements for Tests & Utilities]

* Added calls to Test.getEventBus().deliver() in Flow classes to try to resolve some inconsistent test failures in the pipeline

* Standardized calls to Database.query() to also use String.escapeSingleQuotes()

* Fixed #276 - Added a check in LoggerEmailUtils to check if email deliverability is enabled before sending an email [skip ci]

* Refactored some code in LogHandler, removed exclusion of PMD rule 'AvoidGlobalModifier'

* Added missing test in LogEntryTagHandler_Tests for updating records

* Fixed some test asserts for 'DUPLICATE_VALUE' error that didn't work correctly when the user's language was not English

* Updated LoggerTestUtils test method to create its own test user, instead of trying to update the current user's record

## Pipeline & Packaging

* Bumped package version to v4.7.0, added devDependencies for outdated packages reported by dependabot in GitHub

* Closed #263 by adding new keyword "ancestorVersion": "HIGHEST" in both sfdx-project.json files

* Updated mgd pkg creation script to use --codecoverage instead of --skipvalidation

* Updated codecov.yml so PR comments are deleted & readded, instead of updated

* Fixed error handling of package creation & installation in pwsh scripts

* Temporarily disabling pipeline check for updated docs due to an error in apexdocs package

* Switched to using JWT bearer flow in pipeline for dev hub auth

* Upgraded sfdx-cli, cleaned up package.json, cleaned up both sfdx-project.json files

* Removed local linking of sfdx-scanner in npm prepare script, added linking command to build.yml, added new sfdx plugin for prettier

* Moved scripts folder back to being a top-level folder

* Switched to using new packageAlias sorting feature in bummer sfdx plugin

* Switched from using sfdx force:community:create + a delay in the pipeline, to instead deploying metadata for a skeleton Experience Cloud site
  The pipeline has been having inconsistent failures because it previously had a 2 minute delay added to wait for force:community:create, but sometimes it took Salesforce longer to finish creating the site asynchronously. Using a deploy will make it a synchronous operation, so it should prevent the inconsistent failures.

Co-authored-by: James Simone <16430727+jamessimone@users.noreply.github.com>
  • Loading branch information
jongpie and jamessimone authored Mar 11, 2022
1 parent f190ab1 commit 2b2fce1
Show file tree
Hide file tree
Showing 239 changed files with 12,042 additions and 19,289 deletions.
5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.github/
.husky/
.sfdx/
.vscode/
test-coverage/
2 changes: 2 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ coverage:
patch: off
ignore:
- 'nebula-logger-recipes/**/*'
comment:
behavior: new
99 changes: 60 additions & 39 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,24 +61,33 @@ jobs:
if: steps.cache-npm.outputs.cache-hit != 'true'
run: npm ci

- name: 'Verify package version number is updated'
- name: 'Authorize Dev Hub'
if: ${{ github.event_name == 'pull_request' }}
shell: bash
run: |
echo ${{ env.DEVHUB_SFDX_URL }} > ./DEVHUB_SFDX_URL.txt
npx sfdx auth:sfdxurl:store --sfdxurlfile ./DEVHUB_SFDX_URL.txt --setalias nebula-logger-packaging --setdefaultdevhubusername
rm ./DEVHUB_SFDX_URL.txt
npm run package:version:number:verify
echo "${{ env.DEV_HUB_JWT_SERVER_KEY }}" > ./jwt-server.key
npx sfdx force:auth:jwt:grant --instanceurl ${{ env.DEV_HUB_AUTH_URL }} --clientid ${{ env.DEV_HUB_CONSUMER_KEY }} --username ${{ env.DEV_HUB_BOT_USERNAME }} --jwtkeyfile ./jwt-server.key --setdefaultdevhubusername
env:
DEVHUB_SFDX_URL: ${{ secrets.DEVHUB_SFDX_URL }}
DEV_HUB_AUTH_URL: ${{ secrets.DEV_HUB_AUTH_URL }}
DEV_HUB_BOT_USERNAME: ${{ secrets.DEV_HUB_BOT_USERNAME }}
DEV_HUB_CONSUMER_KEY: ${{ secrets.DEV_HUB_CONSUMER_KEY }}
DEV_HUB_JWT_SERVER_KEY: ${{ secrets.DEV_HUB_JWT_SERVER_KEY }}

- name: 'Verify package version number is updated'
if: ${{ github.event_name == 'pull_request' }}
run: npm run package:version:number:verify

- name: 'Verify LWC with ESLint'
run: npm run lint:verify:lwc

- name: 'Verify Apex with SFDX Scanner'
run: npm run lint:verify:apex
run: |
npm run sfdx:plugins:link:scanner
npm run lint:verify:apex
- name: 'Verify docs are updated'
run: npm run docs:verify
# TODO - uncomment - temporarily commented-out due to an issue with apexdocs in the pipeline
# - name: 'Verify docs are updated'
# run: npm run docs:verify

- name: 'Verify formatting with Prettier'
run: npm run prettier:verify
Expand Down Expand Up @@ -140,13 +149,16 @@ jobs:
- name: 'Authorize Dev Hub'
shell: bash
run: |
echo ${{ env.DEVHUB_SFDX_URL }} > ./DEVHUB_SFDX_URL.txt
npx sfdx auth:sfdxurl:store --sfdxurlfile ./DEVHUB_SFDX_URL.txt --setalias nebula-logger-packaging --setdefaultdevhubusername
echo "${{ env.DEV_HUB_JWT_SERVER_KEY }}" > ./jwt-server.key
npx sfdx force:auth:jwt:grant --instanceurl ${{ env.DEV_HUB_AUTH_URL }} --clientid ${{ env.DEV_HUB_CONSUMER_KEY }} --username ${{ env.DEV_HUB_BOT_USERNAME }} --jwtkeyfile ./jwt-server.key --setdefaultdevhubusername
env:
DEVHUB_SFDX_URL: ${{ secrets.DEVHUB_SFDX_URL }}
DEV_HUB_AUTH_URL: ${{ secrets.DEV_HUB_AUTH_URL }}
DEV_HUB_BOT_USERNAME: ${{ secrets.DEV_HUB_BOT_USERNAME }}
DEV_HUB_CONSUMER_KEY: ${{ secrets.DEV_HUB_CONSUMER_KEY }}
DEV_HUB_JWT_SERVER_KEY: ${{ secrets.DEV_HUB_JWT_SERVER_KEY }}

- name: 'Create Base Scratch Org'
run: npm run org:create:base -- -durationdays 1 -devhubs nebula-logger-packaging
run: npx sfdx force:org:create --durationdays 1 --definitionfile ./config/scratch-orgs/base-scratch-def.json --wait 20 --setdefaultusername --json

- name: 'Push Source to Scratch Org'
run: npm run source:push
Expand Down Expand Up @@ -187,21 +199,19 @@ jobs:
- name: 'Authorize Dev Hub'
shell: bash
run: |
echo ${{ env.DEVHUB_SFDX_URL }} > ./DEVHUB_SFDX_URL.txt
npx sfdx auth:sfdxurl:store --sfdxurlfile ./DEVHUB_SFDX_URL.txt --setalias nebula-logger-packaging --setdefaultdevhubusername
echo "${{ env.DEV_HUB_JWT_SERVER_KEY }}" > ./jwt-server.key
npx sfdx force:auth:jwt:grant --instanceurl ${{ env.DEV_HUB_AUTH_URL }} --clientid ${{ env.DEV_HUB_CONSUMER_KEY }} --username ${{ env.DEV_HUB_BOT_USERNAME }} --jwtkeyfile ./jwt-server.key --setdefaultdevhubusername
env:
DEVHUB_SFDX_URL: ${{ secrets.DEVHUB_SFDX_URL }}

- name: 'Create Scratch Org with Experience Sites Enabled'
run: npm run org:create:experience-cloud -- -durationdays 1 -devhubs nebula-logger-packaging
DEV_HUB_AUTH_URL: ${{ secrets.DEV_HUB_AUTH_URL }}
DEV_HUB_BOT_USERNAME: ${{ secrets.DEV_HUB_BOT_USERNAME }}
DEV_HUB_CONSUMER_KEY: ${{ secrets.DEV_HUB_CONSUMER_KEY }}
DEV_HUB_JWT_SERVER_KEY: ${{ secrets.DEV_HUB_JWT_SERVER_KEY }}

- name: 'Create Test Experience Site'
run: npm run experience:create
- name: 'Create Experience Cloud Scratch Org'
run: npx sfdx force:org:create --durationdays 1 --definitionfile ./config/scratch-orgs/experience-cloud-scratch-def.json --wait 20 --setdefaultusername --json

- name: 'Wait for Experience Site creation'
uses: maddox/actions/sleep@master
with:
args: '120'
- name: 'Deploy Test Experience Site Metadata'
run: npm run experience:deploy

- name: 'Push Source to Scratch Org'
run: npm run source:push
Expand Down Expand Up @@ -251,13 +261,16 @@ jobs:
if: steps.cache-npm.outputs.cache-hit != 'true'
run: npm ci

- name: 'Authorize Packaging Org'
- name: 'Authorize Dev Hub'
shell: bash
run: |
echo ${{ env.DEVHUB_SFDX_URL }} > ./DEVHUB_SFDX_URL.txt
npx sfdx auth:sfdxurl:store --sfdxurlfile ./DEVHUB_SFDX_URL.txt --setalias nebula-logger-packaging --setdefaultdevhubusername
echo "${{ env.DEV_HUB_JWT_SERVER_KEY }}" > ./jwt-server.key
npx sfdx force:auth:jwt:grant --instanceurl ${{ env.DEV_HUB_AUTH_URL }} --clientid ${{ env.DEV_HUB_CONSUMER_KEY }} --username ${{ env.DEV_HUB_BOT_USERNAME }} --jwtkeyfile ./jwt-server.key --setdefaultdevhubusername
env:
DEVHUB_SFDX_URL: ${{ secrets.DEVHUB_SFDX_URL }}
DEV_HUB_AUTH_URL: ${{ secrets.DEV_HUB_AUTH_URL }}
DEV_HUB_BOT_USERNAME: ${{ secrets.DEV_HUB_BOT_USERNAME }}
DEV_HUB_CONSUMER_KEY: ${{ secrets.DEV_HUB_CONSUMER_KEY }}
DEV_HUB_JWT_SERVER_KEY: ${{ secrets.DEV_HUB_JWT_SERVER_KEY }}

- name: 'Authorize Demo Org'
shell: bash
Expand All @@ -268,12 +281,14 @@ jobs:
PKG_DEMO_ORG_SFDX_URL: ${{ secrets.NEBULA_PKG_DEMO_SANDBOX_SFDX_URL }}

- name: 'Create & Install Package Version'
run: npx pwsh ./config/scripts/build/create-and-install-package-version.ps1 -targetpackagealias '"Nebula Logger - Core"' -targetreadme ./README.md -targetusername nebula-logger-package-demo
run: npx pwsh ./scripts/build/create-and-install-package-version.ps1 -targetpackagealias '"Nebula Logger - Core"' -targetreadme ./README.md -targetusername nebula-logger-package-demo

- name: 'Commit New Package Version'
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action Bot"
npm run sfdx:plugins:link:bummer
npx sfdx bummer:package:aliases:sort
npx prettier --write ./sfdx-project.json
git add ./sfdx-project.json
git commit -m "Created new package version"
Expand Down Expand Up @@ -305,13 +320,16 @@ jobs:
if: steps.cache-npm.outputs.cache-hit != 'true'
run: npm ci

- name: 'Authorize Packaging Org'
- name: 'Authorize Dev Hub'
shell: bash
run: |
echo ${{ env.DEVHUB_SFDX_URL }} > ./DEVHUB_SFDX_URL.txt
npx sfdx auth:sfdxurl:store --sfdxurlfile ./DEVHUB_SFDX_URL.txt --setalias nebula-logger-packaging --setdefaultdevhubusername
echo "${{ env.DEV_HUB_JWT_SERVER_KEY }}" > ./jwt-server.key
npx sfdx force:auth:jwt:grant --instanceurl ${{ env.DEV_HUB_AUTH_URL }} --clientid ${{ env.DEV_HUB_CONSUMER_KEY }} --username ${{ env.DEV_HUB_BOT_USERNAME }} --jwtkeyfile ./jwt-server.key --setdefaultdevhubusername
env:
DEVHUB_SFDX_URL: ${{ secrets.DEVHUB_SFDX_URL }}
DEV_HUB_AUTH_URL: ${{ secrets.DEV_HUB_AUTH_URL }}
DEV_HUB_BOT_USERNAME: ${{ secrets.DEV_HUB_BOT_USERNAME }}
DEV_HUB_CONSUMER_KEY: ${{ secrets.DEV_HUB_CONSUMER_KEY }}
DEV_HUB_JWT_SERVER_KEY: ${{ secrets.DEV_HUB_JWT_SERVER_KEY }}

- name: 'Create Beta Managed Package Version'
run: npm run package:version:create:managed
Expand Down Expand Up @@ -339,13 +357,16 @@ jobs:
if: steps.cache-npm.outputs.cache-hit != 'true'
run: npm ci

- name: 'Authorize Packaging Org'
- name: 'Authorize Dev Hub'
shell: bash
run: |
echo ${{ env.DEVHUB_SFDX_URL }} > ./DEVHUB_SFDX_URL.txt
npx sfdx auth:sfdxurl:store --sfdxurlfile ./DEVHUB_SFDX_URL.txt --setalias nebula-logger-packaging --setdefaultdevhubusername
echo "${{ env.DEV_HUB_JWT_SERVER_KEY }}" > ./jwt-server.key
npx sfdx force:auth:jwt:grant --instanceurl ${{ env.DEV_HUB_AUTH_URL }} --clientid ${{ env.DEV_HUB_CONSUMER_KEY }} --username ${{ env.DEV_HUB_BOT_USERNAME }} --jwtkeyfile ./jwt-server.key --setdefaultdevhubusername
env:
DEVHUB_SFDX_URL: ${{ secrets.DEVHUB_SFDX_URL }}
DEV_HUB_AUTH_URL: ${{ secrets.DEV_HUB_AUTH_URL }}
DEV_HUB_BOT_USERNAME: ${{ secrets.DEV_HUB_BOT_USERNAME }}
DEV_HUB_CONSUMER_KEY: ${{ secrets.DEV_HUB_CONSUMER_KEY }}
DEV_HUB_JWT_SERVER_KEY: ${{ secrets.DEV_HUB_JWT_SERVER_KEY }}

- name: 'Promote package versions'
run: npx pwsh ./config/scripts/build/promote-readme-packages.ps1
run: npx pwsh ./scripts/build/promote-readme-packages.ps1
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ nebula-logger/**/main/default/
test-coverage/
temp/

# Additional folders that are temporarily copied when creating a version of the managed package
nebula-logger/managed-package/core/main/configuration/
nebula-logger/managed-package/core/main/log-management/
nebula-logger/managed-package/core/main/logger-engine/
nebula-logger/managed-package/core/main/plugin-framework/
nebula-logger/managed-package/core/tests/

# NPM
node_modules/
yarn.lock
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@

Designed for Salesforce admins, developers & architects. A robust logger for Apex, Lightning Components, Flow, Process Builder & Integrations.

## Unlocked Package - v4.6.16
## Unlocked Package - v4.7.0

[![Install Unlocked Package in a Sandbox](./images/btn-install-unlocked-package-sandbox.png)](https://test.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000015lLzQAI)
[![Install Unlocked Package in Production](./images/btn-install-unlocked-package-production.png)](https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000015lLzQAI)
[![Install Unlocked Package in a Sandbox](./images/btn-install-unlocked-package-sandbox.png)](https://test.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000015lXSQAY)
[![Install Unlocked Package in Production](./images/btn-install-unlocked-package-production.png)](https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000015lXSQAY)
[![View Documentation](./images/btn-view-documentation.png)](https://jongpie.github.io/NebulaLogger/)

## Managed Package - v4.6.0
## Managed Package - v4.7.0

[![Install Managed Package in a Sandbox](./images/btn-install-managed-package-sandbox.png)](https://test.salesforce.com/packaging/installPackage.apexp?mgd=true&p0=04t5Y0000015keOQAQ)
[![Install Managed Package in Production](./images/btn-install-managed-package-production.png)](https://login.salesforce.com/packaging/installPackage.apexp?mgd=true&p0=04t5Y0000015keOQAQ)
[![Install Managed Package in a Sandbox](./images/btn-install-managed-package-sandbox.png)](https://test.salesforce.com/packaging/installPackage.apexp?mgd=true&p0=04t5Y0000015lXNQAY)
[![Install Managed Package in Production](./images/btn-install-managed-package-production.png)](https://login.salesforce.com/packaging/installPackage.apexp?mgd=true&p0=04t5Y0000015lXNQAY)
[![View Milestone](./images/btn-view-managed-package-milestone.png)](https://github.com/jongpie/NebulaLogger/milestone/6)

---
Expand Down
1 change: 0 additions & 1 deletion config/linters/pmd-ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
</description>
<rule ref="category/apex/bestpractices.xml">
<exclude name="ApexAssertionsShouldIncludeMessage" />
<exclude name="AvoidGlobalModifier" />
<exclude name="AvoidLogicInTrigger" />
</rule>
<rule ref="category/apex/codestyle.xml">
Expand Down
7 changes: 5 additions & 2 deletions config/scratch-orgs/experience-cloud-scratch-def.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"orgName": "Nebula Logger - Experience Cloud Scratch Org",
"edition": "Enterprise",
"hasSampleData": true,
"country": "US",
"language": "en_US",
"country": "ES",
"language": "es",
"features": ["Communities"],
"settings": {
"chatterSettings": {
Expand All @@ -12,6 +12,9 @@
"communitiesSettings": {
"enableNetworksEnabled": true
},
"experienceBundleSettings": {
"enableExperienceBundleMetadata": true
},
"userManagementSettings": {
"enableEnhancedPermsetMgmt": true,
"enableEnhancedProfileMgmt": true,
Expand Down
4 changes: 4 additions & 0 deletions docs/apex/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ Manages mass deleting `Log__c` records that have been selected by a user on a `L

Abstract class used by trigger handlers for shared logic

### [LoggerSObjectMetadata](log-management/LoggerSObjectMetadata)

Provides details to LWCs about Logger&apos;s `SObjects`, using `@AuraEnabled` properties

### [LoggerSettingsController](log-management/LoggerSettingsController)

Controller class for lwc `loggerSettings`, used to manage records in `LoggerSettings__c`
Expand Down
85 changes: 85 additions & 0 deletions docs/apex/log-management/LoggerSObjectMetadata.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
layout: default
---

## LoggerSObjectMetadata class

Provides details to LWCs about Logger&apos;s `SObjects`, using `@AuraEnabled` properties

---

### Methods

#### `getLogEntryEventSchema()``SObjectSchema`

Provides schema details about the the platform event object `LogEntryEvent__e`

##### Return

**Type**

SObjectSchema

**Description**

An instance of `LoggerSObjectMetadata.SObjectSchema` for the platform event `LogEntryEvent__e`

#### `getLoggerSettingsSchema()``SObjectSchema`

Provides schema details about the the custom settings object `LoggerSettings__c`

##### Return

**Type**

SObjectSchema

**Description**

An instance of `LoggerSObjectMetadata.SObjectSchema` for the platform event `LoggerSettings__c`

---

### Inner Classes

#### LoggerSObjectMetadata.FieldSchema class

Inner class for `SObjectField` details to LWCs, using `@AuraEnabled` properties

---

##### Properties

###### `apiName``String`

###### `inlineHelpText``String`

###### `label``String`

###### `localApiName``String`

###### `type``String`

---

#### LoggerSObjectMetadata.SObjectSchema class

Inner class for `SObject` details to LWCs, using `@AuraEnabled` properties

---

##### Properties

###### `apiName``String`

###### `fields``Map<String, FieldSchema>`

###### `label``String`

###### `labelPlural``String`

###### `localApiName``String`

###### `namespacePrefix``String`

---
14 changes: 14 additions & 0 deletions docs/apex/logger-engine/Logger.md
Original file line number Diff line number Diff line change
Expand Up @@ -3244,6 +3244,20 @@ SaveMethod

The enum value of Logger.SaveMethod to use for any calls to saveLog() in the current transaction

#### `getScenario()``String`

Returns the scenario name for the current transaction - this is stored in `LogEntryEvent__e.Scenario__c` and `Log__c.Scenario__c`, and can be used to filter &amp; group logs

##### Return

**Type**

String

**Description**

The value currently set as the current transaction&apos;s scenario

#### `getTransactionId()``String`

Returns the unique ID for a particular transaction, stored in Log**c.TransactionId**c
Expand Down
Loading

0 comments on commit 2b2fce1

Please sign in to comment.