Skip to content

Actual DV calls support for ServerLogic Debug using PAC auth#1375

Open
amitjoshi438 wants to merge 11 commits intomainfrom
users/amitjoshi/serverLogicDebugWithDV
Open

Actual DV calls support for ServerLogic Debug using PAC auth#1375
amitjoshi438 wants to merge 11 commits intomainfrom
users/amitjoshi/serverLogicDebugWithDV

Conversation

@amitjoshi438
Copy link
Contributor

@amitjoshi438 amitjoshi438 commented Dec 16, 2025

This pull request introduces major improvements to the Server Logic debugging experience in Power Pages by enabling direct Dataverse API calls during debugging when authenticated, and refactoring the debugger activation for better integration with authentication. The changes ensure that, when authenticated via the PAC CLI, server logic code can call Dataverse APIs directly using real credentials; otherwise, mock responses are returned. The activation and command handling logic for the debugger has been updated to support this, along with enhanced telemetry and error handling.

Server Logic Debugger & Authentication Integration:

  • Refactored the activateServerLogicDebugger function to accept a PacWrapper parameter, enabling automatic retrieval of Dataverse credentials for real API calls during debugging. This includes new helper functions for credential retrieval and validation of server logic files. (src/debugger/server-logic/ServerLogicDebugger.ts, src/client/extension.ts) [1] [2] [3] [4]
  • Updated the command registration and removed the powerpages.debugServerLogic command from the navigation menu to prevent it from appearing in inappropriate contexts. (package.json)

Dataverse API Call Support in Mock SDK:

  • Enhanced the generateServerMockSdk function to support direct Dataverse API calls (CRUD and custom API) using credentials injected via environment variables during debugging. If not authenticated, the SDK falls back to returning mock responses. (src/debugger/server-logic/ServerLogicMockSdk.ts) [1] [2] [3] [4] [5] [6] [7] [8]

Telemetry and Error Handling:

  • Added new telemetry event SERVER_LOGIC_AUTH_ERROR to track authentication failures when retrieving Dataverse credentials. Telemetry for debug and run commands now includes whether real credentials were used. (src/common/OneDSLoggerTelemetry/client/desktopExtensionTelemetryEventNames.ts, src/debugger/server-logic/ServerLogicDebugger.ts) [1] [2] [3]

These changes provide a more realistic and seamless debugging experience for server logic, improve error visibility, and streamline command handling for developers.

Amit Joshi added 11 commits November 10, 2025 14:45
…un/debug commands

- Implement local Server Logic debugger with mock Power Pages SDK
  (src/debugger/server-logic/ServerLogicMockSdk.ts)
- Provide debug configuration provider, runtime loader generation,
  commands for Debug/Run/Generate Mock Data, and welcome notification
  (ServerLogicDebugger.ts, sample-server-logic.js, README.md, index.ts)
- Add CodeLens provider to show inline "Debug" / "Run" actions
  (ServerLogicCodeLensProvider.ts) and register it on activation
- Wire activation into extension (activateServerLogicDebugger in extension.ts)
- Add package.json contributions: debug/run commands, snippets, editor/context entries
- Add telemetry events for debug/run/mock-template actions
- Enable generation of .vscode/mock-data.json and support loading custom mock data
 into users/amitjoshi/serverLogicDebugSupport
@amitjoshi438 amitjoshi438 requested review from a team as code owners December 16, 2025 06:48
Base automatically changed from users/amitjoshi/serverLogicDebugSupport to main December 19, 2025 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant