@@ -137,7 +137,7 @@ function asObjectiveCNumberType(label, type, asLowerCased) {
137137
138138function compatClusterNameRemapping ( cluster , options ) {
139139 cluster = appHelper . asUpperCamelCase ( cluster , {
140- hash : { preserveAcronyms : false } ,
140+ hash : { preserveAcronyms : true } ,
141141 } ) ;
142142
143143 const old = oldName . call ( this , cluster , options ) ;
@@ -151,11 +151,11 @@ function compatClusterNameRemapping(cluster, options) {
151151
152152function compatAttributeNameRemapping ( cluster , attribute , options ) {
153153 cluster = appHelper . asUpperCamelCase ( cluster , {
154- hash : { preserveAcronyms : false } ,
154+ hash : { preserveAcronyms : true } ,
155155 } ) ;
156156
157157 attribute = appHelper . asUpperCamelCase ( attribute , {
158- hash : { preserveAcronyms : false } ,
158+ hash : { preserveAcronyms : true } ,
159159 } ) ;
160160
161161 const old = oldName . call ( this , cluster , {
@@ -172,6 +172,29 @@ function compatAttributeNameRemapping(cluster, attribute, options) {
172172 return attribute ;
173173}
174174
175+ function compatCommandNameRemapping ( cluster , command , options ) {
176+ cluster = appHelper . asUpperCamelCase ( cluster , {
177+ hash : { preserveAcronyms : true } ,
178+ } ) ;
179+
180+ command = appHelper . asUpperCamelCase ( command , {
181+ hash : { preserveAcronyms : true } ,
182+ } ) ;
183+
184+ const old = oldName . call ( this , cluster , {
185+ hash : {
186+ ...options . hash ,
187+ command : command ,
188+ } ,
189+ } ) ;
190+
191+ if ( old ) {
192+ return old ;
193+ }
194+
195+ return command ;
196+ }
197+
175198/**
176199 * Figure out whether the entity represented by cluster+options (could be a
177200 * cluster, attribute, command, etc) has an old name that it was renamed from,
@@ -643,7 +666,7 @@ async function availability(clusterName, options) {
643666 throw new Error (
644667 `Deprecation needs a deprecation message for ${ clusterName } and ${ JSON . stringify (
645668 options . hash
646- ) } `
669+ ) } ( ${ this . global . templatePath } : ${ options . loc . start . line } ) `
647670 ) ;
648671 }
649672
@@ -711,6 +734,90 @@ function wasIntroducedBeforeRelease(releaseName, clusterName, options) {
711734 return data . indexOf ( introducedRelease ) < data . indexOf ( referenceRelease ) ;
712735}
713736
737+ function wasRemoved ( cluster , options ) {
738+ const data = fetchAvailabilityData ( this . global ) ;
739+ const path = makeAvailabilityPath ( cluster , options ) ;
740+
741+ let removedRelease = findReleaseForPath ( data , [ 'removed' , ...path ] , options ) ;
742+ return removedRelease !== undefined ;
743+ }
744+
745+ function and ( ) {
746+ let args = [ ...arguments ] ;
747+ // Strip off the options arg.
748+ let options = args . pop ( ) ;
749+
750+ return args . reduce ( ( running , current ) => {
751+ if ( current instanceof Promise ) {
752+ throw new Error (
753+ "Promise passed as argument to 'and'. You probably want to use async_if/async_and"
754+ ) ;
755+ }
756+ return running && current ;
757+ } , true ) ;
758+ }
759+
760+ function or ( ) {
761+ let args = [ ...arguments ] ;
762+ // Strip off the options arg.
763+ let options = args . pop ( ) ;
764+
765+ return args . reduce ( ( running , current ) => {
766+ if ( current instanceof Promise ) {
767+ throw new Error (
768+ "Promise passed as argument to 'or'. You probably want to use async_if/async_or"
769+ ) ;
770+ }
771+ return running || current ;
772+ } , false ) ;
773+ }
774+
775+ function not ( value ) {
776+ if ( value instanceof Promise ) {
777+ throw new Error (
778+ "Promise passed as argument to 'not'. You probably want to use async_if/async_not"
779+ ) ;
780+ }
781+
782+ return ! value ;
783+ }
784+
785+ async function async_if ( value , options ) {
786+ let condition = await value ;
787+ if ( condition ) {
788+ return options . fn ( this ) ;
789+ } else {
790+ return options . inverse ( this ) ;
791+ }
792+ }
793+
794+ async function async_and ( ) {
795+ let args = [ ...arguments ] ;
796+ // Strip off the options arg.
797+ let options = args . pop ( ) ;
798+
799+ let booleans = await Promise . all ( args ) ;
800+ return booleans . reduce ( ( running , current ) => {
801+ return running && current ;
802+ } , true ) ;
803+ }
804+
805+ async function async_or ( ) {
806+ let args = [ ...arguments ] ;
807+ // Strip off the options arg.
808+ let options = args . pop ( ) ;
809+
810+ let booleans = await Promise . all ( args ) ;
811+ return booleans . reduce ( ( running , current ) => {
812+ return running || current ;
813+ } , false ) ;
814+ }
815+
816+ async function async_not ( value ) {
817+ let toBeNegated = await value ;
818+ return ! toBeNegated ;
819+ }
820+
714821//
715822// Module exports
716823//
@@ -727,8 +834,17 @@ exports.objCEnumItemLabel = objCEnumItemLabel;
727834exports . hasArguments = hasArguments ;
728835exports . compatClusterNameRemapping = compatClusterNameRemapping ;
729836exports . compatAttributeNameRemapping = compatAttributeNameRemapping ;
837+ exports . compatCommandNameRemapping = compatCommandNameRemapping ;
730838exports . availability = availability ;
731839exports . wasIntroducedBeforeRelease = wasIntroducedBeforeRelease ;
840+ exports . wasRemoved = wasRemoved ;
841+ exports . and = and ;
842+ exports . or = or ;
843+ exports . not = not ;
844+ exports . async_if = async_if ;
845+ exports . async_and = async_and ;
846+ exports . async_or = async_or ;
847+ exports . async_not = async_not ;
732848
733849exports . meta = {
734850 category : dbEnum . helperCategory . matter ,
0 commit comments