File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -753,6 +753,19 @@ class MetadataType {
753753 return false ;
754754 }
755755
756+ /**
757+ * helper for {@link MetadataType.upsert} to enforce max key length
758+ *
759+ * @param {string } metadataKey key of metadata
760+ */
761+ static enforceMaxKeyLength ( metadataKey ) {
762+ if ( this . definition . maxKeyLength && metadataKey . length > this . definition . maxKeyLength ) {
763+ throw new Error (
764+ `key exceeds maximum length of ${ this . definition . maxKeyLength } characters for this type`
765+ ) ;
766+ }
767+ }
768+
756769 /**
757770 * MetadataType upsert, after retrieving from target and comparing to check if create or update operation is needed.
758771 *
@@ -774,6 +787,7 @@ class MetadataType {
774787 // preDeployTasks parsing
775788 let deployableMetadata ;
776789 try {
790+ this . enforceMaxKeyLength ( metadataKey ) ;
777791 metadataMap [ metadataKey ] = await this . validation (
778792 'deploy' ,
779793 metadataMap [ metadataKey ] ,
You can’t perform that action at this time.
0 commit comments