Actual DV calls support for ServerLogic Debug using PAC auth #1375
+337
−85
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
activateServerLogicDebuggerfunction to accept aPacWrapperparameter, 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]powerpages.debugServerLogiccommand from the navigation menu to prevent it from appearing in inappropriate contexts. (package.json)Dataverse API Call Support in Mock SDK:
generateServerMockSdkfunction 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:
SERVER_LOGIC_AUTH_ERRORto 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.