File tree Expand file tree Collapse file tree 2 files changed +3
-9
lines changed
x-pack/platform/plugins/shared/integration_assistant/server/integration_builder Expand file tree Collapse file tree 2 files changed +3
-9
lines changed Original file line number Diff line number Diff line change @@ -292,12 +292,6 @@ describe('isValidName', () => {
292292 expect ( isValidName ( 'anotherValidName' ) ) . toBe ( true ) ;
293293 } ) ;
294294
295- it ( 'should return false for names with numbers' , ( ) => {
296- expect ( isValidName ( 'invalid123' ) ) . toBe ( false ) ;
297- expect ( isValidName ( '123invalid' ) ) . toBe ( false ) ;
298- expect ( isValidName ( 'invalid_123' ) ) . toBe ( false ) ;
299- } ) ;
300-
301295 it ( 'should return false for empty string' , ( ) => {
302296 expect ( isValidName ( '' ) ) . toBe ( false ) ;
303297 } ) ;
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ export async function buildPackage(integration: Integration): Promise<Buffer> {
3636
3737 if ( ! isValidName ( integration . name ) ) {
3838 throw new Error (
39- `Invalid integration name: ${ integration . name } , Should only contain letters and underscores`
39+ `Invalid integration name: ${ integration . name } , Should only contain letters, numbers and underscores`
4040 ) ;
4141 }
4242
@@ -49,7 +49,7 @@ export async function buildPackage(integration: Integration): Promise<Buffer> {
4949 const dataStreamName = dataStream . name ;
5050 if ( ! isValidName ( dataStreamName ) ) {
5151 throw new Error (
52- `Invalid datastream name: ${ dataStreamName } , Should only contain letters and underscores`
52+ `Invalid datastream name: ${ dataStreamName } , Should only contain letters, numbers and underscores`
5353 ) ;
5454 }
5555 const specificDataStreamDir = joinPath ( dataStreamsDir , dataStreamName ) ;
@@ -77,7 +77,7 @@ export async function buildPackage(integration: Integration): Promise<Buffer> {
7777 return zipBuffer ;
7878}
7979export function isValidName ( input : string ) : boolean {
80- const regex = / ^ [ a - z A - Z _ ] + $ / ;
80+ const regex = / ^ [ a - z A - Z 0 - 9 _ ] + $ / ;
8181 return input . length > 0 && regex . test ( input ) ;
8282}
8383function createDirectories (
You can’t perform that action at this time.
0 commit comments