@@ -81,8 +81,11 @@ bldrgen.AccessPlan.prototype.col = function(...args) {
8181class Builder extends bldrgen . PlanBuilder {
8282 constructor ( ) {
8383 super ( { } ) ;
84- bldrgen . rdt = ( bldrgen . rdt !== void 0 ) ? bldrgen . rdt : new RdtExpr ( ) ;
84+ if ( this . rdt === void 0 ) {
85+ this . rdt = new RdtExpr ( ) ;
86+ }
8587 }
88+
8689 prefixer ( base ) {
8790 const self = this ;
8891
@@ -115,114 +118,96 @@ class RdtExpr {
115118 * Controls features such as the length and type of the generated value.
116119 * @method planBuilder#maskDeterministic
117120 * @since 2.7.0
118- * @param { PlanColumnName } [column] - The name of the column to be defined.
119- * This can be either a string or the return value from PlanBuilder.col(), PlanBuilder.viewCol() or PlanBuilder.schemaCol().
120- * @param { Item } [options] - An object with name-value pairs specific to the redaction method.
121+ * @param args - Options for redacting.
121122 * @returns { planBuilder.PlanExprCol }
122123 */
123- maskDeterministic ( column , options ) {
124- return redactimpl ( 'maskDeterministic' , 'mask-deterministic' , column , options ) ;
124+ maskDeterministic ( ... args ) {
125+ return redactimpl ( 'maskDeterministic' , 'mask-deterministic' , 1 , args ) ;
125126 }
126127 /** This function replaces values with random text. The masking value can vary across repeated application to the same input value.
127128 * Controls the length of the generated value and type of replacement text (numbers or letters).
128129 * @method planBuilder#maskRandom
129130 * @since 2.7.0
130- * @param { PlanColumnName } [column] - The name of the column to be defined.
131- * This can be either a string or the return value from PlanBuilder.col(), PlanBuilder.viewCol() or PlanBuilder.schemaCol().
132- * @param { Item } [options] - An object with name-value pairs specific to the redaction method.
131+ * @param args - Options for redacting.
133132 * @returns { planBuilder.PlanExprCol }
134133 */
135- maskRandom ( column , options ) {
136- return redactimpl ( 'maskRandom' , 'mask-random' , column , options ) ;
134+ maskRandom ( ... args ) {
135+ return redactimpl ( 'maskRandom' , 'mask-random' , 1 , args ) ;
137136 }
138137 /** This function redacts data that matches the pattern of a dateTime value. Controls the expected input format and the masking dateTime format.
139138 * @method planBuilder#redactDatetime
140139 * @since 2.7.0
141- * @param { PlanColumnName } [column] - The name of the column to be defined.
142- * This can be either a string or the return value from PlanBuilder.col(), PlanBuilder.viewCol() or PlanBuilder.schemaCol().
143- * @param { Item } [options] - An object with name-value pairs specific to the redaction method.
140+ * @param args - Options for redacting.
144141 * @returns { planBuilder.PlanExprCol }
145142 */
146- redactDatetime ( column , options ) {
147- return redactimpl ( 'redactDatetime' , 'redact-datetime' , column , options ) ;
143+ redactDatetime ( ... args ) {
144+ return redactimpl ( 'redactDatetime' , 'redact-datetime' , 2 , args ) ;
148145 }
149146 /** This function redacts data that matches the pattern of an email address.
150147 * Controls whether to mask the entire address, only the username, or only the domain name.
151148 * @method planBuilder#redactEmail
152149 * @since 2.7.0
153- * @param { PlanColumnName } [column] - The name of the column to be defined.
154- * This can be either a string or the return value from PlanBuilder.col(), PlanBuilder.viewCol() or PlanBuilder.schemaCol().
155- * @param { Item } [options] - An object with name-value pairs specific to the redaction method.
150+ * @param args - Options for redacting.
156151 * @returns { planBuilder.PlanExprCol }
157152 */
158- redactEmail ( column , options ) {
159- return redactimpl ( 'redactEmail' , 'redact-email' , column , options ) ;
153+ redactEmail ( ... args ) {
154+ return redactimpl ( 'redactEmail' , 'redact-email' , 1 , args ) ;
160155 }
161156 /** This function redacts data that matches the pattern of an IPv4 address. Controls what character to use as a masking character.
162157 * @method planBuilder#redactIpv4
163158 * @since 2.7.0
164- * @param { PlanColumnName } [column] - The name of the column to be defined.
165- * This can be either a string or the return value from PlanBuilder.col(), PlanBuilder.viewCol() or PlanBuilder.schemaCol().
166- * @param { Item } [options] - An object with name-value pairs specific to the redaction method.
159+ * @param args - Options for redacting.
167160 * @returns { planBuilder.PlanExprCol }
168161 */
169- redactIpv4 ( column , options ) {
170- return redactimpl ( 'redactIpv4' , 'redact-ipv4' , column , options ) ;
162+ redactIpv4 ( ... args ) {
163+ return redactimpl ( 'redactIpv4' , 'redact-ipv4' , 1 , args ) ;
171164 }
172165 /** This function replaces values with random numbers. Controls the data type, range, and format of the masking values.
173166 * @method planBuilder#redactNumber
174167 * @since 2.7.0
175- * @param { PlanColumnName } [column] - The name of the column to be defined.
176- * This can be either a string or the return value from PlanBuilder.col(), PlanBuilder.viewCol() or PlanBuilder.schemaCol().
177- * @param { Item } [options] - An object with name-value pairs specific to the redaction method.
168+ * @param args - Options for redacting.
178169 * @returns { planBuilder.PlanExprCol }
179170 */
180- redactNumber ( column , options ) {
181- return redactimpl ( 'redactNumber' , 'redact-number' , column , options ) ;
171+ redactNumber ( ... args ) {
172+ return redactimpl ( 'redactNumber' , 'redact-number' , 1 , args ) ;
182173 }
183174 /** This function redacts data that matches a given regular expression. You must specify the regular expression and the masking text.
184175 * @method planBuilder#redactRegex
185176 * @since 2.7.0
186- * @param { PlanColumnName } [column] - The name of the column to be defined.
187- * This can be either a string or the return value from PlanBuilder.col(), PlanBuilder.viewCol() or PlanBuilder.schemaCol().
188- * @param { Item } [options] - An object with name-value pairs specific to the redaction method.
177+ * @param args - Options for redacting.
189178 * @returns { planBuilder.PlanExprCol }
190179 */
191- redactRegex ( column , options ) {
192- return redactimpl ( 'redactRegex' , 'redact-regex' , column , options ) ;
180+ redactRegex ( ... args ) {
181+ return redactimpl ( 'redactRegex' , 'redact-regex' , 2 , args ) ;
193182 }
194183 /** This function redacts data that matches the pattern of a US Social Security Number (SSN).
195184 * Controls whether or not to preserve the last 4 digits and what character to use as a masking character.
196185 * @method planBuilder#redactUsSsn
197186 * @since 2.7.0
198- * @param { PlanColumnName } [column] - The name of the column to be defined.
199- * This can be either a string or the return value from PlanBuilder.col(), PlanBuilder.viewCol() or PlanBuilder.schemaCol().
200- * @param { Item } [options] - An object with name-value pairs specific to the redaction method.
187+ * @param args - Options for redacting.
201188 * @returns { planBuilder.PlanExprCol }
202189 */
203- redactUsSsn ( column , options ) {
204- return redactimpl ( 'redactUsSsn' , 'redact-us-ssn' , column , options ) ;
190+ redactUsSsn ( ... args ) {
191+ return redactimpl ( 'redactUsSsn' , 'redact-us-ssn' , 1 , args ) ;
205192 }
206193 /** This function redacts data that matches the pattern of a US telephone number.
207194 * Controls whether or not to preserve the last 4 digits and what character to use as a masking character.
208195 * @method planBuilder#redactUsPhone
209196 * @since 2.7.0
210- * @param { PlanColumnName } [column] - The name of the column to be defined.
211- * This can be either a string or the return value from PlanBuilder.col(), PlanBuilder.viewCol() or PlanBuilder.schemaCol().
212- * @param { Item } [options] - An object with name-value pairs specific to the redaction method.
197+ * @param args - Options for redacting.
213198 * @returns { planBuilder.PlanExprCol }
214199 */
215- redactUsPhone ( column , options ) {
216- return redactimpl ( 'redactUsPhone' , 'redact-us-phone' , column , options ) ;
200+ redactUsPhone ( ... args ) {
201+ return redactimpl ( 'redactUsPhone' , 'redact-us-phone' , 1 , args ) ;
217202 }
218203}
219204
220- function redactimpl ( clientName , serverName , column , options ) {
221- const namer = bldrbase . getNamer ( options , 'column' ) ;
205+ function redactimpl ( clientName , serverName , minArity , args ) {
206+ const namer = bldrbase . getNamer ( args , 'column' ) ;
222207 const paramdefs = [ [ 'column' , [ bldrgen . PlanColumn , types . XsString ] , true , false ] , [ 'option' , [ ] , false , false ] ] ;
223208 const checkedArgs = ( namer !== null ) ?
224- bldrbase . makeNamedArgs ( namer , `PlanBuilder.${ clientName } ` , 2 , new Set ( [ 'column' , 'expression ' ] ) , paramdefs , options ) :
225- bldrbase . makePositionalArgs ( `PlanBuilder.${ clientName } ` , 2 , false , paramdefs , options ) ;
209+ bldrbase . makeNamedArgs ( namer , `PlanBuilder.${ clientName } ` , minArity , new Set ( [ 'column' , 'options ' ] ) , paramdefs , args ) :
210+ bldrbase . makePositionalArgs ( `PlanBuilder.${ clientName } ` , minArity , false , paramdefs , args ) ;
226211 return new bldrgen . PlanExprCol ( 'ordt' , serverName , checkedArgs ) ;
227212}
228213
0 commit comments