Skip to content

Commit 30c295c

Browse files
Feat: Added CIMD client support, default custom domains, refresh token listing, and type updates (#1314)
2 parents d56b202 + 9be84ed commit 30c295c

28 files changed

Lines changed: 2676 additions & 750 deletions

File tree

reference.md

Lines changed: 417 additions & 9 deletions
Large diffs are not rendered by default.

src/management/api/requests/requests.ts

Lines changed: 89 additions & 22 deletions
Large diffs are not rendered by default.

src/management/api/resources/actions/client/Client.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export class ActionsClient {
5959
*
6060
* @example
6161
* await client.actions.list({
62-
* triggerId: "triggerId",
62+
* triggerId: "post-login",
6363
* actionName: "actionName",
6464
* deployed: true,
6565
* page: 1,
@@ -77,7 +77,7 @@ export class ActionsClient {
7777
): Promise<core.WithRawResponse<Management.ListActionsPaginatedResponseContent>> => {
7878
const { triggerId, actionName, deployed, page = 0, per_page: perPage = 50, installed } = request;
7979
const _queryParams: Record<string, unknown> = {
80-
triggerId,
80+
triggerId: triggerId !== undefined ? triggerId : undefined,
8181
actionName,
8282
deployed,
8383
page,
@@ -171,7 +171,7 @@ export class ActionsClient {
171171
* await client.actions.create({
172172
* name: "name",
173173
* supported_triggers: [{
174-
* id: "id"
174+
* id: "post-login"
175175
* }]
176176
* })
177177
*/

src/management/api/resources/actions/resources/triggers/resources/bindings/client/Client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export class BindingsClient {
3838
* @throws {@link Management.TooManyRequestsError}
3939
*
4040
* @example
41-
* await client.actions.triggers.bindings.list("triggerId", {
41+
* await client.actions.triggers.bindings.list("post-login", {
4242
* page: 1,
4343
* per_page: 1
4444
* })
@@ -147,7 +147,7 @@ export class BindingsClient {
147147
* @throws {@link Management.TooManyRequestsError}
148148
*
149149
* @example
150-
* await client.actions.triggers.bindings.updateMany("triggerId")
150+
* await client.actions.triggers.bindings.updateMany("post-login")
151151
*/
152152
public updateMany(
153153
triggerId: Management.ActionTriggerTypeEnum,

src/management/api/resources/clientGrants/client/Client.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@ export class ClientGrantsClient {
155155
*
156156
* @example
157157
* await client.clientGrants.create({
158-
* client_id: "client_id",
159158
* audience: "audience"
160159
* })
161160
*/

src/management/api/resources/clients/client/Client.ts

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ export class ClientsClient {
8787
* is_global: true,
8888
* is_first_party: true,
8989
* app_type: "app_type",
90+
* external_client_id: "external_client_id",
9091
* q: "q"
9192
* })
9293
*/
@@ -107,6 +108,7 @@ export class ClientsClient {
107108
is_global: isGlobal,
108109
is_first_party: isFirstParty,
109110
app_type: appType,
111+
external_client_id: externalClientId,
110112
q,
111113
} = request;
112114
const _queryParams: Record<string, unknown> = {
@@ -118,6 +120,7 @@ export class ClientsClient {
118120
is_global: isGlobal,
119121
is_first_party: isFirstParty,
120122
app_type: appType,
123+
external_client_id: externalClientId,
121124
q,
122125
};
123126
const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest();
@@ -289,6 +292,181 @@ export class ClientsClient {
289292
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/clients");
290293
}
291294

295+
/**
296+
*
297+
* Fetches and validates a Client ID Metadata Document without creating a client.
298+
* Returns the raw metadata and how it would be mapped to Auth0 client fields.
299+
* This endpoint is useful for testing metadata URIs before creating CIMD clients.
300+
*
301+
*
302+
* @param {Management.PreviewCimdMetadataRequestContent} request
303+
* @param {ClientsClient.RequestOptions} requestOptions - Request-specific configuration.
304+
*
305+
* @throws {@link Management.BadRequestError}
306+
* @throws {@link Management.UnauthorizedError}
307+
* @throws {@link Management.ForbiddenError}
308+
* @throws {@link Management.TooManyRequestsError}
309+
* @throws {@link Management.InternalServerError}
310+
*
311+
* @example
312+
* await client.clients.previewCimdMetadata({
313+
* external_client_id: "external_client_id"
314+
* })
315+
*/
316+
public previewCimdMetadata(
317+
request: Management.PreviewCimdMetadataRequestContent,
318+
requestOptions?: ClientsClient.RequestOptions,
319+
): core.HttpResponsePromise<Management.PreviewCimdMetadataResponseContent> {
320+
return core.HttpResponsePromise.fromPromise(this.__previewCimdMetadata(request, requestOptions));
321+
}
322+
323+
private async __previewCimdMetadata(
324+
request: Management.PreviewCimdMetadataRequestContent,
325+
requestOptions?: ClientsClient.RequestOptions,
326+
): Promise<core.WithRawResponse<Management.PreviewCimdMetadataResponseContent>> {
327+
const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest();
328+
let _headers: core.Fetcher.Args["headers"] = mergeHeaders(
329+
_authRequest.headers,
330+
this._options?.headers,
331+
requestOptions?.headers,
332+
);
333+
const _response = await (this._options.fetcher ?? core.fetcher)({
334+
url: core.url.join(
335+
(await core.Supplier.get(this._options.baseUrl)) ??
336+
(await core.Supplier.get(this._options.environment)) ??
337+
environments.ManagementEnvironment.Default,
338+
"clients/cimd/preview",
339+
),
340+
method: "POST",
341+
headers: _headers,
342+
contentType: "application/json",
343+
queryParameters: requestOptions?.queryParams,
344+
requestType: "json",
345+
body: request,
346+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
347+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
348+
abortSignal: requestOptions?.abortSignal,
349+
fetchFn: this._options?.fetch,
350+
logging: this._options.logging,
351+
});
352+
if (_response.ok) {
353+
return {
354+
data: _response.body as Management.PreviewCimdMetadataResponseContent,
355+
rawResponse: _response.rawResponse,
356+
};
357+
}
358+
359+
if (_response.error.reason === "status-code") {
360+
switch (_response.error.statusCode) {
361+
case 400:
362+
throw new Management.BadRequestError(_response.error.body as unknown, _response.rawResponse);
363+
case 401:
364+
throw new Management.UnauthorizedError(_response.error.body as unknown, _response.rawResponse);
365+
case 403:
366+
throw new Management.ForbiddenError(_response.error.body as unknown, _response.rawResponse);
367+
case 429:
368+
throw new Management.TooManyRequestsError(_response.error.body as unknown, _response.rawResponse);
369+
case 500:
370+
throw new Management.InternalServerError(_response.error.body as unknown, _response.rawResponse);
371+
default:
372+
throw new errors.ManagementError({
373+
statusCode: _response.error.statusCode,
374+
body: _response.error.body,
375+
rawResponse: _response.rawResponse,
376+
});
377+
}
378+
}
379+
380+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/clients/cimd/preview");
381+
}
382+
383+
/**
384+
*
385+
* Idempotent registration for Client ID Metadata Document (CIMD) clients.
386+
* Uses external_client_id as the unique identifier for upsert operations.
387+
* **Create:** Returns 201 when a new client is created (requires \
388+
*
389+
* @param {Management.RegisterCimdClientRequestContent} request
390+
* @param {ClientsClient.RequestOptions} requestOptions - Request-specific configuration.
391+
*
392+
* @throws {@link Management.BadRequestError}
393+
* @throws {@link Management.UnauthorizedError}
394+
* @throws {@link Management.ForbiddenError}
395+
* @throws {@link Management.TooManyRequestsError}
396+
* @throws {@link Management.InternalServerError}
397+
*
398+
* @example
399+
* await client.clients.registerCimdClient({
400+
* external_client_id: "external_client_id"
401+
* })
402+
*/
403+
public registerCimdClient(
404+
request: Management.RegisterCimdClientRequestContent,
405+
requestOptions?: ClientsClient.RequestOptions,
406+
): core.HttpResponsePromise<Management.RegisterCimdClientResponseContent> {
407+
return core.HttpResponsePromise.fromPromise(this.__registerCimdClient(request, requestOptions));
408+
}
409+
410+
private async __registerCimdClient(
411+
request: Management.RegisterCimdClientRequestContent,
412+
requestOptions?: ClientsClient.RequestOptions,
413+
): Promise<core.WithRawResponse<Management.RegisterCimdClientResponseContent>> {
414+
const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest();
415+
let _headers: core.Fetcher.Args["headers"] = mergeHeaders(
416+
_authRequest.headers,
417+
this._options?.headers,
418+
requestOptions?.headers,
419+
);
420+
const _response = await (this._options.fetcher ?? core.fetcher)({
421+
url: core.url.join(
422+
(await core.Supplier.get(this._options.baseUrl)) ??
423+
(await core.Supplier.get(this._options.environment)) ??
424+
environments.ManagementEnvironment.Default,
425+
"clients/cimd/register",
426+
),
427+
method: "POST",
428+
headers: _headers,
429+
contentType: "application/json",
430+
queryParameters: requestOptions?.queryParams,
431+
requestType: "json",
432+
body: request,
433+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
434+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
435+
abortSignal: requestOptions?.abortSignal,
436+
fetchFn: this._options?.fetch,
437+
logging: this._options.logging,
438+
});
439+
if (_response.ok) {
440+
return {
441+
data: _response.body as Management.RegisterCimdClientResponseContent,
442+
rawResponse: _response.rawResponse,
443+
};
444+
}
445+
446+
if (_response.error.reason === "status-code") {
447+
switch (_response.error.statusCode) {
448+
case 400:
449+
throw new Management.BadRequestError(_response.error.body as unknown, _response.rawResponse);
450+
case 401:
451+
throw new Management.UnauthorizedError(_response.error.body as unknown, _response.rawResponse);
452+
case 403:
453+
throw new Management.ForbiddenError(_response.error.body as unknown, _response.rawResponse);
454+
case 429:
455+
throw new Management.TooManyRequestsError(_response.error.body as unknown, _response.rawResponse);
456+
case 500:
457+
throw new Management.InternalServerError(_response.error.body as unknown, _response.rawResponse);
458+
default:
459+
throw new errors.ManagementError({
460+
statusCode: _response.error.statusCode,
461+
body: _response.error.body,
462+
rawResponse: _response.rawResponse,
463+
});
464+
}
465+
}
466+
467+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/clients/cimd/register");
468+
}
469+
292470
/**
293471
* Retrieve client details by ID. Clients are SSO connections or Applications linked with your Auth0 tenant. A list of fields to include or exclude may also be specified.
294472
* For more information, read <a href="https://www.auth0.com/docs/get-started/applications"> Applications in Auth0</a> and <a href="https://www.auth0.com/docs/authenticate/single-sign-on"> Single Sign-On</a>.

0 commit comments

Comments
 (0)