feat(management): add sub-package exports and management auth helper#1373
Merged
Conversation
Expose each Management API resource as its own package entry point (for example auth0/clients, auth0/users) so bundlers only include the resources an application uses. Add createManagementAuth and export TokenProvider from auth0/management so callers can configure authentication once and reuse it across sub-clients without pulling in the full ManagementClient.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1373 +/- ##
==========================================
- Coverage 89.76% 89.71% -0.05%
==========================================
Files 431 432 +1
Lines 20108 20124 +16
Branches 9782 9458 -324
==========================================
+ Hits 18049 18054 +5
- Misses 2059 2070 +11
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
… createManagementAuth Extract the telemetry-header, token-supplier, and client-credentials type-guard logic into a shared wrapper/auth-helpers module. Both the full ManagementClient and the createManagementAuth helper now consume it, removing the duplicated implementations. createManagementAuth's clientOptions gain full parity with the full client (Auth0-Client telemetry header, custom domain header, timeout, retries, and logging passthrough) while keeping the module tree-shakeable for sub-package imports.
ankita10119
previously approved these changes
Jul 22, 2026
ankita10119
approved these changes
Jul 22, 2026
amitsingh05667
approved these changes
Jul 22, 2026
harshithRai
approved these changes
Jul 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Changes
This adds per-resource sub-package entry points and a lightweight authentication helper so applications can use the Management API without importing the full
ManagementClient. This keeps bundles small on size-constrained runtimes such as Cloudflare Workers and other edge environments.New package entry points
auth0/clients,auth0/users,auth0/connections, and nested resources such asauth0/clients/connections. A bundler only includes the resources an application imports, instead of the entire resource graph that the top-levelManagementClientreferences.auth0/managemententry point that exposes the management wrapper surface.New authentication helpers (exported from
auth0/management)createManagementAuth(options)configures authentication once and returns{ baseUrl, getToken, clientOptions }. SpreadclientOptionsinto any sub-client so they share one cached, auto-refreshing token. Supports client credentials (client secret or client assertion) and static tokens.TokenProvideris now exported for lower-level control over the token lifecycle. It performs the client credentials grant and caches the token until shortly before it expires.ManagementAuthandManagementAuthOptionstypes.Usage
Request and response types remain under the shared
Managementnamespace and are imported withimport type { Management } from "auth0". Because they are interfaces, they are erased at compile time and add nothing to the bundle.These smaller bundles rely on tree-shaking, so they apply when the SDK is consumed as ESM through a bundler. A CommonJS
require()cannot tree-shake and loads the full resource graph.References
N/A
Testing
The full existing test suite passes without errors.
The build produces the new entry points for both CJS and ESM, and
publintvalidates theexportsmap against the built output.Bundling a single sub-client with a tree-shaking bundler confirms only the imported resource plus shared core and error code is included, and the auth helper does not pull in
ManagementClient.This change adds unit test coverage
This change adds integration test coverage
Checklist