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
14 changes: 7 additions & 7 deletions src/action/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ export async function handler(event: CdkCustomResourceEvent) {
runtime: event.ResourceProperties.runtime,
secrets: event.ResourceProperties.secrets,
})
).data.id;
).id;

while ((await auth0.actions.get({ id: id })).data.status !== "built") {
while ((await auth0.actions.get(id)).status !== "built") {
await timeout(5000);
}

await auth0.actions.deploy({ id: id });
await auth0.actions.deploy(id);

return {
PhysicalResourceId: id,
Expand All @@ -57,7 +57,7 @@ export async function handler(event: CdkCustomResourceEvent) {
}
case "Update": {
await auth0.actions.update(
{ id: event.PhysicalResourceId },
event.PhysicalResourceId,
{
name: event.ResourceProperties.name,
code: event.ResourceProperties.code,
Expand All @@ -69,13 +69,13 @@ export async function handler(event: CdkCustomResourceEvent) {
);

while (
(await auth0.actions.get({ id: event.PhysicalResourceId })).data
(await auth0.actions.get(event.PhysicalResourceId))
.status !== "built"
) {
await timeout(5000);
}

await auth0.actions.deploy({ id: event.PhysicalResourceId });
await auth0.actions.deploy(event.PhysicalResourceId);

return {
PhysicalResourceId: event.PhysicalResourceId,
Expand All @@ -85,7 +85,7 @@ export async function handler(event: CdkCustomResourceEvent) {
};
}
case "Delete": {
await auth0.actions.delete({ id: event.PhysicalResourceId, force: true });
await auth0.actions.delete(event.PhysicalResourceId, { force: true });

return {
PhysicalResourceId: event.PhysicalResourceId,
Expand Down
4 changes: 2 additions & 2 deletions src/branding-settings/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export async function handler(event: CdkCustomResourceEvent) {

switch (event.RequestType) {
case "Create": {
await auth0.branding.updateSettings({
await auth0.branding.update({
logo_url: event.ResourceProperties.logoUrl,
favicon_url: event.ResourceProperties.faviconUrl,
colors: event.ResourceProperties.colors,
Expand All @@ -41,7 +41,7 @@ export async function handler(event: CdkCustomResourceEvent) {
};
}
case "Update": {
await auth0.branding.updateSettings({
await auth0.branding.update({
logo_url: event.ResourceProperties.logoUrl,
favicon_url: event.ResourceProperties.faviconUrl,
colors: event.ResourceProperties.colors,
Expand Down
10 changes: 5 additions & 5 deletions src/branding-theme/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export async function handler(event: CdkCustomResourceEvent) {
switch (event.RequestType) {
case "Create": {
const id = (
await auth0.branding.createTheme({
await auth0.branding.themes.create({
displayName: event.ResourceProperties.displayName,
colors: {
base_focus_color: event.ResourceProperties.colors.baseFocusColor,
Expand Down Expand Up @@ -127,7 +127,7 @@ export async function handler(event: CdkCustomResourceEvent) {
page_layout: event.ResourceProperties.pageBackground.pageLayout,
},
})
).data.themeId;
).themeId;

return {
PhysicalResourceId: id,
Expand All @@ -137,8 +137,8 @@ export async function handler(event: CdkCustomResourceEvent) {
};
}
case "Update": {
await auth0.branding.updateTheme(
{ themeId: event.PhysicalResourceId },
await auth0.branding.themes.update(
event.PhysicalResourceId,
{
displayName: event.ResourceProperties.displayName,
colors: {
Expand Down Expand Up @@ -248,7 +248,7 @@ export async function handler(event: CdkCustomResourceEvent) {
};
}
case "Delete": {
await auth0.branding.deleteTheme({ themeId: event.PhysicalResourceId });
await auth0.branding.themes.delete(event.PhysicalResourceId);

return {
PhysicalResourceId: event.PhysicalResourceId,
Expand Down
8 changes: 3 additions & 5 deletions src/client-grant/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export async function handler(event: CdkCustomResourceEvent) {
`https://${auth0Api.domain}/api/v2/`,
scope: event.ResourceProperties.scope,
})
).data.id;
).id;

return {
PhysicalResourceId: id,
Expand All @@ -60,7 +60,7 @@ export async function handler(event: CdkCustomResourceEvent) {
}

await auth0.clientGrants.update(
{ id: event.PhysicalResourceId },
event.PhysicalResourceId,
{
scope: event.ResourceProperties.scope,
},
Expand All @@ -74,9 +74,7 @@ export async function handler(event: CdkCustomResourceEvent) {
};
}
case "Delete": {
await auth0.clientGrants.delete({
id: event.PhysicalResourceId,
});
await auth0.clientGrants.delete(event.PhysicalResourceId);

return {
PhysicalResourceId: event.PhysicalResourceId,
Expand Down
10 changes: 5 additions & 5 deletions src/client/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export async function handler(event: CdkCustomResourceEvent) {
organization_require_behavior:
event.ResourceProperties.organizationRequireBehavior,
})
).data;
);

return {
PhysicalResourceId: client.client_id,
Expand All @@ -116,7 +116,7 @@ export async function handler(event: CdkCustomResourceEvent) {
}
case "Update": {
await auth0.clients.update(
{ client_id: event.PhysicalResourceId },
event.PhysicalResourceId,
{
name: event.ResourceProperties.name || event.LogicalResourceId,
description: event.ResourceProperties.description,
Expand Down Expand Up @@ -180,8 +180,8 @@ export async function handler(event: CdkCustomResourceEvent) {
);

const client = (
await auth0.clients.get({ client_id: event.PhysicalResourceId })
).data;
await auth0.clients.get(event.PhysicalResourceId)
);

return {
PhysicalResourceId: event.PhysicalResourceId,
Expand All @@ -200,7 +200,7 @@ export async function handler(event: CdkCustomResourceEvent) {
};
}
case "Delete": {
await auth0.clients.delete({ client_id: event.PhysicalResourceId });
await auth0.clients.delete(event.PhysicalResourceId);

return {
PhysicalResourceId: event.PhysicalResourceId,
Expand Down
12 changes: 5 additions & 7 deletions src/connection/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export async function handler(event: CdkCustomResourceEvent) {
const connection = (
event.ResourceProperties.connectionId
? await auth0.connections.update(
{ id: event.ResourceProperties.connectionId },
event.ResourceProperties.connectionId,
{
display_name: event.ResourceProperties.displayName,
enabled_clients: event.ResourceProperties.enabledClients,
Expand All @@ -54,7 +54,7 @@ export async function handler(event: CdkCustomResourceEvent) {
event.ResourceProperties.disableSignup === "true",
},
})
).data;
);

return {
PhysicalResourceId: connection.id,
Expand All @@ -78,7 +78,7 @@ export async function handler(event: CdkCustomResourceEvent) {

const connection = (
await auth0.connections.update(
{ id: event.PhysicalResourceId },
event.PhysicalResourceId,
{
display_name: event.ResourceProperties.displayName,
enabled_clients: event.ResourceProperties.enabledClients,
Expand All @@ -89,7 +89,7 @@ export async function handler(event: CdkCustomResourceEvent) {
},
},
)
).data;
);

return {
PhysicalResourceId: event.PhysicalResourceId,
Expand All @@ -101,9 +101,7 @@ export async function handler(event: CdkCustomResourceEvent) {
}
case "Delete": {
if (event.ResourceProperties.deletionProtection !== "true") {
await auth0.connections.delete({
id: event.PhysicalResourceId,
});
await auth0.connections.delete(event.PhysicalResourceId);
}

return {
Expand Down
8 changes: 4 additions & 4 deletions src/custom-domain/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export async function handler(event: CdkCustomResourceEvent) {
custom_client_ip_header:
event.ResourceProperties.customClientIpHeader,
})
).data;
);

return {
PhysicalResourceId: customDomain.custom_domain_id,
Expand All @@ -50,14 +50,14 @@ export async function handler(event: CdkCustomResourceEvent) {
case "Update": {
const customDomain = (
await auth0.customDomains.update(
{ id: event.PhysicalResourceId },
event.PhysicalResourceId,
{
tls_policy: event.ResourceProperties.tlsPolicy,
custom_client_ip_header:
event.ResourceProperties.customClientIpHeader,
},
)
).data;
);

return {
PhysicalResourceId: event.PhysicalResourceId,
Expand All @@ -69,7 +69,7 @@ export async function handler(event: CdkCustomResourceEvent) {
};
}
case "Delete": {
await auth0.customDomains.delete({ id: event.PhysicalResourceId });
await auth0.customDomains.delete(event.PhysicalResourceId);

return {
PhysicalResourceId: event.PhysicalResourceId,
Expand Down
10 changes: 5 additions & 5 deletions src/email-provider/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@ export async function handler(event: CdkCustomResourceEvent) {

switch (event.RequestType) {
case "Create": {
if (((await auth0.emails.get()).data.name?.trim()?.length || 0) > 0) {
await auth0.emails.update({
if (((await auth0.emails.provider.get()).name?.trim()?.length || 0) > 0) {
await auth0.emails.provider.update({
name: event.ResourceProperties.name,
enabled: true,
default_from_address: event.ResourceProperties.defaultFromAddress,
credentials: credentials,
});
} else {
await auth0.emails.configure({
await auth0.emails.provider.create({
name: event.ResourceProperties.name,
enabled: true,
default_from_address: event.ResourceProperties.defaultFromAddress,
Expand All @@ -108,7 +108,7 @@ export async function handler(event: CdkCustomResourceEvent) {
return;
}
case "Update": {
await auth0.emails.update({
await auth0.emails.provider.update({
name: event.ResourceProperties.name,
enabled: true,
default_from_address: event.ResourceProperties.defaultFromAddress,
Expand All @@ -118,7 +118,7 @@ export async function handler(event: CdkCustomResourceEvent) {
return;
}
case "Delete": {
await auth0.emails.update({
await auth0.emails.provider.update({
enabled: false,
});

Expand Down
4 changes: 2 additions & 2 deletions src/email-template/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export async function handler(event: CdkCustomResourceEvent) {
`${event.ResourceProperties.template} already created, updating email template.`,
);
await auth0.emailTemplates.update(
{ templateName: event.ResourceProperties.template },
event.ResourceProperties.template,
body,
);
} else {
Expand All @@ -67,7 +67,7 @@ export async function handler(event: CdkCustomResourceEvent) {
}
case "Update": {
await auth0.emailTemplates.update(
{ templateName: event.ResourceProperties.template },
event.ResourceProperties.template,
{
template: event.ResourceProperties.template,
body: event.ResourceProperties.body,
Expand Down
8 changes: 4 additions & 4 deletions src/organization/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export async function handler(event: CdkCustomResourceEvent) {
]
: [],
})
).data;
);

return {
PhysicalResourceId: organization.id,
Expand All @@ -75,7 +75,7 @@ export async function handler(event: CdkCustomResourceEvent) {

const organization = (
await auth0.organizations.update(
{ id: event.PhysicalResourceId },
event.PhysicalResourceId,
{
name: event.ResourceProperties.name,
display_name: event.ResourceProperties.displayName,
Expand All @@ -92,7 +92,7 @@ export async function handler(event: CdkCustomResourceEvent) {
metadata: event.ResourceProperties.metadata || [],
},
)
).data;
);

return {
PhysicalResourceId: organization.id,
Expand All @@ -102,7 +102,7 @@ export async function handler(event: CdkCustomResourceEvent) {
};
}
case "Delete": {
await auth0.organizations.delete({ id: event.PhysicalResourceId });
await auth0.organizations.delete(event.PhysicalResourceId);

return {
PhysicalResourceId: event.PhysicalResourceId,
Expand Down
4 changes: 2 additions & 2 deletions src/prompt-settings/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export async function handler(event: CdkCustomResourceEvent) {

switch (event.RequestType) {
case "Create": {
await auth0.prompts.update({
await auth0.prompts.updateSettings({
universal_login_experience:
event.ResourceProperties.universalLoginExperience,
identifier_first: event.ResourceProperties.identifierFirst === "true",
Expand All @@ -40,7 +40,7 @@ export async function handler(event: CdkCustomResourceEvent) {
};
}
case "Update": {
await auth0.prompts.update({
await auth0.prompts.updateSettings({
universal_login_experience:
event.ResourceProperties.universalLoginExperience,
identifier_first: event.ResourceProperties.identifierFirst === "true",
Expand Down
Loading
Loading