11import { CustomDomain } from 'auth0' ;
22import DefaultAPIHandler , { order } from './default' ;
33import { Asset , Assets } from '../../../types' ;
4+ import log from '../../../logger' ;
45
56export const schema = {
67 type : 'array' ,
@@ -18,6 +19,17 @@ export const schema = {
1819 status : { type : 'string' , enum : [ 'pending_verification' , 'ready' , 'disabled' , 'pending' ] } ,
1920 type : { type : 'string' , enum : [ 'auth0_managed_certs' , 'self_managed_certs' ] } ,
2021 verification : { type : 'object' } ,
22+ tls_policy : {
23+ type : 'string' ,
24+ description : 'Custom domain TLS policy. Must be `recommended`, includes TLS 1.2.' ,
25+ defaultValue : 'recommended' ,
26+ } ,
27+ domain_metadata : {
28+ type : 'object' ,
29+ description : 'Domain metadata associated with the custom domain.' ,
30+ defaultValue : undefined ,
31+ maxProperties : 10 ,
32+ } ,
2133 } ,
2234 required : [ 'domain' , 'type' ] ,
2335 } ,
@@ -31,10 +43,13 @@ export default class CustomDomainsHadnler extends DefaultAPIHandler {
3143 ...config ,
3244 type : 'customDomains' ,
3345 id : 'custom_domain_id' ,
34- identifiers : [ 'domain' ] ,
46+ identifiers : [ 'custom_domain_id' , ' domain'] ,
3547 stripCreateFields : [ 'status' , 'primary' , 'verification' ] ,
48+ stripUpdateFields : [ 'status' , 'primary' , 'verification' , 'type' , 'domain' ] ,
3649 functions : {
3750 delete : ( args ) => this . client . customDomains . delete ( { id : args . custom_domain_id } ) ,
51+ update : ( args , data ) =>
52+ this . client . customDomains . update ( { id : args . custom_domain_id } , data ) ,
3853 } ,
3954 } ) ;
4055 }
@@ -71,29 +86,21 @@ export default class CustomDomainsHadnler extends DefaultAPIHandler {
7186 const { customDomains } = assets ;
7287
7388 if ( ! customDomains ) return ;
74- const changes = await this . calcChanges ( assets ) . then ( ( changes ) => {
75- const changesWithoutUpdates = {
76- ...changes ,
77- create : changes . create . map ( ( customDomainToCreate ) => {
78- const newCustomDomain = { ...customDomainToCreate } ;
79- if ( customDomainToCreate . custom_client_ip_header === null ) {
80- delete newCustomDomain . custom_client_ip_header ;
81- }
8289
83- return newCustomDomain ;
84- } ) ,
85- delete : changes . del . map ( ( deleteToMake ) => {
86- const deleteWithSDKCompatibleID = {
87- ... deleteToMake ,
88- id : deleteToMake . custom_domain_id ,
89- } ;
90- delete deleteWithSDKCompatibleID [ 'custom_domain_id' ] ;
91- return deleteWithSDKCompatibleID ;
92- } ) ,
93- update : [ ] , //Do not perform custom domain updates because not supported by SDK
94- } ;
95- return changesWithoutUpdates ;
96- } ) ;
90+ // Deprecation warnings for custom domains
91+ if ( customDomains . some ( ( customDomain ) => customDomain . primary != null ) ) {
92+ log . warn (
93+ 'The "primary" field is deprecated and may be removed in future versions for "customDomains"'
94+ ) ;
95+ }
96+
97+ if ( customDomains . some ( ( customDomain ) => 'verification_method' in customDomain ) ) {
98+ log . warn (
99+ 'The "verification_method" field is deprecated and may be removed in future versions for "customDomains"'
100+ ) ;
101+ }
102+
103+ const changes = await this . calcChanges ( assets ) ;
97104
98105 await super . processChanges ( assets , changes ) ;
99106 }
0 commit comments