Skip to content

Commit 2462fca

Browse files
authored
Added the option to automatically call the lightning-logger LWC (#743)
* Resolved #722 by adding the optional ability to automatically call Salesforce's lightning-logger LWC when logging via lightning components, which creates a "Lightning Logger" event in Event Monitoring * This includes new fields LoggerSettings__c.IsJavaScriptLightningLoggerEnabled__c and LoggerScenarioRule__mdt.IsJavaScriptLightningLoggerEnabled__c to control enabling this feature * Finished some code cleanup left over from v4.13.15 in logEntryBuilder.js and ComponentLogger.cls * Now browser details are represented as an object in both JS and Apex, and some old deprecated properties have been removed * Also added some extra jest tests to validate that the browser details are being properly set * Scope creep: fixed a small bug in a Logger where a System.debug() statement for scenario-based logging was using the wrong variable * Scope creep: removed unnecessary access to FlowLogger in the permission set LoggerLogCreator * FlowLogger should only be called internally by Nebula Logger, so there's no need for users to have direct access to it * Created additional scratch def files & added them to build.yml - each one corresponds to a specific Salesforce feature that's optionally used by Nebula Logger * There are now 5 scratch def files - 1 used for dev, and 4 used by the pipeline (base (used for packaging), event monitoring, experience cloud, and platform cache) * The pipeline will only create 2 scratch orgs at a time to avoid the dev hub's limit of 3 active scratch orgs (1 of 3 available is used for dev work) * Removed an old/duplicate Experience Cloud site (used by the pipeline) * Added Apex class access to 2 Experience Cloud Guest User profiles (used by the pipeline + dev) to simplify manual testing efforts * Upgraded to sf rc v2.56.6 to use the new --concise flag on sf apex test run * Upgraded to v4 of the codecov action in build.yml * Added a new bash script, ./scripts/dev/setup-dev-scratch-org.sh, to automate setting up a new dev scratch org
1 parent 70cecec commit 2462fca

66 files changed

Lines changed: 2018 additions & 2839 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/ISSUE_TEMPLATE/bug-report.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Bug Report
22
description: File a bug report for Nebula Logger
3-
labels: ['bug']
3+
labels: ['Type: Bug']
44
body:
55
- type: dropdown
66
id: package-edition

.github/ISSUE_TEMPLATE/feature-request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Feature Request
22
description: Suggest an enhancement for Nebula Logger
3-
labels: ['enhancement']
3+
labels: ['Type: Enhancement']
44
body:
55
- type: textarea
66
attributes:

.github/workflows/build.yml

Lines changed: 136 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ name: Build
33

44
env:
55
SF_DISABLE_AUTOUPDATE: true
6-
SF_SKIP_NEW_VERSION_CHECK: true
76
SF_LOG_LEVEL: debug
7+
SF_SKIP_NEW_VERSION_CHECK: true
88

99
on:
1010
push:
@@ -124,16 +124,16 @@ jobs:
124124
run: npm run test:lwc
125125

126126
- name: 'Upload LWC code coverage to Codecov.io'
127-
uses: codecov/codecov-action@v3
127+
uses: codecov/codecov-action@v4
128128
with:
129129
token: ${{ secrets.CODECOV_TOKEN }}
130130
flags: LWC
131131

132132
base-scratch-org-tests:
133+
environment: 'Base Scratch Org'
133134
name: 'Run Base Scratch Org Tests'
134135
needs: [code-quality-tests]
135136
runs-on: ubuntu-latest
136-
environment: 'Base Scratch Org'
137137
steps:
138138
- name: 'Checkout source code'
139139
uses: actions/checkout@v4
@@ -164,7 +164,7 @@ jobs:
164164
DEV_HUB_CONSUMER_KEY: ${{ secrets.DEV_HUB_CONSUMER_KEY }}
165165
DEV_HUB_JWT_SERVER_KEY: ${{ secrets.DEV_HUB_JWT_SERVER_KEY }}
166166

167-
- name: 'Create Base Scratch Org'
167+
- name: 'Create Scratch Org'
168168
run: npx sf org create scratch --no-namespace --duration-days 1 --definition-file ./config/scratch-orgs/build-base-scratch-def.json --wait 20 --set-default --json
169169

170170
- name: 'Deploy Source to Scratch Org'
@@ -191,11 +191,73 @@ jobs:
191191
run: npx sf org delete scratch --no-prompt
192192
if: ${{ always() }}
193193

194-
experience-cloud-scratch-org-tests:
195-
name: 'Run Experience Cloud Scratch Org Tests'
194+
event-monitoring-scratch-org-tests:
195+
environment: 'Event Monitoring Scratch Org'
196+
name: 'Run Event Monitoring Scratch Org Tests'
196197
needs: [code-quality-tests]
197198
runs-on: ubuntu-latest
199+
steps:
200+
- name: 'Checkout source code'
201+
uses: actions/checkout@v4
202+
203+
- name: 'Restore node_modules cache'
204+
id: cache-npm
205+
uses: actions/cache@v4
206+
with:
207+
path: node_modules
208+
key: npm-${{ hashFiles('**/package-lock.json') }}
209+
restore-keys: |
210+
npm-${{ env.cache-name }}-
211+
npm-
212+
213+
- name: 'Install npm dependencies'
214+
if: steps.cache-npm.outputs.cache-hit != 'true'
215+
run: npm ci
216+
217+
- name: 'Authorize Dev Hub'
218+
shell: bash
219+
run: |
220+
npx sf version
221+
echo "${{ env.DEV_HUB_JWT_SERVER_KEY }}" > ./jwt-server.key
222+
npx sf org login jwt --instance-url ${{ env.DEV_HUB_AUTH_URL }} --client-id ${{ env.DEV_HUB_CONSUMER_KEY }} --username ${{ env.DEV_HUB_BOT_USERNAME }} --jwt-key-file ./jwt-server.key --set-default-dev-hub
223+
env:
224+
DEV_HUB_AUTH_URL: ${{ secrets.DEV_HUB_AUTH_URL }}
225+
DEV_HUB_BOT_USERNAME: ${{ secrets.DEV_HUB_BOT_USERNAME }}
226+
DEV_HUB_CONSUMER_KEY: ${{ secrets.DEV_HUB_CONSUMER_KEY }}
227+
DEV_HUB_JWT_SERVER_KEY: ${{ secrets.DEV_HUB_JWT_SERVER_KEY }}
228+
229+
- name: 'Create Scratch Org'
230+
run: npx sf org create scratch --no-namespace --duration-days 1 --definition-file ./config/scratch-orgs/build-event-monitoring-scratch-def.json --wait 20 --set-default --json
231+
232+
- name: 'Deploy Source to Scratch Org'
233+
run: npx sf project deploy start --source-dir ./nebula-logger/
234+
235+
- name: 'Assign Logger Admin Permission Set'
236+
run: npm run permset:assign:admin
237+
238+
- name: 'Validate Custom Metadata Records'
239+
run: npx sf apex run --file ./scripts/build/validate-custom-metadata-records.apex
240+
241+
# Nebula Logger has functionality that queries the AuthSession object when the current user has an active session.
242+
# The code should work with or without an active session, so the pipeline runs the tests twice - asynchronously and synchronously.
243+
# This is done because, based on how you execute Apex tests, the running user may have an active session (synchrously) or not (asynchronously).
244+
# Utlimately, this could/should probably be better mocked during tests, but the AuthSession is read-only in Apex, so it's a bit difficult to work with.
245+
# Running the Apex tests sync & async serves as an extra level of integration testing to ensure that everything works with or without an active session.
246+
- name: 'Run Apex Tests Asynchronously'
247+
run: npm run test:apex:nocoverage
248+
249+
- name: 'Run Apex Tests Synchronously'
250+
run: npm run test:apex:nocoverage -- --synchronous
251+
252+
- name: 'Delete Base Scratch Org'
253+
run: npx sf org delete scratch --no-prompt
254+
if: ${{ always() }}
255+
256+
experience-cloud-scratch-org-tests:
198257
environment: 'Experience Cloud Scratch Org'
258+
name: 'Run Experience Cloud Scratch Org Tests'
259+
needs: [code-quality-tests, base-scratch-org-tests]
260+
runs-on: ubuntu-latest
199261
steps:
200262
- name: 'Checkout source code'
201263
uses: actions/checkout@v4
@@ -226,13 +288,13 @@ jobs:
226288
DEV_HUB_CONSUMER_KEY: ${{ secrets.DEV_HUB_CONSUMER_KEY }}
227289
DEV_HUB_JWT_SERVER_KEY: ${{ secrets.DEV_HUB_JWT_SERVER_KEY }}
228290

229-
- name: 'Create Experience Cloud Scratch Org'
291+
- name: 'Create Scratch Org'
230292
run: npx sf org create scratch --no-namespace --duration-days 1 --definition-file ./config/scratch-orgs/build-experience-cloud-scratch-def.json --wait 20 --set-default --json
231293

232294
- name: 'Deploy Source to Scratch Org'
233295
run: npx sf project deploy start --source-dir ./nebula-logger/
234296

235-
- name: 'Deploy Test Experience Site Metadata'
297+
- name: 'Deploy Test Experience Sites Metadata'
236298
run: npm run experience:deploy
237299

238300
- name: 'Assign Logger Admin Permission Set'
@@ -252,8 +314,9 @@ jobs:
252314
- name: 'Run Apex Tests Synchronously'
253315
run: npm run test:apex -- --synchronous
254316

317+
# This is the only scratch org that's used for uploading code coverage
255318
- name: 'Upload Apex test code coverage to Codecov.io'
256-
uses: codecov/codecov-action@v3
319+
uses: codecov/codecov-action@v4
257320
with:
258321
token: ${{ secrets.CODECOV_TOKEN }}
259322
flags: Apex
@@ -262,9 +325,71 @@ jobs:
262325
run: npx sf org delete scratch --no-prompt
263326
if: ${{ always() }}
264327

328+
platform-cache-scratch-org-tests:
329+
environment: 'Platform Cache Scratch Org'
330+
name: 'Run Platform Cache Scratch Org Tests'
331+
needs: [code-quality-tests, event-monitoring-scratch-org-tests]
332+
runs-on: ubuntu-latest
333+
steps:
334+
- name: 'Checkout source code'
335+
uses: actions/checkout@v4
336+
337+
- name: 'Restore node_modules cache'
338+
id: cache-npm
339+
uses: actions/cache@v4
340+
with:
341+
path: node_modules
342+
key: npm-${{ hashFiles('**/package-lock.json') }}
343+
restore-keys: |
344+
npm-${{ env.cache-name }}-
345+
npm-
346+
347+
- name: 'Install npm dependencies'
348+
if: steps.cache-npm.outputs.cache-hit != 'true'
349+
run: npm ci
350+
351+
- name: 'Authorize Dev Hub'
352+
shell: bash
353+
run: |
354+
npx sf version
355+
echo "${{ env.DEV_HUB_JWT_SERVER_KEY }}" > ./jwt-server.key
356+
npx sf org login jwt --instance-url ${{ env.DEV_HUB_AUTH_URL }} --client-id ${{ env.DEV_HUB_CONSUMER_KEY }} --username ${{ env.DEV_HUB_BOT_USERNAME }} --jwt-key-file ./jwt-server.key --set-default-dev-hub
357+
env:
358+
DEV_HUB_AUTH_URL: ${{ secrets.DEV_HUB_AUTH_URL }}
359+
DEV_HUB_BOT_USERNAME: ${{ secrets.DEV_HUB_BOT_USERNAME }}
360+
DEV_HUB_CONSUMER_KEY: ${{ secrets.DEV_HUB_CONSUMER_KEY }}
361+
DEV_HUB_JWT_SERVER_KEY: ${{ secrets.DEV_HUB_JWT_SERVER_KEY }}
362+
363+
- name: 'Create Scratch Org'
364+
run: npx sf org create scratch --no-namespace --duration-days 1 --definition-file ./config/scratch-orgs/build-platform-cache-scratch-def.json --wait 20 --set-default --json
365+
366+
- name: 'Deploy Source to Scratch Org'
367+
run: npx sf project deploy start --source-dir ./nebula-logger/
368+
369+
- name: 'Assign Logger Admin Permission Set'
370+
run: npm run permset:assign:admin
371+
372+
- name: 'Validate Custom Metadata Records'
373+
run: npx sf apex run --file ./scripts/build/validate-custom-metadata-records.apex
374+
375+
# Nebula Logger has functionality that queries the AuthSession object when the current user has an active session.
376+
# The code should work with or without an active session, so the pipeline runs the tests twice - asynchronously and synchronously.
377+
# This is done because, based on how you execute Apex tests, the running user may have an active session (synchrously) or not (asynchronously).
378+
# Utlimately, this could/should probably be better mocked during tests, but the AuthSession is read-only in Apex, so it's a bit difficult to work with.
379+
# Running the Apex tests sync & async serves as an extra level of integration testing to ensure that everything works with or without an active session.
380+
- name: 'Run Apex Tests Asynchronously'
381+
run: npm run test:apex:nocoverage
382+
383+
- name: 'Run Apex Tests Synchronously'
384+
run: npm run test:apex:nocoverage -- --synchronous
385+
386+
- name: 'Delete Base Scratch Org'
387+
run: npx sf org delete scratch --no-prompt
388+
if: ${{ always() }}
389+
265390
create-managed-package-beta:
266391
name: 'Create Managed Package Beta'
267-
needs: [lwc-tests, base-scratch-org-tests, experience-cloud-scratch-org-tests]
392+
needs: [lwc-tests, base-scratch-org-tests, event-monitoring-scratch-org-tests, experience-cloud-scratch-org-tests, platform-cache-scratch-org-tests]
268393
if: ${{ github.ref != 'refs/heads/main' }}
269394
runs-on: ubuntu-latest
270395
environment: 'Demo Org'
@@ -377,7 +502,7 @@ jobs:
377502
378503
promote-package-versions:
379504
name: 'Promote Package Versions'
380-
needs: [lwc-tests, base-scratch-org-tests, experience-cloud-scratch-org-tests]
505+
needs: [lwc-tests, base-scratch-org-tests, event-monitoring-scratch-org-tests, experience-cloud-scratch-org-tests, platform-cache-scratch-org-tests]
381506
if: ${{ github.ref == 'refs/heads/main' }}
382507
runs-on: ubuntu-latest
383508
steps:

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55

66
The most robust logger for Salesforce. Works with Apex, Lightning Components, Flow, Process Builder & Integrations. Designed for Salesforce admins, developers & architects.
77

8-
## Unlocked Package - v4.14.3
8+
## Unlocked Package - v4.14.4
99

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

14-
`sf package install --wait 20 --security-type AdminsOnly --package 04t5Y0000015oQjQAI`
14+
`sf package install --wait 20 --security-type AdminsOnly --package 04t5Y0000015oRNQAY`
1515

16-
`sfdx force:package:install --wait 20 --securitytype AdminsOnly --package 04t5Y0000015oQjQAI`
16+
`sfdx force:package:install --wait 20 --securitytype AdminsOnly --package 04t5Y0000015oRNQAY`
1717

1818
---
1919

config/experience-cloud/experiences/Logger_Test_Site1.site-meta.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)