Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"types": "./dist/cjs/index.d.ts",
"exports": {
".": {
"types": "./dist/cjs/index.d.ts",
"import": {
"types": "./dist/esm/index.d.mts",
"default": "./dist/esm/index.mjs"
Expand Down Expand Up @@ -77,17 +76,17 @@
"auth0-legacy": "npm:auth0@^4.27.0"
},
"devDependencies": {
"webpack": "^5.97.1",
"ts-loader": "^9.5.1",
"webpack": "^5.105.4",
"ts-loader": "^9.5.4",
"jest": "^29.7.0",
"@jest/globals": "^29.7.0",
"@types/jest": "^29.5.14",
"ts-jest": "^29.3.4",
"jest-environment-jsdom": "^29.7.0",
"msw": "2.11.2",
"@types/node": "^18.19.70",
"typescript": "~5.7.2",
"prettier": "3.7.4",
"typescript": "~5.9.3",
"prettier": "3.8.1",
"typedoc": "^0.28.7",
"typedoc-plugin-missing-exports": "^4.0.0",
"nock": "^14.0.6",
Expand Down
31 changes: 31 additions & 0 deletions src/management/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,4 +275,35 @@ export class ManagementClient {
public get verifiableCredentials(): VerifiableCredentialsClient {
return (this._verifiableCredentials ??= new VerifiableCredentialsClient(this._options));
}

/**
* Make a passthrough request using the SDK's configured auth, retry, logging, etc.
* This is useful for making requests to endpoints not yet supported in the SDK.
* The input can be a URL string, URL object, or Request object. Relative paths are resolved against the configured base URL.
*
* @param {Request | string | URL} input - The URL, path, or Request object.
* @param {RequestInit} init - Standard fetch RequestInit options.
* @param {core.PassthroughRequest.RequestOptions} requestOptions - Per-request overrides (timeout, retries, headers, abort signal).
* @returns {Promise<Response>} A standard Response object.
*/
public async fetch(
input: Request | string | URL,
init?: RequestInit,
requestOptions?: core.PassthroughRequest.RequestOptions,
): Promise<Response> {
return core.makePassthroughRequest(
input,
init,
{
baseUrl: this._options.baseUrl ?? this._options.environment,
headers: this._options.headers,
timeoutInSeconds: this._options.timeoutInSeconds,
maxRetries: this._options.maxRetries,
fetch: this._options.fetch,
logging: this._options.logging,
getAuthHeaders: async () => (await this._options.authProvider.getAuthRequest()).headers,
},
requestOptions,
);
}
}
16 changes: 8 additions & 8 deletions src/management/api/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5809,7 +5809,7 @@ export interface ConnectionPropertiesOptions {
/** Enable this if you have a legacy user store and you want to gradually migrate those users to the Auth0 user store */
import_mode?: boolean | undefined;
/** Stores encrypted string only configurations for connections */
configuration?: (Record<string, (string | null) | undefined> | null) | undefined;
configuration?: (Record<string, string | null> | null) | undefined;
customScripts?: Management.ConnectionCustomScripts | undefined;
authentication_methods?: (Management.ConnectionAuthenticationMethods | null) | undefined;
passkey_options?: (Management.ConnectionPasskeyOptions | null) | undefined;
Expand Down Expand Up @@ -7322,7 +7322,7 @@ export type ConnectionUpstreamAliasEnum =
* Options for adding parameters in the request to the upstream IdP
*/
export type ConnectionUpstreamParams =
| (Record<string, (Management.ConnectionUpstreamAdditionalProperties | null) | undefined> | null)
| (Record<string, Management.ConnectionUpstreamAdditionalProperties | null> | null)
| undefined;

/**
Expand Down Expand Up @@ -7407,7 +7407,7 @@ export type ConnectionWaadProtocolEnumAzureAd =
/**
* Metadata associated with the connection in the form of an object with string values (max 255 chars). Maximum of 10 metadata properties allowed.
*/
export type ConnectionsMetadata = Record<string, (string | null) | undefined>;
export type ConnectionsMetadata = Record<string, string | null>;

export interface CreateActionModuleResponseContent {
/** The unique ID of the module. */
Expand Down Expand Up @@ -10185,7 +10185,7 @@ export type DomainCertificateStatusEnum =
/**
* Domain metadata associated with the custom domain, in the form of an object with string values (max 255 chars). Maximum of 10 domain metadata properties allowed.
*/
export type DomainMetadata = Record<string, (string | null) | undefined>;
export type DomainMetadata = Record<string, string | null>;

/**
* Domain verification settings.
Expand Down Expand Up @@ -11170,7 +11170,7 @@ export type FlowActionAuth0SendRequestParamsPayloadObject = Record<string, unkno

export type FlowActionAuth0SendRequestParamsQueryParams = Record<
string,
(FlowActionAuth0SendRequestParamsQueryParams.Value | null) | undefined
FlowActionAuth0SendRequestParamsQueryParams.Value | null
>;

export namespace FlowActionAuth0SendRequestParamsQueryParams {
Expand Down Expand Up @@ -11676,7 +11676,7 @@ export type FlowActionHttpSendRequestParamsPayloadObject = Record<string, unknow

export type FlowActionHttpSendRequestParamsQueryParams = Record<
string,
(FlowActionHttpSendRequestParamsQueryParams.Value | null) | undefined
FlowActionHttpSendRequestParamsQueryParams.Value | null
>;

export namespace FlowActionHttpSendRequestParamsQueryParams {
Expand Down Expand Up @@ -17551,7 +17551,7 @@ export interface OrganizationMemberRole {
/**
* Metadata associated with the organization, in the form of an object with string values (max 255 chars). Maximum of 25 metadata properties allowed.
*/
export type OrganizationMetadata = Record<string, (string | null) | undefined>;
export type OrganizationMetadata = Record<string, string | null>;

/** Defines whether organizations can be used with client credentials exchanges for this grant. */
export const OrganizationUsageEnum = {
Expand Down Expand Up @@ -20060,7 +20060,7 @@ export interface UpdateConnectionOptions {
/** Enable this if you have a legacy user store and you want to gradually migrate those users to the Auth0 user store */
import_mode?: boolean | undefined;
/** Stores encrypted string only configurations for connections */
configuration?: (Record<string, (string | null) | undefined> | null) | undefined;
configuration?: (Record<string, string | null> | null) | undefined;
customScripts?: Management.ConnectionCustomScripts | undefined;
authentication_methods?: (Management.ConnectionAuthenticationMethods | null) | undefined;
passkey_options?: (Management.ConnectionPasskeyOptions | null) | undefined;
Expand Down
11 changes: 8 additions & 3 deletions src/management/core/auth/BasicAuth.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { base64Decode, base64Encode } from "../base64.js";

export interface BasicAuth {
username: string;
password: string;
username?: string;
password?: string;
}

const BASIC_AUTH_HEADER_PREFIX = /^Basic /i;
Expand All @@ -12,7 +12,12 @@ export const BasicAuth = {
if (basicAuth == null) {
return undefined;
}
const token = base64Encode(`${basicAuth.username}:${basicAuth.password}`);
const username = basicAuth.username ?? "";
const password = basicAuth.password ?? "";
if (username === "" && password === "") {
return undefined;
}
const token = base64Encode(`${username}:${password}`);
return `Basic ${token}`;
},
fromAuthorizationHeader: (header: string): BasicAuth => {
Expand Down
2 changes: 1 addition & 1 deletion src/management/core/fetcher/BinaryResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export type BinaryResponse = {
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bytes)
* Some versions of the Fetch API may not support this method.
*/
bytes?(): ReturnType<Response["bytes"]>;
bytes?(): Promise<Uint8Array>;
};

export function getBinaryResponse(response: Response): BinaryResponse {
Expand Down
7 changes: 7 additions & 0 deletions src/management/core/fetcher/Fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,13 @@ export declare namespace Fetcher {

export interface TimeoutError {
reason: "timeout";
cause?: unknown;
}

export interface UnknownError {
reason: "unknown";
errorMessage: string;
cause?: unknown;
}
}

Expand Down Expand Up @@ -282,6 +284,7 @@ export async function fetcherImpl<R = unknown>(args: Fetcher.Args): Promise<APIR
args.abortSignal,
args.withCredentials,
args.duplex,
args.responseType === "streaming" || args.responseType === "sse",
),
args.maxRetries,
);
Expand Down Expand Up @@ -337,6 +340,7 @@ export async function fetcherImpl<R = unknown>(args: Fetcher.Args): Promise<APIR
error: {
reason: "unknown",
errorMessage: "The user aborted a request",
cause: error,
},
rawResponse: abortRawResponse,
};
Expand All @@ -353,6 +357,7 @@ export async function fetcherImpl<R = unknown>(args: Fetcher.Args): Promise<APIR
ok: false,
error: {
reason: "timeout",
cause: error,
},
rawResponse: abortRawResponse,
};
Expand All @@ -370,6 +375,7 @@ export async function fetcherImpl<R = unknown>(args: Fetcher.Args): Promise<APIR
error: {
reason: "unknown",
errorMessage: error.message,
cause: error,
},
rawResponse: unknownRawResponse,
};
Expand All @@ -388,6 +394,7 @@ export async function fetcherImpl<R = unknown>(args: Fetcher.Args): Promise<APIR
error: {
reason: "unknown",
errorMessage: toJson(error),
cause: error,
},
rawResponse: unknownRawResponse,
};
Expand Down
2 changes: 2 additions & 0 deletions src/management/core/fetcher/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ export type { Fetcher, FetchFunction } from "./Fetcher.js";
export { fetcher } from "./Fetcher.js";
export { getHeader } from "./getHeader.js";
export { HttpResponsePromise } from "./HttpResponsePromise.js";
export type { PassthroughRequest } from "./makePassthroughRequest.js";
export { makePassthroughRequest } from "./makePassthroughRequest.js";
export type { RawResponse, WithRawResponse } from "./RawResponse.js";
export { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.js";
export { Supplier } from "./Supplier.js";
Loading
Loading