-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into licensing/unskip-license-change-test
- Loading branch information
Showing
69 changed files
with
935 additions
and
367 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { fold } from 'fp-ts/lib/Either'; | ||
import { identity } from 'fp-ts/lib/function'; | ||
import { pipe } from 'fp-ts/lib/pipeable'; | ||
import { Context, Errors, IntersectionType, Type, UnionType, ValidationError } from 'io-ts'; | ||
|
||
type ErrorFactory = (message: string) => Error; | ||
|
||
const getErrorPath = ([first, ...rest]: Context): string[] => { | ||
if (typeof first === 'undefined') { | ||
return []; | ||
} else if (first.type instanceof IntersectionType) { | ||
const [, ...next] = rest; | ||
return getErrorPath(next); | ||
} else if (first.type instanceof UnionType) { | ||
const [, ...next] = rest; | ||
return [first.key, ...getErrorPath(next)]; | ||
} | ||
|
||
return [first.key, ...getErrorPath(rest)]; | ||
}; | ||
|
||
const getErrorType = ({ context }: ValidationError) => | ||
context[context.length - 1]?.type?.name ?? 'unknown'; | ||
|
||
const formatError = (error: ValidationError) => | ||
error.message ?? | ||
`in ${getErrorPath(error.context).join('/')}: ${JSON.stringify( | ||
error.value | ||
)} does not match expected type ${getErrorType(error)}`; | ||
|
||
export const formatErrors = (errors: ValidationError[]) => | ||
`Failed to validate: \n${errors.map((error) => ` ${formatError(error)}`).join('\n')}`; | ||
|
||
export const createPlainError = (message: string) => new Error(message); | ||
|
||
export const throwErrors = (createError: ErrorFactory) => (errors: Errors) => { | ||
throw createError(formatErrors(errors)); | ||
}; | ||
|
||
export const decodeOrThrow = | ||
<DecodedValue, EncodedValue, InputValue>( | ||
runtimeType: Type<DecodedValue, EncodedValue, InputValue>, | ||
createError: ErrorFactory = createPlainError | ||
) => | ||
(inputValue: InputValue) => | ||
pipe(runtimeType.decode(inputValue), fold(throwErrors(createError), identity)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/env bash | ||
|
||
args=("$@") | ||
re2_version=${args[0]} | ||
|
||
if [ -z "$re2_version" ]; then | ||
echo "Usage: ./download_re2.sh [re2_version]" | ||
exit 1 | ||
fi | ||
|
||
archs=( | ||
"darwin-arm64" | ||
"darwin-x64" | ||
"linux-musl-x64" | ||
"linux-x64" | ||
"win32-x64" | ||
) | ||
node_api_versions=( 108 115 ) | ||
formats=( "br" "gz" ) | ||
|
||
echo "Downloading builds of re2 version ${re2_version} to /tmp/re2" | ||
mkdir /tmp/re2 | ||
|
||
for node_api_version in "${node_api_versions[@]}"; do | ||
echo " Node.js API version ${node_api_version}" | ||
|
||
for arch in "${archs[@]}"; do | ||
for format in "${formats[@]}"; do | ||
url="https://github.com/uhop/node-re2/releases/download/${re2_version}/${arch}-${node_api_version}.${format}" | ||
echo " ${url}" | ||
(cd /tmp/re2 && curl -s -L -O "${url}") | ||
done | ||
done | ||
done | ||
|
||
echo | ||
echo "Calculating shasums for downloaded artifacts..." | ||
echo | ||
shasum -a 256 /tmp/re2/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 0 additions & 6 deletions
6
src/plugins/presentation_util/public/components/data_view_picker/data_view_picker.scss
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 4 additions & 5 deletions
9
src/plugins/presentation_util/public/components/field_picker/field_picker.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 0 additions & 7 deletions
7
src/plugins/presentation_util/public/components/field_picker/field_type_filter.scss
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.